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
fcba9ec5
Unverified
Commit
fcba9ec5
authored
Sep 10, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔨
clean up
parent
b21d7810
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
27 deletions
+115
-27
src/json.hpp
src/json.hpp
+6
-26
test/src/unit-deserialization.cpp
test/src/unit-deserialization.cpp
+1
-1
test/src/unit-iterators1.cpp
test/src/unit-iterators1.cpp
+108
-0
No files found.
src/json.hpp
View file @
fcba9ec5
...
...
@@ -3501,23 +3501,18 @@ class primitive_iterator_t
/// return whether the iterator can be dereferenced
constexpr
bool
is_begin
()
const
noexcept
{
return
(
m_it
==
begin_value
)
;
return
m_it
==
begin_value
;
}
/// return whether the iterator is at end
constexpr
bool
is_end
()
const
noexcept
{
return
(
m_it
==
end_value
)
;
return
m_it
==
end_value
;
}
friend
constexpr
bool
operator
==
(
primitive_iterator_t
lhs
,
primitive_iterator_t
rhs
)
noexcept
{
return
(
lhs
.
m_it
==
rhs
.
m_it
);
}
friend
constexpr
bool
operator
!=
(
primitive_iterator_t
lhs
,
primitive_iterator_t
rhs
)
noexcept
{
return
not
(
lhs
==
rhs
);
return
lhs
.
m_it
==
rhs
.
m_it
;
}
friend
constexpr
bool
operator
<
(
primitive_iterator_t
lhs
,
primitive_iterator_t
rhs
)
noexcept
...
...
@@ -3525,21 +3520,6 @@ class primitive_iterator_t
return
lhs
.
m_it
<
rhs
.
m_it
;
}
friend
constexpr
bool
operator
<=
(
primitive_iterator_t
lhs
,
primitive_iterator_t
rhs
)
noexcept
{
return
lhs
.
m_it
<=
rhs
.
m_it
;
}
friend
constexpr
bool
operator
>
(
primitive_iterator_t
lhs
,
primitive_iterator_t
rhs
)
noexcept
{
return
lhs
.
m_it
>
rhs
.
m_it
;
}
friend
constexpr
bool
operator
>=
(
primitive_iterator_t
lhs
,
primitive_iterator_t
rhs
)
noexcept
{
return
lhs
.
m_it
>=
rhs
.
m_it
;
}
primitive_iterator_t
operator
+
(
difference_type
i
)
{
auto
result
=
*
this
;
...
...
@@ -3600,7 +3580,7 @@ class primitive_iterator_t
static
constexpr
difference_type
end_value
=
begin_value
+
1
;
/// iterator as signed integer type
difference_type
m_it
=
std
::
numeric_limits
<
std
::
ptrdiff_t
>::
denorm_
min
();
difference_type
m_it
=
std
::
numeric_limits
<
std
::
ptrdiff_t
>::
min
();
};
/*!
...
...
@@ -9049,7 +9029,7 @@ class basic_json
@liveexample{The following code exemplifies `type()` for all JSON
types.,type}
@sa @ref operator value_t() -- return the type of the JSON value (implicit)
@sa @ref operator value_t() -- return the type of the JSON value (implicit)
@sa @ref type_name() -- return the type as string
@since version 1.0.0
...
...
@@ -13090,7 +13070,7 @@ class basic_json
types.,type_name}
@sa @ref type() -- return the type of the JSON value
@sa @ref operator value_t() -- return the type of the JSON value (implicit)
@sa @ref operator value_t() -- return the type of the JSON value (implicit)
@since version 1.0.0, public since 2.1.0, `const char*` and `noexcept`
since 3.0.0
...
...
test/src/unit-deserialization.cpp
View file @
fcba9ec5
...
...
@@ -324,7 +324,7 @@ TEST_CASE("deserialization")
uint8_t
v
[]
=
{
'\"'
,
0x7F
,
0xDF
,
0x7F
};
CHECK_THROWS_AS
(
json
::
parse
(
std
::
begin
(
v
),
std
::
end
(
v
)),
json
::
parse_error
&
);
CHECK_THROWS_WITH
(
json
::
parse
(
std
::
begin
(
v
),
std
::
end
(
v
)),
"[json.exception.parse_error.101] parse error at 4: syntax error - invalid string: ill-formed UTF-8 byte; last read: '
\"\x7f\xdf\x7f
'"
);
"[json.exception.parse_error.101] parse error at 4: syntax error - invalid string: ill-formed UTF-8 byte; last read: '
\"\x7f\xdf\x7f
'"
);
CHECK
(
not
json
::
accept
(
std
::
begin
(
v
),
std
::
end
(
v
)));
json
j_error
;
...
...
test/src/unit-iterators1.cpp
View file @
fcba9ec5
...
...
@@ -225,6 +225,114 @@ TEST_CASE("iterators 1")
CHECK
(
*
it
==
j_const
);
}
SECTION
(
"additional tests"
)
{
SECTION
(
"!(begin != begin)"
)
{
CHECK
(
not
(
j
.
begin
()
!=
j
.
begin
()));
}
SECTION
(
"!(end != end)"
)
{
CHECK
(
not
(
j
.
end
()
!=
j
.
end
()));
}
SECTION
(
"begin < end"
)
{
CHECK
(
j
.
begin
()
<
j
.
end
());
}
SECTION
(
"begin <= end"
)
{
CHECK
(
j
.
begin
()
<=
j
.
end
());
}
SECTION
(
"end > begin"
)
{
CHECK
(
j
.
end
()
>
j
.
begin
());
}
SECTION
(
"end >= begin"
)
{
CHECK
(
j
.
end
()
>=
j
.
begin
());
}
SECTION
(
"end == end"
)
{
CHECK
(
j
.
end
()
==
j
.
end
());
}
SECTION
(
"end <= end"
)
{
CHECK
(
j
.
end
()
<=
j
.
end
());
}
SECTION
(
"begin == begin"
)
{
CHECK
(
j
.
begin
()
==
j
.
begin
());
}
SECTION
(
"begin <= begin"
)
{
CHECK
(
j
.
begin
()
<=
j
.
begin
());
}
SECTION
(
"begin >= begin"
)
{
CHECK
(
j
.
begin
()
>=
j
.
begin
());
}
SECTION
(
"!(begin == end)"
)
{
CHECK
(
not
(
j
.
begin
()
==
j
.
end
()));
}
SECTION
(
"begin != end"
)
{
CHECK
(
j
.
begin
()
!=
j
.
end
());
}
SECTION
(
"begin+1 == end"
)
{
CHECK
(
j
.
begin
()
+
1
==
j
.
end
());
}
SECTION
(
"begin == end-1"
)
{
CHECK
(
j
.
begin
()
==
j
.
end
()
-
1
);
}
SECTION
(
"begin != end+1"
)
{
CHECK
(
j
.
begin
()
!=
j
.
end
()
+
1
);
}
SECTION
(
"end != end+1"
)
{
CHECK
(
j
.
end
()
!=
j
.
end
()
+
1
);
}
SECTION
(
"begin+1 != begin+2"
)
{
CHECK
(
j
.
begin
()
+
1
!=
j
.
begin
()
+
2
);
}
SECTION
(
"begin+1 < begin+2"
)
{
CHECK
(
j
.
begin
()
+
1
<
j
.
begin
()
+
2
);
}
SECTION
(
"begin+1 <= begin+2"
)
{
CHECK
(
j
.
begin
()
+
1
<=
j
.
begin
()
+
2
);
}
SECTION
(
"end+1 != end+2"
)
{
CHECK
(
j
.
end
()
+
1
!=
j
.
end
()
+
2
);
}
}
SECTION
(
"key/value"
)
{
auto
it
=
j
.
begin
();
...
...
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