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
9cab30cf
Unverified
Commit
9cab30cf
authored
Aug 14, 2017
by
Théo DELRIEU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add adl_serializer.hpp
parent
8e9714fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
38 deletions
+51
-38
Makefile
Makefile
+2
-1
src/adl_serializer.hpp
src/adl_serializer.hpp
+48
-0
src/json.hpp
src/json.hpp
+1
-37
No files found.
Makefile
View file @
9cab30cf
...
...
@@ -22,7 +22,8 @@ SRCS = ${SRCDIR}/json.hpp \
${SRCDIR}
/detail/parsing/binary_reader.hpp
\
${SRCDIR}
/detail/parsing/binary_writer.hpp
\
${SRCDIR}
/detail/serializer.hpp
\
${SRCDIR}
/detail/json_ref.hpp
${SRCDIR}
/detail/json_ref.hpp
\
${SRCDIR}
/adl_serializer.hpp
# main target
all
:
...
...
src/adl_serializer.hpp
0 → 100644
View file @
9cab30cf
#ifndef NLOHMANN_JSON_ADL_SERIALIZER_HPP
#define NLOHMANN_JSON_ADL_SERIALIZER_HPP
#include <utility>
#include "detail/conversions/from_json.hpp"
#include "detail/conversions/to_json.hpp"
namespace
nlohmann
{
template
<
typename
,
typename
>
struct
adl_serializer
{
/*!
@brief convert a JSON value to any value type
This function is usually called by the `get()` function of the
@ref basic_json class (either explicit or via conversion operators).
@param[in] j JSON value to read from
@param[in,out] val value to write to
*/
template
<
typename
BasicJsonType
,
typename
ValueType
>
static
void
from_json
(
BasicJsonType
&&
j
,
ValueType
&
val
)
noexcept
(
noexcept
(
::
nlohmann
::
from_json
(
std
::
forward
<
BasicJsonType
>
(
j
),
val
)))
{
::
nlohmann
::
from_json
(
std
::
forward
<
BasicJsonType
>
(
j
),
val
);
}
/*!
@brief convert any value type to a JSON value
This function is usually called by the constructors of the @ref basic_json
class.
@param[in,out] j JSON value to write to
@param[in] val value to read from
*/
template
<
typename
BasicJsonType
,
typename
ValueType
>
static
void
to_json
(
BasicJsonType
&
j
,
ValueType
&&
val
)
noexcept
(
noexcept
(
::
nlohmann
::
to_json
(
j
,
std
::
forward
<
ValueType
>
(
val
))))
{
::
nlohmann
::
to_json
(
j
,
std
::
forward
<
ValueType
>
(
val
));
}
};
}
#endif
src/json.hpp
View file @
9cab30cf
...
...
@@ -70,6 +70,7 @@ SOFTWARE.
#include "detail/parsing/binary_writer.hpp"
#include "detail/serializer.hpp"
#include "detail/json_ref.hpp"
#include "adl_serializer.hpp"
/*!
@brief namespace for Niels Lohmann
...
...
@@ -78,42 +79,6 @@ SOFTWARE.
*/
namespace
nlohmann
{
template
<
typename
,
typename
>
struct
adl_serializer
{
/*!
@brief convert a JSON value to any value type
This function is usually called by the `get()` function of the
@ref basic_json class (either explicit or via conversion operators).
@param[in] j JSON value to read from
@param[in,out] val value to write to
*/
template
<
typename
BasicJsonType
,
typename
ValueType
>
static
void
from_json
(
BasicJsonType
&&
j
,
ValueType
&
val
)
noexcept
(
noexcept
(
::
nlohmann
::
from_json
(
std
::
forward
<
BasicJsonType
>
(
j
),
val
)))
{
::
nlohmann
::
from_json
(
std
::
forward
<
BasicJsonType
>
(
j
),
val
);
}
/*!
@brief convert any value type to a JSON value
This function is usually called by the constructors of the @ref basic_json
class.
@param[in,out] j JSON value to write to
@param[in] val value to read from
*/
template
<
typename
BasicJsonType
,
typename
ValueType
>
static
void
to_json
(
BasicJsonType
&
j
,
ValueType
&&
val
)
noexcept
(
noexcept
(
::
nlohmann
::
to_json
(
j
,
std
::
forward
<
ValueType
>
(
val
))))
{
::
nlohmann
::
to_json
(
j
,
std
::
forward
<
ValueType
>
(
val
));
}
};
class
json_pointer
{
/// allow basic_json to access private members
...
...
@@ -7969,7 +7934,6 @@ inline bool operator!=(json_pointer const& lhs, json_pointer const& rhs) noexcep
}
}
// namespace nlohmann
///////////////////////
// nonmember support //
///////////////////////
...
...
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