Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | List of all members
JSON Class Reference

Utility for extracting JSON-compatible strings, numbers or arrays of numbers in text data. More...

#include <JSON.h>

Collaboration diagram for JSON:
Collaboration graph
[legend]

Public Member Functions

template<>
void handleValue (std::istream &istr, JSONtree2 &dst, const std::string &key)
 

Static Public Member Functions

template<class T >
static void readTree (T &tree, std::istream &istr)
 Reads and parses a JSON file. More...
 
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. More...
 
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. More...
 
static void readArray (const std::string &s, Castable &v)
 Given comma-separated string of values, assign them to variable of minimum compatible type.
 

Static Public Attributes

static FileInfo fileInfo
 

Static Protected Member Functions

template<class T >
static void handleValue (std::istream &istr, T &tree, const std::string &key)
 In reading trees.
 

Detailed Description

Utility for extracting JSON-compatible strings, numbers or arrays of numbers in text data.

Member Function Documentation

◆ handleValue()

void handleValue ( std::istream &  istr,
JSONtree2 &  dst,
const std::string &  key 
)
inline

RECURSION

◆ readTree()

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:
  • array: [

,

,

,<...>]

◆ treeToStream()

std::ostream & treeToStream ( std::ostream &  ostr,
const T &  tree,
const drain::SprinterLayout layout = drain::Sprinter::jsonLayout,
short  indent = 0 
)
static

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: