#include "notification-ex/exception.h"
#include "notification-ex/abstract_item.h"
#include "notification-ex/abstract_item_implementation.h"
+#include "notification-ex/item_info_internal.h"
#ifdef LOG_TAG
#undef LOG_TAG
AbstractItem::Impl::Impl(AbstractItem* parent, string id,
std::shared_ptr<AbstractAction> action)
- : id_(id), action_(action), parent_(parent) {
- LOGI("GroupItem created");
+ : id_(id), action_(action), parent_(parent),
+ info_(std::make_shared<ItemInfo>(this)) {
+ LOGI("Item created");
}
AbstractItem::Impl::Impl(AbstractItem* parent,
std::shared_ptr<AbstractAction> action)
- : action_(action), parent_(parent) {
- LOGI("GroupItem created");
+ : action_(action), parent_(parent),
+ info_(std::make_shared<ItemInfo>(this)) {
+ LOGI("Item created");
}
AbstractItem::~AbstractItem() = default;
return impl_->policy_;
}
-int AbstractItem::GetVersion() const {
- return impl_->version_;
-}
-
-void AbstractItem::SetVersion(int ver) {
- impl_->version_ = ver;
-}
-
-int AbstractItem::GetHideTime() const {
- return impl_->hide_time_;
-}
-
-int AbstractItem::GetDeleteTime() const {
- return impl_->delete_time_;
+std::shared_ptr<IItemInfo> AbstractItem::GetInfo() const {
+ return impl_->info_;
}
string AbstractItem::GetChannel() const {
#include "notification-ex/abstract_action.h"
#include "notification-ex/ex_bundle.h"
+#include "notification-ex/iitem_info.h"
#ifndef EXPORT_API
#define EXPORT_API __attribute__((visibility("default")))
bool CanReceive(std::string id) const;
void SetPolicy(Policy policy);
Policy GetPolicy() const;
- int GetVersion() const;
- void SetVersion(int ver);
- int GetHideTime() const;
- int GetDeleteTime() const;
std::string GetChannel() const;
void SetChannel(std::string channel);
void SetLEDInfo(std::shared_ptr<LEDInfo> led);
void SetVibrationPath(std::string path);
std::string GetSoundPath() const;
std::string GetVibrationPath() const;
+ std::shared_ptr<IItemInfo> GetInfo() const;
private:
class Impl;
class AbstractItem::Impl {
public:
+ class ItemInfo;
virtual ~Impl() = default;
private:
private:
friend class AbstractItem;
-
std::string channel_;
std::string id_;
std::shared_ptr<LEDInfo> led_ = nullptr;
AbstractItem* parent_;
std::string sound_path_;
std::string vibration_path_;
+ std::shared_ptr<IItemInfo> info_;
};
} // namespace item
--- /dev/null
+/*
+ * 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_IITEM_INFO_H_
+#define NOTIFICATION_EX_IITEM_INFO_H_
+
+namespace notification {
+namespace item {
+
+class EXPORT_API IItemInfo {
+ public:
+ virtual ~IItemInfo() = default;
+ virtual int GetVersion() const = 0;
+ virtual void SetVersion(int ver) = 0;
+};
+
+} // namespace item
+} // nampace notification
+#endif // NOTIFICATION_EX_IITEM_INFO_H_
--- /dev/null
+/*
+ * 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_IITEM_INFO_INTERNAL_H_
+#define NOTIFICATION_EX_IITEM_INFO_INTERNAL_H_
+
+#include "notification-ex/iitem_info.h"
+
+namespace notification {
+namespace item {
+
+class IItemInfoInternal : public IItemInfo{
+ public:
+ virtual ~IItemInfoInternal() = default;
+ virtual int GetHideTime() const = 0;
+ virtual int GetDeleteTime() const = 0;
+};
+
+} // namespace item
+} // nampace notification
+#endif // NOTIFICATION_EX_IITEM_INFO_INTERNAL_H_
--- /dev/null
+/*
+ * 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 <dlog.h>
+
+#include <memory>
+
+#include "notification-ex/item_info_internal.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "NOTIFICATION_EX"
+
+using namespace std;
+namespace notification {
+namespace item {
+
+AbstractItem::Impl::ItemInfo::ItemInfo(AbstractItem::Impl* impl) : impl_(impl) {}
+
+int AbstractItem::Impl::ItemInfo::GetVersion() const {
+ return impl_->version_;
+}
+
+void AbstractItem::Impl::ItemInfo::SetVersion(int ver) {
+ impl_->version_ = ver;
+}
+
+int AbstractItem::Impl::ItemInfo::GetHideTime() const {
+ return impl_->hide_time_;
+}
+
+int AbstractItem::Impl::ItemInfo::GetDeleteTime() const {
+ return impl_->delete_time_;
+}
+
+} // namespace item
+} // namespace notification
* limitations under the License.
*/
-#ifndef NOTIFICATION_EX_ITEM_H_
-#define NOTIFICATION_EX_ITEM_H_
+#ifndef NOTIFICATION_EX_ITEM_INFO_H_
+#define NOTIFICATION_EX_ITEM_INFO_H_
-#include <time.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include "notification-ex/abstract_item.h"
-#include "notification-ex/ex_bundle.h"
-
-#ifndef EXPORT_API
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
+#include "notification-ex/abstract_item_implementation.h"
+#include "notification-ex/iitem_info_internal.h"
namespace notification {
namespace item {
-class EXPORT_API CustomItem : public AbstractItem {
+class AbstractItem::Impl::ItemInfo : public IItemInfoInternal {
public:
- CustomItem();
- virtual ~CustomItem();
+ ItemInfo(AbstractItem::Impl* impl);
+ virtual ~ItemInfo() = default;
+ int GetVersion() const override;
+ void SetVersion(int ver) override;
+ int GetHideTime() const override;
+ int GetDeleteTime() const override;
- Bundle Serialize() override;
- void Deserialize(Bundle b) override;
- AbstractItem& FindByID(std::string id) override;
-}; // class CustomItem
+ private:
+ AbstractItem::Impl* impl_;
+};
} // namespace item
} // nampace notification
-#endif // NOTIFICATION_EX_ITEM_H_
+#endif // NOTIFICATION_EX_ITEM_INFO_H_