From 14df6d0e606deacd13647391b57535bfa3e159e9 Mon Sep 17 00:00:00 2001 From: "SukHyung, Kang" Date: Tue, 12 Mar 2019 17:17:32 +0900 Subject: [PATCH] Add parent item for TextItem and EntryItem Change-Id: I9c458e3f0efab8a25d2ed0f9feeda3282ec5429f Signed-off-by: SukHyung, Kang --- notification-ex/entry_item.cc | 11 ++++++----- notification-ex/entry_item_implementation.h | 3 ++- notification-ex/text_item.cc | 7 ++++--- notification-ex/text_item_implementation.h | 3 ++- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/notification-ex/entry_item.cc b/notification-ex/entry_item.cc index 143a311..31c4caf 100644 --- a/notification-ex/entry_item.cc +++ b/notification-ex/entry_item.cc @@ -33,15 +33,16 @@ namespace notification { namespace item { -EntryItem::EntryItem(std::string id, std::shared_ptr action) - : AbstractItem(id, AbstractItem::Type::Entry), impl_(new Impl()) { +EntryItem::EntryItem(std::shared_ptr action) + : AbstractItem(AbstractItem::Type::Entry), impl_(new Impl(this)) { } -EntryItem::EntryItem(std::shared_ptr action) - : AbstractItem(AbstractItem::Type::Entry), impl_(new Impl()) { +EntryItem::EntryItem(std::string id, std::shared_ptr action) + : AbstractItem(id, AbstractItem::Type::Entry), impl_(new Impl(this)) { } -EntryItem::Impl::Impl() { +EntryItem::Impl::Impl(EntryItem* parent) + : parent_(parent) { LOGI("EntryItem created"); } diff --git a/notification-ex/entry_item_implementation.h b/notification-ex/entry_item_implementation.h index ecfe724..4af69cc 100644 --- a/notification-ex/entry_item_implementation.h +++ b/notification-ex/entry_item_implementation.h @@ -30,11 +30,12 @@ class EntryItem::Impl { virtual ~Impl(); private: - Impl(); + Impl(EntryItem* parent); private: friend class EntryItem; + EntryItem* parent_; std::string text_; int limit_ = 160; }; diff --git a/notification-ex/text_item.cc b/notification-ex/text_item.cc index d883782..cced868 100644 --- a/notification-ex/text_item.cc +++ b/notification-ex/text_item.cc @@ -34,11 +34,12 @@ namespace notification { namespace item { TextItem::TextItem(std::string id, std::string text, std::string hyperlink, std::shared_ptr action) - : AbstractItem(id, AbstractItem::Type::Text), impl_(new Impl(text, hyperlink)) { + : AbstractItem(id, AbstractItem::Type::Text), + impl_(new Impl(this, text, hyperlink)) { } -TextItem::Impl::Impl(std::string text, std::string hyperlink) - : text_(text), hyperlink_(hyperlink) { +TextItem::Impl::Impl(TextItem* parent, std::string text, std::string hyperlink) + : parent_(parent), text_(text), hyperlink_(hyperlink) { LOGI("TextItem created"); } diff --git a/notification-ex/text_item_implementation.h b/notification-ex/text_item_implementation.h index 48eb92b..ee0e567 100644 --- a/notification-ex/text_item_implementation.h +++ b/notification-ex/text_item_implementation.h @@ -30,11 +30,12 @@ class TextItem::Impl { virtual ~Impl(); private: - Impl(std::string text, std::string hyperlink); + Impl(TextItem* parent, std::string text, std::string hyperlink); private: friend class TextItem; + TextItem* parent_; std::string text_; std::string hyperlink_; }; -- 2.7.4