libqi-api  release-2.5.3-2016-11-18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
jsoncodec.hpp
Go to the documentation of this file.
1 #pragma once
2 /*
3 ** Copyright (C) 2013 Aldebaran Robotics
4 ** See COPYING for the license
5 */
6 
7 #ifndef _QI_TYPE_JSONCODEC_HPP_
8 #define _QI_TYPE_JSONCODEC_HPP_
9 
10 #include <qi/api.hpp>
11 #include <qi/anyvalue.hpp>
12 
13 namespace qi {
14 
15  // Do not use enum here because we want to pipe those values and we don't want to cast them each time we pipe them
16  using JsonOption = int;
17  const unsigned int JsonOption_None = 0;
18  const unsigned int JsonOption_PrettyPrint = 1;
19  const unsigned int JsonOption_Expand = 2;
20 
25  QI_API std::string encodeJSON(const qi::AutoAnyReference &val, JsonOption jsonPrintOption = JsonOption_None);
26 
32  QI_API qi::AnyValue decodeJSON(const std::string &in);
33 
41  QI_API std::string::const_iterator decodeJSON(const std::string::const_iterator &begin,
42  const std::string::const_iterator &end,
43  AnyValue &target);
44 
45 
46 
47 }
48 
49 #endif // _QITYPE_JSONCODEC_HPP_
#define QI_API
Definition: api.hpp:33
const unsigned int JsonOption_Expand
Definition: jsoncodec.hpp:19
dll import/export and compiler message
const unsigned int JsonOption_None
Definition: jsoncodec.hpp:17
qi::AnyValue decodeJSON(const std::string &in)
const unsigned int JsonOption_PrettyPrint
Definition: jsoncodec.hpp:18
int JsonOption
Definition: jsoncodec.hpp:16
std::string encodeJSON(const qi::AutoAnyReference &val, JsonOption jsonPrintOption=JsonOption_None)