Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / service / simulator / src / common / resource_model_schema_builder.h
1 /******************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************/
20
21 #ifndef SIMULATOR_RESOURCE_MODEL_SCHEMA_BUILDER_H_
22 #define SIMULATOR_RESOURCE_MODEL_SCHEMA_BUILDER_H_
23
24 #include "simulator_resource_model_schema.h"
25
26 namespace RAML
27 {
28     class RequestResponseBody;
29     class Properties;
30     class ValueProperty;
31     enum class VariantType;
32 }
33
34 class ResourceModelSchemaBuilder
35 {
36     public:
37         ResourceModelSchemaBuilder(const std::shared_ptr<RAML::RequestResponseBody> &ramlSchema);
38         std::shared_ptr<SimulatorResourceModelSchema> build();
39
40     private:
41         std::shared_ptr<AttributeProperty> buildAttribute(
42             const std::shared_ptr<RAML::Properties> &property);
43
44         std::shared_ptr<IntegerProperty> buildIntegerAttribute(
45             const std::shared_ptr<RAML::Properties> &property);
46
47         std::shared_ptr<DoubleProperty> buildDoubleAttribute(
48             const std::shared_ptr<RAML::Properties> &property);
49
50         std::shared_ptr<BooleanProperty> buildBooleanAttribute(
51             const std::shared_ptr<RAML::Properties> &property);
52
53         std::shared_ptr<StringProperty> buildStringAttribute(
54             const std::shared_ptr<RAML::Properties> &property);
55
56         std::shared_ptr<ArrayProperty> buildArrayAttribute(
57             const std::shared_ptr<RAML::Properties> &property);
58
59         std::shared_ptr<ArrayProperty> buildModelArrayAttribute(
60             const std::shared_ptr<RAML::Properties> &property);
61
62         std::shared_ptr<ModelProperty> buildModelAttribute(
63             const std::shared_ptr<RAML::Properties> &property);
64
65         void setArrayProperties(
66             const std::shared_ptr<RAML::Properties> &property,
67             const std::shared_ptr<ArrayProperty> &arrayProperty);
68
69         std::shared_ptr<RAML::RequestResponseBody> m_ramlSchema;
70 };
71
72 #endif