deploy: 94fe31eb9b
This commit is contained in:
1 parent
41c601a7d1
commit
d2e264bd84
1400 files changed
+11859
-5440
No files matched your search
@@ -52,7 +52,7 @@ assert(jPi.get<TaskState>() == TS_INVALID );
|
||||
#include <iostream>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
using nlohmann::json;
|
||||
|
||||
namespace ns
|
||||
{
|
||||
@@ -90,7 +90,7 @@ assert(jPi.get<TaskState>() == TS_INVALID );
|
||||
json j_stopped = ns::TS_STOPPED;
|
||||
json j_red = ns::Color::red;
|
||||
std::cout << "ns::TS_STOPPED -> " << j_stopped
|
||||
<< ", ns::Color::red -> " << j_red << std::endl;
|
||||
<< ", ns::Color::red -> " << j_red << '\n';
|
||||
|
||||
// deserialization
|
||||
json j_running = "running";
|
||||
@@ -98,7 +98,7 @@ assert(jPi.get<TaskState>() == TS_INVALID );
|
||||
auto running = j_running.get<ns::TaskState>();
|
||||
auto blue = j_blue.get<ns::Color>();
|
||||
std::cout << j_running << " -> " << running
|
||||
<< ", " << j_blue << " -> " << static_cast<int>(blue) << std::endl;
|
||||
<< ", " << j_blue << " -> " << static_cast<int>(blue) << '\n';
|
||||
|
||||
// deserializing undefined JSON value to enum
|
||||
// (where the first map entry above is the default)
|
||||
@@ -106,7 +106,7 @@ assert(jPi.get<TaskState>() == TS_INVALID );
|
||||
auto invalid = j_pi.get<ns::TaskState>();
|
||||
auto unknown = j_pi.get<ns::Color>();
|
||||
std::cout << j_pi << " -> " << invalid << ", "
|
||||
<< j_pi << " -> " << static_cast<int>(unknown) << std::endl;
|
||||
<< j_pi << " -> " << static_cast<int>(unknown) << '\n';
|
||||
}
|
||||
|
||||
```
|
||||
@@ -165,7 +165,7 @@ Other Important points:
|
||||
#include <iostream>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
using nlohmann::json;
|
||||
|
||||
namespace ns
|
||||
{
|
||||
@@ -198,7 +198,7 @@ Other Important points:
|
||||
}
|
||||
catch (const json::exception e)
|
||||
{
|
||||
std::cout << "deserialization failed: " << e.what() << std::endl;
|
||||
std::cout << "deserialization failed: " << e.what() << '\n';
|
||||
}
|
||||
|
||||
// invalid deserialization
|
||||
@@ -210,7 +210,7 @@ Other Important points:
|
||||
}
|
||||
catch (const json::exception e)
|
||||
{
|
||||
std::cout << "deserialization failed: " << e.what() << std::endl;
|
||||
std::cout << "deserialization failed: " << e.what() << '\n';
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user