Added support of String class (issue #55, #56, #70, #77)

This commit is contained in:
Benoit Blanchon
2015-05-25 15:38:58 +02:00
parent 756c279cdc
commit 1b5be892b9
22 changed files with 351 additions and 119 deletions

View File

@ -20,6 +20,11 @@ inline JsonVariant::JsonVariant(const char *value) {
_content.asString = value;
}
inline JsonVariant::JsonVariant(const String &value) {
_type = Internals::JSON_STRING;
_content.asString = value.c_str();
}
inline JsonVariant::JsonVariant(double value, uint8_t decimals) {
_type = static_cast<Internals::JsonVariantType>(
Internals::JSON_DOUBLE_0_DECIMALS + decimals);
@ -107,6 +112,11 @@ inline bool JsonVariant::is<char const *>() const {
return _type == Internals::JSON_STRING;
}
template <>
inline bool JsonVariant::is<String>() const {
return _type == Internals::JSON_STRING;
}
template <>
inline bool JsonVariant::is<double>() const {
return _type >= Internals::JSON_DOUBLE_0_DECIMALS;