This includes code changes for following issues
1. SVACE reported issues.
2. Klocwork reported issues.
3. Setting array minimum, maximum, unique and additional items property properly.
Change-Id: I7ffd8f985ff6db02c1469c6c86884f9c5baadaf5
Signed-off-by: Harish Kumara Marappa <h.marappa@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/5371
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
{\r
if (itemValues->type == 5)\r
{\r
{\r
if (itemValues->type == 5)\r
{\r
- int item_size = cJSON_GetArraySize(itemValues);\r
+ //int item_size = cJSON_GetArraySize(itemValues);\r
- do\r
- {\r
- cJSON *item = cJSON_GetArrayItem(itemValues, item_index);\r
- readItems(item, property);\r
- break; \r
- }\r
- while ( ++item_index < item_size);\r
+ //do\r
+ //{\r
+ cJSON *item = cJSON_GetArrayItem(itemValues, item_index);\r
+ readItems(item, property);\r
+ //break;\r
+ //}\r
+ //while ( ++item_index < item_size);\r
}\r
cJSON *itemsMax = cJSON_GetObjectItem(childProperties, "maxItems");\r
int min = INT_MIN, max = INT_MAX;\r
}\r
cJSON *itemsMax = cJSON_GetObjectItem(childProperties, "maxItems");\r
int min = INT_MIN, max = INT_MAX;\r
- bool unique = cJSON_True, addItems = cJSON_True;\r
+ bool unique = cJSON_False, addItems = cJSON_False;\r
if (itemsMax)\r
{\r
cJSON *exclusiveMax = cJSON_GetObjectItem(childProperties, "exclusiveMaximum");\r
if (itemsMax)\r
{\r
cJSON *exclusiveMax = cJSON_GetObjectItem(childProperties, "exclusiveMaximum");\r
{\r
readAllowedValues(allowedvalues, prop, type);\r
}\r
{\r
readAllowedValues(allowedvalues, prop, type);\r
}\r
+ readValues(item, prop, type);\r
prop->setTypeString(type);\r
property->setValue(*prop);\r
}\r
prop->setTypeString(type);\r
property->setValue(*prop);\r
}\r
\r
void JsonSchema::readFile(std::string &fileName , JsonParameters ¶m)\r
{\r
\r
void JsonSchema::readFile(std::string &fileName , JsonParameters ¶m)\r
{\r
+ std::string name = fileName;\r
+ std::transform(name.begin(), name.end(), name.begin(), ::tolower);\r
+ if (name.compare("oic.baseresource.json") == 0)\r
+ return;\r
+\r
cJSON *json = m_includeResolver->readToJson(fileName);\r
JsonSchemaPtr Refparser = std::make_shared<JsonSchema>(json, m_includeResolver);\r
\r
cJSON *json = m_includeResolver->readToJson(fileName);\r
JsonSchemaPtr Refparser = std::make_shared<JsonSchema>(json, m_includeResolver);\r
\r
\r
void JsonSchema::readFile(std::string &fileName , std::string &defName , JsonParameters ¶m)\r
{\r
\r
void JsonSchema::readFile(std::string &fileName , std::string &defName , JsonParameters ¶m)\r
{\r
+ std::string name = fileName;\r
+ std::transform(name.begin(), name.end(), name.begin(), ::tolower);\r
+ if (name.compare("oic.baseresource.json") == 0)\r
+ return;\r
+\r
cJSON *json = m_includeResolver->readToJson(fileName);\r
JsonSchemaPtr Refparser = std::make_shared<JsonSchema>(json, m_includeResolver);\r
\r
cJSON *json = m_includeResolver->readToJson(fileName);\r
JsonSchemaPtr Refparser = std::make_shared<JsonSchema>(json, m_includeResolver);\r
\r
std::string fileName;\r
if (! ref.empty())\r
{\r
std::string fileName;\r
if (! ref.empty())\r
{\r
- std::size_t pos = ref.find(delimiter1);\r
+ std::size_t pos = std::string::npos;\r
if ( (pos = ref.find(delimiter1)) != std::string::npos)\r
{\r
fileName = ref.substr(0, pos);\r
if ( (pos = ref.find(delimiter1)) != std::string::npos)\r
{\r
fileName = ref.substr(0, pos);\r
m_typeString = type;\r
}\r
\r
m_typeString = type;\r
}\r
\r
- Properties::TypeInfo::TypeInfo(\r
- VariantType type = VariantType::UNKNOWN,\r
- VariantType baseType = VariantType::UNKNOWN,\r
- int depth = 0)\r
+ Properties::TypeInfo::TypeInfo(VariantType type,\r
+ VariantType baseType, int depth)\r
: m_type (type), m_baseType(baseType), m_depth(depth) {}\r
\r
VariantType Properties::TypeInfo::type() const\r
: m_type (type), m_baseType(baseType), m_depth(depth) {}\r
\r
VariantType Properties::TypeInfo::type() const\r
m_min(INT_MIN),\r
m_max(INT_MAX),\r
m_multipleOf(INT_MAX),\r
m_min(INT_MIN),\r
m_max(INT_MAX),\r
m_multipleOf(INT_MAX),\r
- m_minItems(INT_MIN),\r
- m_maxItems(INT_MAX),\r
+ m_minItems(1),\r
+ m_maxItems(20),\r
m_unique(false),\r
m_additionalItems(false)\r
{\r
if (type == ValueProperty::Type::ARRAY)\r
{\r
m_type = ValueProperty::Type::ARRAY;\r
m_unique(false),\r
m_additionalItems(false)\r
{\r
if (type == ValueProperty::Type::ARRAY)\r
{\r
m_type = ValueProperty::Type::ARRAY;\r
- m_minItems = minItems;\r
- m_maxItems = maxItems;\r
+\r
+ if (minItems > 0)\r
+ m_minItems = minItems;\r
+\r
+ if (maxItems != INT_MAX && maxItems > m_minItems)\r
+ m_maxItems = maxItems;\r
+\r
m_unique = unique;\r
m_additionalItems = additionalItems;\r
}\r
m_unique = unique;\r
m_additionalItems = additionalItems;\r
}\r
- else\r
- {\r
- m_type = ValueProperty::Type::UNKNOWN;\r
- }\r
}\r
\r
ValueProperty::Type ValueProperty::type() const\r
}\r
\r
ValueProperty::Type ValueProperty::type() const\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
class ValueProperty\r
{\r
public:\r
- * Constructor of ValueProperty.\r
- */\r
+ * Constructor of ValueProperty.\r
+ */\r
- /**\r
- * Copy Constructor of ValueProperty.\r
- *\r
- * @param ValueProperty.\r
- */\r
ValueProperty(const ValueProperty &) = default;\r
ValueProperty(const ValueProperty &) = default;\r
- /**\r
- * Assignment operator for ValueProperty.\r
- *\r
- * @param ValueProperty.\r
- */\r
ValueProperty &operator=(const ValueProperty &) = default;\r
ValueProperty &operator=(const ValueProperty &) = default;\r
- /**\r
- * Copy Constructor of ValueProperty.\r
- *\r
- * @param ValueProperty.\r
- */\r
ValueProperty(ValueProperty &&) = default;\r
ValueProperty(ValueProperty &&) = default;\r
- /**\r
- * Assignment operator for ValueProperty.\r
- *\r
- * @param ValueProperty.\r
- */\r
ValueProperty &operator=(ValueProperty &&) = default;\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
explicit ValueProperty(double min, double max, int multipleOf);\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
explicit ValueProperty(const std::vector<int> &valueSet);\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
explicit ValueProperty(const std::vector<double> &valueSet);\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
explicit ValueProperty(const std::vector<bool> &valueSet);\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
explicit ValueProperty(const std::vector<std::string> &valueSet);\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
explicit ValueProperty(const std::vector<ValueVariant> &valueSet);\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
explicit ValueProperty(Type type, std::string value);\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
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
- * 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
- * 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
- * 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
int multipleOf() const;\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
std::string pattern() const;\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
std::string format() const;\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
int valueSetSize() const;\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
std::vector<ValueVariant> valueSet() const;\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
void valueArray(int &minItems, int &maxItems, bool &unique, bool &additionalItems) const;\r
\r
private:\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
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
TypeInfo(const TypeInfo &) = default;\r
- /**\r
- * Assignment operator for TypeInfo.\r
- *\r
- * @param TypeInfo.\r
- */\r
TypeInfo &operator=(const TypeInfo &) = default;\r
TypeInfo &operator=(const TypeInfo &) = default;\r
- /**\r
- * Copy Constructor of TypeInfo.\r
- *\r
- * @param TypeInfo.\r
- */\r
TypeInfo(TypeInfo &&) = default;\r
TypeInfo(TypeInfo &&) = default;\r
- /**\r
- * Assignment operator for TypeInfo.\r
- *\r
- * @param TypeInfo.\r
- */\r
TypeInfo &operator=(TypeInfo &&) = default;\r
TypeInfo &operator=(TypeInfo &&) = default;\r
- /**\r
- * Constructor of TypeInfo.\r
- */\r
- TypeInfo() = default;\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
VariantType type() const;\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
VariantType baseType() const;\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
- * 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
bool operator ==(const TypeInfo &) const;\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
bool operator !=(const TypeInfo &) const;\r
\r
private:\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
Properties(const std::string &name) : m_name(name) {}\r
- /**\r
- * Constructor of Properties.\r
- */\r
Properties() = default;\r
Properties() = default;\r
- /**\r
- * Copy Constructor of Properties.\r
- *\r
- * @param Properties.\r
- */\r
Properties(const Properties &) = default;\r
Properties(const Properties &) = default;\r
- /**\r
- * Assignment operator for Properties.\r
- *\r
- * @param Properties.\r
- */\r
Properties &operator=(const Properties &) = default;\r
Properties &operator=(const Properties &) = default;\r
- /**\r
- * Copy Constructor of Properties.\r
- *\r
- * @param Properties.\r
- */\r
Properties(Properties &&) = default;\r
Properties(Properties &&) = default;\r
- /**\r
- * Assignment operator for Properties.\r
- *\r
- * @param Properties.\r
- */\r
Properties &operator=(Properties &&) = default;\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
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
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
std::string getName() const;\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
void setName(const std::string &name);\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
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
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
template <typename T>\r
void setValue(const T &value)\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
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
template <typename T>\r
T getValue() const\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
bool isDefaultValue() const { return ((m_value != nullptr) ? true : false); }\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
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
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
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
void setRequiredValue(const std::string &reqValue);\r
\r
private:\r
- * This method is for getting CJson object of schema.\r
- *\r
- * @return pointer to cJSON.\r
- */\r
+ * This method is for getting CJson object of schema.\r
+ *\r
+ * @return pointer to cJSON.\r
+ */\r
virtual cJSON *getJson() const;\r
\r
/**\r
virtual cJSON *getJson() const;\r
\r
/**\r
- * This method is for setting schema as CJson object.\r
- *\r
- * @param cjson - Cjson pointer.\r
- */\r
+ * This method is for setting schema as CJson object.\r
+ *\r
+ * @param cjson - Cjson pointer.\r
+ */\r
virtual void setJson(cJSON *cjson);\r
\r
/**\r
virtual void setJson(cJSON *cjson);\r
\r
/**\r
- * This method is for getting schema as string.\r
- *\r
- * @return string.\r
- */\r
+ * This method is for getting schema as string.\r
+ *\r
+ * @return string.\r
+ */\r
virtual std::string getSchema() const;\r
\r
/**\r
virtual std::string getSchema() const;\r
\r
/**\r
- * This method is for setting schema as string.\r
- *\r
- * @param schema - schema string.\r
- */\r
+ * This method is for setting schema as string.\r
+ *\r
+ * @param schema - schema string.\r
+ */\r
virtual void setSchema(const std::string &schema);\r
\r
/**\r
virtual void setSchema(const std::string &schema);\r
\r
/**\r
- * This method is for getting Properties from JsonSchema.\r
- *\r
- * @return pointer to JsonSchema.\r
- */\r
+ * This method is for getting Properties from JsonSchema.\r
+ *\r
+ * @return pointer to JsonSchema.\r
+ */\r
virtual JsonSchemaPtr const &getProperties() const;\r
\r
/**\r
virtual JsonSchemaPtr const &getProperties() const;\r
\r
/**\r
- * Constructor of Schema.\r
- *\r
- * @param schema - contents of schema to be parsed\r
- * @param includeResolver - Reference to IncludeResolver for reading external files\r
- *\r
- */\r
+ * Constructor of Schema.\r
+ *\r
+ * @param schema - contents of schema to be parsed\r
+ * @param includeResolver - Reference to IncludeResolver for reading external files\r
+ *\r
+ */\r
Schema(const std::string &schema, const IncludeResolverPtr &includeResolver):\r
m_schema(schema) , m_cjson(cJSON_Parse(schema.c_str())),\r
m_resProperties(std::make_shared<JsonSchema>(m_cjson, includeResolver) ) ,\r
m_includeResolver(includeResolver) {}\r
\r
/**\r
Schema(const std::string &schema, const IncludeResolverPtr &includeResolver):\r
m_schema(schema) , m_cjson(cJSON_Parse(schema.c_str())),\r
m_resProperties(std::make_shared<JsonSchema>(m_cjson, includeResolver) ) ,\r
m_includeResolver(includeResolver) {}\r
\r
/**\r
- * Constructor of Schema.\r
- */\r
+ * Constructor of Schema.\r
+ */\r
Schema(): m_cjson(NULL), m_resProperties(std::make_shared<JsonSchema>()),\r
m_includeResolver(NULL) {}\r
\r
Schema(): m_cjson(NULL), m_resProperties(std::make_shared<JsonSchema>()),\r
m_includeResolver(NULL) {}\r
\r
+ Schema(const Schema&) = delete;\r
+ Schema& operator=(const Schema&) = delete;\r
+ Schema(Schema&&) = delete;\r
+ Schema& operator=(Schema&&) = delete;\r
+\r
- * Destructor of Schema.\r
- */\r
+ * Destructor of Schema.\r
+ */\r
~Schema() { cJSON_Delete(m_cjson); }\r
\r
private:\r
~Schema() { cJSON_Delete(m_cjson); }\r
\r
private:\r