virtual AbstractItem& FindByID(std::string id) = 0;
/**
+ * @brief Checks the item type exist in this notification.
+ * @since_tizen 5.5
+ * @param[in] type notification item type
+ * @return true if the item type exists
+ */
+ virtual bool IsItemTypeExist(int type) = 0;
+
+ /**
* @brief Gets the type of notification item.
* @since_tizen 5.5
* @return The type of notification item
return FactoryManager::GetInst().GetNullItem();
}
+bool ButtonItem::IsItemTypeExist(int type) {
+ if (GetType() == type)
+ return true;
+ return false;
+}
+
std::string ButtonItem::GetTitle() const {
return impl_->title_;
}
AbstractItem& FindByID(std::string id) override;
/**
+ * @brief Checks the item type exist in this notification.
+ * @since_tizen 5.5
+ * @param[in] type notification item type
+ * @return true if the item type exists
+ */
+ bool IsItemTypeExist(int type) override;
+
+ /**
* @brief Gets the type of ButtonItem.
* @since_tizen 5.5
* @return AbstractItem::Type::Button
return FactoryManager::GetInst().GetNullItem();
}
+bool ChatMessageItem::IsItemTypeExist(int type) {
+ if (GetType() == type)
+ return true;
+ return false;
+}
+
TextItem& ChatMessageItem::GetNameItem() const {
return *(impl_->name_);
}
AbstractItem& FindByID(std::string id) override;
/**
+ * @brief Checks the item type exist in this notification.
+ * @since_tizen 5.5
+ * @param[in] type notification item type
+ * @return true if the item type exists
+ */
+ bool IsItemTypeExist(int type) override;
+
+ /**
* @brief Gets the path of shared file location.
* @since_tizen 5.5
* @return The list of shared path.
return FactoryManager::GetInst().GetNullItem();
}
+bool CheckBoxItem::IsItemTypeExist(int type) {
+ if (GetType() == type)
+ return true;
+ return false;
+}
+
std::string CheckBoxItem::GetTitle(void) const {
return impl_->title_;
}
AbstractItem& FindByID(std::string id) override;
/**
+ * @brief Checks the item type exist in this notification.
+ * @since_tizen 5.5
+ * @param[in] type notification item type
+ * @return true if the item type exists
+ */
+ bool IsItemTypeExist(int type) override;
+
+ /**
* @brief Gets the type of CheckBoxItem.
* @since_tizen 5.5
* @return AbstractItem::Type::CheckBox
return FactoryManager::GetInst().GetNullItem();
}
+bool EntryItem::IsItemTypeExist(int type) {
+ if (GetType() == type)
+ return true;
+ return false;
+}
+
std::string EntryItem::GetText() const {
return impl_->text_;
}
AbstractItem& FindByID(std::string id) override;
/**
+ * @brief Checks the item type exist in this notification.
+ * @since_tizen 5.5
+ * @param[in] type notification item type
+ * @return true if the item type exists
+ */
+ bool IsItemTypeExist(int type) override;
+
+ /**
* @brief Gets the type of EntryItem.
* @since_tizen 5.5
* @return AbstractItem::Type::Entry
return FactoryManager::GetInst().GetNullItem();
}
+bool GroupItem::IsItemTypeExist(int type) {
+ if (GetType() == type)
+ return true;
+
+ for (auto& i : impl_->children_list_) {
+ if (i.get()->IsItemTypeExist(type))
+ return true;
+ }
+ return false;
+}
+
list<string> GroupItem::GetSharedPath() const {
list<string> ret;
AbstractItem& FindByID(std::string id) override;
/**
+ * @brief Checks the item type exist in this notification.
+ * @since_tizen 5.5
+ * @param[in] type notification item type
+ * @return true if the item type exists
+ */
+ bool IsItemTypeExist(int type) override;
+
+ /**
* @brief Gets the type of GroupItem.
* @since_tizen 5.5
* @return AbstractItem::Type::Group
return FactoryManager::GetInst().GetNullItem();
}
+bool IconTextItem::IsItemTypeExist(int type) {
+ if (GetType() == type)
+ return true;
+ return false;
+}
+
IconItem& IconTextItem::GetIconItem() const {
return *(impl_->icon_);
}
AbstractItem& FindByID(std::string id) override;
/**
+ * @brief Checks the item type exist in this notification.
+ * @since_tizen 5.5
+ * @param[in] type notification item type
+ * @return true if the item type exists
+ */
+ bool IsItemTypeExist(int type) override;
+
+ /**
* @brief Gets the type of IconTextItem.
* @since_tizen 5.5
* @return AbstractItem::Type::IconText
return FactoryManager::GetInst().GetNullItem();
}
+bool ImageItem::IsItemTypeExist(int type) {
+ if (GetType() == type)
+ return true;
+ return false;
+}
+
std::string ImageItem::GetImagePath() const {
return impl_->image_path_;
}
AbstractItem& FindByID(std::string id) override;
/**
+ * @brief Checks the item type exist in this notification.
+ * @since_tizen 5.5
+ * @param[in] type notification item type
+ * @return true if the item type exists
+ */
+ bool IsItemTypeExist(int type) override;
+
+ /**
* @brief Gets the path of image.
* @since_tizen 5.5
* @return The path of image
return FactoryManager::GetInst().GetNullItem();
}
+bool InputSelectorItem::IsItemTypeExist(int type) {
+ if (GetType() == type)
+ return true;
+ return false;
+}
+
list<string> InputSelectorItem::GetContents() const {
return impl_->contents_;
}
virtual AbstractItem& FindByID(std::string id) override;
/**
+ * @brief Checks the item type exist in this notification.
+ * @since_tizen 5.5
+ * @param[in] type notification item type
+ * @return true if the item type exists
+ */
+ bool IsItemTypeExist(int type) override;
+
+ /**
* @brief Gets the type of InputSelectorItem.
* @since_tizen 5.5
* @return AbstractItem::Type::InputSelector
return *this;
}
+bool NullItem::IsItemTypeExist(int type) {
+ if (GetType() == type)
+ return true;
+ return false;
+}
+
} // namespace item
} // namespace notification
void Deserialize(Bundle b) override;
/**
+ * @brief Checks the item type exist in this notification.
+ * @since_tizen 5.5
+ * @param[in] type notification item type
+ * @return true if the item type exists
+ */
+ bool IsItemTypeExist(int type) override;
+
+ /**
* @brief Finds the AbstractItem using by notification item id.
* @since_tizen 5.5
* @param[in] id notification item id
return FactoryManager::GetInst().GetNullItem();
}
+bool ProgressItem::IsItemTypeExist(int type) {
+ if (GetType() == type)
+ return true;
+ return false;
+}
+
float ProgressItem::GetCurrent() const {
return impl_->current_;
}
virtual AbstractItem& FindByID(std::string id) override;
/**
+ * @brief Checks the item type exist in this notification.
+ * @since_tizen 5.5
+ * @param[in] type notification item type
+ * @return true if the item type exists
+ */
+ bool IsItemTypeExist(int type) override;
+
+ /**
* @brief Gets the type of ProgressItem.
* @since_tizen 5.5
* @return AbstractItem::Type::Progress
return FactoryManager::GetInst().GetNullItem();
}
+bool TextItem::IsItemTypeExist(int type) {
+ if (GetType() == type)
+ return true;
+ return false;
+}
+
void TextItem::SetContents(std::string contents) {
impl_->text_ = contents;
}
AbstractItem& FindByID(std::string id) override;
/**
+ * @brief Checks the item type exist in this notification.
+ * @since_tizen 5.5
+ * @param[in] type notification item type
+ * @return true if the item type exists
+ */
+ bool IsItemTypeExist(int type) override;
+
+ /**
* @brief Sets the contents of TextItem.
* @since_tizen 5.5
* @return The text contents
return FactoryManager::GetInst().GetNullItem();
}
+bool TimeItem::IsItemTypeExist(int type) {
+ if (GetType() == type)
+ return true;
+ return false;
+}
+
time_t TimeItem::GetTime() const {
return impl_->time_;
}
AbstractItem& FindByID(std::string id) override;
/**
+ * @brief Checks the item type exist in this notification.
+ * @since_tizen 5.5
+ * @param[in] type notification item type
+ * @return true if the item type exists
+ */
+ bool IsItemTypeExist(int type) override;
+
+ /**
* @brief Gets the time state of TimeItem.
* @since_tizen 5.5
* @return The time state of TimeItem.
AbstractItem& FindByID(std::string id) override {
return *this;
}
+ bool IsItemTypeExist(int type) {
+ if (GetType() == type)
+ return true;
+ return false;
+ }
int GetType() const override {
return MY_ITEM_TYPE;
}
#include "notification-ex/group_item.h"
#include "notification-ex/button_item.h"
+#include "notification-ex/text_item.h"
#include "notification-ex/item_inflator.h"
#include "unittest/mock/app_common.h"
ASSERT_EQ(ret_gr.GetChildren().size(), 1);
}
+
+TEST_F(GroupItemTest, IsItemTypeExist) {
+ GroupItem item("GROUP1");
+ shared_ptr<GroupItem> gr2 = shared_ptr<GroupItem>(new GroupItem("GROUP2"));
+ shared_ptr<GroupItem> gr3 = shared_ptr<GroupItem>(new GroupItem("GROUP3"));
+ gr2->AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
+ gr2->AddChild(std::make_shared<ButtonItem>("btn3", "test3"));
+ gr2->AddChild(std::make_shared<ButtonItem>("btn4", "test4"));
+ gr3->AddChild(std::make_shared<ButtonItem>("btn6", "test6"));
+ gr3->AddChild(std::make_shared<TextItem>("text1", "text1"));
+ gr2->AddChild(gr3);
+
+ item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
+ item.AddChild(gr2);
+ item.AddChild(std::make_shared<ButtonItem>("btn5", "test5"));
+ ASSERT_EQ(item.GetChildren().size(), 3);
+
+ ASSERT_EQ(item.IsItemTypeExist(AbstractItem::Text), true);
+ ASSERT_EQ(item.IsItemTypeExist(AbstractItem::Image), false);
+}
+
TEST_F(GroupItemTest, FindByIDNullItemReturn) {
GroupItem item("GROUP1");
item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));