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
1ab580d6
Unverified
Commit
1ab580d6
authored
Mar 08, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
📝
more documentation for the new exceptions
parent
fe71e7df
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
47 additions
and
12 deletions
+47
-12
Makefile
doc/Makefile
+2
-0
at__size_type_const.cpp
doc/examples/at__size_type_const.cpp
+2
-2
at__size_type_const.link
doc/examples/at__size_type_const.link
+2
-2
at__size_type_const.output
doc/examples/at__size_type_const.output
+1
-1
basic_json__InputIt_InputIt.cpp
doc/examples/basic_json__InputIt_InputIt.cpp
+10
-0
basic_json__InputIt_InputIt.link
doc/examples/basic_json__InputIt_InputIt.link
+2
-2
basic_json__InputIt_InputIt.output
doc/examples/basic_json__InputIt_InputIt.output
+1
-0
object.cpp
doc/examples/object.cpp
+11
-1
object.link
doc/examples/object.link
+2
-2
object.output
doc/examples/object.output
+1
-0
operator__ValueType.cpp
doc/examples/operator__ValueType.cpp
+10
-0
operator__ValueType.link
doc/examples/operator__ValueType.link
+2
-2
operator__ValueType.output
doc/examples/operator__ValueType.output
+1
-0
json.hpp
src/json.hpp
+0
-0
json.hpp.re2c
src/json.hpp.re2c
+0
-0
No files found.
doc/Makefile
View file @
1ab580d6
...
@@ -59,6 +59,8 @@ doxygen: create_output create_links
...
@@ -59,6 +59,8 @@ doxygen: create_output create_links
$(SED)
-i
's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >@@g'
html/
*
.html
$(SED)
-i
's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >@@g'
html/
*
.html
$(SED)
-i
's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType JSONSerializer >@@g'
html/
*
.html
$(SED)
-i
's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType JSONSerializer >@@g'
html/
*
.html
$(SED)
-i
's@template<template< typename U, typename V, typename... Args > class ObjectType = std::map, template< typename U, typename... Args > class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = std::int64_t, class NumberUnsignedType = std::uint64_t, class NumberFloatType = double, template< typename U > class AllocatorType = std::allocator, template< typename T, typename SFINAE=void > class JSONSerializer = adl_serializer>@@g'
html/
*
.html
$(SED)
-i
's@template<template< typename U, typename V, typename... Args > class ObjectType = std::map, template< typename U, typename... Args > class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = std::int64_t, class NumberUnsignedType = std::uint64_t, class NumberFloatType = double, template< typename U > class AllocatorType = std::allocator, template< typename T, typename SFINAE=void > class JSONSerializer = adl_serializer>@@g'
html/
*
.html
$(SED)
-i
's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >@@g'
html/
*
.html
$(SED)
-i
's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >@@g'
html/
*
.html
upload
:
clean doxygen check_output
upload
:
clean doxygen check_output
cd
html
;
../scripts/git-update-ghpages nlohmann/json
cd
html
;
../scripts/git-update-ghpages nlohmann/json
...
...
doc/examples/at__size_type_const.cpp
View file @
1ab580d6
...
@@ -15,8 +15,8 @@ int main()
...
@@ -15,8 +15,8 @@ int main()
{
{
std
::
cout
<<
array
.
at
(
5
)
<<
'\n'
;
std
::
cout
<<
array
.
at
(
5
)
<<
'\n'
;
}
}
catch
(
json
::
out_of_rang
e
)
catch
(
const
json
::
out_of_range
&
e
)
{
{
std
::
cout
<<
"out of range"
<<
'\n'
;
std
::
cout
<<
e
.
what
()
<<
'\n'
;
}
}
}
}
doc/examples/at__size_type_const.link
View file @
1ab580d6
<a target="_blank" href="http://melpon.org/wandbox/permlink/ZiPo8P49B2Cc8B85"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/L70DHUpUzdDQtLgZ"><b>online</b></a>
\ No newline at end of file
\ No newline at end of file
doc/examples/at__size_type_const.output
View file @
1ab580d6
"third"
"third"
out of range
[json.exception.out_of_range.401] array index 5 is
out of range
doc/examples/basic_json__InputIt_InputIt.cpp
View file @
1ab580d6
...
@@ -18,4 +18,14 @@ int main()
...
@@ -18,4 +18,14 @@ int main()
std
::
cout
<<
j_array_range
<<
'\n'
;
std
::
cout
<<
j_array_range
<<
'\n'
;
std
::
cout
<<
j_number_range
<<
'\n'
;
std
::
cout
<<
j_number_range
<<
'\n'
;
std
::
cout
<<
j_object_range
<<
'\n'
;
std
::
cout
<<
j_object_range
<<
'\n'
;
// example for an exception
try
{
json
j_invalid
(
j_number
.
begin
()
+
1
,
j_number
.
end
());
}
catch
(
json
::
invalid_iterator
&
e
)
{
std
::
cout
<<
e
.
what
()
<<
'\n'
;
}
}
}
doc/examples/basic_json__InputIt_InputIt.link
View file @
1ab580d6
<a target="_blank" href="http://melpon.org/wandbox/permlink/nKF1QcieoCHm6Lez"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/oUU2X0pbZq7gawRB"><b>online</b></a>
\ No newline at end of file
\ No newline at end of file
doc/examples/basic_json__InputIt_InputIt.output
View file @
1ab580d6
["bravo","charly"]
["bravo","charly"]
42
42
{"one":"eins"}
{"one":"eins"}
[json.exception.invalid_iterator.204] iterators out of range
doc/examples/object.cpp
View file @
1ab580d6
...
@@ -8,10 +8,20 @@ int main()
...
@@ -8,10 +8,20 @@ int main()
json
j_no_init_list
=
json
::
object
();
json
j_no_init_list
=
json
::
object
();
json
j_empty_init_list
=
json
::
object
({});
json
j_empty_init_list
=
json
::
object
({});
json
j_list_of_pairs
=
json
::
object
({
{
"one"
,
1
},
{
"two"
,
2
}
});
json
j_list_of_pairs
=
json
::
object
({
{
"one"
,
1
},
{
"two"
,
2
}
});
//json j_invalid_list = json::object({ "one", 1 }); // would throw
// serialize the JSON objects
// serialize the JSON objects
std
::
cout
<<
j_no_init_list
<<
'\n'
;
std
::
cout
<<
j_no_init_list
<<
'\n'
;
std
::
cout
<<
j_empty_init_list
<<
'\n'
;
std
::
cout
<<
j_empty_init_list
<<
'\n'
;
std
::
cout
<<
j_list_of_pairs
<<
'\n'
;
std
::
cout
<<
j_list_of_pairs
<<
'\n'
;
// example for an exception
try
{
// can only create an object from a list of pairs
json
j_invalid_object
=
json
::
object
({{
"one"
,
1
,
2
}});
}
catch
(
json
::
type_error
&
e
)
{
std
::
cout
<<
e
.
what
()
<<
'\n'
;
}
}
}
doc/examples/object.link
View file @
1ab580d6
<a target="_blank" href="http://melpon.org/wandbox/permlink/hhxRaUctq3FA54SW"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/Ub9U5AMbng3oZiao"><b>online</b></a>
\ No newline at end of file
\ No newline at end of file
doc/examples/object.output
View file @
1ab580d6
{}
{}
{}
{}
{"one":1,"two":2}
{"one":1,"two":2}
[json.exception.type_error.301] cannot create object from initializer list
doc/examples/operator__ValueType.cpp
View file @
1ab580d6
...
@@ -46,4 +46,14 @@ int main()
...
@@ -46,4 +46,14 @@ int main()
{
{
std
::
cout
<<
i
.
first
<<
": "
<<
i
.
second
<<
'\n'
;
std
::
cout
<<
i
.
first
<<
": "
<<
i
.
second
<<
'\n'
;
}
}
// example for an exception
try
{
bool
v1
=
json_types
[
"string"
];
}
catch
(
json
::
type_error
&
e
)
{
std
::
cout
<<
e
.
what
()
<<
'\n'
;
}
}
}
doc/examples/operator__ValueType.link
View file @
1ab580d6
<a target="_blank" href="http://melpon.org/wandbox/permlink/rUGX6AaVuZfwiiYI"><b>online</b></a>
<a target="_blank" href="http://melpon.org/wandbox/permlink/drFSKFXJd8IMzMK3"><b>online</b></a>
\ No newline at end of file
\ No newline at end of file
doc/examples/operator__ValueType.output
View file @
1ab580d6
...
@@ -9,3 +9,4 @@ number: {"floating-point":17.23,"integer":42}
...
@@ -9,3 +9,4 @@ number: {"floating-point":17.23,"integer":42}
null: null
null: null
boolean: true
boolean: true
array: [1,2,3,4,5]
array: [1,2,3,4,5]
[json.exception.type_error.302] type must be boolean, but is string
src/json.hpp
View file @
1ab580d6
This diff is collapsed.
Click to expand it.
src/json.hpp.re2c
View file @
1ab580d6
This diff is collapsed.
Click to expand it.
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