Modifying version number for building on tizen 3.0
[platform/upstream/iotivity.git] / resource / include / AttributeValue.h
1
2 //******************************************************************
3 //
4 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 //
6 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 //      http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // Unless required by applicable law or agreed to in writing, software
15 // distributed under the License is distributed on an "AS IS" BASIS,
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 // See the License for the specific language governing permissions and
18 // limitations under the License.
19 //
20 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21
22 /// @file AttributeValue.h
23
24 /// @brief  This file contains the definition of the internally used
25 // type AttributeValue
26
27 #ifndef __ATTRIBUTEVALUE_H
28 #define __ATTRIBUTEVALUE_H
29
30 // These defines are required to get the boost::variant to hold more than 20 items.
31 // documentation requires that you use a power of 10
32 #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
33 #define BOOST_MPL_LIMIT_LIST_SIZE 30
34 #define BOOST_MPL_LIMIT_VECTOR_SIZE 30
35 #include <boost/variant.hpp>
36
37 namespace OC
38 {
39     class OCRepresentation;
40
41     struct NullType{};
42     // Since null needs to be encoded in a special fashion in JSON, the encoder
43     // needs to know the index of the NullType Sentinel  Any time the code does a special
44     // case for the NullType, we use the AttributeValueNullIndex.  This MUST be kept up to date
45     // with the variant's which() for NullType.
46     static const int AttributeValueNullIndex = 0;
47     typedef boost::variant<
48
49         // Base values:
50         NullType, // Note: this handles the null-type and must match the above static const
51         int,
52         double,
53         bool,
54         std::string,
55         OC::OCRepresentation,
56
57         // Sequences:
58         std::vector<int>,
59         std::vector<double>,
60         std::vector<bool>,
61         std::vector<std::string>,
62         std::vector<OC::OCRepresentation>,
63
64         // Nested sequences:
65         std::vector<std::vector<int>>,
66         std::vector<std::vector<std::vector<int>>>,
67
68         std::vector<std::vector<double>>,
69         std::vector<std::vector<std::vector<double>>>,
70
71         std::vector<std::vector<bool>>,
72         std::vector<std::vector<std::vector<bool>>>,
73
74         std::vector<std::vector<std::string>>,
75         std::vector<std::vector<std::vector<std::string>>>,
76
77         std::vector<std::vector<OC::OCRepresentation>>,
78         std::vector<std::vector<std::vector<OC::OCRepresentation>>>
79     > AttributeValue;
80
81 }
82 #endif // __ATTRIBUTEVALUE_H