53 #include <json_spirit_value.h> 66 extern template class json_spirit::Config_map<std::string>;
67 extern template class json_spirit::Value_impl<json_spirit::Config_map<std::string>>;
86 boost::mpl::bool_<boost::is_same<T, std::string>::value || boost::is_arithmetic<T>::value>
102 #define MIRA_JSON_TRAIT(B,T) \ 104 struct TypeTrait<T> \ 109 MIRA_JSON_TRAIT(
int,
char)
110 MIRA_JSON_TRAIT(
int, uint8)
111 MIRA_JSON_TRAIT(
int, uint16)
112 MIRA_JSON_TRAIT(int64, uint32)
113 MIRA_JSON_TRAIT(
int, int8)
114 MIRA_JSON_TRAIT(
int, int16)
115 MIRA_JSON_TRAIT(
int, int32)
116 MIRA_JSON_TRAIT(
double,
float)
119 MIRA_JSON_TRAIT(
double,
long double)
125 template <
typename T>
131 template <
typename T>
134 return static_cast<T
>(value);
163 static unsigned int get() {
return instance().mPrecision; }
166 unsigned int mPrecision;
204 bool formatted=
false,
int precision = -1);
243 std::string::const_iterator& end,
269 const std::string& elementName);
300 const std::string& elementName);
324 const std::string& elementName);
355 const std::string& elementName);
380 template <
typename OStream>
399 template <
typename IStream>
408 template <
typename CharT>
412 is.seekg(-1, std::ios_base::cur);
OStream & operator<<(OStream &os, const mira::JSONValue &value)
Definition: JSON.h:381
MIRA_BASE_EXPORT bool hasNumberElement(const Value &iValue, const std::string &element)
Query existence of number element/member in a json::Value Use this variant to only query whether the ...
static void reset()
Reset default precision for json::write() to initial default value (MIRA_JSON_DEFAULT_PRECISION).
Definition: JSON.h:160
Implementation of the CreationPolicy that is used by the Singleton template.
Definition: Singleton.h:174
static Type & instance()
Returns a reference to the singleton instance.
Definition: Singleton.h:544
json_spirit::mArray Array
A representation of an array (vector) in JSON.
Definition: JSON.h:190
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
IStream & operator>>(IStream &is, mira::JSONValue &value)
Definition: JSON.h:400
A struct used for return value of getElementIfExists()
Definition: JSON.h:283
MIRA_BASE_EXPORT QueryNumberResult getNumberElementIfExists(const Value &iValue, const std::string &elementName)
Get a number element/member from a json::Value if it exists, otherwise the returned result will conta...
Type trait that indicates whether a type can be serialized as an atomic value.
Definition: IsAtomicSerializable.h:83
std::string error
empty if exists is true
Definition: JSON.h:341
MIRA_BASE_EXPORT bool hasElement(const Value &iValue, const std::string &element)
Query existence of element/member in a json::Value Use this variant to only query whether the element...
Output stream adapter that can be assigned to any output stream and allows binary output using the <<...
Definition: BinaryStream.h:293
A struct used for return value of getNumberElementIfExists()
Definition: JSON.h:338
MIRA_BASE_EXPORT void write(const Value &value, std::ostream &ioStream, bool formatted=false, int precision=-1)
Writes a json::Value into a given stream using the JSON format.
Commonly used exception classes.
A singleton template class that can be freely configured using policies that control the instantiatio...
Definition: Singleton.h:531
A singleton class that can be freely configured using policies that control the creation, instantiation, lifetime and thread-safety.
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295
MIRA_BASE_EXPORT void read(const std::string &s, Value &oValue)
Read a json::Value from a string that contains JSON format.
json_spirit::mObject Object
A representation of an object (class, struct) in JSON.
Definition: JSON.h:183
static const unsigned int MIRA_JSON_DEFAULT_PRECISION
Default value if not changed using set().
Definition: JSON.h:153
MIRA_BASE_EXPORT QueryValueResult getElementIfExists(const Value &iValue, const std::string &elementName)
Get a json::Value element/member from a json::Value if it exists, otherwise the returned result will ...
JSONDefaultPrecision()
Definition: JSON.h:150
json_spirit::mValue Value
A value is an abstract description of data in JSON (underlying data can either be one of the JSON bas...
Definition: JSON.h:176
JSONDefaultPrecision is a singleton that provides a mechanism to control the default precision for ou...
Definition: JSON.h:145
json::Array JSONArray
Imports the json::Array type into mira namespace.
Definition: JSON.h:367
Contains the BinaryIStream and BinaryOStream classes for fast and efficient streaming of binary data...
Value value
undefined if exists is false
Definition: JSON.h:285
std::string error
empty if exists is true
Definition: JSON.h:286
Provides type trait that indicates whether a type can be serialized as atomic value.
PropertyHint precision(int p)
Sets the attribute "precision".
Definition: PropertyHint.h:285
json::Object JSONObject
Imports the json::Object type into mira namespace.
Definition: JSON.h:365
bool exists
Definition: JSON.h:339
MIRA_BASE_EXPORT double getNumberElement(const Value &iValue, const std::string &elementName)
Get a number element/member from a json::Value See getElement() for basic syntax. ...
json::Value JSONValue
Imports the json::Value type into mira namespace.
Definition: JSON.h:363
bool exists
Definition: JSON.h:284
double number
undefined if exists is false
Definition: JSON.h:340
MIRA_BASE_EXPORT Value getElement(const Value &iValue, const std::string &elementName)
Get a json::Value element/member from a json::Value Syntax: