Utility for extracting JSON-compatible strings, numbers or arrays of numbers in text data.
More...
#include <JSON.h>
|
template<> |
void | handleValue (std::istream &istr, JSONtree &dst, const std::string &key) |
|
|
template<class T > |
static void | readTree (T &tree, std::istream &istr) |
| Reads and parses a JSON file.
|
|
template<class T > |
static std::ostream & | treeToStream (std::ostream &ostr, const T &tree, const drain::SprinterLayout &layout=drain::Sprinter::jsonLayout, short indent=0) |
| Write a tree into an output stream using JSON layout by default.
|
|
static void | readValue (std::istream &istr, Castable &v, bool keepType=false) |
| Read a value (JSON syntax). Read stream until a value has been extracted, with type recognition.
|
|
static void | readValue (const std::string &s, Castable &v, bool keepType=false) |
| Read value (JSON syntax). Read stream until a value has been extracted, with type recognition.
|
|
static void | readArray (const std::string &s, Castable &v) |
| Given comma-separated string of values, assign them to variable of minimum compatible type.
|
|
|
template<class T > |
static void | handleValue (std::istream &istr, T &tree, const std::string &key) |
| In reading trees.
|
|
Utility for extracting JSON-compatible strings, numbers or arrays of numbers in text data.
◆ handleValue()
template<>
void handleValue |
( |
std::istream & |
istr, |
|
|
JSONtree & |
dst, |
|
|
const std::string & |
key |
|
) |
| |
|
inline |
◆ readTree()
template<class T >
void readTree |
( |
T & |
tree, |
|
|
std::istream & |
istr |
|
) |
| |
|
static |
Reads and parses a JSON file.
- Template Parameters
-
- | tree type, especially drain::Tree<K,V> |
◆ readValue()
void readValue |
( |
const std::string & |
s, |
|
|
Castable & |
v, |
|
|
bool |
keepType = false |
|
) |
| |
|
static |
Read value (JSON syntax). Read stream until a value has been extracted, with type recognition.
Allowed syntax:
- string: "<value>"
- scalar:
,
,
,<...>]
◆ treeToStream()
Write a tree into an output stream using JSON layout by default.
SprinterLayout offers flexibility in formatting. JSON layout is the default.
The documentation for this class was generated from the following files:
- src/drain/util/JSON.h
- src/drain/util/JSON.cpp