Motor OpenGL
Cargando...
Buscando...
Nada coincide
Referencia del espacio de nombres detail

detail namespace with internal helper functions Más...

Espacios de nombres

namespace  dtoa_impl
 implements the Grisu2 algorithm for binary to decimal floating-point conversion.

Clases

struct  position_t
 struct to capture the start position of the current token Más...
class  exception
 general exception of the basic_json class Más...
class  parse_error
 exception indicating a parse error Más...
class  invalid_iterator
 exception indicating errors with iterators Más...
class  type_error
 exception indicating executing a member function with a wrong type Más...
class  out_of_range
 exception indicating access out of the defined range Más...
class  other_error
 exception indicating other library errors Más...
class  iteration_proxy
 proxy class for the items() function Más...
class  file_input_adapter
class  input_stream_adapter
class  lexer
 lexical analysis Más...
class  json_sax_dom_parser
 SAX implementation to create a JSON value from SAX events. Más...
class  binary_reader
 deserialization of CBOR, MessagePack, and UBJSON values Más...
class  parser
 syntax analysis Más...
struct  internal_iterator
 an iterator value Más...
struct  json_default_base
 Default base class of the basic_json class. Más...
class  binary_writer
 serialization to CBOR and MessagePack values Más...

Enumeraciones

enum class  value_t : std::uint8_t {
  null , object , array , string ,
  boolean , number_integer , number_unsigned , number_float ,
  binary , discarded
}
 the JSON type enumeration Más...
enum class  input_format_t
 the supported input formats
enum class  cbor_tag_handler_t { error , ignore , store }
 how to treat CBOR tags Más...
enum class  error_handler_t { strict , replace , ignore }

Funciones

bool operator< (const value_t lhs, const value_t rhs) noexcept
 comparison operator for JSON types
template<typename StringType>
void replace_substring (StringType &s, const StringType &f, const StringType &t)
 replace all occurrences of a substring by another string
template<typename StringType>
StringType escape (StringType s)
 string escaping as described in RFC 6901 (Sect. 4)
template<typename BasicJsonType>
std::size_t hash (const BasicJsonType &j)
 hash a JSON value
template<typename FloatType>
JSON_HEDLEY_RETURNS_NON_NULL char * to_chars (char *first, const char *last, FloatType value)
 generates a decimal representation of the floating-point number value in [first, last).

Descripción detallada

detail namespace with internal helper functions

This namespace collects functions that should not be exposed, implementations of some basic_json methods, and meta-programming helpers.

Desde
version 2.1.0

Documentación de enumeraciones

◆ cbor_tag_handler_t

enum class detail::cbor_tag_handler_t
strong

how to treat CBOR tags

Valores de enumeraciones
error 

throw a parse_error exception in case of a tag

ignore 

ignore tags

store 

store tags as binary type

◆ error_handler_t

enum class detail::error_handler_t
strong
Valores de enumeraciones
strict 

throw a type_error exception in case of invalid UTF-8

replace 

replace invalid UTF-8 sequences with U+FFFD

ignore 

ignore invalid UTF-8 sequences

◆ value_t

enum class detail::value_t : std::uint8_t
strong

the JSON type enumeration

This enumeration collects the different JSON types. It is internally used to distinguish the stored values, and the functions basic_json::is_null(), basic_json::is_object(), basic_json::is_array(), basic_json::is_string(), basic_json::is_boolean(), basic_json::is_number() (with basic_json::is_number_integer(), basic_json::is_number_unsigned(), and basic_json::is_number_float()), basic_json::is_discarded(), basic_json::is_primitive(), and basic_json::is_structured() rely on it.

Nota
There are three enumeration entries (number_integer, number_unsigned, and number_float), because the library distinguishes these three types for numbers: basic_json::number_unsigned_t is used for unsigned integers, basic_json::number_integer_t is used for signed integers, and basic_json::number_float_t is used for floating-point numbers or to approximate integers which do not fit in the limits of their respective type.
Ver también
see basic_json::basic_json(const value_t value_type) – create a JSON value with the default value for a given type
Desde
version 1.0.0
Valores de enumeraciones
null 

null value

object 

object (unordered set of name/value pairs)

array 

array (ordered collection of values)

string 

string value

boolean 

boolean value

number_integer 

number value (signed integer)

number_unsigned 

number value (unsigned integer)

number_float 

number value (floating-point)

binary 

binary array (ordered collection of bytes)

discarded 

discarded by the parser callback function

Documentación de funciones

◆ escape()

template<typename StringType>
StringType detail::escape ( StringType s)
inline

string escaping as described in RFC 6901 (Sect. 4)

Parámetros
[in]sstring to escape
Devuelve
escaped string

Note the order of escaping "~" to "~0" and "/" to "~1" is important.

◆ hash()

template<typename BasicJsonType>
std::size_t detail::hash ( const BasicJsonType & j)

hash a JSON value

The hash function tries to rely on std::hash where possible. Furthermore, the type of the JSON value is taken into account to have different hash values for null, 0, 0U, and false, etc.

Parámetros de plantilla
BasicJsonTypebasic_json specialization
Parámetros
jJSON value to hash
Devuelve
hash value of j

◆ operator<()

bool detail::operator< ( const value_t lhs,
const value_t rhs )
inlinenoexcept

comparison operator for JSON types

Returns an ordering that is similar to Python:

  • order: null < boolean < number < object < array < string < binary
  • furthermore, each type is not smaller than itself
  • discarded values are not comparable
  • binary is represented as a b"" string in python and directly comparable to a string; however, making a binary array directly comparable with a string would be surprising behavior in a JSON file.
Desde
version 1.0.0

◆ replace_substring()

template<typename StringType>
void detail::replace_substring ( StringType & s,
const StringType & f,
const StringType & t )
inline

replace all occurrences of a substring by another string

Parámetros
[in,out]sthe string to manipulate; changed so that all occurrences of f are replaced with t
[in]fthe substring to replace with t
[in]tthe string to replace f
Precondición
The search string f must not be empty. This precondition is enforced with an assertion.
Desde
version 2.0.0

◆ to_chars()

template<typename FloatType>
JSON_HEDLEY_RETURNS_NON_NULL char * detail::to_chars ( char * first,
const char * last,
FloatType value )

generates a decimal representation of the floating-point number value in [first, last).

The format of the resulting decimal representation is similar to printf's g format. Returns an iterator pointing past-the-end of the decimal representation.

Nota
The input number must be finite, i.e. NaN's and Inf's are not supported.
The buffer must be large enough.
The result is NOT null-terminated.