BitShares-Core  4.0.0
BitShares blockchain implementation and command-line interface software
Public Types | Static Public Member Functions | List of all members
fc::json Class Reference

#include <json.hpp>

Public Types

enum  parse_type { legacy_parser = 0, broken_nul_parser = 4 }
 
enum  output_formatting { stringify_large_ints_and_doubles = 0, legacy_generator = 1 }
 

Static Public Member Functions

static ostreamto_stream (ostream &out, const std::string &)
 
static ostreamto_stream (ostream &out, const variant &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static ostreamto_stream (ostream &out, const variants &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static ostreamto_stream (ostream &out, const variant_object &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static variant from_stream (buffered_istream &in, parse_type ptype=legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static variant from_string (const string &utf8_str, parse_type ptype=legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static variants variants_from_string (const string &utf8_str, parse_type ptype=legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static string to_string (const variant &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static string to_pretty_string (const variant &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static bool is_valid (const std::string &json_str, parse_type ptype=legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
template<typename T >
static void save_to_file (const T &v, const fc::path &fi, bool pretty=true, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static void save_to_file (const variant &v, const fc::path &fi, bool pretty=true, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
static variant from_file (const fc::path &p, parse_type ptype=legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
template<typename T >
static T from_file (const fc::path &p, parse_type ptype=legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
template<typename T >
static string to_string (const T &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
template<typename T >
static string to_pretty_string (const T &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 
template<typename T >
static void save_to_file (const T &v, const std::string &p, bool pretty=true, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
 

Detailed Description

Provides interface for json serialization.

json strings are always UTF8

Definition at line 17 of file json.hpp.

Member Enumeration Documentation

Enumerator
stringify_large_ints_and_doubles 
legacy_generator 

Definition at line 30 of file json.hpp.

Enumerator
legacy_parser 
broken_nul_parser 

Definition at line 20 of file json.hpp.

Member Function Documentation

variant fc::json::from_file ( const fc::path p,
parse_type  ptype = legacy_parser,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 755 of file json.cpp.

template<typename T >
static T fc::json::from_file ( const fc::path p,
parse_type  ptype = legacy_parser,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
inlinestatic

Definition at line 60 of file json.hpp.

variant fc::json::from_stream ( buffered_istream in,
parse_type  ptype = legacy_parser,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 761 of file json.cpp.

variant fc::json::from_string ( const string &  utf8_str,
parse_type  ptype = legacy_parser,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 458 of file json.cpp.

bool fc::json::is_valid ( const std::string &  json_str,
parse_type  ptype = legacy_parser,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 798 of file json.cpp.

template<typename T >
static void fc::json::save_to_file ( const T &  v,
const fc::path fi,
bool  pretty = true,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
inlinestatic

Definition at line 51 of file json.hpp.

void fc::json::save_to_file ( const variant v,
const fc::path fi,
bool  pretty = true,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 741 of file json.cpp.

template<typename T >
static void fc::json::save_to_file ( const T &  v,
const std::string &  p,
bool  pretty = true,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
inlinestatic

Definition at line 78 of file json.hpp.

std::string fc::json::to_pretty_string ( const variant v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 736 of file json.cpp.

template<typename T >
static string fc::json::to_pretty_string ( const T &  v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
inlinestatic

Definition at line 72 of file json.hpp.

ostream & fc::json::to_stream ( ostream out,
const std::string &  str 
)
static

Definition at line 550 of file json.cpp.

ostream & fc::json::to_stream ( ostream out,
const variant v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 782 of file json.cpp.

ostream & fc::json::to_stream ( ostream out,
const variants v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 787 of file json.cpp.

ostream & fc::json::to_stream ( ostream out,
const variant_object v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 792 of file json.cpp.

std::string fc::json::to_string ( const variant v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 638 of file json.cpp.

template<typename T >
static string fc::json::to_string ( const T &  v,
output_formatting  format = stringify_large_ints_and_doubles,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
inlinestatic

Definition at line 66 of file json.hpp.

variants fc::json::variants_from_string ( const string &  utf8_str,
parse_type  ptype = legacy_parser,
uint32_t  max_depth = DEFAULT_MAX_RECURSION_DEPTH 
)
static

Definition at line 465 of file json.cpp.


The documentation for this class was generated from the following files: