Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / service / simulator / ramlparser / raml / jsonSchemaParser / Definitions.h
1 /******************************************************************\r
2  *\r
3  * Copyright 2015 Samsung Electronics All Rights Reserved.\r
4  *\r
5  *\r
6  *\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  *\r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  *\r
19  ******************************************************************/\r
20 \r
21 /**\r
22  * @file   Definitions.h\r
23  *\r
24  * @brief   This file provides data Model for Json Schema Definitions.\r
25  */\r
26 \r
27 #ifndef DEFINITIONS_H_\r
28 #define DEFINITIONS_H_\r
29 \r
30 #include <string>\r
31 #include <vector>\r
32 #include <map>\r
33 #include "Properties.h"\r
34 #include <memory>\r
35 \r
36 namespace RAML\r
37 {\r
38     /**\r
39      * @class   Definitions\r
40      * @brief   This class provides data Model for Json Schema Definitions.\r
41      */\r
42     class Definitions\r
43     {\r
44         public:\r
45 \r
46             /**\r
47                   * Constructor of Definitions.\r
48                   */\r
49             Definitions() = default;\r
50             /**\r
51                   * Copy Constructor of Definitions.\r
52                   *\r
53                   * @param Definitions\r
54                   */\r
55             Definitions(const Definitions &) = default;\r
56             /**\r
57                   * Assignment operator for Definitions.\r
58                   *\r
59                   * @param Definitions\r
60                   */\r
61             Definitions &operator=(const Definitions &) = default;\r
62             /**\r
63                   * Copy Constructor of Definitions.\r
64                   *\r
65                   * @param Definitions\r
66                   */\r
67             Definitions(Definitions &&) = default;\r
68             /**\r
69                   * Assignment operator for Definitions.\r
70                   *\r
71                   * @param Definitions\r
72                   */\r
73             Definitions &operator=(Definitions &&) = default;\r
74 \r
75             /**\r
76                   * Constructor of Definitions.\r
77                   *\r
78                   * @param name - Definitions name as string.\r
79                   */\r
80             Definitions(const std::string &name) : m_defName(name) {}\r
81 \r
82             /**\r
83                  * This method is for getting Name from Definitions.\r
84                  *\r
85                  * @return Definitions name as string\r
86                  */\r
87             std::string getName() const;\r
88             /**\r
89                  * This method is for setting name to Definitions\r
90                  *\r
91                  * @param name - Definitions name as string.\r
92                  */\r
93             void setName(const std::string &name);\r
94 \r
95             /**\r
96                  * This method is for getting Type from Definitions.\r
97                  *\r
98                  * @return Definitions Type as string\r
99                  */\r
100             std::string getType() const;\r
101 \r
102             /**\r
103                  * This method is for setting Type to Definitions\r
104                  *\r
105                  * @param type - Definitions Type as string.\r
106                  */\r
107             void setType(const std::string &type);\r
108             /**\r
109                  * This method is for getting RequiredValue from Definitions.\r
110                  *\r
111                  * @return list of RequiredValue as string\r
112                  */\r
113             std::vector<std::string> const &getRequiredValues() const;\r
114 \r
115             /**\r
116                  * This method is for setting RequiredValue to Definitions\r
117                  *\r
118                  * @param reqValue - RequiredValue as string.\r
119                  */\r
120             void setRequiredValue(const std::string &reqValue);\r
121 \r
122             /**\r
123                  * This method is for getting size of Properties from Definitions.\r
124                  *\r
125                  * @return size of Properties map\r
126                  */\r
127             int propertiesSize() const { return m_properties.size(); }\r
128 \r
129             /**\r
130                  * This method is for getting Properties from Definitions.\r
131                  *\r
132                  * @param propName - name of property as string.\r
133                  *\r
134                  * @return pointer to Properties.\r
135                  */\r
136             PropertiesPtr getproperty(const std::string &propName );\r
137 \r
138             /**\r
139                  * This method is for getting Properties from Definitions.\r
140                  *\r
141                  * @return map of Property name and pointer to Properties\r
142                  */\r
143             std::map<std::string, PropertiesPtr> const  &getProperties();\r
144 \r
145             /**\r
146                  * This method is for setting Properties to Definitions\r
147                  *\r
148                  * @param propName - Definitions Type as string.\r
149                  * @param property - pointer to Properties.\r
150                  */\r
151             void addProperty(const std::string &propName, const PropertiesPtr &property);\r
152 \r
153         private:\r
154             std::map<std::string, PropertiesPtr > m_properties;\r
155             std::string m_defName;\r
156             std::string m_type;\r
157             std::vector<std::string> m_required;\r
158 \r
159     };\r
160 \r
161     /** DefinitionsPtr - shared Ptr to Definitions.*/\r
162     typedef std::shared_ptr<Definitions> DefinitionsPtr;\r
163 \r
164 }\r
165 #endif\r