Created
November 8, 2018 03:49
-
-
Save schani/1b5cd956d4fdc900809b5a32b96438a4 to your computer and use it in GitHub Desktop.
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
diff -Naur /tmp/tmp.JgQbRnLgcP/cplusplus/test/inputs/json/samples/pokedex/TopLevel.hpp /tmp/tmp.wYD9u6A3yU/cplusplus/test/inputs/json/samples/pokedex/TopLevel.hpp | |
--- /tmp/tmp.JgQbRnLgcP/cplusplus/test/inputs/json/samples/pokedex/TopLevel.hpp 2018-11-06 16:47:56.000000000 +0000 | |
+++ /tmp/tmp.wYD9u6A3yU/cplusplus/test/inputs/json/samples/pokedex/TopLevel.hpp 2018-11-08 01:40:36.000000000 +0000 | |
@@ -14,6 +14,7 @@ | |
#include <boost/optional.hpp> | |
#include <stdexcept> | |
#include <regex> | |
+ | |
namespace nlohmann { | |
template <typename T> | |
struct adl_serializer<std::shared_ptr<T>> { | |
@@ -45,6 +46,11 @@ | |
return std::shared_ptr<T>(); | |
} | |
+ template <typename T> | |
+ inline std::shared_ptr<T> get_optional(const json &j, std::string property) { | |
+ return get_optional<T>(j, property.data()); | |
+ } | |
+ | |
enum class Egg : int { NOT_IN_EGGS, OMANYTE_CANDY, THE_10_KM, THE_2_KM, THE_5_KM }; | |
class Evolution { | |
@@ -174,6 +180,21 @@ | |
} | |
namespace nlohmann { | |
+ void from_json(const json& _j, quicktype::Evolution& _x); | |
+ void to_json(json& _j, const quicktype::Evolution& _x); | |
+ | |
+ void from_json(const json& _j, quicktype::Pokemon& _x); | |
+ void to_json(json& _j, const quicktype::Pokemon& _x); | |
+ | |
+ void from_json(const json& _j, quicktype::TopLevel& _x); | |
+ void to_json(json& _j, const quicktype::TopLevel& _x); | |
+ | |
+ void from_json(const json& _j, quicktype::Egg& _x); | |
+ void to_json(json& _j, const quicktype::Egg& _x); | |
+ | |
+ void from_json(const json& _j, quicktype::Type& _x); | |
+ void to_json(json& _j, const quicktype::Type& _x); | |
+ | |
inline void from_json(const json& _j, quicktype::Evolution& _x) { | |
_x.set_name( _j.at("name").get<std::string>() ); | |
_x.set_num( _j.at("num").get<std::string>() ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment