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
024fec8a
Unverified
Commit
024fec8a
authored
Jul 21, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔨
more cleanup using clang-tidy
parent
a09193e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
21 deletions
+17
-21
json.hpp
src/json.hpp
+17
-21
No files found.
src/json.hpp
View file @
024fec8a
...
@@ -1065,7 +1065,7 @@ void from_json(const BasicJsonType& j, std::forward_list<T, Allocator>& l)
...
@@ -1065,7 +1065,7 @@ void from_json(const BasicJsonType& j, std::forward_list<T, Allocator>& l)
}
}
template
<
typename
BasicJsonType
,
typename
CompatibleArrayType
>
template
<
typename
BasicJsonType
,
typename
CompatibleArrayType
>
void
from_json_array_impl
(
const
BasicJsonType
&
j
,
CompatibleArrayType
&
arr
,
priority_tag
<
0
>
)
void
from_json_array_impl
(
const
BasicJsonType
&
j
,
CompatibleArrayType
&
arr
,
priority_tag
<
0
>
/*unused*/
)
{
{
using
std
::
begin
;
using
std
::
begin
;
using
std
::
end
;
using
std
::
end
;
...
@@ -1080,7 +1080,7 @@ void from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, prio
...
@@ -1080,7 +1080,7 @@ void from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, prio
}
}
template
<
typename
BasicJsonType
,
typename
CompatibleArrayType
>
template
<
typename
BasicJsonType
,
typename
CompatibleArrayType
>
auto
from_json_array_impl
(
const
BasicJsonType
&
j
,
CompatibleArrayType
&
arr
,
priority_tag
<
1
>
)
auto
from_json_array_impl
(
const
BasicJsonType
&
j
,
CompatibleArrayType
&
arr
,
priority_tag
<
1
>
/*unused*/
)
->
decltype
(
->
decltype
(
arr
.
reserve
(
std
::
declval
<
typename
CompatibleArrayType
::
size_type
>
()),
arr
.
reserve
(
std
::
declval
<
typename
CompatibleArrayType
::
size_type
>
()),
void
())
void
())
...
@@ -1099,7 +1099,7 @@ auto from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, prio
...
@@ -1099,7 +1099,7 @@ auto from_json_array_impl(const BasicJsonType& j, CompatibleArrayType& arr, prio
}
}
template
<
typename
BasicJsonType
,
typename
T
,
std
::
size_t
N
>
template
<
typename
BasicJsonType
,
typename
T
,
std
::
size_t
N
>
void
from_json_array_impl
(
const
BasicJsonType
&
j
,
std
::
array
<
T
,
N
>&
arr
,
priority_tag
<
2
>
)
void
from_json_array_impl
(
const
BasicJsonType
&
j
,
std
::
array
<
T
,
N
>&
arr
,
priority_tag
<
2
>
/*unused*/
)
{
{
for
(
std
::
size_t
i
=
0
;
i
<
N
;
++
i
)
for
(
std
::
size_t
i
=
0
;
i
<
N
;
++
i
)
{
{
...
@@ -1211,14 +1211,14 @@ struct to_json_fn
...
@@ -1211,14 +1211,14 @@ struct to_json_fn
{
{
private
:
private
:
template
<
typename
BasicJsonType
,
typename
T
>
template
<
typename
BasicJsonType
,
typename
T
>
auto
call
(
BasicJsonType
&
j
,
T
&&
val
,
priority_tag
<
1
>
)
const
noexcept
(
noexcept
(
to_json
(
j
,
std
::
forward
<
T
>
(
val
))))
auto
call
(
BasicJsonType
&
j
,
T
&&
val
,
priority_tag
<
1
>
/*unused*/
)
const
noexcept
(
noexcept
(
to_json
(
j
,
std
::
forward
<
T
>
(
val
))))
->
decltype
(
to_json
(
j
,
std
::
forward
<
T
>
(
val
)),
void
())
->
decltype
(
to_json
(
j
,
std
::
forward
<
T
>
(
val
)),
void
())
{
{
return
to_json
(
j
,
std
::
forward
<
T
>
(
val
));
return
to_json
(
j
,
std
::
forward
<
T
>
(
val
));
}
}
template
<
typename
BasicJsonType
,
typename
T
>
template
<
typename
BasicJsonType
,
typename
T
>
void
call
(
BasicJsonType
&
,
T
&&
,
priority_tag
<
0
>
)
const
noexcept
void
call
(
BasicJsonType
&
/*unused*/
,
T
&&
/*unused*/
,
priority_tag
<
0
>
/*unused*/
)
const
noexcept
{
{
static_assert
(
sizeof
(
BasicJsonType
)
==
0
,
static_assert
(
sizeof
(
BasicJsonType
)
==
0
,
"could not find to_json() method in T's namespace"
);
"could not find to_json() method in T's namespace"
);
...
@@ -1237,7 +1237,7 @@ struct from_json_fn
...
@@ -1237,7 +1237,7 @@ struct from_json_fn
{
{
private
:
private
:
template
<
typename
BasicJsonType
,
typename
T
>
template
<
typename
BasicJsonType
,
typename
T
>
auto
call
(
const
BasicJsonType
&
j
,
T
&
val
,
priority_tag
<
1
>
)
const
auto
call
(
const
BasicJsonType
&
j
,
T
&
val
,
priority_tag
<
1
>
/*unused*/
)
const
noexcept
(
noexcept
(
from_json
(
j
,
val
)))
noexcept
(
noexcept
(
from_json
(
j
,
val
)))
->
decltype
(
from_json
(
j
,
val
),
void
())
->
decltype
(
from_json
(
j
,
val
),
void
())
{
{
...
@@ -1245,7 +1245,7 @@ struct from_json_fn
...
@@ -1245,7 +1245,7 @@ struct from_json_fn
}
}
template
<
typename
BasicJsonType
,
typename
T
>
template
<
typename
BasicJsonType
,
typename
T
>
void
call
(
const
BasicJsonType
&
,
T
&
,
priority_tag
<
0
>
)
const
noexcept
void
call
(
const
BasicJsonType
&
/*unused*/
,
T
&
/*unused*/
,
priority_tag
<
0
>
/*unused*/
)
const
noexcept
{
{
static_assert
(
sizeof
(
BasicJsonType
)
==
0
,
static_assert
(
sizeof
(
BasicJsonType
)
==
0
,
"could not find from_json() method in T's namespace"
);
"could not find from_json() method in T's namespace"
);
...
@@ -3727,16 +3727,14 @@ https://github.com/nlohmann/json/pull/105.
...
@@ -3727,16 +3727,14 @@ https://github.com/nlohmann/json/pull/105.
template
<
typename
BasicJsonType
>
struct
internal_iterator
template
<
typename
BasicJsonType
>
struct
internal_iterator
{
{
/// iterator for JSON objects
/// iterator for JSON objects
typename
BasicJsonType
::
object_t
::
iterator
object_iterator
;
typename
BasicJsonType
::
object_t
::
iterator
object_iterator
{}
;
/// iterator for JSON arrays
/// iterator for JSON arrays
typename
BasicJsonType
::
array_t
::
iterator
array_iterator
;
typename
BasicJsonType
::
array_t
::
iterator
array_iterator
{}
;
/// generic iterator for all other types
/// generic iterator for all other types
primitive_iterator_t
primitive_iterator
;
primitive_iterator_t
primitive_iterator
{}
;
/// create an uninitialized internal_iterator
/// create an uninitialized internal_iterator
internal_iterator
()
noexcept
internal_iterator
()
=
default
;
:
object_iterator
(),
array_iterator
(),
primitive_iterator
()
{}
};
};
template
<
typename
IteratorType
>
class
iteration_proxy
;
template
<
typename
IteratorType
>
class
iteration_proxy
;
...
@@ -4584,7 +4582,7 @@ template <typename CharType>
...
@@ -4584,7 +4582,7 @@ template <typename CharType>
class
output_vector_adapter
:
public
output_adapter
<
CharType
>
class
output_vector_adapter
:
public
output_adapter
<
CharType
>
{
{
public
:
public
:
output_vector_adapter
(
std
::
vector
<
CharType
>&
vec
)
:
v
(
vec
)
{}
explicit
output_vector_adapter
(
std
::
vector
<
CharType
>&
vec
)
:
v
(
vec
)
{}
void
write_character
(
CharType
c
)
override
void
write_character
(
CharType
c
)
override
{
{
...
@@ -7408,13 +7406,11 @@ class json_pointer
...
@@ -7408,13 +7406,11 @@ class json_pointer
const
std
::
string
&
t
)
const
std
::
string
&
t
)
{
{
assert
(
not
f
.
empty
());
assert
(
not
f
.
empty
());
for
(
auto
pos
=
s
.
find
(
f
);
// find first occurrence of f
for
(
std
::
size_t
pos
=
s
.
find
(
f
);
// find first occurrence of f
pos
!=
std
::
string
::
npos
;
// make sure f was found
pos
!=
std
::
string
::
npos
;
// make sure f was found
s
.
replace
(
pos
,
f
.
size
(),
t
),
// replace with t, and
s
.
replace
(
pos
,
f
.
size
(),
t
),
// replace with t
pos
=
s
.
find
(
f
,
pos
+
t
.
size
()))
// find next occurrence of f
pos
=
s
.
find
(
f
,
pos
+
t
.
size
())
// find next occurrence of f
{}
)
;
}
}
/// escape tilde and slash
/// escape tilde and slash
...
...
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