class AccountParser : public ElementParser
{
public:
- struct AccountProviderParser : public ElementParser
+ struct IconParser : public ElementParser
{
- public:
-
- struct IconParser : public ElementParser
- {
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- return &IgnoringParser::Create; //ignore unknown according to w3c
- }
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create; //ignore unknown according to w3c
+ }
- virtual void Accept(const Text& text)
- {
- if (text.value == L"") {
- return;
- }
- m_value = text.value;
+ virtual void Accept(const Text& text)
+ {
+ if (text.value == L"") {
+ return;
}
+ m_value = text.value;
+ }
- virtual void Accept(const Element& /*element*/)
- {}
+ virtual void Accept(const Element& /*element*/)
+ {}
- virtual void Accept(const XmlAttribute& attribute)
- {
- if (attribute.name == L"section") {
- if (attribute.value == L"account") {
- m_type = ConfigParserData::IconSectionType::DefaultIcon;
- } else if (attribute.value == L"account-small") {
- m_type = ConfigParserData::IconSectionType::SmallIcon;
- }
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (attribute.name == L"section") {
+ if (attribute.value == L"Account") {
+ m_type = ConfigParserData::IconSectionType::DefaultIcon;
+ } else if (attribute.value == L"AccountSmall") {
+ m_type = ConfigParserData::IconSectionType::SmallIcon;
}
}
+ }
- virtual void Verify()
- {
- if (m_value.IsNull() || *m_value == L"") {
- return;
- }
-
- std::pair<ConfigParserData::IconSectionType, DPL::String> icon;
- icon.first = m_type;
- icon.second = *m_value;
-
- m_data.m_iconSet.insert(icon);
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
}
- IconParser(ConfigParserData::AccountProvider& data) :
- ElementParser(),
- m_properNamespace(false),
- m_type(ConfigParserData::DefaultIcon),
- m_data(data)
- {}
+ std::pair<ConfigParserData::IconSectionType, DPL::String> icon;
+ icon.first = m_type;
+ icon.second = *m_value;
- private:
- bool m_properNamespace;
- ConfigParserData::IconSectionType m_type;
- ConfigParserData::AccountProvider& m_data;
- DPL::OptionalString m_value;
- };
+ m_data.m_iconSet.insert(icon);
+ }
- struct DisplayNameParser : public ElementParser
- {
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- return &IgnoringParser::Create; //ignore unknown according to w3c
- }
+ IconParser(ConfigParserData::AccountProvider& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_type(ConfigParserData::DefaultIcon),
+ m_data(data)
+ {}
- virtual void Accept(const Text& text)
- {
- if (text.value == L"") {
- return;
- }
- m_value = text.value;
- }
+ private:
+ bool m_properNamespace;
+ ConfigParserData::IconSectionType m_type;
+ ConfigParserData::AccountProvider& m_data;
+ DPL::OptionalString m_value;
+ };
- virtual void Accept(const Element& element)
- {
- m_lang = element.lang;
- m_value= L"";
- }
+ struct DisplayNameParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create; //ignore unknown according to w3c
+ }
- virtual void Accept(const XmlAttribute& /*attribute*/)
- {}
+ virtual void Accept(const Text& text)
+ {
+ if (text.value == L"") {
+ return;
+ }
+ m_value = text.value;
+ }
- virtual void Verify()
- {
- if (m_value.IsNull() || *m_value == L"") {
- return;
- }
+ virtual void Accept(const Element& element)
+ {
+ m_lang = element.lang;
+ m_value= L"";
+ }
- std::pair<DPL::String, DPL::String> name;
- name.first = *m_lang;
- name.second = *m_value;
+ virtual void Accept(const XmlAttribute& /*attribute*/)
+ {}
- m_data.m_displayNameSet.insert(name);
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
}
- DisplayNameParser(ConfigParserData::AccountProvider& data) :
- ElementParser(),
- m_properNamespace(false),
- m_data(data)
- {}
+ std::pair<DPL::String, DPL::String> name;
+ name.first = *m_lang;
+ name.second = *m_value;
- private:
- bool m_properNamespace;
- DPL::OptionalString m_lang;
- DPL::OptionalString m_value;
- ConfigParserData::AccountProvider& m_data;
- };
-
- struct CapabilityParser : public ElementParser
- {
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- return &IgnoringParser::Create; //ignore unknown according to w3c
- }
+ m_data.m_displayNameSet.insert(name);
+ }
- virtual void Accept(const Text& text)
- {
- if (text.value == L"") {
- return;
- }
- m_value = text.value;
- }
+ DisplayNameParser(ConfigParserData::AccountProvider& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
- virtual void Accept(const Element& /*element*/)
- {}
+ private:
+ bool m_properNamespace;
+ DPL::OptionalString m_lang;
+ DPL::OptionalString m_value;
+ ConfigParserData::AccountProvider& m_data;
+ };
- virtual void Accept(const XmlAttribute& /*attribute*/)
- {}
+ struct CapabilityParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create; //ignore unknown according to w3c
+ }
- virtual void Verify()
- {
- if (m_value.IsNull() || *m_value == L"") {
- return;
- }
- m_data.m_capabilityList.push_back(*m_value);
+ virtual void Accept(const Text& text)
+ {
+ if (text.value == L"") {
+ return;
}
+ m_value = text.value;
+ }
- CapabilityParser(ConfigParserData::AccountProvider& data) :
- ElementParser(),
- m_properNamespace(false),
- m_data(data)
+ virtual void Accept(const Element& /*element*/)
{}
- private:
- bool m_properNamespace;
- DPL::OptionalString m_value;
- ConfigParserData::AccountProvider& m_data;
- };
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
- {
- if (name == L"icon") {
- return DPL::MakeDelegate(this, &AccountProviderParser::OnIconElement);
- } else if (name == L"display-name") {
- return DPL::MakeDelegate(this,
- &AccountProviderParser::OnDisplayNameElement);
- } else if (name == L"capability") {
- return DPL::MakeDelegate(this, &AccountProviderParser::OnCapabilityElement);
- } else {
- return &IgnoringParser::Create; //ignore unknown according to w3c
- }
- }
-
- virtual void Accept(const Text& /*text*/)
- {}
+ virtual void Accept(const XmlAttribute& /*attribute*/)
+ {}
- virtual void Accept(const Element& /*element*/)
- {}
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+ m_data.m_capabilityList.push_back(*m_value);
+ }
- virtual void Accept(const XmlAttribute& attribute)
- {
- if (attribute.name == L"multiple-accounts-support") {
- if (attribute.value == L"true") {
- m_multiSupport = true;
- }
- }
- }
+ CapabilityParser(ConfigParserData::AccountProvider& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
- virtual void Verify()
- {
- m_data.m_multiAccountSupport = m_multiSupport;
+ private:
+ bool m_properNamespace;
+ DPL::OptionalString m_value;
+ ConfigParserData::AccountProvider& m_data;
+ };
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& name)
+ {
+ if (name == L"icon") {
+ return DPL::MakeDelegate(this, &AccountParser::OnIconElement);
+ } else if (name == L"display-name") {
+ return DPL::MakeDelegate(this,
+ &AccountParser::OnDisplayNameElement);
+ } else if (name == L"capability") {
+ return DPL::MakeDelegate(this, &AccountParser::OnCapabilityElement);
+ } else {
+ return &IgnoringParser::Create; //ignore unknown according to w3c
}
+ }
- ElementParserPtr OnIconElement()
- {
- return ElementParserPtr(new IconParser(m_data));
- }
+ virtual void Accept(const Text& /*text*/)
+ {}
- ElementParserPtr OnDisplayNameElement()
- {
- return ElementParserPtr(new DisplayNameParser(m_data));
- }
+ virtual void Accept(const Element& /*element*/)
+ {}
- ElementParserPtr OnCapabilityElement()
- {
- return ElementParserPtr(new CapabilityParser(m_data));
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (attribute.name == L"multiple-account-support") {
+ if (attribute.value == L"true") {
+ m_account.m_multiAccountSupport = true;
+ }
}
+ }
- AccountProviderParser(ConfigParserData::AccountProvider& data) :
- ElementParser(),
- m_properNamespace(false),
- m_multiSupport(false),
- m_data(data)
- {}
-
- private:
- bool m_properNamespace;
- bool m_multiSupport;
- ConfigParserData::AccountProvider& m_data;
- };
-
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
- {
- if (name == L"account-provider") {
- return DPL::MakeDelegate(this, &AccountParser::OnProviderElement);
- } else {
- return &IgnoringParser::Create; //ignore unknown according to w3c
- }
- }
-
- virtual void Accept(const Element& element)
- {
- if (element.ns == ConfigurationNamespace::TizenWebAppNamespaceName) {
- m_properNamespace = true;
- }
- }
+ virtual void Verify()
+ {
+ }
- virtual void Accept(const XmlAttribute& /*attribute*/)
- {}
+ ElementParserPtr OnIconElement()
+ {
+ return ElementParserPtr(new IconParser(m_account));
+ }
- virtual void Accept(const Text& /*text*/)
- {}
+ ElementParserPtr OnDisplayNameElement()
+ {
+ return ElementParserPtr(new DisplayNameParser(m_account));
+ }
- virtual void Verify()
- {}
+ ElementParserPtr OnCapabilityElement()
+ {
+ return ElementParserPtr(new CapabilityParser(m_account));
+ }
- ElementParserPtr OnProviderElement()
+ AccountParser(ConfigParserData& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_multiSupport(false),
+ m_data(data),
+ m_account(data.accountProvider)
{
- return ElementParserPtr(new AccountProviderParser(m_account));
}
- AccountParser(ConfigParserData& data) :
- ElementParser(),
- m_data(data),
- m_account(data.accountProvider),
- m_properNamespace(false),
- m_multiSupport(false)
- {}
-
private:
- ConfigParserData& m_data;
- ConfigParserData::AccountProvider& m_account;
- bool m_properNamespace;
- bool m_multiSupport;
+ bool m_properNamespace;
+ bool m_multiSupport;
+ ConfigParserData& m_data;
+ ConfigParserData::AccountProvider& m_account;
};
class MetadataParser : public ElementParser