Revert "Use tizen_base::Bundle" 31/204531/1
authorMyungKi Lee <mk5004.lee@samsung.com>
Wed, 24 Apr 2019 06:56:40 +0000 (06:56 +0000)
committerMyungKi Lee <mk5004.lee@samsung.com>
Wed, 24 Apr 2019 06:56:40 +0000 (06:56 +0000)
This reverts commit 9a1af78ffd05e971c40bf1cae4866f95da951490.

Change-Id: Ic1d306ed097052eb4080a5a62bcc0d2218a1ade9

73 files changed:
notification-ex/abstract_action.cc
notification-ex/abstract_action.h
notification-ex/abstract_item.cc
notification-ex/abstract_item.h
notification-ex/action_inflator.cc
notification-ex/action_inflator.h
notification-ex/app_control_action.cc
notification-ex/app_control_action.h
notification-ex/button_item.cc
notification-ex/button_item.h
notification-ex/chat_message_item.cc
notification-ex/chat_message_item.h
notification-ex/checkbox_item.cc
notification-ex/checkbox_item.h
notification-ex/db_manager.cc
notification-ex/dbus_connection_manager.h
notification-ex/dbus_event_listener.cc
notification-ex/dbus_event_listener.h
notification-ex/dbus_sender.cc
notification-ex/dbus_sender.h
notification-ex/dbus_sender_implementation.h
notification-ex/entry_item.cc
notification-ex/entry_item.h
notification-ex/event_info.cc
notification-ex/event_info_internal.h
notification-ex/event_listener_interface.h
notification-ex/event_observer_interface.h
notification-ex/event_sender_interface.h
notification-ex/ex_bundle.h [new file with mode: 0644]
notification-ex/group_item.cc
notification-ex/group_item.h
notification-ex/icon_text_item.cc
notification-ex/icon_text_item.h
notification-ex/ievent_info.h
notification-ex/image_item.cc
notification-ex/image_item.h
notification-ex/input_selector_item.cc
notification-ex/input_selector_item.h
notification-ex/item_inflator.cc
notification-ex/item_inflator.h
notification-ex/manager.cc
notification-ex/manager.h
notification-ex/mock_sender.h
notification-ex/null_item.cc
notification-ex/null_item.h
notification-ex/progress_item.cc
notification-ex/progress_item.h
notification-ex/reporter.cc
notification-ex/reporter.h
notification-ex/stub.cc
notification-ex/text_item.cc
notification-ex/text_item.h
notification-ex/time_item.cc
notification-ex/time_item.h
notification-ex/visibility_action.cc
notification-ex/visibility_action.h
unittest/src/test_abstract_item.cc
unittest/src/test_app_control_action.cc
unittest/src/test_bundle.cc [new file with mode: 0644]
unittest/src/test_button_item.cc
unittest/src/test_chat_message_item.cc
unittest/src/test_checkbox_item.cc
unittest/src/test_entry_item.cc
unittest/src/test_event_info.cc
unittest/src/test_group_item.cc
unittest/src/test_icon_item.cc
unittest/src/test_icon_text_item.cc
unittest/src/test_image_item.cc
unittest/src/test_input_selector_item.cc
unittest/src/test_progress_item.cc
unittest/src/test_text_item.cc
unittest/src/test_time_item.cc
unittest/src/test_visibility_action.cc

index 8f276dded46486d5c6711732f67d7c8fb677a7e9..e37ee52efb43078ace5c3ec26cf7a18204cfdd14 100644 (file)
@@ -28,8 +28,6 @@
 #define ABSTRACT_ACTION_IS_LOCAL_KEY "__ABSTRACT_ACTION_IS_LOCAL_KEY__"
 #define ABSTRACT_ACTION_EXTRA_KEY "__ABSTRACT_ACTION_EXTRA_KEY__"
 
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 AbstractAction::AbstractAction(bool isLocal)
index f8ace1bcbd6af342f2451f84e91d0d9fa12eedec..71d9f1a60416fdf269a25feaac4ed509722957b1 100644 (file)
@@ -20,7 +20,7 @@
 #include <memory>
 #include <string>
 
-#include <bundle_cpp.h>
+#include "notification-ex/ex_bundle.h"
 
 #ifndef EXPORT_API
 #define EXPORT_API __attribute__((visibility("default")))
