JSON Voorhees
Killer JSON for C++
value.hpp File Reference

Copyright (c) 2012-2018 by Travis Gockel. More...

#include <jsonv/config.hpp>
#include <jsonv/string_view.hpp>
#include <jsonv/detail/basic_view.hpp>
#include <cstddef>
#include <cstdint>
#include <initializer_list>
#include <iosfwd>
#include <iterator>
#include <functional>
#include <map>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <utility>

Go to the source code of this file.

Classes

union  jsonv::detail::value_storage
 
class  jsonv::kind_error
 Thrown from various value methods when attempting to perform an operation which is not valid for the kind of value. More...
 
class  jsonv::value
 Represents a single JSON value, which can be any one of a potential kind, each behaving slightly differently. More...
 
struct  jsonv::value::basic_array_iterator< T, TArrayView >
 The base type for iterating over array values. More...
 
struct  jsonv::value::basic_object_iterator< T, TIterator >
 The base iterator type for iterating over object types. More...
 
struct  jsonv::value::object_insert_return_type
 Type returned from insert operations when this has kind::object. More...
 
class  jsonv::object_node_handle
 A node handle used when a value is kind::object to access elements of the object in potentially destructive manner. More...
 
struct  std::hash< jsonv::value >
 Explicit specialization of std::hash for jsonv::value types so you can store a value in an unordered container. More...
 

Macros

#define JSONV_VALUE_INTEGER_ALTERNATIVE_CTOR_PROTO_GENERATOR(type_)   value(type_ val);
 

Enumerations

enum  jsonv::kind : unsigned char {
  null, object, array, string,
  integer, decimal, boolean
}
 Describes the kind of data a value holds. More...
 

Functions

JSONV_PUBLIC std::ostream & jsonv::operator<< (std::ostream &, const kind &)
 Print out the name of the kind. More...
 
JSONV_PUBLIC std::string jsonv::to_string (const kind &)
 Get the name of the kind. More...
 
JSONV_PUBLIC std::string jsonv::to_string (const value &)
 Get a string representation of the given value. More...
 
JSONV_PUBLIC value jsonv::operator""_json (const char *str, std::size_t len)
 A user-defined literal for parsing JSON. More...
 
JSONV_PUBLIC void jsonv::swap (value &a, value &b) noexcept
 Swap the values a and b. More...
 
JSONV_PUBLIC value jsonv::array ()
 Create an empty array value. More...
 
JSONV_PUBLIC value jsonv::array (std::initializer_list< value > source)
 Create an array value from the given source. More...
 
template<typename TForwardIterator >
value jsonv::array (TForwardIterator first, TForwardIterator last)
 Create an array with contents defined by range [first, last). More...
 
JSONV_PUBLIC value jsonv::object ()
 Create an empty object. More...
 
JSONV_PUBLIC value jsonv::object (std::initializer_list< std::pair< std::string, value >> source)
 Create an object with key-value pairs from the given source. More...
 
JSONV_PUBLIC value jsonv::object (std::initializer_list< std::pair< std::wstring, value >> source)
 
template<typename TForwardIterator >
value jsonv::object (TForwardIterator first, TForwardIterator last)
 Create an object whose contents are defined by range [first, last). More...
 

Variables

JSONV_PUBLIC const value jsonv::null
 An instance with kind::null. More...
 

Detailed Description

Copyright (c) 2012-2018 by Travis Gockel.

All rights reserved.

This program is free software: you can redistribute it and/or modify it under the terms of the Apache License as published by the Apache Software Foundation, either version 2 of the License, or (at your option) any later version.

Author
Travis Gockel (travi.nosp@m.s@go.nosp@m.ckelh.nosp@m.ut.c.nosp@m.om)

Definition in file value.hpp.


Class Documentation

struct jsonv::value::object_insert_return_type

Type returned from insert operations when this has kind::object.

It is generally compatible with the insert_return_type of std::map, with the notable lack of node.

See also
insert

Definition at line 420 of file value.hpp.

Class Members
bool inserted Did the insert operation perform an insert? A value of false indicates there was a key already present with the same name.
const_object_iterator position The position of the inserted node or node with the duplicate key.