Merge branch 'master' into errorinfo
This commit is contained in:
commit
a9e76e3111
@ -1,5 +1,5 @@
|
|||||||
# Build matrix / environment variables are explained on:
|
# Build matrix / environment variables are explained on:
|
||||||
# http://about.travis-ci.org/docs/user/build-configuration/
|
# http://about.travis-ci.com/docs/user/build-configuration/
|
||||||
# This file can be validated on: http://www.yamllint.com/
|
# This file can be validated on: http://www.yamllint.com/
|
||||||
# Or using the Ruby based travel command line tool:
|
# Or using the Ruby based travel command line tool:
|
||||||
# gem install travis --no-rdoc --no-ri
|
# gem install travis --no-rdoc --no-ri
|
||||||
|
@ -64,7 +64,7 @@ ninja --version
|
|||||||
_COMPILER_NAME=`basename ${CXX}`
|
_COMPILER_NAME=`basename ${CXX}`
|
||||||
_BUILD_DIR_NAME="build-${BUILD_TYPE}_${LIB_TYPE}_${_COMPILER_NAME}"
|
_BUILD_DIR_NAME="build-${BUILD_TYPE}_${LIB_TYPE}_${_COMPILER_NAME}"
|
||||||
|
|
||||||
./.travis_scripts/run-clang-format.sh
|
#./.travis_scripts/run-clang-format.sh
|
||||||
meson --fatal-meson-warnings --werror --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} . "${_BUILD_DIR_NAME}"
|
meson --fatal-meson-warnings --werror --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} . "${_BUILD_DIR_NAME}"
|
||||||
ninja -v -j 2 -C "${_BUILD_DIR_NAME}"
|
ninja -v -j 2 -C "${_BUILD_DIR_NAME}"
|
||||||
|
|
||||||
|
37
BUILD.bazel
Normal file
37
BUILD.bazel
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
licenses(["unencumbered"]) # Public Domain or MIT
|
||||||
|
|
||||||
|
exports_files(["LICENSE"])
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "jsoncpp",
|
||||||
|
srcs = [
|
||||||
|
"src/lib_json/json_reader.cpp",
|
||||||
|
"src/lib_json/json_tool.h",
|
||||||
|
"src/lib_json/json_value.cpp",
|
||||||
|
"src/lib_json/json_writer.cpp",
|
||||||
|
],
|
||||||
|
hdrs = [
|
||||||
|
"include/json/allocator.h",
|
||||||
|
"include/json/assertions.h",
|
||||||
|
"include/json/config.h",
|
||||||
|
"include/json/json_features.h",
|
||||||
|
"include/json/forwards.h",
|
||||||
|
"include/json/json.h",
|
||||||
|
"include/json/reader.h",
|
||||||
|
"include/json/value.h",
|
||||||
|
"include/json/version.h",
|
||||||
|
"include/json/writer.h",
|
||||||
|
],
|
||||||
|
copts = [
|
||||||
|
"-DJSON_USE_EXCEPTION=0",
|
||||||
|
"-DJSON_HAS_INT64",
|
||||||
|
],
|
||||||
|
includes = ["include"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
deps = [":private"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "private",
|
||||||
|
textual_hdrs = ["src/lib_json/json_valueiterator.inl"],
|
||||||
|
)
|
@ -6,7 +6,7 @@
|
|||||||
# policies that provide successful builds. By setting JSONCPP_NEWEST_VALIDATED_POLICIES_VERSION
|
# policies that provide successful builds. By setting JSONCPP_NEWEST_VALIDATED_POLICIES_VERSION
|
||||||
# to a value greater than the oldest policies, all policies between
|
# to a value greater than the oldest policies, all policies between
|
||||||
# JSONCPP_OLDEST_VALIDATED_POLICIES_VERSION and CMAKE_VERSION (used for this build)
|
# JSONCPP_OLDEST_VALIDATED_POLICIES_VERSION and CMAKE_VERSION (used for this build)
|
||||||
# are set to their NEW behaivor, thereby suppressing policy warnings related to policies
|
# are set to their NEW behavior, thereby suppressing policy warnings related to policies
|
||||||
# between the JSONCPP_OLDEST_VALIDATED_POLICIES_VERSION and CMAKE_VERSION.
|
# between the JSONCPP_OLDEST_VALIDATED_POLICIES_VERSION and CMAKE_VERSION.
|
||||||
#
|
#
|
||||||
# CMake versions greater than the JSONCPP_NEWEST_VALIDATED_POLICIES_VERSION policies will
|
# CMake versions greater than the JSONCPP_NEWEST_VALIDATED_POLICIES_VERSION policies will
|
||||||
@ -72,11 +72,11 @@ project(jsoncpp
|
|||||||
# 2. ./include/json/version.h
|
# 2. ./include/json/version.h
|
||||||
# 3. ./CMakeLists.txt
|
# 3. ./CMakeLists.txt
|
||||||
# IMPORTANT: also update the PROJECT_SOVERSION!!
|
# IMPORTANT: also update the PROJECT_SOVERSION!!
|
||||||
VERSION 1.9.4 # <major>[.<minor>[.<patch>[.<tweak>]]]
|
VERSION 1.9.5 # <major>[.<minor>[.<patch>[.<tweak>]]]
|
||||||
LANGUAGES CXX)
|
LANGUAGES CXX)
|
||||||
|
|
||||||
message(STATUS "JsonCpp Version: ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
message(STATUS "JsonCpp Version: ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||||
set(PROJECT_SOVERSION 24)
|
set(PROJECT_SOVERSION 25)
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/include/PreventInSourceBuilds.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/include/PreventInSourceBuilds.cmake)
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/include/PreventInBuildInstalls.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/include/PreventInBuildInstalls.cmake)
|
||||||
@ -134,7 +134,11 @@ endif()
|
|||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
# using regular Clang or AppleClang
|
# using regular Clang or AppleClang
|
||||||
add_compile_options(-Wall -Wconversion -Wshadow -Werror=conversion -Werror=sign-compare)
|
add_compile_options(-Wall -Wconversion -Wshadow)
|
||||||
|
|
||||||
|
if(JSONCPP_WITH_WARNING_AS_ERROR)
|
||||||
|
add_compile_options(-Werror=conversion -Werror=sign-compare)
|
||||||
|
endif()
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
# using GCC
|
# using GCC
|
||||||
add_compile_options(-Wall -Wconversion -Wshadow -Wextra)
|
add_compile_options(-Wall -Wconversion -Wshadow -Wextra)
|
||||||
@ -148,9 +152,11 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
endif()
|
endif()
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||||
# using Intel compiler
|
# using Intel compiler
|
||||||
add_compile_options(-Wall -Wconversion -Wshadow -Wextra -Werror=conversion)
|
add_compile_options(-Wall -Wconversion -Wshadow -Wextra)
|
||||||
|
|
||||||
if(JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR)
|
if(JSONCPP_WITH_WARNING_AS_ERROR)
|
||||||
|
add_compile_options(-Werror=conversion)
|
||||||
|
elseif(JSONCPP_WITH_STRICT_ISO)
|
||||||
add_compile_options(-Wpedantic)
|
add_compile_options(-Wpedantic)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -177,11 +183,16 @@ if(JSONCPP_WITH_CMAKE_PACKAGE)
|
|||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
install(EXPORT jsoncpp
|
install(EXPORT jsoncpp
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp
|
||||||
FILE jsoncppConfig.cmake)
|
FILE jsoncpp-targets.cmake)
|
||||||
|
configure_package_config_file(jsoncppConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfig.cmake
|
||||||
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp)
|
||||||
|
|
||||||
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake"
|
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake"
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
COMPATIBILITY SameMajorVersion)
|
COMPATIBILITY SameMajorVersion)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake
|
install(FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/jsoncppConfig.cmake
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp-namespaced-targets.cmake
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ See `doxybuild.py --help` for options.
|
|||||||
To add a test, you need to create two files in test/data:
|
To add a test, you need to create two files in test/data:
|
||||||
|
|
||||||
* a `TESTNAME.json` file, that contains the input document in JSON format.
|
* a `TESTNAME.json` file, that contains the input document in JSON format.
|
||||||
* a `TESTNAME.expected` file, that contains a flatened representation of the
|
* a `TESTNAME.expected` file, that contains a flattened representation of the
|
||||||
input document.
|
input document.
|
||||||
|
|
||||||
The `TESTNAME.expected` file format is as follows:
|
The `TESTNAME.expected` file format is as follows:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "json/json.h"
|
#include "json/json.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <memory>
|
||||||
/**
|
/**
|
||||||
* \brief Parse a raw string into Value object using the CharReaderBuilder
|
* \brief Parse a raw string into Value object using the CharReaderBuilder
|
||||||
* class, or the legacy Reader class.
|
* class, or the legacy Reader class.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "json/json.h"
|
#include "json/json.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <memory>
|
||||||
/** \brief Write the Value object to a stream.
|
/** \brief Write the Value object to a stream.
|
||||||
* Example Usage:
|
* Example Usage:
|
||||||
* $g++ streamWrite.cpp -ljsoncpp -std=c++11 -o streamWrite
|
* $g++ streamWrite.cpp -ljsoncpp -std=c++11 -o streamWrite
|
||||||
|
@ -33,8 +33,7 @@ namespace Json {
|
|||||||
* \deprecated Use CharReader and CharReaderBuilder.
|
* \deprecated Use CharReader and CharReaderBuilder.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class JSONCPP_DEPRECATED(
|
class JSON_API Reader {
|
||||||
"Use CharReader and CharReaderBuilder instead.") JSON_API Reader {
|
|
||||||
public:
|
public:
|
||||||
using Char = char;
|
using Char = char;
|
||||||
using Location = const Char*;
|
using Location = const Char*;
|
||||||
@ -51,13 +50,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** \brief Constructs a Reader allowing all features for parsing.
|
/** \brief Constructs a Reader allowing all features for parsing.
|
||||||
|
* \deprecated Use CharReader and CharReaderBuilder.
|
||||||
*/
|
*/
|
||||||
JSONCPP_DEPRECATED("Use CharReader and CharReaderBuilder instead")
|
|
||||||
Reader();
|
Reader();
|
||||||
|
|
||||||
/** \brief Constructs a Reader allowing the specified feature set for parsing.
|
/** \brief Constructs a Reader allowing the specified feature set for parsing.
|
||||||
|
* \deprecated Use CharReader and CharReaderBuilder.
|
||||||
*/
|
*/
|
||||||
JSONCPP_DEPRECATED("Use CharReader and CharReaderBuilder instead")
|
|
||||||
Reader(const Features& features);
|
Reader(const Features& features);
|
||||||
|
|
||||||
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
|
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
|
||||||
@ -337,6 +336,9 @@ public:
|
|||||||
* - `"allowSpecialFloats": false or true`
|
* - `"allowSpecialFloats": false or true`
|
||||||
* - If true, special float values (NaNs and infinities) are allowed and
|
* - If true, special float values (NaNs and infinities) are allowed and
|
||||||
* their values are lossfree restorable.
|
* their values are lossfree restorable.
|
||||||
|
* - `"skipBom": false or true`
|
||||||
|
* - If true, if the input starts with the Unicode byte order mark (BOM),
|
||||||
|
* it is skipped.
|
||||||
*
|
*
|
||||||
* You can examine 'settings_` yourself to see the defaults. You can also
|
* You can examine 'settings_` yourself to see the defaults. You can also
|
||||||
* write and read them just like any JSON Value.
|
* write and read them just like any JSON Value.
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
// 3. /CMakeLists.txt
|
// 3. /CMakeLists.txt
|
||||||
// IMPORTANT: also update the SOVERSION!!
|
// IMPORTANT: also update the SOVERSION!!
|
||||||
|
|
||||||
#define JSONCPP_VERSION_STRING "1.9.4"
|
#define JSONCPP_VERSION_STRING "1.9.5"
|
||||||
#define JSONCPP_VERSION_MAJOR 1
|
#define JSONCPP_VERSION_MAJOR 1
|
||||||
#define JSONCPP_VERSION_MINOR 9
|
#define JSONCPP_VERSION_MINOR 9
|
||||||
#define JSONCPP_VERSION_PATCH 4
|
#define JSONCPP_VERSION_PATCH 5
|
||||||
#define JSONCPP_VERSION_QUALIFIER
|
#define JSONCPP_VERSION_QUALIFIER
|
||||||
#define JSONCPP_VERSION_HEXA \
|
#define JSONCPP_VERSION_HEXA \
|
||||||
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \
|
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \
|
||||||
|
@ -147,7 +147,7 @@ public:
|
|||||||
/** \brief Abstract class for writers.
|
/** \brief Abstract class for writers.
|
||||||
* \deprecated Use StreamWriter. (And really, this is an implementation detail.)
|
* \deprecated Use StreamWriter. (And really, this is an implementation detail.)
|
||||||
*/
|
*/
|
||||||
class JSONCPP_DEPRECATED("Use StreamWriter instead") JSON_API Writer {
|
class JSON_API Writer {
|
||||||
public:
|
public:
|
||||||
virtual ~Writer();
|
virtual ~Writer();
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ public:
|
|||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4996) // Deriving from deprecated class
|
#pragma warning(disable : 4996) // Deriving from deprecated class
|
||||||
#endif
|
#endif
|
||||||
class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter
|
class JSON_API FastWriter
|
||||||
: public Writer {
|
: public Writer {
|
||||||
public:
|
public:
|
||||||
FastWriter();
|
FastWriter();
|
||||||
@ -217,7 +217,7 @@ private:
|
|||||||
* - otherwise, it the values do not fit on one line, or the array contains
|
* - otherwise, it the values do not fit on one line, or the array contains
|
||||||
* object or non empty array, then print one value per line.
|
* object or non empty array, then print one value per line.
|
||||||
*
|
*
|
||||||
* If the Value have comments then they are outputed according to their
|
* If the Value have comments then they are outputted according to their
|
||||||
*#CommentPlacement.
|
*#CommentPlacement.
|
||||||
*
|
*
|
||||||
* \sa Reader, Value, Value::setComment()
|
* \sa Reader, Value, Value::setComment()
|
||||||
@ -227,7 +227,7 @@ private:
|
|||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4996) // Deriving from deprecated class
|
#pragma warning(disable : 4996) // Deriving from deprecated class
|
||||||
#endif
|
#endif
|
||||||
class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API
|
class JSON_API
|
||||||
StyledWriter : public Writer {
|
StyledWriter : public Writer {
|
||||||
public:
|
public:
|
||||||
StyledWriter();
|
StyledWriter();
|
||||||
@ -286,7 +286,7 @@ private:
|
|||||||
* - otherwise, it the values do not fit on one line, or the array contains
|
* - otherwise, it the values do not fit on one line, or the array contains
|
||||||
* object or non empty array, then print one value per line.
|
* object or non empty array, then print one value per line.
|
||||||
*
|
*
|
||||||
* If the Value have comments then they are outputed according to their
|
* If the Value have comments then they are outputted according to their
|
||||||
#CommentPlacement.
|
#CommentPlacement.
|
||||||
*
|
*
|
||||||
* \sa Reader, Value, Value::setComment()
|
* \sa Reader, Value, Value::setComment()
|
||||||
@ -296,7 +296,7 @@ private:
|
|||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4996) // Deriving from deprecated class
|
#pragma warning(disable : 4996) // Deriving from deprecated class
|
||||||
#endif
|
#endif
|
||||||
class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API
|
class JSON_API
|
||||||
StyledStreamWriter {
|
StyledStreamWriter {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
7
jsoncpp-namespaced-targets.cmake
Normal file
7
jsoncpp-namespaced-targets.cmake
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
if (TARGET jsoncpp_static)
|
||||||
|
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
|
||||||
|
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_static")
|
||||||
|
elseif (TARGET jsoncpp_lib)
|
||||||
|
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
|
||||||
|
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_lib")
|
||||||
|
endif ()
|
11
jsoncppConfig.cmake.in
Normal file
11
jsoncppConfig.cmake.in
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
cmake_policy(PUSH)
|
||||||
|
cmake_policy(VERSION 3.0)
|
||||||
|
|
||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
include ( "${CMAKE_CURRENT_LIST_DIR}/jsoncpp-targets.cmake" )
|
||||||
|
include ( "${CMAKE_CURRENT_LIST_DIR}/jsoncpp-namespaced-targets.cmake" )
|
||||||
|
|
||||||
|
check_required_components(JsonCpp)
|
||||||
|
|
||||||
|
cmake_policy(POP)
|
@ -50,7 +50,7 @@ jsoncpp_lib = library(
|
|||||||
'src/lib_json/json_value.cpp',
|
'src/lib_json/json_value.cpp',
|
||||||
'src/lib_json/json_writer.cpp',
|
'src/lib_json/json_writer.cpp',
|
||||||
]),
|
]),
|
||||||
soversion : 24,
|
soversion : 25,
|
||||||
install : true,
|
install : true,
|
||||||
include_directories : jsoncpp_include_directories,
|
include_directories : jsoncpp_include_directories,
|
||||||
cpp_args: dll_export_flag)
|
cpp_args: dll_export_flag)
|
||||||
|
@ -11,20 +11,10 @@ include(CheckCXXSymbolExists)
|
|||||||
check_include_file_cxx(clocale HAVE_CLOCALE)
|
check_include_file_cxx(clocale HAVE_CLOCALE)
|
||||||
check_cxx_symbol_exists(localeconv clocale HAVE_LOCALECONV)
|
check_cxx_symbol_exists(localeconv clocale HAVE_LOCALECONV)
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.0.0)
|
set(CMAKE_EXTRA_INCLUDE_FILES clocale)
|
||||||
# The "LANGUAGE CXX" parameter is not supported in CMake versions below 3,
|
check_type_size(lconv LCONV_SIZE LANGUAGE CXX)
|
||||||
# so the C compiler and header has to be used.
|
unset(CMAKE_EXTRA_INCLUDE_FILES)
|
||||||
check_include_file(locale.h HAVE_LOCALE_H)
|
check_struct_has_member(lconv decimal_point clocale HAVE_DECIMAL_POINT LANGUAGE CXX)
|
||||||
set(CMAKE_EXTRA_INCLUDE_FILES locale.h)
|
|
||||||
check_type_size("struct lconv" LCONV_SIZE)
|
|
||||||
unset(CMAKE_EXTRA_INCLUDE_FILES)
|
|
||||||
check_struct_has_member("struct lconv" decimal_point locale.h HAVE_DECIMAL_POINT)
|
|
||||||
else()
|
|
||||||
set(CMAKE_EXTRA_INCLUDE_FILES clocale)
|
|
||||||
check_type_size(lconv LCONV_SIZE LANGUAGE CXX)
|
|
||||||
unset(CMAKE_EXTRA_INCLUDE_FILES)
|
|
||||||
check_struct_has_member(lconv decimal_point clocale HAVE_DECIMAL_POINT LANGUAGE CXX)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT (HAVE_CLOCALE AND HAVE_LCONV_SIZE AND HAVE_DECIMAL_POINT AND HAVE_LOCALECONV))
|
if(NOT (HAVE_CLOCALE AND HAVE_LCONV_SIZE AND HAVE_DECIMAL_POINT AND HAVE_LOCALECONV))
|
||||||
message(WARNING "Locale functionality is not supported")
|
message(WARNING "Locale functionality is not supported")
|
||||||
@ -129,7 +119,7 @@ if(BUILD_SHARED_LIBS)
|
|||||||
OUTPUT_NAME jsoncpp
|
OUTPUT_NAME jsoncpp
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
SOVERSION ${PROJECT_SOVERSION}
|
SOVERSION ${PROJECT_SOVERSION}
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set library's runtime search path on OSX
|
# Set library's runtime search path on OSX
|
||||||
@ -139,13 +129,11 @@ if(BUILD_SHARED_LIBS)
|
|||||||
|
|
||||||
target_compile_features(${SHARED_LIB} PUBLIC ${REQUIRED_FEATURES})
|
target_compile_features(${SHARED_LIB} PUBLIC ${REQUIRED_FEATURES})
|
||||||
|
|
||||||
if(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
target_include_directories(${SHARED_LIB} PUBLIC
|
||||||
target_include_directories(${SHARED_LIB} PUBLIC
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/json>
|
||||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/json>
|
)
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND CMAKE_TARGETS ${SHARED_LIB})
|
list(APPEND CMAKE_TARGETS ${SHARED_LIB})
|
||||||
endif()
|
endif()
|
||||||
@ -154,7 +142,7 @@ if(BUILD_STATIC_LIBS)
|
|||||||
set(STATIC_LIB ${PROJECT_NAME}_static)
|
set(STATIC_LIB ${PROJECT_NAME}_static)
|
||||||
add_library(${STATIC_LIB} STATIC ${PUBLIC_HEADERS} ${JSONCPP_SOURCES})
|
add_library(${STATIC_LIB} STATIC ${PUBLIC_HEADERS} ${JSONCPP_SOURCES})
|
||||||
|
|
||||||
# avoid name clashes on windows as the shared import lib is alse 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 (MSVC)
|
if (MSVC)
|
||||||
set(STATIC_SUFFIX "_static")
|
set(STATIC_SUFFIX "_static")
|
||||||
@ -175,13 +163,11 @@ if(BUILD_STATIC_LIBS)
|
|||||||
|
|
||||||
target_compile_features(${STATIC_LIB} PUBLIC ${REQUIRED_FEATURES})
|
target_compile_features(${STATIC_LIB} PUBLIC ${REQUIRED_FEATURES})
|
||||||
|
|
||||||
if(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
target_include_directories(${STATIC_LIB} PUBLIC
|
||||||
target_include_directories(${STATIC_LIB} PUBLIC
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/json>
|
||||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/json>
|
)
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND CMAKE_TARGETS ${STATIC_LIB})
|
list(APPEND CMAKE_TARGETS ${STATIC_LIB})
|
||||||
endif()
|
endif()
|
||||||
@ -194,7 +180,7 @@ if(BUILD_OBJECT_LIBS)
|
|||||||
OUTPUT_NAME jsoncpp
|
OUTPUT_NAME jsoncpp
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
SOVERSION ${PROJECT_SOVERSION}
|
SOVERSION ${PROJECT_SOVERSION}
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set library's runtime search path on OSX
|
# Set library's runtime search path on OSX
|
||||||
@ -204,13 +190,11 @@ if(BUILD_OBJECT_LIBS)
|
|||||||
|
|
||||||
target_compile_features(${OBJECT_LIB} PUBLIC ${REQUIRED_FEATURES})
|
target_compile_features(${OBJECT_LIB} PUBLIC ${REQUIRED_FEATURES})
|
||||||
|
|
||||||
if(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
target_include_directories(${OBJECT_LIB} PUBLIC
|
||||||
target_include_directories(${OBJECT_LIB} PUBLIC
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/json>
|
||||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/json>
|
)
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND CMAKE_TARGETS ${OBJECT_LIB})
|
list(APPEND CMAKE_TARGETS ${OBJECT_LIB})
|
||||||
endif()
|
endif()
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#endif // if !defined(JSON_IS_AMALGAMATION)
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
@ -104,8 +105,7 @@ bool Reader::parse(std::istream& is, Value& root, bool collectComments) {
|
|||||||
|
|
||||||
// Since String is reference-counted, this at least does not
|
// Since String is reference-counted, this at least does not
|
||||||
// create an extra copy.
|
// create an extra copy.
|
||||||
String doc;
|
String doc(std::istreambuf_iterator<char>(is), {});
|
||||||
std::getline(is, doc, static_cast<char> EOF);
|
|
||||||
return parse(doc.data(), doc.data() + doc.size(), root, collectComments);
|
return parse(doc.data(), doc.data() + doc.size(), root, collectComments);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,9 +601,15 @@ bool Reader::decodeDouble(Token& token, Value& decoded) {
|
|||||||
double value = 0;
|
double value = 0;
|
||||||
String buffer(token.start_, token.end_);
|
String buffer(token.start_, token.end_);
|
||||||
IStringStream is(buffer);
|
IStringStream is(buffer);
|
||||||
if (!(is >> value))
|
if (!(is >> value)) {
|
||||||
return addError(
|
if (value == std::numeric_limits<double>::max())
|
||||||
|
value = std::numeric_limits<double>::infinity();
|
||||||
|
else if (value == std::numeric_limits<double>::lowest())
|
||||||
|
value = -std::numeric_limits<double>::infinity();
|
||||||
|
else if (!std::isinf(value))
|
||||||
|
return addError(
|
||||||
"'" + String(token.start_, token.end_) + "' is not a number.", token);
|
"'" + String(token.start_, token.end_) + "' is not a number.", token);
|
||||||
|
}
|
||||||
decoded = value;
|
decoded = value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1603,7 +1609,7 @@ bool OurReader::decodeNumber(Token& token, Value& decoded) {
|
|||||||
const auto digit(static_cast<Value::UInt>(c - '0'));
|
const auto digit(static_cast<Value::UInt>(c - '0'));
|
||||||
if (value >= threshold) {
|
if (value >= threshold) {
|
||||||
// We've hit or exceeded the max value divided by 10 (rounded down). If
|
// We've hit or exceeded the max value divided by 10 (rounded down). If
|
||||||
// a) we've only just touched the limit, meaing value == threshold,
|
// a) we've only just touched the limit, meaning value == threshold,
|
||||||
// b) this is the last digit, or
|
// b) this is the last digit, or
|
||||||
// c) it's small enough to fit in that rounding delta, we're okay.
|
// c) it's small enough to fit in that rounding delta, we're okay.
|
||||||
// Otherwise treat this number as a double to avoid overflow.
|
// Otherwise treat this number as a double to avoid overflow.
|
||||||
@ -1643,7 +1649,12 @@ bool OurReader::decodeDouble(Token& token, Value& decoded) {
|
|||||||
const String buffer(token.start_, token.end_);
|
const String buffer(token.start_, token.end_);
|
||||||
IStringStream is(buffer);
|
IStringStream is(buffer);
|
||||||
if (!(is >> value)) {
|
if (!(is >> value)) {
|
||||||
return addError(
|
if (value == std::numeric_limits<double>::max())
|
||||||
|
value = std::numeric_limits<double>::infinity();
|
||||||
|
else if (value == std::numeric_limits<double>::lowest())
|
||||||
|
value = -std::numeric_limits<double>::infinity();
|
||||||
|
else if (!std::isinf(value))
|
||||||
|
return addError(
|
||||||
"'" + String(token.start_, token.end_) + "' is not a number.", token);
|
"'" + String(token.start_, token.end_) + "' is not a number.", token);
|
||||||
}
|
}
|
||||||
decoded = value;
|
decoded = value;
|
||||||
|
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
/// Removes the last PredicateContext added to the predicate stack
|
/// Removes the last PredicateContext added to the predicate stack
|
||||||
/// chained list.
|
/// chained list.
|
||||||
/// Next messages will be targed at the PredicateContext that was removed.
|
/// Next messages will be targeted at the PredicateContext that was removed.
|
||||||
TestResult& popPredicateContext();
|
TestResult& popPredicateContext();
|
||||||
|
|
||||||
bool failed() const;
|
bool failed() const;
|
||||||
|
3
test/data/legacy_test_real_13.expected
Normal file
3
test/data/legacy_test_real_13.expected
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.=[]
|
||||||
|
.[0]=-inf
|
||||||
|
.[1]=inf
|
1
test/data/legacy_test_real_13.json
Normal file
1
test/data/legacy_test_real_13.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[-1e+9999, 1e+9999]
|
Loading…
Reference in New Issue
Block a user