#include <objlib.h>
Convert class contents to JSON object.
Returns a json11 JSON object of the class
- Returns
- A json11 JSON object containing every member variable within the class
109 {
"groups" , d_groups },
std::map< std::string, Json > object
Definition: json11.hpp:88
double length
Definition: objlib.h:100
Vector centroid
Definition: objlib.h:99
vector< vertex > vertices
Definition: objlib.h:98
vector< size_t > groups
Definition: objlib.h:97
void Cosmos::wavefront::line::from_json |
( |
const string & |
s | ) |
|
|
inline |
Set class contents from JSON string.
Parses the provided JSON-formatted string and sets the class data. String should be formatted like the string returned from to_json()
- Parameters
-
s | JSON-formatted string to set class contents to |
- Returns
- n/a
126 for(
size_t i = 0;
i <
groups.size(); ++
i) {
127 if(!p[
"groups"][
i].is_null())
128 groups[
i] = static_cast<size_t>(p[
"groups"][
i].number_value());
134 if(!p[
"length"].is_null())
length = p[
"length"].number_value();
136 cerr<<
"ERROR: <"<<error<<
">"<<endl;
Definition: json11.hpp:79
void from_json(const string &s)
Set class contents from JSON string.
Definition: objlib.h:122
int i
Definition: rw_test.cpp:37
static double * p
Definition: gauss_jackson_test.cpp:42
void dump(std::string &out) const
double length
Definition: objlib.h:100
void from_json(const string &s)
Set class contents from JSON string.
Definition: vector.h:783
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
static void dump(NullStruct, string &out)
Definition: json11.cpp:53
Vector centroid
Definition: objlib.h:99
vector< vertex > vertices
Definition: objlib.h:98
vector< size_t > groups
Definition: objlib.h:97
vector<size_t> Cosmos::wavefront::line::groups |
vector<vertex> Cosmos::wavefront::line::vertices |
Vector Cosmos::wavefront::line::centroid |
double Cosmos::wavefront::line::length = 0. |
The documentation for this struct was generated from the following file: