mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-15 23:20:05 +02:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
65b47144f1 | ||
![]() |
6bc7bff8ad | ||
![]() |
5e5d4f79bc | ||
![]() |
42c395a9b6 | ||
![]() |
7fa28fc7c8 | ||
![]() |
ec71240def | ||
![]() |
58c2ab5527 | ||
![]() |
b3e4ed5277 | ||
![]() |
e9543de4c3 | ||
![]() |
1269f26494 |
30
.travis.yml
30
.travis.yml
@@ -2,37 +2,12 @@
|
|||||||
# 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/
|
||||||
# See also
|
before_install: sudo apt-get install cmake
|
||||||
# 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: ./travis.sh
|
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
|
||||||
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
|
||||||
@@ -40,4 +15,3 @@ env:
|
|||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
- aaronjjacobs@gmail.com
|
- aaronjjacobs@gmail.com
|
||||||
sudo: false
|
|
||||||
|
@@ -9,8 +9,6 @@ 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)
|
|
||||||
|
|
||||||
# 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)
|
||||||
@@ -21,16 +19,15 @@ IF(NOT WIN32)
|
|||||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||||
ENDIF(NOT WIN32)
|
ENDIF(NOT WIN32)
|
||||||
|
|
||||||
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 ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
|
SET(ARCHIVE_INSTALL_DIR lib${LIB_SUFFIX}
|
||||||
CACHE PATH "Install dir for static libraries")
|
CACHE PATH "Install dir for static libraries")
|
||||||
SET(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
|
SET(LIBRARY_INSTALL_DIR lib${LIB_SUFFIX}
|
||||||
CACHE PATH "Install dir for shared libraries")
|
CACHE PATH "Install dir for shared libraries")
|
||||||
SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include
|
SET(INCLUDE_INSTALL_DIR include
|
||||||
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")
|
||||||
@@ -63,7 +60,7 @@ ENDMACRO(jsoncpp_parse_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.10.4 )
|
SET( JSONCPP_VERSION 0.10.1 )
|
||||||
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")
|
||||||
@@ -97,11 +94,10 @@ endif( MSVC )
|
|||||||
|
|
||||||
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} -std=c++11 -Werror -Wall -Wshadow -Wshorten-64-to-32")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||||
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} -Werror -Wall -Wshadow -Wextra -pedantic -Wno-long-long")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
|
||||||
# not yet ready for -Wconversion
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
IF(JSONCPP_WITH_WARNING_AS_ERROR)
|
IF(JSONCPP_WITH_WARNING_AS_ERROR)
|
||||||
|
68
README.md
68
README.md
@@ -19,14 +19,12 @@ 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 include
|
The recommended approach to integrating JsonCpp in your project is to build
|
||||||
the [amalgamated source](#generating-amalgamated-source-and-header) (a single
|
the amalgamated source (a single `.cpp` file) with your own build system. This
|
||||||
`.cpp` file and two `.h` files) in your project, and compile and build as you
|
ensures consistency of compilation flags and ABI compatibility. See the section
|
||||||
would any other source file. This ensures consistency of compilation flags and
|
"Generating amalgamated source and header" for instructions.
|
||||||
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:
|
||||||
@@ -36,31 +34,6 @@ 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
|
||||||
@@ -85,7 +58,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 `BUILD_SHARED_LIBS` to build as a
|
* Review JsonCpp build options (tick `JSONCPP_LIB_BUILD_SHARED` 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.
|
||||||
@@ -94,10 +67,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 -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" ../..
|
cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_STATIC=ON -DJSONCPP_LIB_BUILD_SHARED=OFF -G "Unix Makefiles" ../..
|
||||||
make
|
make
|
||||||
|
|
||||||
Running `cmake -h` will display the list of available generators (passed using
|
Running `cmake -`" 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
|
||||||
@@ -133,7 +106,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
|
||||||
@@ -169,6 +142,29 @@ 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
35
appveyor.yml
@@ -1,35 +0,0 @@
|
|||||||
# 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 -DBUILD_SHARED_LIBS=ON -G "Unix Makefiles" ../..
|
cd build/debug; cmake -DCMAKE_BUILD_TYPE=debug -DJSONCPP_LIB_BUILD_SHARED=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,9 +26,6 @@ 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,6 +1 @@
|
|||||||
# 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
|
# module
|
@@ -19,8 +19,8 @@
|
|||||||
},
|
},
|
||||||
{"name": "shared_dll",
|
{"name": "shared_dll",
|
||||||
"variables": [
|
"variables": [
|
||||||
["BUILD_SHARED_LIBS=true"],
|
["JSONCPP_LIB_BUILD_SHARED=true"],
|
||||||
["BUILD_SHARED_LIBS=false"]
|
["JSONCPP_LIB_BUILD_SHARED=false"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{"name": "build_type",
|
{"name": "build_type",
|
||||||
|
@@ -12,8 +12,8 @@
|
|||||||
},
|
},
|
||||||
{"name": "shared_dll",
|
{"name": "shared_dll",
|
||||||
"variables": [
|
"variables": [
|
||||||
["BUILD_SHARED_LIBS=true"],
|
["JSONCPP_LIB_BUILD_SHARED=true"],
|
||||||
["BUILD_SHARED_LIBS=false"]
|
["JSONCPP_LIB_BUILD_SHARED=false"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{"name": "build_type",
|
{"name": "build_type",
|
||||||
|
@@ -1,9 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
# Copyright 2009 Baptiste Lepilleur
|
# Baptiste Lepilleur, 2009
|
||||||
# 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,11 +1,5 @@
|
|||||||
# 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,8 +1,3 @@
|
|||||||
# 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
|
||||||
|
@@ -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 = subprocess.call(cmd), ''
|
status, output = os.system(' '.join(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)
|
||||||
|
@@ -302,13 +302,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 CharReaderBuilderDefaults
|
* \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode
|
||||||
*/
|
*/
|
||||||
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 CharReaderBuilderStrictMode
|
* \snippet src/lib_json/json_reader.cpp CharReaderBuilderDefaults
|
||||||
*/
|
*/
|
||||||
static void strictMode(Json::Value* settings);
|
static void strictMode(Json::Value* settings);
|
||||||
};
|
};
|
||||||
|
@@ -214,7 +214,7 @@ private:
|
|||||||
void swap(CZString& other);
|
void swap(CZString& other);
|
||||||
|
|
||||||
struct StringStorage {
|
struct StringStorage {
|
||||||
unsigned policy_: 2;
|
DuplicationPolicy policy_: 2;
|
||||||
unsigned length_: 30; // 1GB max
|
unsigned length_: 30; // 1GB max
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -644,6 +644,9 @@ 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); }
|
||||||
@@ -691,12 +694,6 @@ 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.
|
||||||
|
@@ -4,10 +4,10 @@
|
|||||||
#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.10.4"
|
# define JSONCPP_VERSION_STRING "0.10.1"
|
||||||
# define JSONCPP_VERSION_MAJOR 0
|
# define JSONCPP_VERSION_MAJOR 0
|
||||||
# define JSONCPP_VERSION_MINOR 10
|
# define JSONCPP_VERSION_MINOR 10
|
||||||
# define JSONCPP_VERSION_PATCH 4
|
# define JSONCPP_VERSION_PATCH 1
|
||||||
# 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))
|
||||||
|
|
||||||
|
@@ -1,8 +1,3 @@
|
|||||||
# 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
|
||||||
@@ -19,7 +14,6 @@ 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=@LIBRARY_INSTALL_DIR@
|
libdir=${exec_prefix}/@LIBRARY_INSTALL_DIR@
|
||||||
includedir=@INCLUDE_INSTALL_DIR@
|
includedir=${prefix}/@INCLUDE_INSTALL_DIR@
|
||||||
|
|
||||||
Name: jsoncpp
|
Name: jsoncpp
|
||||||
Description: A C++ library for interacting with JSON
|
Description: A C++ library for interacting with JSON
|
||||||
|
@@ -1,8 +1,3 @@
|
|||||||
# 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,8 +1,3 @@
|
|||||||
# 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,8 +1,3 @@
|
|||||||
# 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,8 +1,3 @@
|
|||||||
# 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.
|
||||||
|
@@ -1,15 +1,18 @@
|
|||||||
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(BUILD_SHARED_LIBS)
|
IF(JSONCPP_LIB_BUILD_SHARED)
|
||||||
ADD_DEFINITIONS( -DJSON_DLL )
|
|
||||||
TARGET_LINK_LIBRARIES(jsontestrunner_exe jsoncpp_lib)
|
TARGET_LINK_LIBRARIES(jsontestrunner_exe jsoncpp_lib)
|
||||||
ELSE(BUILD_SHARED_LIBS)
|
ELSE(JSONCPP_LIB_BUILD_SHARED)
|
||||||
TARGET_LINK_LIBRARIES(jsontestrunner_exe jsoncpp_lib_static)
|
TARGET_LINK_LIBRARIES(jsontestrunner_exe jsoncpp_lib_static)
|
||||||
ENDIF(BUILD_SHARED_LIBS)
|
ENDIF(JSONCPP_LIB_BUILD_SHARED)
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(jsontestrunner_exe PROPERTIES OUTPUT_NAME jsontestrunner_exe)
|
SET_TARGET_PROPERTIES(jsontestrunner_exe PROPERTIES OUTPUT_NAME jsontestrunner_exe)
|
||||||
|
|
||||||
|
@@ -1,3 +1,10 @@
|
|||||||
|
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
|
||||||
@@ -39,12 +46,11 @@ ELSE(JSONCPP_WITH_CMAKE_PACKAGE)
|
|||||||
SET(INSTALL_EXPORT)
|
SET(INSTALL_EXPORT)
|
||||||
ENDIF(JSONCPP_WITH_CMAKE_PACKAGE)
|
ENDIF(JSONCPP_WITH_CMAKE_PACKAGE)
|
||||||
|
|
||||||
IF(BUILD_SHARED_LIBS)
|
IF(JSONCPP_LIB_BUILD_SHARED)
|
||||||
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}
|
||||||
@@ -59,11 +65,10 @@ IF(BUILD_SHARED_LIBS)
|
|||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(BUILD_STATIC_LIBS)
|
IF(JSONCPP_LIB_BUILD_STATIC)
|
||||||
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}
|
||||||
|
@@ -32,7 +32,11 @@ static int stackDepth_g = 0; // see readValue()
|
|||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
typedef std::unique_ptr<CharReader> CharReaderPtr;
|
||||||
|
#else
|
||||||
typedef std::auto_ptr<CharReader> CharReaderPtr;
|
typedef std::auto_ptr<CharReader> CharReaderPtr;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Implementation of class Features
|
// Implementation of class Features
|
||||||
// ////////////////////////////////
|
// ////////////////////////////////
|
||||||
@@ -557,9 +561,33 @@ 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;
|
||||||
std::string buffer(token.start_, token.end_);
|
const int bufferSize = 32;
|
||||||
std::istringstream is(buffer);
|
int count;
|
||||||
if (!(is >> value))
|
int length = int(token.end_ - token.start_);
|
||||||
|
|
||||||
|
// 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);
|
||||||
@@ -1265,7 +1293,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);
|
||||||
@@ -1326,7 +1354,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();
|
||||||
|
@@ -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] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
|
result[1] = 0x80 | static_cast<char>((0x3f & (cp >> 6)));
|
||||||
result[0] = static_cast<char>(0xE0 | (0xf & (cp >> 12)));
|
result[0] = 0xE0 | static_cast<char>((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));
|
||||||
@@ -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 = static_cast<signed char>(value % 10U + static_cast<unsigned>('0'));
|
*--current = char(value % 10) + '0';
|
||||||
value /= 10;
|
value /= 10;
|
||||||
} while (value != 0);
|
} while (value != 0);
|
||||||
}
|
}
|
||||||
|
@@ -109,7 +109,7 @@ 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 + static_cast<unsigned>(sizeof(unsigned)) + 1U;
|
unsigned actualLength = length + sizeof(unsigned) + 1U;
|
||||||
char* newString = static_cast<char*>(malloc(actualLength));
|
char* newString = static_cast<char*>(malloc(actualLength));
|
||||||
if (newString == 0) {
|
if (newString == 0) {
|
||||||
throwRuntimeError(
|
throwRuntimeError(
|
||||||
@@ -126,7 +126,7 @@ inline static void decodePrefixedString(
|
|||||||
unsigned* length, char const** value)
|
unsigned* length, char const** value)
|
||||||
{
|
{
|
||||||
if (!isPrefixed) {
|
if (!isPrefixed) {
|
||||||
*length = static_cast<unsigned>(strlen(prefixed));
|
*length = strlen(prefixed);
|
||||||
*value = prefixed;
|
*value = prefixed;
|
||||||
} else {
|
} else {
|
||||||
*length = *reinterpret_cast<unsigned const*>(prefixed);
|
*length = *reinterpret_cast<unsigned const*>(prefixed);
|
||||||
@@ -233,14 +233,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 aindex) : cstr_(0), index_(aindex) {}
|
Value::CZString::CZString(ArrayIndex index) : cstr_(0), index_(index) {}
|
||||||
|
|
||||||
Value::CZString::CZString(char const* str, unsigned ulength, DuplicationPolicy allocate)
|
Value::CZString::CZString(char const* str, unsigned length, DuplicationPolicy allocate)
|
||||||
: cstr_(str)
|
: cstr_(str)
|
||||||
{
|
{
|
||||||
// allocate != duplicate
|
// allocate != duplicate
|
||||||
storage_.policy_ = allocate & 0x3;
|
storage_.policy_ = allocate;
|
||||||
storage_.length_ = ulength & 0x3FFFFFFF;
|
storage_.length_ = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value::CZString::CZString(const CZString& other)
|
Value::CZString::CZString(const CZString& other)
|
||||||
@@ -249,9 +249,9 @@ Value::CZString::CZString(const CZString& other)
|
|||||||
: other.cstr_)
|
: other.cstr_)
|
||||||
{
|
{
|
||||||
storage_.policy_ = (other.cstr_
|
storage_.policy_ = (other.cstr_
|
||||||
? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
|
? (other.storage_.policy_ == noDuplication
|
||||||
? noDuplication : duplicate)
|
? noDuplication : duplicate)
|
||||||
: static_cast<DuplicationPolicy>(other.storage_.policy_));
|
: other.storage_.policy_);
|
||||||
storage_.length_ = other.storage_.length_;
|
storage_.length_ = other.storage_.length_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,9 +313,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 vtype) {
|
Value::Value(ValueType type) {
|
||||||
initBasic(vtype);
|
initBasic(type);
|
||||||
switch (vtype) {
|
switch (type) {
|
||||||
case nullValue:
|
case nullValue:
|
||||||
break;
|
break;
|
||||||
case intValue:
|
case intValue:
|
||||||
@@ -480,7 +480,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 & 0x1;
|
other.allocated_ = temp2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Value::swap(Value& other) {
|
void Value::swap(Value& other) {
|
||||||
@@ -606,12 +606,12 @@ const char* Value::asCString() const {
|
|||||||
return this_str;
|
return this_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Value::getString(char const** str, char const** cend) const {
|
bool Value::getString(char const** str, char const** end) 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);
|
||||||
*cend = *str + length;
|
*end = *str + length;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -810,8 +810,7 @@ bool Value::asBool() const {
|
|||||||
case uintValue:
|
case uintValue:
|
||||||
return value_.uint_ ? true : false;
|
return value_.uint_ ? true : false;
|
||||||
case realValue:
|
case realValue:
|
||||||
// This is kind of strange. Not recommended.
|
return value_.real_ ? true : false;
|
||||||
return (value_.real_ != 0.0) ? true : false;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -959,8 +958,8 @@ const Value& Value::operator[](int index) const {
|
|||||||
return (*this)[ArrayIndex(index)];
|
return (*this)[ArrayIndex(index)];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Value::initBasic(ValueType vtype, bool allocated) {
|
void Value::initBasic(ValueType type, bool allocated) {
|
||||||
type_ = vtype;
|
type_ = type;
|
||||||
allocated_ = allocated;
|
allocated_ = allocated;
|
||||||
comments_ = 0;
|
comments_ = 0;
|
||||||
}
|
}
|
||||||
@@ -987,7 +986,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* cend)
|
Value& Value::resolveReference(char const* key, char const* end)
|
||||||
{
|
{
|
||||||
JSON_ASSERT_MESSAGE(
|
JSON_ASSERT_MESSAGE(
|
||||||
type_ == nullValue || type_ == objectValue,
|
type_ == nullValue || type_ == objectValue,
|
||||||
@@ -995,7 +994,7 @@ Value& Value::resolveReference(char const* key, char const* cend)
|
|||||||
if (type_ == nullValue)
|
if (type_ == nullValue)
|
||||||
*this = Value(objectValue);
|
*this = Value(objectValue);
|
||||||
CZString actualKey(
|
CZString actualKey(
|
||||||
key, static_cast<unsigned>(cend-key), CZString::duplicateOnCopy);
|
key, static_cast<unsigned>(end-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;
|
||||||
@@ -1013,13 +1012,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* cend) const
|
Value const* Value::find(char const* key, char const* end) 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>(cend-key), CZString::noDuplication);
|
CZString actualKey(key, static_cast<unsigned>(end-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;
|
||||||
@@ -1063,9 +1062,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* cend, Value const& defaultValue) const
|
Value Value::get(char const* key, char const* end, Value const& defaultValue) const
|
||||||
{
|
{
|
||||||
Value const* found = find(key, cend);
|
Value const* found = find(key, end);
|
||||||
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
|
||||||
@@ -1078,12 +1077,12 @@ Value Value::get(std::string const& key, Value const& defaultValue) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Value::removeMember(const char* key, const char* cend, Value* removed)
|
bool Value::removeMember(const char* key, const char* end, Value* removed)
|
||||||
{
|
{
|
||||||
if (type_ != objectValue) {
|
if (type_ != objectValue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CZString actualKey(key, static_cast<unsigned>(cend-key), CZString::noDuplication);
|
CZString actualKey(key, static_cast<unsigned>(end-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;
|
||||||
@@ -1128,8 +1127,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 keey(i);
|
CZString key(i);
|
||||||
(*value_.map_)[keey] = (*this)[i + 1];
|
(*value_.map_)[key] = (*this)[i + 1];
|
||||||
}
|
}
|
||||||
// erase the last one ("leftover")
|
// erase the last one ("leftover")
|
||||||
CZString keyLast(oldSize - 1);
|
CZString keyLast(oldSize - 1);
|
||||||
@@ -1145,9 +1144,9 @@ Value Value::get(const CppTL::ConstString& key,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool Value::isMember(char const* key, char const* cend) const
|
bool Value::isMember(char const* key, char const* end) const
|
||||||
{
|
{
|
||||||
Value const* value = find(key, cend);
|
Value const* value = find(key, end);
|
||||||
return NULL != value;
|
return NULL != value;
|
||||||
}
|
}
|
||||||
bool Value::isMember(char const* key) const
|
bool Value::isMember(char const* key) const
|
||||||
|
@@ -93,26 +93,26 @@ UInt ValueIteratorBase::index() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string ValueIteratorBase::name() const {
|
std::string ValueIteratorBase::name() const {
|
||||||
char const* keey;
|
char const* key;
|
||||||
char const* end;
|
char const* end;
|
||||||
keey = memberName(&end);
|
key = memberName(&end);
|
||||||
if (!keey) return std::string();
|
if (!key) return std::string();
|
||||||
return std::string(keey, end);
|
return std::string(key, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* ValueIteratorBase::memberName() const {
|
char const* ValueIteratorBase::memberName() const {
|
||||||
const char* cname = (*current_).first.data();
|
const char* name = (*current_).first.data();
|
||||||
return cname ? cname : "";
|
return name ? name : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* ValueIteratorBase::memberName(char const** end) const {
|
char const* ValueIteratorBase::memberName(char const** end) const {
|
||||||
const char* cname = (*current_).first.data();
|
const char* name = (*current_).first.data();
|
||||||
if (!cname) {
|
if (!name) {
|
||||||
*end = NULL;
|
*end = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
*end = cname + (*current_).first.length();
|
*end = name + (*current_).first.length();
|
||||||
return cname;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
@@ -29,18 +29,10 @@
|
|||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below
|
#if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#elif defined(__ANDROID__)
|
|
||||||
#define snprintf snprintf
|
|
||||||
#elif __cplusplus >= 201103L
|
#elif __cplusplus >= 201103L
|
||||||
#define snprintf std::snprintf
|
#define snprintf std::snprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__BORLANDC__)
|
|
||||||
#include <float.h>
|
|
||||||
#define isfinite _finite
|
|
||||||
#define snprintf _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.
|
||||||
#pragma warning(disable : 4996)
|
#pragma warning(disable : 4996)
|
||||||
@@ -48,7 +40,11 @@
|
|||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
|
#if __cplusplus >= 201103L
|
||||||
|
typedef std::unique_ptr<StreamWriter> StreamWriterPtr;
|
||||||
|
#else
|
||||||
typedef std::auto_ptr<StreamWriter> StreamWriterPtr;
|
typedef std::auto_ptr<StreamWriter> StreamWriterPtr;
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool containsControlCharacter(const char* str) {
|
static bool containsControlCharacter(const char* str) {
|
||||||
while (*str) {
|
while (*str) {
|
||||||
@@ -314,14 +310,8 @@ 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;
|
||||||
@@ -343,7 +333,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(), static_cast<unsigned>(name.length()));
|
document_ += valueToQuotedStringN(name.data(), name.length());
|
||||||
document_ += yamlCompatiblityEnabled_ ? ": " : ":";
|
document_ += yamlCompatiblityEnabled_ ? ": " : ":";
|
||||||
writeValue(value[name]);
|
writeValue(value[name]);
|
||||||
}
|
}
|
||||||
@@ -385,7 +375,7 @@ void StyledWriter::writeValue(const Value& value) {
|
|||||||
break;
|
break;
|
||||||
case stringValue:
|
case stringValue:
|
||||||
{
|
{
|
||||||
// Is NULL possible for value.string_?
|
// Is NULL is 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);
|
||||||
@@ -602,15 +592,8 @@ 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;
|
||||||
@@ -903,7 +886,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(), static_cast<unsigned>(name.length())));
|
writeWithIndent(valueToQuotedStringN(name.data(), name.length()));
|
||||||
*sout_ << colonSymbol_;
|
*sout_ << colonSymbol_;
|
||||||
writeValue(childValue);
|
writeValue(childValue);
|
||||||
if (++it == members.end()) {
|
if (++it == members.end()) {
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
# 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
|
||||||
@@ -7,12 +11,11 @@ ADD_EXECUTABLE( jsoncpp_test
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
IF(BUILD_SHARED_LIBS)
|
IF(JSONCPP_LIB_BUILD_SHARED)
|
||||||
ADD_DEFINITIONS( -DJSON_DLL )
|
|
||||||
TARGET_LINK_LIBRARIES(jsoncpp_test jsoncpp_lib)
|
TARGET_LINK_LIBRARIES(jsoncpp_test jsoncpp_lib)
|
||||||
ELSE(BUILD_SHARED_LIBS)
|
ELSE(JSONCPP_LIB_BUILD_SHARED)
|
||||||
TARGET_LINK_LIBRARIES(jsoncpp_test jsoncpp_lib_static)
|
TARGET_LINK_LIBRARIES(jsoncpp_test jsoncpp_lib_static)
|
||||||
ENDIF(BUILD_SHARED_LIBS)
|
ENDIF(JSONCPP_LIB_BUILD_SHARED)
|
||||||
|
|
||||||
# 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)
|
||||||
@@ -20,19 +23,19 @@ ENDIF(BUILD_SHARED_LIBS)
|
|||||||
# 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(BUILD_SHARED_LIBS)
|
IF(JSONCPP_LIB_BUILD_SHARED)
|
||||||
# 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(BUILD_SHARED_LIBS)
|
ELSE(JSONCPP_LIB_BUILD_SHARED)
|
||||||
# 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(BUILD_SHARED_LIBS)
|
ENDIF(JSONCPP_LIB_BUILD_SHARED)
|
||||||
ENDIF(JSONCPP_WITH_POST_BUILD_UNITTEST)
|
ENDIF(JSONCPP_WITH_POST_BUILD_UNITTEST)
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test)
|
SET_TARGET_PROPERTIES(jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test)
|
||||||
|
@@ -257,20 +257,6 @@ 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());
|
||||||
@@ -296,10 +282,7 @@ 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) {
|
||||||
@@ -2156,7 +2139,6 @@ 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 {};
|
||||||
@@ -2189,7 +2171,6 @@ 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 BuilderTest : JsonTest::TestCase {};
|
struct BuilderTest : JsonTest::TestCase {};
|
||||||
@@ -2273,7 +2254,6 @@ int main(int argc, const char* argv[]) {
|
|||||||
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);
|
||||||
|
@@ -1,10 +1,4 @@
|
|||||||
# Copyright 2007 Baptiste Lepilleur
|
# removes all files created during testing
|
||||||
# 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,8 +1,3 @@
|
|||||||
# 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,11 +1,4 @@
|
|||||||
# Copyright 2007 Baptiste Lepilleur
|
# Simple implementation of a json test runner to run the test against json-py.
|
||||||
# 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,8 +1,3 @@
|
|||||||
# 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,8 +1,3 @@
|
|||||||
# 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
29
travis.sh
@@ -1,29 +0,0 @@
|
|||||||
#!/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