Added support of long long (issue #171)

Moved all build settings to `ArduinoJson/Configuration.hpp`
Added AppVeyor settings in source tree
This commit is contained in:
Benoit Blanchon
2016-02-14 16:18:13 +01:00
parent ce63e9c3c3
commit 8733f95e51
53 changed files with 945 additions and 869 deletions

View File

@ -17,31 +17,7 @@ using namespace ArduinoJson::Internals;
namespace ArduinoJson {
template <typename TFloat>
static TFloat parse(const char *);
template <>
float parse<float>(const char *s) {
return static_cast<float>(strtod(s, NULL));
}
template <>
double parse<double>(const char *s) {
return strtod(s, NULL);
}
template <>
long parse<long>(const char *s) {
return strtol(s, NULL, 10);
}
template <>
int parse<int>(const char *s) {
return atoi(s);
}
template <>
const char *JsonVariant::as<const char *>() const {
const char *JsonVariant::asString() const {
if (_type == JSON_UNPARSED && _content.asString &&
!strcmp("null", _content.asString))
return NULL;
@ -61,22 +37,7 @@ JsonFloat JsonVariant::asFloat() const {
return 0.0;
}
JsonInteger JsonVariant::asInteger() const {
if (_type == JSON_INTEGER || _type == JSON_BOOLEAN) return _content.asInteger;
if (_type >= JSON_FLOAT_0_DECIMALS)
return static_cast<JsonInteger>(_content.asFloat);
if ((_type == JSON_STRING || _type == JSON_UNPARSED) && _content.asString) {
if (!strcmp("true", _content.asString)) return 1;
return parse<JsonInteger>(_content.asString);
}
return 0L;
}
template <>
String JsonVariant::as<String>() const {
String JsonVariant::toString() const {
String s;
if ((_type == JSON_STRING || _type == JSON_UNPARSED) &&
_content.asString != NULL)