CToon C++ 0.9.0
A C++ TOON/JSON serialization library
Loading...
Searching...
No Matches
ctoon Namespace Reference

Classes

class  document
 
class  error
 
class  mut_document
 
class  mut_value
 
class  parse_error
 
class  spec
 
class  value
 
class  version
 
class  write_error
 
class  write_options
 
class  write_result
 

Enumerations

enum class  delimiter : uint32_t { COMMA = CTOON_DELIMITER_COMMA , TAB = CTOON_DELIMITER_TAB , PIPE = CTOON_DELIMITER_PIPE }
 
enum class  write_flag : uint32_t {
  NOFLAG = static_cast<uint32_t>(CTOON_WRITE_NOFLAG) , ESCAPE_UNICODE = static_cast<uint32_t>(CTOON_WRITE_ESCAPE_UNICODE) , ESCAPE_SLASHES = static_cast<uint32_t>(CTOON_WRITE_ESCAPE_SLASHES) , ALLOW_INF_AND_NAN = static_cast<uint32_t>(CTOON_WRITE_ALLOW_INF_AND_NAN) ,
  INF_AND_NAN_AS_NULL = static_cast<uint32_t>(CTOON_WRITE_INF_AND_NAN_AS_NULL) , ALLOW_INVALID_UNICODE = static_cast<uint32_t>(CTOON_WRITE_ALLOW_INVALID_UNICODE) , LENGTH_MARKER = static_cast<uint32_t>(CTOON_WRITE_LENGTH_MARKER) , NEWLINE_AT_END = static_cast<uint32_t>(CTOON_WRITE_NEWLINE_AT_END)
}
 
enum class  read_flag : uint32_t {
  NOFLAG = static_cast<uint32_t>(CTOON_READ_NOFLAG) , INSITU = static_cast<uint32_t>(CTOON_READ_INSITU) , STOP_WHEN_DONE = static_cast<uint32_t>(CTOON_READ_STOP_WHEN_DONE) , ALLOW_TRAILING_COMMAS = static_cast<uint32_t>(CTOON_READ_ALLOW_TRAILING_COMMAS) ,
  ALLOW_COMMENTS = static_cast<uint32_t>(CTOON_READ_ALLOW_COMMENTS) , ALLOW_INF_AND_NAN = static_cast<uint32_t>(CTOON_READ_ALLOW_INF_AND_NAN) , NUMBER_AS_RAW = static_cast<uint32_t>(CTOON_READ_NUMBER_AS_RAW) , ALLOW_INVALID_UNICODE = static_cast<uint32_t>(CTOON_READ_ALLOW_INVALID_UNICODE) ,
  BIGNUM_AS_RAW = static_cast<uint32_t>(CTOON_READ_BIGNUM_AS_RAW) , ALLOW_BOM = static_cast<uint32_t>(CTOON_READ_ALLOW_BOM) , ALLOW_EXT_NUMBER = static_cast<uint32_t>(CTOON_READ_ALLOW_EXT_NUMBER) , ALLOW_EXT_ESCAPE = static_cast<uint32_t>(CTOON_READ_ALLOW_EXT_ESCAPE) ,
  ALLOW_EXT_WHITESPACE = static_cast<uint32_t>(CTOON_READ_ALLOW_EXT_WHITESPACE) , ALLOW_SINGLE_QUOTED_STR = static_cast<uint32_t>(CTOON_READ_ALLOW_SINGLE_QUOTED_STR) , ALLOW_UNQUOTED_KEY = static_cast<uint32_t>(CTOON_READ_ALLOW_UNQUOTED_KEY) , NON_STRICT = static_cast<uint32_t>(CTOON_READ_NON_STRICT)
}
 

Functions

write_flag operator| (write_flag l, write_flag r) CTOON_NOEXCEPT
 
write_flag & operator|= (write_flag &l, write_flag r) CTOON_NOEXCEPT
 
ctoon_write_flag to_c (write_flag f) CTOON_NOEXCEPT
 Convert to the C type for passing to C API.
 
read_flag operator| (read_flag l, read_flag r) CTOON_NOEXCEPT
 
read_flag & operator|= (read_flag &l, read_flag r) CTOON_NOEXCEPT
 
ctoon_read_flag to_c (read_flag f) CTOON_NOEXCEPT
 Convert to the C type for passing to C API.
 
document parse (const char *toon, read_flag flags=read_flag::NOFLAG)
 
document parse (const std::string &toon, read_flag flags=read_flag::NOFLAG)
 
document parse_file (const char *path, read_flag flags=read_flag::NOFLAG)
 
mut_document make_document ()
 
write_result to_string (const document &d, const write_options &o=write_options())
 
write_result to_string (const mut_document &d, const write_options &o=write_options())
 
document from_json (const char *json, std::size_t len, read_flag flags=read_flag::NOFLAG)
 
document from_json (const char *json, read_flag flags=read_flag::NOFLAG)
 
document from_json (const std::string &json, read_flag flags=read_flag::NOFLAG)
 
document from_json_file (const char *path, read_flag flags=read_flag::NOFLAG)
 
write_result to_json (const document &d, int indent=2, write_flag flags=write_flag::NOFLAG)
 
write_result to_json (const mut_document &d, int indent=2, write_flag flags=write_flag::NOFLAG)
 
write_result json_to_toon (const char *json, std::size_t len, const write_options &opts=write_options(), read_flag flags=read_flag::NOFLAG)
 JSON text -> TOON text.
 
write_result json_to_toon (const char *json, const write_options &opts=write_options(), read_flag flags=read_flag::NOFLAG)
 
write_result json_to_toon (const std::string &json, const write_options &opts=write_options(), read_flag flags=read_flag::NOFLAG)
 
write_result json_to_toon (const string_view &json, const write_options &opts=write_options(), read_flag flags=read_flag::NOFLAG)
 
void json_to_toon_file (const char *json_path, const char *toon_path, const write_options &opts=write_options(), read_flag flags=read_flag::NOFLAG)
 JSON file -> TOON file.
 
write_result toon_to_json (const char *toon, std::size_t len, int indent=0, write_flag wflags=write_flag::NOFLAG, read_flag rflags=read_flag::NOFLAG)
 TOON text -> JSON text (compact by default; pass indent > 0 to pretty-print).
 
write_result toon_to_json (const char *toon, int indent=0, write_flag wflags=write_flag::NOFLAG, read_flag rflags=read_flag::NOFLAG)
 
write_result toon_to_json (const std::string &toon, int indent=0, write_flag wflags=write_flag::NOFLAG, read_flag rflags=read_flag::NOFLAG)
 
write_result toon_to_json (const string_view &toon, int indent=0, write_flag wflags=write_flag::NOFLAG, read_flag rflags=read_flag::NOFLAG)
 
void toon_to_json_file (const char *toon_path, const char *json_path, int indent=0, write_flag wflags=write_flag::NOFLAG, read_flag rflags=read_flag::NOFLAG)
 TOON file -> JSON file.
 

Enumeration Type Documentation

◆ delimiter

enum class ctoon::delimiter : uint32_t
strong
Enumerator
COMMA 
TAB 
PIPE 

Definition at line 200 of file ctoon.hpp.

◆ read_flag

enum class ctoon::read_flag : uint32_t
strong
Enumerator
NOFLAG 
INSITU 
STOP_WHEN_DONE 
ALLOW_TRAILING_COMMAS 
ALLOW_COMMENTS 
ALLOW_INF_AND_NAN 
NUMBER_AS_RAW 
ALLOW_INVALID_UNICODE 
BIGNUM_AS_RAW 
ALLOW_BOM 
ALLOW_EXT_NUMBER 
ALLOW_EXT_ESCAPE 
ALLOW_EXT_WHITESPACE 
ALLOW_SINGLE_QUOTED_STR 
ALLOW_UNQUOTED_KEY 
NON_STRICT 

Definition at line 239 of file ctoon.hpp.

◆ write_flag

enum class ctoon::write_flag : uint32_t
strong
Enumerator
NOFLAG 
ESCAPE_UNICODE 
ESCAPE_SLASHES 
ALLOW_INF_AND_NAN 
INF_AND_NAN_AS_NULL 
ALLOW_INVALID_UNICODE 
LENGTH_MARKER 
NEWLINE_AT_END 

Definition at line 213 of file ctoon.hpp.

Function Documentation

◆ from_json() [1/3]

document ctoon::from_json ( const char *  json,
read_flag  flags = read_flag::NOFLAG 
)
inline

Definition at line 851 of file ctoon.hpp.

References ctoon::document::from_json().

◆ from_json() [2/3]

document ctoon::from_json ( const char *  json,
std::size_t  len,
read_flag  flags = read_flag::NOFLAG 
)
inline

Definition at line 848 of file ctoon.hpp.

References ctoon::document::from_json().

◆ from_json() [3/3]

document ctoon::from_json ( const std::string &  json,
read_flag  flags = read_flag::NOFLAG 
)
inline

Definition at line 854 of file ctoon.hpp.

References ctoon::document::from_json().

◆ from_json_file()

document ctoon::from_json_file ( const char *  path,
read_flag  flags = read_flag::NOFLAG 
)
inline

Definition at line 857 of file ctoon.hpp.

References ctoon::document::from_json_file().

◆ json_to_toon() [1/4]

write_result ctoon::json_to_toon ( const char *  json,
const write_options &  opts = write_options(),
read_flag  flags = read_flag::NOFLAG 
)
inline

Definition at line 889 of file ctoon.hpp.

References json_to_toon().

◆ json_to_toon() [2/4]

write_result ctoon::json_to_toon ( const char *  json,
std::size_t  len,
const write_options &  opts = write_options(),
read_flag  flags = read_flag::NOFLAG 
)
inline

JSON text -> TOON text.

Definition at line 875 of file ctoon.hpp.

References to_c().

Referenced by json_to_toon(), json_to_toon(), and json_to_toon().

◆ json_to_toon() [3/4]

write_result ctoon::json_to_toon ( const std::string &  json,
const write_options &  opts = write_options(),
read_flag  flags = read_flag::NOFLAG 
)
inline

Definition at line 894 of file ctoon.hpp.

References json_to_toon().

◆ json_to_toon() [4/4]

write_result ctoon::json_to_toon ( const string_view &  json,
const write_options &  opts = write_options(),
read_flag  flags = read_flag::NOFLAG 
)
inline

Definition at line 899 of file ctoon.hpp.

References json_to_toon().

◆ json_to_toon_file()

void ctoon::json_to_toon_file ( const char *  json_path,
const char *  toon_path,
const write_options &  opts = write_options(),
read_flag  flags = read_flag::NOFLAG 
)
inline

JSON file -> TOON file.

Definition at line 906 of file ctoon.hpp.

References to_c().

◆ make_document()

mut_document ctoon::make_document ( )
inline

Definition at line 843 of file ctoon.hpp.

References ctoon::mut_document::create().

◆ operator|() [1/2]

read_flag ctoon::operator| ( read_flag  l,
read_flag  r 
)
inline

Definition at line 258 of file ctoon.hpp.

◆ operator|() [2/2]

write_flag ctoon::operator| ( write_flag  l,
write_flag  r 
)
inline

Definition at line 224 of file ctoon.hpp.

◆ operator|=() [1/2]

read_flag & ctoon::operator|= ( read_flag &  l,
read_flag  r 
)
inline

Definition at line 261 of file ctoon.hpp.

◆ operator|=() [2/2]

write_flag & ctoon::operator|= ( write_flag &  l,
write_flag  r 
)
inline

Definition at line 227 of file ctoon.hpp.

◆ parse() [1/2]

document ctoon::parse ( const char *  toon,
read_flag  flags = read_flag::NOFLAG 
)
inline

Definition at line 834 of file ctoon.hpp.

References ctoon::document::parse().

◆ parse() [2/2]

document ctoon::parse ( const std::string &  toon,
read_flag  flags = read_flag::NOFLAG 
)
inline

Definition at line 837 of file ctoon.hpp.

References ctoon::document::parse().

◆ parse_file()

document ctoon::parse_file ( const char *  path,
read_flag  flags = read_flag::NOFLAG 
)
inline

Definition at line 840 of file ctoon.hpp.

References ctoon::document::parse_file().

◆ to_c() [1/2]

ctoon_read_flag ctoon::to_c ( read_flag  f)
inline

Convert to the C type for passing to C API.

Definition at line 265 of file ctoon.hpp.

◆ to_c() [2/2]

◆ to_json() [1/2]

write_result ctoon::to_json ( const document &  d,
int  indent = 2,
write_flag  flags = write_flag::NOFLAG 
)
inline

Definition at line 860 of file ctoon.hpp.

References ctoon::document::to_json().

◆ to_json() [2/2]

write_result ctoon::to_json ( const mut_document &  d,
int  indent = 2,
write_flag  flags = write_flag::NOFLAG 
)
inline

Definition at line 863 of file ctoon.hpp.

References ctoon::mut_document::to_json().

◆ to_string() [1/2]

write_result ctoon::to_string ( const document &  d,
const write_options &  o = write_options() 
)
inline

Definition at line 844 of file ctoon.hpp.

References ctoon::document::to_string().

◆ to_string() [2/2]

write_result ctoon::to_string ( const mut_document &  d,
const write_options &  o = write_options() 
)
inline

Definition at line 845 of file ctoon.hpp.

References ctoon::mut_document::to_string().

◆ toon_to_json() [1/4]

write_result ctoon::toon_to_json ( const char *  toon,
int  indent = 0,
write_flag  wflags = write_flag::NOFLAG,
read_flag  rflags = read_flag::NOFLAG 
)
inline

Definition at line 933 of file ctoon.hpp.

References toon_to_json().

◆ toon_to_json() [2/4]

write_result ctoon::toon_to_json ( const char *  toon,
std::size_t  len,
int  indent = 0,
write_flag  wflags = write_flag::NOFLAG,
read_flag  rflags = read_flag::NOFLAG 
)
inline

TOON text -> JSON text (compact by default; pass indent > 0 to pretty-print).

Definition at line 919 of file ctoon.hpp.

References to_c().

Referenced by toon_to_json(), toon_to_json(), and toon_to_json().

◆ toon_to_json() [3/4]

write_result ctoon::toon_to_json ( const std::string &  toon,
int  indent = 0,
write_flag  wflags = write_flag::NOFLAG,
read_flag  rflags = read_flag::NOFLAG 
)
inline

Definition at line 938 of file ctoon.hpp.

References toon_to_json().

◆ toon_to_json() [4/4]

write_result ctoon::toon_to_json ( const string_view &  toon,
int  indent = 0,
write_flag  wflags = write_flag::NOFLAG,
read_flag  rflags = read_flag::NOFLAG 
)
inline

Definition at line 943 of file ctoon.hpp.

References toon_to_json().

◆ toon_to_json_file()

void ctoon::toon_to_json_file ( const char *  toon_path,
const char *  json_path,
int  indent = 0,
write_flag  wflags = write_flag::NOFLAG,
read_flag  rflags = read_flag::NOFLAG 
)
inline

TOON file -> JSON file.

Definition at line 950 of file ctoon.hpp.

References to_c().