mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-15 23:20:05 +02:00
Compare commits
171 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5ec82e482c | ||
![]() |
b84332249b | ||
![]() |
cb3b38c3ea | ||
![]() |
226f7a2b6b | ||
![]() |
d2fc18af7f | ||
![]() |
aec261a899 | ||
![]() |
20564b3f0c | ||
![]() |
0fc51120c0 | ||
![]() |
4a984c24b5 | ||
![]() |
2f9a6a682c | ||
![]() |
26159b96f1 | ||
![]() |
e105003bb5 | ||
![]() |
dde8426ded | ||
![]() |
ecfd658e6a | ||
![]() |
eec6794106 | ||
![]() |
0ea25978d5 | ||
![]() |
9297822cde | ||
![]() |
a4354d782b | ||
![]() |
a7b80fea65 | ||
![]() |
8bdb07dd52 | ||
![]() |
22dade5c97 | ||
![]() |
1380aff595 | ||
![]() |
8644269675 | ||
![]() |
28dcc3589a | ||
![]() |
aaf3417654 | ||
![]() |
22ec823cc7 | ||
![]() |
ffea45bbe1 | ||
![]() |
1b32e3e869 | ||
![]() |
18e4d04e8e | ||
![]() |
d84702c903 | ||
![]() |
949babd7b0 | ||
![]() |
6ed877c77c | ||
![]() |
1c69568f8d | ||
![]() |
770fdda28b | ||
![]() |
d48bff5fcb | ||
![]() |
93d74678da | ||
![]() |
ed5d73fe1d | ||
![]() |
b97e624ac1 | ||
![]() |
542354902e | ||
![]() |
17360f3d4b | ||
![]() |
75747db30c | ||
![]() |
81cf237917 | ||
![]() |
cac79543f8 | ||
![]() |
d8186f36a6 | ||
![]() |
7f240623d3 | ||
![]() |
784433ac72 | ||
![]() |
7275e3ce3c | ||
![]() |
46aa9d75fa | ||
![]() |
f94a0e8989 | ||
![]() |
e22a2f36f7 | ||
![]() |
fac87108a4 | ||
![]() |
14fc9f124e | ||
![]() |
658fa37e63 | ||
![]() |
02839ef5b1 | ||
![]() |
138c48b7e8 | ||
![]() |
72fb4a5b08 | ||
![]() |
c6fa959318 | ||
![]() |
056e5f9b64 | ||
![]() |
d8e8c14ffc | ||
![]() |
fb1301274f | ||
![]() |
f4e6fccd46 | ||
![]() |
7670e5151b | ||
![]() |
2e185081b2 | ||
![]() |
cb8259f545 | ||
![]() |
bb5d0249ed | ||
![]() |
710260d070 | ||
![]() |
2428889813 | ||
![]() |
89704039a0 | ||
![]() |
dbda2aa36f | ||
![]() |
ef38374e99 | ||
![]() |
f1cafb6ded | ||
![]() |
a13303e456 | ||
![]() |
7bc97db496 | ||
![]() |
6ca8ffcb91 | ||
![]() |
b5e70f950e | ||
![]() |
b26804d1c2 | ||
![]() |
702a539762 | ||
![]() |
81cb7e5c5b | ||
![]() |
d259f608fd | ||
![]() |
4652f818fe | ||
![]() |
ce32274ba5 | ||
![]() |
717c791d4e | ||
![]() |
17181acf74 | ||
![]() |
6e52e272da | ||
![]() |
6416350438 | ||
![]() |
07623b71f2 | ||
![]() |
bcb83b921c | ||
![]() |
f1ff13767c | ||
![]() |
2760c7902a | ||
![]() |
3f05b1a897 | ||
![]() |
de2c85f576 | ||
![]() |
b389d81bf9 | ||
![]() |
89c51f3457 | ||
![]() |
e6f1cffdd3 | ||
![]() |
64441486ac | ||
![]() |
d5e54d2609 | ||
![]() |
97e093a361 | ||
![]() |
d57ac97db8 | ||
![]() |
31e9962754 | ||
![]() |
f40dd0f3ed | ||
![]() |
5256551b03 | ||
![]() |
6649009ffa | ||
![]() |
2a10f4a3b8 | ||
![]() |
c334ac0376 | ||
![]() |
28d086e1d9 | ||
![]() |
a0a7c5f6de | ||
![]() |
fcbab02e4a | ||
![]() |
f4ee48bc21 | ||
![]() |
88184d142b | ||
![]() |
ae177fd901 | ||
![]() |
3f6345234f | ||
![]() |
a53070c42b | ||
![]() |
c09e121aeb | ||
![]() |
4f8ec9d207 | ||
![]() |
0fe61a68f8 | ||
![]() |
43019088f0 | ||
![]() |
0c1c076b7c | ||
![]() |
11130997c3 | ||
![]() |
30bb4ccb67 | ||
![]() |
74143f39e7 | ||
![]() |
56650e83c5 | ||
![]() |
c66cc277f5 | ||
![]() |
441f8cdfa1 | ||
![]() |
a658759039 | ||
![]() |
0eb0e502c8 | ||
![]() |
e983204906 | ||
![]() |
fe06acb587 | ||
![]() |
1b49a55ea1 | ||
![]() |
13c36e9807 | ||
![]() |
db7ad75794 | ||
![]() |
f4bdc1b602 | ||
![]() |
93f45d065c | ||
![]() |
6f6ddaa91c | ||
![]() |
254fe6a07a | ||
![]() |
00d7bea0f6 | ||
![]() |
a9d06d2650 | ||
![]() |
1c4f6a2d79 | ||
![]() |
e49bd30950 | ||
![]() |
13d78e3da3 | ||
![]() |
50069d72da | ||
![]() |
24682e37bf | ||
![]() |
c2b988ee74 | ||
![]() |
e255ce31a4 | ||
![]() |
779b5bc5ba | ||
![]() |
63860617b3 | ||
![]() |
9cb88d2ca6 | ||
![]() |
363e51c0a9 | ||
![]() |
240ddb6a1b | ||
![]() |
9dd77dc0ef | ||
![]() |
244b1496e1 | ||
![]() |
c083835261 | ||
![]() |
cbe7e7c9cb | ||
![]() |
be183def8f | ||
![]() |
951bd3d05d | ||
![]() |
1c58876185 | ||
![]() |
2f2034629e | ||
![]() |
7020451b44 | ||
![]() |
80497f102e | ||
![]() |
f9feb66be2 | ||
![]() |
ed495edcc1 | ||
![]() |
3c0a383877 | ||
![]() |
5003983029 | ||
![]() |
871b311e7e | ||
![]() |
cdbc35f6ac | ||
![]() |
4e30c4fcdb | ||
![]() |
0d33cb3639 | ||
![]() |
2250b3c29d | ||
![]() |
9376368d86 | ||
![]() |
5383794cc9 | ||
![]() |
75279ccec2 | ||
![]() |
717b08695e |
11
.gitattributes
vendored
Normal file
11
.gitattributes
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
* text=auto
|
||||||
|
*.h text
|
||||||
|
*.cpp text
|
||||||
|
*.json text
|
||||||
|
*.in text
|
||||||
|
*.sh eol=lf
|
||||||
|
*.bat eol=crlf
|
||||||
|
*.vcproj eol=crlf
|
||||||
|
*.vcxproj eol=crlf
|
||||||
|
*.sln eol=crlf
|
||||||
|
devtools/agent_vm* eol=crlf
|
33
.travis.yml
33
.travis.yml
@@ -2,16 +2,41 @@
|
|||||||
# http://about.travis-ci.org/docs/user/build-configuration/
|
# http://about.travis-ci.org/docs/user/build-configuration/
|
||||||
# This file can be validated on:
|
# This file can be validated on:
|
||||||
# http://lint.travis-ci.org/
|
# http://lint.travis-ci.org/
|
||||||
before_install: sudo apt-get install cmake
|
# See also
|
||||||
|
# http://stackoverflow.com/questions/22111549/travis-ci-with-clang-3-4-and-c11/30925448#30925448
|
||||||
|
# to allow C++11, though we are not yet building with -std=c++11
|
||||||
|
|
||||||
|
install:
|
||||||
|
# /usr/bin/gcc is 4.6 always, but gcc-X.Y is available.
|
||||||
|
#- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
|
||||||
|
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.6" CC="gcc-4.6"; fi
|
||||||
|
# /usr/bin/clang is our version already, and clang-X.Y does not exist.
|
||||||
|
#- if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.0" CC="clang-3.0"; fi
|
||||||
|
- echo ${PATH}
|
||||||
|
- ls /usr/local
|
||||||
|
- export PATH=/usr/bin:${PATH}
|
||||||
|
- echo ${CXX}
|
||||||
|
- ${CXX} --version
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
- gcc-4.6
|
||||||
|
- g++-4.6
|
||||||
|
- clang
|
||||||
|
- valgrind
|
||||||
|
os:
|
||||||
|
- linux
|
||||||
language: cpp
|
language: cpp
|
||||||
compiler:
|
compiler:
|
||||||
- gcc
|
- gcc
|
||||||
- clang
|
- clang
|
||||||
script: cmake -DJSONCPP_WITH_CMAKE_PACKAGE=$CMAKE_PKG -DJSONCPP_LIB_BUILD_SHARED=$SHARED_LIB -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_VERBOSE_MAKEFILE=$VERBOSE_MAKE . && make && make jsoncpp_check
|
script: ./travis.sh
|
||||||
env:
|
env:
|
||||||
matrix:
|
matrix:
|
||||||
- SHARED_LIB=ON STATIC_LIB=ON CMAKE_PKG=ON BUILD_TYPE=release VERBOSE_MAKE=false
|
- SHARED_LIB=ON STATIC_LIB=ON CMAKE_PKG=ON BUILD_TYPE=release VERBOSE_MAKE=false
|
||||||
- SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE_MAKE=true VERBOSE
|
- SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE_MAKE=true VERBOSE
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email: false
|
||||||
- aaronjjacobs@gmail.com
|
sudo: false
|
||||||
|
@@ -9,6 +9,10 @@ OPTION(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post
|
|||||||
OPTION(JSONCPP_WITH_WARNING_AS_ERROR "Force compilation to fail if a warning occurs" OFF)
|
OPTION(JSONCPP_WITH_WARNING_AS_ERROR "Force compilation to fail if a warning occurs" OFF)
|
||||||
OPTION(JSONCPP_WITH_PKGCONFIG_SUPPORT "Generate and install .pc files" ON)
|
OPTION(JSONCPP_WITH_PKGCONFIG_SUPPORT "Generate and install .pc files" ON)
|
||||||
OPTION(JSONCPP_WITH_CMAKE_PACKAGE "Generate and install cmake package files" OFF)
|
OPTION(JSONCPP_WITH_CMAKE_PACKAGE "Generate and install cmake package files" OFF)
|
||||||
|
OPTION(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." OFF)
|
||||||
|
OPTION(BUILD_STATIC_LIBS "Build jsoncpp_lib static library." ON)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
# Ensures that CMAKE_BUILD_TYPE is visible in cmake-gui on Unix
|
# Ensures that CMAKE_BUILD_TYPE is visible in cmake-gui on Unix
|
||||||
IF(NOT WIN32)
|
IF(NOT WIN32)
|
||||||
@@ -16,18 +20,19 @@ IF(NOT WIN32)
|
|||||||
SET(CMAKE_BUILD_TYPE Release CACHE STRING
|
SET(CMAKE_BUILD_TYPE Release CACHE STRING
|
||||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage."
|
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage."
|
||||||
FORCE)
|
FORCE)
|
||||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
ENDIF()
|
||||||
ENDIF(NOT WIN32)
|
ENDIF()
|
||||||
|
|
||||||
|
SET(DEBUG_LIBNAME_SUFFIX "" CACHE STRING "Optional suffix to append to the library name for a debug build")
|
||||||
SET(LIB_SUFFIX "" CACHE STRING "Optional arch-dependent suffix for the library installation directory")
|
SET(LIB_SUFFIX "" CACHE STRING "Optional arch-dependent suffix for the library installation directory")
|
||||||
|
|
||||||
SET(RUNTIME_INSTALL_DIR bin
|
SET(RUNTIME_INSTALL_DIR bin
|
||||||
CACHE PATH "Install dir for executables and dlls")
|
CACHE PATH "Install dir for executables and dlls")
|
||||||
SET(ARCHIVE_INSTALL_DIR lib${LIB_SUFFIX}
|
SET(ARCHIVE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
|
||||||
CACHE PATH "Install dir for static libraries")
|
CACHE PATH "Install dir for static libraries")
|
||||||
SET(LIBRARY_INSTALL_DIR lib${LIB_SUFFIX}
|
SET(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
|
||||||
CACHE PATH "Install dir for shared libraries")
|
CACHE PATH "Install dir for shared libraries")
|
||||||
SET(INCLUDE_INSTALL_DIR include
|
SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/jsoncpp
|
||||||
CACHE PATH "Install dir for headers")
|
CACHE PATH "Install dir for headers")
|
||||||
SET(PACKAGE_INSTALL_DIR lib${LIB_SUFFIX}/cmake
|
SET(PACKAGE_INSTALL_DIR lib${LIB_SUFFIX}/cmake
|
||||||
CACHE PATH "Install dir for cmake package config files")
|
CACHE PATH "Install dir for cmake package config files")
|
||||||
@@ -36,7 +41,7 @@ MARK_AS_ADVANCED( RUNTIME_INSTALL_DIR ARCHIVE_INSTALL_DIR INCLUDE_INSTALL_DIR PA
|
|||||||
# Set variable named ${VAR_NAME} to value ${VALUE}
|
# Set variable named ${VAR_NAME} to value ${VALUE}
|
||||||
FUNCTION(set_using_dynamic_name VAR_NAME VALUE)
|
FUNCTION(set_using_dynamic_name VAR_NAME VALUE)
|
||||||
SET( "${VAR_NAME}" "${VALUE}" PARENT_SCOPE)
|
SET( "${VAR_NAME}" "${VALUE}" PARENT_SCOPE)
|
||||||
ENDFUNCTION(set_using_dynamic_name)
|
ENDFUNCTION()
|
||||||
|
|
||||||
# Extract major, minor, patch from version text
|
# Extract major, minor, patch from version text
|
||||||
# Parse a version string "X.Y.Z" and outputs
|
# Parse a version string "X.Y.Z" and outputs
|
||||||
@@ -52,15 +57,15 @@ MACRO(jsoncpp_parse_version VERSION_TEXT OUPUT_PREFIX)
|
|||||||
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" TRUE )
|
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" TRUE )
|
||||||
ELSE( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
|
ELSE( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
|
||||||
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" FALSE )
|
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" FALSE )
|
||||||
ENDIF( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
|
ENDIF()
|
||||||
ENDMACRO(jsoncpp_parse_version)
|
ENDMACRO()
|
||||||
|
|
||||||
# Read out version from "version" file
|
# Read out version from "version" file
|
||||||
#FILE(STRINGS "version" JSONCPP_VERSION)
|
#FILE(STRINGS "version" JSONCPP_VERSION)
|
||||||
#SET( JSONCPP_VERSION_MAJOR X )
|
#SET( JSONCPP_VERSION_MAJOR X )
|
||||||
#SET( JSONCPP_VERSION_MINOR Y )
|
#SET( JSONCPP_VERSION_MINOR Y )
|
||||||
#SET( JSONCPP_VERSION_PATCH Z )
|
#SET( JSONCPP_VERSION_PATCH Z )
|
||||||
SET( JSONCPP_VERSION 0.9.4 )
|
SET( JSONCPP_VERSION 0.10.6 )
|
||||||
jsoncpp_parse_version( ${JSONCPP_VERSION} JSONCPP_VERSION )
|
jsoncpp_parse_version( ${JSONCPP_VERSION} JSONCPP_VERSION )
|
||||||
#IF(NOT JSONCPP_VERSION_FOUND)
|
#IF(NOT JSONCPP_VERSION_FOUND)
|
||||||
# MESSAGE(FATAL_ERROR "Failed to parse version string properly. Expect X.Y.Z")
|
# MESSAGE(FATAL_ERROR "Failed to parse version string properly. Expect X.Y.Z")
|
||||||
@@ -76,11 +81,13 @@ CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/version.in"
|
|||||||
NEWLINE_STYLE UNIX )
|
NEWLINE_STYLE UNIX )
|
||||||
|
|
||||||
macro(UseCompilationWarningAsError)
|
macro(UseCompilationWarningAsError)
|
||||||
if ( MSVC )
|
if ( MSVC )
|
||||||
# Only enabled in debug because some old versions of VS STL generate
|
# Only enabled in debug because some old versions of VS STL generate
|
||||||
# warnings when compiled in release configuration.
|
# warnings when compiled in release configuration.
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /WX ")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /WX ")
|
||||||
endif( MSVC )
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_XX_COMPILER_ID MATCHES "Clang" )
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Include our configuration header
|
# Include our configuration header
|
||||||
@@ -90,19 +97,20 @@ if ( MSVC )
|
|||||||
# Only enabled in debug because some old versions of VS STL generate
|
# Only enabled in debug because some old versions of VS STL generate
|
||||||
# unreachable code warning when compiled in release configuration.
|
# unreachable code warning when compiled in release configuration.
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W4 ")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W4 ")
|
||||||
endif( MSVC )
|
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
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wshadow -Wshorten-64-to-32")
|
||||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
# using GCC
|
# using GCC
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wshadow -Wextra -pedantic -Wno-long-long")
|
||||||
|
# not yet ready for -Wsign-conversion
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
IF(JSONCPP_WITH_WARNING_AS_ERROR)
|
IF(JSONCPP_WITH_WARNING_AS_ERROR)
|
||||||
UseCompilationWarningAsError()
|
UseCompilationWarningAsError()
|
||||||
ENDIF(JSONCPP_WITH_WARNING_AS_ERROR)
|
ENDIF()
|
||||||
|
|
||||||
IF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
IF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
||||||
CONFIGURE_FILE(
|
CONFIGURE_FILE(
|
||||||
@@ -110,14 +118,14 @@ IF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
|||||||
"pkg-config/jsoncpp.pc"
|
"pkg-config/jsoncpp.pc"
|
||||||
@ONLY)
|
@ONLY)
|
||||||
INSTALL(FILES "${CMAKE_BINARY_DIR}/pkg-config/jsoncpp.pc"
|
INSTALL(FILES "${CMAKE_BINARY_DIR}/pkg-config/jsoncpp.pc"
|
||||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig")
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||||
ENDIF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
ENDIF()
|
||||||
|
|
||||||
IF(JSONCPP_WITH_CMAKE_PACKAGE)
|
IF(JSONCPP_WITH_CMAKE_PACKAGE)
|
||||||
INSTALL(EXPORT jsoncpp
|
INSTALL(EXPORT jsoncpp
|
||||||
DESTINATION ${PACKAGE_INSTALL_DIR}/jsoncpp
|
DESTINATION ${PACKAGE_INSTALL_DIR}/jsoncpp
|
||||||
FILE jsoncppConfig.cmake)
|
FILE jsoncppConfig.cmake)
|
||||||
ENDIF(JSONCPP_WITH_CMAKE_PACKAGE)
|
ENDIF()
|
||||||
|
|
||||||
# Build the different applications
|
# Build the different applications
|
||||||
ADD_SUBDIRECTORY( src )
|
ADD_SUBDIRECTORY( src )
|
||||||
|
68
README.md
68
README.md
@@ -19,12 +19,14 @@ format to store user input files.
|
|||||||
* `0.y.z` can be used with older compilers.
|
* `0.y.z` can be used with older compilers.
|
||||||
* Major versions maintain binary-compatibility.
|
* Major versions maintain binary-compatibility.
|
||||||
|
|
||||||
Using JsonCpp in your project
|
# Using JsonCpp in your project
|
||||||
-----------------------------
|
-----------------------------
|
||||||
The recommended approach to integrating JsonCpp in your project is to build
|
The recommended approach to integrating JsonCpp in your project is to include
|
||||||
the amalgamated source (a single `.cpp` file) with your own build system. This
|
the [amalgamated source](#generating-amalgamated-source-and-header) (a single
|
||||||
ensures consistency of compilation flags and ABI compatibility. See the section
|
`.cpp` file and two `.h` files) in your project, and compile and build as you
|
||||||
"Generating amalgamated source and header" for instructions.
|
would any other source file. This ensures consistency of compilation flags and
|
||||||
|
ABI compatibility, issues which arise when building shared or static
|
||||||
|
libraries. See the next section for instructions.
|
||||||
|
|
||||||
The `include/` should be added to your compiler include path. Jsoncpp headers
|
The `include/` should be added to your compiler include path. Jsoncpp headers
|
||||||
should be included as follow:
|
should be included as follow:
|
||||||
@@ -34,6 +36,31 @@ should be included as follow:
|
|||||||
If JsonCpp was built as a dynamic library on Windows, then your project needs to
|
If JsonCpp was built as a dynamic library on Windows, then your project needs to
|
||||||
define the macro `JSON_DLL`.
|
define the macro `JSON_DLL`.
|
||||||
|
|
||||||
|
Generating amalgamated source and header
|
||||||
|
----------------------------------------
|
||||||
|
JsonCpp is provided with a script to generate a single header and a single
|
||||||
|
source file to ease inclusion into an existing project. The amalgamated source
|
||||||
|
can be generated at any time by running the following command from the
|
||||||
|
top-directory (this requires Python 2.6):
|
||||||
|
|
||||||
|
python amalgamate.py
|
||||||
|
|
||||||
|
It is possible to specify header name. See the `-h` option for detail.
|
||||||
|
|
||||||
|
By default, the following files are generated:
|
||||||
|
* `dist/jsoncpp.cpp`: source file that needs to be added to your project.
|
||||||
|
* `dist/json/json.h`: corresponding header file for use in your project. It is
|
||||||
|
equivalent to including `json/json.h` in non-amalgamated source. This header
|
||||||
|
only depends on standard headers.
|
||||||
|
* `dist/json/json-forwards.h`: header that provides forward declaration of all
|
||||||
|
JsonCpp types.
|
||||||
|
|
||||||
|
The amalgamated sources are generated by concatenating JsonCpp source in the
|
||||||
|
correct order and defining the macro `JSON_IS_AMALGAMATION` to prevent inclusion
|
||||||
|
of other headers.
|
||||||
|
|
||||||
|
# Contributing to JsonCpp
|
||||||
|
|
||||||
Building and testing with CMake
|
Building and testing with CMake
|
||||||
-------------------------------
|
-------------------------------
|
||||||
[CMake][] is a C++ Makefiles/Solution generator. It is usually available on most
|
[CMake][] is a C++ Makefiles/Solution generator. It is usually available on most
|
||||||
@@ -58,7 +85,7 @@ Steps for generating solution/makefiles using `cmake-gui`:
|
|||||||
* Make "source code" point to the source directory.
|
* Make "source code" point to the source directory.
|
||||||
* Make "where to build the binary" point to the directory to use for the build.
|
* Make "where to build the binary" point to the directory to use for the build.
|
||||||
* Click on the "Grouped" check box.
|
* Click on the "Grouped" check box.
|
||||||
* Review JsonCpp build options (tick `JSONCPP_LIB_BUILD_SHARED` to build as a
|
* Review JsonCpp build options (tick `BUILD_SHARED_LIBS` to build as a
|
||||||
dynamic library).
|
dynamic library).
|
||||||
* Click the configure button at the bottom, then the generate button.
|
* Click the configure button at the bottom, then the generate button.
|
||||||
* The generated solution/makefiles can be found in the binary directory.
|
* The generated solution/makefiles can be found in the binary directory.
|
||||||
@@ -67,10 +94,10 @@ Alternatively, from the command-line on Unix in the source directory:
|
|||||||
|
|
||||||
mkdir -p build/debug
|
mkdir -p build/debug
|
||||||
cd build/debug
|
cd build/debug
|
||||||
cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_STATIC=ON -DJSONCPP_LIB_BUILD_SHARED=OFF -G "Unix Makefiles" ../..
|
cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" ../..
|
||||||
make
|
make
|
||||||
|
|
||||||
Running `cmake -`" will display the list of available generators (passed using
|
Running `cmake -h` will display the list of available generators (passed using
|
||||||
the `-G` option).
|
the `-G` option).
|
||||||
|
|
||||||
By default CMake hides compilation commands. This can be modified by specifying
|
By default CMake hides compilation commands. This can be modified by specifying
|
||||||
@@ -106,7 +133,7 @@ If you are building with Microsoft Visual Studio 2008, you need to set up the
|
|||||||
environment by running `vcvars32.bat` (e.g. MSVC 2008 command prompt) before
|
environment by running `vcvars32.bat` (e.g. MSVC 2008 command prompt) before
|
||||||
running SCons.
|
running SCons.
|
||||||
|
|
||||||
# Running the tests manually
|
## Running the tests manually
|
||||||
You need to run tests manually only if you are troubleshooting an issue.
|
You need to run tests manually only if you are troubleshooting an issue.
|
||||||
|
|
||||||
In the instructions below, replace `path/to/jsontest` with the path of the
|
In the instructions below, replace `path/to/jsontest` with the path of the
|
||||||
@@ -142,29 +169,6 @@ Run the Python script `doxybuild.py` from the top directory:
|
|||||||
|
|
||||||
See `doxybuild.py --help` for options.
|
See `doxybuild.py --help` for options.
|
||||||
|
|
||||||
Generating amalgamated source and header
|
|
||||||
----------------------------------------
|
|
||||||
JsonCpp is provided with a script to generate a single header and a single
|
|
||||||
source file to ease inclusion into an existing project. The amalgamated source
|
|
||||||
can be generated at any time by running the following command from the
|
|
||||||
top-directory (this requires Python 2.6):
|
|
||||||
|
|
||||||
python amalgamate.py
|
|
||||||
|
|
||||||
It is possible to specify header name. See the `-h` option for detail.
|
|
||||||
|
|
||||||
By default, the following files are generated:
|
|
||||||
* `dist/jsoncpp.cpp`: source file that needs to be added to your project.
|
|
||||||
* `dist/json/json.h`: corresponding header file for use in your project. It is
|
|
||||||
equivalent to including `json/json.h` in non-amalgamated source. This header
|
|
||||||
only depends on standard headers.
|
|
||||||
* `dist/json/json-forwards.h`: header that provides forward declaration of all
|
|
||||||
JsonCpp types.
|
|
||||||
|
|
||||||
The amalgamated sources are generated by concatenating JsonCpp source in the
|
|
||||||
correct order and defining the macro `JSON_IS_AMALGAMATION` to prevent inclusion
|
|
||||||
of other headers.
|
|
||||||
|
|
||||||
Adding a reader/writer test
|
Adding a reader/writer test
|
||||||
---------------------------
|
---------------------------
|
||||||
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:
|
||||||
|
35
appveyor.yml
Normal file
35
appveyor.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# This is a comment.
|
||||||
|
|
||||||
|
version: build.{build}
|
||||||
|
|
||||||
|
os: Windows Server 2012 R2
|
||||||
|
|
||||||
|
clone_folder: c:\projects\jsoncpp
|
||||||
|
|
||||||
|
platform:
|
||||||
|
- Win32
|
||||||
|
- x64
|
||||||
|
|
||||||
|
configuration:
|
||||||
|
- Debug
|
||||||
|
- Release
|
||||||
|
|
||||||
|
# scripts to run before build
|
||||||
|
before_build:
|
||||||
|
- echo "Running cmake..."
|
||||||
|
- cd c:\projects\jsoncpp
|
||||||
|
- cmake --version
|
||||||
|
- set PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
|
||||||
|
- if %PLATFORM% == Win32 cmake .
|
||||||
|
- if %PLATFORM% == x64 cmake -G "Visual Studio 12 2013 Win64" .
|
||||||
|
|
||||||
|
build:
|
||||||
|
project: jsoncpp.sln # path to Visual Studio solution or project
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
provider: GitHub
|
||||||
|
auth_token:
|
||||||
|
secure: K2Tp1q8pIZ7rs0Ot24ZMWuwr12Ev6Tc6QkhMjGQxoQG3ng1pXtgPasiJ45IDXGdg
|
||||||
|
on:
|
||||||
|
branch: master
|
||||||
|
appveyor_repo_tag: true
|
@@ -16,7 +16,7 @@ dox:
|
|||||||
# Then 'git add -A' and 'git push' in jsoncpp-docs.
|
# Then 'git add -A' and 'git push' in jsoncpp-docs.
|
||||||
build:
|
build:
|
||||||
mkdir -p build/debug
|
mkdir -p build/debug
|
||||||
cd build/debug; cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_SHARED=ON -G "Unix Makefiles" ../..
|
cd build/debug; cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_SHARED_LIBS=ON -G "Unix Makefiles" ../..
|
||||||
make -C build/debug
|
make -C build/debug
|
||||||
|
|
||||||
# Currently, this depends on include/json/version.h generated
|
# Currently, this depends on include/json/version.h generated
|
||||||
@@ -26,6 +26,9 @@ test-amalgamate:
|
|||||||
python3.4 amalgamate.py
|
python3.4 amalgamate.py
|
||||||
cd dist; gcc -I. -c jsoncpp.cpp
|
cd dist; gcc -I. -c jsoncpp.cpp
|
||||||
|
|
||||||
|
valgrind:
|
||||||
|
valgrind --error-exitcode=42 --leak-check=full ./build/debug/src/test_lib_json/jsoncpp_test
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
\rm -rf *.gz *.asc dist/
|
\rm -rf *.gz *.asc dist/
|
||||||
|
|
||||||
|
@@ -1 +1,6 @@
|
|||||||
# module
|
# Copyright 2010 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
# module
|
||||||
|
@@ -1,33 +1,33 @@
|
|||||||
{
|
{
|
||||||
"cmake_variants" : [
|
"cmake_variants" : [
|
||||||
{"name": "generator",
|
{"name": "generator",
|
||||||
"generators": [
|
"generators": [
|
||||||
{"generator": [
|
{"generator": [
|
||||||
"Visual Studio 7 .NET 2003",
|
"Visual Studio 7 .NET 2003",
|
||||||
"Visual Studio 9 2008",
|
"Visual Studio 9 2008",
|
||||||
"Visual Studio 9 2008 Win64",
|
"Visual Studio 9 2008 Win64",
|
||||||
"Visual Studio 10",
|
"Visual Studio 10",
|
||||||
"Visual Studio 10 Win64",
|
"Visual Studio 10 Win64",
|
||||||
"Visual Studio 11",
|
"Visual Studio 11",
|
||||||
"Visual Studio 11 Win64"
|
"Visual Studio 11 Win64"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{"generator": ["MinGW Makefiles"],
|
{"generator": ["MinGW Makefiles"],
|
||||||
"env_prepend": [{"path": "c:/wut/prg/MinGW/bin"}]
|
"env_prepend": [{"path": "c:/wut/prg/MinGW/bin"}]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{"name": "shared_dll",
|
{"name": "shared_dll",
|
||||||
"variables": [
|
"variables": [
|
||||||
["JSONCPP_LIB_BUILD_SHARED=true"],
|
["BUILD_SHARED_LIBS=true"],
|
||||||
["JSONCPP_LIB_BUILD_SHARED=false"]
|
["BUILD_SHARED_LIBS=false"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{"name": "build_type",
|
{"name": "build_type",
|
||||||
"build_types": [
|
"build_types": [
|
||||||
"debug",
|
"debug",
|
||||||
"release"
|
"release"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -1,26 +1,26 @@
|
|||||||
{
|
{
|
||||||
"cmake_variants" : [
|
"cmake_variants" : [
|
||||||
{"name": "generator",
|
{"name": "generator",
|
||||||
"generators": [
|
"generators": [
|
||||||
{"generator": [
|
{"generator": [
|
||||||
"Visual Studio 6",
|
"Visual Studio 6",
|
||||||
"Visual Studio 7",
|
"Visual Studio 7",
|
||||||
"Visual Studio 8 2005"
|
"Visual Studio 8 2005"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{"name": "shared_dll",
|
{"name": "shared_dll",
|
||||||
"variables": [
|
"variables": [
|
||||||
["JSONCPP_LIB_BUILD_SHARED=true"],
|
["BUILD_SHARED_LIBS=true"],
|
||||||
["JSONCPP_LIB_BUILD_SHARED=false"]
|
["BUILD_SHARED_LIBS=false"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{"name": "build_type",
|
{"name": "build_type",
|
||||||
"build_types": [
|
"build_types": [
|
||||||
"debug",
|
"debug",
|
||||||
"release"
|
"release"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
# Baptiste Lepilleur, 2009
|
# Copyright 2009 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from dircache import listdir
|
from dircache import listdir
|
||||||
|
@@ -1,5 +1,11 @@
|
|||||||
|
# Copyright 2010 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import os.path
|
import os.path
|
||||||
|
import sys
|
||||||
|
|
||||||
def fix_source_eol(path, is_dry_run = True, verbose = True, eol = '\n'):
|
def fix_source_eol(path, is_dry_run = True, verbose = True, eol = '\n'):
|
||||||
"""Makes sure that all sources have the specified eol sequence (default: unix)."""
|
"""Makes sure that all sources have the specified eol sequence (default: unix)."""
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
# Copyright 2010 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
import os
|
import os
|
||||||
import tarfile
|
import tarfile
|
||||||
|
@@ -31,7 +31,7 @@ def find_program(*filenames):
|
|||||||
paths = os.environ.get('PATH', '').split(os.pathsep)
|
paths = os.environ.get('PATH', '').split(os.pathsep)
|
||||||
suffixes = ('win32' in sys.platform) and '.exe .com .bat .cmd' or ''
|
suffixes = ('win32' in sys.platform) and '.exe .com .bat .cmd' or ''
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
for name in [filename+ext for ext in suffixes.split()]:
|
for name in [filename+ext for ext in suffixes.split(' ')]:
|
||||||
for directory in paths:
|
for directory in paths:
|
||||||
full_path = os.path.join(directory, name)
|
full_path = os.path.join(directory, name)
|
||||||
if os.path.isfile(full_path):
|
if os.path.isfile(full_path):
|
||||||
@@ -72,7 +72,7 @@ def run_cmd(cmd, silent=False):
|
|||||||
if silent:
|
if silent:
|
||||||
status, output = getstatusoutput(cmd)
|
status, output = getstatusoutput(cmd)
|
||||||
else:
|
else:
|
||||||
status, output = os.system(' '.join(cmd)), ''
|
status, output = subprocess.call(cmd), ''
|
||||||
if status:
|
if status:
|
||||||
msg = 'Error while %s ...\n\terror=%d, output="""%s"""' %(info, status, output)
|
msg = 'Error while %s ...\n\terror=%d, output="""%s"""' %(info, status, output)
|
||||||
raise Exception(msg)
|
raise Exception(msg)
|
||||||
|
@@ -13,22 +13,30 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif // if !defined(JSON_IS_AMALGAMATION)
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
|
||||||
|
/** It should not be possible for a maliciously designed file to
|
||||||
|
* cause an abort() or seg-fault, so these macros are used only
|
||||||
|
* for pre-condition violations and internal logic errors.
|
||||||
|
*/
|
||||||
#if JSON_USE_EXCEPTION
|
#if JSON_USE_EXCEPTION
|
||||||
#include <stdexcept>
|
|
||||||
#define JSON_ASSERT(condition) \
|
// @todo <= add detail about condition in exception
|
||||||
{if (!(condition)) {throw std::logic_error( "assert json failed" );}} // @todo <= add detail about condition in exception
|
# define JSON_ASSERT(condition) \
|
||||||
#define JSON_FAIL_MESSAGE(message) \
|
{if (!(condition)) {Json::throwLogicError( "assert json failed" );}}
|
||||||
|
|
||||||
|
# define JSON_FAIL_MESSAGE(message) \
|
||||||
{ \
|
{ \
|
||||||
std::ostringstream oss; oss << message; \
|
std::ostringstream oss; oss << message; \
|
||||||
throw std::logic_error(oss.str()); \
|
Json::throwLogicError(oss.str()); \
|
||||||
|
abort(); \
|
||||||
}
|
}
|
||||||
//#define JSON_FAIL_MESSAGE(message) throw std::logic_error(message)
|
|
||||||
#else // JSON_USE_EXCEPTION
|
#else // JSON_USE_EXCEPTION
|
||||||
#define JSON_ASSERT(condition) assert(condition)
|
|
||||||
|
# define JSON_ASSERT(condition) assert(condition)
|
||||||
|
|
||||||
// The call to assert() will show the failure message in debug builds. In
|
// The call to assert() will show the failure message in debug builds. In
|
||||||
// release bugs we abort, for a core-dump or debugger.
|
// release builds we abort, for a core-dump or debugger.
|
||||||
#define JSON_FAIL_MESSAGE(message) \
|
# define JSON_FAIL_MESSAGE(message) \
|
||||||
{ \
|
{ \
|
||||||
std::ostringstream oss; oss << message; \
|
std::ostringstream oss; oss << message; \
|
||||||
assert(false && oss.str().c_str()); \
|
assert(false && oss.str().c_str()); \
|
||||||
|
@@ -70,6 +70,14 @@
|
|||||||
#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
|
#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
|
||||||
/// Indicates that the following function is deprecated.
|
/// Indicates that the following function is deprecated.
|
||||||
#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
|
#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
|
||||||
|
#elif defined(__clang__) && defined(__has_feature)
|
||||||
|
#if __has_feature(attribute_deprecated_with_message)
|
||||||
|
#define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
|
||||||
|
#endif
|
||||||
|
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
|
||||||
|
#define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
|
||||||
|
#elif defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
|
||||||
|
#define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(JSONCPP_DEPRECATED)
|
#if !defined(JSONCPP_DEPRECATED)
|
||||||
|
@@ -98,7 +98,7 @@ public:
|
|||||||
* during parsing.
|
* during parsing.
|
||||||
* \deprecated Use getFormattedErrorMessages() instead (typo fix).
|
* \deprecated Use getFormattedErrorMessages() instead (typo fix).
|
||||||
*/
|
*/
|
||||||
JSONCPP_DEPRECATED("Use getFormattedErrorMessages instead")
|
JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.")
|
||||||
std::string getFormatedErrorMessages() const;
|
std::string getFormatedErrorMessages() const;
|
||||||
|
|
||||||
/** \brief Returns a user friendly string that list errors in the parsed
|
/** \brief Returns a user friendly string that list errors in the parsed
|
||||||
@@ -226,6 +226,7 @@ public:
|
|||||||
|
|
||||||
class Factory {
|
class Factory {
|
||||||
public:
|
public:
|
||||||
|
virtual ~Factory() {}
|
||||||
/** \brief Allocate a CharReader via operator new().
|
/** \brief Allocate a CharReader via operator new().
|
||||||
* \throw std::exception if something goes wrong (e.g. invalid settings)
|
* \throw std::exception if something goes wrong (e.g. invalid settings)
|
||||||
*/
|
*/
|
||||||
@@ -235,8 +236,6 @@ public:
|
|||||||
|
|
||||||
/** \brief Build a CharReader implementation.
|
/** \brief Build a CharReader implementation.
|
||||||
|
|
||||||
\deprecated This is experimental and will be altered before the next release.
|
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
\code
|
\code
|
||||||
using namespace Json;
|
using namespace Json;
|
||||||
@@ -278,6 +277,9 @@ public:
|
|||||||
the JSON value in the input string.
|
the JSON value in the input string.
|
||||||
- `"rejectDupKeys": false or true`
|
- `"rejectDupKeys": false or true`
|
||||||
- If true, `parse()` returns false when a key is duplicated within an object.
|
- If true, `parse()` returns false when a key is duplicated within an object.
|
||||||
|
- `"allowSpecialFloats": false or true`
|
||||||
|
- If true, special float values (NaNs and infinities) are allowed
|
||||||
|
and their values are lossfree restorable.
|
||||||
|
|
||||||
You can examine 'settings_` yourself
|
You can examine 'settings_` yourself
|
||||||
to see the defaults. You can also write and read them just like any
|
to see the defaults. You can also write and read them just like any
|
||||||
@@ -303,13 +305,13 @@ public:
|
|||||||
/** Called by ctor, but you can use this to reset settings_.
|
/** Called by ctor, but you can use this to reset settings_.
|
||||||
* \pre 'settings' != NULL (but Json::null is fine)
|
* \pre 'settings' != NULL (but Json::null is fine)
|
||||||
* \remark Defaults:
|
* \remark Defaults:
|
||||||
* \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode
|
* \snippet src/lib_json/json_reader.cpp CharReaderBuilderDefaults
|
||||||
*/
|
*/
|
||||||
static void setDefaults(Json::Value* settings);
|
static void setDefaults(Json::Value* settings);
|
||||||
/** Same as old Features::strictMode().
|
/** Same as old Features::strictMode().
|
||||||
* \pre 'settings' != NULL (but Json::null is fine)
|
* \pre 'settings' != NULL (but Json::null is fine)
|
||||||
* \remark Defaults:
|
* \remark Defaults:
|
||||||
* \snippet src/lib_json/json_reader.cpp CharReaderBuilderDefaults
|
* \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode
|
||||||
*/
|
*/
|
||||||
static void strictMode(Json::Value* settings);
|
static void strictMode(Json::Value* settings);
|
||||||
};
|
};
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
#endif // if !defined(JSON_IS_AMALGAMATION)
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
#ifndef JSON_USE_CPPTL_SMALLMAP
|
#ifndef JSON_USE_CPPTL_SMALLMAP
|
||||||
#include <map>
|
#include <map>
|
||||||
@@ -28,10 +29,63 @@
|
|||||||
#pragma warning(disable : 4251)
|
#pragma warning(disable : 4251)
|
||||||
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
|
||||||
|
//Conditional NORETURN attribute on the throw functions would:
|
||||||
|
// a) suppress false positives from static code analysis
|
||||||
|
// b) possibly improve optimization opportunities.
|
||||||
|
#if !defined(JSONCPP_NORETURN)
|
||||||
|
# if defined(_MSC_VER)
|
||||||
|
# define JSONCPP_NORETURN __declspec(noreturn)
|
||||||
|
# elif defined(__GNUC__)
|
||||||
|
# define JSONCPP_NORETURN __attribute__ ((__noreturn__))
|
||||||
|
# else
|
||||||
|
# define JSONCPP_NORETURN
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/** \brief JSON (JavaScript Object Notation).
|
/** \brief JSON (JavaScript Object Notation).
|
||||||
*/
|
*/
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
|
/** Base class for all exceptions we throw.
|
||||||
|
*
|
||||||
|
* We use nothing but these internally. Of course, STL can throw others.
|
||||||
|
*/
|
||||||
|
class JSON_API Exception : public std::exception {
|
||||||
|
public:
|
||||||
|
Exception(std::string const& msg);
|
||||||
|
virtual ~Exception() throw();
|
||||||
|
virtual char const* what() const throw();
|
||||||
|
protected:
|
||||||
|
std::string const msg_;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Exceptions which the user cannot easily avoid.
|
||||||
|
*
|
||||||
|
* E.g. out-of-memory (when we use malloc), stack-overflow, malicious input
|
||||||
|
*
|
||||||
|
* \remark derived from Json::Exception
|
||||||
|
*/
|
||||||
|
class JSON_API RuntimeError : public Exception {
|
||||||
|
public:
|
||||||
|
RuntimeError(std::string const& msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
|
||||||
|
*
|
||||||
|
* These are precondition-violations (user bugs) and internal errors (our bugs).
|
||||||
|
*
|
||||||
|
* \remark derived from Json::Exception
|
||||||
|
*/
|
||||||
|
class JSON_API LogicError : public Exception {
|
||||||
|
public:
|
||||||
|
LogicError(std::string const& msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
/// used internally
|
||||||
|
JSONCPP_NORETURN void throwRuntimeError(std::string const& msg);
|
||||||
|
/// used internally
|
||||||
|
JSONCPP_NORETURN void throwLogicError(std::string const& msg);
|
||||||
|
|
||||||
/** \brief Type of the value held by a Value object.
|
/** \brief Type of the value held by a Value object.
|
||||||
*/
|
*/
|
||||||
enum ValueType {
|
enum ValueType {
|
||||||
@@ -188,7 +242,7 @@ private:
|
|||||||
void swap(CZString& other);
|
void swap(CZString& other);
|
||||||
|
|
||||||
struct StringStorage {
|
struct StringStorage {
|
||||||
DuplicationPolicy policy_: 2;
|
unsigned policy_: 2;
|
||||||
unsigned length_: 30; // 1GB max
|
unsigned length_: 30; // 1GB max
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -232,7 +286,7 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
#endif // if defined(JSON_HAS_INT64)
|
#endif // if defined(JSON_HAS_INT64)
|
||||||
Value(double value);
|
Value(double value);
|
||||||
Value(const char* value); ///< Copy til first 0. (NULL causes to seg-fault.)
|
Value(const char* value); ///< Copy til first 0. (NULL causes to seg-fault.)
|
||||||
Value(const char* beginValue, const char* endValue); ///< Copy all, incl zeroes.
|
Value(const char* begin, const char* end); ///< Copy all, incl zeroes.
|
||||||
/** \brief Constructs a value from a static string.
|
/** \brief Constructs a value from a static string.
|
||||||
|
|
||||||
* Like other value string constructor but do not duplicate the string for
|
* Like other value string constructor but do not duplicate the string for
|
||||||
@@ -283,7 +337,7 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
* \return false if !string. (Seg-fault if str or end are NULL.)
|
* \return false if !string. (Seg-fault if str or end are NULL.)
|
||||||
*/
|
*/
|
||||||
bool getString(
|
bool getString(
|
||||||
char const** str, char const** end) const;
|
char const** begin, char const** end) const;
|
||||||
#ifdef JSON_USE_CPPTL
|
#ifdef JSON_USE_CPPTL
|
||||||
CppTL::ConstString asConstString() const;
|
CppTL::ConstString asConstString() const;
|
||||||
#endif
|
#endif
|
||||||
@@ -412,8 +466,8 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
Value get(const char* key, const Value& defaultValue) const;
|
Value get(const char* key, const Value& defaultValue) const;
|
||||||
/// Return the member named key if it exist, defaultValue otherwise.
|
/// Return the member named key if it exist, defaultValue otherwise.
|
||||||
/// \note deep copy
|
/// \note deep copy
|
||||||
/// \param key may contain embedded nulls.
|
/// \note key may contain embedded nulls.
|
||||||
Value get(const char* key, const char* end, const Value& defaultValue) const;
|
Value get(const char* begin, const char* end, const Value& defaultValue) const;
|
||||||
/// Return the member named key if it exist, defaultValue otherwise.
|
/// Return the member named key if it exist, defaultValue otherwise.
|
||||||
/// \note deep copy
|
/// \note deep copy
|
||||||
/// \param key may contain embedded nulls.
|
/// \param key may contain embedded nulls.
|
||||||
@@ -425,12 +479,12 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
#endif
|
#endif
|
||||||
/// Most general and efficient version of isMember()const, get()const,
|
/// Most general and efficient version of isMember()const, get()const,
|
||||||
/// and operator[]const
|
/// and operator[]const
|
||||||
/// \note As stated elsewhere, behavior is undefined if (end-key) >= 2^30
|
/// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
|
||||||
Value const* find(char const* key, char const* end) const;
|
Value const* find(char const* begin, char const* end) const;
|
||||||
/// Most general and efficient version of object-mutators.
|
/// Most general and efficient version of object-mutators.
|
||||||
/// \note As stated elsewhere, behavior is undefined if (end-key) >= 2^30
|
/// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
|
||||||
/// \return non-zero, but JSON_ASSERT if this is neither object nor nullValue.
|
/// \return non-zero, but JSON_ASSERT if this is neither object nor nullValue.
|
||||||
Value const* demand(char const* key, char const* end);
|
Value const* demand(char const* begin, char const* end);
|
||||||
/// \brief Remove and return the named member.
|
/// \brief Remove and return the named member.
|
||||||
///
|
///
|
||||||
/// Do nothing if it did not exist.
|
/// Do nothing if it did not exist.
|
||||||
@@ -443,7 +497,7 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
/// \param key may contain embedded nulls.
|
/// \param key may contain embedded nulls.
|
||||||
/// \deprecated
|
/// \deprecated
|
||||||
Value removeMember(const std::string& key);
|
Value removeMember(const std::string& key);
|
||||||
/// Same as removeMember(const char* key, const char* end, Value* removed),
|
/// Same as removeMember(const char* begin, const char* end, Value* removed),
|
||||||
/// but 'key' is null-terminated.
|
/// but 'key' is null-terminated.
|
||||||
bool removeMember(const char* key, Value* removed);
|
bool removeMember(const char* key, Value* removed);
|
||||||
/** \brief Remove the named map member.
|
/** \brief Remove the named map member.
|
||||||
@@ -454,7 +508,7 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
*/
|
*/
|
||||||
bool removeMember(std::string const& key, Value* removed);
|
bool removeMember(std::string const& key, Value* removed);
|
||||||
/// Same as removeMember(std::string const& key, Value* removed)
|
/// Same as removeMember(std::string const& key, Value* removed)
|
||||||
bool removeMember(const char* key, const char* end, Value* removed);
|
bool removeMember(const char* begin, const char* end, Value* removed);
|
||||||
/** \brief Remove the indexed array element.
|
/** \brief Remove the indexed array element.
|
||||||
|
|
||||||
O(n) expensive operations.
|
O(n) expensive operations.
|
||||||
@@ -470,7 +524,7 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
/// \param key may contain embedded nulls.
|
/// \param key may contain embedded nulls.
|
||||||
bool isMember(const std::string& key) const;
|
bool isMember(const std::string& key) const;
|
||||||
/// Same as isMember(std::string const& key)const
|
/// Same as isMember(std::string const& key)const
|
||||||
bool isMember(const char* key, const char* end) const;
|
bool isMember(const char* begin, const char* end) const;
|
||||||
#ifdef JSON_USE_CPPTL
|
#ifdef JSON_USE_CPPTL
|
||||||
/// Return true if the object has a member named key.
|
/// Return true if the object has a member named key.
|
||||||
bool isMember(const CppTL::ConstString& key) const;
|
bool isMember(const CppTL::ConstString& key) const;
|
||||||
@@ -489,6 +543,7 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
//# endif
|
//# endif
|
||||||
|
|
||||||
/// \deprecated Always pass len.
|
/// \deprecated Always pass len.
|
||||||
|
JSONCPP_DEPRECATED("Use setComment(std::string const&) instead.")
|
||||||
void setComment(const char* comment, CommentPlacement placement);
|
void setComment(const char* comment, CommentPlacement placement);
|
||||||
/// Comments must be //... or /* ... */
|
/// Comments must be //... or /* ... */
|
||||||
void setComment(const char* comment, size_t len, CommentPlacement placement);
|
void setComment(const char* comment, size_t len, CommentPlacement placement);
|
||||||
@@ -617,9 +672,6 @@ public:
|
|||||||
typedef int difference_type;
|
typedef int difference_type;
|
||||||
typedef ValueIteratorBase SelfType;
|
typedef ValueIteratorBase SelfType;
|
||||||
|
|
||||||
ValueIteratorBase();
|
|
||||||
explicit ValueIteratorBase(const Value::ObjectValues::iterator& current);
|
|
||||||
|
|
||||||
bool operator==(const SelfType& other) const { return isEqual(other); }
|
bool operator==(const SelfType& other) const { return isEqual(other); }
|
||||||
|
|
||||||
bool operator!=(const SelfType& other) const { return !isEqual(other); }
|
bool operator!=(const SelfType& other) const { return !isEqual(other); }
|
||||||
@@ -632,16 +684,22 @@ public:
|
|||||||
/// Value.
|
/// Value.
|
||||||
Value key() const;
|
Value key() const;
|
||||||
|
|
||||||
/// Return the index of the referenced Value. -1 if it is not an arrayValue.
|
/// Return the index of the referenced Value, or -1 if it is not an arrayValue.
|
||||||
UInt index() const;
|
UInt index() const;
|
||||||
|
|
||||||
|
/// Return the member name of the referenced Value, or "" if it is not an
|
||||||
|
/// objectValue.
|
||||||
|
/// \note Avoid `c_str()` on result, as embedded zeroes are possible.
|
||||||
|
std::string name() const;
|
||||||
|
|
||||||
/// Return the member name of the referenced Value. "" if it is not an
|
/// Return the member name of the referenced Value. "" if it is not an
|
||||||
/// objectValue.
|
/// objectValue.
|
||||||
/// \deprecated This cannot be used for UTF-8 strings, since there can be embedded nulls.
|
/// \deprecated This cannot be used for UTF-8 strings, since there can be embedded nulls.
|
||||||
|
JSONCPP_DEPRECATED("Use `key = name();` instead.")
|
||||||
char const* memberName() const;
|
char const* memberName() const;
|
||||||
/// Return the member name of the referenced Value, or NULL if it is not an
|
/// Return the member name of the referenced Value, or NULL if it is not an
|
||||||
/// objectValue.
|
/// objectValue.
|
||||||
/// Better version than memberName(). Allows embedded nulls.
|
/// \note Better version than memberName(). Allows embedded nulls.
|
||||||
char const* memberName(char const** end) const;
|
char const* memberName(char const** end) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -661,6 +719,12 @@ private:
|
|||||||
Value::ObjectValues::iterator current_;
|
Value::ObjectValues::iterator current_;
|
||||||
// Indicates that iterator is for a null value.
|
// Indicates that iterator is for a null value.
|
||||||
bool isNull_;
|
bool isNull_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// For some reason, BORLAND needs these at the end, rather
|
||||||
|
// than earlier. No idea why.
|
||||||
|
ValueIteratorBase();
|
||||||
|
explicit ValueIteratorBase(const Value::ObjectValues::iterator& current);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief const iterator for object and array value.
|
/** \brief const iterator for object and array value.
|
||||||
|
@@ -1,13 +1,12 @@
|
|||||||
// DO NOT EDIT. This file is generated by CMake from "version"
|
// DO NOT EDIT. This file (and "version") is generated by CMake.
|
||||||
// and "version.h.in" files.
|
|
||||||
// Run CMake configure step to update it.
|
// Run CMake configure step to update it.
|
||||||
#ifndef JSON_VERSION_H_INCLUDED
|
#ifndef JSON_VERSION_H_INCLUDED
|
||||||
# define JSON_VERSION_H_INCLUDED
|
# define JSON_VERSION_H_INCLUDED
|
||||||
|
|
||||||
# define JSONCPP_VERSION_STRING "0.9.4"
|
# define JSONCPP_VERSION_STRING "0.10.6"
|
||||||
# define JSONCPP_VERSION_MAJOR 0
|
# define JSONCPP_VERSION_MAJOR 0
|
||||||
# define JSONCPP_VERSION_MINOR 9
|
# define JSONCPP_VERSION_MINOR 10
|
||||||
# define JSONCPP_VERSION_PATCH 4
|
# define JSONCPP_VERSION_PATCH 6
|
||||||
# define JSONCPP_VERSION_QUALIFIER
|
# define JSONCPP_VERSION_QUALIFIER
|
||||||
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
|
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@ public:
|
|||||||
/** Write Value into document as configured in sub-class.
|
/** Write Value into document as configured in sub-class.
|
||||||
Do not take ownership of sout, but maintain a reference during function.
|
Do not take ownership of sout, but maintain a reference during function.
|
||||||
\pre sout != NULL
|
\pre sout != NULL
|
||||||
\return zero on success
|
\return zero on success (For now, we always return zero, so check the stream instead.)
|
||||||
\throw std::exception possibly, depending on configuration
|
\throw std::exception possibly, depending on configuration
|
||||||
*/
|
*/
|
||||||
virtual int write(Value const& root, std::ostream* sout) = 0;
|
virtual int write(Value const& root, std::ostream* sout) = 0;
|
||||||
@@ -99,6 +99,10 @@ public:
|
|||||||
Strictly speaking, this is not valid JSON. But when the output is being
|
Strictly speaking, this is not valid JSON. But when the output is being
|
||||||
fed to a browser's Javascript, it makes for smaller output and the
|
fed to a browser's Javascript, it makes for smaller output and the
|
||||||
browser can handle the output just fine.
|
browser can handle the output just fine.
|
||||||
|
- "useSpecialFloats": false or true
|
||||||
|
- If true, outputs non-finite floating point values in the following way:
|
||||||
|
NaN values as "NaN", positive infinity as "Infinity", and negative infinity
|
||||||
|
as "-Infinity".
|
||||||
|
|
||||||
You can examine 'settings_` yourself
|
You can examine 'settings_` yourself
|
||||||
to see the defaults. You can also write and read them just like any
|
to see the defaults. You can also write and read them just like any
|
||||||
@@ -132,7 +136,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** \brief Abstract class for writers.
|
/** \brief Abstract class for writers.
|
||||||
* \deprecated Use StreamWriter.
|
* \deprecated Use StreamWriter. (And really, this is an implementation detail.)
|
||||||
*/
|
*/
|
||||||
class JSON_API Writer {
|
class JSON_API Writer {
|
||||||
public:
|
public:
|
||||||
@@ -151,6 +155,7 @@ public:
|
|||||||
* \deprecated Use StreamWriterBuilder.
|
* \deprecated Use StreamWriterBuilder.
|
||||||
*/
|
*/
|
||||||
class JSON_API FastWriter : public Writer {
|
class JSON_API FastWriter : public Writer {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FastWriter();
|
FastWriter();
|
||||||
virtual ~FastWriter() {}
|
virtual ~FastWriter() {}
|
||||||
|
@@ -1,46 +1,46 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_json", "lib_json.vcproj", "{B84F7231-16CE-41D8-8C08-7B523FF4225B}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_json", "lib_json.vcproj", "{B84F7231-16CE-41D8-8C08-7B523FF4225B}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jsontest", "jsontest.vcproj", "{25AF2DD2-D396-4668-B188-488C33B8E620}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jsontest", "jsontest.vcproj", "{25AF2DD2-D396-4668-B188-488C33B8E620}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{B84F7231-16CE-41D8-8C08-7B523FF4225B} = {B84F7231-16CE-41D8-8C08-7B523FF4225B}
|
{B84F7231-16CE-41D8-8C08-7B523FF4225B} = {B84F7231-16CE-41D8-8C08-7B523FF4225B}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_lib_json", "test_lib_json.vcproj", "{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_lib_json", "test_lib_json.vcproj", "{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{B84F7231-16CE-41D8-8C08-7B523FF4225B} = {B84F7231-16CE-41D8-8C08-7B523FF4225B}
|
{B84F7231-16CE-41D8-8C08-7B523FF4225B} = {B84F7231-16CE-41D8-8C08-7B523FF4225B}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfiguration) = preSolution
|
GlobalSection(SolutionConfiguration) = preSolution
|
||||||
Debug = Debug
|
Debug = Debug
|
||||||
dummy = dummy
|
dummy = dummy
|
||||||
Release = Release
|
Release = Release
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfiguration) = postSolution
|
GlobalSection(ProjectConfiguration) = postSolution
|
||||||
{B84F7231-16CE-41D8-8C08-7B523FF4225B}.Debug.ActiveCfg = Debug|Win32
|
{B84F7231-16CE-41D8-8C08-7B523FF4225B}.Debug.ActiveCfg = Debug|Win32
|
||||||
{B84F7231-16CE-41D8-8C08-7B523FF4225B}.Debug.Build.0 = Debug|Win32
|
{B84F7231-16CE-41D8-8C08-7B523FF4225B}.Debug.Build.0 = Debug|Win32
|
||||||
{B84F7231-16CE-41D8-8C08-7B523FF4225B}.dummy.ActiveCfg = dummy|Win32
|
{B84F7231-16CE-41D8-8C08-7B523FF4225B}.dummy.ActiveCfg = dummy|Win32
|
||||||
{B84F7231-16CE-41D8-8C08-7B523FF4225B}.dummy.Build.0 = dummy|Win32
|
{B84F7231-16CE-41D8-8C08-7B523FF4225B}.dummy.Build.0 = dummy|Win32
|
||||||
{B84F7231-16CE-41D8-8C08-7B523FF4225B}.Release.ActiveCfg = Release|Win32
|
{B84F7231-16CE-41D8-8C08-7B523FF4225B}.Release.ActiveCfg = Release|Win32
|
||||||
{B84F7231-16CE-41D8-8C08-7B523FF4225B}.Release.Build.0 = Release|Win32
|
{B84F7231-16CE-41D8-8C08-7B523FF4225B}.Release.Build.0 = Release|Win32
|
||||||
{25AF2DD2-D396-4668-B188-488C33B8E620}.Debug.ActiveCfg = Debug|Win32
|
{25AF2DD2-D396-4668-B188-488C33B8E620}.Debug.ActiveCfg = Debug|Win32
|
||||||
{25AF2DD2-D396-4668-B188-488C33B8E620}.Debug.Build.0 = Debug|Win32
|
{25AF2DD2-D396-4668-B188-488C33B8E620}.Debug.Build.0 = Debug|Win32
|
||||||
{25AF2DD2-D396-4668-B188-488C33B8E620}.dummy.ActiveCfg = Debug|Win32
|
{25AF2DD2-D396-4668-B188-488C33B8E620}.dummy.ActiveCfg = Debug|Win32
|
||||||
{25AF2DD2-D396-4668-B188-488C33B8E620}.dummy.Build.0 = Debug|Win32
|
{25AF2DD2-D396-4668-B188-488C33B8E620}.dummy.Build.0 = Debug|Win32
|
||||||
{25AF2DD2-D396-4668-B188-488C33B8E620}.Release.ActiveCfg = Release|Win32
|
{25AF2DD2-D396-4668-B188-488C33B8E620}.Release.ActiveCfg = Release|Win32
|
||||||
{25AF2DD2-D396-4668-B188-488C33B8E620}.Release.Build.0 = Release|Win32
|
{25AF2DD2-D396-4668-B188-488C33B8E620}.Release.Build.0 = Release|Win32
|
||||||
{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.Debug.ActiveCfg = Debug|Win32
|
{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.Debug.ActiveCfg = Debug|Win32
|
||||||
{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.Debug.Build.0 = Debug|Win32
|
{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.Debug.Build.0 = Debug|Win32
|
||||||
{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.dummy.ActiveCfg = Debug|Win32
|
{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.dummy.ActiveCfg = Debug|Win32
|
||||||
{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.dummy.Build.0 = Debug|Win32
|
{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.dummy.Build.0 = Debug|Win32
|
||||||
{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.Release.ActiveCfg = Release|Win32
|
{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.Release.ActiveCfg = Release|Win32
|
||||||
{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.Release.Build.0 = Release|Win32
|
{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.Release.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
@@ -1,119 +1,119 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="7.10"
|
Version="7.10"
|
||||||
Name="jsontest"
|
Name="jsontest"
|
||||||
ProjectGUID="{25AF2DD2-D396-4668-B188-488C33B8E620}"
|
ProjectGUID="{25AF2DD2-D396-4668-B188-488C33B8E620}"
|
||||||
Keyword="Win32Proj">
|
Keyword="Win32Proj">
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform
|
<Platform
|
||||||
Name="Win32"/>
|
Name="Win32"/>
|
||||||
</Platforms>
|
</Platforms>
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="../../build/vs71/debug/jsontest"
|
OutputDirectory="../../build/vs71/debug/jsontest"
|
||||||
IntermediateDirectory="../../build/vs71/debug/jsontest"
|
IntermediateDirectory="../../build/vs71/debug/jsontest"
|
||||||
ConfigurationType="1"
|
ConfigurationType="1"
|
||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="../../include"
|
AdditionalIncludeDirectories="../../include"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
Detect64BitPortabilityProblems="TRUE"
|
||||||
DebugInformationFormat="4"/>
|
DebugInformationFormat="4"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)/jsontest.exe"
|
OutputFile="$(OutDir)/jsontest.exe"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
GenerateDebugInformation="TRUE"
|
GenerateDebugInformation="TRUE"
|
||||||
ProgramDatabaseFile="$(OutDir)/jsontest.pdb"
|
ProgramDatabaseFile="$(OutDir)/jsontest.pdb"
|
||||||
SubSystem="1"
|
SubSystem="1"
|
||||||
TargetMachine="1"/>
|
TargetMachine="1"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPostBuildEventTool"/>
|
Name="VCPostBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"/>
|
Name="VCPreBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"/>
|
Name="VCResourceCompilerTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebDeploymentTool"/>
|
Name="VCWebDeploymentTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="../../build/vs71/release/jsontest"
|
OutputDirectory="../../build/vs71/release/jsontest"
|
||||||
IntermediateDirectory="../../build/vs71/release/jsontest"
|
IntermediateDirectory="../../build/vs71/release/jsontest"
|
||||||
ConfigurationType="1"
|
ConfigurationType="1"
|
||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories="../../include"
|
AdditionalIncludeDirectories="../../include"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
Detect64BitPortabilityProblems="TRUE"
|
||||||
DebugInformationFormat="3"/>
|
DebugInformationFormat="3"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)/jsontest.exe"
|
OutputFile="$(OutDir)/jsontest.exe"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
GenerateDebugInformation="TRUE"
|
GenerateDebugInformation="TRUE"
|
||||||
SubSystem="1"
|
SubSystem="1"
|
||||||
OptimizeReferences="2"
|
OptimizeReferences="2"
|
||||||
EnableCOMDATFolding="2"
|
EnableCOMDATFolding="2"
|
||||||
TargetMachine="1"/>
|
TargetMachine="1"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPostBuildEventTool"/>
|
Name="VCPostBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"/>
|
Name="VCPreBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"/>
|
Name="VCResourceCompilerTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebDeploymentTool"/>
|
Name="VCWebDeploymentTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
</Configurations>
|
</Configurations>
|
||||||
<References>
|
<References>
|
||||||
</References>
|
</References>
|
||||||
<Files>
|
<Files>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\jsontestrunner\main.cpp">
|
RelativePath="..\..\src\jsontestrunner\main.cpp">
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
</VisualStudioProject>
|
</VisualStudioProject>
|
||||||
|
@@ -1,205 +1,205 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="7.10"
|
Version="7.10"
|
||||||
Name="lib_json"
|
Name="lib_json"
|
||||||
ProjectGUID="{B84F7231-16CE-41D8-8C08-7B523FF4225B}"
|
ProjectGUID="{B84F7231-16CE-41D8-8C08-7B523FF4225B}"
|
||||||
Keyword="Win32Proj">
|
Keyword="Win32Proj">
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform
|
<Platform
|
||||||
Name="Win32"/>
|
Name="Win32"/>
|
||||||
</Platforms>
|
</Platforms>
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="../../build/vs71/debug/lib_json"
|
OutputDirectory="../../build/vs71/debug/lib_json"
|
||||||
IntermediateDirectory="../../build/vs71/debug/lib_json"
|
IntermediateDirectory="../../build/vs71/debug/lib_json"
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="../../include"
|
AdditionalIncludeDirectories="../../include"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
EnableFunctionLevelLinking="TRUE"
|
EnableFunctionLevelLinking="TRUE"
|
||||||
DisableLanguageExtensions="TRUE"
|
DisableLanguageExtensions="TRUE"
|
||||||
ForceConformanceInForLoopScope="FALSE"
|
ForceConformanceInForLoopScope="FALSE"
|
||||||
RuntimeTypeInfo="TRUE"
|
RuntimeTypeInfo="TRUE"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
Detect64BitPortabilityProblems="TRUE"
|
||||||
DebugInformationFormat="4"/>
|
DebugInformationFormat="4"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
OutputFile="$(OutDir)/json_vc71_libmtd.lib"/>
|
OutputFile="$(OutDir)/json_vc71_libmtd.lib"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPostBuildEventTool"/>
|
Name="VCPostBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"/>
|
Name="VCPreBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"/>
|
Name="VCResourceCompilerTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="../../build/vs71/release/lib_json"
|
OutputDirectory="../../build/vs71/release/lib_json"
|
||||||
IntermediateDirectory="../../build/vs71/release/lib_json"
|
IntermediateDirectory="../../build/vs71/release/lib_json"
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
CharacterSet="2"
|
CharacterSet="2"
|
||||||
WholeProgramOptimization="TRUE">
|
WholeProgramOptimization="TRUE">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
GlobalOptimizations="TRUE"
|
GlobalOptimizations="TRUE"
|
||||||
EnableIntrinsicFunctions="TRUE"
|
EnableIntrinsicFunctions="TRUE"
|
||||||
AdditionalIncludeDirectories="../../include"
|
AdditionalIncludeDirectories="../../include"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableFunctionLevelLinking="TRUE"
|
EnableFunctionLevelLinking="TRUE"
|
||||||
DisableLanguageExtensions="TRUE"
|
DisableLanguageExtensions="TRUE"
|
||||||
ForceConformanceInForLoopScope="FALSE"
|
ForceConformanceInForLoopScope="FALSE"
|
||||||
RuntimeTypeInfo="TRUE"
|
RuntimeTypeInfo="TRUE"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
AssemblerOutput="4"
|
AssemblerOutput="4"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
Detect64BitPortabilityProblems="TRUE"
|
||||||
DebugInformationFormat="3"/>
|
DebugInformationFormat="3"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
OutputFile="$(OutDir)/json_vc71_libmt.lib"/>
|
OutputFile="$(OutDir)/json_vc71_libmt.lib"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPostBuildEventTool"/>
|
Name="VCPostBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"/>
|
Name="VCPreBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"/>
|
Name="VCResourceCompilerTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="dummy|Win32"
|
Name="dummy|Win32"
|
||||||
OutputDirectory="$(ConfigurationName)"
|
OutputDirectory="$(ConfigurationName)"
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
CharacterSet="2"
|
CharacterSet="2"
|
||||||
WholeProgramOptimization="TRUE">
|
WholeProgramOptimization="TRUE">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
GlobalOptimizations="TRUE"
|
GlobalOptimizations="TRUE"
|
||||||
EnableIntrinsicFunctions="TRUE"
|
EnableIntrinsicFunctions="TRUE"
|
||||||
AdditionalIncludeDirectories="../../include"
|
AdditionalIncludeDirectories="../../include"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="4"
|
RuntimeLibrary="4"
|
||||||
EnableFunctionLevelLinking="TRUE"
|
EnableFunctionLevelLinking="TRUE"
|
||||||
DisableLanguageExtensions="TRUE"
|
DisableLanguageExtensions="TRUE"
|
||||||
ForceConformanceInForLoopScope="FALSE"
|
ForceConformanceInForLoopScope="FALSE"
|
||||||
RuntimeTypeInfo="TRUE"
|
RuntimeTypeInfo="TRUE"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
AssemblerOutput="4"
|
AssemblerOutput="4"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
Detect64BitPortabilityProblems="TRUE"
|
||||||
DebugInformationFormat="3"/>
|
DebugInformationFormat="3"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
GenerateDebugInformation="TRUE"
|
GenerateDebugInformation="TRUE"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
OptimizeReferences="2"
|
OptimizeReferences="2"
|
||||||
EnableCOMDATFolding="2"
|
EnableCOMDATFolding="2"
|
||||||
TargetMachine="1"/>
|
TargetMachine="1"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPostBuildEventTool"/>
|
Name="VCPostBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"/>
|
Name="VCPreBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"/>
|
Name="VCResourceCompilerTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebDeploymentTool"/>
|
Name="VCWebDeploymentTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
</Configurations>
|
</Configurations>
|
||||||
<References>
|
<References>
|
||||||
</References>
|
</References>
|
||||||
<Files>
|
<Files>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\json\autolink.h">
|
RelativePath="..\..\include\json\autolink.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\json\config.h">
|
RelativePath="..\..\include\json\config.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\json\features.h">
|
RelativePath="..\..\include\json\features.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\json\forwards.h">
|
RelativePath="..\..\include\json\forwards.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\json\json.h">
|
RelativePath="..\..\include\json\json.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\lib_json\json_reader.cpp">
|
RelativePath="..\..\src\lib_json\json_reader.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\lib_json\json_value.cpp">
|
RelativePath="..\..\src\lib_json\json_value.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\lib_json\json_valueiterator.inl">
|
RelativePath="..\..\src\lib_json\json_valueiterator.inl">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\lib_json\json_writer.cpp">
|
RelativePath="..\..\src\lib_json\json_writer.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\json\reader.h">
|
RelativePath="..\..\include\json\reader.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\json\value.h">
|
RelativePath="..\..\include\json\value.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\json\writer.h">
|
RelativePath="..\..\include\json\writer.h">
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
</VisualStudioProject>
|
</VisualStudioProject>
|
||||||
|
@@ -1,130 +1,130 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="7.10"
|
Version="7.10"
|
||||||
Name="test_lib_json"
|
Name="test_lib_json"
|
||||||
ProjectGUID="{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}"
|
ProjectGUID="{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}"
|
||||||
RootNamespace="test_lib_json"
|
RootNamespace="test_lib_json"
|
||||||
Keyword="Win32Proj">
|
Keyword="Win32Proj">
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform
|
<Platform
|
||||||
Name="Win32"/>
|
Name="Win32"/>
|
||||||
</Platforms>
|
</Platforms>
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="../../build/vs71/debug/test_lib_json"
|
OutputDirectory="../../build/vs71/debug/test_lib_json"
|
||||||
IntermediateDirectory="../../build/vs71/debug/test_lib_json"
|
IntermediateDirectory="../../build/vs71/debug/test_lib_json"
|
||||||
ConfigurationType="1"
|
ConfigurationType="1"
|
||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="../../include"
|
AdditionalIncludeDirectories="../../include"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
Detect64BitPortabilityProblems="TRUE"
|
||||||
DebugInformationFormat="4"/>
|
DebugInformationFormat="4"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)/test_lib_json.exe"
|
OutputFile="$(OutDir)/test_lib_json.exe"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
GenerateDebugInformation="TRUE"
|
GenerateDebugInformation="TRUE"
|
||||||
ProgramDatabaseFile="$(OutDir)/test_lib_json.pdb"
|
ProgramDatabaseFile="$(OutDir)/test_lib_json.pdb"
|
||||||
SubSystem="1"
|
SubSystem="1"
|
||||||
TargetMachine="1"/>
|
TargetMachine="1"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
Description="Running all unit tests"
|
Description="Running all unit tests"
|
||||||
CommandLine="$(TargetPath)"/>
|
CommandLine="$(TargetPath)"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"/>
|
Name="VCPreBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"/>
|
Name="VCResourceCompilerTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebDeploymentTool"/>
|
Name="VCWebDeploymentTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="../../build/vs71/release/test_lib_json"
|
OutputDirectory="../../build/vs71/release/test_lib_json"
|
||||||
IntermediateDirectory="../../build/vs71/release/test_lib_json"
|
IntermediateDirectory="../../build/vs71/release/test_lib_json"
|
||||||
ConfigurationType="1"
|
ConfigurationType="1"
|
||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories="../../include"
|
AdditionalIncludeDirectories="../../include"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
Detect64BitPortabilityProblems="TRUE"
|
||||||
DebugInformationFormat="3"/>
|
DebugInformationFormat="3"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCustomBuildTool"/>
|
Name="VCCustomBuildTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)/test_lib_json.exe"
|
OutputFile="$(OutDir)/test_lib_json.exe"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
GenerateDebugInformation="TRUE"
|
GenerateDebugInformation="TRUE"
|
||||||
SubSystem="1"
|
SubSystem="1"
|
||||||
OptimizeReferences="2"
|
OptimizeReferences="2"
|
||||||
EnableCOMDATFolding="2"
|
EnableCOMDATFolding="2"
|
||||||
TargetMachine="1"/>
|
TargetMachine="1"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"/>
|
Name="VCMIDLTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
Description="Running all unit tests"
|
Description="Running all unit tests"
|
||||||
CommandLine="$(TargetPath)"/>
|
CommandLine="$(TargetPath)"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"/>
|
Name="VCPreBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"/>
|
Name="VCPreLinkEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"/>
|
Name="VCResourceCompilerTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebDeploymentTool"/>
|
Name="VCWebDeploymentTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
</Configurations>
|
</Configurations>
|
||||||
<References>
|
<References>
|
||||||
</References>
|
</References>
|
||||||
<Files>
|
<Files>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\test_lib_json\jsontest.cpp">
|
RelativePath="..\..\src\test_lib_json\jsontest.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\test_lib_json\jsontest.h">
|
RelativePath="..\..\src\test_lib_json\jsontest.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\test_lib_json\main.cpp">
|
RelativePath="..\..\src\test_lib_json\main.cpp">
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
</VisualStudioProject>
|
</VisualStudioProject>
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
# Copyright 2010 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
"""Tag the sandbox for release, make source and doc tarballs.
|
"""Tag the sandbox for release, make source and doc tarballs.
|
||||||
|
|
||||||
Requires Python 2.6
|
Requires Python 2.6
|
||||||
@@ -14,6 +19,7 @@ python makerelease.py 0.5.0 0.6.0-dev
|
|||||||
Note: This was for Subversion. Now that we are in GitHub, we do not
|
Note: This was for Subversion. Now that we are in GitHub, we do not
|
||||||
need to build versioned tarballs anymore, so makerelease.py is defunct.
|
need to build versioned tarballs anymore, so makerelease.py is defunct.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import os.path
|
import os.path
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
prefix=@CMAKE_INSTALL_PREFIX@
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
exec_prefix=${prefix}
|
exec_prefix=${prefix}
|
||||||
libdir=${exec_prefix}/@LIBRARY_INSTALL_DIR@
|
libdir=@LIBRARY_INSTALL_DIR@
|
||||||
includedir=${prefix}/@INCLUDE_INSTALL_DIR@
|
includedir=@INCLUDE_INSTALL_DIR@
|
||||||
|
|
||||||
Name: jsoncpp
|
Name: jsoncpp
|
||||||
Description: A C++ library for interacting with JSON
|
Description: A C++ library for interacting with JSON
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
# Copyright 2009 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
# Copyright 2007 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
# Copyright 2010 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from SCons.Script import * # the usual scons stuff you get in a SConscript
|
from SCons.Script import * # the usual scons stuff you get in a SConscript
|
||||||
import collections
|
import collections
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
# Copyright 2007 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
"""tarball
|
"""tarball
|
||||||
|
|
||||||
Tool-specific initialization for tarball.
|
Tool-specific initialization for tarball.
|
||||||
|
@@ -2,4 +2,4 @@ ADD_SUBDIRECTORY(lib_json)
|
|||||||
IF(JSONCPP_WITH_TESTS)
|
IF(JSONCPP_WITH_TESTS)
|
||||||
ADD_SUBDIRECTORY(jsontestrunner)
|
ADD_SUBDIRECTORY(jsontestrunner)
|
||||||
ADD_SUBDIRECTORY(test_lib_json)
|
ADD_SUBDIRECTORY(test_lib_json)
|
||||||
ENDIF(JSONCPP_WITH_TESTS)
|
ENDIF()
|
||||||
|
@@ -1,18 +1,15 @@
|
|||||||
FIND_PACKAGE(PythonInterp 2.6)
|
FIND_PACKAGE(PythonInterp 2.6)
|
||||||
|
|
||||||
IF(JSONCPP_LIB_BUILD_SHARED)
|
|
||||||
ADD_DEFINITIONS( -DJSON_DLL )
|
|
||||||
ENDIF(JSONCPP_LIB_BUILD_SHARED)
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(jsontestrunner_exe
|
ADD_EXECUTABLE(jsontestrunner_exe
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
IF(JSONCPP_LIB_BUILD_SHARED)
|
IF(BUILD_SHARED_LIBS)
|
||||||
|
ADD_DEFINITIONS( -DJSON_DLL )
|
||||||
TARGET_LINK_LIBRARIES(jsontestrunner_exe jsoncpp_lib)
|
TARGET_LINK_LIBRARIES(jsontestrunner_exe jsoncpp_lib)
|
||||||
ELSE(JSONCPP_LIB_BUILD_SHARED)
|
ELSE(BUILD_SHARED_LIBS)
|
||||||
TARGET_LINK_LIBRARIES(jsontestrunner_exe jsoncpp_lib_static)
|
TARGET_LINK_LIBRARIES(jsontestrunner_exe jsoncpp_lib_static)
|
||||||
ENDIF(JSONCPP_LIB_BUILD_SHARED)
|
ENDIF()
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(jsontestrunner_exe PROPERTIES OUTPUT_NAME jsontestrunner_exe)
|
SET_TARGET_PROPERTIES(jsontestrunner_exe PROPERTIES OUTPUT_NAME jsontestrunner_exe)
|
||||||
|
|
||||||
@@ -25,4 +22,4 @@ IF(PYTHONINTERP_FOUND)
|
|||||||
DEPENDS jsontestrunner_exe jsoncpp_test
|
DEPENDS jsontestrunner_exe jsoncpp_test
|
||||||
)
|
)
|
||||||
ADD_CUSTOM_TARGET(jsoncpp_check DEPENDS jsoncpp_readerwriter_tests)
|
ADD_CUSTOM_TARGET(jsoncpp_check DEPENDS jsoncpp_readerwriter_tests)
|
||||||
ENDIF(PYTHONINTERP_FOUND)
|
ENDIF()
|
||||||
|
@@ -1,15 +1,8 @@
|
|||||||
OPTION(JSONCPP_LIB_BUILD_SHARED "Build jsoncpp_lib as a shared library." OFF)
|
|
||||||
OPTION(JSONCPP_LIB_BUILD_STATIC "Build jsoncpp_lib static library." ON)
|
|
||||||
|
|
||||||
IF(BUILD_SHARED_LIBS)
|
|
||||||
SET(JSONCPP_LIB_BUILD_SHARED ON)
|
|
||||||
ENDIF(BUILD_SHARED_LIBS)
|
|
||||||
|
|
||||||
if( CMAKE_COMPILER_IS_GNUCXX )
|
if( CMAKE_COMPILER_IS_GNUCXX )
|
||||||
#Get compiler version.
|
#Get compiler version.
|
||||||
execute_process( COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
|
execute_process( COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
|
||||||
OUTPUT_VARIABLE GNUCXX_VERSION )
|
OUTPUT_VARIABLE GNUCXX_VERSION )
|
||||||
|
|
||||||
#-Werror=* was introduced -after- GCC 4.1.2
|
#-Werror=* was introduced -after- GCC 4.1.2
|
||||||
if( GNUCXX_VERSION VERSION_GREATER 4.1.2 )
|
if( GNUCXX_VERSION VERSION_GREATER 4.1.2 )
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=strict-aliasing")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=strict-aliasing")
|
||||||
@@ -44,42 +37,44 @@ IF(JSONCPP_WITH_CMAKE_PACKAGE)
|
|||||||
SET(INSTALL_EXPORT EXPORT jsoncpp)
|
SET(INSTALL_EXPORT EXPORT jsoncpp)
|
||||||
ELSE(JSONCPP_WITH_CMAKE_PACKAGE)
|
ELSE(JSONCPP_WITH_CMAKE_PACKAGE)
|
||||||
SET(INSTALL_EXPORT)
|
SET(INSTALL_EXPORT)
|
||||||
ENDIF(JSONCPP_WITH_CMAKE_PACKAGE)
|
ENDIF()
|
||||||
|
|
||||||
IF(JSONCPP_LIB_BUILD_SHARED)
|
IF(BUILD_SHARED_LIBS)
|
||||||
ADD_DEFINITIONS( -DJSON_DLL_BUILD )
|
ADD_DEFINITIONS( -DJSON_DLL_BUILD )
|
||||||
ADD_LIBRARY(jsoncpp_lib SHARED ${PUBLIC_HEADERS} ${jsoncpp_sources})
|
ADD_LIBRARY(jsoncpp_lib SHARED ${PUBLIC_HEADERS} ${jsoncpp_sources})
|
||||||
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_VERSION_MAJOR})
|
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_VERSION_MAJOR})
|
||||||
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES OUTPUT_NAME jsoncpp )
|
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES OUTPUT_NAME jsoncpp
|
||||||
|
DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
|
||||||
|
|
||||||
INSTALL( TARGETS jsoncpp_lib ${INSTALL_EXPORT}
|
INSTALL( TARGETS jsoncpp_lib ${INSTALL_EXPORT}
|
||||||
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
|
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
|
||||||
LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
|
LIBRARY DESTINATION "${LIBRARY_INSTALL_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||||
ARCHIVE DESTINATION ${ARCHIVE_INSTALL_DIR})
|
ARCHIVE DESTINATION "${ARCHIVE_INSTALL_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||||
|
|
||||||
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||||
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib PUBLIC
|
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib PUBLIC
|
||||||
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
|
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>)
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>)
|
||||||
ENDIF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
ENDIF()
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(JSONCPP_LIB_BUILD_STATIC)
|
IF(BUILD_STATIC_LIBS)
|
||||||
ADD_LIBRARY(jsoncpp_lib_static STATIC ${PUBLIC_HEADERS} ${jsoncpp_sources})
|
ADD_LIBRARY(jsoncpp_lib_static STATIC ${PUBLIC_HEADERS} ${jsoncpp_sources})
|
||||||
SET_TARGET_PROPERTIES( jsoncpp_lib_static PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_VERSION_MAJOR})
|
SET_TARGET_PROPERTIES( jsoncpp_lib_static PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_VERSION_MAJOR})
|
||||||
SET_TARGET_PROPERTIES( jsoncpp_lib_static PROPERTIES OUTPUT_NAME jsoncpp )
|
SET_TARGET_PROPERTIES( jsoncpp_lib_static PROPERTIES OUTPUT_NAME jsoncpp
|
||||||
|
DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
|
||||||
|
|
||||||
INSTALL( TARGETS jsoncpp_lib_static ${INSTALL_EXPORT}
|
INSTALL( TARGETS jsoncpp_lib_static ${INSTALL_EXPORT}
|
||||||
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
|
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
|
||||||
LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
|
LIBRARY DESTINATION "${LIBRARY_INSTALL_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||||
ARCHIVE DESTINATION ${ARCHIVE_INSTALL_DIR})
|
ARCHIVE DESTINATION "${ARCHIVE_INSTALL_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||||
|
|
||||||
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||||
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib_static PUBLIC
|
TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib_static PUBLIC
|
||||||
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
|
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
||||||
)
|
)
|
||||||
ENDIF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
|
ENDIF()
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@@ -17,11 +17,21 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <stdexcept>
|
#include <limits>
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below
|
#if defined(_MSC_VER)
|
||||||
|
#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above
|
||||||
|
#define snprintf sprintf_s
|
||||||
|
#elif _MSC_VER >= 1900 // VC++ 14.0 and above
|
||||||
|
#define snprintf std::snprintf
|
||||||
|
#else
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
|
#elif defined(__ANDROID__)
|
||||||
|
#define snprintf snprintf
|
||||||
|
#elif __cplusplus >= 201103L
|
||||||
|
#define snprintf std::snprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
|
#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
|
||||||
// Disable warning about strdup being deprecated.
|
// Disable warning about strdup being deprecated.
|
||||||
@@ -33,10 +43,10 @@ static int stackDepth_g = 0; // see readValue()
|
|||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
#if __cplusplus >= 201103L
|
#if __GNUC__ >= 6
|
||||||
typedef std::unique_ptr<CharReader> CharReaderPtr;
|
typedef std::scoped_ptr<CharReader> const CharReaderPtr;
|
||||||
#else
|
#else
|
||||||
typedef std::auto_ptr<CharReader> CharReaderPtr;
|
typedef std::auto_ptr<CharReader> CharReaderPtr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Implementation of class Features
|
// Implementation of class Features
|
||||||
@@ -145,7 +155,7 @@ bool Reader::readValue() {
|
|||||||
// But this deprecated class has a security problem: Bad input can
|
// But this deprecated class has a security problem: Bad input can
|
||||||
// cause a seg-fault. This seems like a fair, binary-compatible way
|
// cause a seg-fault. This seems like a fair, binary-compatible way
|
||||||
// to prevent the problem.
|
// to prevent the problem.
|
||||||
if (stackDepth_g >= stackLimit_g) throw std::runtime_error("Exceeded stackLimit in readValue().");
|
if (stackDepth_g >= stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue().");
|
||||||
++stackDepth_g;
|
++stackDepth_g;
|
||||||
|
|
||||||
Token token;
|
Token token;
|
||||||
@@ -522,7 +532,7 @@ bool Reader::decodeNumber(Token& token, Value& decoded) {
|
|||||||
++current;
|
++current;
|
||||||
// TODO: Help the compiler do the div and mod at compile time or get rid of them.
|
// TODO: Help the compiler do the div and mod at compile time or get rid of them.
|
||||||
Value::LargestUInt maxIntegerValue =
|
Value::LargestUInt maxIntegerValue =
|
||||||
isNegative ? Value::LargestUInt(-Value::minLargestInt)
|
isNegative ? Value::LargestUInt(Value::maxLargestInt) + 1
|
||||||
: Value::maxLargestUInt;
|
: Value::maxLargestUInt;
|
||||||
Value::LargestUInt threshold = maxIntegerValue / 10;
|
Value::LargestUInt threshold = maxIntegerValue / 10;
|
||||||
Value::LargestUInt value = 0;
|
Value::LargestUInt value = 0;
|
||||||
@@ -543,7 +553,9 @@ bool Reader::decodeNumber(Token& token, Value& decoded) {
|
|||||||
}
|
}
|
||||||
value = value * 10 + digit;
|
value = value * 10 + digit;
|
||||||
}
|
}
|
||||||
if (isNegative)
|
if (isNegative && value == maxIntegerValue)
|
||||||
|
decoded = Value::minLargestInt;
|
||||||
|
else if (isNegative)
|
||||||
decoded = -Value::LargestInt(value);
|
decoded = -Value::LargestInt(value);
|
||||||
else if (value <= Value::LargestUInt(Value::maxInt))
|
else if (value <= Value::LargestUInt(Value::maxInt))
|
||||||
decoded = Value::LargestInt(value);
|
decoded = Value::LargestInt(value);
|
||||||
@@ -562,33 +574,9 @@ bool Reader::decodeDouble(Token& token) {
|
|||||||
|
|
||||||
bool Reader::decodeDouble(Token& token, Value& decoded) {
|
bool Reader::decodeDouble(Token& token, Value& decoded) {
|
||||||
double value = 0;
|
double value = 0;
|
||||||
const int bufferSize = 32;
|
std::string buffer(token.start_, token.end_);
|
||||||
int count;
|
std::istringstream is(buffer);
|
||||||
int length = int(token.end_ - token.start_);
|
if (!(is >> value))
|
||||||
|
|
||||||
// Sanity check to avoid buffer overflow exploits.
|
|
||||||
if (length < 0) {
|
|
||||||
return addError("Unable to parse token length", token);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Avoid using a string constant for the format control string given to
|
|
||||||
// sscanf, as this can cause hard to debug crashes on OS X. See here for more
|
|
||||||
// info:
|
|
||||||
//
|
|
||||||
// http://developer.apple.com/library/mac/#DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/Incompatibilities.html
|
|
||||||
char format[] = "%lf";
|
|
||||||
|
|
||||||
if (length <= bufferSize) {
|
|
||||||
Char buffer[bufferSize + 1];
|
|
||||||
memcpy(buffer, token.start_, length);
|
|
||||||
buffer[length] = 0;
|
|
||||||
count = sscanf(buffer, format, &value);
|
|
||||||
} else {
|
|
||||||
std::string buffer(token.start_, token.end_);
|
|
||||||
count = sscanf(buffer.c_str(), format, &value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count != 1)
|
|
||||||
return addError("'" + std::string(token.start_, token.end_) +
|
return addError("'" + std::string(token.start_, token.end_) +
|
||||||
"' is not a number.",
|
"' is not a number.",
|
||||||
token);
|
token);
|
||||||
@@ -780,15 +768,7 @@ std::string Reader::getLocationLineAndColumn(Location location) const {
|
|||||||
int line, column;
|
int line, column;
|
||||||
getLocationLineAndColumn(location, line, column);
|
getLocationLineAndColumn(location, line, column);
|
||||||
char buffer[18 + 16 + 16 + 1];
|
char buffer[18 + 16 + 16 + 1];
|
||||||
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
|
|
||||||
#if defined(WINCE)
|
|
||||||
_snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
|
|
||||||
#else
|
|
||||||
sprintf_s(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
|
snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
|
||||||
#endif
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -828,6 +808,7 @@ public:
|
|||||||
bool allowSingleQuotes_;
|
bool allowSingleQuotes_;
|
||||||
bool failIfExtra_;
|
bool failIfExtra_;
|
||||||
bool rejectDupKeys_;
|
bool rejectDupKeys_;
|
||||||
|
bool allowSpecialFloats_;
|
||||||
int stackLimit_;
|
int stackLimit_;
|
||||||
}; // OurFeatures
|
}; // OurFeatures
|
||||||
|
|
||||||
@@ -839,6 +820,7 @@ OurFeatures::OurFeatures()
|
|||||||
, allowDroppedNullPlaceholders_(false), allowNumericKeys_(false)
|
, allowDroppedNullPlaceholders_(false), allowNumericKeys_(false)
|
||||||
, allowSingleQuotes_(false)
|
, allowSingleQuotes_(false)
|
||||||
, failIfExtra_(false)
|
, failIfExtra_(false)
|
||||||
|
, allowSpecialFloats_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -880,6 +862,9 @@ private:
|
|||||||
tokenTrue,
|
tokenTrue,
|
||||||
tokenFalse,
|
tokenFalse,
|
||||||
tokenNull,
|
tokenNull,
|
||||||
|
tokenNaN,
|
||||||
|
tokenPosInf,
|
||||||
|
tokenNegInf,
|
||||||
tokenArraySeparator,
|
tokenArraySeparator,
|
||||||
tokenMemberSeparator,
|
tokenMemberSeparator,
|
||||||
tokenComment,
|
tokenComment,
|
||||||
@@ -910,7 +895,7 @@ private:
|
|||||||
bool readCppStyleComment();
|
bool readCppStyleComment();
|
||||||
bool readString();
|
bool readString();
|
||||||
bool readStringSingleQuote();
|
bool readStringSingleQuote();
|
||||||
void readNumber();
|
bool readNumber(bool checkInf);
|
||||||
bool readValue();
|
bool readValue();
|
||||||
bool readObject(Token& token);
|
bool readObject(Token& token);
|
||||||
bool readArray(Token& token);
|
bool readArray(Token& token);
|
||||||
@@ -1014,7 +999,7 @@ bool OurReader::parse(const char* beginDoc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OurReader::readValue() {
|
bool OurReader::readValue() {
|
||||||
if (stackDepth_ >= features_.stackLimit_) throw std::runtime_error("Exceeded stackLimit in readValue().");
|
if (stackDepth_ >= features_.stackLimit_) throwRuntimeError("Exceeded stackLimit in readValue().");
|
||||||
++stackDepth_;
|
++stackDepth_;
|
||||||
Token token;
|
Token token;
|
||||||
skipCommentTokens(token);
|
skipCommentTokens(token);
|
||||||
@@ -1056,6 +1041,24 @@ bool OurReader::readValue() {
|
|||||||
currentValue().swapPayload(v);
|
currentValue().swapPayload(v);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case tokenNaN:
|
||||||
|
{
|
||||||
|
Value v(std::numeric_limits<double>::quiet_NaN());
|
||||||
|
currentValue().swapPayload(v);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case tokenPosInf:
|
||||||
|
{
|
||||||
|
Value v(std::numeric_limits<double>::infinity());
|
||||||
|
currentValue().swapPayload(v);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case tokenNegInf:
|
||||||
|
{
|
||||||
|
Value v(-std::numeric_limits<double>::infinity());
|
||||||
|
currentValue().swapPayload(v);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case tokenArraySeparator:
|
case tokenArraySeparator:
|
||||||
case tokenObjectEnd:
|
case tokenObjectEnd:
|
||||||
case tokenArrayEnd:
|
case tokenArrayEnd:
|
||||||
@@ -1132,9 +1135,16 @@ bool OurReader::readToken(Token& token) {
|
|||||||
case '7':
|
case '7':
|
||||||
case '8':
|
case '8':
|
||||||
case '9':
|
case '9':
|
||||||
case '-':
|
|
||||||
token.type_ = tokenNumber;
|
token.type_ = tokenNumber;
|
||||||
readNumber();
|
readNumber(false);
|
||||||
|
break;
|
||||||
|
case '-':
|
||||||
|
if (readNumber(true)) {
|
||||||
|
token.type_ = tokenNumber;
|
||||||
|
} else {
|
||||||
|
token.type_ = tokenNegInf;
|
||||||
|
ok = features_.allowSpecialFloats_ && match("nfinity", 7);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
token.type_ = tokenTrue;
|
token.type_ = tokenTrue;
|
||||||
@@ -1148,6 +1158,22 @@ bool OurReader::readToken(Token& token) {
|
|||||||
token.type_ = tokenNull;
|
token.type_ = tokenNull;
|
||||||
ok = match("ull", 3);
|
ok = match("ull", 3);
|
||||||
break;
|
break;
|
||||||
|
case 'N':
|
||||||
|
if (features_.allowSpecialFloats_) {
|
||||||
|
token.type_ = tokenNaN;
|
||||||
|
ok = match("aN", 2);
|
||||||
|
} else {
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'I':
|
||||||
|
if (features_.allowSpecialFloats_) {
|
||||||
|
token.type_ = tokenPosInf;
|
||||||
|
ok = match("nfinity", 7);
|
||||||
|
} else {
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ',':
|
case ',':
|
||||||
token.type_ = tokenArraySeparator;
|
token.type_ = tokenArraySeparator;
|
||||||
break;
|
break;
|
||||||
@@ -1248,8 +1274,12 @@ bool OurReader::readCppStyleComment() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OurReader::readNumber() {
|
bool OurReader::readNumber(bool checkInf) {
|
||||||
const char *p = current_;
|
const char *p = current_;
|
||||||
|
if (checkInf && p != end_ && *p == 'I') {
|
||||||
|
current_ = ++p;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
char c = '0'; // stopgap for already consumed character
|
char c = '0'; // stopgap for already consumed character
|
||||||
// integral part
|
// integral part
|
||||||
while (c >= '0' && c <= '9')
|
while (c >= '0' && c <= '9')
|
||||||
@@ -1268,6 +1298,7 @@ void OurReader::readNumber() {
|
|||||||
while (c >= '0' && c <= '9')
|
while (c >= '0' && c <= '9')
|
||||||
c = (current_ = p) < end_ ? *p++ : 0;
|
c = (current_ = p) < end_ ? *p++ : 0;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
bool OurReader::readString() {
|
bool OurReader::readString() {
|
||||||
Char c = 0;
|
Char c = 0;
|
||||||
@@ -1294,7 +1325,7 @@ bool OurReader::readStringSingleQuote() {
|
|||||||
return c == '\'';
|
return c == '\'';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OurReader::readObject(Token& tokenStart) {
|
bool OurReader::readObject(Token& /*tokenStart*/) {
|
||||||
Token tokenName;
|
Token tokenName;
|
||||||
std::string name;
|
std::string name;
|
||||||
Value init(objectValue);
|
Value init(objectValue);
|
||||||
@@ -1325,7 +1356,7 @@ bool OurReader::readObject(Token& tokenStart) {
|
|||||||
return addErrorAndRecover(
|
return addErrorAndRecover(
|
||||||
"Missing ':' after object member name", colon, tokenObjectEnd);
|
"Missing ':' after object member name", colon, tokenObjectEnd);
|
||||||
}
|
}
|
||||||
if (name.length() >= (1U<<30)) throw std::runtime_error("keylength >= 2^30");
|
if (name.length() >= (1U<<30)) throwRuntimeError("keylength >= 2^30");
|
||||||
if (features_.rejectDupKeys_ && currentValue().isMember(name)) {
|
if (features_.rejectDupKeys_ && currentValue().isMember(name)) {
|
||||||
std::string msg = "Duplicate key: '" + name + "'";
|
std::string msg = "Duplicate key: '" + name + "'";
|
||||||
return addErrorAndRecover(
|
return addErrorAndRecover(
|
||||||
@@ -1355,7 +1386,7 @@ bool OurReader::readObject(Token& tokenStart) {
|
|||||||
"Missing '}' or object member name", tokenName, tokenObjectEnd);
|
"Missing '}' or object member name", tokenName, tokenObjectEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OurReader::readArray(Token& tokenStart) {
|
bool OurReader::readArray(Token& /*tokenStart*/) {
|
||||||
Value init(arrayValue);
|
Value init(arrayValue);
|
||||||
currentValue().swapPayload(init);
|
currentValue().swapPayload(init);
|
||||||
skipSpaces();
|
skipSpaces();
|
||||||
@@ -1450,33 +1481,9 @@ bool OurReader::decodeDouble(Token& token) {
|
|||||||
|
|
||||||
bool OurReader::decodeDouble(Token& token, Value& decoded) {
|
bool OurReader::decodeDouble(Token& token, Value& decoded) {
|
||||||
double value = 0;
|
double value = 0;
|
||||||
const int bufferSize = 32;
|
std::string buffer( token.start_, token.end_ );
|
||||||
int count;
|
std::istringstream is(buffer);
|
||||||
int length = int(token.end_ - token.start_);
|
if (!(is >> value))
|
||||||
|
|
||||||
// Sanity check to avoid buffer overflow exploits.
|
|
||||||
if (length < 0) {
|
|
||||||
return addError("Unable to parse token length", token);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Avoid using a string constant for the format control string given to
|
|
||||||
// sscanf, as this can cause hard to debug crashes on OS X. See here for more
|
|
||||||
// info:
|
|
||||||
//
|
|
||||||
// http://developer.apple.com/library/mac/#DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/Incompatibilities.html
|
|
||||||
char format[] = "%lf";
|
|
||||||
|
|
||||||
if (length <= bufferSize) {
|
|
||||||
Char buffer[bufferSize + 1];
|
|
||||||
memcpy(buffer, token.start_, length);
|
|
||||||
buffer[length] = 0;
|
|
||||||
count = sscanf(buffer, format, &value);
|
|
||||||
} else {
|
|
||||||
std::string buffer(token.start_, token.end_);
|
|
||||||
count = sscanf(buffer.c_str(), format, &value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count != 1)
|
|
||||||
return addError("'" + std::string(token.start_, token.end_) +
|
return addError("'" + std::string(token.start_, token.end_) +
|
||||||
"' is not a number.",
|
"' is not a number.",
|
||||||
token);
|
token);
|
||||||
@@ -1668,15 +1675,7 @@ std::string OurReader::getLocationLineAndColumn(Location location) const {
|
|||||||
int line, column;
|
int line, column;
|
||||||
getLocationLineAndColumn(location, line, column);
|
getLocationLineAndColumn(location, line, column);
|
||||||
char buffer[18 + 16 + 16 + 1];
|
char buffer[18 + 16 + 16 + 1];
|
||||||
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
|
|
||||||
#if defined(WINCE)
|
|
||||||
_snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
|
|
||||||
#else
|
|
||||||
sprintf_s(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
|
snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
|
||||||
#endif
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1736,6 +1735,7 @@ CharReader* CharReaderBuilder::newCharReader() const
|
|||||||
features.stackLimit_ = settings_["stackLimit"].asInt();
|
features.stackLimit_ = settings_["stackLimit"].asInt();
|
||||||
features.failIfExtra_ = settings_["failIfExtra"].asBool();
|
features.failIfExtra_ = settings_["failIfExtra"].asBool();
|
||||||
features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool();
|
features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool();
|
||||||
|
features.allowSpecialFloats_ = settings_["allowSpecialFloats"].asBool();
|
||||||
return new OurCharReader(collectComments, features);
|
return new OurCharReader(collectComments, features);
|
||||||
}
|
}
|
||||||
static void getValidReaderKeys(std::set<std::string>* valid_keys)
|
static void getValidReaderKeys(std::set<std::string>* valid_keys)
|
||||||
@@ -1750,6 +1750,7 @@ static void getValidReaderKeys(std::set<std::string>* valid_keys)
|
|||||||
valid_keys->insert("stackLimit");
|
valid_keys->insert("stackLimit");
|
||||||
valid_keys->insert("failIfExtra");
|
valid_keys->insert("failIfExtra");
|
||||||
valid_keys->insert("rejectDupKeys");
|
valid_keys->insert("rejectDupKeys");
|
||||||
|
valid_keys->insert("allowSpecialFloats");
|
||||||
}
|
}
|
||||||
bool CharReaderBuilder::validate(Json::Value* invalid) const
|
bool CharReaderBuilder::validate(Json::Value* invalid) const
|
||||||
{
|
{
|
||||||
@@ -1783,6 +1784,7 @@ void CharReaderBuilder::strictMode(Json::Value* settings)
|
|||||||
(*settings)["allowSingleQuotes"] = false;
|
(*settings)["allowSingleQuotes"] = false;
|
||||||
(*settings)["failIfExtra"] = true;
|
(*settings)["failIfExtra"] = true;
|
||||||
(*settings)["rejectDupKeys"] = true;
|
(*settings)["rejectDupKeys"] = true;
|
||||||
|
(*settings)["allowSpecialFloats"] = false;
|
||||||
//! [CharReaderBuilderStrictMode]
|
//! [CharReaderBuilderStrictMode]
|
||||||
}
|
}
|
||||||
// static
|
// static
|
||||||
@@ -1798,6 +1800,7 @@ void CharReaderBuilder::setDefaults(Json::Value* settings)
|
|||||||
(*settings)["stackLimit"] = 1000;
|
(*settings)["stackLimit"] = 1000;
|
||||||
(*settings)["failIfExtra"] = false;
|
(*settings)["failIfExtra"] = false;
|
||||||
(*settings)["rejectDupKeys"] = false;
|
(*settings)["rejectDupKeys"] = false;
|
||||||
|
(*settings)["allowSpecialFloats"] = false;
|
||||||
//! [CharReaderBuilderDefaults]
|
//! [CharReaderBuilderDefaults]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1827,7 +1830,7 @@ std::istream& operator>>(std::istream& sin, Value& root) {
|
|||||||
"Error from reader: %s",
|
"Error from reader: %s",
|
||||||
errs.c_str());
|
errs.c_str());
|
||||||
|
|
||||||
JSON_FAIL_MESSAGE("reader error");
|
throwRuntimeError("reader error");
|
||||||
}
|
}
|
||||||
return sin;
|
return sin;
|
||||||
}
|
}
|
||||||
|
@@ -30,8 +30,8 @@ static inline std::string codePointToUTF8(unsigned int cp) {
|
|||||||
} else if (cp <= 0xFFFF) {
|
} else if (cp <= 0xFFFF) {
|
||||||
result.resize(3);
|
result.resize(3);
|
||||||
result[2] = static_cast<char>(0x80 | (0x3f & cp));
|
result[2] = static_cast<char>(0x80 | (0x3f & cp));
|
||||||
result[1] = 0x80 | static_cast<char>((0x3f & (cp >> 6)));
|
result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
|
||||||
result[0] = 0xE0 | static_cast<char>((0xf & (cp >> 12)));
|
result[0] = static_cast<char>(0xE0 | (0xf & (cp >> 12)));
|
||||||
} else if (cp <= 0x10FFFF) {
|
} else if (cp <= 0x10FFFF) {
|
||||||
result.resize(4);
|
result.resize(4);
|
||||||
result[3] = static_cast<char>(0x80 | (0x3f & cp));
|
result[3] = static_cast<char>(0x80 | (0x3f & cp));
|
||||||
@@ -43,7 +43,7 @@ static inline std::string codePointToUTF8(unsigned int cp) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if ch is a control character (in range [0,32[).
|
/// Returns true if ch is a control character (in range [1,31]).
|
||||||
static inline bool isControlCharacter(char ch) { return ch > 0 && ch <= 0x1F; }
|
static inline bool isControlCharacter(char ch) { return ch > 0 && ch <= 0x1F; }
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -63,7 +63,7 @@ typedef char UIntToStringBuffer[uintToStringBufferSize];
|
|||||||
static inline void uintToString(LargestUInt value, char*& current) {
|
static inline void uintToString(LargestUInt value, char*& current) {
|
||||||
*--current = 0;
|
*--current = 0;
|
||||||
do {
|
do {
|
||||||
*--current = char(value % 10) + '0';
|
*--current = static_cast<signed char>(value % 10U + static_cast<unsigned>('0'));
|
||||||
value /= 10;
|
value /= 10;
|
||||||
} while (value != 0);
|
} while (value != 0);
|
||||||
}
|
}
|
||||||
|
@@ -88,9 +88,11 @@ static inline char* duplicateStringValue(const char* value,
|
|||||||
length = Value::maxInt - 1;
|
length = Value::maxInt - 1;
|
||||||
|
|
||||||
char* newString = static_cast<char*>(malloc(length + 1));
|
char* newString = static_cast<char*>(malloc(length + 1));
|
||||||
JSON_ASSERT_MESSAGE(newString != 0,
|
if (newString == NULL) {
|
||||||
"in Json::Value::duplicateStringValue(): "
|
throwRuntimeError(
|
||||||
"Failed to allocate string value buffer");
|
"in Json::Value::duplicateStringValue(): "
|
||||||
|
"Failed to allocate string value buffer");
|
||||||
|
}
|
||||||
memcpy(newString, value, length);
|
memcpy(newString, value, length);
|
||||||
newString[length] = 0;
|
newString[length] = 0;
|
||||||
return newString;
|
return newString;
|
||||||
@@ -107,11 +109,13 @@ static inline char* duplicateAndPrefixStringValue(
|
|||||||
JSON_ASSERT_MESSAGE(length <= (unsigned)Value::maxInt - sizeof(unsigned) - 1U,
|
JSON_ASSERT_MESSAGE(length <= (unsigned)Value::maxInt - sizeof(unsigned) - 1U,
|
||||||
"in Json::Value::duplicateAndPrefixStringValue(): "
|
"in Json::Value::duplicateAndPrefixStringValue(): "
|
||||||
"length too big for prefixing");
|
"length too big for prefixing");
|
||||||
unsigned actualLength = length + sizeof(unsigned) + 1U;
|
unsigned actualLength = length + static_cast<unsigned>(sizeof(unsigned)) + 1U;
|
||||||
char* newString = static_cast<char*>(malloc(actualLength));
|
char* newString = static_cast<char*>(malloc(actualLength));
|
||||||
JSON_ASSERT_MESSAGE(newString != 0,
|
if (newString == 0) {
|
||||||
"in Json::Value::duplicateAndPrefixStringValue(): "
|
throwRuntimeError(
|
||||||
"Failed to allocate string value buffer");
|
"in Json::Value::duplicateAndPrefixStringValue(): "
|
||||||
|
"Failed to allocate string value buffer");
|
||||||
|
}
|
||||||
*reinterpret_cast<unsigned*>(newString) = length;
|
*reinterpret_cast<unsigned*>(newString) = length;
|
||||||
memcpy(newString + sizeof(unsigned), value, length);
|
memcpy(newString + sizeof(unsigned), value, length);
|
||||||
newString[actualLength - 1U] = 0; // to avoid buffer over-run accidents by users later
|
newString[actualLength - 1U] = 0; // to avoid buffer over-run accidents by users later
|
||||||
@@ -122,7 +126,7 @@ inline static void decodePrefixedString(
|
|||||||
unsigned* length, char const** value)
|
unsigned* length, char const** value)
|
||||||
{
|
{
|
||||||
if (!isPrefixed) {
|
if (!isPrefixed) {
|
||||||
*length = strlen(prefixed);
|
*length = static_cast<unsigned>(strlen(prefixed));
|
||||||
*value = prefixed;
|
*value = prefixed;
|
||||||
} else {
|
} else {
|
||||||
*length = *reinterpret_cast<unsigned const*>(prefixed);
|
*length = *reinterpret_cast<unsigned const*>(prefixed);
|
||||||
@@ -149,6 +153,30 @@ static inline void releaseStringValue(char* value) { free(value); }
|
|||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
|
Exception::Exception(std::string const& msg)
|
||||||
|
: msg_(msg)
|
||||||
|
{}
|
||||||
|
Exception::~Exception() throw()
|
||||||
|
{}
|
||||||
|
char const* Exception::what() const throw()
|
||||||
|
{
|
||||||
|
return msg_.c_str();
|
||||||
|
}
|
||||||
|
RuntimeError::RuntimeError(std::string const& msg)
|
||||||
|
: Exception(msg)
|
||||||
|
{}
|
||||||
|
LogicError::LogicError(std::string const& msg)
|
||||||
|
: Exception(msg)
|
||||||
|
{}
|
||||||
|
JSONCPP_NORETURN void throwRuntimeError(std::string const& msg)
|
||||||
|
{
|
||||||
|
throw RuntimeError(msg);
|
||||||
|
}
|
||||||
|
JSONCPP_NORETURN void throwLogicError(std::string const& msg)
|
||||||
|
{
|
||||||
|
throw LogicError(msg);
|
||||||
|
}
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////
|
||||||
// //////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////
|
||||||
// //////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////
|
||||||
@@ -188,14 +216,14 @@ void Value::CommentInfo::setComment(const char* text, size_t len) {
|
|||||||
// Notes: policy_ indicates if the string was allocated when
|
// Notes: policy_ indicates if the string was allocated when
|
||||||
// a string is stored.
|
// a string is stored.
|
||||||
|
|
||||||
Value::CZString::CZString(ArrayIndex index) : cstr_(0), index_(index) {}
|
Value::CZString::CZString(ArrayIndex aindex) : cstr_(0), index_(aindex) {}
|
||||||
|
|
||||||
Value::CZString::CZString(char const* str, unsigned length, DuplicationPolicy allocate)
|
Value::CZString::CZString(char const* str, unsigned ulength, DuplicationPolicy allocate)
|
||||||
: cstr_(str)
|
: cstr_(str)
|
||||||
{
|
{
|
||||||
// allocate != duplicate
|
// allocate != duplicate
|
||||||
storage_.policy_ = allocate;
|
storage_.policy_ = allocate & 0x3;
|
||||||
storage_.length_ = length;
|
storage_.length_ = ulength & 0x3FFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value::CZString::CZString(const CZString& other)
|
Value::CZString::CZString(const CZString& other)
|
||||||
@@ -204,9 +232,9 @@ Value::CZString::CZString(const CZString& other)
|
|||||||
: other.cstr_)
|
: other.cstr_)
|
||||||
{
|
{
|
||||||
storage_.policy_ = (other.cstr_
|
storage_.policy_ = (other.cstr_
|
||||||
? (other.storage_.policy_ == noDuplication
|
? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
|
||||||
? noDuplication : duplicate)
|
? noDuplication : duplicate)
|
||||||
: other.storage_.policy_);
|
: static_cast<DuplicationPolicy>(other.storage_.policy_));
|
||||||
storage_.length_ = other.storage_.length_;
|
storage_.length_ = other.storage_.length_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,9 +296,9 @@ bool Value::CZString::isStaticString() const { return storage_.policy_ == noDupl
|
|||||||
* memset( this, 0, sizeof(Value) )
|
* memset( this, 0, sizeof(Value) )
|
||||||
* This optimization is used in ValueInternalMap fast allocator.
|
* This optimization is used in ValueInternalMap fast allocator.
|
||||||
*/
|
*/
|
||||||
Value::Value(ValueType type) {
|
Value::Value(ValueType vtype) {
|
||||||
initBasic(type);
|
initBasic(vtype);
|
||||||
switch (type) {
|
switch (vtype) {
|
||||||
case nullValue:
|
case nullValue:
|
||||||
break;
|
break;
|
||||||
case intValue:
|
case intValue:
|
||||||
@@ -435,7 +463,7 @@ void Value::swapPayload(Value& other) {
|
|||||||
std::swap(value_, other.value_);
|
std::swap(value_, other.value_);
|
||||||
int temp2 = allocated_;
|
int temp2 = allocated_;
|
||||||
allocated_ = other.allocated_;
|
allocated_ = other.allocated_;
|
||||||
other.allocated_ = temp2;
|
other.allocated_ = temp2 & 0x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Value::swap(Value& other) {
|
void Value::swap(Value& other) {
|
||||||
@@ -561,12 +589,12 @@ const char* Value::asCString() const {
|
|||||||
return this_str;
|
return this_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Value::getString(char const** str, char const** end) const {
|
bool Value::getString(char const** str, char const** cend) const {
|
||||||
if (type_ != stringValue) return false;
|
if (type_ != stringValue) return false;
|
||||||
if (value_.string_ == 0) return false;
|
if (value_.string_ == 0) return false;
|
||||||
unsigned length;
|
unsigned length;
|
||||||
decodePrefixedString(this->allocated_, this->value_.string_, &length, str);
|
decodePrefixedString(this->allocated_, this->value_.string_, &length, str);
|
||||||
*end = *str + length;
|
*cend = *str + length;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,7 +793,8 @@ bool Value::asBool() const {
|
|||||||
case uintValue:
|
case uintValue:
|
||||||
return value_.uint_ ? true : false;
|
return value_.uint_ ? true : false;
|
||||||
case realValue:
|
case realValue:
|
||||||
return value_.real_ ? true : false;
|
// This is kind of strange. Not recommended.
|
||||||
|
return (value_.real_ != 0.0) ? true : false;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -913,8 +942,8 @@ const Value& Value::operator[](int index) const {
|
|||||||
return (*this)[ArrayIndex(index)];
|
return (*this)[ArrayIndex(index)];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Value::initBasic(ValueType type, bool allocated) {
|
void Value::initBasic(ValueType vtype, bool allocated) {
|
||||||
type_ = type;
|
type_ = vtype;
|
||||||
allocated_ = allocated;
|
allocated_ = allocated;
|
||||||
comments_ = 0;
|
comments_ = 0;
|
||||||
}
|
}
|
||||||
@@ -941,7 +970,7 @@ Value& Value::resolveReference(const char* key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @param key is not null-terminated.
|
// @param key is not null-terminated.
|
||||||
Value& Value::resolveReference(char const* key, char const* end)
|
Value& Value::resolveReference(char const* key, char const* cend)
|
||||||
{
|
{
|
||||||
JSON_ASSERT_MESSAGE(
|
JSON_ASSERT_MESSAGE(
|
||||||
type_ == nullValue || type_ == objectValue,
|
type_ == nullValue || type_ == objectValue,
|
||||||
@@ -949,7 +978,7 @@ Value& Value::resolveReference(char const* key, char const* end)
|
|||||||
if (type_ == nullValue)
|
if (type_ == nullValue)
|
||||||
*this = Value(objectValue);
|
*this = Value(objectValue);
|
||||||
CZString actualKey(
|
CZString actualKey(
|
||||||
key, static_cast<unsigned>(end-key), CZString::duplicateOnCopy);
|
key, static_cast<unsigned>(cend-key), CZString::duplicateOnCopy);
|
||||||
ObjectValues::iterator it = value_.map_->lower_bound(actualKey);
|
ObjectValues::iterator it = value_.map_->lower_bound(actualKey);
|
||||||
if (it != value_.map_->end() && (*it).first == actualKey)
|
if (it != value_.map_->end() && (*it).first == actualKey)
|
||||||
return (*it).second;
|
return (*it).second;
|
||||||
@@ -967,13 +996,13 @@ Value Value::get(ArrayIndex index, const Value& defaultValue) const {
|
|||||||
|
|
||||||
bool Value::isValidIndex(ArrayIndex index) const { return index < size(); }
|
bool Value::isValidIndex(ArrayIndex index) const { return index < size(); }
|
||||||
|
|
||||||
Value const* Value::find(char const* key, char const* end) const
|
Value const* Value::find(char const* key, char const* cend) const
|
||||||
{
|
{
|
||||||
JSON_ASSERT_MESSAGE(
|
JSON_ASSERT_MESSAGE(
|
||||||
type_ == nullValue || type_ == objectValue,
|
type_ == nullValue || type_ == objectValue,
|
||||||
"in Json::Value::find(key, end, found): requires objectValue or nullValue");
|
"in Json::Value::find(key, end, found): requires objectValue or nullValue");
|
||||||
if (type_ == nullValue) return NULL;
|
if (type_ == nullValue) return NULL;
|
||||||
CZString actualKey(key, static_cast<unsigned>(end-key), CZString::noDuplication);
|
CZString actualKey(key, static_cast<unsigned>(cend-key), CZString::noDuplication);
|
||||||
ObjectValues::const_iterator it = value_.map_->find(actualKey);
|
ObjectValues::const_iterator it = value_.map_->find(actualKey);
|
||||||
if (it == value_.map_->end()) return NULL;
|
if (it == value_.map_->end()) return NULL;
|
||||||
return &(*it).second;
|
return &(*it).second;
|
||||||
@@ -1017,9 +1046,9 @@ Value const& Value::operator[](CppTL::ConstString const& key) const
|
|||||||
|
|
||||||
Value& Value::append(const Value& value) { return (*this)[size()] = value; }
|
Value& Value::append(const Value& value) { return (*this)[size()] = value; }
|
||||||
|
|
||||||
Value Value::get(char const* key, char const* end, Value const& defaultValue) const
|
Value Value::get(char const* key, char const* cend, Value const& defaultValue) const
|
||||||
{
|
{
|
||||||
Value const* found = find(key, end);
|
Value const* found = find(key, cend);
|
||||||
return !found ? defaultValue : *found;
|
return !found ? defaultValue : *found;
|
||||||
}
|
}
|
||||||
Value Value::get(char const* key, Value const& defaultValue) const
|
Value Value::get(char const* key, Value const& defaultValue) const
|
||||||
@@ -1032,12 +1061,12 @@ Value Value::get(std::string const& key, Value const& defaultValue) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Value::removeMember(const char* key, const char* end, Value* removed)
|
bool Value::removeMember(const char* key, const char* cend, Value* removed)
|
||||||
{
|
{
|
||||||
if (type_ != objectValue) {
|
if (type_ != objectValue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CZString actualKey(key, static_cast<unsigned>(end-key), CZString::noDuplication);
|
CZString actualKey(key, static_cast<unsigned>(cend-key), CZString::noDuplication);
|
||||||
ObjectValues::iterator it = value_.map_->find(actualKey);
|
ObjectValues::iterator it = value_.map_->find(actualKey);
|
||||||
if (it == value_.map_->end())
|
if (it == value_.map_->end())
|
||||||
return false;
|
return false;
|
||||||
@@ -1082,8 +1111,8 @@ bool Value::removeIndex(ArrayIndex index, Value* removed) {
|
|||||||
ArrayIndex oldSize = size();
|
ArrayIndex oldSize = size();
|
||||||
// shift left all items left, into the place of the "removed"
|
// shift left all items left, into the place of the "removed"
|
||||||
for (ArrayIndex i = index; i < (oldSize - 1); ++i){
|
for (ArrayIndex i = index; i < (oldSize - 1); ++i){
|
||||||
CZString key(i);
|
CZString keey(i);
|
||||||
(*value_.map_)[key] = (*this)[i + 1];
|
(*value_.map_)[keey] = (*this)[i + 1];
|
||||||
}
|
}
|
||||||
// erase the last one ("leftover")
|
// erase the last one ("leftover")
|
||||||
CZString keyLast(oldSize - 1);
|
CZString keyLast(oldSize - 1);
|
||||||
@@ -1099,9 +1128,9 @@ Value Value::get(const CppTL::ConstString& key,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool Value::isMember(char const* key, char const* end) const
|
bool Value::isMember(char const* key, char const* cend) const
|
||||||
{
|
{
|
||||||
Value const* value = find(key, end);
|
Value const* value = find(key, cend);
|
||||||
return NULL != value;
|
return NULL != value;
|
||||||
}
|
}
|
||||||
bool Value::isMember(char const* key) const
|
bool Value::isMember(char const* key) const
|
||||||
|
@@ -92,19 +92,27 @@ UInt ValueIteratorBase::index() const {
|
|||||||
return Value::UInt(-1);
|
return Value::UInt(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ValueIteratorBase::name() const {
|
||||||
|
char const* keey;
|
||||||
|
char const* end;
|
||||||
|
keey = memberName(&end);
|
||||||
|
if (!keey) return std::string();
|
||||||
|
return std::string(keey, end);
|
||||||
|
}
|
||||||
|
|
||||||
char const* ValueIteratorBase::memberName() const {
|
char const* ValueIteratorBase::memberName() const {
|
||||||
const char* name = (*current_).first.data();
|
const char* cname = (*current_).first.data();
|
||||||
return name ? name : "";
|
return cname ? cname : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* ValueIteratorBase::memberName(char const** end) const {
|
char const* ValueIteratorBase::memberName(char const** end) const {
|
||||||
const char* name = (*current_).first.data();
|
const char* cname = (*current_).first.data();
|
||||||
if (!name) {
|
if (!cname) {
|
||||||
*end = NULL;
|
*end = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
*end = name + (*current_).first.length();
|
*end = cname + (*current_).first.length();
|
||||||
return name;
|
return cname;
|
||||||
}
|
}
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
@@ -12,13 +12,36 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <stdexcept>
|
#include <cassert>
|
||||||
#include <assert.h>
|
#include <cstring>
|
||||||
#include <math.h>
|
#include <cstdio>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below
|
#if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1800 // Between VC++ 6.0 and VC++ 11.0
|
||||||
|
#include <float.h>
|
||||||
|
#define isfinite _finite
|
||||||
|
#elif defined(__sun) && defined(__SVR4) //Solaris
|
||||||
|
#include <ieeefp.h>
|
||||||
|
#define isfinite finite
|
||||||
|
#else
|
||||||
|
#include <cmath>
|
||||||
|
#define isfinite std::isfinite
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above
|
||||||
|
#define snprintf sprintf_s
|
||||||
|
#elif _MSC_VER >= 1900 // VC++ 14.0 and above
|
||||||
|
#define snprintf std::snprintf
|
||||||
|
#else
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#endif
|
||||||
|
#elif defined(__ANDROID__)
|
||||||
|
#define snprintf snprintf
|
||||||
|
#elif __cplusplus >= 201103L
|
||||||
|
#define snprintf std::snprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__BORLANDC__)
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#define isfinite _finite
|
#define isfinite _finite
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
@@ -29,17 +52,12 @@
|
|||||||
#pragma warning(disable : 4996)
|
#pragma warning(disable : 4996)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__sun) && defined(__SVR4) //Solaris
|
|
||||||
#include <ieeefp.h>
|
|
||||||
#define isfinite finite
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
#if __cplusplus >= 201103L
|
#if __GNUC__ >= 6
|
||||||
typedef std::unique_ptr<StreamWriter> StreamWriterPtr;
|
typedef std::scoped_ptr<StreamWriter> const StreamWriterPtr;
|
||||||
#else
|
#else
|
||||||
typedef std::auto_ptr<StreamWriter> StreamWriterPtr;
|
typedef std::auto_ptr<StreamWriter> StreamWriterPtr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool containsControlCharacter(const char* str) {
|
static bool containsControlCharacter(const char* str) {
|
||||||
@@ -63,12 +81,15 @@ static bool containsControlCharacter0(const char* str, unsigned len) {
|
|||||||
std::string valueToString(LargestInt value) {
|
std::string valueToString(LargestInt value) {
|
||||||
UIntToStringBuffer buffer;
|
UIntToStringBuffer buffer;
|
||||||
char* current = buffer + sizeof(buffer);
|
char* current = buffer + sizeof(buffer);
|
||||||
bool isNegative = value < 0;
|
if (value == Value::minLargestInt) {
|
||||||
if (isNegative)
|
uintToString(LargestUInt(Value::maxLargestInt) + 1, current);
|
||||||
value = -value;
|
|
||||||
uintToString(LargestUInt(value), current);
|
|
||||||
if (isNegative)
|
|
||||||
*--current = '-';
|
*--current = '-';
|
||||||
|
} else if (value < 0) {
|
||||||
|
uintToString(LargestUInt(-value), current);
|
||||||
|
*--current = '-';
|
||||||
|
} else {
|
||||||
|
uintToString(LargestUInt(value), current);
|
||||||
|
}
|
||||||
assert(current >= buffer);
|
assert(current >= buffer);
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
@@ -93,43 +114,38 @@ std::string valueToString(UInt value) {
|
|||||||
|
|
||||||
#endif // # if defined(JSON_HAS_INT64)
|
#endif // # if defined(JSON_HAS_INT64)
|
||||||
|
|
||||||
std::string valueToString(double value) {
|
std::string valueToString(double value, bool useSpecialFloats, unsigned int precision) {
|
||||||
// Allocate a buffer that is more than large enough to store the 16 digits of
|
// Allocate a buffer that is more than large enough to store the 16 digits of
|
||||||
// precision requested below.
|
// precision requested below.
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
int len = -1;
|
int len = -1;
|
||||||
|
|
||||||
// Print into the buffer. We need not request the alternative representation
|
char formatString[6];
|
||||||
// that always has a decimal point because JSON doesn't distingish the
|
sprintf(formatString, "%%.%dg", precision);
|
||||||
// concepts of reals and integers.
|
|
||||||
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with
|
// Print into the buffer. We need not request the alternative representation
|
||||||
// visual studio 2005 to
|
// that always has a decimal point because JSON doesn't distingish the
|
||||||
// avoid warning.
|
// concepts of reals and integers.
|
||||||
#if defined(WINCE)
|
|
||||||
len = _snprintf(buffer, sizeof(buffer), "%.17g", value);
|
|
||||||
#else
|
|
||||||
len = sprintf_s(buffer, sizeof(buffer), "%.17g", value);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
if (isfinite(value)) {
|
if (isfinite(value)) {
|
||||||
len = snprintf(buffer, sizeof(buffer), "%.17g", value);
|
len = snprintf(buffer, sizeof(buffer), formatString, value);
|
||||||
} else {
|
} else {
|
||||||
// IEEE standard states that NaN values will not compare to themselves
|
// IEEE standard states that NaN values will not compare to themselves
|
||||||
if (value != value) {
|
if (value != value) {
|
||||||
len = snprintf(buffer, sizeof(buffer), "null");
|
len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "NaN" : "null");
|
||||||
} else if (value < 0) {
|
} else if (value < 0) {
|
||||||
len = snprintf(buffer, sizeof(buffer), "-1e+9999");
|
len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "-Infinity" : "-1e+9999");
|
||||||
} else {
|
} else {
|
||||||
len = snprintf(buffer, sizeof(buffer), "1e+9999");
|
len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "Infinity" : "1e+9999");
|
||||||
}
|
}
|
||||||
// For those, we do not need to call fixNumLoc, but it is fast.
|
// For those, we do not need to call fixNumLoc, but it is fast.
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
assert(len >= 0);
|
assert(len >= 0);
|
||||||
fixNumericLocale(buffer, buffer + len);
|
fixNumericLocale(buffer, buffer + len);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string valueToString(double value) { return valueToString(value, false, 17); }
|
||||||
|
|
||||||
std::string valueToString(bool value) { return value ? "true" : "false"; }
|
std::string valueToString(bool value) { return value ? "true" : "false"; }
|
||||||
|
|
||||||
std::string valueToQuotedString(const char* value) {
|
std::string valueToQuotedString(const char* value) {
|
||||||
@@ -306,8 +322,14 @@ void FastWriter::writeValue(const Value& value) {
|
|||||||
document_ += valueToString(value.asDouble());
|
document_ += valueToString(value.asDouble());
|
||||||
break;
|
break;
|
||||||
case stringValue:
|
case stringValue:
|
||||||
document_ += valueToQuotedString(value.asCString());
|
{
|
||||||
|
// Is NULL possible for value.string_?
|
||||||
|
char const* str;
|
||||||
|
char const* end;
|
||||||
|
bool ok = value.getString(&str, &end);
|
||||||
|
if (ok) document_ += valueToQuotedStringN(str, static_cast<unsigned>(end-str));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case booleanValue:
|
case booleanValue:
|
||||||
document_ += valueToString(value.asBool());
|
document_ += valueToString(value.asBool());
|
||||||
break;
|
break;
|
||||||
@@ -329,7 +351,7 @@ void FastWriter::writeValue(const Value& value) {
|
|||||||
const std::string& name = *it;
|
const std::string& name = *it;
|
||||||
if (it != members.begin())
|
if (it != members.begin())
|
||||||
document_ += ',';
|
document_ += ',';
|
||||||
document_ += valueToQuotedStringN(name.data(), name.length());
|
document_ += valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length()));
|
||||||
document_ += yamlCompatiblityEnabled_ ? ": " : ":";
|
document_ += yamlCompatiblityEnabled_ ? ": " : ":";
|
||||||
writeValue(value[name]);
|
writeValue(value[name]);
|
||||||
}
|
}
|
||||||
@@ -371,7 +393,7 @@ void StyledWriter::writeValue(const Value& value) {
|
|||||||
break;
|
break;
|
||||||
case stringValue:
|
case stringValue:
|
||||||
{
|
{
|
||||||
// Is NULL is possible for value.string_?
|
// Is NULL possible for value.string_?
|
||||||
char const* str;
|
char const* str;
|
||||||
char const* end;
|
char const* end;
|
||||||
bool ok = value.getString(&str, &end);
|
bool ok = value.getString(&str, &end);
|
||||||
@@ -588,8 +610,15 @@ void StyledStreamWriter::writeValue(const Value& value) {
|
|||||||
pushValue(valueToString(value.asDouble()));
|
pushValue(valueToString(value.asDouble()));
|
||||||
break;
|
break;
|
||||||
case stringValue:
|
case stringValue:
|
||||||
pushValue(valueToQuotedString(value.asCString()));
|
{
|
||||||
|
// Is NULL possible for value.string_?
|
||||||
|
char const* str;
|
||||||
|
char const* end;
|
||||||
|
bool ok = value.getString(&str, &end);
|
||||||
|
if (ok) pushValue(valueToQuotedStringN(str, static_cast<unsigned>(end-str)));
|
||||||
|
else pushValue("");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case booleanValue:
|
case booleanValue:
|
||||||
pushValue(valueToString(value.asBool()));
|
pushValue(valueToString(value.asBool()));
|
||||||
break;
|
break;
|
||||||
@@ -781,7 +810,9 @@ struct BuiltStyledStreamWriter : public StreamWriter
|
|||||||
CommentStyle::Enum cs,
|
CommentStyle::Enum cs,
|
||||||
std::string const& colonSymbol,
|
std::string const& colonSymbol,
|
||||||
std::string const& nullSymbol,
|
std::string const& nullSymbol,
|
||||||
std::string const& endingLineFeedSymbol);
|
std::string const& endingLineFeedSymbol,
|
||||||
|
bool useSpecialFloats,
|
||||||
|
unsigned int precision);
|
||||||
virtual int write(Value const& root, std::ostream* sout);
|
virtual int write(Value const& root, std::ostream* sout);
|
||||||
private:
|
private:
|
||||||
void writeValue(Value const& value);
|
void writeValue(Value const& value);
|
||||||
@@ -808,13 +839,17 @@ private:
|
|||||||
std::string endingLineFeedSymbol_;
|
std::string endingLineFeedSymbol_;
|
||||||
bool addChildValues_ : 1;
|
bool addChildValues_ : 1;
|
||||||
bool indented_ : 1;
|
bool indented_ : 1;
|
||||||
|
bool useSpecialFloats_ : 1;
|
||||||
|
unsigned int precision_;
|
||||||
};
|
};
|
||||||
BuiltStyledStreamWriter::BuiltStyledStreamWriter(
|
BuiltStyledStreamWriter::BuiltStyledStreamWriter(
|
||||||
std::string const& indentation,
|
std::string const& indentation,
|
||||||
CommentStyle::Enum cs,
|
CommentStyle::Enum cs,
|
||||||
std::string const& colonSymbol,
|
std::string const& colonSymbol,
|
||||||
std::string const& nullSymbol,
|
std::string const& nullSymbol,
|
||||||
std::string const& endingLineFeedSymbol)
|
std::string const& endingLineFeedSymbol,
|
||||||
|
bool useSpecialFloats,
|
||||||
|
unsigned int precision)
|
||||||
: rightMargin_(74)
|
: rightMargin_(74)
|
||||||
, indentation_(indentation)
|
, indentation_(indentation)
|
||||||
, cs_(cs)
|
, cs_(cs)
|
||||||
@@ -823,6 +858,8 @@ BuiltStyledStreamWriter::BuiltStyledStreamWriter(
|
|||||||
, endingLineFeedSymbol_(endingLineFeedSymbol)
|
, endingLineFeedSymbol_(endingLineFeedSymbol)
|
||||||
, addChildValues_(false)
|
, addChildValues_(false)
|
||||||
, indented_(false)
|
, indented_(false)
|
||||||
|
, useSpecialFloats_(useSpecialFloats)
|
||||||
|
, precision_(precision)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
int BuiltStyledStreamWriter::write(Value const& root, std::ostream* sout)
|
int BuiltStyledStreamWriter::write(Value const& root, std::ostream* sout)
|
||||||
@@ -852,7 +889,7 @@ void BuiltStyledStreamWriter::writeValue(Value const& value) {
|
|||||||
pushValue(valueToString(value.asLargestUInt()));
|
pushValue(valueToString(value.asLargestUInt()));
|
||||||
break;
|
break;
|
||||||
case realValue:
|
case realValue:
|
||||||
pushValue(valueToString(value.asDouble()));
|
pushValue(valueToString(value.asDouble(), useSpecialFloats_, precision_));
|
||||||
break;
|
break;
|
||||||
case stringValue:
|
case stringValue:
|
||||||
{
|
{
|
||||||
@@ -882,7 +919,7 @@ void BuiltStyledStreamWriter::writeValue(Value const& value) {
|
|||||||
std::string const& name = *it;
|
std::string const& name = *it;
|
||||||
Value const& childValue = value[name];
|
Value const& childValue = value[name];
|
||||||
writeCommentBeforeValue(childValue);
|
writeCommentBeforeValue(childValue);
|
||||||
writeWithIndent(valueToQuotedStringN(name.data(), name.length()));
|
writeWithIndent(valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length())));
|
||||||
*sout_ << colonSymbol_;
|
*sout_ << colonSymbol_;
|
||||||
writeValue(childValue);
|
writeValue(childValue);
|
||||||
if (++it == members.end()) {
|
if (++it == members.end()) {
|
||||||
@@ -1067,13 +1104,15 @@ StreamWriter* StreamWriterBuilder::newStreamWriter() const
|
|||||||
std::string cs_str = settings_["commentStyle"].asString();
|
std::string cs_str = settings_["commentStyle"].asString();
|
||||||
bool eyc = settings_["enableYAMLCompatibility"].asBool();
|
bool eyc = settings_["enableYAMLCompatibility"].asBool();
|
||||||
bool dnp = settings_["dropNullPlaceholders"].asBool();
|
bool dnp = settings_["dropNullPlaceholders"].asBool();
|
||||||
|
bool usf = settings_["useSpecialFloats"].asBool();
|
||||||
|
unsigned int pre = settings_["precision"].asUInt();
|
||||||
CommentStyle::Enum cs = CommentStyle::All;
|
CommentStyle::Enum cs = CommentStyle::All;
|
||||||
if (cs_str == "All") {
|
if (cs_str == "All") {
|
||||||
cs = CommentStyle::All;
|
cs = CommentStyle::All;
|
||||||
} else if (cs_str == "None") {
|
} else if (cs_str == "None") {
|
||||||
cs = CommentStyle::None;
|
cs = CommentStyle::None;
|
||||||
} else {
|
} else {
|
||||||
throw std::runtime_error("commentStyle must be 'All' or 'None'");
|
throwRuntimeError("commentStyle must be 'All' or 'None'");
|
||||||
}
|
}
|
||||||
std::string colonSymbol = " : ";
|
std::string colonSymbol = " : ";
|
||||||
if (eyc) {
|
if (eyc) {
|
||||||
@@ -1085,10 +1124,11 @@ StreamWriter* StreamWriterBuilder::newStreamWriter() const
|
|||||||
if (dnp) {
|
if (dnp) {
|
||||||
nullSymbol = "";
|
nullSymbol = "";
|
||||||
}
|
}
|
||||||
|
if (pre > 17) pre = 17;
|
||||||
std::string endingLineFeedSymbol = "";
|
std::string endingLineFeedSymbol = "";
|
||||||
return new BuiltStyledStreamWriter(
|
return new BuiltStyledStreamWriter(
|
||||||
indentation, cs,
|
indentation, cs,
|
||||||
colonSymbol, nullSymbol, endingLineFeedSymbol);
|
colonSymbol, nullSymbol, endingLineFeedSymbol, usf, pre);
|
||||||
}
|
}
|
||||||
static void getValidWriterKeys(std::set<std::string>* valid_keys)
|
static void getValidWriterKeys(std::set<std::string>* valid_keys)
|
||||||
{
|
{
|
||||||
@@ -1097,6 +1137,8 @@ static void getValidWriterKeys(std::set<std::string>* valid_keys)
|
|||||||
valid_keys->insert("commentStyle");
|
valid_keys->insert("commentStyle");
|
||||||
valid_keys->insert("enableYAMLCompatibility");
|
valid_keys->insert("enableYAMLCompatibility");
|
||||||
valid_keys->insert("dropNullPlaceholders");
|
valid_keys->insert("dropNullPlaceholders");
|
||||||
|
valid_keys->insert("useSpecialFloats");
|
||||||
|
valid_keys->insert("precision");
|
||||||
}
|
}
|
||||||
bool StreamWriterBuilder::validate(Json::Value* invalid) const
|
bool StreamWriterBuilder::validate(Json::Value* invalid) const
|
||||||
{
|
{
|
||||||
@@ -1127,6 +1169,8 @@ void StreamWriterBuilder::setDefaults(Json::Value* settings)
|
|||||||
(*settings)["indentation"] = "\t";
|
(*settings)["indentation"] = "\t";
|
||||||
(*settings)["enableYAMLCompatibility"] = false;
|
(*settings)["enableYAMLCompatibility"] = false;
|
||||||
(*settings)["dropNullPlaceholders"] = false;
|
(*settings)["dropNullPlaceholders"] = false;
|
||||||
|
(*settings)["useSpecialFloats"] = false;
|
||||||
|
(*settings)["precision"] = 17;
|
||||||
//! [StreamWriterBuilderDefaults]
|
//! [StreamWriterBuilderDefaults]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
// DO NOT EDIT. This file is generated by CMake from "version"
|
// DO NOT EDIT. This file (and "version") is generated by CMake.
|
||||||
// and "version.h.in" files.
|
|
||||||
// Run CMake configure step to update it.
|
// Run CMake configure step to update it.
|
||||||
#ifndef JSON_VERSION_H_INCLUDED
|
#ifndef JSON_VERSION_H_INCLUDED
|
||||||
# define JSON_VERSION_H_INCLUDED
|
# define JSON_VERSION_H_INCLUDED
|
||||||
|
@@ -1,9 +1,5 @@
|
|||||||
# vim: et ts=4 sts=4 sw=4 tw=0
|
# vim: et ts=4 sts=4 sw=4 tw=0
|
||||||
|
|
||||||
IF(JSONCPP_LIB_BUILD_SHARED)
|
|
||||||
ADD_DEFINITIONS( -DJSON_DLL )
|
|
||||||
ENDIF(JSONCPP_LIB_BUILD_SHARED)
|
|
||||||
|
|
||||||
ADD_EXECUTABLE( jsoncpp_test
|
ADD_EXECUTABLE( jsoncpp_test
|
||||||
jsontest.cpp
|
jsontest.cpp
|
||||||
jsontest.h
|
jsontest.h
|
||||||
@@ -11,11 +7,12 @@ ADD_EXECUTABLE( jsoncpp_test
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
IF(JSONCPP_LIB_BUILD_SHARED)
|
IF(BUILD_SHARED_LIBS)
|
||||||
|
ADD_DEFINITIONS( -DJSON_DLL )
|
||||||
TARGET_LINK_LIBRARIES(jsoncpp_test jsoncpp_lib)
|
TARGET_LINK_LIBRARIES(jsoncpp_test jsoncpp_lib)
|
||||||
ELSE(JSONCPP_LIB_BUILD_SHARED)
|
ELSE(BUILD_SHARED_LIBS)
|
||||||
TARGET_LINK_LIBRARIES(jsoncpp_test jsoncpp_lib_static)
|
TARGET_LINK_LIBRARIES(jsoncpp_test jsoncpp_lib_static)
|
||||||
ENDIF(JSONCPP_LIB_BUILD_SHARED)
|
ENDIF()
|
||||||
|
|
||||||
# another way to solve issue #90
|
# another way to solve issue #90
|
||||||
#set_target_properties(jsoncpp_test PROPERTIES COMPILE_FLAGS -ffloat-store)
|
#set_target_properties(jsoncpp_test PROPERTIES COMPILE_FLAGS -ffloat-store)
|
||||||
@@ -23,19 +20,19 @@ ENDIF(JSONCPP_LIB_BUILD_SHARED)
|
|||||||
# Run unit tests in post-build
|
# Run unit tests in post-build
|
||||||
# (default cmake workflow hides away the test result into a file, resulting in poor dev workflow?!?)
|
# (default cmake workflow hides away the test result into a file, resulting in poor dev workflow?!?)
|
||||||
IF(JSONCPP_WITH_POST_BUILD_UNITTEST)
|
IF(JSONCPP_WITH_POST_BUILD_UNITTEST)
|
||||||
IF(JSONCPP_LIB_BUILD_SHARED)
|
IF(BUILD_SHARED_LIBS)
|
||||||
# First, copy the shared lib, for Microsoft.
|
# First, copy the shared lib, for Microsoft.
|
||||||
# Then, run the test executable.
|
# Then, run the test executable.
|
||||||
ADD_CUSTOM_COMMAND( TARGET jsoncpp_test
|
ADD_CUSTOM_COMMAND( TARGET jsoncpp_test
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:jsoncpp_lib> $<TARGET_FILE_DIR:jsoncpp_test>
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:jsoncpp_lib> $<TARGET_FILE_DIR:jsoncpp_test>
|
||||||
COMMAND $<TARGET_FILE:jsoncpp_test>)
|
COMMAND $<TARGET_FILE:jsoncpp_test>)
|
||||||
ELSE(JSONCPP_LIB_BUILD_SHARED)
|
ELSE(BUILD_SHARED_LIBS)
|
||||||
# Just run the test executable.
|
# Just run the test executable.
|
||||||
ADD_CUSTOM_COMMAND( TARGET jsoncpp_test
|
ADD_CUSTOM_COMMAND( TARGET jsoncpp_test
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND $<TARGET_FILE:jsoncpp_test>)
|
COMMAND $<TARGET_FILE:jsoncpp_test>)
|
||||||
ENDIF(JSONCPP_LIB_BUILD_SHARED)
|
ENDIF()
|
||||||
ENDIF(JSONCPP_WITH_POST_BUILD_UNITTEST)
|
ENDIF()
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test)
|
SET_TARGET_PROPERTIES(jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test)
|
||||||
|
@@ -6,8 +6,8 @@
|
|||||||
#include "jsontest.h"
|
#include "jsontest.h"
|
||||||
#include <json/config.h>
|
#include <json/config.h>
|
||||||
#include <json/json.h>
|
#include <json/json.h>
|
||||||
#include <stdexcept>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
// Make numeric limits more convenient to talk about.
|
// Make numeric limits more convenient to talk about.
|
||||||
// Assumes int type in 32 bits.
|
// Assumes int type in 32 bits.
|
||||||
@@ -258,6 +258,20 @@ JSONTEST_FIXTURE(ValueTest, arrays) {
|
|||||||
JSONTEST_ASSERT_EQUAL(Json::Value(17), got);
|
JSONTEST_ASSERT_EQUAL(Json::Value(17), got);
|
||||||
JSONTEST_ASSERT_EQUAL(false, array1_.removeIndex(2, &got)); // gone now
|
JSONTEST_ASSERT_EQUAL(false, array1_.removeIndex(2, &got)); // gone now
|
||||||
}
|
}
|
||||||
|
JSONTEST_FIXTURE(ValueTest, arrayIssue252)
|
||||||
|
{
|
||||||
|
int count = 5;
|
||||||
|
Json::Value root;
|
||||||
|
Json::Value item;
|
||||||
|
root["array"] = Json::Value::nullRef;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
item["a"] = i;
|
||||||
|
item["b"] = i;
|
||||||
|
root["array"][i] = item;
|
||||||
|
}
|
||||||
|
//JSONTEST_ASSERT_EQUAL(5, root["array"].size());
|
||||||
|
}
|
||||||
|
|
||||||
JSONTEST_FIXTURE(ValueTest, null) {
|
JSONTEST_FIXTURE(ValueTest, null) {
|
||||||
JSONTEST_ASSERT_EQUAL(Json::nullValue, null_.type());
|
JSONTEST_ASSERT_EQUAL(Json::nullValue, null_.type());
|
||||||
@@ -283,7 +297,10 @@ JSONTEST_FIXTURE(ValueTest, null) {
|
|||||||
JSONTEST_ASSERT_EQUAL(0.0, null_.asFloat());
|
JSONTEST_ASSERT_EQUAL(0.0, null_.asFloat());
|
||||||
JSONTEST_ASSERT_STRING_EQUAL("", null_.asString());
|
JSONTEST_ASSERT_STRING_EQUAL("", null_.asString());
|
||||||
|
|
||||||
|
#if !defined(__ARMEL__)
|
||||||
|
// See line #165 of include/json/value.h
|
||||||
JSONTEST_ASSERT_EQUAL(Json::Value::null, null_);
|
JSONTEST_ASSERT_EQUAL(Json::Value::null, null_);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONTEST_FIXTURE(ValueTest, strings) {
|
JSONTEST_FIXTURE(ValueTest, strings) {
|
||||||
@@ -1199,7 +1216,7 @@ JSONTEST_FIXTURE(ValueTest, nonIntegers) {
|
|||||||
JSONTEST_ASSERT_EQUAL(-2147483648.5, val.asDouble());
|
JSONTEST_ASSERT_EQUAL(-2147483648.5, val.asDouble());
|
||||||
JSONTEST_ASSERT_EQUAL(float(-2147483648.5), val.asFloat());
|
JSONTEST_ASSERT_EQUAL(float(-2147483648.5), val.asFloat());
|
||||||
#ifdef JSON_HAS_INT64
|
#ifdef JSON_HAS_INT64
|
||||||
JSONTEST_ASSERT_EQUAL(-Json::Int64(1) << 31, val.asLargestInt());
|
JSONTEST_ASSERT_EQUAL(-(Json::Int64(1) << 31), val.asLargestInt());
|
||||||
#endif
|
#endif
|
||||||
JSONTEST_ASSERT_EQUAL(true, val.asBool());
|
JSONTEST_ASSERT_EQUAL(true, val.asBool());
|
||||||
JSONTEST_ASSERT_EQUAL("-2147483648.5",
|
JSONTEST_ASSERT_EQUAL("-2147483648.5",
|
||||||
@@ -1241,7 +1258,7 @@ JSONTEST_FIXTURE(ValueTest, nonIntegers) {
|
|||||||
|
|
||||||
// A 16-digit floating point number.
|
// A 16-digit floating point number.
|
||||||
val = Json::Value(2199023255552000.0f);
|
val = Json::Value(2199023255552000.0f);
|
||||||
JSONTEST_ASSERT_EQUAL(float(2199023255552000), val.asFloat());
|
JSONTEST_ASSERT_EQUAL(float(2199023255552000.0f), val.asFloat());
|
||||||
JSONTEST_ASSERT_STRING_EQUAL("2199023255552000",
|
JSONTEST_ASSERT_STRING_EQUAL("2199023255552000",
|
||||||
normalizeFloatingPointStr(val.asString()));
|
normalizeFloatingPointStr(val.asString()));
|
||||||
|
|
||||||
@@ -1524,7 +1541,7 @@ JSONTEST_FIXTURE(ValueTest, StaticString) {
|
|||||||
|
|
||||||
JSONTEST_FIXTURE(ValueTest, CommentBefore) {
|
JSONTEST_FIXTURE(ValueTest, CommentBefore) {
|
||||||
Json::Value val; // fill val
|
Json::Value val; // fill val
|
||||||
val.setComment("// this comment should appear before", Json::commentBefore);
|
val.setComment(std::string("// this comment should appear before"), Json::commentBefore);
|
||||||
Json::StreamWriterBuilder wbuilder;
|
Json::StreamWriterBuilder wbuilder;
|
||||||
wbuilder.settings_["commentStyle"] = "All";
|
wbuilder.settings_["commentStyle"] = "All";
|
||||||
{
|
{
|
||||||
@@ -1619,6 +1636,63 @@ JSONTEST_FIXTURE(ValueTest, zeroesInKeys) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSONTEST_FIXTURE(ValueTest, specialFloats) {
|
||||||
|
Json::StreamWriterBuilder b;
|
||||||
|
b.settings_["useSpecialFloats"] = true;
|
||||||
|
|
||||||
|
Json::Value v = std::numeric_limits<double>::quiet_NaN();
|
||||||
|
std::string expected = "NaN";
|
||||||
|
std::string result = Json::writeString(b, v);
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
|
||||||
|
|
||||||
|
v = std::numeric_limits<double>::infinity();
|
||||||
|
expected = "Infinity";
|
||||||
|
result = Json::writeString(b, v);
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
|
||||||
|
|
||||||
|
v = -std::numeric_limits<double>::infinity();
|
||||||
|
expected = "-Infinity";
|
||||||
|
result = Json::writeString(b, v);
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONTEST_FIXTURE(ValueTest, precision) {
|
||||||
|
Json::StreamWriterBuilder b;
|
||||||
|
b.settings_["precision"] = 5;
|
||||||
|
|
||||||
|
Json::Value v = 100.0/3;
|
||||||
|
std::string expected = "33.333";
|
||||||
|
std::string result = Json::writeString(b, v);
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
|
||||||
|
|
||||||
|
v = 0.25000000;
|
||||||
|
expected = "0.25";
|
||||||
|
result = Json::writeString(b, v);
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
|
||||||
|
|
||||||
|
v = 0.2563456;
|
||||||
|
expected = "0.25635";
|
||||||
|
result = Json::writeString(b, v);
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
|
||||||
|
|
||||||
|
b.settings_["precision"] = 1;
|
||||||
|
expected = "0.3";
|
||||||
|
result = Json::writeString(b, v);
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
|
||||||
|
|
||||||
|
b.settings_["precision"] = 17;
|
||||||
|
v = 1234857476305.256345694873740545068;
|
||||||
|
expected = "1234857476305.2563";
|
||||||
|
result = Json::writeString(b, v);
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
|
||||||
|
|
||||||
|
b.settings_["precision"] = 24;
|
||||||
|
v = 0.256345694873740545068;
|
||||||
|
expected = "0.25634569487374054";
|
||||||
|
result = Json::writeString(b, v);
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
|
||||||
|
}
|
||||||
|
|
||||||
struct StreamWriterTest : JsonTest::TestCase {};
|
struct StreamWriterTest : JsonTest::TestCase {};
|
||||||
|
|
||||||
JSONTEST_FIXTURE(StreamWriterTest, dropNullPlaceholders) {
|
JSONTEST_FIXTURE(StreamWriterTest, dropNullPlaceholders) {
|
||||||
@@ -1841,7 +1915,7 @@ JSONTEST_FIXTURE(CharReaderStrictModeTest, dupKeys) {
|
|||||||
struct CharReaderFailIfExtraTest : JsonTest::TestCase {};
|
struct CharReaderFailIfExtraTest : JsonTest::TestCase {};
|
||||||
|
|
||||||
JSONTEST_FIXTURE(CharReaderFailIfExtraTest, issue164) {
|
JSONTEST_FIXTURE(CharReaderFailIfExtraTest, issue164) {
|
||||||
// This is interpretted as a string value followed by a colon.
|
// This is interpreted as a string value followed by a colon.
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
char const doc[] =
|
char const doc[] =
|
||||||
@@ -2140,6 +2214,7 @@ JSONTEST_FIXTURE(CharReaderAllowSingleQuotesTest, issue182) {
|
|||||||
JSONTEST_ASSERT_STRING_EQUAL("x", root["a"].asString());
|
JSONTEST_ASSERT_STRING_EQUAL("x", root["a"].asString());
|
||||||
JSONTEST_ASSERT_STRING_EQUAL("y", root["b"].asString());
|
JSONTEST_ASSERT_STRING_EQUAL("y", root["b"].asString());
|
||||||
}
|
}
|
||||||
|
delete reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CharReaderAllowZeroesTest : JsonTest::TestCase {};
|
struct CharReaderAllowZeroesTest : JsonTest::TestCase {};
|
||||||
@@ -2172,6 +2247,82 @@ JSONTEST_FIXTURE(CharReaderAllowZeroesTest, issue176) {
|
|||||||
JSONTEST_ASSERT_STRING_EQUAL("x", root["a"].asString());
|
JSONTEST_ASSERT_STRING_EQUAL("x", root["a"].asString());
|
||||||
JSONTEST_ASSERT_STRING_EQUAL("y", root["b"].asString());
|
JSONTEST_ASSERT_STRING_EQUAL("y", root["b"].asString());
|
||||||
}
|
}
|
||||||
|
delete reader;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CharReaderAllowSpecialFloatsTest : JsonTest::TestCase {};
|
||||||
|
|
||||||
|
JSONTEST_FIXTURE(CharReaderAllowSpecialFloatsTest, issue209) {
|
||||||
|
Json::CharReaderBuilder b;
|
||||||
|
b.settings_["allowSpecialFloats"] = true;
|
||||||
|
Json::Value root;
|
||||||
|
std::string errs;
|
||||||
|
Json::CharReader* reader(b.newCharReader());
|
||||||
|
{
|
||||||
|
char const doc[] = "{\"a\":NaN,\"b\":Infinity,\"c\":-Infinity}";
|
||||||
|
bool ok = reader->parse(
|
||||||
|
doc, doc + std::strlen(doc),
|
||||||
|
&root, &errs);
|
||||||
|
JSONTEST_ASSERT(ok);
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL("", errs);
|
||||||
|
JSONTEST_ASSERT_EQUAL(3u, root.size());
|
||||||
|
double n = root["a"].asDouble();
|
||||||
|
JSONTEST_ASSERT(n != n);
|
||||||
|
JSONTEST_ASSERT_EQUAL(std::numeric_limits<double>::infinity(), root.get("b", 0.0));
|
||||||
|
JSONTEST_ASSERT_EQUAL(-std::numeric_limits<double>::infinity(), root.get("c", 0.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TestData {
|
||||||
|
int line;
|
||||||
|
bool ok;
|
||||||
|
std::string in;
|
||||||
|
};
|
||||||
|
const TestData test_data[] = {
|
||||||
|
{__LINE__, 1, "{\"a\":9}"},
|
||||||
|
{__LINE__, 0, "{\"a\":0Infinity}"},
|
||||||
|
{__LINE__, 0, "{\"a\":1Infinity}"},
|
||||||
|
{__LINE__, 0, "{\"a\":9Infinity}"},
|
||||||
|
{__LINE__, 0, "{\"a\":0nfinity}"},
|
||||||
|
{__LINE__, 0, "{\"a\":1nfinity}"},
|
||||||
|
{__LINE__, 0, "{\"a\":9nfinity}"},
|
||||||
|
{__LINE__, 0, "{\"a\":nfinity}"},
|
||||||
|
{__LINE__, 0, "{\"a\":.nfinity}"},
|
||||||
|
{__LINE__, 0, "{\"a\":9nfinity}"},
|
||||||
|
{__LINE__, 0, "{\"a\":-nfinity}"},
|
||||||
|
{__LINE__, 1, "{\"a\":Infinity}"},
|
||||||
|
{__LINE__, 0, "{\"a\":.Infinity}"},
|
||||||
|
{__LINE__, 0, "{\"a\":_Infinity}"},
|
||||||
|
{__LINE__, 0, "{\"a\":_nfinity}"},
|
||||||
|
{__LINE__, 1, "{\"a\":-Infinity}"}
|
||||||
|
};
|
||||||
|
for (size_t tdi = 0; tdi < sizeof(test_data) / sizeof(*test_data); ++tdi) {
|
||||||
|
const TestData& td = test_data[tdi];
|
||||||
|
bool ok = reader->parse(&*td.in.begin(),
|
||||||
|
&*td.in.begin() + td.in.size(),
|
||||||
|
&root, &errs);
|
||||||
|
JSONTEST_ASSERT(td.ok == ok)
|
||||||
|
<< "line:" << td.line << "\n"
|
||||||
|
<< " expected: {"
|
||||||
|
<< "ok:" << td.ok
|
||||||
|
<< ", in:\'" << td.in << "\'"
|
||||||
|
<< "}\n"
|
||||||
|
<< " actual: {"
|
||||||
|
<< "ok:" << ok
|
||||||
|
<< "}\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
char const doc[] = "{\"posInf\": Infinity, \"NegInf\": -Infinity}";
|
||||||
|
bool ok = reader->parse(
|
||||||
|
doc, doc + std::strlen(doc),
|
||||||
|
&root, &errs);
|
||||||
|
JSONTEST_ASSERT(ok);
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL("", errs);
|
||||||
|
JSONTEST_ASSERT_EQUAL(2u, root.size());
|
||||||
|
JSONTEST_ASSERT_EQUAL(std::numeric_limits<double>::infinity(), root["posInf"].asDouble());
|
||||||
|
JSONTEST_ASSERT_EQUAL(-std::numeric_limits<double>::infinity(), root["NegInf"].asDouble());
|
||||||
|
}
|
||||||
|
delete reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct BuilderTest : JsonTest::TestCase {};
|
struct BuilderTest : JsonTest::TestCase {};
|
||||||
@@ -2213,12 +2364,49 @@ JSONTEST_FIXTURE(IteratorTest, distance) {
|
|||||||
JSONTEST_ASSERT_STRING_EQUAL("b", str);
|
JSONTEST_ASSERT_STRING_EQUAL("b", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSONTEST_FIXTURE(IteratorTest, names) {
|
||||||
|
Json::Value json;
|
||||||
|
json["k1"] = "a";
|
||||||
|
json["k2"] = "b";
|
||||||
|
Json::ValueIterator it = json.begin();
|
||||||
|
JSONTEST_ASSERT(it != json.end());
|
||||||
|
JSONTEST_ASSERT_EQUAL(Json::Value("k1"), it.key());
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL("k1", it.name());
|
||||||
|
JSONTEST_ASSERT_EQUAL(-1, it.index());
|
||||||
|
++it;
|
||||||
|
JSONTEST_ASSERT(it != json.end());
|
||||||
|
JSONTEST_ASSERT_EQUAL(Json::Value("k2"), it.key());
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL("k2", it.name());
|
||||||
|
JSONTEST_ASSERT_EQUAL(-1, it.index());
|
||||||
|
++it;
|
||||||
|
JSONTEST_ASSERT(it == json.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONTEST_FIXTURE(IteratorTest, indexes) {
|
||||||
|
Json::Value json;
|
||||||
|
json[0] = "a";
|
||||||
|
json[1] = "b";
|
||||||
|
Json::ValueIterator it = json.begin();
|
||||||
|
JSONTEST_ASSERT(it != json.end());
|
||||||
|
JSONTEST_ASSERT_EQUAL(Json::Value(Json::ArrayIndex(0)), it.key());
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL("", it.name());
|
||||||
|
JSONTEST_ASSERT_EQUAL(0, it.index());
|
||||||
|
++it;
|
||||||
|
JSONTEST_ASSERT(it != json.end());
|
||||||
|
JSONTEST_ASSERT_EQUAL(Json::Value(Json::ArrayIndex(1)), it.key());
|
||||||
|
JSONTEST_ASSERT_STRING_EQUAL("", it.name());
|
||||||
|
JSONTEST_ASSERT_EQUAL(1, it.index());
|
||||||
|
++it;
|
||||||
|
JSONTEST_ASSERT(it == json.end());
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main(int argc, const char* argv[]) {
|
||||||
JsonTest::Runner runner;
|
JsonTest::Runner runner;
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, checkNormalizeFloatingPointStr);
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, checkNormalizeFloatingPointStr);
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, memberCount);
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, memberCount);
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, objects);
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, objects);
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, arrays);
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, arrays);
|
||||||
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, arrayIssue252);
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, null);
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, null);
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, strings);
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, strings);
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, bools);
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, bools);
|
||||||
@@ -2239,6 +2427,8 @@ int main(int argc, const char* argv[]) {
|
|||||||
//JSONTEST_REGISTER_FIXTURE(runner, ValueTest, nulls);
|
//JSONTEST_REGISTER_FIXTURE(runner, ValueTest, nulls);
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, zeroes);
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, zeroes);
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, zeroesInKeys);
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, zeroesInKeys);
|
||||||
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, specialFloats);
|
||||||
|
JSONTEST_REGISTER_FIXTURE(runner, ValueTest, precision);
|
||||||
|
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, StreamWriterTest, dropNullPlaceholders);
|
JSONTEST_REGISTER_FIXTURE(runner, StreamWriterTest, dropNullPlaceholders);
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, StreamWriterTest, writeZeroes);
|
JSONTEST_REGISTER_FIXTURE(runner, StreamWriterTest, writeZeroes);
|
||||||
@@ -2272,9 +2462,13 @@ int main(int argc, const char* argv[]) {
|
|||||||
|
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, CharReaderAllowZeroesTest, issue176);
|
JSONTEST_REGISTER_FIXTURE(runner, CharReaderAllowZeroesTest, issue176);
|
||||||
|
|
||||||
|
JSONTEST_REGISTER_FIXTURE(runner, CharReaderAllowSpecialFloatsTest, issue209);
|
||||||
|
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, BuilderTest, settings);
|
JSONTEST_REGISTER_FIXTURE(runner, BuilderTest, settings);
|
||||||
|
|
||||||
JSONTEST_REGISTER_FIXTURE(runner, IteratorTest, distance);
|
JSONTEST_REGISTER_FIXTURE(runner, IteratorTest, distance);
|
||||||
|
JSONTEST_REGISTER_FIXTURE(runner, IteratorTest, names);
|
||||||
|
JSONTEST_REGISTER_FIXTURE(runner, IteratorTest, indexes);
|
||||||
|
|
||||||
return runner.runCommandLine(argc, argv);
|
return runner.runCommandLine(argc, argv);
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,10 @@
|
|||||||
# removes all files created during testing
|
# Copyright 2007 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
"""Removes all files created during testing."""
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
# Copyright 2007 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import glob
|
import glob
|
||||||
import os.path
|
import os.path
|
||||||
|
@@ -1,4 +1,11 @@
|
|||||||
# Simple implementation of a json test runner to run the test against json-py.
|
# Copyright 2007 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
"""Simple implementation of a json test runner to run the test against
|
||||||
|
json-py."""
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import os.path
|
import os.path
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
# Copyright 2007 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from io import open
|
from io import open
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
# Copyright 2009 Baptiste Lepilleur
|
||||||
|
# Distributed under MIT license, or public domain if desired and
|
||||||
|
# recognized in your jurisdiction.
|
||||||
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from io import open
|
from io import open
|
||||||
|
29
travis.sh
Executable file
29
travis.sh
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# This is called by `.travis.yml` via Travis CI.
|
||||||
|
# Travis supplies $TRAVIS_OS_NAME.
|
||||||
|
# http://docs.travis-ci.com/user/multi-os/
|
||||||
|
# Our .travis.yml also defines:
|
||||||
|
# - SHARED_LIB=ON/OFF
|
||||||
|
# - STATIC_LIB=ON/OFF
|
||||||
|
# - CMAKE_PKG=ON/OFF
|
||||||
|
# - BUILD_TYPE=release/debug
|
||||||
|
# - VERBOSE_MAKE=false/true
|
||||||
|
# - VERBOSE (set or not)
|
||||||
|
|
||||||
|
# -e: fail on error
|
||||||
|
# -v: show commands
|
||||||
|
# -x: show expanded commands
|
||||||
|
set -vex
|
||||||
|
|
||||||
|
env | sort
|
||||||
|
|
||||||
|
cmake -DJSONCPP_WITH_CMAKE_PACKAGE=$CMAKE_PKG -DBUILD_SHARED_LIBS=$SHARED_LIB -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_VERBOSE_MAKEFILE=$VERBOSE_MAKE .
|
||||||
|
make
|
||||||
|
|
||||||
|
# Python is not available in Travis for osx.
|
||||||
|
# https://github.com/travis-ci/travis-ci/issues/2320
|
||||||
|
if [ "$TRAVIS_OS_NAME" != "osx" ]
|
||||||
|
then
|
||||||
|
make jsoncpp_check
|
||||||
|
valgrind --error-exitcode=42 --leak-check=full ./src/test_lib_json/jsoncpp_test
|
||||||
|
fi
|
Reference in New Issue
Block a user