27#define PARSE_VALUE( name ) \
28 if( j.find( #name ) != j.end() ) \
29 j.at( #name ).get_to( d.name )
31#define PARSE_TO_DOUBLE( name, def ) \
32 if( j.find( #name ) == j.end() ) \
36 else if( j.at( #name ).is_string() ) \
38 wxString str = j.at( #name ).get<wxString>(); \
41 str.ToCDouble( &out ); \
44 else if( j.at( #name ).is_number() ) \
46 d.name = j.at( #name ).get<double>(); \
54 wxString str = j.get<wxString>();
60 else if( j.is_number() )
75 if( j.find(
"c_para" ) != j.end() && j.at(
"c_para" ).is_object() )
76 d.
c_para = j.at(
"c_para" );
96 nlohmann::json inner = nlohmann::json::parse( d.
dataStr->get<std::string>(),
nullptr,
false );
98 if( inner.is_object() )
107 d.
layers = j.at(
"layers" );
109 if( j.find(
"DRCRULE" ) != j.end() && j.at(
"DRCRULE" ).is_object() )
128 if( !aJson.is_object() || aJson.contains(
"head" ) )
131 auto it = aJson.find(
"dataStr" );
133 if( it == aJson.end() || !it->is_object() || !it->contains(
"head" ) )
136 nlohmann::json inner = std::move( *it );
137 aJson = std::move( inner );
#define PARSE_TO_DOUBLE(name, def)
#define PARSE_VALUE(name)
void from_json(const nlohmann::json &j, EASYEDA::DOC_TYPE &d)
bool UnwrapDataStr(nlohmann::json &aJson)
Replace a document the EasyEDA server wraps in a metadata envelope with the document it carries.
std::optional< std::map< wxString, nlohmann::json > > DRCRULE
std::vector< wxString > layers
std::optional< nlohmann::json > dataStr
std::optional< std::map< wxString, wxString > > c_para