Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
144cf6a4
Unverified
Commit
144cf6a4
authored
Mar 05, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔨
added user-defined exceptions 310
parent
5cca44c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
20 deletions
+20
-20
src/json.hpp
src/json.hpp
+7
-7
src/json.hpp.re2c
src/json.hpp.re2c
+7
-7
test/src/unit-modifiers.cpp
test/src/unit-modifiers.cpp
+6
-6
No files found.
src/json.hpp
View file @
144cf6a4
...
@@ -5887,8 +5887,8 @@ class basic_json
...
@@ -5887,8 +5887,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; example:
@throw
type_error.310 when JSON value is not an array; example: `"cannot
`"cannot
use swap() with string"`
use swap() with string"`
@complexity Constant.
@complexity Constant.
...
@@ -5906,7 +5906,7 @@ class basic_json
...
@@ -5906,7 +5906,7 @@ class basic_json
}
}
else
else
{
{
JSON_THROW
(
std
::
domain_error
(
"cannot use swap() with "
+
type_name
()));
JSON_THROW
(
type_error
(
310
,
"cannot use swap() with "
+
type_name
()));
}
}
}
}
...
@@ -5920,7 +5920,7 @@ class basic_json
...
@@ -5920,7 +5920,7 @@ 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; example:
@throw
type_error.310
when JSON value is not an object; example:
`"cannot use swap() with string"`
`"cannot use swap() with string"`
@complexity Constant.
@complexity Constant.
...
@@ -5939,7 +5939,7 @@ class basic_json
...
@@ -5939,7 +5939,7 @@ class basic_json
}
}
else
else
{
{
JSON_THROW
(
std
::
domain_error
(
"cannot use swap() with "
+
type_name
()));
JSON_THROW
(
type_error
(
310
,
"cannot use swap() with "
+
type_name
()));
}
}
}
}
...
@@ -5953,7 +5953,7 @@ class basic_json
...
@@ -5953,7 +5953,7 @@ 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; example: `"cannot
@throw
type_error.310
when JSON value is not a string; example: `"cannot
use swap() with boolean"`
use swap() with boolean"`
@complexity Constant.
@complexity Constant.
...
@@ -5972,7 +5972,7 @@ class basic_json
...
@@ -5972,7 +5972,7 @@ class basic_json
}
}
else
else
{
{
JSON_THROW
(
std
::
domain_error
(
"cannot use swap() with "
+
type_name
()));
JSON_THROW
(
type_error
(
310
,
"cannot use swap() with "
+
type_name
()));
}
}
}
}
...
...
src/json.hpp.re2c
View file @
144cf6a4
...
@@ -5887,8 +5887,8 @@ class basic_json
...
@@ -5887,8 +5887,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; example:
@throw
type_error.310 when JSON value is not an array; example: `"cannot
`"cannot
use swap() with string"`
use swap() with string"`
@complexity Constant.
@complexity Constant.
...
@@ -5906,7 +5906,7 @@ class basic_json
...
@@ -5906,7 +5906,7 @@ class basic_json
}
}
else
else
{
{
JSON_THROW(
std::domain_error(
"cannot use swap() with " + type_name()));
JSON_THROW(
type_error(310,
"cannot use swap() with " + type_name()));
}
}
}
}
...
@@ -5920,7 +5920,7 @@ class basic_json
...
@@ -5920,7 +5920,7 @@ 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; example:
@throw
type_error.310
when JSON value is not an object; example:
`"cannot use swap() with string"`
`"cannot use swap() with string"`
@complexity Constant.
@complexity Constant.
...
@@ -5939,7 +5939,7 @@ class basic_json
...
@@ -5939,7 +5939,7 @@ class basic_json
}
}
else
else
{
{
JSON_THROW(
std::domain_error(
"cannot use swap() with " + type_name()));
JSON_THROW(
type_error(310,
"cannot use swap() with " + type_name()));
}
}
}
}
...
@@ -5953,7 +5953,7 @@ class basic_json
...
@@ -5953,7 +5953,7 @@ 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; example: `"cannot
@throw
type_error.310
when JSON value is not a string; example: `"cannot
use swap() with boolean"`
use swap() with boolean"`
@complexity Constant.
@complexity Constant.
...
@@ -5972,7 +5972,7 @@ class basic_json
...
@@ -5972,7 +5972,7 @@ class basic_json
}
}
else
else
{
{
JSON_THROW(
std::domain_error(
"cannot use swap() with " + type_name()));
JSON_THROW(
type_error(310,
"cannot use swap() with " + type_name()));
}
}
}
}
...
...
test/src/unit-modifiers.cpp
View file @
144cf6a4
...
@@ -751,8 +751,8 @@ TEST_CASE("modifiers")
...
@@ -751,8 +751,8 @@ TEST_CASE("modifiers")
json
j
=
17
;
json
j
=
17
;
json
::
array_t
a
=
{
"foo"
,
"bar"
,
"baz"
};
json
::
array_t
a
=
{
"foo"
,
"bar"
,
"baz"
};
CHECK_THROWS_AS
(
j
.
swap
(
a
),
std
::
domain
_error
);
CHECK_THROWS_AS
(
j
.
swap
(
a
),
json
::
type
_error
);
CHECK_THROWS_WITH
(
j
.
swap
(
a
),
"cannot use swap() with number"
);
CHECK_THROWS_WITH
(
j
.
swap
(
a
),
"
[json.exception.type_error.310]
cannot use swap() with number"
);
}
}
}
}
...
@@ -777,8 +777,8 @@ TEST_CASE("modifiers")
...
@@ -777,8 +777,8 @@ TEST_CASE("modifiers")
json
j
=
17
;
json
j
=
17
;
json
::
object_t
o
=
{{
"cow"
,
"Kuh"
},
{
"chicken"
,
"Huhn"
}};
json
::
object_t
o
=
{{
"cow"
,
"Kuh"
},
{
"chicken"
,
"Huhn"
}};
CHECK_THROWS_AS
(
j
.
swap
(
o
),
std
::
domain
_error
);
CHECK_THROWS_AS
(
j
.
swap
(
o
),
json
::
type
_error
);
CHECK_THROWS_WITH
(
j
.
swap
(
o
),
"cannot use swap() with number"
);
CHECK_THROWS_WITH
(
j
.
swap
(
o
),
"
[json.exception.type_error.310]
cannot use swap() with number"
);
}
}
}
}
...
@@ -803,8 +803,8 @@ TEST_CASE("modifiers")
...
@@ -803,8 +803,8 @@ TEST_CASE("modifiers")
json
j
=
17
;
json
j
=
17
;
json
::
string_t
s
=
"Hallo Welt"
;
json
::
string_t
s
=
"Hallo Welt"
;
CHECK_THROWS_AS
(
j
.
swap
(
s
),
std
::
domain
_error
);
CHECK_THROWS_AS
(
j
.
swap
(
s
),
json
::
type
_error
);
CHECK_THROWS_WITH
(
j
.
swap
(
s
),
"cannot use swap() with number"
);
CHECK_THROWS_WITH
(
j
.
swap
(
s
),
"
[json.exception.type_error.310]
cannot use swap() with number"
);
}
}
}
}
}
}
...
...
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