MLIB
Loading...
Searching...
No Matches
json.h File Reference

Definition of json::node class. More...

#include <functional>
#include <map>
#include <memory>
#include <mlib/errorcode.h>
#include <iomanip>
#include <string>
#include <vector>

Go to the source code of this file.

Data Structures

class  json::node
 Representation of a JSON node. More...
 
class  json::node::iterator_type< C_ >
 node iterator More...
 
struct  json::omanip
 

Macros

#define JSON_FMT_INDENT   0x01
 Indent JSON string when writing.
 
#define JSON_FMT_QUOTESLASH   0x02
 Quote all solidus ('/') characters.
 
#define ERR_JSON_INVTYPE   -1
 invalid node type
 
#define ERR_JSON_TOOMANY   -2
 too many descendants
 
#define ERR_JSON_ITERTYPE   -3
 invalid iterator type
 
#define ERR_JSON_ITERPOS   -4
 invalid iterator position
 
#define ERR_JSON_INPUT   -5
 invalid character in input stream
 
#define ERR_JSON_SIZE   -7
 invalid element size
 
#define ERR_JSON_MISSING   -8
 invalid index or key on const node
 

Enumerations

enum class  json::type {
  null , object , array , numeric ,
  string , boolean
}
 JSON node types.
 

Functions

mlib::errfacjson::Errors ()
 Return error facility used for JSON errors.
 
void json::Errors (mlib::errfac &facility)
 Set error facility for JSON errors.
 
void json::indenter (std::ios_base &os, int spaces)
 
omanip json::spaces (int nspc)
 
std::ostream & json::indent (std::ostream &os)
 
std::ostream & json::tabs (std::ostream &os)
 
std::ostream & json::noindent (std::ostream &os)
 
std::ostream & json::operator<< (std::ostream &os, const node &n)
 Write a JSON object to a stream.
 
std::istream & json::operator>> (std::istream &is, node &n)
 Read a JSON node from a stream.
 
template<typename T>
void json::to_json (node &n, const std::vector< T > &vec)
 Assign array value to a node.
 

Variables

constexpr int json::max_array_size = 8192
 Maximum number of array elements in a JSON node.
 
constexpr int json::max_object_names = 8192
 Maximum number of properties for a node.
 
constexpr int json::max_string_length = 8192
 Maximum string length.
 

Detailed Description

Definition of json::node class.

(c) Mircea Neacsu 2022. All rights reserved.