ConfigParserData& m_data;
};
+class LiveboxParser : public ElementParser
+{
+ public:
+
+ struct LabelParser : public ElementParser
+ {
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns ==
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const Text& text)
+ {
+ if(m_properNamespace)
+ m_label = text.value;
+ }
+
+ virtual void Verify()
+ {
+ m_data.m_label = m_label;
+ }
+
+ LabelParser(ConfigParserData::LiveboxInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {
+ }
+
+ private:
+ DPL::String m_label;
+ ConfigParserData::LiveboxInfo& m_data;
+ bool m_properNamespace;
+ };
+
+ struct IconParser : public ElementParser
+ {
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if(m_properNamespace) {
+ if (attribute.name == L"src") {
+ m_icon = attribute.value;
+ }
+ }
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns ==
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {
+ }
+
+ virtual void Verify()
+ {
+ m_data.m_icon = m_icon;
+ }
+
+ explicit IconParser(ConfigParserData::LiveboxInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {
+ }
+
+ private:
+ DPL::String m_icon;
+ ConfigParserData::LiveboxInfo& m_data;
+ bool m_properNamespace;
+ };
+
+ struct BoxParser : public ElementParser
+ {
+ struct PdParser : public ElementParser
+ {
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& name)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if(m_properNamespace) {
+ if (attribute.name == L"src") {
+ m_src = attribute.value;
+ } else if (attribute.name == L"width") {
+ m_width = attribute.value;
+ } else if (attribute.name == L"height") {
+ m_height = attribute.value;
+ }
+ }
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns ==
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {
+ }
+
+ virtual void Verify()
+ {
+ m_data.m_pdSrc = m_src;
+ m_data.m_pdWidth = m_width;
+ m_data.m_pdHeight = m_height;
+ }
+
+ explicit PdParser(ConfigParserData::LiveboxInfo::Box& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {
+ }
+
+ private:
+ DPL::String m_src;
+ DPL::String m_width;
+ DPL::String m_height;
+
+ bool m_properNamespace;
+ ConfigParserData::LiveboxInfo::Box& m_data;
+ };
+
+ struct SizeParser : public ElementParser
+ {
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if(m_properNamespace) {
+ if (attribute.name == L"preview") {
+ m_preview = attribute.value;
+ }
+ }
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns ==
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const Text& text)
+ {
+ if(m_properNamespace)
+ m_size = text.value;
+ }
+
+ virtual void Verify()
+ {
+ std::pair<DPL::String, DPL::String> boxSize;
+ boxSize.first = m_size;
+ boxSize.second = m_preview;
+ m_data.m_boxSize.push_back(boxSize);
+ }
+
+ explicit SizeParser(ConfigParserData::LiveboxInfo::Box& data) :
+ ElementParser(),
+ m_data(data)
+ {
+ }
+
+ private:
+ DPL::String m_size;
+ DPL::String m_preview;
+ bool m_properNamespace;
+ ConfigParserData::LiveboxInfo::Box& m_data;
+ };
+
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& name)
+ {
+ if (name == L"boxsize") {
+ return DPL::MakeDelegate(this, &LiveboxParser::BoxParser::OnSizeElement);
+ } else if (name == L"pd") {
+ return DPL::MakeDelegate(this, &LiveboxParser::BoxParser::OnPdElement);
+ }
+ }
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (m_properNamespace) {
+ if (attribute.name == L"src")
+ m_box.m_boxSrc = attribute.value;
+ }
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns ==
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {
+ }
+
+ virtual void Verify()
+ {
+ m_data.m_boxInfo = m_box;
+ }
+
+ explicit BoxParser(ConfigParserData::LiveboxInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {
+ }
+
+ ElementParserPtr OnPdElement()
+ {
+ return ElementParserPtr(new PdParser(m_box));
+ }
+
+ ElementParserPtr OnSizeElement()
+ {
+ return ElementParserPtr(new SizeParser(m_box));
+ }
+
+ private:
+ DPL::String m_src;
+ ConfigParserData::LiveboxInfo& m_data;
+ bool m_properNamespace;
+ ConfigParserData::LiveboxInfo::Box m_box;
+
+ };
+
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& name)
+ {
+ if (name == L"label") {
+ return DPL::MakeDelegate(this, &LiveboxParser::OnLabelElement);
+ } else if (name == L"icon") {
+ return DPL::MakeDelegate(this, &LiveboxParser::OnIconElement);
+ } else if (name == L"box") {
+ return DPL::MakeDelegate(this, &LiveboxParser::OnBoxElement);
+ } else {
+ return &IgnoringParser::Create;
+ }
+ }
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (m_properNamespace) {
+ if (attribute.name == L"appid") {
+ m_appId = attribute.value;
+ } else if (attribute.name == L"auto_launch") {
+ m_autoLaunch = attribute.value;
+ } else if (attribute.name == L"period") {
+ m_period = attribute.value;
+ } else if (attribute.name == L"network") {
+ m_network = attribute.value;
+ LogDebug("@@@ "<<m_network);
+ } else if (attribute.name == L"nodisplay") {
+ m_nodisplay = attribute.value;
+ } else if (attribute.name == L"primary") {
+ m_primary = attribute.value;
+ } else if (attribute.name == L"timeout") {
+ m_timeout = attribute.value;
+ }
+ }
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns ==
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {
+ }
+
+ virtual void Verify()
+ {
+ m_livebox.m_appId = m_appId;
+ m_livebox.m_autoLaunch = m_autoLaunch;
+ m_livebox.m_period = m_period;
+ m_livebox.m_network = m_network;
+ m_livebox.m_nodisplay = m_nodisplay;
+ m_livebox.m_primary = m_primary;
+ m_livebox.m_timeout = m_timeout;
+
+ m_data.m_livebox.push_back(m_livebox);
+ }
+
+ explicit LiveboxParser(ConfigParserData& data) :
+ ElementParser(),
+ m_data(data),
+ m_properNamespace(false)
+ {
+ m_livebox = ConfigParserData::LiveboxInfo();
+ }
+
+ ElementParserPtr OnLabelElement()
+ {
+ return ElementParserPtr(new LabelParser(m_livebox));
+ }
+
+ ElementParserPtr OnIconElement()
+ {
+ return ElementParserPtr(new IconParser(m_livebox));
+ }
+ ElementParserPtr OnBoxElement()
+ {
+ return ElementParserPtr(new BoxParser(m_livebox));
+ }
+
+ private:
+ ConfigParserData& m_data;
+ ConfigParserData::LiveboxInfo m_livebox;
+ DPL::String m_appId;
+ DPL::String m_autoLaunch;
+ DPL::String m_period;
+ DPL::String m_network;
+ DPL::String m_nodisplay;
+ DPL::String m_primary;
+ DPL::String m_timeout;
+ bool m_properNamespace;
+
+};
+
ElementParser::ActionFunc WidgetParser::GetElementParser(const DPL::String& /*ns*/,
const DPL::String& name)
{
&WidgetParser::OnAppControlElement);
m_map[L"category"] = DPL::MakeDelegate(this,
&WidgetParser::OnCategoryElement);
+ m_map[L"livebox"] = DPL::MakeDelegate(this, &WidgetParser::OnLiveboxElement);
+
}
ElementParserPtr WidgetParser::OnNameElement()
return ElementParserPtr(new CategoryParser(m_data));
}
+ElementParserPtr WidgetParser::OnLiveboxElement()
+{
+ return ElementParserPtr(new LiveboxParser(m_data));
+}
+
void WidgetParser::Accept(const Element& element)
{
if (element.ns != ConfigurationNamespace::W3CWidgetNamespaceName &&