#include <boost/variant.hpp>\r
#include <boost/lexical_cast.hpp>\r
#include <limits>\r
+#if defined (__TIZENRT__)\r
+#include <apps/netutils/cJSON.h>\r
+#else\r
#include "cJSON.h"\r
+#endif\r
#include <memory>\r
\r
namespace RAML\r
BOOLEAN,\r
STRING,\r
PROPERTY,\r
- ARRAY\r
+ ARRAY,\r
+ OBJECT\r
};\r
+\r
/**\r
- * @class ValueProperty\r
- * @brief This class provides data Model for Json Schema Value Property.\r
- */\r
+ * @class ValueProperty\r
+ * @brief This class provides data Model for Json Schema Value Property.\r
+ */\r
class ValueProperty\r
{\r
public:\r
};\r
\r
/**\r
- * Constructor of ValueProperty.\r
- */\r
+ * Constructor of ValueProperty.\r
+ */\r
ValueProperty();\r
- /**\r
- * Copy Constructor of ValueProperty.\r
- *\r
- * @param ValueProperty.\r
- */\r
+\r
ValueProperty(const ValueProperty &) = default;\r
- /**\r
- * Assignment operator for ValueProperty.\r
- *\r
- * @param ValueProperty.\r
- */\r
+\r
ValueProperty &operator=(const ValueProperty &) = default;\r
- /**\r
- * Copy Constructor of ValueProperty.\r
- *\r
- * @param ValueProperty.\r
- */\r
+\r
ValueProperty(ValueProperty &&) = default;\r
- /**\r
- * Assignment operator for ValueProperty.\r
- *\r
- * @param ValueProperty.\r
- */\r
+\r
ValueProperty &operator=(ValueProperty &&) = default;\r
\r
/**\r
- * explicit Constructor of ValueProperty for Type RANGE.\r
- *\r
- * @param min - minimum value of property.\r
- * @param max- maximum value of property.\r
- * @param multipleOf- multipleOf value of property.\r
- */\r
+ * explicit Constructor of ValueProperty for Type RANGE.\r
+ *\r
+ * @param min - minimum value of property.\r
+ * @param max- maximum value of property.\r
+ * @param multipleOf- multipleOf value of property.\r
+ */\r
explicit ValueProperty(double min, double max, int multipleOf);\r
+\r
/**\r
- * explicit Constructor of ValueProperty for Type VALUE_SET.\r
- *\r
- * @param valueSet - allowed values in the Properties.\r
- */\r
+ * explicit Constructor of ValueProperty for Type VALUE_SET.\r
+ *\r
+ * @param valueSet - allowed values in the Properties.\r
+ */\r
explicit ValueProperty(const std::vector<int> &valueSet);\r
+\r
/**\r
- * explicit Constructor of ValueProperty for Type VALUE_SET.\r
- *\r
- * @param valueSet - allowed values in the Properties.\r
- */\r
+ * explicit Constructor of ValueProperty for Type VALUE_SET.\r
+ *\r
+ * @param valueSet - allowed values in the Properties.\r
+ */\r
explicit ValueProperty(const std::vector<double> &valueSet);\r
+\r
/**\r
- * explicit Constructor of ValueProperty for Type VALUE_SET.\r
- *\r
- * @param valueSet - allowed values in the Properties.\r
- */\r
+ * explicit Constructor of ValueProperty for Type VALUE_SET.\r
+ *\r
+ * @param valueSet - allowed values in the Properties.\r
+ */\r
explicit ValueProperty(const std::vector<bool> &valueSet);\r
+\r
/**\r
- * explicit Constructor of ValueProperty for Type VALUE_SET.\r
- *\r
- * @param valueSet - allowed values in the Properties.\r
- */\r
+ * explicit Constructor of ValueProperty for Type VALUE_SET.\r
+ *\r
+ * @param valueSet - allowed values in the Properties.\r
+ */\r
explicit ValueProperty(const std::vector<std::string> &valueSet);\r
+\r
/**\r
- * explicit Constructor of ValueProperty for Type VALUE_SET.\r
- *\r
- * @param valueSet - allowed values in the Properties.\r
- */\r
+ * explicit Constructor of ValueProperty for Type VALUE_SET.\r
+ *\r
+ * @param valueSet - allowed values in the Properties.\r
+ */\r
explicit ValueProperty(const std::vector<ValueVariant> &valueSet);\r
+\r
/**\r
- * explicit Constructor of ValueProperty for Type PATTERN or FORMAT.\r
- *\r
- * @param type - ValueProperty Type.\r
- * @param value - value for the pattern or format.\r
- */\r
+ * explicit Constructor of ValueProperty for Type PATTERN or FORMAT.\r
+ *\r
+ * @param type - ValueProperty Type.\r
+ * @param value - value for the pattern or format.\r
+ */\r
explicit ValueProperty(Type type, std::string value);\r
+\r
/**\r
- * explicit Constructor of ValueProperty for Type ARRAY.\r
- *\r
- * @param type - ValueProperty Type.\r
- * @param minItems - minimum elements in the Array property.\r
- * @param maxItems - maximum elements in the Array property.\r
- * @param unique - unique elements in the Array property.\r
- * @param additionalItems - additional elements in the Array property.\r
- */\r
+ * explicit Constructor of ValueProperty for Type ARRAY.\r
+ *\r
+ * @param type - ValueProperty Type.\r
+ * @param minItems - minimum elements in the Array property.\r
+ * @param maxItems - maximum elements in the Array property.\r
+ * @param unique - unique elements in the Array property.\r
+ * @param additionalItems - additional elements in the Array property.\r
+ */\r
explicit ValueProperty(Type type, int minItems, int maxItems, bool unique, bool additionalItems);\r
\r
/**\r
- * This method is for getting type of ValueProperty.\r
- *\r
- * @return Type of ValueProperty\r
- */\r
+ * This method is for getting type of ValueProperty.\r
+ *\r
+ * @return Type of ValueProperty\r
+ */\r
Type type() const;\r
+\r
/**\r
- * This method is for getting minimum value of ValueProperty.\r
- *\r
- * @return min value of ValueProperty\r
- */\r
+ * This method is for getting minimum value of ValueProperty.\r
+ *\r
+ * @return min value of ValueProperty\r
+ */\r
double min() const;\r
+\r
/**\r
- * This method is for getting maximum value of ValueProperty.\r
- *\r
- * @return max value of ValueProperty\r
- */\r
+ * This method is for getting maximum value of ValueProperty.\r
+ *\r
+ * @return max value of ValueProperty\r
+ */\r
double max() const;\r
+\r
/**\r
- * This method is for getting multipleOf value of ValueProperty.\r
- *\r
- * @return multipleOf value of ValueProperty\r
- */\r
+ * This method is for getting multipleOf value of ValueProperty.\r
+ *\r
+ * @return multipleOf value of ValueProperty\r
+ */\r
int multipleOf() const;\r
+\r
/**\r
- * This method is for getting pattern value of ValueProperty.\r
- *\r
- * @return pattern value of ValueProperty\r
- */\r
+ * This method is for getting pattern value of ValueProperty.\r
+ *\r
+ * @return pattern value of ValueProperty\r
+ */\r
std::string pattern() const;\r
+\r
/**\r
- * This method is for getting format value of ValueProperty.\r
- *\r
- * @return format value of ValueProperty\r
- */\r
+ * This method is for getting format value of ValueProperty.\r
+ *\r
+ * @return format value of ValueProperty\r
+ */\r
std::string format() const;\r
+\r
/**\r
- * This method is for getting valueSet of ValueProperty.\r
- *\r
- * @return valueSet of ValueProperty\r
- */\r
+ * This method is for getting valueSet of ValueProperty.\r
+ *\r
+ * @return valueSet of ValueProperty\r
+ */\r
int valueSetSize() const;\r
+\r
/**\r
- * This method is for getting valueSet of ValueProperty.\r
- *\r
- * @return valueSet of ValueProperty\r
- */\r
+ * This method is for getting valueSet of ValueProperty.\r
+ *\r
+ * @return valueSet of ValueProperty\r
+ */\r
std::vector<ValueVariant> valueSet() const;\r
+\r
/**\r
- * This method is for getting valueArray of ValueProperty.\r
- *\r
- * @param minItems - reference to get minimum elements in the Array property.\r
- * @param maxItems - reference to get maximum elements in the Array property.\r
- * @param unique - reference to get unique elements in the Array property.\r
- * @param additionalItems - reference to get additional elements in the Array property.\r
- */\r
+ * This method is for getting valueArray of ValueProperty.\r
+ *\r
+ * @param minItems - reference to get minimum elements in the Array property.\r
+ * @param maxItems - reference to get maximum elements in the Array property.\r
+ * @param unique - reference to get unique elements in the Array property.\r
+ * @param additionalItems - reference to get additional elements in the Array property.\r
+ */\r
void valueArray(int &minItems, int &maxItems, bool &unique, bool &additionalItems) const;\r
\r
private:\r
{\r
public:\r
/**\r
- * @class TypeInfo\r
- * @brief This class provides type information of Json Properties.\r
- */\r
+ * @class TypeInfo\r
+ * @brief This class provides type information of Json Properties.\r
+ */\r
class TypeInfo\r
{\r
public:\r
/**\r
- * Constructor of TypeInfo.\r
- *\r
- * @param VariantType - type of property.\r
- * @param VariantType - type of parent property.\r
- * @param int - depth of property.\r
- */\r
- TypeInfo(VariantType, VariantType, int);\r
- /**\r
- * Copy Constructor of TypeInfo.\r
- *\r
- * @param TypeInfo.\r
- */\r
+ * Constructor of TypeInfo.\r
+ *\r
+ * @param VariantType - type of property.\r
+ * @param VariantType - type of parent property.\r
+ * @param int - depth of property.\r
+ */\r
+ TypeInfo(VariantType type = VariantType::UNKNOWN,\r
+ VariantType baseType = VariantType::UNKNOWN,\r
+ int depth = 0);\r
+\r
TypeInfo(const TypeInfo &) = default;\r
- /**\r
- * Assignment operator for TypeInfo.\r
- *\r
- * @param TypeInfo.\r
- */\r
+\r
TypeInfo &operator=(const TypeInfo &) = default;\r
- /**\r
- * Copy Constructor of TypeInfo.\r
- *\r
- * @param TypeInfo.\r
- */\r
+\r
TypeInfo(TypeInfo &&) = default;\r
- /**\r
- * Assignment operator for TypeInfo.\r
- *\r
- * @param TypeInfo.\r
- */\r
+\r
TypeInfo &operator=(TypeInfo &&) = default;\r
- /**\r
- * Constructor of TypeInfo.\r
- */\r
- TypeInfo() = default;\r
\r
/**\r
- * This method is for getting type of properties.\r
- *\r
- * @return VariantType of Property\r
- */\r
+ * This method is for getting type of properties.\r
+ *\r
+ * @return VariantType of Property\r
+ */\r
VariantType type() const;\r
+\r
/**\r
- * This method is for getting base or parent type of properties.\r
- *\r
- * @return VariantType of parent Property\r
- */\r
+ * This method is for getting base or parent type of properties.\r
+ *\r
+ * @return VariantType of parent Property\r
+ */\r
VariantType baseType() const;\r
+\r
/**\r
- * This method is for getting depth of properties.\r
- *\r
- * @return depth as int\r
- */\r
+ * This method is for getting depth of properties.\r
+ *\r
+ * @return depth as int\r
+ */\r
int depth() const;\r
+\r
/**\r
- * operator for TypeInfo to check equality.\r
- *\r
- * @param TypeInfo.\r
- */\r
+ * operator for TypeInfo to check equality.\r
+ *\r
+ * @param TypeInfo.\r
+ */\r
bool operator ==(const TypeInfo &) const;\r
+\r
/**\r
- * operator for TypeInfo to check inequality.\r
- *\r
- * @param TypeInfo.\r
- */\r
+ * operator for TypeInfo to check inequality.\r
+ *\r
+ * @param TypeInfo.\r
+ */\r
bool operator !=(const TypeInfo &) const;\r
\r
private:\r
};\r
\r
/**\r
- * Constructor of Properties.\r
- *\r
- * @param name - Properties name as string.\r
- */\r
+ * Constructor of Properties.\r
+ *\r
+ * @param name - Properties name as string.\r
+ */\r
Properties(const std::string &name) : m_name(name) {}\r
- /**\r
- * Constructor of Properties.\r
- */\r
+\r
Properties() = default;\r
- /**\r
- * Copy Constructor of Properties.\r
- *\r
- * @param Properties.\r
- */\r
+\r
Properties(const Properties &) = default;\r
- /**\r
- * Assignment operator for Properties.\r
- *\r
- * @param Properties.\r
- */\r
+\r
Properties &operator=(const Properties &) = default;\r
- /**\r
- * Copy Constructor of Properties.\r
- *\r
- * @param Properties.\r
- */\r
+\r
Properties(Properties &&) = default;\r
- /**\r
- * Assignment operator for Properties.\r
- *\r
- * @param Properties.\r
- */\r
+\r
Properties &operator=(Properties &&) = default;\r
\r
/**\r
- * This method is for getting TypeInfo of Properties.\r
- *\r
- * @return Properties TypeInfo\r
- */\r
+ * This method is for getting TypeInfo of Properties.\r
+ *\r
+ * @return Properties TypeInfo\r
+ */\r
TypeInfo getType() const;\r
\r
/**\r
- * This method is for setting type of Properties.\r
- *\r
- * @param type -Propertie's Type\r
- */\r
+ * This method is for setting type of Properties.\r
+ *\r
+ * @param type -Propertie's Type\r
+ */\r
void setTypeString(const std::string &type);\r
\r
/**\r
- * This method is for getting Name from Properties.\r
- *\r
- * @return Properties name as string\r
- */\r
+ * This method is for getting Name from Properties.\r
+ *\r
+ * @return Properties name as string\r
+ */\r
std::string getName() const;\r
+\r
/**\r
- * This method is for setting name to Properties\r
- *\r
- * @param name - Properties name as string.\r
- */\r
+ * This method is for setting name to Properties\r
+ *\r
+ * @param name - Properties name as string.\r
+ */\r
void setName(const std::string &name);\r
+\r
/**\r
- * This method is for getting Description from Properties.\r
- *\r
- * @return Description as string\r
- */\r
+ * This method is for getting Description from Properties.\r
+ *\r
+ * @return Description as string\r
+ */\r
std::string getDescription() const;\r
\r
/**\r
- * This method is for setting Description to Properties\r
- *\r
- * @param description - Description as string.\r
- */\r
+ * This method is for setting Description to Properties\r
+ *\r
+ * @param description - Description as string.\r
+ */\r
void setDescription(const std::string &description);\r
\r
/**\r
- * This method is for setting Value to Properties.\r
- *\r
- * @param value - Value of Properties\r
- */\r
+ * This method is for setting Value to Properties.\r
+ *\r
+ * @param value - Value of Properties\r
+ */\r
template <typename T>\r
void setValue(const T &value)\r
{\r
}\r
\r
/**\r
- * This method is for getting Value from Properties.\r
- *\r
- * @return Properties Value\r
- */\r
+ * This method is for getting Value from Properties.\r
+ *\r
+ * @return Properties Value\r
+ */\r
ValueVariant getValue() const;\r
\r
/**\r
- * This method is for getting Value from Properties.\r
- *\r
- * @return Properties Value\r
- */\r
+ * This method is for getting Value from Properties.\r
+ *\r
+ * @return Properties Value\r
+ */\r
template <typename T>\r
T getValue() const\r
{\r
- return boost::get<T>(m_value);\r
+ return boost::get<T>(*(m_value.get()));\r
}\r
\r
/**\r
- * This method is for checking if default Value exists in the Properties.\r
- *\r
- * @return true if present and false if not present\r
- */\r
+ * This method is for checking if default Value exists in the Properties.\r
+ *\r
+ * @return true if present and false if not present\r
+ */\r
bool isDefaultValue() const { return ((m_value != nullptr) ? true : false); }\r
+\r
/**\r
- * This method is for getting ValueProperty from Properties.\r
- *\r
- * @return vector of pointer to ValueProperty\r
- */\r
+ * This method is for getting ValueProperty from Properties.\r
+ *\r
+ * @return vector of pointer to ValueProperty\r
+ */\r
std::vector<std::shared_ptr<ValueProperty> > const &getValueProperties() const;\r
\r
/**\r
- * This method is for setting ValueProperty to Properties\r
- *\r
- * @param value - pointer to ValueProperty\r
- */\r
+ * This method is for setting ValueProperty to Properties\r
+ *\r
+ * @param value - pointer to ValueProperty\r
+ */\r
void setValueProperty(const std::shared_ptr<ValueProperty> &value);\r
\r
\r
/**\r
- * This method is for getting RequiredValue from Properties.\r
- *\r
- * @return list of RequiredValue as string\r
- */\r
+ * This method is for getting RequiredValue from Properties.\r
+ *\r
+ * @return list of RequiredValue as string\r
+ */\r
std::vector<std::string> const &getRequiredValues() const;\r
\r
/**\r
- * This method is for setting RequiredValue to Properties\r
- *\r
- * @param reqValue - RequiredValue as string.\r
- */\r
+ * This method is for setting RequiredValue to Properties\r
+ *\r
+ * @param reqValue - RequiredValue as string.\r
+ */\r
void setRequiredValue(const std::string &reqValue);\r
\r
private:\r