namespace Jobs {
namespace WidgetInstall {
-
/**
* @brief string with optional language attribute
*/
class StringWithLang
{
-public:
+ public:
StringWithLang() { }
- StringWithLang(DPL::String s): string(s) { }
- StringWithLang(DPL::String s, DPL::String l): string(s), lang(l) { }
- DPL::String getString() { return this->string; }
- DPL::String getLang() { return this->lang; }
- bool hasLang() { return !this->lang.empty(); }
-private:
+ StringWithLang(DPL::String s) : string(s) { }
+ StringWithLang(DPL::String s, DPL::String l) : string(s), lang(l) { }
+ DPL::String getString()
+ {
+ return this->string;
+ }
+ DPL::String getLang()
+ {
+ return this->lang;
+ }
+ bool hasLang()
+ {
+ return !this->lang.empty();
+ }
+ int operator==(const StringWithLang &other)
+ {
+ return (DPL::ToUTF8String(other.string) == DPL::ToUTF8String(string)) &&
+ (DPL::ToUTF8String(other.lang) == DPL::ToUTF8String(lang));
+ }
+
+ private:
DPL::String string;
DPL::String lang;
};
/**
* These types are basicaly strings but they should allow usage of different
* range of characters or words (details in XML spec.).
- * For simplicity DPL::Strings are used, although this can lead to XML validation
+ * For simplicity DPL::Strings are used, although this can lead to XML
+ * validation
* errors (related to usage of not allowed characters in given places).
*/
typedef DPL::String NcnameType, NmtokenType, AnySimpleType, LangType;
typedef DPL::String OperationType, MimeType, UriType, TypeType, PackageType;
typedef DPL::OptionalString InstallLocationType, CategoriesType;
typedef DPL::String AppCategoryType;
+typedef DPL::String KeyType, ValueType;
/**
* xmllib2 wrappers
void writeElement(xmlTextWriterPtr writer, const char * name, DPL::String body);
void writeText(xmlTextWriterPtr writer, DPL::String text);
void writeElement(xmlTextWriterPtr writer, const char * name, const char * body);
-void writeElementWithOneAttribute(xmlTextWriterPtr writer, const char * name,
- const char * body, const char * nameAttr, DPL::String bodyAttr,
- bool condition = true);
+void writeElementWithOneAttribute(xmlTextWriterPtr writer,
+ const char * name,
+ const char * body,
+ const char * nameAttr,
+ DPL::String bodyAttr,
+ bool condition = true);
void startElement(xmlTextWriterPtr writer, const char * name);
void endElement(xmlTextWriterPtr writer);
void writeAttribute(xmlTextWriterPtr writer, const char * name,
- DPL::String body, bool condition);
+ DPL::String body, bool condition);
void writeAttribute(xmlTextWriterPtr writer, const char * name,
- const char * body, bool condition);
+ const char * body, bool condition);
/**
* @brief author element
*/
class Author
{
-public:
+ public:
Author() {}
Author(AnySimpleType e,
- NcnameType h,
- LangType l,
- DPL::String b)
- : email(e), href(h), lang(l), body(b) {}
+ NcnameType h,
+ LangType l,
+ DPL::String b) :
+ email(e), href(h), lang(l), body(b) {}
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
AnySimpleType email;
NcnameType href;
LangType lang;
*/
class AppControl
{
-public:
+ public:
AppControl() {}
- void addOperation(const OperationType &x) { this->operation.push_back(x); }
- void addUri(const UriType &x) { this->uri.push_back(x); }
- void addMime(const MimeType &x) { this->mime.push_back(x); }
+ void addOperation(const OperationType &x)
+ {
+ this->operation.push_back(x);
+ }
+ void addUri(const UriType &x)
+ {
+ this->uri.push_back(x);
+ }
+ void addMime(const MimeType &x)
+ {
+ this->mime.push_back(x);
+ }
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
std::list<OperationType> operation; //attr name AnySimpleType
std::list<UriType> uri; //attr name AnySimpleType
std::list<MimeType> mime; //attr name AnySimpleType
typedef AppControl AppControlType;
/**
+ * @brief account element
+ */
+typedef std::list<std::pair<DPL::String, DPL::String>> IconListType;
+typedef std::list<LabelType> DisplayNameListType;
+typedef std::list<DPL::String> AccountCapabilityType;
+
+struct AccountProvider
+{
+ NcnameType appid;
+ NcnameType multiAccount;
+ IconListType icon;
+ DisplayNameListType name;
+ AccountCapabilityType capability;
+};
+
+typedef AccountProvider AccountProviderType;
+
+class Account
+{
+ public:
+ Account() {}
+ void addAccountProvider(const AccountProvider &x)
+ {
+ this->provider = x;
+ }
+ void serialize(xmlTextWriterPtr writer);
+
+ private:
+ AccountProviderType provider;
+};
+
+class Privilege
+{
+ public:
+ Privilege() {}
+ void addPrivilegeName(const DPL::String &x)
+ {
+ this->name.push_back(x);
+ }
+ bool isEmpty()
+ {
+ return this->name.empty();
+ }
+
+ void serialize(xmlTextWriterPtr writer);
+
+ private:
+ std::list<DPL::String> name;
+};
+
+typedef Privilege PrivilegeType;
+
+class Metadata
+{
+ public:
+ Metadata(KeyType k, ValueType v) :
+ key(k),
+ value(v)
+ {}
+ void serialize(xmlTextWriterPtr writer);
+
+ private:
+ KeyType key;
+ ValueType value;
+};
+
+typedef Metadata MetadataType;
+
+
+/**
* @brief ime-application element
*/
class ImeApplication
{
-public:
+ public:
ImeApplication() {}
- void setAppid(const NcnameType &x) { this->appid = x; }
- void setExec(const NcnameType &x) { this->exec = x; }
- void setMultiple(bool x) { this->multiple = x; }
- void setNodisplay(bool x) { this->nodisplay = x; }
- void setType(const TypeType &x) { this->type = x; }
- void addLabel(const LabelType &x) { this->label.push_back(x); }
- void addIcon(const IconType &x) { this->icon.push_back(x); }
+ void setAppid(const NcnameType &x)
+ {
+ this->appid = x;
+ }
+ void setExec(const NcnameType &x)
+ {
+ this->exec = x;
+ }
+ void setMultiple(bool x)
+ {
+ this->multiple = x;
+ }
+ void setNodisplay(bool x)
+ {
+ this->nodisplay = x;
+ }
+ void setType(const TypeType &x)
+ {
+ this->type = x;
+ }
+ void addLabel(const LabelType &x)
+ {
+ this->label.push_back(x);
+ }
+ void addIcon(const IconType &x)
+ {
+ this->icon.push_back(x);
+ }
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
NcnameType appid;
NcnameType exec;
DPL::OptionalBool multiple;
*/
class ServiceApplication
{
-public:
+ public:
ServiceApplication() {}
- void setAppid(const NcnameType &x) { this->appid = x; }
- void setAutoRestart(bool x) { this->autoRestart = x; }
- void setExec(const AnySimpleType &x) { this->exec = x; }
- void setOnBoot(bool x) { this->onBoot = x; }
- void setType(const TypeType &x) { this->type = x; }
- void addLabel(const LabelType &x) { this->label.push_back(x); }
- void addIcon(const IconType &x) { this->icon.push_back(x); }
+ void setAppid(const NcnameType &x)
+ {
+ this->appid = x;
+ }
+ void setAutoRestart(bool x)
+ {
+ this->autoRestart = x;
+ }
+ void setExec(const AnySimpleType &x)
+ {
+ this->exec = x;
+ }
+ void setOnBoot(bool x)
+ {
+ this->onBoot = x;
+ }
+ void setType(const TypeType &x)
+ {
+ this->type = x;
+ }
+ void addLabel(const LabelType &x)
+ {
+ this->label.push_back(x);
+ }
+ void addIcon(const IconType &x)
+ {
+ this->icon.push_back(x);
+ }
void addAppControl(const AppControlType &x)
{
this->appControl.push_back(x);
}
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
NcnameType appid;
DPL::OptionalBool autoRestart;
AnySimpleType exec;
*/
class UiApplication
{
-public:
+ public:
UiApplication() {}
- void setAppid(const NcnameType &x) { this->appid = x; }
- void setExtraid(const NcnameType &x) { this->extraid = x; }
- void setExec(const AnySimpleType &x) { this->exec = x; }
- void setMultiple(bool x) { this->multiple = x; }
- void setNodisplay(bool x) { this->nodisplay = x; }
- void setTaskmanage(bool x) { this->taskmanage = x; }
- void setType(const TypeType &x) { this->type = x; }
- void setCategories(const NcnameType &x) { this->categories = x; }
- void addLabel(const LabelType &x) { this->label.push_back(x); }
- void addIcon(const IconType &x) { this->icon.push_back(x); }
+ void setAppid(const NcnameType &x)
+ {
+ this->appid = x;
+ }
+ void setExtraid(const NcnameType &x)
+ {
+ this->extraid = x;
+ }
+ void setExec(const AnySimpleType &x)
+ {
+ this->exec = x;
+ }
+ void setMultiple(bool x)
+ {
+ this->multiple = x;
+ }
+ void setNodisplay(bool x)
+ {
+ this->nodisplay = x;
+ }
+ void setTaskmanage(bool x)
+ {
+ this->taskmanage = x;
+ }
+ void setType(const TypeType &x)
+ {
+ this->type = x;
+ }
+ void setCategories(const NcnameType &x)
+ {
+ this->categories = x;
+ }
+ void addLabel(const LabelType &x)
+ {
+ this->label.push_back(x);
+ }
+ void addIcon(const IconType &x)
+ {
+ this->icon.push_back(x);
+ }
void addAppControl(const AppControlType &x)
{
this->appControl.push_back(x);
{
this->appCategory.push_back(x);
}
+ void addMetadata(const MetadataType &m)
+ {
+ this->metadata.push_back(m);
+ }
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
NcnameType appid;
NcnameType extraid;
AnySimpleType exec;
std::list<IconType> icon;
std::list<AppControlType> appControl;
std::list<AppCategoryType> appCategory;
+ std::list<MetadataType> metadata;
};
typedef UiApplication UiApplicationType;
/**
* @brief LiveBox element
*/
-typedef std::list<std::pair<DPL::String, DPL::String>> boxSizeType;
-
+typedef std::list<std::pair<DPL::String, DPL::String> > boxSizeType;
struct BoxInfo
{
NcnameType boxSrc;
+ NcnameType boxMouseEvent;
+ NcnameType boxTouchEffect;
boxSizeType boxSize;
NcnameType pdSrc;
NcnameType pdWidth;
class LiveBox
{
-public:
+ public:
LiveBox() { }
- void setLiveboxId(const NcnameType &x) { this->liveboxId = x; }
- void setPrimary(const NcnameType &x) { this->primary = x; }
- void setAutoLaunch(const NcnameType &x) { this->autoLaunch = x; }
- void setUpdatePeriod(const NcnameType &x) { this->updatePeriod = x; }
- void setLabel(const NcnameType &x) { this->label = x; }
- void setIcon(const NcnameType &x) { this->icon = x; }
- void setBox(const BoxInfoType &x) { this->box = x; }
+ void setLiveboxId(const NcnameType &x)
+ {
+ this->liveboxId = x;
+ }
+ void setPrimary(const NcnameType &x)
+ {
+ this->primary = x;
+ }
+ void setUpdatePeriod(const NcnameType &x)
+ {
+ this->updatePeriod = x;
+ }
+ void setLabel(const NcnameType &x)
+ {
+ this->label = x;
+ }
+ void setIcon(const NcnameType &x)
+ {
+ this->icon = x;
+ }
+ void setBox(const BoxInfoType &x)
+ {
+ this->box = x;
+ }
void serialize(xmlTextWriterPtr writer);
-private:
+ private:
NcnameType liveboxId;
NcnameType primary;
NcnameType autoLaunch;
*/
class Manifest
{
-public:
+ public:
Manifest() {}
void serialize(xmlTextWriterPtr writer);
void generate(DPL::String filename);
- void addLabel(const LabelType &x) { this->label.push_back(x); }
- void addIcon(const IconType &x) { this->icon.push_back(x); }
- void addAuthor(const AuthorType &x) { this->author.push_back(x); };
+ void addLabel(const LabelType &x)
+ {
+#ifdef MULTIPROCESS_SERVICE_SUPPORT
+ auto pos = std::find(label.begin(), label.end(), x);
+ if (pos == label.end()) {
+ this->label.push_back(x);
+ }
+#else
+ this->label.push_back(x);
+#endif
+ }
+ void addIcon(const IconType &x)
+ {
+ this->icon.push_back(x);
+ }
+ void addAuthor(const AuthorType &x)
+ {
+ this->author.push_back(x);
+ }
void addDescription(const DescriptionType &x)
{
this->description.push_back(x);
}
-// void addCompatibility(const CompatibilityType &x)
-// {
-// this->compatibility.push_back(x);
-// }
-// void addDeviceProfile(const DeviceProfileType &x)
-// {
-// this->deviceProfile.push_back(x);
-// }
+ // void addCompatibility(const CompatibilityType &x)
+ // {
+ // this->compatibility.push_back(x);
+ // }
+ // void addDeviceProfile(const DeviceProfileType &x)
+ // {
+ // this->deviceProfile.push_back(x);
+ // }
void addServiceApplication(const ServiceApplicationType &x)
{
this->serviceApplication.push_back(x);
{
this->imeApplication.push_back(x);
}
-// void addFont(const FontType &x) { this->font.push_back(x); }
+ // void addFont(const FontType &x) { this->font.push_back(x); }
void addLivebox(const LiveBoxInfo &x)
{
this->livebox.push_back(x);
}
+ void addAccount(const Account &x)
+ {
+ this->account.push_back(x);
+ }
+
+ void addPrivileges(const PrivilegeType &x)
+ {
+ this->privileges = x;
+ }
+
void setInstallLocation(const InstallLocationType &x)
{
this->installLocation = x;
}
- void setPackage(const NcnameType &x) { this->package = x; }
- void setType(const PackageType &x) { this->type = x; }
- void setVersion(const NmtokenType &x) { this->version = x; }
-private:
+ void setPackage(const NcnameType &x)
+ {
+ this->package = x;
+ }
+ void setType(const PackageType &x)
+ {
+ this->type = x;
+ }
+ void setVersion(const NmtokenType &x)
+ {
+ this->version = x;
+ }
+
+ private:
std::list<LabelType> label;
std::list<IconType> icon;
std::list<AuthorType> author;
std::list<DescriptionType> description;
-// std::list<CompatibilityType> compatibility;
-// std::list<DeviceProfileType> deviceProfile;
+ // std::list<CompatibilityType> compatibility;
+ // std::list<DeviceProfileType> deviceProfile;
std::list<ServiceApplicationType> serviceApplication;
std::list<UiApplicationType> uiApplication;
std::list<ImeApplicationType> imeApplication;
-// std::list<FontType> font;
+ // std::list<FontType> font;
std::list<LiveBoxInfo> livebox;
InstallLocationType installLocation;
NcnameType package;
PackageType type;
NmtokenType version;
-};
+ std::list<Account> account;
+ PrivilegeType privileges;
+};
} //namespace Jobs
} //namespace WidgetInstall