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
d80bbffc
Commit
d80bbffc
authored
Dec 27, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor cleanup
parent
7371c71d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
34 deletions
+58
-34
json.hpp
src/json.hpp
+29
-17
json.hpp.re2c
src/json.hpp.re2c
+29
-17
No files found.
src/json.hpp
View file @
d80bbffc
...
@@ -2457,8 +2457,8 @@ class basic_json
...
@@ -2457,8 +2457,8 @@ class basic_json
object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or @ref
object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or @ref
number_float_t.
number_float_t.
@return pointer to the internally stored JSON value if the requested
pointer
@return pointer to the internally stored JSON value if the requested
type @a PointerType fits to the JSON value; `nullptr` otherwise
pointer
type @a PointerType fits to the JSON value; `nullptr` otherwise
@complexity Constant.
@complexity Constant.
...
@@ -2508,8 +2508,8 @@ class basic_json
...
@@ -2508,8 +2508,8 @@ class basic_json
object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or @ref
object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or @ref
number_float_t.
number_float_t.
@return pointer to the internally stored JSON value if the requested
pointer
@return pointer to the internally stored JSON value if the requested
type @a PointerType fits to the JSON value; `nullptr` otherwise
pointer
type @a PointerType fits to the JSON value; `nullptr` otherwise
@complexity Constant.
@complexity Constant.
...
@@ -3897,8 +3897,7 @@ class basic_json
...
@@ -3897,8 +3897,7 @@ class basic_json
array | result of function array_t::size()
array | result of function array_t::size()
@complexity Constant, as long as @ref array_t and @ref object_t satisfy the
@complexity Constant, as long as @ref array_t and @ref object_t satisfy the
Container concept; that is, their size() functions have
Container concept; that is, their size() functions have constant complexity.
constant complexity.
@requirement This function satisfies the Container requirements:
@requirement This function satisfies the Container requirements:
- The complexity is constant.
- The complexity is constant.
...
@@ -3956,8 +3955,8 @@ class basic_json
...
@@ -3956,8 +3955,8 @@ class basic_json
array | result of function array_t::max_size()
array | result of function array_t::max_size()
@complexity Constant, as long as @ref array_t and @ref object_t satisfy the
@complexity Constant, as long as @ref array_t and @ref object_t satisfy the
Container concept; that is, their max_size() functions have
Container concept; that is, their max_size() functions have constant
constant
complexity.
complexity.
@requirement This function satisfies the Container requirements:
@requirement This function satisfies the Container requirements:
- The complexity is constant.
- The complexity is constant.
...
@@ -4216,7 +4215,8 @@ class basic_json
...
@@ -4216,7 +4215,8 @@ class basic_json
@param[in] val element to insert
@param[in] val element to insert
@return iterator pointing to the inserted @a val.
@return iterator pointing to the inserted @a val.
@throw std::domain_error if called on JSON values other than arrays
@throw std::domain_error if called on JSON values other than arrays;
example: `"cannot use insert() with string"`
@throw std::domain_error if @a pos is not an iterator of *this; example:
@throw std::domain_error if @a pos is not an iterator of *this; example:
`"iterator does not fit current value"`
`"iterator does not fit current value"`
...
@@ -4270,7 +4270,8 @@ class basic_json
...
@@ -4270,7 +4270,8 @@ class basic_json
@return iterator pointing to the first element inserted, or @a pos if
@return iterator pointing to the first element inserted, or @a pos if
`cnt==0`
`cnt==0`
@throw std::domain_error if called on JSON values other than arrays
@throw std::domain_error if called on JSON values other than arrays;
example: `"cannot use insert() with string"`
@throw std::domain_error if @a pos is not an iterator of *this; example:
@throw std::domain_error if @a pos is not an iterator of *this; example:
`"iterator does not fit current value"`
`"iterator does not fit current value"`
...
@@ -4313,7 +4314,8 @@ class basic_json
...
@@ -4313,7 +4314,8 @@ class basic_json
@param[in] first begin of the range of elements to insert
@param[in] first begin of the range of elements to insert
@param[in] last end of the range of elements to insert
@param[in] last end of the range of elements to insert
@throw std::domain_error if called on JSON values other than arrays
@throw std::domain_error if called on JSON values other than arrays;
example: `"cannot use insert() with string"`
@throw std::domain_error if @a pos is not an iterator of *this; example:
@throw std::domain_error if @a pos is not an iterator of *this; example:
`"iterator does not fit current value"`
`"iterator does not fit current value"`
@throw std::domain_error if @a first and @a last do not belong to the same
@throw std::domain_error if @a first and @a last do not belong to the same
...
@@ -4374,9 +4376,11 @@ class basic_json
...
@@ -4374,9 +4376,11 @@ class basic_json
the end() iterator
the end() iterator
@param[in] ilist initializer list to insert the values from
@param[in] ilist initializer list to insert the values from
@throw std::domain_error if called on JSON values other than arrays
@throw std::domain_error if called on JSON values other than arrays;
example: `"cannot use insert() with string"`
@throw std::domain_error if @a pos is not an iterator of *this; example:
@throw std::domain_error if @a pos is not an iterator of *this; example:
`"iterator does not fit current value"`
`"iterator does not fit current value"`
@return iterator pointing to the first element inserted, or @a pos if
@return iterator pointing to the first element inserted, or @a pos if
`ilist` is empty
`ilist` is empty
...
@@ -4445,7 +4449,8 @@ class basic_json
...
@@ -4445,7 +4449,8 @@ class basic_json
@param[in,out] other array to exchange the contents with
@param[in,out] other array to exchange the contents with
@throw std::domain_error when JSON value is not an array
@throw std::domain_error when JSON value is not an array; example: `"cannot
use swap() with string"`
@complexity Constant.
@complexity Constant.
...
@@ -4477,7 +4482,8 @@ class basic_json
...
@@ -4477,7 +4482,8 @@ class basic_json
@param[in,out] other object to exchange the contents with
@param[in,out] other object to exchange the contents with
@throw std::domain_error when JSON value is not an object
@throw std::domain_error when JSON value is not an object; example:
`"cannot use swap() with string"`
@complexity Constant.
@complexity Constant.
...
@@ -4509,7 +4515,8 @@ class basic_json
...
@@ -4509,7 +4515,8 @@ class basic_json
@param[in,out] other string to exchange the contents with
@param[in,out] other string to exchange the contents with
@throw std::domain_error when JSON value is not a string
@throw std::domain_error when JSON value is not a string; example: `"cannot
use swap() with boolean"`
@complexity Constant.
@complexity Constant.
...
@@ -6349,6 +6356,8 @@ class basic_json
...
@@ -6349,6 +6356,8 @@ class basic_json
m_start
=
m_cursor
=
m_content
;
m_start
=
m_cursor
=
m_content
;
m_limit
=
m_content
+
s
.
size
();
m_limit
=
m_content
+
s
.
size
();
}
}
/// constructor with a given stream
explicit
lexer
(
std
::
istream
*
s
)
noexcept
explicit
lexer
(
std
::
istream
*
s
)
noexcept
:
m_stream
(
s
),
m_buffer
()
:
m_stream
(
s
),
m_buffer
()
{
{
...
@@ -6361,7 +6370,7 @@ class basic_json
...
@@ -6361,7 +6370,7 @@ class basic_json
/// default constructor
/// default constructor
lexer
()
=
default
;
lexer
()
=
default
;
// switch of unwanted functions
// switch of
f
unwanted functions
lexer
(
const
lexer
&
)
=
delete
;
lexer
(
const
lexer
&
)
=
delete
;
lexer
operator
=
(
const
lexer
&
)
=
delete
;
lexer
operator
=
(
const
lexer
&
)
=
delete
;
...
@@ -6370,10 +6379,13 @@ class basic_json
...
@@ -6370,10 +6379,13 @@ class basic_json
@param[in] codepoint1 the code point (can be high surrogate)
@param[in] codepoint1 the code point (can be high surrogate)
@param[in] codepoint2 the code point (can be low surrogate or 0)
@param[in] codepoint2 the code point (can be low surrogate or 0)
@return string representation of the code point
@return string representation of the code point
@throw std::out_of_range if code point is >0x10ffff; example: `"code
@throw std::out_of_range if code point is >0x10ffff; example: `"code
points above 0x10FFFF are invalid"`
points above 0x10FFFF are invalid"`
@throw std::invalid_argument if the low surrogate is invalid
@throw std::invalid_argument if the low surrogate is invalid; example:
`""missing or wrong low surrogate""`
@see <http://en.wikipedia.org/wiki/UTF-8#Sample_code>
@see <http://en.wikipedia.org/wiki/UTF-8#Sample_code>
*/
*/
...
...
src/json.hpp.re2c
View file @
d80bbffc
...
@@ -2457,8 +2457,8 @@ class basic_json
...
@@ -2457,8 +2457,8 @@ class basic_json
object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or @ref
object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or @ref
number_float_t.
number_float_t.
@return pointer to the internally stored JSON value if the requested
pointer
@return pointer to the internally stored JSON value if the requested
type @a PointerType fits to the JSON value; `nullptr` otherwise
pointer
type @a PointerType fits to the JSON value; `nullptr` otherwise
@complexity Constant.
@complexity Constant.
...
@@ -2508,8 +2508,8 @@ class basic_json
...
@@ -2508,8 +2508,8 @@ class basic_json
object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or @ref
object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or @ref
number_float_t.
number_float_t.
@return pointer to the internally stored JSON value if the requested
pointer
@return pointer to the internally stored JSON value if the requested
type @a PointerType fits to the JSON value; `nullptr` otherwise
pointer
type @a PointerType fits to the JSON value; `nullptr` otherwise
@complexity Constant.
@complexity Constant.
...
@@ -3897,8 +3897,7 @@ class basic_json
...
@@ -3897,8 +3897,7 @@ class basic_json
array | result of function array_t::size()
array | result of function array_t::size()
@complexity Constant, as long as @ref array_t and @ref object_t satisfy the
@complexity Constant, as long as @ref array_t and @ref object_t satisfy the
Container concept; that is, their size() functions have
Container concept; that is, their size() functions have constant complexity.
constant complexity.
@requirement This function satisfies the Container requirements:
@requirement This function satisfies the Container requirements:
- The complexity is constant.
- The complexity is constant.
...
@@ -3956,8 +3955,8 @@ class basic_json
...
@@ -3956,8 +3955,8 @@ class basic_json
array | result of function array_t::max_size()
array | result of function array_t::max_size()
@complexity Constant, as long as @ref array_t and @ref object_t satisfy the
@complexity Constant, as long as @ref array_t and @ref object_t satisfy the
Container concept; that is, their max_size() functions have
Container concept; that is, their max_size() functions have constant
constant
complexity.
complexity.
@requirement This function satisfies the Container requirements:
@requirement This function satisfies the Container requirements:
- The complexity is constant.
- The complexity is constant.
...
@@ -4216,7 +4215,8 @@ class basic_json
...
@@ -4216,7 +4215,8 @@ class basic_json
@param[in] val element to insert
@param[in] val element to insert
@return iterator pointing to the inserted @a val.
@return iterator pointing to the inserted @a val.
@throw std::domain_error if called on JSON values other than arrays
@throw std::domain_error if called on JSON values other than arrays;
example: `"cannot use insert() with string"`
@throw std::domain_error if @a pos is not an iterator of *this; example:
@throw std::domain_error if @a pos is not an iterator of *this; example:
`"iterator does not fit current value"`
`"iterator does not fit current value"`
...
@@ -4270,7 +4270,8 @@ class basic_json
...
@@ -4270,7 +4270,8 @@ class basic_json
@return iterator pointing to the first element inserted, or @a pos if
@return iterator pointing to the first element inserted, or @a pos if
`cnt==0`
`cnt==0`
@throw std::domain_error if called on JSON values other than arrays
@throw std::domain_error if called on JSON values other than arrays;
example: `"cannot use insert() with string"`
@throw std::domain_error if @a pos is not an iterator of *this; example:
@throw std::domain_error if @a pos is not an iterator of *this; example:
`"iterator does not fit current value"`
`"iterator does not fit current value"`
...
@@ -4313,7 +4314,8 @@ class basic_json
...
@@ -4313,7 +4314,8 @@ class basic_json
@param[in] first begin of the range of elements to insert
@param[in] first begin of the range of elements to insert
@param[in] last end of the range of elements to insert
@param[in] last end of the range of elements to insert
@throw std::domain_error if called on JSON values other than arrays
@throw std::domain_error if called on JSON values other than arrays;
example: `"cannot use insert() with string"`
@throw std::domain_error if @a pos is not an iterator of *this; example:
@throw std::domain_error if @a pos is not an iterator of *this; example:
`"iterator does not fit current value"`
`"iterator does not fit current value"`
@throw std::domain_error if @a first and @a last do not belong to the same
@throw std::domain_error if @a first and @a last do not belong to the same
...
@@ -4374,9 +4376,11 @@ class basic_json
...
@@ -4374,9 +4376,11 @@ class basic_json
the end() iterator
the end() iterator
@param[in] ilist initializer list to insert the values from
@param[in] ilist initializer list to insert the values from
@throw std::domain_error if called on JSON values other than arrays
@throw std::domain_error if called on JSON values other than arrays;
example: `"cannot use insert() with string"`
@throw std::domain_error if @a pos is not an iterator of *this; example:
@throw std::domain_error if @a pos is not an iterator of *this; example:
`"iterator does not fit current value"`
`"iterator does not fit current value"`
@return iterator pointing to the first element inserted, or @a pos if
@return iterator pointing to the first element inserted, or @a pos if
`ilist` is empty
`ilist` is empty
...
@@ -4445,7 +4449,8 @@ class basic_json
...
@@ -4445,7 +4449,8 @@ class basic_json
@param[in,out] other array to exchange the contents with
@param[in,out] other array to exchange the contents with
@throw std::domain_error when JSON value is not an array
@throw std::domain_error when JSON value is not an array; example: `"cannot
use swap() with string"`
@complexity Constant.
@complexity Constant.
...
@@ -4477,7 +4482,8 @@ class basic_json
...
@@ -4477,7 +4482,8 @@ class basic_json
@param[in,out] other object to exchange the contents with
@param[in,out] other object to exchange the contents with
@throw std::domain_error when JSON value is not an object
@throw std::domain_error when JSON value is not an object; example:
`"cannot use swap() with string"`
@complexity Constant.
@complexity Constant.
...
@@ -4509,7 +4515,8 @@ class basic_json
...
@@ -4509,7 +4515,8 @@ class basic_json
@param[in,out] other string to exchange the contents with
@param[in,out] other string to exchange the contents with
@throw std::domain_error when JSON value is not a string
@throw std::domain_error when JSON value is not a string; example: `"cannot
use swap() with boolean"`
@complexity Constant.
@complexity Constant.
...
@@ -6349,6 +6356,8 @@ class basic_json
...
@@ -6349,6 +6356,8 @@ class basic_json
m_start = m_cursor = m_content;
m_start = m_cursor = m_content;
m_limit = m_content + s.size();
m_limit = m_content + s.size();
}
}
/// constructor with a given stream
explicit lexer(std::istream* s) noexcept
explicit lexer(std::istream* s) noexcept
: m_stream(s), m_buffer()
: m_stream(s), m_buffer()
{
{
...
@@ -6361,7 +6370,7 @@ class basic_json
...
@@ -6361,7 +6370,7 @@ class basic_json
/// default constructor
/// default constructor
lexer() = default;
lexer() = default;
// switch of unwanted functions
// switch of
f
unwanted functions
lexer(const lexer&) = delete;
lexer(const lexer&) = delete;
lexer operator=(const lexer&) = delete;
lexer operator=(const lexer&) = delete;
...
@@ -6370,10 +6379,13 @@ class basic_json
...
@@ -6370,10 +6379,13 @@ class basic_json
@param[in] codepoint1 the code point (can be high surrogate)
@param[in] codepoint1 the code point (can be high surrogate)
@param[in] codepoint2 the code point (can be low surrogate or 0)
@param[in] codepoint2 the code point (can be low surrogate or 0)
@return string representation of the code point
@return string representation of the code point
@throw std::out_of_range if code point is >0x10ffff; example: `"code
@throw std::out_of_range if code point is >0x10ffff; example: `"code
points above 0x10FFFF are invalid"`
points above 0x10FFFF are invalid"`
@throw std::invalid_argument if the low surrogate is invalid
@throw std::invalid_argument if the low surrogate is invalid; example:
`""missing or wrong low surrogate""`
@see <http://en.wikipedia.org/wiki/UTF-8#Sample_code>
@see <http://en.wikipedia.org/wiki/UTF-8#Sample_code>
*/
*/
...
...
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