-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from injae/dev
default dependencies change: remove fmt
- Loading branch information
Showing
23 changed files
with
229 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
#include <serdepp/serde.hpp> | ||
#include <serdepp/adaptor/nlohmann_json.hpp> | ||
|
||
struct Object { | ||
DERIVE_SERDE(Object, | ||
(&Self::radius, "radius") | ||
(&Self::width, "width") | ||
(&Self::height, "height")) | ||
std::optional<int> radius; | ||
std::optional<int> width; | ||
std::optional<int> height; | ||
}; | ||
struct Test { | ||
DERIVE_SERDE(Test, | ||
(&Self::type, "type") | ||
[attributes(flatten)] | ||
(&Self::object, "object")) | ||
std::string type; | ||
Object object; | ||
}; | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
nlohmann::json jflat = R"([ | ||
{"type": "circle", "radius": 5}, | ||
{"type": "rectangle", "width": 6, "height": 5} | ||
])"_json; | ||
|
||
nlohmann::json j = R"([ | ||
{"type": "circle", "object": {"radius" : 5}}, | ||
{"type": "rectangle", "object": {"width": 6, "height": 5}} | ||
])"_json; | ||
|
||
auto j_flatten = serde::deserialize<std::vector<Test>>(jflat); | ||
|
||
std::cout << serde::serialize<serde::serde_sstream>(j_flatten).str(); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#include "serdepp/serde.hpp" | ||
#include "serdepp/adaptor/fmt.hpp" | ||
|
||
namespace serde::attribute { | ||
namespace detail { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#include "serdepp/serde.hpp" | ||
#include "serdepp/adaptor/fmt.hpp" | ||
|
||
namespace serde::attribute { | ||
namespace detail { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.