Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
623c03bc
Commit
623c03bc
authored
Jul 19, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some cleanup
parent
818ae5a5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
506 additions
and
862 deletions
+506
-862
README.md
README.md
+1
-0
Doxyfile
doc/Doxyfile
+4
-4
json.hpp
src/json.hpp
+409
-782
json.hpp.re2c
src/json.hpp.re2c
+92
-76
No files found.
README.md
View file @
623c03bc
...
@@ -57,6 +57,7 @@ Though it's 2015 already, the support for C++11 is still a bit sparse. Currently
...
@@ -57,6 +57,7 @@ Though it's 2015 already, the support for C++11 is still a bit sparse. Currently
-
GCC 4.9
-
GCC 4.9
-
GCC 5.0
-
GCC 5.0
-
GCC 5.1
-
GCC 5.1
-
GCC 5.2
-
Clang 3.4
-
Clang 3.4
-
Clang 3.5
-
Clang 3.5
-
Clang 3.6
-
Clang 3.6
...
...
doc/Doxyfile
View file @
623c03bc
...
@@ -37,7 +37,7 @@ OPTIMIZE_FOR_FORTRAN = NO
...
@@ -37,7 +37,7 @@ OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
MARKDOWN_SUPPORT = YES
AUTOLINK_SUPPORT =
YES
AUTOLINK_SUPPORT =
NO
BUILTIN_STL_SUPPORT = YES
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
SIP_SUPPORT = NO
...
@@ -95,7 +95,7 @@ QUIET = YES
...
@@ -95,7 +95,7 @@ QUIET = YES
WARNINGS = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC =
NO
WARN_NO_PARAMDOC =
YES
WARN_FORMAT = "$file:$line: $text"
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
WARN_LOGFILE =
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
...
@@ -108,7 +108,7 @@ RECURSIVE = NO
...
@@ -108,7 +108,7 @@ RECURSIVE = NO
EXCLUDE =
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS = nlohmann::
internals
EXCLUDE_SYMBOLS = nlohmann::
anonymous_namespace
EXAMPLE_PATH = examples
EXAMPLE_PATH = examples
EXAMPLE_PATTERNS =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
EXAMPLE_RECURSIVE = NO
...
@@ -151,7 +151,7 @@ HTML_COLORSTYLE_HUE = 220
...
@@ -151,7 +151,7 @@ HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = YES
HTML_TIMESTAMP = YES
HTML_DYNAMIC_SECTIONS =
NO
HTML_DYNAMIC_SECTIONS =
YES
HTML_INDEX_NUM_ENTRIES = 100
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = YES
GENERATE_DOCSET = YES
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_FEEDNAME = "Doxygen generated docs"
...
...
src/json.hpp
View file @
623c03bc
...
@@ -103,24 +103,47 @@ default)
...
@@ -103,24 +103,47 @@ default)
@requirement The class satisfies the following concept requirements:
@requirement The class satisfies the following concept requirements:
- Basic
- Basic
- [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible)
- [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible):
- [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible)
JSON values can be default constructed. The result will be a JSON null value.
- [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible)
- [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible):
- [MoveAssignable](http://en.cppreference.com/w/cpp/concept/MoveAssignable)
A JSON value can be constructed from an rvalue argument.
- [CopyAssignable](http://en.cppreference.com/w/cpp/concept/CopyAssignable)
- [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible):
- [Destructible](http://en.cppreference.com/w/cpp/concept/Destructible)
A JSON value can be copy-constrcuted from an lvalue expression.
- [MoveAssignable](http://en.cppreference.com/w/cpp/concept/MoveAssignable):
A JSON value van be assigned from an rvalue argument.
- [CopyAssignable](http://en.cppreference.com/w/cpp/concept/CopyAssignable):
A JSON value can be copy-assigned from an lvalue expression.
- [Destructible](http://en.cppreference.com/w/cpp/concept/Destructible):
JSON values can be destructed.
- Layout
- Layout
- [StandardLayoutType](http://en.cppreference.com/w/cpp/concept/StandardLayoutType)
- [StandardLayoutType](http://en.cppreference.com/w/cpp/concept/StandardLayoutType):
JSON values have
[standard layout](http://en.cppreference.com/w/cpp/language/data_members#Standard_layout):
All non-static data members are private and standard layout types, the class
has no virtual functions or (virtual) base classes.
- Library-wide
- Library-wide
- [EqualityComparable](http://en.cppreference.com/w/cpp/concept/EqualityComparable)
- [EqualityComparable](http://en.cppreference.com/w/cpp/concept/EqualityComparable):
- [LessThanComparable](http://en.cppreference.com/w/cpp/concept/LessThanComparable)
JSON values can be compared with `==`, see @ref
- [Swappable](http://en.cppreference.com/w/cpp/concept/Swappable)
operator==(const_reference,const_reference).
- [NullablePointer](http://en.cppreference.com/w/cpp/concept/NullablePointer)
- [LessThanComparable](http://en.cppreference.com/w/cpp/concept/LessThanComparable):
JSON values can be compared with `<`, see @ref
operator<(const_reference,const_reference).
- [Swappable](http://en.cppreference.com/w/cpp/concept/Swappable):
Any JSON lvalue or rvalue of can be swapped with any lvalue or rvalue of
other compatible types, using unqualified function call @ref swap().
- [NullablePointer](http://en.cppreference.com/w/cpp/concept/NullablePointer):
JSON values can be compared against `std::nullptr_t` objects which are used
to model the `null` value.
- Container
- Container
- [Container](http://en.cppreference.com/w/cpp/concept/Container)
- [Container](http://en.cppreference.com/w/cpp/concept/Container):
- [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)
JSON values can be used like STL containers and provide iterator access.
- [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer);
JSON values can be used like STL containers and provide reverse iterator
access.
@internal
@note ObjectType trick from http://stackoverflow.com/a/9860911
@note ObjectType trick from http://stackoverflow.com/a/9860911
@endinternal
@see RFC 7159 <http://rfc7159.net/rfc7159>
@see RFC 7159 <http://rfc7159.net/rfc7159>
*/
*/
...
@@ -137,8 +160,13 @@ class basic_json
...
@@ -137,8 +160,13 @@ class basic_json
{
{
private
:
private
:
/// workaround type for MSVC
/// workaround type for MSVC
using
basic_json_t
=
using
basic_json_t
=
basic_json
<
ObjectType
,
basic_json
<
ObjectType
,
ArrayType
,
StringType
,
BooleanType
,
NumberIntegerType
,
NumberFloatType
,
AllocatorType
>
;
ArrayType
,
StringType
,
BooleanType
,
NumberIntegerType
,
NumberFloatType
,
AllocatorType
>
;
public
:
public
:
...
@@ -269,8 +297,11 @@ class basic_json
...
@@ -269,8 +297,11 @@ class basic_json
@sa array_t
@sa array_t
*/
*/
using
object_t
=
using
object_t
=
ObjectType
<
StringType
,
ObjectType
<
StringType
,
basic_json
,
std
::
less
<
StringType
>
,
AllocatorType
<
std
::
pair
<
const
StringType
,
basic_json
>>>
;
basic_json
,
std
::
less
<
StringType
>
,
AllocatorType
<
std
::
pair
<
const
StringType
,
basic_json
>>>
;
/*!
/*!
@brief a type for an array
@brief a type for an array
...
@@ -526,7 +557,7 @@ class basic_json
...
@@ -526,7 +557,7 @@ class basic_json
boolean
,
///< boolean value
boolean
,
///< boolean value
number_integer
,
///< number value (integer)
number_integer
,
///< number value (integer)
number_float
,
///< number value (floating-point)
number_float
,
///< number value (floating-point)
discarded
///<
(internal) indicates the parser callback chose not to keep the value
discarded
///<
discarded by the the parser callback function
};
};
...
@@ -767,7 +798,6 @@ class basic_json
...
@@ -767,7 +798,6 @@ class basic_json
value.,basic_json}
value.,basic_json}
@sa basic_json(std::nullptr_t)
@sa basic_json(std::nullptr_t)
@ingroup container
*/
*/
basic_json
()
noexcept
=
default
;
basic_json
()
noexcept
=
default
;
...
@@ -1503,9 +1533,7 @@ class basic_json
...
@@ -1503,9 +1533,7 @@ class basic_json
@throw std::bad_alloc if allocation for object, array, or string fails.
@throw std::bad_alloc if allocation for object, array, or string fails.
@liveexample{The following code shows an example for the copy
@liveexample{The following code shows an example for the copy
constructor.,basic_jsonbasic_json_t}
constructor.,basic_json__basic_json}
@ingroup container
*/
*/
basic_json
(
const
basic_json
&
other
)
basic_json
(
const
basic_json
&
other
)
:
m_type
(
other
.
m_type
)
:
m_type
(
other
.
m_type
)
...
@@ -1599,8 +1627,6 @@ class basic_json
...
@@ -1599,8 +1627,6 @@ class basic_json
creates a copy of value `a` which is then swapped with `b`. Finally\, the
creates a copy of value `a` which is then swapped with `b`. Finally\, the
copy of `a` (which is the null value after the swap) is
copy of `a` (which is the null value after the swap) is
destroyed.,basic_json__copyassignment}
destroyed.,basic_json__copyassignment}
@ingroup container
*/
*/
reference
&
operator
=
(
basic_json
other
)
noexcept
(
reference
&
operator
=
(
basic_json
other
)
noexcept
(
std
::
is_nothrow_move_constructible
<
value_t
>::
value
and
std
::
is_nothrow_move_constructible
<
value_t
>::
value
and
...
@@ -1625,8 +1651,6 @@ class basic_json
...
@@ -1625,8 +1651,6 @@ class basic_json
@requirement This function satisfies the Container requirements:
@requirement This function satisfies the Container requirements:
- The complexity is linear.
- The complexity is linear.
- All stored elements are destroyed and all memory is freed.
- All stored elements are destroyed and all memory is freed.
@ingroup container
*/
*/
~
basic_json
()
~
basic_json
()
{
{
...
@@ -3138,8 +3162,6 @@ class basic_json
...
@@ -3138,8 +3162,6 @@ class basic_json
- The complexity is constant.
- The complexity is constant.
@liveexample{The following code shows an example for @ref begin.,begin}
@liveexample{The following code shows an example for @ref begin.,begin}
@ingroup container
*/
*/
iterator
begin
()
iterator
begin
()
{
{
...
@@ -3150,7 +3172,6 @@ class basic_json
...
@@ -3150,7 +3172,6 @@ class basic_json
/*!
/*!
@copydoc basic_json::cbegin()
@copydoc basic_json::cbegin()
@ingroup container
*/
*/
const_iterator
begin
()
const
const_iterator
begin
()
const
{
{
...
@@ -3173,8 +3194,6 @@ class basic_json
...
@@ -3173,8 +3194,6 @@ class basic_json
- Has the semantics of `const_cast<const basic_json&>(*this).begin()`.
- Has the semantics of `const_cast<const basic_json&>(*this).begin()`.
@liveexample{The following code shows an example for @ref cbegin.,cbegin}
@liveexample{The following code shows an example for @ref cbegin.,cbegin}
@ingroup container
*/
*/
const_iterator
cbegin
()
const
const_iterator
cbegin
()
const
{
{
...
@@ -3198,8 +3217,6 @@ class basic_json
...
@@ -3198,8 +3217,6 @@ class basic_json
- The complexity is constant.
- The complexity is constant.
@liveexample{The following code shows an example for @ref end.,end}
@liveexample{The following code shows an example for @ref end.,end}
@ingroup container
*/
*/
iterator
end
()
iterator
end
()
{
{
...
@@ -3210,7 +3227,6 @@ class basic_json
...
@@ -3210,7 +3227,6 @@ class basic_json
/*!
/*!
@copydoc basic_json::cend()
@copydoc basic_json::cend()
@ingroup container
*/
*/
const_iterator
end
()
const
const_iterator
end
()
const
{
{
...
@@ -3233,8 +3249,6 @@ class basic_json
...
@@ -3233,8 +3249,6 @@ class basic_json
- Has the semantics of `const_cast<const basic_json&>(*this).end()`.
- Has the semantics of `const_cast<const basic_json&>(*this).end()`.
@liveexample{The following code shows an example for @ref cend.,cend}
@liveexample{The following code shows an example for @ref cend.,cend}
@ingroup container
*/
*/
const_iterator
cend
()
const
const_iterator
cend
()
const
{
{
...
@@ -3257,8 +3271,6 @@ class basic_json
...
@@ -3257,8 +3271,6 @@ class basic_json
- Has the semantics of `reverse_iterator(end())`.
- Has the semantics of `reverse_iterator(end())`.
@liveexample{The following code shows an example for @ref rbegin.,rbegin}
@liveexample{The following code shows an example for @ref rbegin.,rbegin}
@ingroup reversiblecontainer
*/
*/
reverse_iterator
rbegin
()
reverse_iterator
rbegin
()
{
{
...
@@ -3267,7 +3279,6 @@ class basic_json
...
@@ -3267,7 +3279,6 @@ class basic_json
/*!
/*!
@copydoc basic_json::crbegin()
@copydoc basic_json::crbegin()
@ingroup reversiblecontainer
*/
*/
const_reverse_iterator
rbegin
()
const
const_reverse_iterator
rbegin
()
const
{
{
...
@@ -3289,8 +3300,6 @@ class basic_json
...
@@ -3289,8 +3300,6 @@ class basic_json
- Has the semantics of `reverse_iterator(begin())`.
- Has the semantics of `reverse_iterator(begin())`.
@liveexample{The following code shows an example for @ref rend.,rend}
@liveexample{The following code shows an example for @ref rend.,rend}
@ingroup reversiblecontainer
*/
*/
reverse_iterator
rend
()
reverse_iterator
rend
()
{
{
...
@@ -3299,7 +3308,6 @@ class basic_json
...
@@ -3299,7 +3308,6 @@ class basic_json
/*!
/*!
@copydoc basic_json::crend()
@copydoc basic_json::crend()
@ingroup reversiblecontainer
*/
*/
const_reverse_iterator
rend
()
const
const_reverse_iterator
rend
()
const
{
{
...
@@ -3321,8 +3329,6 @@ class basic_json
...
@@ -3321,8 +3329,6 @@ class basic_json
- Has the semantics of `const_cast<const basic_json&>(*this).rbegin()`.
- Has the semantics of `const_cast<const basic_json&>(*this).rbegin()`.
@liveexample{The following code shows an example for @ref crbegin.,crbegin}
@liveexample{The following code shows an example for @ref crbegin.,crbegin}
@ingroup reversiblecontainer
*/
*/
const_reverse_iterator
crbegin
()
const
const_reverse_iterator
crbegin
()
const
{
{
...
@@ -3344,8 +3350,6 @@ class basic_json
...
@@ -3344,8 +3350,6 @@ class basic_json
- Has the semantics of `const_cast<const basic_json&>(*this).rend()`.
- Has the semantics of `const_cast<const basic_json&>(*this).rend()`.
@liveexample{The following code shows an example for @ref crend.,crend}
@liveexample{The following code shows an example for @ref crend.,crend}
@ingroup reversiblecontainer
*/
*/
const_reverse_iterator
crend
()
const
const_reverse_iterator
crend
()
const
{
{
...
@@ -3388,8 +3392,6 @@ class basic_json
...
@@ -3388,8 +3392,6 @@ class basic_json
@liveexample{The following code uses @ref empty to check if a @ref json
@liveexample{The following code uses @ref empty to check if a @ref json
object contains any elements.,empty}
object contains any elements.,empty}
@ingroup container
*/
*/
bool
empty
()
const
noexcept
bool
empty
()
const
noexcept
{
{
...
@@ -3444,8 +3446,6 @@ class basic_json
...
@@ -3444,8 +3446,6 @@ class basic_json
@liveexample{The following code calls @ref size on the different value
@liveexample{The following code calls @ref size on the different value
types.,size}
types.,size}
@ingroup container
*/
*/
size_type
size
()
const
noexcept
size_type
size
()
const
noexcept
{
{
...
@@ -3503,8 +3503,6 @@ class basic_json
...
@@ -3503,8 +3503,6 @@ class basic_json
@liveexample{The following code calls @ref max_size on the different value
@liveexample{The following code calls @ref max_size on the different value
types. Note the output is implementation specific.,max_size}
types. Note the output is implementation specific.,max_size}
@ingroup container
*/
*/
size_type
max_size
()
const
noexcept
size_type
max_size
()
const
noexcept
{
{
...
@@ -3932,8 +3930,6 @@ class basic_json
...
@@ -3932,8 +3930,6 @@ class basic_json
@liveexample{The example below shows how JSON arrays can be
@liveexample{The example below shows how JSON arrays can be
swapped.,swap__reference}
swapped.,swap__reference}
@ingroup container
*/
*/
void
swap
(
reference
other
)
noexcept
(
void
swap
(
reference
other
)
noexcept
(
std
::
is_nothrow_move_constructible
<
value_t
>::
value
and
std
::
is_nothrow_move_constructible
<
value_t
>::
value
and
...
@@ -3962,8 +3958,6 @@ class basic_json
...
@@ -3962,8 +3958,6 @@ class basic_json
@liveexample{The example below shows how JSON values can be
@liveexample{The example below shows how JSON values can be
swapped.,swap__array_t}
swapped.,swap__array_t}
@ingroup container
*/
*/
void
swap
(
array_t
&
other
)
void
swap
(
array_t
&
other
)
{
{
...
@@ -3993,8 +3987,6 @@ class basic_json
...
@@ -3993,8 +3987,6 @@ class basic_json
@liveexample{The example below shows how JSON values can be
@liveexample{The example below shows how JSON values can be
swapped.,swap__object_t}
swapped.,swap__object_t}
@ingroup container
*/
*/
void
swap
(
object_t
&
other
)
void
swap
(
object_t
&
other
)
{
{
...
@@ -4024,8 +4016,6 @@ class basic_json
...
@@ -4024,8 +4016,6 @@ class basic_json
@liveexample{The example below shows how JSON values can be
@liveexample{The example below shows how JSON values can be
swapped.,swap__string_t}
swapped.,swap__string_t}
@ingroup container
*/
*/
void
swap
(
string_t
&
other
)
void
swap
(
string_t
&
other
)
{
{
...
@@ -4100,8 +4090,6 @@ class basic_json
...
@@ -4100,8 +4090,6 @@ class basic_json
@liveexample{The example demonstrates comparing several JSON
@liveexample{The example demonstrates comparing several JSON
types.,operator__equal}
types.,operator__equal}
@ingroup container
*/
*/
friend
bool
operator
==
(
const_reference
lhs
,
const_reference
rhs
)
noexcept
friend
bool
operator
==
(
const_reference
lhs
,
const_reference
rhs
)
noexcept
{
{
...
@@ -4186,8 +4174,6 @@ class basic_json
...
@@ -4186,8 +4174,6 @@ class basic_json
@liveexample{The example demonstrates comparing several JSON
@liveexample{The example demonstrates comparing several JSON
types.,operator__notequal}
types.,operator__notequal}
@ingroup container
*/
*/
friend
bool
operator
!=
(
const_reference
lhs
,
const_reference
rhs
)
noexcept
friend
bool
operator
!=
(
const_reference
lhs
,
const_reference
rhs
)
noexcept
{
{
...
@@ -4839,7 +4825,7 @@ class basic_json
...
@@ -4839,7 +4825,7 @@ class basic_json
}
}
/// return value to compare
/// return value to compare
operator
const
difference_type
()
const
operator
difference_type
()
const
{
{
return
m_it
;
return
m_it
;
}
}
...
@@ -4862,21 +4848,28 @@ class basic_json
...
@@ -4862,21 +4848,28 @@ class basic_json
struct
internal_iterator
struct
internal_iterator
{
{
/// iterator for JSON objects
/// iterator for JSON objects
typename
object_t
::
iterator
object_iterator
;
typename
object_t
::
iterator
object_iterator
=
typename
object_t
::
iterator
()
;
/// iterator for JSON arrays
/// iterator for JSON arrays
typename
array_t
::
iterator
array_iterator
;
typename
array_t
::
iterator
array_iterator
=
typename
array_t
::
iterator
()
;
/// generic iterator for all other types
/// generic iterator for all other types
primitive_iterator_t
primitive_iterator
;
primitive_iterator_t
primitive_iterator
=
primitive_iterator_t
();
// leave the union un-initialized
internal_iterator
()
{}
};
};
public
:
public
:
/// a const random access iterator for the basic_json class
/*!
@brief a const random access iterator for the @ref basic_json class
This class implements a const iterator for the @ref basic_json class. From
this class, the @ref iterator class is derived.
@requirement The class satisfies the following concept requirements:
- [RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator):
The iterator that can be moved to point (forward and backward) to any
element in constant time.
*/
class
const_iterator
:
public
std
::
iterator
<
std
::
random_access_iterator_tag
,
const
basic_json
>
class
const_iterator
:
public
std
::
iterator
<
std
::
random_access_iterator_tag
,
const
basic_json
>
{
{
//
allow basic_json class to access m_it
//
/ allow basic_json to access private members
friend
class
basic_json
;
friend
class
basic_json
;
public
:
public
:
...
@@ -5368,7 +5361,16 @@ class basic_json
...
@@ -5368,7 +5361,16 @@ class basic_json
internal_iterator
m_it
=
internal_iterator
();
internal_iterator
m_it
=
internal_iterator
();
};
};
/// a random access iterator for the basic_json class
/*!
@brief a mutable random access iterator for the @ref basic_json class
@requirement The class satisfies the following concept requirements:
- [RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator):
The iterator that can be moved to point (forward and backward) to any
element in constant time.
- [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator):
It is possible to write to the pointed-to element.
*/
class
iterator
:
public
const_iterator
class
iterator
:
public
const_iterator
{
{
public
:
public
:
...
@@ -5490,13 +5492,28 @@ class basic_json
...
@@ -5490,13 +5492,28 @@ class basic_json
}
}
};
};
/// a template for a reverse iterator class
/*!
@brief a template for a reverse iterator class
@tparam Base the base iterator type to reverse. Valid types are @ref
iterator (to create @ref reverse_iterator) and @ref const_iterator (to
create @ref const_reverse_iterator).
@requirement The class satisfies the following concept requirements:
- [RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator):
The iterator that can be moved to point (forward and backward) to any
element in constant time.
- [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator):
It is possible to write to the pointed-to element (only if @a Base is
@ref iterator).
*/
template
<
typename
Base
>
template
<
typename
Base
>
class
json_reverse_iterator
:
public
std
::
reverse_iterator
<
Base
>
class
json_reverse_iterator
:
public
std
::
reverse_iterator
<
Base
>
{
{
public
:
public
:
/// shortcut to the reverse iterator adaptor
/// shortcut to the reverse iterator adaptor
using
base_iterator
=
std
::
reverse_iterator
<
Base
>
;
using
base_iterator
=
std
::
reverse_iterator
<
Base
>
;
/// the reference type for the pointed-to element
using
reference
=
typename
Base
::
reference
;
using
reference
=
typename
Base
::
reference
;
/// create reverse iterator from iterator
/// create reverse iterator from iterator
...
@@ -5772,758 +5789,369 @@ class basic_json
...
@@ -5772,758 +5789,369 @@ class basic_json
// remember the begin of the token
// remember the begin of the token
m_start
=
m_cursor
;
m_start
=
m_cursor
;
{
lexer_char_t
yych
;
unsigned
int
yyaccept
=
0
;
static
const
unsigned
char
yybm
[]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
32
,
32
,
0
,
0
,
32
,
0
,
0
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
96
,
64
,
0
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
192
,
192
,
192
,
192
,
192
,
192
,
192
,
192
,
192
,
192
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
0
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
};
{
if
((
m_limit
-
m_cursor
)
<
5
)
yyfill
();
// LCOV_EXCL_LINE;
lexer_char_t
yych
;
yych
=
*
m_cursor
;
unsigned
int
yyaccept
=
0
;
if
(
yych
<=
'9'
)
{
static
const
unsigned
char
yybm
[]
=
if
(
yych
<=
' '
)
{
{
if
(
yych
<=
'\n'
)
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
if
(
yych
<=
0x00
)
goto
basic_json_parser_27
;
0
,
32
,
32
,
0
,
0
,
32
,
0
,
0
,
if
(
yych
<=
0x08
)
goto
basic_json_parser_29
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
>=
'\n'
)
goto
basic_json_parser_4
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
}
else
{
96
,
64
,
0
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
==
'\r'
)
goto
basic_json_parser_2
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
0x1F
)
goto
basic_json_parser_29
;
192
,
192
,
192
,
192
,
192
,
192
,
192
,
192
,
}
192
,
192
,
64
,
64
,
64
,
64
,
64
,
64
,
}
else
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
','
)
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
==
'"'
)
goto
basic_json_parser_26
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'+'
)
goto
basic_json_parser_29
;
64
,
64
,
64
,
64
,
0
,
64
,
64
,
64
,
goto
basic_json_parser_14
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
}
else
{
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'-'
)
goto
basic_json_parser_22
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'/'
)
goto
basic_json_parser_29
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
if
(
yych
<=
'0'
)
goto
basic_json_parser_23
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
goto
basic_json_parser_25
;
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
64
,
};
if
((
m_limit
-
m_cursor
)
<
5
)
{
yyfill
();
// LCOV_EXCL_LINE;
}
yych
=
*
m_cursor
;
if
(
yych
<=
'9'
)
{
if
(
yych
<=
' '
)
{
if
(
yych
<=
'\n'
)
{
if
(
yych
<=
0x00
)
{
goto
basic_json_parser_27
;
}
if
(
yych
<=
0x08
)
{
goto
basic_json_parser_29
;
}
if
(
yych
>=
'\n'
)
{
goto
basic_json_parser_4
;
}
}
else
{
if
(
yych
==
'\r'
)
{
goto
basic_json_parser_2
;
}
if
(
yych
<=
0x1F
)
{
goto
basic_json_parser_29
;
}
}
}
else
{
if
(
yych
<=
','
)
{
if
(
yych
==
'"'
)
{
goto
basic_json_parser_26
;
}
if
(
yych
<=
'+'
)
{
goto
basic_json_parser_29
;
}
goto
basic_json_parser_14
;
}
else
{
if
(
yych
<=
'-'
)
{
goto
basic_json_parser_22
;
}
if
(
yych
<=
'/'
)
{
goto
basic_json_parser_29
;
}
if
(
yych
<=
'0'
)
{
goto
basic_json_parser_23
;
}
goto
basic_json_parser_25
;
}
}
}
}
else
}
{
}
else
{
if
(
yych
<=
'm'
)
if
(
yych
<=
'm'
)
{
{
if
(
yych
<=
'\\'
)
{
if
(
yych
<=
'\\'
)
if
(
yych
<=
':'
)
goto
basic_json_parser_16
;
{
if
(
yych
==
'['
)
goto
basic_json_parser_6
;
if
(
yych
<=
':'
)
goto
basic_json_parser_29
;
{
}
else
{
goto
basic_json_parser_16
;
if
(
yych
<=
']'
)
goto
basic_json_parser_8
;
}
if
(
yych
==
'f'
)
goto
basic_json_parser_21
;
if
(
yych
==
'['
)
goto
basic_json_parser_29
;
{
}
goto
basic_json_parser_6
;
}
else
{
}
if
(
yych
<=
'z'
)
{
goto
basic_json_parser_29
;
if
(
yych
<=
'n'
)
goto
basic_json_parser_18
;
}
if
(
yych
==
't'
)
goto
basic_json_parser_20
;
else
goto
basic_json_parser_29
;
{
}
else
{
if
(
yych
<=
']'
)
if
(
yych
<=
'{'
)
goto
basic_json_parser_10
;
{
if
(
yych
==
'}'
)
goto
basic_json_parser_12
;
goto
basic_json_parser_8
;
goto
basic_json_parser_29
;
}
if
(
yych
==
'f'
)
{
goto
basic_json_parser_21
;
}
goto
basic_json_parser_29
;
}
}
else
{
if
(
yych
<=
'z'
)
{
if
(
yych
<=
'n'
)
{
goto
basic_json_parser_18
;
}
if
(
yych
==
't'
)
{
goto
basic_json_parser_20
;
}
goto
basic_json_parser_29
;
}
else
{
if
(
yych
<=
'{'
)
{
goto
basic_json_parser_10
;
}
if
(
yych
==
'}'
)
{
goto
basic_json_parser_12
;
}
goto
basic_json_parser_29
;
}
}
}
}
}
}
basic_json_parser_2
:
basic_json_parser_2
:
++
m_cursor
;
++
m_cursor
;
yych
=
*
m_cursor
;
yych
=
*
m_cursor
;
goto
basic_json_parser_5
;
goto
basic_json_parser_5
;
basic_json_parser_3
:
basic_json_parser_3
:
{
{
return
scan
();
}
return
scan
();
}
basic_json_parser_4
:
basic_json_parser_4
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
yyfill
();
// LCOV_EXCL_LINE;
{
yych
=
*
m_cursor
;
yyfill
();
// LCOV_EXCL_LINE;
}
yych
=
*
m_cursor
;
basic_json_parser_5
:
basic_json_parser_5
:
if
(
yybm
[
0
+
yych
]
&
32
)
if
(
yybm
[
0
+
yych
]
&
32
)
{
{
goto
basic_json_parser_4
;
goto
basic_json_parser_4
;
}
}
goto
basic_json_parser_3
;
goto
basic_json_parser_3
;
basic_json_parser_6
:
basic_json_parser_6
:
++
m_cursor
;
++
m_cursor
;
{
{
return
token_type
::
begin_array
;
}
return
token_type
::
begin_array
;
}
basic_json_parser_8
:
basic_json_parser_8
:
++
m_cursor
;
++
m_cursor
;
{
{
return
token_type
::
end_array
;
}
return
token_type
::
end_array
;
}
basic_json_parser_10
:
basic_json_parser_10
:
++
m_cursor
;
++
m_cursor
;
{
{
return
token_type
::
begin_object
;
}
return
token_type
::
begin_object
;
}
basic_json_parser_12
:
basic_json_parser_12
:
++
m_cursor
;
++
m_cursor
;
{
{
return
token_type
::
end_object
;
}
return
token_type
::
end_object
;
}
basic_json_parser_14
:
basic_json_parser_14
:
++
m_cursor
;
++
m_cursor
;
{
{
return
token_type
::
value_separator
;
}
return
token_type
::
value_separator
;
}
basic_json_parser_16
:
basic_json_parser_16
:
++
m_cursor
;
++
m_cursor
;
{
{
return
token_type
::
name_separator
;
}
return
token_type
::
name_separator
;
}
basic_json_parser_18
:
basic_json_parser_18
:
yyaccept
=
0
;
yyaccept
=
0
;
yych
=
*
(
m_marker
=
++
m_cursor
);
yych
=
*
(
m_marker
=
++
m_cursor
);
if
(
yych
==
'u'
)
if
(
yych
==
'u'
)
goto
basic_json_parser_59
;
{
goto
basic_json_parser_59
;
}
basic_json_parser_19
:
basic_json_parser_19
:
{
{
return
token_type
::
parse_error
;
}
return
token_type
::
parse_error
;
}
basic_json_parser_20
:
basic_json_parser_20
:
yyaccept
=
0
;
yyaccept
=
0
;
yych
=
*
(
m_marker
=
++
m_cursor
);
yych
=
*
(
m_marker
=
++
m_cursor
);
if
(
yych
==
'r'
)
if
(
yych
==
'r'
)
goto
basic_json_parser_55
;
{
goto
basic_json_parser_19
;
goto
basic_json_parser_55
;
}
goto
basic_json_parser_19
;
basic_json_parser_21
:
basic_json_parser_21
:
yyaccept
=
0
;
yyaccept
=
0
;
yych
=
*
(
m_marker
=
++
m_cursor
);
yych
=
*
(
m_marker
=
++
m_cursor
);
if
(
yych
==
'a'
)
if
(
yych
==
'a'
)
goto
basic_json_parser_50
;
{
goto
basic_json_parser_19
;
goto
basic_json_parser_50
;
}
goto
basic_json_parser_19
;
basic_json_parser_22
:
basic_json_parser_22
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
goto
basic_json_parser_19
;
{
if
(
yych
<=
'0'
)
goto
basic_json_parser_49
;
goto
basic_json_parser_19
;
if
(
yych
<=
'9'
)
goto
basic_json_parser_40
;
}
goto
basic_json_parser_19
;
if
(
yych
<=
'0'
)
{
goto
basic_json_parser_49
;
}
if
(
yych
<=
'9'
)
{
goto
basic_json_parser_40
;
}
goto
basic_json_parser_19
;
basic_json_parser_23
:
basic_json_parser_23
:
yyaccept
=
1
;
yyaccept
=
1
;
yych
=
*
(
m_marker
=
++
m_cursor
);
yych
=
*
(
m_marker
=
++
m_cursor
);
if
(
yych
<=
'D'
)
if
(
yych
<=
'D'
)
{
{
if
(
yych
==
'.'
)
goto
basic_json_parser_42
;
if
(
yych
==
'.'
)
}
else
{
{
if
(
yych
<=
'E'
)
goto
basic_json_parser_43
;
goto
basic_json_parser_42
;
if
(
yych
==
'e'
)
goto
basic_json_parser_43
;
}
}
}
else
{
if
(
yych
<=
'E'
)
{
goto
basic_json_parser_43
;
}
if
(
yych
==
'e'
)
{
goto
basic_json_parser_43
;
}
}
basic_json_parser_24
:
basic_json_parser_24
:
{
{
return
token_type
::
value_number
;
}
return
token_type
::
value_number
;
}
basic_json_parser_25
:
basic_json_parser_25
:
yyaccept
=
1
;
yyaccept
=
1
;
yych
=
*
(
m_marker
=
++
m_cursor
);
yych
=
*
(
m_marker
=
++
m_cursor
);
goto
basic_json_parser_41
;
goto
basic_json_parser_41
;
basic_json_parser_26
:
basic_json_parser_26
:
yyaccept
=
0
;
yyaccept
=
0
;
yych
=
*
(
m_marker
=
++
m_cursor
);
yych
=
*
(
m_marker
=
++
m_cursor
);
if
(
yych
<=
0x0F
)
if
(
yych
<=
0x0F
)
goto
basic_json_parser_19
;
{
goto
basic_json_parser_31
;
goto
basic_json_parser_19
;
}
goto
basic_json_parser_31
;
basic_json_parser_27
:
basic_json_parser_27
:
++
m_cursor
;
++
m_cursor
;
{
{
return
token_type
::
end_of_input
;
}
return
token_type
::
end_of_input
;
}
basic_json_parser_29
:
basic_json_parser_29
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
goto
basic_json_parser_19
;
goto
basic_json_parser_19
;
basic_json_parser_30
:
basic_json_parser_30
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
yyfill
();
// LCOV_EXCL_LINE;
{
yych
=
*
m_cursor
;
yyfill
();
// LCOV_EXCL_LINE;
}
yych
=
*
m_cursor
;
basic_json_parser_31
:
basic_json_parser_31
:
if
(
yybm
[
0
+
yych
]
&
64
)
if
(
yybm
[
0
+
yych
]
&
64
)
{
{
goto
basic_json_parser_30
;
goto
basic_json_parser_30
;
}
}
if
(
yych
<=
0x0F
)
goto
basic_json_parser_32
;
if
(
yych
<=
0x0F
)
if
(
yych
<=
'"'
)
goto
basic_json_parser_34
;
{
goto
basic_json_parser_33
;
goto
basic_json_parser_32
;
}
if
(
yych
<=
'"'
)
{
goto
basic_json_parser_34
;
}
goto
basic_json_parser_33
;
basic_json_parser_32
:
basic_json_parser_32
:
m_cursor
=
m_marker
;
m_cursor
=
m_marker
;
if
(
yyaccept
==
0
)
if
(
yyaccept
==
0
)
{
{
goto
basic_json_parser_19
;
goto
basic_json_parser_19
;
}
else
{
}
goto
basic_json_parser_24
;
else
}
{
goto
basic_json_parser_24
;
}
basic_json_parser_33
:
basic_json_parser_33
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
yyfill
();
// LCOV_EXCL_LINE;
{
yych
=
*
m_cursor
;
yyfill
();
// LCOV_EXCL_LINE;
if
(
yych
<=
'e'
)
{
}
if
(
yych
<=
'/'
)
{
yych
=
*
m_cursor
;
if
(
yych
==
'"'
)
goto
basic_json_parser_30
;
if
(
yych
<=
'e'
)
if
(
yych
<=
'.'
)
goto
basic_json_parser_32
;
{
goto
basic_json_parser_30
;
if
(
yych
<=
'/'
)
}
else
{
{
if
(
yych
<=
'\\'
)
{
if
(
yych
==
'"'
)
if
(
yych
<=
'['
)
goto
basic_json_parser_32
;
{
goto
basic_json_parser_30
;
goto
basic_json_parser_30
;
}
else
{
}
if
(
yych
==
'b'
)
goto
basic_json_parser_30
;
if
(
yych
<=
'.'
)
goto
basic_json_parser_32
;
{
goto
basic_json_parser_32
;
}
goto
basic_json_parser_30
;
}
else
{
if
(
yych
<=
'\\'
)
{
if
(
yych
<=
'['
)
{
goto
basic_json_parser_32
;
}
goto
basic_json_parser_30
;
}
else
{
if
(
yych
==
'b'
)
{
goto
basic_json_parser_30
;
}
goto
basic_json_parser_32
;
}
}
}
}
else
}
{
}
else
{
if
(
yych
<=
'q'
)
if
(
yych
<=
'q'
)
{
{
if
(
yych
<=
'f'
)
goto
basic_json_parser_30
;
if
(
yych
<=
'f'
)
if
(
yych
==
'n'
)
goto
basic_json_parser_30
;
{
goto
basic_json_parser_32
;
goto
basic_json_parser_30
;
}
else
{
}
if
(
yych
<=
's'
)
{
if
(
yych
==
'n'
)
if
(
yych
<=
'r'
)
goto
basic_json_parser_30
;
{
goto
basic_json_parser_32
;
goto
basic_json_parser_30
;
}
else
{
}
if
(
yych
<=
't'
)
goto
basic_json_parser_30
;
goto
basic_json_parser_32
;
if
(
yych
<=
'u'
)
goto
basic_json_parser_36
;
}
goto
basic_json_parser_32
;
else
{
if
(
yych
<=
's'
)
{
if
(
yych
<=
'r'
)
{
goto
basic_json_parser_30
;
}
goto
basic_json_parser_32
;
}
else
{
if
(
yych
<=
't'
)
{
goto
basic_json_parser_30
;
}
if
(
yych
<=
'u'
)
{
goto
basic_json_parser_36
;
}
goto
basic_json_parser_32
;
}
}
}
}
}
}
basic_json_parser_34
:
basic_json_parser_34
:
++
m_cursor
;
++
m_cursor
;
{
{
return
token_type
::
value_string
;
}
return
token_type
::
value_string
;
}
basic_json_parser_36
:
basic_json_parser_36
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
yyfill
();
// LCOV_EXCL_LINE;
{
yych
=
*
m_cursor
;
yyfill
();
// LCOV_EXCL_LINE;
if
(
yych
<=
'@'
)
{
}
if
(
yych
<=
'/'
)
goto
basic_json_parser_32
;
yych
=
*
m_cursor
;
if
(
yych
>=
':'
)
goto
basic_json_parser_32
;
if
(
yych
<=
'@'
)
}
else
{
{
if
(
yych
<=
'F'
)
goto
basic_json_parser_37
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'`'
)
goto
basic_json_parser_32
;
{
if
(
yych
>=
'g'
)
goto
basic_json_parser_32
;
goto
basic_json_parser_32
;
}
}
if
(
yych
>=
':'
)
{
goto
basic_json_parser_32
;
}
}
else
{
if
(
yych
<=
'F'
)
{
goto
basic_json_parser_37
;
}
if
(
yych
<=
'`'
)
{
goto
basic_json_parser_32
;
}
if
(
yych
>=
'g'
)
{
goto
basic_json_parser_32
;
}
}
basic_json_parser_37
:
basic_json_parser_37
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
yyfill
();
// LCOV_EXCL_LINE;
{
yych
=
*
m_cursor
;
yyfill
();
// LCOV_EXCL_LINE;
if
(
yych
<=
'@'
)
{
}
if
(
yych
<=
'/'
)
goto
basic_json_parser_32
;
yych
=
*
m_cursor
;
if
(
yych
>=
':'
)
goto
basic_json_parser_32
;
if
(
yych
<=
'@'
)
}
else
{
{
if
(
yych
<=
'F'
)
goto
basic_json_parser_38
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'`'
)
goto
basic_json_parser_32
;
{
if
(
yych
>=
'g'
)
goto
basic_json_parser_32
;
goto
basic_json_parser_32
;
}
}
if
(
yych
>=
':'
)
{
goto
basic_json_parser_32
;
}
}
else
{
if
(
yych
<=
'F'
)
{
goto
basic_json_parser_38
;
}
if
(
yych
<=
'`'
)
{
goto
basic_json_parser_32
;
}
if
(
yych
>=
'g'
)
{
goto
basic_json_parser_32
;
}
}
basic_json_parser_38
:
basic_json_parser_38
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
yyfill
();
// LCOV_EXCL_LINE;
{
yych
=
*
m_cursor
;
yyfill
();
// LCOV_EXCL_LINE;
if
(
yych
<=
'@'
)
{
}
if
(
yych
<=
'/'
)
goto
basic_json_parser_32
;
yych
=
*
m_cursor
;
if
(
yych
>=
':'
)
goto
basic_json_parser_32
;
if
(
yych
<=
'@'
)
}
else
{
{
if
(
yych
<=
'F'
)
goto
basic_json_parser_39
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'`'
)
goto
basic_json_parser_32
;
{
if
(
yych
>=
'g'
)
goto
basic_json_parser_32
;
goto
basic_json_parser_32
;
}
}
if
(
yych
>=
':'
)
{
goto
basic_json_parser_32
;
}
}
else
{
if
(
yych
<=
'F'
)
{
goto
basic_json_parser_39
;
}
if
(
yych
<=
'`'
)
{
goto
basic_json_parser_32
;
}
if
(
yych
>=
'g'
)
{
goto
basic_json_parser_32
;
}
}
basic_json_parser_39
:
basic_json_parser_39
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
yyfill
();
// LCOV_EXCL_LINE;
{
yych
=
*
m_cursor
;
yyfill
();
// LCOV_EXCL_LINE;
if
(
yych
<=
'@'
)
{
}
if
(
yych
<=
'/'
)
goto
basic_json_parser_32
;
yych
=
*
m_cursor
;
if
(
yych
<=
'9'
)
goto
basic_json_parser_30
;
if
(
yych
<=
'@'
)
goto
basic_json_parser_32
;
{
}
else
{
if
(
yych
<=
'/'
)
if
(
yych
<=
'F'
)
goto
basic_json_parser_30
;
{
if
(
yych
<=
'`'
)
goto
basic_json_parser_32
;
goto
basic_json_parser_32
;
if
(
yych
<=
'f'
)
goto
basic_json_parser_30
;
}
goto
basic_json_parser_32
;
if
(
yych
<=
'9'
)
}
{
goto
basic_json_parser_30
;
}
goto
basic_json_parser_32
;
}
else
{
if
(
yych
<=
'F'
)
{
goto
basic_json_parser_30
;
}
if
(
yych
<=
'`'
)
{
goto
basic_json_parser_32
;
}
if
(
yych
<=
'f'
)
{
goto
basic_json_parser_30
;
}
goto
basic_json_parser_32
;
}
basic_json_parser_40
:
basic_json_parser_40
:
yyaccept
=
1
;
yyaccept
=
1
;
m_marker
=
++
m_cursor
;
m_marker
=
++
m_cursor
;
if
((
m_limit
-
m_cursor
)
<
3
)
if
((
m_limit
-
m_cursor
)
<
3
)
yyfill
();
// LCOV_EXCL_LINE;
{
yych
=
*
m_cursor
;
yyfill
();
// LCOV_EXCL_LINE;
}
yych
=
*
m_cursor
;
basic_json_parser_41
:
basic_json_parser_41
:
if
(
yybm
[
0
+
yych
]
&
128
)
if
(
yybm
[
0
+
yych
]
&
128
)
{
{
goto
basic_json_parser_40
;
goto
basic_json_parser_40
;
}
}
if
(
yych
<=
'D'
)
{
if
(
yych
<=
'D'
)
if
(
yych
!=
'.'
)
goto
basic_json_parser_24
;
{
}
else
{
if
(
yych
!=
'.'
)
if
(
yych
<=
'E'
)
goto
basic_json_parser_43
;
{
if
(
yych
==
'e'
)
goto
basic_json_parser_43
;
goto
basic_json_parser_24
;
goto
basic_json_parser_24
;
}
}
}
else
{
if
(
yych
<=
'E'
)
{
goto
basic_json_parser_43
;
}
if
(
yych
==
'e'
)
{
goto
basic_json_parser_43
;
}
goto
basic_json_parser_24
;
}
basic_json_parser_42
:
basic_json_parser_42
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
goto
basic_json_parser_32
;
{
if
(
yych
<=
'9'
)
goto
basic_json_parser_47
;
goto
basic_json_parser_32
;
goto
basic_json_parser_32
;
}
if
(
yych
<=
'9'
)
{
goto
basic_json_parser_47
;
}
goto
basic_json_parser_32
;
basic_json_parser_43
:
basic_json_parser_43
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
<=
','
)
if
(
yych
<=
','
)
{
{
if
(
yych
!=
'+'
)
goto
basic_json_parser_32
;
if
(
yych
!=
'+'
)
}
else
{
{
if
(
yych
<=
'-'
)
goto
basic_json_parser_44
;
goto
basic_json_parser_32
;
if
(
yych
<=
'/'
)
goto
basic_json_parser_32
;
}
if
(
yych
<=
'9'
)
goto
basic_json_parser_45
;
}
goto
basic_json_parser_32
;
else
}
{
if
(
yych
<=
'-'
)
{
goto
basic_json_parser_44
;
}
if
(
yych
<=
'/'
)
{
goto
basic_json_parser_32
;
}
if
(
yych
<=
'9'
)
{
goto
basic_json_parser_45
;
}
goto
basic_json_parser_32
;
}
basic_json_parser_44
:
basic_json_parser_44
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
goto
basic_json_parser_32
;
{
if
(
yych
>=
':'
)
goto
basic_json_parser_32
;
goto
basic_json_parser_32
;
}
if
(
yych
>=
':'
)
{
goto
basic_json_parser_32
;
}
basic_json_parser_45
:
basic_json_parser_45
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
yyfill
();
// LCOV_EXCL_LINE;
{
yych
=
*
m_cursor
;
yyfill
();
// LCOV_EXCL_LINE;
if
(
yych
<=
'/'
)
goto
basic_json_parser_24
;
}
if
(
yych
<=
'9'
)
goto
basic_json_parser_45
;
yych
=
*
m_cursor
;
goto
basic_json_parser_24
;
if
(
yych
<=
'/'
)
{
goto
basic_json_parser_24
;
}
if
(
yych
<=
'9'
)
{
goto
basic_json_parser_45
;
}
goto
basic_json_parser_24
;
basic_json_parser_47
:
basic_json_parser_47
:
yyaccept
=
1
;
yyaccept
=
1
;
m_marker
=
++
m_cursor
;
m_marker
=
++
m_cursor
;
if
((
m_limit
-
m_cursor
)
<
3
)
if
((
m_limit
-
m_cursor
)
<
3
)
yyfill
();
// LCOV_EXCL_LINE;
{
yych
=
*
m_cursor
;
yyfill
();
// LCOV_EXCL_LINE;
if
(
yych
<=
'D'
)
{
}
if
(
yych
<=
'/'
)
goto
basic_json_parser_24
;
yych
=
*
m_cursor
;
if
(
yych
<=
'9'
)
goto
basic_json_parser_47
;
if
(
yych
<=
'D'
)
goto
basic_json_parser_24
;
{
}
else
{
if
(
yych
<=
'/'
)
if
(
yych
<=
'E'
)
goto
basic_json_parser_43
;
{
if
(
yych
==
'e'
)
goto
basic_json_parser_43
;
goto
basic_json_parser_24
;
goto
basic_json_parser_24
;
}
}
if
(
yych
<=
'9'
)
{
goto
basic_json_parser_47
;
}
goto
basic_json_parser_24
;
}
else
{
if
(
yych
<=
'E'
)
{
goto
basic_json_parser_43
;
}
if
(
yych
==
'e'
)
{
goto
basic_json_parser_43
;
}
goto
basic_json_parser_24
;
}
basic_json_parser_49
:
basic_json_parser_49
:
yyaccept
=
1
;
yyaccept
=
1
;
yych
=
*
(
m_marker
=
++
m_cursor
);
yych
=
*
(
m_marker
=
++
m_cursor
);
if
(
yych
<=
'D'
)
if
(
yych
<=
'D'
)
{
{
if
(
yych
==
'.'
)
goto
basic_json_parser_42
;
if
(
yych
==
'.'
)
goto
basic_json_parser_24
;
{
}
else
{
goto
basic_json_parser_42
;
if
(
yych
<=
'E'
)
goto
basic_json_parser_43
;
}
if
(
yych
==
'e'
)
goto
basic_json_parser_43
;
goto
basic_json_parser_24
;
goto
basic_json_parser_24
;
}
}
else
{
if
(
yych
<=
'E'
)
{
goto
basic_json_parser_43
;
}
if
(
yych
==
'e'
)
{
goto
basic_json_parser_43
;
}
goto
basic_json_parser_24
;
}
basic_json_parser_50
:
basic_json_parser_50
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
!=
'l'
)
if
(
yych
!=
'l'
)
goto
basic_json_parser_32
;
{
yych
=
*++
m_cursor
;
goto
basic_json_parser_32
;
if
(
yych
!=
's'
)
goto
basic_json_parser_32
;
}
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
!=
'e'
)
goto
basic_json_parser_32
;
if
(
yych
!=
's'
)
++
m_cursor
;
{
{
return
token_type
::
literal_false
;
}
goto
basic_json_parser_32
;
}
yych
=
*++
m_cursor
;
if
(
yych
!=
'e'
)
{
goto
basic_json_parser_32
;
}
++
m_cursor
;
{
return
token_type
::
literal_false
;
}
basic_json_parser_55
:
basic_json_parser_55
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
!=
'u'
)
if
(
yych
!=
'u'
)
goto
basic_json_parser_32
;
{
yych
=
*++
m_cursor
;
goto
basic_json_parser_32
;
if
(
yych
!=
'e'
)
goto
basic_json_parser_32
;
}
++
m_cursor
;
yych
=
*++
m_cursor
;
{
return
token_type
::
literal_true
;
}
if
(
yych
!=
'e'
)
{
goto
basic_json_parser_32
;
}
++
m_cursor
;
{
return
token_type
::
literal_true
;
}
basic_json_parser_59
:
basic_json_parser_59
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
!=
'l'
)
if
(
yych
!=
'l'
)
goto
basic_json_parser_32
;
{
yych
=
*++
m_cursor
;
goto
basic_json_parser_32
;
if
(
yych
!=
'l'
)
goto
basic_json_parser_32
;
}
++
m_cursor
;
yych
=
*++
m_cursor
;
{
return
token_type
::
literal_null
;
}
if
(
yych
!=
'l'
)
}
{
goto
basic_json_parser_32
;
}
++
m_cursor
;
{
return
token_type
::
literal_null
;
}
}
}
}
...
@@ -7047,7 +6675,6 @@ namespace std
...
@@ -7047,7 +6675,6 @@ namespace std
{
{
/*!
/*!
@brief exchanges the values of two JSON objects
@brief exchanges the values of two JSON objects
@ingroup container
*/
*/
template
<>
template
<>
inline
void
swap
(
nlohmann
::
json
&
j1
,
inline
void
swap
(
nlohmann
::
json
&
j1
,
...
...
src/json.hpp.re2c
View file @
623c03bc
...
@@ -103,24 +103,47 @@ default)
...
@@ -103,24 +103,47 @@ default)
@requirement The class satisfies the following concept requirements:
@requirement The class satisfies the following concept requirements:
- Basic
- Basic
- [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible)
- [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible):
- [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible)
JSON values can be default constructed. The result will be a JSON null value.
- [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible)
- [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible):
- [MoveAssignable](http://en.cppreference.com/w/cpp/concept/MoveAssignable)
A JSON value can be constructed from an rvalue argument.
- [CopyAssignable](http://en.cppreference.com/w/cpp/concept/CopyAssignable)
- [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible):
- [Destructible](http://en.cppreference.com/w/cpp/concept/Destructible)
A JSON value can be copy-constrcuted from an lvalue expression.
- [MoveAssignable](http://en.cppreference.com/w/cpp/concept/MoveAssignable):
A JSON value van be assigned from an rvalue argument.
- [CopyAssignable](http://en.cppreference.com/w/cpp/concept/CopyAssignable):
A JSON value can be copy-assigned from an lvalue expression.
- [Destructible](http://en.cppreference.com/w/cpp/concept/Destructible):
JSON values can be destructed.
- Layout
- Layout
- [StandardLayoutType](http://en.cppreference.com/w/cpp/concept/StandardLayoutType)
- [StandardLayoutType](http://en.cppreference.com/w/cpp/concept/StandardLayoutType):
JSON values have
[standard layout](http://en.cppreference.com/w/cpp/language/data_members#Standard_layout):
All non-static data members are private and standard layout types, the class
has no virtual functions or (virtual) base classes.
- Library-wide
- Library-wide
- [EqualityComparable](http://en.cppreference.com/w/cpp/concept/EqualityComparable)
- [EqualityComparable](http://en.cppreference.com/w/cpp/concept/EqualityComparable):
- [LessThanComparable](http://en.cppreference.com/w/cpp/concept/LessThanComparable)
JSON values can be compared with `==`, see @ref
- [Swappable](http://en.cppreference.com/w/cpp/concept/Swappable)
operator==(const_reference,const_reference).
- [NullablePointer](http://en.cppreference.com/w/cpp/concept/NullablePointer)
- [LessThanComparable](http://en.cppreference.com/w/cpp/concept/LessThanComparable):
JSON values can be compared with `<`, see @ref
operator<(const_reference,const_reference).
- [Swappable](http://en.cppreference.com/w/cpp/concept/Swappable):
Any JSON lvalue or rvalue of can be swapped with any lvalue or rvalue of
other compatible types, using unqualified function call @ref swap().
- [NullablePointer](http://en.cppreference.com/w/cpp/concept/NullablePointer):
JSON values can be compared against `std::nullptr_t` objects which are used
to model the `null` value.
- Container
- Container
- [Container](http://en.cppreference.com/w/cpp/concept/Container)
- [Container](http://en.cppreference.com/w/cpp/concept/Container):
- [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)
JSON values can be used like STL containers and provide iterator access.
- [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer);
JSON values can be used like STL containers and provide reverse iterator
access.
@internal
@note ObjectType trick from http://stackoverflow.com/a/9860911
@note ObjectType trick from http://stackoverflow.com/a/9860911
@endinternal
@see RFC 7159 <http://rfc7159.net/rfc7159>
@see RFC 7159 <http://rfc7159.net/rfc7159>
*/
*/
...
@@ -137,8 +160,13 @@ class basic_json
...
@@ -137,8 +160,13 @@ class basic_json
{
{
private:
private:
/// workaround type for MSVC
/// workaround type for MSVC
using basic_json_t =
using basic_json_t = basic_json<ObjectType,
basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType>;
ArrayType,
StringType,
BooleanType,
NumberIntegerType,
NumberFloatType,
AllocatorType>;
public:
public:
...
@@ -269,8 +297,11 @@ class basic_json
...
@@ -269,8 +297,11 @@ class basic_json
@sa array_t
@sa array_t
*/
*/
using object_t =
using object_t = ObjectType<StringType,
ObjectType<StringType, basic_json, std::less<StringType>, AllocatorType<std::pair<const StringType, basic_json>>>;
basic_json,
std::less<StringType>,
AllocatorType<std::pair<const StringType,
basic_json>>>;
/*!
/*!
@brief a type for an array
@brief a type for an array
...
@@ -526,7 +557,7 @@ class basic_json
...
@@ -526,7 +557,7 @@ class basic_json
boolean, ///< boolean value
boolean, ///< boolean value
number_integer, ///< number value (integer)
number_integer, ///< number value (integer)
number_float, ///< number value (floating-point)
number_float, ///< number value (floating-point)
discarded ///<
(internal) indicates the parser callback chose not to keep the value
discarded ///<
discarded by the the parser callback function
};
};
...
@@ -767,7 +798,6 @@ class basic_json
...
@@ -767,7 +798,6 @@ class basic_json
value.,basic_json}
value.,basic_json}
@sa basic_json(std::nullptr_t)
@sa basic_json(std::nullptr_t)
@ingroup container
*/
*/
basic_json() noexcept = default;
basic_json() noexcept = default;
...
@@ -1503,9 +1533,7 @@ class basic_json
...
@@ -1503,9 +1533,7 @@ class basic_json
@throw std::bad_alloc if allocation for object, array, or string fails.
@throw std::bad_alloc if allocation for object, array, or string fails.
@liveexample{The following code shows an example for the copy
@liveexample{The following code shows an example for the copy
constructor.,basic_jsonbasic_json_t}
constructor.,basic_json__basic_json}
@ingroup container
*/
*/
basic_json(const basic_json& other)
basic_json(const basic_json& other)
: m_type(other.m_type)
: m_type(other.m_type)
...
@@ -1599,8 +1627,6 @@ class basic_json
...
@@ -1599,8 +1627,6 @@ class basic_json
creates a copy of value `a` which is then swapped with `b`. Finally\, the
creates a copy of value `a` which is then swapped with `b`. Finally\, the
copy of `a` (which is the null value after the swap) is
copy of `a` (which is the null value after the swap) is
destroyed.,basic_json__copyassignment}
destroyed.,basic_json__copyassignment}
@ingroup container
*/
*/
reference& operator=(basic_json other) noexcept (
reference& operator=(basic_json other) noexcept (
std::is_nothrow_move_constructible<value_t>::value and
std::is_nothrow_move_constructible<value_t>::value and
...
@@ -1625,8 +1651,6 @@ class basic_json
...
@@ -1625,8 +1651,6 @@ class basic_json
@requirement This function satisfies the Container requirements:
@requirement This function satisfies the Container requirements:
- The complexity is linear.
- The complexity is linear.
- All stored elements are destroyed and all memory is freed.
- All stored elements are destroyed and all memory is freed.
@ingroup container
*/
*/
~basic_json()
~basic_json()
{
{
...
@@ -3138,8 +3162,6 @@ class basic_json
...
@@ -3138,8 +3162,6 @@ class basic_json
- The complexity is constant.
- The complexity is constant.
@liveexample{The following code shows an example for @ref begin.,begin}
@liveexample{The following code shows an example for @ref begin.,begin}
@ingroup container
*/
*/
iterator begin()
iterator begin()
{
{
...
@@ -3150,7 +3172,6 @@ class basic_json
...
@@ -3150,7 +3172,6 @@ class basic_json
/*!
/*!
@copydoc basic_json::cbegin()
@copydoc basic_json::cbegin()
@ingroup container
*/
*/
const_iterator begin() const
const_iterator begin() const
{
{
...
@@ -3173,8 +3194,6 @@ class basic_json
...
@@ -3173,8 +3194,6 @@ class basic_json
- Has the semantics of `const_cast<const basic_json&>(*this).begin()`.
- Has the semantics of `const_cast<const basic_json&>(*this).begin()`.
@liveexample{The following code shows an example for @ref cbegin.,cbegin}
@liveexample{The following code shows an example for @ref cbegin.,cbegin}
@ingroup container
*/
*/
const_iterator cbegin() const
const_iterator cbegin() const
{
{
...
@@ -3198,8 +3217,6 @@ class basic_json
...
@@ -3198,8 +3217,6 @@ class basic_json
- The complexity is constant.
- The complexity is constant.
@liveexample{The following code shows an example for @ref end.,end}
@liveexample{The following code shows an example for @ref end.,end}
@ingroup container
*/
*/
iterator end()
iterator end()
{
{
...
@@ -3210,7 +3227,6 @@ class basic_json
...
@@ -3210,7 +3227,6 @@ class basic_json
/*!
/*!
@copydoc basic_json::cend()
@copydoc basic_json::cend()
@ingroup container
*/
*/
const_iterator end() const
const_iterator end() const
{
{
...
@@ -3233,8 +3249,6 @@ class basic_json
...
@@ -3233,8 +3249,6 @@ class basic_json
- Has the semantics of `const_cast<const basic_json&>(*this).end()`.
- Has the semantics of `const_cast<const basic_json&>(*this).end()`.
@liveexample{The following code shows an example for @ref cend.,cend}
@liveexample{The following code shows an example for @ref cend.,cend}
@ingroup container
*/
*/
const_iterator cend() const
const_iterator cend() const
{
{
...
@@ -3257,8 +3271,6 @@ class basic_json
...
@@ -3257,8 +3271,6 @@ class basic_json
- Has the semantics of `reverse_iterator(end())`.
- Has the semantics of `reverse_iterator(end())`.
@liveexample{The following code shows an example for @ref rbegin.,rbegin}
@liveexample{The following code shows an example for @ref rbegin.,rbegin}
@ingroup reversiblecontainer
*/
*/
reverse_iterator rbegin()
reverse_iterator rbegin()
{
{
...
@@ -3267,7 +3279,6 @@ class basic_json
...
@@ -3267,7 +3279,6 @@ class basic_json
/*!
/*!
@copydoc basic_json::crbegin()
@copydoc basic_json::crbegin()
@ingroup reversiblecontainer
*/
*/
const_reverse_iterator rbegin() const
const_reverse_iterator rbegin() const
{
{
...
@@ -3289,8 +3300,6 @@ class basic_json
...
@@ -3289,8 +3300,6 @@ class basic_json
- Has the semantics of `reverse_iterator(begin())`.
- Has the semantics of `reverse_iterator(begin())`.
@liveexample{The following code shows an example for @ref rend.,rend}
@liveexample{The following code shows an example for @ref rend.,rend}
@ingroup reversiblecontainer
*/
*/
reverse_iterator rend()
reverse_iterator rend()
{
{
...
@@ -3299,7 +3308,6 @@ class basic_json
...
@@ -3299,7 +3308,6 @@ class basic_json
/*!
/*!
@copydoc basic_json::crend()
@copydoc basic_json::crend()
@ingroup reversiblecontainer
*/
*/
const_reverse_iterator rend() const
const_reverse_iterator rend() const
{
{
...
@@ -3321,8 +3329,6 @@ class basic_json
...
@@ -3321,8 +3329,6 @@ class basic_json
- Has the semantics of `const_cast<const basic_json&>(*this).rbegin()`.
- Has the semantics of `const_cast<const basic_json&>(*this).rbegin()`.
@liveexample{The following code shows an example for @ref crbegin.,crbegin}
@liveexample{The following code shows an example for @ref crbegin.,crbegin}
@ingroup reversiblecontainer
*/
*/
const_reverse_iterator crbegin() const
const_reverse_iterator crbegin() const
{
{
...
@@ -3344,8 +3350,6 @@ class basic_json
...
@@ -3344,8 +3350,6 @@ class basic_json
- Has the semantics of `const_cast<const basic_json&>(*this).rend()`.
- Has the semantics of `const_cast<const basic_json&>(*this).rend()`.
@liveexample{The following code shows an example for @ref crend.,crend}
@liveexample{The following code shows an example for @ref crend.,crend}
@ingroup reversiblecontainer
*/
*/
const_reverse_iterator crend() const
const_reverse_iterator crend() const
{
{
...
@@ -3388,8 +3392,6 @@ class basic_json
...
@@ -3388,8 +3392,6 @@ class basic_json
@liveexample{The following code uses @ref empty to check if a @ref json
@liveexample{The following code uses @ref empty to check if a @ref json
object contains any elements.,empty}
object contains any elements.,empty}
@ingroup container
*/
*/
bool empty() const noexcept
bool empty() const noexcept
{
{
...
@@ -3444,8 +3446,6 @@ class basic_json
...
@@ -3444,8 +3446,6 @@ class basic_json
@liveexample{The following code calls @ref size on the different value
@liveexample{The following code calls @ref size on the different value
types.,size}
types.,size}
@ingroup container
*/
*/
size_type size() const noexcept
size_type size() const noexcept
{
{
...
@@ -3503,8 +3503,6 @@ class basic_json
...
@@ -3503,8 +3503,6 @@ class basic_json
@liveexample{The following code calls @ref max_size on the different value
@liveexample{The following code calls @ref max_size on the different value
types. Note the output is implementation specific.,max_size}
types. Note the output is implementation specific.,max_size}
@ingroup container
*/
*/
size_type max_size() const noexcept
size_type max_size() const noexcept
{
{
...
@@ -3932,8 +3930,6 @@ class basic_json
...
@@ -3932,8 +3930,6 @@ class basic_json
@liveexample{The example below shows how JSON arrays can be
@liveexample{The example below shows how JSON arrays can be
swapped.,swap__reference}
swapped.,swap__reference}
@ingroup container
*/
*/
void swap(reference other) noexcept (
void swap(reference other) noexcept (
std::is_nothrow_move_constructible<value_t>::value and
std::is_nothrow_move_constructible<value_t>::value and
...
@@ -3962,8 +3958,6 @@ class basic_json
...
@@ -3962,8 +3958,6 @@ class basic_json
@liveexample{The example below shows how JSON values can be
@liveexample{The example below shows how JSON values can be
swapped.,swap__array_t}
swapped.,swap__array_t}
@ingroup container
*/
*/
void swap(array_t& other)
void swap(array_t& other)
{
{
...
@@ -3993,8 +3987,6 @@ class basic_json
...
@@ -3993,8 +3987,6 @@ class basic_json
@liveexample{The example below shows how JSON values can be
@liveexample{The example below shows how JSON values can be
swapped.,swap__object_t}
swapped.,swap__object_t}
@ingroup container
*/
*/
void swap(object_t& other)
void swap(object_t& other)
{
{
...
@@ -4024,8 +4016,6 @@ class basic_json
...
@@ -4024,8 +4016,6 @@ class basic_json
@liveexample{The example below shows how JSON values can be
@liveexample{The example below shows how JSON values can be
swapped.,swap__string_t}
swapped.,swap__string_t}
@ingroup container
*/
*/
void swap(string_t& other)
void swap(string_t& other)
{
{
...
@@ -4100,8 +4090,6 @@ class basic_json
...
@@ -4100,8 +4090,6 @@ class basic_json
@liveexample{The example demonstrates comparing several JSON
@liveexample{The example demonstrates comparing several JSON
types.,operator__equal}
types.,operator__equal}
@ingroup container
*/
*/
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
friend bool operator==(const_reference lhs, const_reference rhs) noexcept
{
{
...
@@ -4186,8 +4174,6 @@ class basic_json
...
@@ -4186,8 +4174,6 @@ class basic_json
@liveexample{The example demonstrates comparing several JSON
@liveexample{The example demonstrates comparing several JSON
types.,operator__notequal}
types.,operator__notequal}
@ingroup container
*/
*/
friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
{
{
...
@@ -4839,7 +4825,7 @@ class basic_json
...
@@ -4839,7 +4825,7 @@ class basic_json
}
}
/// return value to compare
/// return value to compare
operator
const
difference_type () const
operator difference_type () const
{
{
return m_it;
return m_it;
}
}
...
@@ -4862,21 +4848,28 @@ class basic_json
...
@@ -4862,21 +4848,28 @@ class basic_json
struct internal_iterator
struct internal_iterator
{
{
/// iterator for JSON objects
/// iterator for JSON objects
typename object_t::iterator object_iterator;
typename object_t::iterator object_iterator
= typename object_t::iterator()
;
/// iterator for JSON arrays
/// iterator for JSON arrays
typename array_t::iterator array_iterator;
typename array_t::iterator array_iterator
= typename array_t::iterator()
;
/// generic iterator for all other types
/// generic iterator for all other types
primitive_iterator_t primitive_iterator;
primitive_iterator_t primitive_iterator = primitive_iterator_t();
// leave the union un-initialized
internal_iterator() {}
};
};
public:
public:
/// a const random access iterator for the basic_json class
/*!
@brief a const random access iterator for the @ref basic_json class
This class implements a const iterator for the @ref basic_json class. From
this class, the @ref iterator class is derived.
@requirement The class satisfies the following concept requirements:
- [RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator):
The iterator that can be moved to point (forward and backward) to any
element in constant time.
*/
class const_iterator : public std::iterator<std::random_access_iterator_tag, const basic_json>
class const_iterator : public std::iterator<std::random_access_iterator_tag, const basic_json>
{
{
//
allow basic_json class to access m_it
//
/ allow basic_json to access private members
friend class basic_json;
friend class basic_json;
public:
public:
...
@@ -5368,7 +5361,16 @@ class basic_json
...
@@ -5368,7 +5361,16 @@ class basic_json
internal_iterator m_it = internal_iterator();
internal_iterator m_it = internal_iterator();
};
};
/// a random access iterator for the basic_json class
/*!
@brief a mutable random access iterator for the @ref basic_json class
@requirement The class satisfies the following concept requirements:
- [RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator):
The iterator that can be moved to point (forward and backward) to any
element in constant time.
- [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator):
It is possible to write to the pointed-to element.
*/
class iterator : public const_iterator
class iterator : public const_iterator
{
{
public:
public:
...
@@ -5490,13 +5492,28 @@ class basic_json
...
@@ -5490,13 +5492,28 @@ class basic_json
}
}
};
};
/// a template for a reverse iterator class
/*!
@brief a template for a reverse iterator class
@tparam Base the base iterator type to reverse. Valid types are @ref
iterator (to create @ref reverse_iterator) and @ref const_iterator (to
create @ref const_reverse_iterator).
@requirement The class satisfies the following concept requirements:
- [RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator):
The iterator that can be moved to point (forward and backward) to any
element in constant time.
- [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator):
It is possible to write to the pointed-to element (only if @a Base is
@ref iterator).
*/
template<typename Base>
template<typename Base>
class json_reverse_iterator : public std::reverse_iterator<Base>
class json_reverse_iterator : public std::reverse_iterator<Base>
{
{
public:
public:
/// shortcut to the reverse iterator adaptor
/// shortcut to the reverse iterator adaptor
using base_iterator = std::reverse_iterator<Base>;
using base_iterator = std::reverse_iterator<Base>;
/// the reference type for the pointed-to element
using reference = typename Base::reference;
using reference = typename Base::reference;
/// create reverse iterator from iterator
/// create reverse iterator from iterator
...
@@ -6353,7 +6370,6 @@ namespace std
...
@@ -6353,7 +6370,6 @@ namespace std
{
{
/*!
/*!
@brief exchanges the values of two JSON objects
@brief exchanges the values of two JSON objects
@ingroup container
*/
*/
template <>
template <>
inline void swap(nlohmann::json& j1,
inline void swap(nlohmann::json& j1,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment