Disposition attribute in AppControlInfo
[framework/web/wrt-commons.git] / modules / widget_dao / dao / config_parser_data.cpp
index d2550cc..969e20b 100644 (file)
  * @version     0.1
  * @brief
  */
+#include <stddef.h>
 #include <dpl/wrt-dao-ro/config_parser_data.h>
 #include <dpl/log/log.h>
 #include <libxml/xmlreader.h>
 #include <libxml/xmlstring.h>
 
 namespace WrtDB {
+bool IsSpace(const xmlChar* str);
+bool CopyChar(xmlChar* out, xmlChar* in);
 
 bool IsSpace(const xmlChar* str)
 {
@@ -87,6 +90,8 @@ bool IsSpace(const xmlChar* str)
                 case 0xa9:
                 case 0xaf:
                     return true;
+                default:
+                    return false;
                 }
             case 0x81:
                 if (*(str + 2) == 0x9f) {
@@ -115,7 +120,7 @@ bool IsSpace(const xmlChar* str)
 }
 
 bool CopyChar(xmlChar* out,
-        xmlChar* in)
+              xmlChar* in)
 {
     int size = xmlUTF8Size(in);
     switch (size) {
@@ -146,7 +151,7 @@ void NormalizeString(DPL::String& str)
     str = *opt;
 }
 
-void NormalizeString (DPL::Optional<DPL::String>& txt)
+void NormalizeString (DPL::Optional<DPL::String>& txt, bool isTrimSpace)
 {
     if (!!txt) {
         std::string tmp = DPL::ToUTF8String(*txt);
@@ -176,7 +181,7 @@ void NormalizeString (DPL::Optional<DPL::String>& txt)
                 if (c[0] == 0x0) {
                     break;
                 }
-                if (first) {
+                if (first && !isTrimSpace) {
                     xmlChar space[6] = { 0x20 };
                     CopyChar(s, space);
                     s += xmlUTF8Size(s);
@@ -193,104 +198,69 @@ void NormalizeString (DPL::Optional<DPL::String>& txt)
     }
 }
 
-bool ConfigParserData::Param::operator==(const Param& other) const
+void NormalizeAndTrimSpaceString(DPL::OptionalString& txt)
 {
-    return name == other.name && value == other.value;
+    NormalizeString(txt, true);
 }
 
-bool ConfigParserData::Param::operator!=(const Param& other) const
+bool ConfigParserData::Feature::operator==(const Feature& other) const
 {
-    return name != other.name || value != other.value;
+    return name == other.name;
 }
 
-bool ConfigParserData::Param::operator >(const Param& other) const
+bool ConfigParserData::Feature::operator!=(const Feature& other) const
 {
-    if (name == other.name) {
-        return value > other.value;
-    } else {
-        return name > other.name;
-    }
+    return name != other.name;
 }
 
-bool ConfigParserData::Param::operator>=(const Param& other) const
+bool ConfigParserData::Feature::operator >(const Feature& other) const
 {
-    if (name >= other.name) {
-        return true;
-    } else {
-        return value >= other.value;
-    }
+    return name > other.name;
 }
 
-bool ConfigParserData::Param::operator <(const Param& other) const
+bool ConfigParserData::Feature::operator>=(const Feature& other) const
 {
-    if (name == other.name) {
-        return value < other.value;
-    } else {
-        return name < other.name;
-    }
+    return name >= other.name;
 }
 
-bool ConfigParserData::Param::operator<=(const Param& other) const
+bool ConfigParserData::Feature::operator <(const Feature& other) const
 {
-    if (name <= other.name) {
-        return true;
-    } else {
-        return value <= other.value;
-    }
+    return name < other.name;
 }
 
-bool ConfigParserData::Feature::operator==(const Feature& other) const
+bool ConfigParserData::Feature::operator<=(const Feature& other) const
 {
-    return name == other.name && paramsList == other.paramsList;
+    return name <= other.name;
 }
 
-bool ConfigParserData::Feature::operator!=(const Feature& other) const
+bool ConfigParserData::Privilege::operator==(const Privilege& other) const
 {
-    return name != other.name || paramsList != other.paramsList;
+    return name == other.name;
 }
 
-bool ConfigParserData::Feature::operator >(const Feature& other) const
+bool ConfigParserData::Privilege::operator!=(const Privilege& other) const
 {
-    if (name > other.name) {
-        return true;
-    }
-    if (name < other.name) {
-        return false;
-    }
-    return paramsList > other.paramsList;
+    return name != other.name;
 }
 
-bool ConfigParserData::Feature::operator>=(const Feature& other) const
+bool ConfigParserData::Privilege::operator >(const Privilege& other) const
 {
-    if (name > other.name) {
-        return true;
-    }
-    if (name < other.name) {
-        return false;
-    }
-    return paramsList >= other.paramsList;
+    return name > other.name;
 }
 
-bool ConfigParserData::Feature::operator <(const Feature& other) const
+bool ConfigParserData::Privilege::operator>=(const Privilege& other) const
 {
-    if (name < other.name) {
-        return true;
-    }
-    if (name > other.name) {
-        return false;
-    }
-    return paramsList < other.paramsList;
+    return name >= other.name;
 }
 
-bool ConfigParserData::Feature::operator<=(const Feature& other) const
+bool ConfigParserData::Privilege::operator <(const Privilege& other) const
 {
-    if (name < other.name) {
-        return true;
-    }
-    if (name > other.name) {
-        return false;
-    }
-    return paramsList <= other.paramsList;
+    return name < other.name;
+}
+
+bool ConfigParserData::Privilege::operator<=(const Privilege& other) const
+{
+    return name < other.name;
 }
 
 bool ConfigParserData::Icon::operator==(const Icon& other) const
@@ -377,13 +347,13 @@ bool ConfigParserData::AccessInfo::operator <(const AccessInfo& info) const
 bool ConfigParserData::Setting::operator==(const Setting& other) const
 {
     return m_name == other.m_name &&
-        m_value == other.m_value;
+           m_value == other.m_value;
 }
 
 bool ConfigParserData::Setting::operator!=(const Setting& other) const
 {
     return m_name != other.m_name ||
-        m_value != other.m_value;
+           m_value != other.m_value;
 }
 
 bool ConfigParserData::Setting::operator >(const Setting& other) const
@@ -409,16 +379,56 @@ bool ConfigParserData::Setting::operator<=(const Setting& other) const
 bool ConfigParserData::ServiceInfo::operator== (const ServiceInfo& info) const
 {
     return m_src == info.m_src &&
-    m_operation == info.m_operation &&
-    m_scheme == info.m_scheme &&
-    m_mime == info.m_mime;
+           m_operation == info.m_operation &&
+           m_scheme == info.m_scheme &&
+           m_mime == info.m_mime &&
+           m_disposition == info.m_disposition;
 }
 
 bool ConfigParserData::ServiceInfo::operator!= (const ServiceInfo& info) const
 {
-    return m_src != info.m_src &&
-    m_operation != info.m_operation &&
-    m_scheme != info.m_scheme &&
-    m_mime != info.m_mime;
+    return m_src != info.m_src ||
+           m_operation != info.m_operation ||
+           m_scheme != info.m_scheme ||
+           m_mime != info.m_mime ||
+           m_disposition != info.m_disposition;
+}
+
+bool ConfigParserData::AppControlInfo::operator== (const AppControlInfo& info) const
+{
+    return m_src == info.m_src &&
+           m_operation == info.m_operation &&
+           m_uriList == info.m_uriList &&
+           m_mimeList == info.m_mimeList &&
+           m_disposition == info.m_disposition;
+}
+
+bool ConfigParserData::AppControlInfo::operator!= (const AppControlInfo& info) const
+{
+    return m_src != info.m_src ||
+           m_operation != info.m_operation ||
+           m_uriList != info.m_uriList ||
+           m_mimeList != info.m_mimeList ||
+           m_disposition != info.m_disposition;
+}
+
+bool ConfigParserData::LiveboxInfo::operator==(const LiveboxInfo& other) const
+{
+    return m_liveboxId == other.m_liveboxId &&
+           m_autoLaunch == other.m_autoLaunch &&
+           m_updatePeriod == other.m_updatePeriod &&
+           m_primary == other.m_primary &&
+           m_label == other.m_label &&
+           m_icon == other.m_icon;
+}
+
+bool ConfigParserData::LiveboxInfo::operator!=(const LiveboxInfo& other) const
+{
+    return m_liveboxId != other.m_liveboxId &&
+           m_autoLaunch != other.m_autoLaunch &&
+           m_updatePeriod != other.m_updatePeriod &&
+           m_primary != other.m_primary &&
+           m_label != other.m_label &&
+           m_icon != other.m_icon;
 }
 } // namespace WrtDB