mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-08-04 10:36:23 -04:00
Merge branch 'master' into findType
This commit is contained in:
commit
f7c2723342
2
AUTHORS
2
AUTHORS
@ -16,7 +16,7 @@ Baruch Siach <baruch@tkos.co.il>
|
|||||||
Ben Boeckel <mathstuf@gmail.com>
|
Ben Boeckel <mathstuf@gmail.com>
|
||||||
Benjamin Knecht <bknecht@logitech.com>
|
Benjamin Knecht <bknecht@logitech.com>
|
||||||
Bernd Kuhls <bernd.kuhls@t-online.de>
|
Bernd Kuhls <bernd.kuhls@t-online.de>
|
||||||
Billy Donahue <billydonahue@google.com>
|
Billy Donahue <billy.donahue@gmail.com>
|
||||||
Braden McDorman <bmcdorman@gmail.com>
|
Braden McDorman <bmcdorman@gmail.com>
|
||||||
Brandon Myers <bmyers1788@gmail.com>
|
Brandon Myers <bmyers1788@gmail.com>
|
||||||
Brendan Drew <brendan.drew@daqri.com>
|
Brendan Drew <brendan.drew@daqri.com>
|
||||||
|
@ -143,7 +143,7 @@ if(BUILD_STATIC_LIBS)
|
|||||||
|
|
||||||
# avoid name clashes on windows as the shared import lib is also named jsoncpp.lib
|
# avoid name clashes on windows as the shared import lib is also named jsoncpp.lib
|
||||||
if(NOT DEFINED STATIC_SUFFIX AND BUILD_SHARED_LIBS)
|
if(NOT DEFINED STATIC_SUFFIX AND BUILD_SHARED_LIBS)
|
||||||
if (WIN32)
|
if (MSVC OR ("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC"))
|
||||||
set(STATIC_SUFFIX "_static")
|
set(STATIC_SUFFIX "_static")
|
||||||
else()
|
else()
|
||||||
set(STATIC_SUFFIX "")
|
set(STATIC_SUFFIX "")
|
||||||
|
@ -23,13 +23,6 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#if __cplusplus >= 201103L
|
|
||||||
|
|
||||||
#if !defined(sscanf)
|
|
||||||
#define sscanf std::sscanf
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif //__cplusplus
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#if !defined(_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
|
#if !defined(_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
|
||||||
@ -53,11 +46,7 @@ static size_t const stackLimit_g =
|
|||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520)
|
|
||||||
using CharReaderPtr = std::unique_ptr<CharReader>;
|
using CharReaderPtr = std::unique_ptr<CharReader>;
|
||||||
#else
|
|
||||||
using CharReaderPtr = std::auto_ptr<CharReader>;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Implementation of class Features
|
// Implementation of class Features
|
||||||
// ////////////////////////////////
|
// ////////////////////////////////
|
||||||
|
@ -684,7 +684,7 @@ Value::UInt Value::asUInt() const {
|
|||||||
JSON_ASSERT_MESSAGE(isUInt(), "LargestUInt out of UInt range");
|
JSON_ASSERT_MESSAGE(isUInt(), "LargestUInt out of UInt range");
|
||||||
return UInt(value_.uint_);
|
return UInt(value_.uint_);
|
||||||
case realValue:
|
case realValue:
|
||||||
JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt),
|
JSON_ASSERT_MESSAGE(InRange(value_.real_, 0u, maxUInt),
|
||||||
"double out of UInt range");
|
"double out of UInt range");
|
||||||
return UInt(value_.real_);
|
return UInt(value_.real_);
|
||||||
case nullValue:
|
case nullValue:
|
||||||
@ -733,7 +733,7 @@ Value::UInt64 Value::asUInt64() const {
|
|||||||
case uintValue:
|
case uintValue:
|
||||||
return UInt64(value_.uint_);
|
return UInt64(value_.uint_);
|
||||||
case realValue:
|
case realValue:
|
||||||
JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt64),
|
JSON_ASSERT_MESSAGE(InRange(value_.real_, 0u, maxUInt64),
|
||||||
"double out of UInt64 range");
|
"double out of UInt64 range");
|
||||||
return UInt64(value_.real_);
|
return UInt64(value_.real_);
|
||||||
case nullValue:
|
case nullValue:
|
||||||
@ -844,7 +844,7 @@ bool Value::isConvertibleTo(ValueType other) const {
|
|||||||
type() == booleanValue || type() == nullValue;
|
type() == booleanValue || type() == nullValue;
|
||||||
case uintValue:
|
case uintValue:
|
||||||
return isUInt() ||
|
return isUInt() ||
|
||||||
(type() == realValue && InRange(value_.real_, 0, maxUInt)) ||
|
(type() == realValue && InRange(value_.real_, 0u, maxUInt)) ||
|
||||||
type() == booleanValue || type() == nullValue;
|
type() == booleanValue || type() == nullValue;
|
||||||
case realValue:
|
case realValue:
|
||||||
return isNumeric() || type() == booleanValue || type() == nullValue;
|
return isNumeric() || type() == booleanValue || type() == nullValue;
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -17,67 +19,6 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#if __cplusplus >= 201103L
|
|
||||||
#include <cmath>
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#if !defined(isnan)
|
|
||||||
#define isnan std::isnan
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(isfinite)
|
|
||||||
#define isfinite std::isfinite
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
#include <cmath>
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#if !defined(isnan)
|
|
||||||
#include <float.h>
|
|
||||||
#define isnan _isnan
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(isfinite)
|
|
||||||
#include <float.h>
|
|
||||||
#define isfinite _finite
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
|
|
||||||
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
|
|
||||||
#endif //_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
|
|
||||||
|
|
||||||
#endif //_MSC_VER
|
|
||||||
|
|
||||||
#if defined(__sun) && defined(__SVR4) // Solaris
|
|
||||||
#if !defined(isfinite)
|
|
||||||
#include <ieeefp.h>
|
|
||||||
#define isfinite finite
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__hpux)
|
|
||||||
#if !defined(isfinite)
|
|
||||||
#if defined(__ia64) && !defined(finite)
|
|
||||||
#define isfinite(x) \
|
|
||||||
((sizeof(x) == sizeof(float) ? _Isfinitef(x) : _IsFinite(x)))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(isnan)
|
|
||||||
// IEEE standard states that NaN values will not compare to themselves
|
|
||||||
#define isnan(x) ((x) != (x))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(__APPLE__)
|
|
||||||
#if !defined(isfinite)
|
|
||||||
#define isfinite finite
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
// Disable warning about strdup being deprecated.
|
// Disable warning about strdup being deprecated.
|
||||||
#pragma warning(disable : 4996)
|
#pragma warning(disable : 4996)
|
||||||
@ -85,11 +26,7 @@
|
|||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520)
|
|
||||||
using StreamWriterPtr = std::unique_ptr<StreamWriter>;
|
using StreamWriterPtr = std::unique_ptr<StreamWriter>;
|
||||||
#else
|
|
||||||
using StreamWriterPtr = std::auto_ptr<StreamWriter>;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
String valueToString(LargestInt value) {
|
String valueToString(LargestInt value) {
|
||||||
UIntToStringBuffer buffer;
|
UIntToStringBuffer buffer;
|
||||||
@ -129,12 +66,12 @@ String valueToString(double value, bool useSpecialFloats,
|
|||||||
// Print into the buffer. We need not request the alternative representation
|
// Print into the buffer. We need not request the alternative representation
|
||||||
// that always has a decimal point because JSON doesn't distinguish the
|
// that always has a decimal point because JSON doesn't distinguish the
|
||||||
// concepts of reals and integers.
|
// concepts of reals and integers.
|
||||||
if (!isfinite(value)) {
|
if (!std::isfinite(value)) {
|
||||||
static const char* const reps[2][3] = {{"NaN", "-Infinity", "Infinity"},
|
if (std::isnan(value))
|
||||||
{"null", "-1e+9999", "1e+9999"}};
|
return useSpecialFloats ? "NaN" : "null";
|
||||||
return reps[useSpecialFloats ? 0 : 1][isnan(value) ? 0
|
if (value < 0)
|
||||||
: (value < 0) ? 1
|
return useSpecialFloats ? "-Infinity" : "-1e+9999";
|
||||||
: 2];
|
return useSpecialFloats ? "Infinity" : "1e+9999";
|
||||||
}
|
}
|
||||||
|
|
||||||
String buffer(size_t(36), '\0');
|
String buffer(size_t(36), '\0');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user