Fix for SVACE and Klocwork issues in RAML parser module. 71/5371/2
authorHarish Kumara Marappa <h.marappa@samsung.com>
Thu, 3 Mar 2016 20:24:50 +0000 (01:54 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Fri, 4 Mar 2016 05:53:15 +0000 (05:53 +0000)
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>
service/simulator/ramlparser/raml/jsonSchemaParser/JsonSchema.cpp
service/simulator/ramlparser/raml/jsonSchemaParser/Properties.cpp
service/simulator/ramlparser/raml/jsonSchemaParser/Properties.h
service/simulator/ramlparser/raml/model/Schema.h

index bc69828..0207404 100755 (executable)
@@ -510,15 +510,15 @@ namespace RAML
         {\r
             if (itemValues->type == 5)\r
             {\r
-                int item_size = cJSON_GetArraySize(itemValues);\r
+                //int item_size = cJSON_GetArraySize(itemValues);\r
                 int item_index = 0;\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
             else\r
             {\r
@@ -527,7 +527,7 @@ namespace RAML
         }\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
@@ -649,6 +649,7 @@ namespace RAML
             {\r
                 readAllowedValues(allowedvalues, prop, type);\r
             }\r
+            readValues(item, prop, type);\r
             prop->setTypeString(type);\r
             property->setValue(*prop);\r
         }\r
@@ -718,6 +719,11 @@ namespace RAML
 \r
     void JsonSchema::readFile(std::string &fileName ,  JsonParameters &param)\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
@@ -728,6 +734,11 @@ namespace RAML
 \r
     void JsonSchema::readFile(std::string &fileName , std::string &defName ,  JsonParameters &param)\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
@@ -747,7 +758,7 @@ namespace RAML
         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
index bc29606..8905525 100755 (executable)
@@ -137,10 +137,8 @@ namespace RAML
         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
@@ -338,23 +336,24 @@ namespace RAML
             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_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
-        else\r
-        {\r
-            m_type = ValueProperty::Type::UNKNOWN;\r
-        }\r
     }\r
 \r
     ValueProperty::Type ValueProperty::type() const\r
index 04e9dc8..dd784d8 100755 (executable)
@@ -63,10 +63,11 @@ namespace RAML
         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
@@ -82,146 +83,145 @@ namespace RAML
             };\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
@@ -246,78 +246,64 @@ namespace RAML
     {\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
@@ -327,85 +313,69 @@ namespace RAML
             };\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
@@ -413,17 +383,17 @@ namespace RAML
             }\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
@@ -431,38 +401,39 @@ namespace RAML
             }\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
index c1c95d3..b50233e 100755 (executable)
@@ -43,61 +43,66 @@ namespace RAML
     {\r
         public:\r
             /**\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
-                 * 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
-                 * 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
-                  * 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
-                 * 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
-                   * 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
-                  * 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(const Schema&) = delete;\r
+            Schema& operator=(const Schema&) = delete;\r
+            Schema(Schema&&) = delete;\r
+            Schema& operator=(Schema&&) = delete;\r
+\r
             /**\r
-                  * Destructor of Schema.\r
-                  */\r
+             * Destructor of Schema.\r
+             */\r
             ~Schema() { cJSON_Delete(m_cjson); }\r
 \r
         private:\r