@@ -82,21 +82,21 @@ class EXPORT_API AbstractAction {
    * @param[in] b Bundle type data
    * @return The type of action
    */
-  static int GetType(tizen_base::Bundle b);
+  static int GetType(Bundle b);
 
   /**
    * @brief Serialize the data of AbstractAction.
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  virtual tizen_base::Bundle Serialize() const = 0;
+  virtual Bundle Serialize() const = 0;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  virtual void Deserialize(tizen_base::Bundle b) = 0;
+  virtual void Deserialize(Bundle b) = 0;
 
   /**
    * @brief Gets whether local or not.
index 69e12cd135fbdff9ebb4cca8a401af1fd738bc86..359680a907b91544a147d9052b7033227ae9b338 100644 (file)
@@ -75,7 +75,6 @@
 #define ABSTRACT_ITEM_TRUE "TRUE"
 
 using namespace std;
-using namespace tizen_base;
 namespace notification {
 namespace item {
 
index 3fdf1e25115d2e158e32e8800a566ce0059e591a..e9961a75602451a9544b76e13f80cecaded37520 100644 (file)
 #define NOTIFICATION_EX_ABSTRACT_ITEM_H_
 
 #include <time.h>
-#include <bundle_cpp.h>
 
 #include <memory>
 #include <string>
 #include <list>
 
 #include "notification-ex/abstract_action.h"
+#include "notification-ex/ex_bundle.h"
 #include "notification-ex/iitem_info.h"
 
 #ifndef EXPORT_API
@@ -404,14 +404,14 @@ class EXPORT_API AbstractItem {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  virtual tizen_base::Bundle Serialize() const = 0;
+  virtual Bundle Serialize() const = 0;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  virtual void Deserialize(tizen_base::Bundle b) = 0;
+  virtual void Deserialize(Bundle b) = 0;
 
   /**
    * @brief Finds the AbstractItem using by notification item id.
@@ -433,7 +433,7 @@ class EXPORT_API AbstractItem {
    * @since_tizen 5.5
    * @return The type of notification item
    */
-  static int GetType(tizen_base::Bundle b);
+  static int GetType(Bundle b);
 
   /**
    * @brief Gets the path of shared file location.
index 23eaa22ed883d4a516db63a23340cec018de242b..c757e46a1955951d8957b6e43fce5acbad694cc6 100644 (file)
@@ -15,7 +15,6 @@
  */
 
 #include <dlog.h>
-#include <bundle_cpp.h>
 
 #include <memory>
 
@@ -31,7 +30,7 @@
 namespace notification {
 namespace item {
 
-std::shared_ptr<AbstractAction> ActionInflator::Create(tizen_base::Bundle b) {
+std::shared_ptr<AbstractAction> ActionInflator::Create(Bundle b) {
   std::shared_ptr<AbstractAction> action =
       FactoryManager::GetInst().CreateAction(AbstractAction::GetType(b));
   action.get()->Deserialize(b);
index eff5e6dd9b37e1f8d32237e9667c56d8ac80c2ba..243db279b46bb3bc59e1bc61d56adf02846470df 100644 (file)
@@ -37,7 +37,7 @@ class EXPORT_API ActionInflator {
    * @since_tizen 5.5
    * @param[in] b Bundle type data
    */
-  static std::shared_ptr<AbstractAction> Create(tizen_base::Bundle b);
+  static std::shared_ptr<AbstractAction> Create(Bundle b);
 };
 
 }  // namespace item
index 3664535db9abe703908f9d31dbcf10c101c6191f..d58c8d7ec0fba334af4fa539ce98222aa4342037 100644 (file)
@@ -28,8 +28,6 @@
 #define LOG_TAG "NOTIFICATION_EX"
 #define APPCONTROL_ACTION_KEY "__APPCONTROL_ACTION_KEY__"
 
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 
@@ -71,13 +69,13 @@ Bundle AppControlAction::Serialize() const {
   app_control_export_as_bundle(impl_->control_, &control_b);
   if (control_b == NULL) {
     LOGE("failed to get bundle from app_control");
-    return {};
+    return nullptr;
   }
 
   bundle_encode(control_b, &control_raw, &len);
   if (len <= 0) {
     LOGE("bundle encode failed");
-    return {};
+    return nullptr;
   }
 
   b = AbstractAction::Serialize();
index efb8d70cc8b77c1eb747e14db241df54db2de8b8..564b4bedbabab410fa99d800673f0982869a8489 100644 (file)
@@ -64,14 +64,14 @@ class EXPORT_API AppControlAction : public AbstractAction {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  tizen_base::Bundle Serialize() const override;
+  Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  void Deserialize(tizen_base::Bundle b) override;
+  void Deserialize(Bundle b) override;
 
   /**
    * @brief Gets whether local or not.
index 61d02ed55bad8eabad874b37b5736c6fa03aeae7..0c862abc715d35c8a5fa2ed59ff221c00f01d945 100644 (file)
@@ -30,8 +30,6 @@
 #define BUTTON_TITLE_KEY "__BUTTON_TITLE_KEY__"
 
 using namespace std;
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 
index b507986554c49e92d4b53ffafe5c491d7e4d0101..4e11722a1a813c44f6f9a0130be4eb9e6fde7f5f 100644 (file)
@@ -65,14 +65,14 @@ class EXPORT_API ButtonItem : public AbstractItem {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  tizen_base::Bundle Serialize() const override;
+  Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  void Deserialize(tizen_base::Bundle b) override;
+  void Deserialize(Bundle b) override;
 
   /**
    * @brief Finds the AbstractItem using by notification item id.
index cda463bc613222e254e91c730246b9c784a22ca3..11e5c4f1464d9972ea209185b25b0da1f84ee18e 100644 (file)
@@ -32,8 +32,6 @@
 #define CHATMESSAGE_TIME_KEY "__CHATMESSAGE_TIME_KEY__"
 #define CHATMESSAGE_TYPE_KEY "__CHATMESSAGE_TYPE_KEY__"
 
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 
index 8e8906e5c59dcf27e39f3f4cb4960914011bd325..bae99b7575d2bdac22653ab44df4b7c066e67f3e 100644 (file)
@@ -78,14 +78,14 @@ class EXPORT_API ChatMessageItem : public AbstractItem {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  tizen_base::Bundle Serialize() const override;
+  Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  void Deserialize(tizen_base::Bundle b) override;
+  void Deserialize(Bundle b) override;
 
   /**
    * @brief Finds the AbstractItem using by notification item id.
index 69f682dd53e7c8cbc06e92d80533435c66b6c8c4..ed5e99a6c888b5b05aa8ef5a8a005308f19e72a2 100644 (file)
@@ -29,8 +29,6 @@
 #define CHECKBOX_TITLE_KEY "__CHECKBOX_TITLE_KEY__"
 #define CHECKBOX_CHECKED_KEY "__CHECKBOX_CHECKED_KEY__"
 
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 
index 8a99f3393f622e9a1dab269dc5d2616da0774d03..fa1d20a203856daf07fcd89bdaa446db9f81cf2e 100644 (file)
@@ -55,14 +55,14 @@ class EXPORT_API CheckBoxItem : public AbstractItem {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  tizen_base::Bundle Serialize() const override;
+  Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  void Deserialize(tizen_base::Bundle b) override;
+  void Deserialize(Bundle b) override;
 
   /**
    * @brief Finds the AbstractItem using by notification item id.
index 31898bdc27a5c5d3f652cefcd514ac41d0d3d890..d238706c5c96d99ba32c9b839dee06b83bf78477 100644 (file)
@@ -62,7 +62,6 @@
 #define NOTI_LIMIT 100
 
 using namespace std;
-using namespace tizen_base;
 using namespace notification::item;
 
 namespace notification {
index 995d0453176233fd390145e717596c43ff354b49..9b37f09c5ee3abdc9c9ec774967f818fbfe75ca7 100644 (file)
@@ -21,9 +21,7 @@
 
 #include <string>
 
-#ifndef EXPORT_API
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
+#include "notification-ex/ex_bundle.h"
 
 namespace notification {
 
index f34b5d31ab85c1bbd186ea7d6847390c2f3131dd..cc03c2cf4fd5744c44619327a926cd3b84e68a40 100644 (file)
@@ -33,8 +33,6 @@
 #define MAX_PACKAGE_STR_SIZE 512
 
 using namespace std;
-using namespace tizen_base;
-
 namespace notification {
 
 DBusEventListener::DBusEventListener(string path)
index db76d0fd0aa08c235ed2653a18bad90f80c37af8..15b1fde720692863f405b3c43647d905b0ac5512 100644 (file)
@@ -29,8 +29,8 @@ class EXPORT_API DBusEventListener : public IEventListener {
   void RegisterObserver(IEventObserver* observer) override;
   void UnRegisterObserver(IEventObserver* observer) override;
   void NotifyObserver(
-      const IEventInfo& info, std::list<tizen_base::Bundle> serialized) override;
-  std::list<tizen_base::Bundle> NotifyObserver(const IEventInfo& info) override;
+      const IEventInfo& info, std::list<Bundle> serialized) override;
+  std::list<Bundle> NotifyObserver(const IEventInfo& info) override;
 
  private:
   class Impl;
index 38cbfb6a189912e763c5659594bd41d210b347d0..21952359e24e6b6681966d0e6c4c7a3523163267 100644 (file)
@@ -34,7 +34,6 @@
 #define MAX_PACKAGE_STR_SIZE 512
 
 using namespace std;
-using namespace tizen_base;
 namespace notification {
 
 DBusSender::DBusSender(string path) : impl_(new Impl(this, path)) {
index ed557bb9baa17f6c56eb143b4ba264e04e9bf1bf..c6bf29856b6954ffc201e25078b76978cdf3042f 100644 (file)
@@ -17,8 +17,7 @@
 #ifndef NOTIFICATION_EX_DBUS_SENDER_H_
 #define NOTIFICATION_EX_DBUS_SENDER_H_
 
-#include <bundle_cpp.h>
-
+#include "notification-ex/ex_bundle.h"
 #include "notification-ex/event_sender_interface.h"
 #include "notification-ex/ievent_info.h"
 
@@ -32,9 +31,9 @@ class EXPORT_API DBusSender : public IEventSender {
  public:
   DBusSender(std::string path);
   virtual ~DBusSender();
-  void Notify(const IEventInfo& info, std::list<tizen_base::Bundle> serialized,
+  void Notify(const IEventInfo& info, std::list<Bundle> serialized,
       std::string dest_appid = "") override;
-  std::list<tizen_base::Bundle> Request(const IEventInfo& info) override;
+  std::list<Bundle> Request(const IEventInfo& info) override;
 
  private:
   class Impl;
index cef9c707f73c63bd81c7af333aafbfb288e6b5c5..1ce5e5f7087a544e61bb1a2d07da88eb1722e7ce 100644 (file)
@@ -17,8 +17,6 @@
 #ifndef NOTIFICATION_EX_DBUS_SENDER_IMPLEMENTATION_H_
 #define NOTIFICATION_EX_DBUS_SENDER_IMPLEMENTATION_H_
 
-#include <bundle_cpp.h>
-
 #include <string>
 #include <memory>
 #include <list>
@@ -39,8 +37,7 @@ class DBusSender::Impl {
   std::string GetBusName(
       std::string appid, std::string dest_appid) const;
   bool EmitSignal(std::string bus_name, std::string signal_name, GVariant* data);
-  GDBusMessage* MethodCall(std::string appid, std::string method_name,
-      tizen_base::Bundle serialized);
+  GDBusMessage* MethodCall(std::string appid, std::string method_name, Bundle serialized);
   std::string path_;
   DBusSender* parent_;
 };
index dff60b7feeab67f9c8c57fcaecac9939a0a2c0df..9b0bdc6bea62ddc19189d78e550cc4fc9b64f827 100644 (file)
@@ -30,8 +30,6 @@
 #define ENTRY_TEXT_KEY "__ENTRY_TEXT_KEY__"
 #define ENTRY_LIMIT_KEY "__ENTRY_LIMIT_KEY__"
 
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 
index e84e4ee50e497e938b5b1506fe4cd632343b8e70..6bc04a38eb214413713ab2d157b21582cb73c567 100644 (file)
@@ -63,14 +63,14 @@ class EXPORT_API EntryItem : public AbstractItem {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  tizen_base::Bundle Serialize() const override;
+  Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  void Deserialize(tizen_base::Bundle b) override;
+  void Deserialize(Bundle b) override;
 
   /**
    * @brief Finds the AbstractItem using by notification item id.
index fc06d1334ec21288e054d7984e98f08cec3ca509..ded0ecf4f04fc0ff0e7194f67ee944e82c3809d5 100644 (file)
@@ -37,7 +37,6 @@
 #define NOTIFICATION_EX_EVENT_ERROR_KEY "__NOTIFICATION_EX_EVENT_ERROR_KEY__"
 
 using namespace std;
-using namespace tizen_base;
 namespace notification {
 
 EventInfo::EventInfo(int type, std::string owner, std::string channel,
index b2b175dc042c85ff70297f17756000d276de1371..ada713a5a60ac88c05c18c9c80f0c8cb3b6bac21 100644 (file)
 #ifndef NOTIFICATION_EX_EVENT_INFO_INTERNAL_H_
 #define NOTIFICATION_EX_EVENT_INFO_INTERNAL_H_
 
-#include <bundle_cpp.h>
-
 #include <string>
 #include <list>
 
 #include "notification-ex/common.h"
+#include "notification-ex/ex_bundle.h"
 #include "notification-ex/ievent_info_internal.h"
 
 #ifndef EXPORT_API
@@ -35,7 +34,7 @@ class EventInfo : public IEventInfoInternal {
  public:
   EventInfo(int type, std::string owner, std::string channel = "",
       std::string item_id = "");
-  EventInfo(tizen_base::Bundle serialized);
+  EventInfo(Bundle serialized);
   virtual ~EventInfo();
   uid_t GetUid() const override;
   void SetUid(uid_t uid) override;
@@ -47,7 +46,7 @@ class EventInfo : public IEventInfoInternal {
   std::string GetChannel() const override;
   std::string GetItemId() const override;
   int GetRequestId() const override;
-  tizen_base::Bundle Serialize() const override;
+  Bundle Serialize() const override;
   static std::string GetString(int type);
 
  private:
index e9fe2ae0506725d254990d5eba0526a1dc3b95a6..c59908bf13b6c92b675abfbf7c0c007681da30cd 100644 (file)
@@ -33,9 +33,8 @@ class EXPORT_API IEventListener {
   virtual ~IEventListener() = default;
   virtual void RegisterObserver(IEventObserver* observer) = 0;
   virtual void UnRegisterObserver(IEventObserver* observer) = 0;
-  virtual void NotifyObserver(const IEventInfo& info,
-      std::list<tizen_base::Bundle> serialized) = 0;
-  virtual std::list<tizen_base::Bundle> NotifyObserver(const IEventInfo& info) = 0;
+  virtual void NotifyObserver(const IEventInfo& info, std::list<Bundle> serialized) = 0;
+  virtual std::list<Bundle> NotifyObserver(const IEventInfo& info) = 0;
 };
 
 }  // namespace notification
index 67d77b736ffa5d0bf4dd9c1ea9d41dbca3b3fa3c..e3192a502cc9a80fdc70b34fce2378a75eea1f36 100644 (file)
 #ifndef NOTIFICATION_EX_OBSERVER_INTERFACE_H_
 #define NOTIFICATION_EX_OBSERVER_INTERFACE_H_
 
-#include <bundle_cpp.h>
-
 #include <list>
 
+#include "notification-ex/ex_bundle.h"
 #include "notification-ex/ievent_info.h"
 
 #ifndef EXPORT_API
@@ -32,9 +31,8 @@ namespace notification {
 class EXPORT_API IEventObserver {
  public:
   virtual ~IEventObserver() = default;
-  virtual void OnEvent(const IEventInfo& info,
-      std::list<tizen_base::Bundle> serialized) = 0;
-  virtual std::list<tizen_base::Bundle> OnRequest(const IEventInfo& info) = 0;
+  virtual void OnEvent(const IEventInfo& info, std::list<Bundle> serialized) = 0;
+  virtual std::list<Bundle> OnRequest(const IEventInfo& info) = 0;
 };
 
 }  // namespace notification
index 0c23fac4a0e2c75752ebdf143c1a1d64bd478bec..8b8bb1f0ec1ef1c47be0cba1412fbf24b805c5b3 100644 (file)
 #ifndef NOTIFICATION_EX_EVENT_SENDER_INTERFACE_H_
 #define NOTIFICATION_EX_EVENT_SENDER_INTERFACE_H_
 
-#include <bundle_cpp.h>
-
 #include <list>
 
+#include "notification-ex/ex_bundle.h"
 #include "notification-ex/ievent_info.h"
 
 #ifndef EXPORT_API
@@ -31,10 +30,9 @@ namespace notification {
 
 class EXPORT_API IEventSender {
  public:
-  virtual void Notify(const IEventInfo& info,
-      std::list<tizen_base::Bundle> serialized,
+  virtual void Notify(const IEventInfo& info, std::list<Bundle> serialized,
       std::string dest_appid = "") = 0;
-  virtual std::list<tizen_base::Bundle> Request(const IEventInfo &info) = 0;
+  virtual std::list<Bundle> Request(const IEventInfo &info) = 0;
 };
 
 }  // namespace notification
diff --git a/notification-ex/ex_bundle.h b/notification-ex/ex_bundle.h
new file mode 100644 (file)
index 0000000..6587920
--- /dev/null
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NOTIFICATION_EX_BUNDLE_H_
+#define NOTIFICATION_EX_BUNDLE_H_
+
+#include <bundle.h>
+
+#include <string>
+#include <vector>
+#include <memory>
+#include <cstdio>
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "NOTIFICATION_EX"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+class EXPORT_API Bundle final {
+ public:
+  using BundleRaw =
+      std::pair<std::unique_ptr<bundle_raw, decltype(std::free)*>, int>;
+
+  class KeyInfo final {
+   public:
+    KeyInfo(const bundle_keyval_t* handle, std::string name)
+       : handle_(handle), name_(std::move(name)) {}
+
+    bundle_type GetType() const {
+      return static_cast<bundle_type>(
+          bundle_keyval_get_type(const_cast<bundle_keyval_t*>(handle_)));
+    }
+
+    bool IsArray() const {
+      return bundle_keyval_type_is_array(const_cast<bundle_keyval_t*>(handle_));
+    }
+
+    const std::string& GetName() const {
+      return name_;
+    }
+
+   private:
+    const bundle_keyval_t* handle_;
+    std::string name_;
+  };
+
+  Bundle() {
+    handle_ = bundle_create();
+  }
+
+  Bundle(BundleRaw raw) {
+    handle_ = bundle_decode(raw.first.get(), raw.second);
+  }
+
+
+  Bundle(const std::string& raw) {
+    handle_ = bundle_decode(reinterpret_cast<const bundle_raw*>(raw.c_str()),
+                         raw.length());
+  }
+
+  Bundle(bundle* b, bool copy = true, bool own = true)
+      : own_(own), copy_(copy) {
+    if (!copy_)
+      handle_ = b;
+    else
+      handle_ = bundle_dup(b);
+  }
+
+  ~Bundle() {
+    if (handle_ && (own_ || copy_))
+      bundle_free(handle_);
+  }
+
+  Bundle(const Bundle& b) {
+    handle_ = bundle_dup(b.handle_);
+  }
+
+  Bundle& operator = (const Bundle& b) {
+    handle_ = bundle_dup(b.handle_);
+    return *this;
+  }
+
+  Bundle(Bundle&& b) noexcept {
+    handle_ = b.handle_;
+    b.handle_ = nullptr;
+  }
+
+  Bundle& operator = (Bundle&& b) noexcept {
+    handle_ = b.handle_;
+    b.handle_ = nullptr;
+    return *this;
+  }
+
+  std::vector<KeyInfo> GetKeys() {
+    std::vector<KeyInfo> v;
+
+    bundle_foreach(handle_, [](const char *key, const int type,
+        const bundle_keyval_t *kv, void *user_data) {
+        auto* v = static_cast<std::vector<KeyInfo>*>(user_data);
+        v->emplace_back(kv, key);
+      }, &v);
+
+    return v;
+  }
+
+  int Add(const std::string& key, const std::string& val) {
+     return bundle_add_str(handle_, key.c_str(), val.c_str());
+  }
+
+  int Add(const std::string& key, const std::vector<std::string>& val) {
+    std::vector<const char*> v;
+    for (auto& i : val) {
+      v.push_back(i.c_str());
+    }
+
+    return bundle_add_str_array(handle_, key.c_str(), v.data(), v.size());
+  }
+
+  int Add(const std::string& key, const std::vector<unsigned char>& val) {
+    return bundle_add_byte(handle_, key.c_str(), val.data(), val.size());
+  }
+
+  int Merge(Bundle& b) {
+    std::vector<KeyInfo> keys = b.GetKeys();
+    for (auto& k : keys) {
+      int ret;
+      if (k.IsArray())
+        ret = Add(k.GetName(), b.GetStringArray(k.GetName()));
+      else
+        ret = Add(k.GetName(), b.GetString(k.GetName()));
+      if (ret != 0)
+        return ret;
+    }
+    return 0;
+  }
+
+  int Delete(const std::string& key) {
+    return bundle_del(handle_, key.c_str());
+  }
+
+  std::string GetString(const std::string& key) const {
+    char* str = nullptr;
+    bundle_get_str(handle_, key.c_str(), &str);
+
+    if (!str)
+      return "";
+
+    return std::string(str);
+  }
+
+  std::vector<std::string> GetStringArray(const std::string& key) const {
+    std::vector<std::string> v;
+
+    const char** str_array = nullptr;
+    int len = 0;
+
+    str_array = bundle_get_str_array(handle_, key.c_str(), &len);
+
+    for (int i = 0; i < len; i++) {
+      v.emplace_back(str_array[i]);
+    }
+
+    return v;
+  }
+
+  std::vector<unsigned char> GetByte(const std::string& key) const {
+    size_t size;
+    unsigned char* bytes = nullptr;
+    bundle_get_byte(handle_, key.c_str(),
+        reinterpret_cast<void**>(&bytes), &size);
+    return std::vector<unsigned char>(bytes, bytes + size);
+  }
+
+  BundleRaw ToRaw() {
+    bundle_raw* raw = nullptr;
+    int len = 0;
+    bundle_encode(handle_, &raw, &len);
+
+    return BundleRaw(
+        std::unique_ptr<bundle_raw, decltype(std::free)*>(raw, std::free), len);
+  }
+
+  int GetCount() const {
+    return bundle_get_count(handle_);
+  }
+
+  bundle_type GetType(const std::string& key) const {
+    return static_cast<bundle_type>(bundle_get_type(handle_, key.c_str()));
+  }
+
+  bundle* GetHandle() const {
+    return handle_;
+  }
+
+  bundle* Detach() {
+    auto* h = handle_;
+    handle_ = nullptr;
+    return h;
+  }
+
+ private:
+  bundle* handle_;
+  bool own_ = true;
+  bool copy_ = true;
+};
+
+}  // namespace notification
+
+#endif  // NOTIFICATION_EX_BUNDLE_H_
index 506e50ad6d3f39f05b893d71249dfd6e94bdf935..430a6d1b319609b24ecf3ab31d74089d3f9a436d 100644 (file)
@@ -38,7 +38,6 @@
 #define GROUP_APP_LABEL_KEY "__GROUP_APP_LABEL_KEY__"
 
 using namespace std;
-using namespace tizen_base;
 namespace notification {
 namespace item {
 
index 67ed182840cb0becec61f685e29ffcb634d81fc9..a4e70032de97572e7da77dc68008f364b0ac68d9 100644 (file)
@@ -61,14 +61,14 @@ class EXPORT_API GroupItem : public AbstractItem {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  tizen_base::Bundle Serialize() const override;
+  Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  void Deserialize(tizen_base::Bundle b) override;
+  void Deserialize(Bundle b) override;
 
   /**
    * @brief Finds the AbstractItem using by notification item id.
index fafeeb61c595e7e2e3ae03cecd13e9f678b6ebdf..813a23056d5d41d859e4dd3c4cb18164486187b4 100644 (file)
@@ -29,8 +29,6 @@
 #define ICONTEXT_PATH_KEY "__ICONTEXT_PATH_KEY__"
 #define ICONTEXT_TITLE_KEY "__ICONTEXT_TITLE_KEY__"
 
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 
index 9079cba1ef46f5519116381af90b655b725e4d07..9225ad9d4f93609bcf88dd0a73602c50e3e57f83 100644 (file)
@@ -58,14 +58,14 @@ class EXPORT_API IconTextItem : public AbstractItem {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  tizen_base::Bundle Serialize() const override;
+  Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  void Deserialize(tizen_base::Bundle b) override;
+  void Deserialize(Bundle b) override;
 
   /**
    * @brief Finds the AbstractItem using by notification item id.
index 51968c740a486eeb44799d160288c1cc457b57e2..690b9748c9016dd1c81b91b109a9974675e911a9 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef NOTIFICATION_EX_IEVENT_INFO_H_
 #define NOTIFICATION_EX_IEVENT_INFO_H_
 
-#include <bundle_cpp.h>
+#include "notification-ex/ex_bundle.h"
 
 namespace notification {
 
@@ -41,7 +41,7 @@ class EXPORT_API IEventInfo {
   virtual std::string GetChannel() const = 0;
   virtual std::string GetItemId() const = 0;
   virtual int GetRequestId() const = 0;
-  virtual tizen_base::Bundle Serialize() const = 0;
+  virtual Bundle Serialize() const = 0;
 };
 
 }  // namespace notification
index 2d473f838941af6f12937e36552c801a3eec69ea..07fd987d440824b888ce3e5ab3fab9700e98d173 100644 (file)
@@ -28,8 +28,6 @@
 #define LOG_TAG "NOTIFICATION_EX"
 #define IMAGE_PATH_KEY "__IMAGE_PATH_KEY__"
 
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 
index 5ba849ebd7aea5689313573ea6b6dd2af4e2ff94..0ac43e313fe68881d2455ef4e4533d0e41d1a21f 100644 (file)
@@ -70,14 +70,14 @@ class EXPORT_API ImageItem : public AbstractItem {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  tizen_base::Bundle Serialize() const override;
+  Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  void Deserialize(tizen_base::Bundle b) override;
+  void Deserialize(Bundle b) override;
 
   /**
    * @brief Finds the AbstractItem using by notification item id.
index b0c44c23d76eefa33efe16720684de8ea92b64f1..f8ea9265f5c7ed5da5003be6a4f2929ae4340932 100644 (file)
@@ -32,8 +32,6 @@
 #define INPUT_SELECTOR_CONTENTS_KEY "__INPUT_SELECTOR_CONTENTS_KEY__"
 
 using namespace std;
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 
index 623515b35157954cb2b5ae8cb0f32fb563f7abb6..f769be9ce2285177eaf5e72d08263a0d48c3c0b0 100644 (file)
@@ -61,14 +61,14 @@ class EXPORT_API InputSelectorItem : public AbstractItem {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  virtual tizen_base::Bundle Serialize() const override;
+  virtual Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  virtual void Deserialize(tizen_base::Bundle b) override;
+  virtual void Deserialize(Bundle b) override;
 
   /**
    * @brief Finds the AbstractItem using by notification item id.
index f1f2ec4a4efc95a748303abc217f0547115164c2..a0a39d9c8c59d1a9c31cbd4e34d4b6122e72d6f5 100644 (file)
@@ -31,7 +31,7 @@ using namespace std;
 namespace notification {
 namespace item {
 
-unique_ptr<AbstractItem> ItemInflator::Create(tizen_base::Bundle b) {
+unique_ptr<AbstractItem> ItemInflator::Create(Bundle b) {
   unique_ptr<AbstractItem> item =
       FactoryManager::GetInst().CreateItem(AbstractItem::GetType(b));
   item.get()->Deserialize(b);
index db59895c488a8b4853ddeac2e42d2d5673e6e7f0..3d9d837b5858c49ae56c241f338434e0b42bde88 100644 (file)
@@ -38,7 +38,7 @@ class EXPORT_API ItemInflator {
    * @since_tizen 5.5
    * @param[in] b Bundle type data
    */
-  static std::unique_ptr<AbstractItem> Create(tizen_base::Bundle b);
+  static std::unique_ptr<AbstractItem> Create(Bundle b);
 };
 
 }  // namespace item
index c28dbcaa80e3ab249f7111a963e9faea6b74da1e..e5af0fcde5ad9d7322e716c603cd6ef4eb7db224 100644 (file)
@@ -38,7 +38,6 @@
 #define NOTIFICATION_EX_MANAGER_OBJECT_PATH "/org/tizen/notification_ex_manager"
 
 using namespace std;
-using namespace tizen_base;
 using namespace notification::item;
 namespace notification {
 
index 3a3b98268cf49014350df490d3689fe87ed5003a..578a0a66e97320335ed5312d38f54053907abe81 100644 (file)
@@ -46,9 +46,8 @@ class EXPORT_API Manager : public IEventObserver {
   int Hide(std::shared_ptr<item::AbstractItem> noti);
   std::unique_ptr<item::AbstractItem> FindByRootID(std::string id);
   int SendEvent(const IEventInfo& info, std::shared_ptr<item::AbstractItem> noti);
-  void OnEvent(const IEventInfo& info,
-      std::list<tizen_base::Bundle> serialized) override;
-  std::list<tizen_base::Bundle> OnRequest(const IEventInfo& info) override;
+  void OnEvent(const IEventInfo& info, std::list<Bundle> serialized) override;
+  std::list<Bundle> OnRequest(const IEventInfo& info) override;
   void SendError(const IEventInfo& info, NotificationError error);
   int GetCount() const;
   static std::string GetPath();
index 588fc2eabfd5f7697f2b984722cd62e17b9fcadc..509a5258ef5b7b0474735745cd357e8696026413 100644 (file)
@@ -30,7 +30,7 @@ class EXPORT_API MockSender : public IEventSender {
   MockSender();
   virtual ~MockSender();
 
-  void Notify(tizen_base::Bundle serialized) override;
+  void Notify(Bundle serialized) override;
 };
 
 }  // namespace notification
index 0e24297721c615048227947bb148da3a35b79c34..3c0f7f8c08f14d33b19e3e93d4c99f2b7aedb5b6 100644 (file)
@@ -27,8 +27,6 @@
 #define LOG_TAG "NOTIFICATION_EX"
 
 using namespace std;
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 
index 2ea723506f36fcecadc106f3a1ed7c438bd8749b..fe5927b46cbffdd03638b2d91ec4c54fb7f198d6 100644 (file)
@@ -67,14 +67,14 @@ class EXPORT_API NullItem : public AbstractItem {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  tizen_base::Bundle Serialize() const override;
+  Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  void Deserialize(tizen_base::Bundle b) override;
+  void Deserialize(Bundle b) override;
 
   /**
    * @brief Finds the AbstractItem using by notification item id.
index 3c1ac4df97271cb8a6fb98d0da97299817c45eb1..a697d57a32d01a36aaf8654bd40127b1bf85737c 100644 (file)
@@ -33,8 +33,6 @@
 #define PROGRESS_MAX_KEY "__PROGRESS_MAX_KEY__"
 
 using namespace std;
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 
index 8b058313e8f9e04a7cda9f25596e00ace7572bb4..533b32292ad6d63a2a8b43a21b8ce5f31a4fa256 100644 (file)
@@ -68,14 +68,14 @@ class EXPORT_API ProgressItem : public AbstractItem {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  virtual tizen_base::Bundle Serialize() const override;
+  virtual Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  virtual void Deserialize(tizen_base::Bundle b) override;
+  virtual void Deserialize(Bundle b) override;
 
   /**
    * @brief Finds the AbstractItem using by notification item id.
index e7e236329f25493933b88051ac1910475a6cd95d..ed1e64ef5aade2214be83a518bc769ada77ac2e9 100644 (file)
@@ -36,7 +36,6 @@
 #define NOTIFICATION_EX_REPORTER_OBJECT_PATH "/org/tizen/notification_ex_reporter"
 
 using namespace std;
-using namespace tizen_base;
 using namespace notification::item;
 namespace notification {
 
index 299b5b1a4dcbaf8f01d70400d4701f431897bdea..c73db6f55945aea24062fc9107aa58b06caa6005 100644 (file)
@@ -53,9 +53,8 @@ class EXPORT_API Reporter : public IEventObserver {
   virtual std::list<std::shared_ptr<item::AbstractItem>> OnRequestEvent(
       const IEventInfo& info);
   virtual void OnError(NotificationError error, int requestId);
-  void OnEvent(const IEventInfo& info,
-      std::list<tizen_base::Bundle> serialized) override;
-  std::list<tizen_base::Bundle> OnRequest(const IEventInfo& info) override;
+  void OnEvent(const IEventInfo& info, std::list<Bundle> serialized) override;
+  std::list<Bundle> OnRequest(const IEventInfo& info) override;
   static std::string GetPath();
 
  private:
index 2ceb63684f3c1cdc40a5778b17e2226cfb36c8d2..9a1df5478e8808e135b4663b238746304b2a5a1e 100644 (file)
@@ -48,6 +48,7 @@
 #include "notification-ex/progress_item.h"
 #include "notification-ex/time_item.h"
 #include "notification-ex/visibility_action.h"
+#include "notification-ex/ex_bundle.h"
 #include "notification-ex/event_info_internal.h"
 #include "notification-ex/manager.h"
 #include "notification-ex/dbus_sender.h"
@@ -65,7 +66,6 @@
 #define EXPORT_API __attribute__((visibility("default")))
 
 using namespace std;
-using namespace tizen_base;
 using namespace notification::item;
 using namespace notification;
 
index fa0696ea47d0fff15e03745608b49d6afe5a9545..075df87f3656f4ecf29294a661a825eb9a1dc9fd 100644 (file)
@@ -30,8 +30,6 @@
 #define TEXT_CONTENTS_KEY "__TEXT_CONTENTS_KEY__"
 #define TEXT_HYPERLINK_KEY "__TEXT_HYPERLINK_KEY__"
 
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 TextItem::TextItem(std::string id, std::string text, std::string hyperlink,
index 4a805214aa49f730677be501eeeda64eba4024aa..4ac8731aa20e1a70f3d3036509a0bbda1351304f 100644 (file)
@@ -67,14 +67,14 @@ class EXPORT_API TextItem : public AbstractItem {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  tizen_base::Bundle Serialize() const override;
+  Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  void Deserialize(tizen_base::Bundle b) override;
+  void Deserialize(Bundle b) override;
 
   /**
    * @brief Finds the AbstractItem using by notification item id.
index 66f086f4206fe9e9b1fadcc4a55cd06721761e92..b57b9f46fb9a79e60dcff0162598ada9cd36471c 100644 (file)
@@ -28,8 +28,6 @@
 #define LOG_TAG "NOTIFICATION_EX"
 #define TIME_KEY "__TIME_KEY__"
 
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 
index 2a1a925ee892395267ab651e4adb79078ab6d04e..4291344cd4a98d8db7ea50585cdc358f4902007b 100644 (file)
@@ -80,14 +80,14 @@ class EXPORT_API TimeItem : public AbstractItem {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  tizen_base::Bundle Serialize() const override;
+  Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  void Deserialize(tizen_base::Bundle b) override;
+  void Deserialize(Bundle b) override;
 
   /**
    * @brief Finds the AbstractItem using by notification item id.
index e2688aa83c9f1d9f6a7d737e7f03f29b6e857b99..f274eb25dd3d5d1780eb3c6072ecf70dd791a71c 100644 (file)
@@ -27,8 +27,6 @@
 #define VISIBILITY_ACTION_ENTITY_KEY "__VISIBILITY_ACTION_VISIBLE_KEY__"
 #define VISIBILITY_ACTION_ENTITY_SIZE_KEY "__VISIBILITY_ACTION_ENTITY_SIZE_KEY__"
 
-using namespace tizen_base;
-
 namespace notification {
 namespace item {
 
index 8855226c06a83d1b94f2049b8579627fc91be6cc..20c17578da77d4b6b38cf5ad69cffb1053dddafc 100644 (file)
@@ -60,14 +60,14 @@ class EXPORT_API VisibilityAction  : public AbstractAction {
    * @since_tizen 5.5
    * @return Bundle type data
    */
-  tizen_base::Bundle Serialize() const override;
+  Bundle Serialize() const override;
 
   /**
    * @brief Deserialize the serialized data.
    * @since_tizen 5.5
    * @param[in] b The serialized Bundle data
    */
-  void Deserialize(tizen_base::Bundle b) override;
+  void Deserialize(Bundle b) override;
 
   /**
    * @brief Gets whether local or not.
index 115741c6ee36a9f4ab37aabf6b6574b8ced48786..0a7ed6f6dd7fe2636263ccfbda31ee78c41233af 100644 (file)
@@ -28,7 +28,6 @@
 #define MY_ITEM_TYPE AbstractItem::Type::Custom + 1
 
 using namespace notification;
-using namespace tizen_base;
 using namespace notification::item;
 
 namespace {
index 7b49c6082a522b255bdd6ce6fe51fc4da7ac3f21..ff575c1b1bc714099bfc3cd4b3cf896b7dea2468 100644 (file)
@@ -20,7 +20,6 @@
 #include "notification-ex/app_control_action.h"
 #include "notification-ex/action_inflator.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;
 
diff --git a/unittest/src/test_bundle.cc b/unittest/src/test_bundle.cc
new file mode 100644 (file)
index 0000000..a7e66cc
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string>
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "notification-ex/ex_bundle.h"
+
+using ::testing::AtLeast;
+using namespace notification;
+
+TEST(Bundle, CtorDtor) {
+  Bundle bundle;
+}
+
+TEST(Bundle, CopyCtor) {
+  Bundle bundle;
+  bundle.Add("TestKey", "TestVal");
+
+  Bundle b2(bundle);
+  EXPECT_EQ(b2.GetString("TestKey"), "TestVal");
+}
+
+TEST(Bundle, MoveCtor) {
+  Bundle bundle;
+  bundle.Add("TestKey", "TestVal");
+
+  Bundle b2(std::move(bundle));
+  EXPECT_EQ(b2.GetString("TestKey"), "TestVal");
+}
+
+TEST(Bundle, AddStringGetString) {
+  Bundle bundle;
+  bundle.Add("TestKey", "TestVal");
+
+  EXPECT_EQ(bundle.GetString("TestKey"), "TestVal");
+}
+
+TEST(Bundle, AddByteGetByte) {
+  Bundle bundle;
+  std::vector<unsigned char> v = { 0, 1, 2, 3};
+  bundle.Add("TestKey", v);
+  auto v2 = bundle.GetByte("TestKey");
+
+  EXPECT_EQ(v2.size(), 4);
+  EXPECT_EQ(v2[0], 0);
+  EXPECT_EQ(v2[1], 1);
+  EXPECT_EQ(v2[2], 2);
+  EXPECT_EQ(v2[3], 3);
+}
+
+TEST(Bundle, AddStringArrayGetStringArray) {
+  Bundle bundle;
+  bundle.Add("TestKey", { "TestVal1", "TestVal2", "TestVal3" });
+
+  auto v = bundle.GetStringArray("TestKey");
+
+  EXPECT_EQ(v.size(), 3);
+  EXPECT_EQ(v[0], "TestVal1");
+  EXPECT_EQ(v[1], "TestVal2");
+  EXPECT_EQ(v[2], "TestVal3");
+}
+
+TEST(Bundle, ToRaw) {
+  Bundle bundle;
+  bundle.Add("TestKey", "TestVal");
+
+  auto r = bundle.ToRaw();
+  Bundle b2(std::move(r));
+  EXPECT_EQ(bundle.GetString("TestKey"), "TestVal");
+}
+
+TEST(Bundle, GetCount) {
+  Bundle bundle;
+  bundle.Add("TestKey1", "TestVal1");
+  bundle.Add("TestKey2", "TestVal2");
+
+  EXPECT_EQ(bundle.GetCount(), 2);
+}
+
+TEST(Bundle, Delete) {
+  Bundle bundle;
+  int r = bundle.Add("TestKey1", "TestVal1");
+  EXPECT_EQ(r, 0);
+
+  r = bundle.Delete("TestKey1");
+  EXPECT_EQ(r, 0);
+
+  EXPECT_EQ(bundle.GetString("TestKey1"), "");
+}
+
+TEST(Bundle, GetKeys) {
+  Bundle bundle;
+  bundle.Add("TestKey1", "TestVal1");
+  bundle.Add("TestKey2", "TestVal2");
+  bundle.Add("TestKey3", "TestVal3");
+
+  auto v = bundle.GetKeys();
+
+  EXPECT_EQ(bundle.GetCount(), 3);
+
+  for (auto& i : v) {
+    EXPECT_EQ(i.GetType(), BUNDLE_TYPE_STR);
+  }
+}
index 2e9e581e7d8a2ae8947d8f568aa5e7529b7f5075..ad4a996ae8ce64b30d447114c0859563995442b3 100644 (file)
@@ -7,7 +7,6 @@
 #include "notification-ex/button_item.h"
 #include "notification-ex/item_inflator.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;
 using namespace std;
index cde985a6d5569d92f13d9bd1936367c79e9a6a78..c72e6fbec7ce394d69abc1621b603473fd1c4aa2 100644 (file)
@@ -20,7 +20,6 @@
 #include "notification-ex/chat_message_item.h"
 #include "notification-ex/item_inflator.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;
 
index eba55a732797b01c9377ad2ea6ffe19a97275d35..bdcb24661520570168c6683957facf67d903c72e 100644 (file)
@@ -20,7 +20,6 @@
 #include "notification-ex/checkbox_item.h"
 #include "notification-ex/item_inflator.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;
 
index 76b0006a224d949192433cf5dcaa528a2910b014..b4e3e059e834c0e918592b08481b603398177bab 100644 (file)
@@ -20,7 +20,6 @@
 #include "notification-ex/entry_item.h"
 #include "notification-ex/item_inflator.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;
 
index 655f12adf7efb3898c968c075765eb48b4955c9f..120cee5d7837da452f9738405da3dfb00b72ba4d 100644 (file)
@@ -6,7 +6,6 @@
 
 #include "notification-ex/event_info_internal.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace std;
 
index 478c1d329fdddebf8c3bf9d4637c7566ec595359..c4fb43f8c954ecb1d3b15141c7efd74032c06d01 100644 (file)
@@ -9,7 +9,6 @@
 #include "notification-ex/item_inflator.h"
 #include "unittest/mock/app_common.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;
 using namespace std;
index 98ff517ad4c70b290aeb4ee2ec114771f15d1a5f..df7fb7f315e335e23199e80cfa6a81235581aaf1 100644 (file)
@@ -20,7 +20,6 @@
 #include "notification-ex/icon_item.h"
 #include "notification-ex/item_inflator.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;
 
index 0a29622930908326822cae47c75b7b5402f12529..91c7fc49d26ee5ad03687863fec37620fb8b3ce6 100644 (file)
@@ -20,7 +20,6 @@
 #include "notification-ex/icon_text_item.h"
 #include "notification-ex/item_inflator.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;
 
index 66c6786092f5c7448e6f7d2a31a4ce07fcccce89..41db181407406b7b327c443c935e7702fe9f4caa 100644 (file)
@@ -20,7 +20,6 @@
 #include "notification-ex/image_item.h"
 #include "notification-ex/item_inflator.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;
 
index 7bf3afce6a014ae5102d69df41d73b94b7fe8f07..245f66b3240e50cb9b961f53623b2d41c6f9c964 100644 (file)
@@ -7,7 +7,6 @@
 #include "notification-ex/input_selector_item.h"
 #include "notification-ex/item_inflator.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;
 using namespace std;
index 4874737a32bb9ae7e5bdd18a466611f30fafdfdd..6f3d5f861ca4c7d513e934f493372938e774feed 100644 (file)
@@ -7,7 +7,6 @@
 #include "notification-ex/progress_item.h"
 #include "notification-ex/item_inflator.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;
 using namespace std;
index 192156701858a511e60d835956a31ae807248fba..432a6a6cc35007ced5aaac9e5dcfeaa5ae120573 100644 (file)
@@ -20,7 +20,6 @@
 #include "notification-ex/text_item.h"
 #include "notification-ex/item_inflator.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;
 
index 96e8e745fe11bca86c8b2ef7478cb2d8b55354a1..fa149e5e502b78c2ed1364d4d5b9dc95829427f0 100644 (file)
@@ -20,7 +20,6 @@
 #include "notification-ex/time_item.h"
 #include "notification-ex/item_inflator.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;
 
index e231b365a7efb1f612c96bdee0907a07f6a47cb6..21c0c1884895e5afd7d9a65e392d187fd9473489 100644 (file)
@@ -22,7 +22,6 @@
 #include "notification-ex/visibility_action.h"
 #include "notification-ex/action_inflator.h"
 
-using namespace tizen_base;
 using namespace notification;
 using namespace notification::item;