Remove unused pkg dependancy
[platform/upstream/iotivity.git] / service / simulator / ramlparser / raml / jsonSchemaParser / Definitions.cpp
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.cpp\r
23  *\r
24  * @brief   This file provides data Model for Json Schema Definitions.\r
25  */\r
26 \r
27 #include "Definitions.h"\r
28 \r
29 namespace RAML\r
30 {\r
31     std::string Definitions::getName() const\r
32     {\r
33         return m_defName;\r
34     }\r
35 \r
36     void Definitions::setName(const std::string &name)\r
37     {\r
38         m_defName = name;\r
39     }\r
40 \r
41     std::string Definitions::getType() const\r
42     {\r
43         return m_type;\r
44     }\r
45 \r
46     void Definitions::setType(const std::string &type)\r
47     {\r
48         m_type = type;\r
49     }\r
50 \r
51     std::vector<std::string> const &Definitions::getRequiredValues() const\r
52     {\r
53         return m_required;\r
54     }\r
55 \r
56     void Definitions::setRequiredValue(const std::string &reqValue)\r
57     {\r
58         auto it = m_required.begin();\r
59         for (; it != m_required.end(); ++it)\r
60         {\r
61             if (*it == reqValue)\r
62                 break;\r
63         }\r
64         if (m_required.end() == it)\r
65         {\r
66             m_required.push_back(reqValue);\r
67         }\r
68     }\r
69 \r
70     PropertiesPtr Definitions::getproperty(const std::string &propName )\r
71     {\r
72         if (m_properties.end() != m_properties.find(propName))\r
73         {\r
74             return m_properties[propName];\r
75         }\r
76         return nullptr;\r
77     }\r
78 \r
79     std::map<std::string, PropertiesPtr> const  &Definitions::getProperties()\r
80     {\r
81         return m_properties;\r
82     }\r
83 \r
84     void Definitions::addProperty(const std::string &propName, const PropertiesPtr &property)\r
85     {\r
86         if (m_properties.end() == m_properties.find(propName))\r
87         {\r
88             m_properties[propName] =  property;\r
89         }\r
90     }\r
91 }\r