-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjson_pack_base.h
682 lines (599 loc) · 21.8 KB
/
json_pack_base.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
/*
@copyright Russell Standish 2000-2013
@author Russell Standish
This file is part of Classdesc
Open source licensed under the MIT license. See LICENSE for details.
*/
#ifndef CLASSDESC_JSON_PACK_BASE_H
#define CLASSDESC_JSON_PACK_BASE_H
#include "classdesc.h"
#define JSON5_PARSER_MVALUE_ENABLED
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#include <json5_parser_value.h>
#include <json5_parser_reader_template.h>
#include <json5_parser_writer_template.h>
#include <stdio.h>
#include <stdarg.h>
#include <vector>
#include <map>
#include <cmath>
#if defined(__cplusplus) && __cplusplus<201103L
#include <math.h>
namespace std
{
using ::nan;
}
#endif
namespace classdesc
{
class json_pack_error : public exception
{
static const int maxchars=200; /* I hope this will always be large enough */
char errstring[maxchars];
public:
json_pack_error(const char *fmt,...)
{
va_list args;
va_start(args, fmt);
vsnprintf(errstring,maxchars,fmt,args);
va_end(args);
}
virtual ~json_pack_error() throw() {}
virtual const char* what() const throw() {return errstring;}
};
struct json_object_not_found: public json_pack_error
{
json_object_not_found(const string& name):
json_pack_error("json object %s not found", name.c_str()) {}
};
typedef std::map<json5_parser::Value_type,RESTProcessType::Type> RESTProcessTypeJSONMap_t;
const inline RESTProcessTypeJSONMap_t& RESTProcessTypeJSONMap()
{
static RESTProcessTypeJSONMap_t jsonMap;
if (jsonMap.empty())
{
jsonMap[json5_parser::obj_type]=RESTProcessType::object;
jsonMap[json5_parser::array_type]=RESTProcessType::array;
jsonMap[json5_parser::str_type]=RESTProcessType::string;
jsonMap[json5_parser::bool_type]=RESTProcessType::boolean;
jsonMap[json5_parser::int_type]=RESTProcessType::int_number;
jsonMap[json5_parser::real_type]=RESTProcessType::float_number;
jsonMap[json5_parser::null_type]=RESTProcessType::null;
}
return jsonMap;
};
/// convert a json5_parser::Value_type to a RESTProcessType::Type
inline RESTProcessType::Type Json5ParserTypeToRESTProcessType(json5_parser::Value_type type)
{
RESTProcessTypeJSONMap_t::const_iterator r=RESTProcessTypeJSONMap().find(type);
if (r!=RESTProcessTypeJSONMap().end()) return r->second;
return RESTProcessType::null;
}
/// convert a RESTProcessType::Type to a json5_parser::Value_type
inline json5_parser::Value_type RESTProcessTypeToJson5ParserType(RESTProcessType::Type type)
{
typedef std::map<RESTProcessType::Type,json5_parser::Value_type> Map;
static Map jsonMap;
if (jsonMap.empty())
{
const RESTProcessTypeJSONMap_t& m=RESTProcessTypeJSONMap();
for (RESTProcessTypeJSONMap_t::const_iterator i=m.begin(); i!=m.end(); ++i)
jsonMap.insert(std::make_pair(i->second,i->first));
}
Map::const_iterator r=jsonMap.find(type);
if (r!=jsonMap.end()) return r->second;
return json5_parser::null_type;
};
// these are classes, not typedefs to avoid adding properties to mValue
class json_pack_t: public json5_parser::mValue
{
public:
bool throw_on_error; ///< enable exceptions on error conditions
bool throw_on_not_found; ///< enable exceptions if element not present in JSON stream
typedef json5_parser::mArray Array;
json_pack_t(): throw_on_error(false), throw_on_not_found(false) {}
template <class T>
explicit json_pack_t(const T& x,
typename enable_if<is_base_of<json5_parser::mValue,T>, dummy<0> >::T* d=0 ):
json5_parser::mValue(x), throw_on_error(false), throw_on_not_found(false) {}
template <class T>
explicit json_pack_t(const T& x,
typename enable_if<is_base_of<json5_parser::mArray,T>, dummy<0> >::T* d=0 ):
json5_parser::mValue(x), throw_on_error(false), throw_on_not_found(false) {}
template <class T>
explicit json_pack_t(const T& x,
typename enable_if<is_base_of<json5_parser::mObject,T>, dummy<0> >::T* d=0 ):
json5_parser::mValue(x), throw_on_error(false), throw_on_not_found(false) {}
template <class T>
explicit json_pack_t(const T& x, typename enable_if<
And<
And<
Not<is_base_of<json5_parser::mValue,T> >,
Not<is_base_of<json5_parser::mArray,T> >
>,
Not<is_base_of<json5_parser::mObject,T> >
>, dummy<1> >::T* d=0);
explicit json_pack_t(bool x):
json5_parser::mValue(x),
throw_on_error(false), throw_on_not_found(false) {}
explicit json_pack_t(double x):
json5_parser::mValue(x), throw_on_error(false), throw_on_not_found(false) {}
explicit json_pack_t(const char* x):
json5_parser::mValue(x), throw_on_error(false), throw_on_not_found(false) {}
explicit json_pack_t(const string& x):
json5_parser::mValue(x), throw_on_error(false), throw_on_not_found(false) {}
// explicit json_pack_t(const Array& x):
// json5_parser::mValue(x), throw_on_error(false), throw_on_not_found(false) {}
// explicit json_pack_t(const json5_parser::mValue& x):
// json5_parser::mValue(x), throw_on_error(false), throw_on_not_found(false) {}
#if defined(__cplusplus) && __cplusplus>=201103L
template <class T>
explicit json_pack_t(const std::initializer_list<T>& x): json5_parser::mValue(json5_parser::mArray())
{
auto& arr=get_array();
for (auto& i: x) arr.emplace_back(i);
}
#endif
const Array& array() const {return get_array();}
RESTProcessType::Type type() const {
return Json5ParserTypeToRESTProcessType(json5_parser::mValue::type());
}
/// convert this to an object type (if not already)
void objectify() {if (type()!=RESTProcessType::object) *this=json_pack_t(json5_parser::mObject());}
};
inline bool read(const std::string& s, json_pack_t& value)
{
return json5_parser::read_string(s, static_cast<json5_parser::mValue&>(value));
}
inline bool read(std::istream& is, json_pack_t& value)
{
return json5_parser::read_stream(is, static_cast<json5_parser::mValue&>(value));
}
inline void write(const json_pack_t& value, std::ostream& os, unsigned options=0)
{
json5_parser::write_stream(static_cast<const json5_parser::mValue&>(value), os, options );
}
inline std::string write(const json_pack_t& value, unsigned options=0)
{
return json5_parser::write_string(static_cast<const json5_parser::mValue&>(value), options );
}
inline void write_formatted(const json_pack_t& value, std::ostream& os)
{
write_stream( static_cast<const json5_parser::mValue&>(value), os, json5_parser::pretty_print );
}
inline std::string write_formatted(const json_pack_t& value)
{
return write_string( static_cast<const json5_parser::mValue&>(value), json5_parser::pretty_print );
}
typedef json_pack_t json_unpack_t;
/// forward declare generic json operations
template <class T> void json_pack(json_pack_t& o, const string& d, T& a);
template <class T> void json_pack(json_pack_t& o, const string& d, const T& a)
{json_pack(o,d,const_cast<T&>(a));}
template <class T> void json_unpack(json_unpack_t& o, const string& d, T& a);
template <class T> json_pack_t& operator<<(json_pack_t& j, const T& a)
{json_pack(j,"",a); return j;}
template <class T> const json_unpack_t& operator>>(const json_unpack_t& j, T& a)
{json_unpack(const_cast<json_unpack_t&>(j),"",a); return j;}
inline const json_unpack_t& operator>>(const json_unpack_t& j, const char*& a)
{throw json_pack_error("cannot unpack to char*, please use string instead");}
template <class T>
json_pack_t::json_pack_t(const T& x, typename enable_if<
And<
And<
Not<is_base_of<json5_parser::mValue,T> >,
Not<is_base_of<json5_parser::mArray,T> >
>,
Not<is_base_of<json5_parser::mObject,T> >
>, dummy<1> >::T*):
json5_parser::mValue(json5_parser::mObject()),
throw_on_error(false), throw_on_not_found(false)
{(*this)<<x;}
/// find an object named by \a name within the json object x
inline json5_parser::mValue&
json_find(json5_parser::mValue& x, std::string name)
{
if (name.size()==0) return x;
if (name[0]=='.') name.erase(0,1); //remove leading '.'
std::string::size_type p=name.find('.');
if (x.type()==json5_parser::obj_type)
{
json5_parser::mObject& xo=x.get_obj();
json5_parser::mObject::iterator i=xo.find(name.substr(0,p));
if (i==xo.end())
throw json_object_not_found(name.substr(0,p));
else if (p==std::string::npos)
return i->second;
else
return json_find(i->second,name.substr(p,std::string::npos));
}
else
throw json_pack_error("%s is not a json object",name.c_str());
}
//json5_parser::mValue does not provide constructors for everything. Oh well..
template <class T> json5_parser::mValue valueof(T a)
{return json5_parser::mValue(a);}
template <class T> T getValue(const json5_parser::mValue& x)
{return x.get_value<T>();}
inline json5_parser::mValue valueof(unsigned char a)
{return json5_parser::mValue(int(a));}
template <> inline unsigned char getValue(const json5_parser::mValue& x)
{return x.get_value<int>();}
inline json5_parser::mValue valueof(signed char a)
{return json5_parser::mValue(int(a));}
template <> inline signed char getValue(const json5_parser::mValue& x)
{return x.get_value<int>();}
inline json5_parser::mValue valueof(char a)
{return json5_parser::mValue(string()+a);}
template <> inline char getValue(const json5_parser::mValue& x)
{return x.get_value<string>()[0];}
inline json5_parser::mValue valueof(unsigned short a)
{return json5_parser::mValue(int(a));}
template <> inline unsigned short getValue(const json5_parser::mValue& x)
{return x.get_value<int>();}
inline json5_parser::mValue valueof(signed short a)
{return json5_parser::mValue(int(a));}
template <> inline signed short getValue(const json5_parser::mValue& x)
{return x.get_value<int>();}
inline json5_parser::mValue valueof(unsigned int a)
{return json5_parser::mValue(boost::uint64_t(a));}
template <> inline unsigned getValue(const json5_parser::mValue& x)
{return x.get_value<boost::uint64_t>();}
inline json5_parser::mValue valueof(unsigned long a)
{return json5_parser::mValue(boost::uint64_t(a));}
template <> inline unsigned long getValue(const json5_parser::mValue& x)
{return x.get_value<boost::uint64_t>();}
inline json5_parser::mValue valueof(long a)
{return json5_parser::mValue(boost::int64_t(a));}
template <> inline long getValue(const json5_parser::mValue& x)
{return x.get_value<boost::int64_t>();}
#ifdef HAVE_LONGLONG
inline json5_parser::mValue valueof(unsigned long long a)
{return json5_parser::mValue(boost::uint64_t(a));}
template <> inline unsigned long long getValue(const json5_parser::mValue& x)
{return x.get_value<boost::uint64_t>();}
inline json5_parser::mValue valueof(long long a)
{return json5_parser::mValue(boost::int64_t(a));}
template <> inline long long getValue(const json5_parser::mValue& x)
{return x.get_value<boost::int64_t>();}
#endif
inline json5_parser::mValue valueof(float a)
{return json5_parser::mValue(double(a));}
template <> inline float getValue(const json5_parser::mValue& x)
{
// treat nulls as nans - JSON.stringify of special values returns "null"
if (x.type()==json5_parser::null_type) return std::nan("");
return x.get_value<double>();
}
template <> inline double getValue(const json5_parser::mValue& x)
{
// treat nulls as nans - JSON.stringify of special values returns "null"
if (x.type()==json5_parser::null_type) return std::nan("");
return x.get_value<double>();
}
// basic types
template <class T> typename
enable_if<Or<is_fundamental<T>,is_string<T> >, void>::T
json_packp(json_unpack_t& o, const string& d, const T& a, dummy<0> dum=0)
{
using namespace json5_parser;
if (d=="")
{
json_pack_t tmp(valueof(a));
o=tmp;
}
else
{
o.objectify();
try
{
json5_parser::mValue& parent=json_find(o,head(d));
if (parent.type()==obj_type)
parent.get_obj()[tail(d)]=valueof(a);
else
throw json_pack_error("cannot add to a basic type");
}
catch (const json_object_not_found&)
{
// only throw if this flag is set
if (o.throw_on_not_found) throw;
}
catch (const json_pack_error&)
{
// only throw if this flag is set
if (o.throw_on_error) throw;
}
}
}
// basic types
template <class T> typename
enable_if<Or<is_fundamental<T>,is_string<T> >, void>::T
json_unpackp(json_unpack_t& o, string d, T& a, dummy<0> dum=0)
{
try
{
a=getValue<T>(json_find(o,d));
}
catch (const json_pack_error&)
{
// only throw if this flag is set
if (o.throw_on_error) throw;
}
}
template <class T> void json_pack_isarray
(json5_parser::mValue& jval, const T& val, std::vector<size_t> dims)
{
if (dims.empty())
{
json_pack_t j;
json_pack(j,"",val);
jval=j;
}
else
{
size_t s=dims.back();
jval=json5_parser::mArray(s);
dims.pop_back();
size_t stride=1;
for (size_t i=0; i<dims.size(); ++i) stride*=dims[i];
for (size_t i=0; i<s; ++i)
json_pack_isarray(jval.get_array()[i],(&val)[i*stride], dims);
}
}
// array handling
template <class T>
void json_pack(json_pack_t& o, const string& d, is_array ia, const T& a,
int ndims,size_t ncopies,...)
{
va_list ap;
va_start(ap,ncopies);
std::vector<size_t> dims(ndims);
dims[ndims-1]=ncopies;
for (int i=ndims-2; i>=0; --i) dims[i]=va_arg(ap,size_t);
va_end(ap);
try
{
json5_parser::mValue& parent=json_find(o,head(d));
if (parent.type()!=json5_parser::obj_type)
throw json_pack_error("attempt to pack an array member into a non-object");
else
json_pack_isarray(parent.get_obj()[tail(d)],a,dims);
}
catch (json_pack_error&)
{
// only throw if this flag is set
if (o.throw_on_error) throw;
}
}
template <class T> void json_unpack_isarray
(const json5_parser::mValue& jval, T& val, std::vector<size_t> dims)
{
if (dims.empty())
{
json_unpack_t j(jval);
json_unpack(j,"",val);
}
else
{
size_t s=dims.back();
dims.pop_back();
size_t stride=1;
for (size_t i=0; i<dims.size(); ++i) stride*=dims[i];
for (size_t i=0; i<s; ++i)
json_unpack_isarray(jval.get_array()[i],(&val)[i*stride], dims);
}
}
template <class T>
void json_unpack(json_unpack_t& o, const string& d, is_array ia, T& a,
int ndims,size_t ncopies,...)
{
va_list ap;
va_start(ap,ncopies);
std::vector<size_t> dims(ndims);
dims[ndims-1]=ncopies;
for (int i=ndims-2; i>=0; --i) dims[i]=va_arg(ap,size_t);
va_end(ap);
try
{
const json5_parser::mValue& v=json_find(o,d);
if (v.type()!=json5_parser::array_type)
throw json_pack_error
("attempt to unpack an array member from a non-object");
else
json_unpack_isarray(v,a,dims);
}
catch (json_pack_error&)
{
// only throw if this flag is set
if (o.throw_on_error) throw;
}
}
/**
handle enums
*/
template <class T> void json_pack(json_pack_t& x, const string& d,
Enum_handle<T> arg)
{
string tmp(static_cast<string>(arg));
json_pack(x,d,tmp);
}
//Enum_handles have reference semantics
template <class T> void json_unpack(json_unpack_t& x, const string& d,
Enum_handle<T> arg)
{
std::string tmp;
json_unpack(x,d,tmp);
// remove extraneous white space
int (*isspace)(int)=std::isspace;
std::string::iterator end=std::remove_if(tmp.begin(),tmp.end(),isspace);
arg=tmp.substr(0,end-tmp.begin());
}
/** standard container handling */
template <class T> typename
enable_if<is_sequence<T>, void>::T
json_unpackp(json_unpack_t& o, const string& d, T& a, dummy<1> dum=0)
{
try
{
const json5_parser::mValue& val=json_find(o,d);
if (val.type()!=json5_parser::array_type)
throw json_pack_error("%s is not an array",d.c_str());
else
{
const json5_parser::mArray& arr=val.get_array();
resize(a, arr.size());
size_t i=0;
for (typename T::iterator j=a.begin(); i<arr.size() && j!=a.end(); ++i, ++j)
{
json_unpack_t jp(arr[i]);
json_unpack(jp,"",*j);
}
}
}
catch (json_pack_error&)
{
if (o.throw_on_error) throw;
}
}
template <class T1, class T2>
void json_pack(json_pack_t& o, const string& d, std::pair<T1,T2>& a)
{
o.objectify();
json_pack(o,d+".first",a.first);
json_pack(o,d+".second",a.second);
}
template <class T1, class T2>
void json_unpackp(json_unpack_t& o, const string& d, std::pair<T1,T2>& a)
{
json_unpack(o,d+".first",a.first);
json_unpack(o,d+".second",a.second);
}
template <class T> typename
enable_if<Or<is_sequence<T>,is_associative_container<T> >, void>::T
json_packp(json_pack_t& o, const string& d, const T& a, dummy<1> dum=0)
{
o.objectify();
try
{
json5_parser::mValue& parent=json_find(o,head(d));
if (parent.type()!=json5_parser::obj_type)
throw json_pack_error("attempt to pack an array member into a non-object");
else
{
json5_parser::mValue* v;
if (d.empty())
v=&parent;
else
v=&parent.get_obj()[tail(d)];
json5_parser::mArray& arr=
(*v=json5_parser::mArray(a.size())).get_array();
typename T::const_iterator i=a.begin();
for (size_t k=0; i!=a.end(); ++i, ++k)
{
json_pack_t j;
json_pack(j,"",*i);
arr[k]=j;
}
}
}
catch (json_pack_error&)
{
if (o.throw_on_error) throw;
}
}
template <class T> typename
enable_if<And<is_associative_container<T>, Not<is_stringKeyMap<T> > >, void>::T
json_unpackp(json_unpack_t& o, const string& d, T& a, dummy<2> dum=0)
{
try
{
const json5_parser::mValue& val=json_find(o,d);
if (val.type()!=json5_parser::array_type)
throw json_pack_error("%s is not an array",d.c_str());
else
{
const json5_parser::mArray& arr=val.get_array();
a.clear();
for (size_t i=0; i<arr.size(); ++i)
{
// certain linters fail to recognise that this variable is initialised in the json_unpack call
#if defined(__cplusplus) && __cplusplus>=201103L
typename NonConstKeyValueType<typename T::value_type>::T v{};
#else
typename NonConstKeyValueType<typename T::value_type>::T v;
#endif
json_unpack_t j(arr[i]);
json_unpack(j,"",v);
a.insert(v);
}
}
}
catch (json_pack_error&)
{
if (o.throw_on_error) throw;
}
}
/*
const static support
*/
template <class T>
void//typename enable_if<Not<is_pointer<T> >,void>::T
json_pack(json_pack_t& targ, const string& desc, is_const_static, T)
{}
template <class T>
void//typename enable_if<Not<is_pointer<T> >,void>::T
json_unpack(json_unpack_t& targ, const string& desc, is_const_static, T)
{}
template <class T>
typename enable_if<is_object<T>, void>::T
json_unpack(json_unpack_t& targ, const string& desc, T*) {}
template <class T>
void json_unpack(json_unpack_t& targ, const string& desc, const T& arg) {}
template <class T>
void json_pack(json_pack_t& targ, const string& desc, Exclude<T>& arg) {}
template <class T>
void json_unpack(json_unpack_t& targ, const string& desc, Exclude<T>& arg) {}
template <class T, class U>
void json_pack(json_pack_t& targ, const string& desc, T&, is_constructor, U&) {}
template <class T, class U>
void json_unpack(json_unpack_t& targ, const string& desc, T&, is_constructor, U&) {}
/// produce json string equivalent of object \a x
template <class T> string json(const T& x)
{
json_pack_t j;
json_pack(j,"",x);
return write(j);
}
template <class T> void json(T& x, const string& s)
{
json_pack_t j;
read(s, j);
json_unpack(j,"",x);
}
template <class T>
void json_pack_onbase(json_pack_t& x,const string& d,T& a)
{json_pack(x,d+basename<T>(),a);}
template <class T>
void json_unpack_onbase(json_unpack_t& x,const string& d,T& a)
{json_unpack(x,d+basename<T>(),a);}
}
inline std::ostream& operator<<(std::ostream& o, const json5_parser::mValue& x)
{
json5_parser::write_stream(x,o);
return o;
}
namespace classdesc_access
{
template <class T, class Enable=void> struct access_json_pack;
template <class T, class Enable=void> struct access_json_unpack;
}
#include "use_mbr_pointers.h"
CLASSDESC_USE_OLDSTYLE_MEMBER_OBJECTS(json_pack)
CLASSDESC_USE_OLDSTYLE_MEMBER_OBJECTS(json_unpack)
CLASSDESC_FUNCTION_NOP(json_pack)
CLASSDESC_FUNCTION_NOP(json_unpack)
using classdesc::json_pack_onbase;
using classdesc::json_unpack_onbase;
using classdesc::json_pack;
using classdesc::json_unpack;
#endif