File tree 3 files changed +18
-2
lines changed
3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -1272,7 +1272,7 @@ namespace classdesc
1272
1272
1273
1273
template <class T >
1274
1274
typename enable_if<is_floating_point<T>, bool >::T partiallyMatchable (const REST_PROCESS_BUFFER& x)
1275
- {return x.type ()==RESTProcessType::float_number||x.type ()==RESTProcessType::int_number;}
1275
+ {return x.type ()==RESTProcessType::float_number||x.type ()==RESTProcessType::int_number||x. type ()==RESTProcessType::null ;}
1276
1276
1277
1277
template <class T >
1278
1278
typename enable_if<
Original file line number Diff line number Diff line change @@ -1122,6 +1122,9 @@ namespace classdesc
1122
1122
template <> int enumKey<RESTProcessType::Type >(const string& x){return int (enum_keysData<RESTProcessType::Type >::keys (x));}
1123
1123
template <> string enumKey<RESTProcessType::Type >(int x){return enum_keysData<RESTProcessType::Type >::keys (x);}
1124
1124
}
1125
+
1126
+ // / and undefined hook to allow logging to console in an emscripten environment.
1127
+ void log (const std::string&);
1125
1128
}
1126
1129
1127
1130
Original file line number Diff line number Diff line change 18
18
#include < stdarg.h>
19
19
#include < vector>
20
20
#include < map>
21
+ #include < cmath>
21
22
22
23
namespace classdesc
23
24
{
@@ -296,8 +297,20 @@ namespace classdesc
296
297
297
298
inline json5_parser::mValue valueof (float a)
298
299
{return json5_parser::mValue (double (a));}
300
+
299
301
template <> inline float getValue (const json5_parser::mValue & x)
300
- {return x.get_value <double >();}
302
+ {
303
+ // treat nulls as nans - JSON.stringify of special values returns "null"
304
+ if (x.type ()==json5_parser::null_type) return std::nan (" " );
305
+ return x.get_value <double >();
306
+ }
307
+
308
+ template <> inline double getValue (const json5_parser::mValue & x)
309
+ {
310
+ // treat nulls as nans - JSON.stringify of special values returns "null"
311
+ if (x.type ()==json5_parser::null_type) return std::nan (" " );
312
+ return x.get_value <double >();
313
+ }
301
314
302
315
// basic types
303
316
template <class T > typename
You can’t perform that action at this time.
0 commit comments