Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / service / simulator / ramlparser / raml / model / AbstractParam.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   AbstractParam.h\r
23  *\r
24  * @brief   This file provides data Model for RAML AbstractParam.\r
25  */\r
26 \r
27 #ifndef ABSTRACT_PARAM_H\r
28 #define ABSTRACT_PARAM_H\r
29 \r
30 \r
31 #include <map>\r
32 #include <list>\r
33 #include <string>\r
34 #include "Utils.h"\r
35 \r
36 \r
37 namespace RAML\r
38 {\r
39     /**\r
40      * @class   AbstractParam\r
41      * @brief   This class provides data Model for RAML AbstractParam.\r
42      */\r
43     class AbstractParam\r
44     {\r
45         public:\r
46             /**\r
47                  * This method is for getting DefaultValue from AbstractParam.\r
48                  *\r
49                  * @return DefaultValue as string.\r
50                  */\r
51             virtual std::string getDefaultValue() const;\r
52 \r
53             /**\r
54                  * This method is for setting DefaultValue to AbstractParam.\r
55                  *\r
56                  * @param defaultValue - DefaultValue as string\r
57                  */\r
58             virtual void setDefaultValue(const std::string &defaultValue);\r
59 \r
60             /**\r
61                  * This method is for getting Description from AbstractParam.\r
62                  *\r
63                  * @return Description as string.\r
64                  */\r
65             virtual std::string getDescription() const;\r
66 \r
67             /**\r
68                  * This method is for setting Description to AbstractParam.\r
69                  *\r
70                  * @param description - Description as string\r
71                  */\r
72             virtual void setDescription(const std::string &description);\r
73 \r
74             /**\r
75                  * This method is for getting DisplayName from AbstractParam.\r
76                  *\r
77                  * @return DisplayName as string.\r
78                  */\r
79             virtual std::string getDisplayName() const;\r
80 \r
81             /**\r
82                  * This method is for setting DisplayName to AbstractParam.\r
83                  *\r
84                  * @param displayName - DisplayName as string\r
85                  */\r
86             virtual void setDisplayName(const std::string &displayName);\r
87 \r
88             /**\r
89                  * This method is for getting Enumeration from AbstractParam.\r
90                  *\r
91                  * @return list of enumeration as string.\r
92                  */\r
93             virtual std::list<std::string> getEnumeration() const;\r
94 \r
95             /**\r
96                  * This method is for setting Enumeration to AbstractParam.\r
97                  *\r
98                  * @param enumeration - Enumeration as string\r
99                  */\r
100             virtual void setEnumeration(const std::string &enumeration);\r
101 \r
102             /**\r
103                  * This method is for getting Example from AbstractParam.\r
104                  *\r
105                  * @return Example as string.\r
106                  */\r
107             virtual std::string getExample() const;\r
108 \r
109             /**\r
110                  * This method is for setting Example to AbstractParam.\r
111                  *\r
112                  * @param example - Example as string\r
113                  */\r
114             virtual void setExample(const std::string &example);\r
115 \r
116             /**\r
117                  * This method is for getting MaxLength from AbstractParam.\r
118                  *\r
119                  * @return MaxLength as int.\r
120                  */\r
121             virtual int getMaxLength() const;\r
122 \r
123             /**\r
124                  * This method is for setting MaxLength to AbstractParam.\r
125                  *\r
126                  * @param maxLength - MaxLength as int\r
127                  */\r
128             virtual void setMaxLength(int maxLength);\r
129 \r
130             /**\r
131                  * This method is for getting Maximum from AbstractParam.\r
132                  *\r
133                  * @return Maximum as int.\r
134                  */\r
135             virtual int getMaximum() const;\r
136 \r
137             /**\r
138                  * This method is for setting Maximum to AbstractParam.\r
139                  *\r
140                  * @param maximum - Maximum as int\r
141                  */\r
142             virtual void setMaximum(int maximum);\r
143 \r
144             /**\r
145                  * This method is for getting MinLength from AbstractParam.\r
146                  *\r
147                  * @return MinLength as int.\r
148                  */\r
149             virtual int getMinLength() const;\r
150 \r
151             /**\r
152                  * This method is for setting MinLength to AbstractParam.\r
153                  *\r
154                  * @param minLength - MinLength as int\r
155                  */\r
156             virtual void setMinLength(int minLength);\r
157 \r
158             /**\r
159                  * This method is for getting Minimum from AbstractParam.\r
160                  *\r
161                  * @return Minimum as int.\r
162                  */\r
163             virtual int getMinimum() const;\r
164 \r
165             /**\r
166                  * This method is for setting Minimum to AbstractParam.\r
167                  *\r
168                  * @param minimum - Minimum as int\r
169                  */\r
170             virtual void setMinimum(int minimum);\r
171 \r
172             /**\r
173                  * This method is for getting Pattern from AbstractParam.\r
174                  *\r
175                  * @return Pattern as string.\r
176                  */\r
177             virtual std::string getPattern() const;\r
178 \r
179             /**\r
180                  * This method is for setting Pattern to AbstractParam.\r
181                  *\r
182                  * @param pattern - Pattern as string\r
183                  */\r
184             virtual void setPattern(const std::string &pattern) ;\r
185 \r
186             /**\r
187                  * This method is for getting Type from AbstractParam.\r
188                  *\r
189                  * @return Type as string.\r
190                  */\r
191             virtual std::string getType() const;\r
192 \r
193             /**\r
194                  * This method is for setting Type to AbstractParam.\r
195                  *\r
196                  * @param type - Type as string\r
197                  */\r
198             virtual void setType(const std::string &type);\r
199 \r
200             /**\r
201                  * This method is for getting isRepeat from AbstractParam.\r
202                  *\r
203                  * @return isRepeat as bool.\r
204                  */\r
205             virtual bool isRepeat() const;\r
206 \r
207             /**\r
208                  * This method is for setting Repeat to AbstractParam.\r
209                  *\r
210                  * @param repeat - Repeat as bool\r
211                  */\r
212             virtual void setRepeat(bool repeat);\r
213 \r
214             /**\r
215                  * This method is for getting isRequired from AbstractParam.\r
216                  *\r
217                  * @return isRequired as bool.\r
218                  */\r
219             virtual bool isRequired() const;\r
220 \r
221             /**\r
222                  * This method is for setting Required to AbstractParam.\r
223                  *\r
224                  * @param required - Required as bool\r
225                  */\r
226             virtual void setRequired(bool required);\r
227 \r
228             /**\r
229                   * Constructor of AbstractParam.\r
230                   */\r
231             AbstractParam() : m_minimum(0), m_maximum(0), m_minLength(0), m_maxLength(0),\r
232                 m_repeat(false), m_required(false) {}\r
233 \r
234             /**\r
235                    * Constructor of AbstractParam.\r
236                    *\r
237                    * @param yamlNode - Reference to YamlNode for reading the AbstractParam\r
238                    *\r
239                    */\r
240             AbstractParam(const YAML::Node &yamlNode) : m_minimum(0), m_maximum(0),\r
241                 m_minLength(0), m_maxLength(0), m_repeat(false), m_required(false)\r
242             {\r
243                 readParameters(yamlNode);\r
244             }\r
245         private:\r
246             virtual void readParameters(const YAML::Node &yamlNode);\r
247 \r
248         private:\r
249             std::string m_defaultValue;\r
250             std::string m_description;\r
251             std::string m_displayName;\r
252             std::list<std::string> m_enumeration;\r
253             std::string m_example;\r
254             int m_minimum;\r
255             int m_maximum;\r
256             int m_minLength;\r
257             int m_maxLength;\r
258             std::string m_pattern;\r
259             bool m_repeat;\r
260             bool m_required;\r
261             std::string m_type;\r
262 \r
263 \r
264     };\r
265 \r
266 }\r
267 #endif\r