timestamp: fix currentTime() problem
[profile/ivi/automotive-message-broker.git] / lib / jsonhelper.h
1 #ifndef _JSON_HELPER_H_
2 #define _JSON_HELPER_H_
3
4 #include "picojson.h"
5
6 #include <memory>
7
8 #include <glib.h>
9
10 class AbstractPropertyType;
11
12 namespace amb
13 {
14 namespace BasicTypes
15 {
16 enum BasicTypeEnum
17 {
18         UInt16,
19         UInt32,
20         Int16,
21         Int32,
22         String,
23         Double,
24         Boolean
25 };
26
27 extern const char * UInt16Str;
28 extern const char * UInt32Str;
29 extern const char * Int16Str;
30 extern const char * Int32Str;
31 extern const char * StringStr;
32 extern const char * DoubleStr;
33 extern const char * BooleanStr;
34
35 /*!
36  * \brief fromSignature get the basic type from gvariant signature
37  * \param sig gvariant signature
38  * \return string representing the basic type
39  */
40 const std::string fromSignature(std::string const & sig);
41
42 /*!
43  * \brief fromAbstractProperty get the basic type from AbstractPropertType
44  * \param property
45  * \return
46  */
47 const std::string fromAbstractProperty(AbstractPropertyType *property);
48
49 } // BasicTypes
50
51 picojson::value gvariantToJson(GVariant* value);
52
53 GVariant * jsonToGVariant(const picojson::value & json, const std::string & signature);
54
55 std::shared_ptr<AbstractPropertyType> jsonToProperty(const picojson::value& json);
56 }
57
58 #endif
59