mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-10-15 15:16:47 +02:00
Compare commits
138 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ddabf50f72 | ||
![]() |
63ab03ca28 | ||
![]() |
41ff85f443 | ||
![]() |
9079422ac1 | ||
![]() |
c39aa295e4 | ||
![]() |
42ca02b833 | ||
![]() |
e6a588a246 | ||
![]() |
7c979e8661 | ||
![]() |
c469326b47 | ||
![]() |
240c85a10c | ||
![]() |
d61cddedac | ||
![]() |
5a2dc7a2ad | ||
![]() |
a06b390187 | ||
![]() |
42a161fc80 | ||
![]() |
a3a4059367 | ||
![]() |
4d587638af | ||
![]() |
75e0c39393 | ||
![]() |
43fd41d1fc | ||
![]() |
7287065b63 | ||
![]() |
9249878229 | ||
![]() |
17c14e73a9 | ||
![]() |
21e133c6fb | ||
![]() |
ff6b449a07 | ||
![]() |
f2f19b03fb | ||
![]() |
026c39fa1a | ||
![]() |
614671d09b | ||
![]() |
132840aaa1 | ||
![]() |
9bb984a594 | ||
![]() |
66d4573206 | ||
![]() |
b29fc9834f | ||
![]() |
1a54511aa1 | ||
![]() |
a7ad98fb82 | ||
![]() |
692164d471 | ||
![]() |
c95a841fef | ||
![]() |
e895eccd18 | ||
![]() |
3b5f8bef41 | ||
![]() |
c89f0282d1 | ||
![]() |
1b68b02ccd | ||
![]() |
adb9ab1424 | ||
![]() |
49da91c786 | ||
![]() |
e8378d1e74 | ||
![]() |
2de18021fc | ||
![]() |
c98e1d85e3 | ||
![]() |
d830c0ab94 | ||
![]() |
90591c70cd | ||
![]() |
4cfae897c0 | ||
![]() |
f4ec601fd3 | ||
![]() |
d40f26d472 | ||
![]() |
c668af9d41 | ||
![]() |
13b5ed7287 | ||
![]() |
6d31cec7cf | ||
![]() |
5331d295aa | ||
![]() |
004270db37 | ||
![]() |
9006194139 | ||
![]() |
6062f9b848 | ||
![]() |
ef16a35328 | ||
![]() |
7354da8077 | ||
![]() |
6a15ca6442 | ||
![]() |
9a048e5766 | ||
![]() |
59e4d35339 | ||
![]() |
f26edb05e5 | ||
![]() |
cadb6dd9a6 | ||
![]() |
ea9f0cec30 | ||
![]() |
ffdcc9355d | ||
![]() |
f45c01a46e | ||
![]() |
3c2069fdd1 | ||
![]() |
414b179d86 | ||
![]() |
0ba8bd73f5 | ||
![]() |
23c44d9f9e | ||
![]() |
8996c377aa | ||
![]() |
a679dde58d | ||
![]() |
c21b4bbfdb | ||
![]() |
d14d8c35c3 | ||
![]() |
ed258de63d | ||
![]() |
154652ee7a | ||
![]() |
4a9d77bcf7 | ||
![]() |
56efb6ba83 | ||
![]() |
7f9cc2705c | ||
![]() |
d7347a2623 | ||
![]() |
2e319850d1 | ||
![]() |
a3d35d7fb8 | ||
![]() |
19fc55f408 | ||
![]() |
acf74290f1 | ||
![]() |
746ef154f1 | ||
![]() |
559b4416e6 | ||
![]() |
6ca374371e | ||
![]() |
f7df408a6a | ||
![]() |
86ed860c4b | ||
![]() |
c442fd96e6 | ||
![]() |
c68443f3a0 | ||
![]() |
11c48d0047 | ||
![]() |
264c3edca7 | ||
![]() |
a47fc398ef | ||
![]() |
2f178f390f | ||
![]() |
f251f15e6a | ||
![]() |
60bfcf1715 | ||
![]() |
81065748e3 | ||
![]() |
11836ae9aa | ||
![]() |
e25fb5384a | ||
![]() |
f700fe4559 | ||
![]() |
d167a09b1c | ||
![]() |
ba158fd22d | ||
![]() |
f3a4941590 | ||
![]() |
0d25d9aebf | ||
![]() |
5021e799dc | ||
![]() |
762ad0fe9d | ||
![]() |
d6e666f573 | ||
![]() |
2ecd2a59de | ||
![]() |
a691cb19de | ||
![]() |
ee7935986e | ||
![]() |
b4abc8241f | ||
![]() |
12e9ef32f9 | ||
![]() |
77632b2611 | ||
![]() |
89aa87bd24 | ||
![]() |
34fc0020c0 | ||
![]() |
f880a9432d | ||
![]() |
5a82131033 | ||
![]() |
1839f2da34 | ||
![]() |
91c1d23461 | ||
![]() |
86f085b810 | ||
![]() |
ac372d2b00 | ||
![]() |
0e24e3c64f | ||
![]() |
89ab7eca7f | ||
![]() |
a1db52b030 | ||
![]() |
1572539bec | ||
![]() |
d8cd848ede | ||
![]() |
92259f7147 | ||
![]() |
4a431bcdac | ||
![]() |
7d868636de | ||
![]() |
ab0f1e234a | ||
![]() |
45a560a8c0 | ||
![]() |
4893a8f667 | ||
![]() |
f6d785fda8 | ||
![]() |
8d54e333ff | ||
![]() |
b063cf4ada | ||
![]() |
c4ab6d733f | ||
![]() |
2f97c0147b | ||
![]() |
52cfe5ae88 |
11
.gitignore
vendored
11
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
/build/
|
/build/
|
||||||
|
/build-*/
|
||||||
*.pyc
|
*.pyc
|
||||||
*.swp
|
*.swp
|
||||||
*.actual
|
*.actual
|
||||||
@@ -6,7 +7,6 @@
|
|||||||
*.process-output
|
*.process-output
|
||||||
*.rewrite
|
*.rewrite
|
||||||
/bin/
|
/bin/
|
||||||
/buildscons/
|
|
||||||
/libs/
|
/libs/
|
||||||
/doc/doxyfile
|
/doc/doxyfile
|
||||||
/dist/
|
/dist/
|
||||||
@@ -30,9 +30,8 @@
|
|||||||
|
|
||||||
# CMake-generated files:
|
# CMake-generated files:
|
||||||
CMakeFiles/
|
CMakeFiles/
|
||||||
CTestTestFile.cmake
|
*.cmake
|
||||||
cmake_install.cmake
|
/pkg-config/jsoncpp.pc
|
||||||
pkg-config/jsoncpp.pc
|
|
||||||
jsoncpp_lib_static.dir/
|
jsoncpp_lib_static.dir/
|
||||||
|
|
||||||
# In case someone runs cmake in the root-dir:
|
# In case someone runs cmake in the root-dir:
|
||||||
@@ -45,8 +44,12 @@ jsoncpp_lib_static.dir/
|
|||||||
/src/lib_json/Makefile
|
/src/lib_json/Makefile
|
||||||
/src/test_lib_json/Makefile
|
/src/test_lib_json/Makefile
|
||||||
/src/test_lib_json/jsoncpp_test
|
/src/test_lib_json/jsoncpp_test
|
||||||
|
*.a
|
||||||
|
|
||||||
# eclipse project files
|
# eclipse project files
|
||||||
.project
|
.project
|
||||||
.cproject
|
.cproject
|
||||||
/.settings/
|
/.settings/
|
||||||
|
|
||||||
|
# DS_Store
|
||||||
|
.DS_Store
|
||||||
|
27
.travis.yml
27
.travis.yml
@@ -6,15 +6,26 @@
|
|||||||
# http://stackoverflow.com/questions/22111549/travis-ci-with-clang-3-4-and-c11/30925448#30925448
|
# 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
|
# to allow C++11, though we are not yet building with -std=c++11
|
||||||
|
|
||||||
|
before_install: pyenv install 3.5.4 && pyenv global 3.5.4
|
||||||
install:
|
install:
|
||||||
|
- if [[ $TRAVIS_OS_NAME == osx ]]; then
|
||||||
|
brew update;
|
||||||
|
brew install python3 ninja;
|
||||||
|
python3 -m venv venv;
|
||||||
|
source venv/bin/activate;
|
||||||
|
elif [[ $TRAVIS_OS_NAME == linux ]]; then
|
||||||
|
wget https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-linux.zip;
|
||||||
|
unzip -q ninja-linux.zip -d build;
|
||||||
|
fi
|
||||||
|
- pip3 install meson
|
||||||
# /usr/bin/gcc is 4.6 always, but gcc-X.Y is available.
|
# /usr/bin/gcc is 4.6 always, but gcc-X.Y is available.
|
||||||
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
|
- if [[ $CXX = g++ ]]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
|
||||||
# /usr/bin/clang is our version already, and clang-X.Y does not exist.
|
# /usr/bin/clang has a conflict with gcc, so use clang-X.Y.
|
||||||
#- if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
|
- if [[ $CXX = clang++ ]]; then export CXX="clang++-3.5" CC="clang-3.5"; fi
|
||||||
- echo ${PATH}
|
- echo ${PATH}
|
||||||
- ls /usr/local
|
- ls /usr/local
|
||||||
- ls /usr/local/bin
|
- ls /usr/local/bin
|
||||||
- export PATH=/usr/local/bin:/usr/bin:${PATH}
|
- export PATH="${PWD}"/build:/usr/local/bin:/usr/bin:${PATH}
|
||||||
- echo ${CXX}
|
- echo ${CXX}
|
||||||
- ${CXX} --version
|
- ${CXX} --version
|
||||||
- which valgrind
|
- which valgrind
|
||||||
@@ -22,10 +33,11 @@ addons:
|
|||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.5
|
||||||
packages:
|
packages:
|
||||||
- gcc-4.9
|
- gcc-4.9
|
||||||
- g++-4.9
|
- g++-4.9
|
||||||
- clang
|
- clang-3.5
|
||||||
- valgrind
|
- valgrind
|
||||||
os:
|
os:
|
||||||
- linux
|
- linux
|
||||||
@@ -36,8 +48,9 @@ compiler:
|
|||||||
script: ./travis.sh
|
script: ./travis.sh
|
||||||
env:
|
env:
|
||||||
matrix:
|
matrix:
|
||||||
- SHARED_LIB=ON STATIC_LIB=ON CMAKE_PKG=ON BUILD_TYPE=release VERBOSE_MAKE=false
|
- LIB_TYPE=static BUILD_TYPE=release
|
||||||
- SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE_MAKE=true VERBOSE
|
- LIB_TYPE=shared BUILD_TYPE=debug
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
dist: trusty
|
||||||
sudo: false
|
sudo: false
|
||||||
|
110
AUTHORS
110
AUTHORS
@@ -1 +1,111 @@
|
|||||||
Baptiste Lepilleur <blep@users.sourceforge.net>
|
Baptiste Lepilleur <blep@users.sourceforge.net>
|
||||||
|
|
||||||
|
Aaron Jacobs <aaronjjacobs@gmail.com>
|
||||||
|
Aaron Jacobs <jacobsa@google.com>
|
||||||
|
Adam Boseley <ABoseley@agjunction.com>
|
||||||
|
Adam Boseley <adam.boseley@gmail.com>
|
||||||
|
Aleksandr Derbenev <13alexac@gmail.com>
|
||||||
|
Alexander Gazarov <DrMetallius@users.noreply.github.com>
|
||||||
|
Alexander V. Brezgin <abrezgin@appliedtech.ru>
|
||||||
|
Alexandr Brezgin <albrezgin@mail.ru>
|
||||||
|
Alexey Kruchinin <alexey@mopals.com>
|
||||||
|
Anton Indrawan <anton.indrawan@gmail.com>
|
||||||
|
Baptiste Jonglez <git@bitsofnetworks.org>
|
||||||
|
Baptiste Lepilleur <baptiste.lepilleur@gmail.com>
|
||||||
|
Baruch Siach <baruch@tkos.co.il>
|
||||||
|
Ben Boeckel <mathstuf@gmail.com>
|
||||||
|
Benjamin Knecht <bknecht@logitech.com>
|
||||||
|
Bernd Kuhls <bernd.kuhls@t-online.de>
|
||||||
|
Billy Donahue <billydonahue@google.com>
|
||||||
|
Braden McDorman <bmcdorman@gmail.com>
|
||||||
|
Brandon Myers <bmyers1788@gmail.com>
|
||||||
|
Brendan Drew <brendan.drew@daqri.com>
|
||||||
|
chason <cxchao802@gmail.com>
|
||||||
|
Chris Gilling <cgilling@iparadigms.com>
|
||||||
|
Christopher Dawes <christopher.dawes.1981@googlemail.com>
|
||||||
|
Christopher Dunn <cdunn2001@gmail.com>
|
||||||
|
Chuck Atkins <chuck.atkins@kitware.com>
|
||||||
|
Cody P Schafer <dev@codyps.com>
|
||||||
|
Connor Manning <connor@hobu.co>
|
||||||
|
Cory Quammen <cory.quammen@kitware.com>
|
||||||
|
Cristóvão B da Cruz e Silva <CrisXed@gmail.com>
|
||||||
|
Daniel Krügler <daniel.kruegler@gmail.com>
|
||||||
|
Dani-Hub <daniel.kruegler@googlemail.com>
|
||||||
|
Dan Liu <gzliudan>
|
||||||
|
datadiode <datadiode@users.noreply.github.com>
|
||||||
|
datadiode <jochen.neubeck@vodafone.de>
|
||||||
|
David Seifert <soap@gentoo.org>
|
||||||
|
David West <david-west@idexx.com>
|
||||||
|
dawesc <chris.dawes@eftlab.co.uk>
|
||||||
|
Dmitry Marakasov <amdmi3@amdmi3.ru>
|
||||||
|
dominicpezzuto <dom@dompezzuto.com>
|
||||||
|
Don Milham <dmilham@gmail.com>
|
||||||
|
drgler <daniel.kruegler@gmail.com>
|
||||||
|
ds283 <D.Seery@sussex.ac.uk>
|
||||||
|
Egor Tensin <Egor.Tensin@gmail.com>
|
||||||
|
eightnoteight <mr.eightnoteight@gmail.com>
|
||||||
|
Evince <baneyue@gmail.com>
|
||||||
|
filipjs <filipjs@users.noreply.github.com>
|
||||||
|
findblar <ft@finbarr.ca>
|
||||||
|
Florian Meier <florian.meier@koalo.de>
|
||||||
|
Gaëtan Lehmann <gaetan.lehmann@gmail.com>
|
||||||
|
Gaurav <g.gupta@samsung.com>
|
||||||
|
Gergely Nagy <ngg@ngg.hu>
|
||||||
|
Gida Pataki <gida.pataki@prezi.com>
|
||||||
|
I3ck <buckmartin@buckmartin.de>
|
||||||
|
Iñaki Baz Castillo <ibc@aliax.net>
|
||||||
|
Jacco <jacco@geul.net>
|
||||||
|
Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
|
||||||
|
Jonas Platte <mail@jonasplatte.de>
|
||||||
|
Jörg Krause <joerg.krause@embedded.rocks>
|
||||||
|
Keith Lea <keith@whamcitylights.com>
|
||||||
|
Kevin Grant <kbradleygrant@gmail.com>
|
||||||
|
Kirill V. Lyadvinsky <jia3ep@gmail.com>
|
||||||
|
Kirill V. Lyadvinsky <mail@codeatcpp.com>
|
||||||
|
Kobi Gurkan <kobigurk@gmail.com>
|
||||||
|
Magnus Bjerke Vik <mbvett@gmail.com>
|
||||||
|
Malay Shah <malays@users.sourceforge.net>
|
||||||
|
Mara Kim <hacker.root@gmail.com>
|
||||||
|
Marek Kotewicz <marek.kotewicz@gmail.com>
|
||||||
|
Mark Lakata <mark@lakata.org>
|
||||||
|
Mark Zeren <mzeren@vmware.com>
|
||||||
|
Martin Buck <buckmartin@buckmartin.de>
|
||||||
|
Martyn Gigg <martyn.gigg@gmail.com>
|
||||||
|
Mattes D <github@xoft.cz>
|
||||||
|
Matthias Loy <matthias.loy@hbm.com>
|
||||||
|
Merlyn Morgan-Graham <kavika@gmail.com>
|
||||||
|
Michael Shields <mshields@google.com>
|
||||||
|
Michał Górny <mgorny@gentoo.org>
|
||||||
|
Mike Naberezny <mike@naberezny.com>
|
||||||
|
mloy <matthias.loy@googlemail.com>
|
||||||
|
Motti <lanzkron@gmail.com>
|
||||||
|
nnkur <nnkur@mail.ru>
|
||||||
|
Omkar Wagh <owagh@owaghlinux.ny.tower-research.com>
|
||||||
|
paulo <paulobrizolara@users.noreply.github.com>
|
||||||
|
pavel.pimenov <pavel.pimenov@gmail.com>
|
||||||
|
Paweł Bylica <chfast@gmail.com>
|
||||||
|
Péricles Lopes Machado <pericles.raskolnikoff@gmail.com>
|
||||||
|
Peter Spiess-Knafl <psk@autistici.org>
|
||||||
|
pffang <pffang@vip.qq.com>
|
||||||
|
Rémi Verschelde <remi@verschelde.fr>
|
||||||
|
renu555 <renu.tyagi@samsung.com>
|
||||||
|
Robert Dailey <rcdailey@gmail.com>
|
||||||
|
Sam Clegg <sbc@chromium.org>
|
||||||
|
selaselah <selah@outlook.com>
|
||||||
|
Sergiy80 <sil2004@gmail.com>
|
||||||
|
sergzub <sergzub@gmail.com>
|
||||||
|
Stefan Schweter <stefan@schweter.it>
|
||||||
|
Steffen Kieß <Steffen.Kiess@ipvs.uni-stuttgart.de>
|
||||||
|
Steven Hahn <hahnse@ornl.gov>
|
||||||
|
Stuart Eichert <stuart@fivemicro.com>
|
||||||
|
SuperManitu <supermanitu@gmail.com>
|
||||||
|
Techwolf <dring@g33kworld.net>
|
||||||
|
Tengiz Sharafiev <btolfa+github@gmail.com>
|
||||||
|
Tomasz Maciejewski <tmaciejewsk@gmail.com>
|
||||||
|
Vicente Olivert Riera <Vincent.Riera@imgtec.com>
|
||||||
|
xiaoyur347 <xiaoyur347@gmail.com>
|
||||||
|
ycqiu <429148848@qq.com>
|
||||||
|
yiqiju <fred_ju@selinc.com>
|
||||||
|
Yu Xiaolei <dreifachstein@gmail.com>
|
||||||
|
|
||||||
|
Google Inc.
|
||||||
|
119
CMakeLists.txt
119
CMakeLists.txt
@@ -1,6 +1,6 @@
|
|||||||
# vim: et ts=4 sts=4 sw=4 tw=0
|
# vim: et ts=4 sts=4 sw=4 tw=0
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
|
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
|
||||||
PROJECT(jsoncpp)
|
PROJECT(jsoncpp)
|
||||||
ENABLE_TESTING()
|
ENABLE_TESTING()
|
||||||
|
|
||||||
@@ -22,20 +22,15 @@ IF(NOT WIN32)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET(DEBUG_LIBNAME_SUFFIX "" CACHE STRING "Optional suffix to append to the library name for a debug build")
|
# Enable runtime search path support for dynamic libraries on OSX
|
||||||
SET(LIB_SUFFIX "" CACHE STRING "Optional arch-dependent suffix for the library installation directory")
|
IF(APPLE)
|
||||||
|
SET(CMAKE_MACOSX_RPATH 1)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
SET(RUNTIME_INSTALL_DIR bin
|
# Adhere to GNU filesystem layout conventions
|
||||||
CACHE PATH "Install dir for executables and dlls")
|
INCLUDE(GNUInstallDirs)
|
||||||
SET(ARCHIVE_INSTALL_DIR lib${LIB_SUFFIX}
|
|
||||||
CACHE PATH "Install dir for static libraries")
|
SET(DEBUG_LIBNAME_SUFFIX "" CACHE STRING "Optional suffix to append to the library name for a debug build")
|
||||||
SET(LIBRARY_INSTALL_DIR lib${LIB_SUFFIX}
|
|
||||||
CACHE PATH "Install dir for shared libraries")
|
|
||||||
SET(INCLUDE_INSTALL_DIR include
|
|
||||||
CACHE PATH "Install dir for headers")
|
|
||||||
SET(PACKAGE_INSTALL_DIR lib${LIB_SUFFIX}/cmake
|
|
||||||
CACHE PATH "Install dir for cmake package config files")
|
|
||||||
MARK_AS_ADVANCED( RUNTIME_INSTALL_DIR ARCHIVE_INSTALL_DIR INCLUDE_INSTALL_DIR PACKAGE_INSTALL_DIR )
|
|
||||||
|
|
||||||
# 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)
|
||||||
@@ -64,11 +59,12 @@ ENDMACRO()
|
|||||||
#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 1.7.5 )
|
SET( JSONCPP_VERSION 1.8.4 )
|
||||||
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")
|
||||||
#ENDIF(NOT JSONCPP_VERSION_FOUND)
|
#ENDIF(NOT JSONCPP_VERSION_FOUND)
|
||||||
|
SET( JSONCPP_SOVERSION 19 )
|
||||||
SET( JSONCPP_USE_SECURE_MEMORY "0" CACHE STRING "-D...=1 to use memory-wiping allocator for STL" )
|
SET( JSONCPP_USE_SECURE_MEMORY "0" CACHE STRING "-D...=1 to use memory-wiping allocator for STL" )
|
||||||
|
|
||||||
MESSAGE(STATUS "JsonCpp Version: ${JSONCPP_VERSION_MAJOR}.${JSONCPP_VERSION_MINOR}.${JSONCPP_VERSION_PATCH}")
|
MESSAGE(STATUS "JsonCpp Version: ${JSONCPP_VERSION_MAJOR}.${JSONCPP_VERSION_MINOR}.${JSONCPP_VERSION_PATCH}")
|
||||||
@@ -80,70 +76,79 @@ CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/version.in"
|
|||||||
"${PROJECT_SOURCE_DIR}/version"
|
"${PROJECT_SOURCE_DIR}/version"
|
||||||
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 ")
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||||
if (JSONCPP_WITH_STRICT_ISO)
|
IF(JSONCPP_WITH_STRICT_ISO)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors")
|
||||||
endif ()
|
ENDIF()
|
||||||
endif()
|
ENDIF()
|
||||||
endmacro()
|
ENDMACRO()
|
||||||
|
|
||||||
# Include our configuration header
|
# Include our configuration header
|
||||||
INCLUDE_DIRECTORIES( ${jsoncpp_SOURCE_DIR}/include )
|
INCLUDE_DIRECTORIES( ${jsoncpp_SOURCE_DIR}/include )
|
||||||
|
|
||||||
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
|
||||||
# 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()
|
ENDIF()
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
# Require C++11 support, prefer ISO C++ over GNU variants,
|
||||||
# using regular Clang or AppleClang
|
# as relying solely on ISO C++ is more portable.
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Werror=conversion -Werror=sign-compare")
|
SET(CMAKE_CXX_STANDARD 11)
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
# using GCC
|
SET(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wextra")
|
|
||||||
# not yet ready for -Wsign-conversion
|
|
||||||
|
|
||||||
if (JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR)
|
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=conversion -pedantic")
|
# using regular Clang or AppleClang
|
||||||
endif ()
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wconversion -Wshadow -Werror=conversion -Werror=sign-compare")
|
||||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
# using Intel compiler
|
# using GCC
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wextra -Werror=conversion")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wconversion -Wshadow -Wextra")
|
||||||
|
# not yet ready for -Wsign-conversion
|
||||||
|
|
||||||
if (JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR)
|
IF(JSONCPP_WITH_STRICT_ISO)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
|
||||||
endif ()
|
ENDIF()
|
||||||
endif()
|
IF(JSONCPP_WITH_WARNING_AS_ERROR)
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=conversion")
|
||||||
|
ENDIF()
|
||||||
|
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||||
|
# using Intel compiler
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wconversion -Wshadow -Wextra -Werror=conversion")
|
||||||
|
|
||||||
find_program(CCACHE_FOUND ccache)
|
IF(JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR)
|
||||||
if(CCACHE_FOUND)
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
ENDIF()
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
ENDIF()
|
||||||
endif(CCACHE_FOUND)
|
|
||||||
|
FIND_PROGRAM(CCACHE_FOUND ccache)
|
||||||
|
IF(CCACHE_FOUND)
|
||||||
|
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
||||||
|
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
||||||
|
ENDIF(CCACHE_FOUND)
|
||||||
|
|
||||||
IF(JSONCPP_WITH_WARNING_AS_ERROR)
|
IF(JSONCPP_WITH_WARNING_AS_ERROR)
|
||||||
UseCompilationWarningAsError()
|
UseCompilationWarningAsError()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
IF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
||||||
CONFIGURE_FILE(
|
CONFIGURE_FILE(
|
||||||
"pkg-config/jsoncpp.pc.in"
|
"pkg-config/jsoncpp.pc.in"
|
||||||
"pkg-config/jsoncpp.pc"
|
"pkg-config/jsoncpp.pc"
|
||||||
@ONLY)
|
@ONLY)
|
||||||
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkg-config/jsoncpp.pc"
|
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkg-config/jsoncpp.pc"
|
||||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig")
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(JSONCPP_WITH_CMAKE_PACKAGE)
|
IF(JSONCPP_WITH_CMAKE_PACKAGE)
|
||||||
INSTALL(EXPORT jsoncpp
|
INSTALL(EXPORT jsoncpp
|
||||||
DESTINATION ${PACKAGE_INSTALL_DIR}/jsoncpp
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jsoncpp
|
||||||
FILE jsoncppConfig.cmake)
|
FILE jsoncppConfig.cmake)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
8
LICENSE
8
LICENSE
@@ -2,13 +2,13 @@ The JsonCpp library's source code, including accompanying documentation,
|
|||||||
tests and demonstration applications, are licensed under the following
|
tests and demonstration applications, are licensed under the following
|
||||||
conditions...
|
conditions...
|
||||||
|
|
||||||
The author (Baptiste Lepilleur) explicitly disclaims copyright in all
|
Baptiste Lepilleur and The JsonCpp Authors explicitly disclaim copyright in all
|
||||||
jurisdictions which recognize such a disclaimer. In such jurisdictions,
|
jurisdictions which recognize such a disclaimer. In such jurisdictions,
|
||||||
this software is released into the Public Domain.
|
this software is released into the Public Domain.
|
||||||
|
|
||||||
In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
|
In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
|
||||||
2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
|
2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur and
|
||||||
released under the terms of the MIT License (see below).
|
The JsonCpp Authors, and is released under the terms of the MIT License (see below).
|
||||||
|
|
||||||
In jurisdictions which recognize Public Domain property, the user of this
|
In jurisdictions which recognize Public Domain property, the user of this
|
||||||
software may choose to accept it either as 1) Public Domain, 2) under the
|
software may choose to accept it either as 1) Public Domain, 2) under the
|
||||||
@@ -23,7 +23,7 @@ described in clear, concise terms at:
|
|||||||
The full text of the MIT License follows:
|
The full text of the MIT License follows:
|
||||||
|
|
||||||
========================================================================
|
========================================================================
|
||||||
Copyright (c) 2007-2010 Baptiste Lepilleur
|
Copyright (c) 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person
|
Permission is hereby granted, free of charge, to any person
|
||||||
obtaining a copy of this software and associated documentation
|
obtaining a copy of this software and associated documentation
|
||||||
|
175
NEWS.txt
175
NEWS.txt
@@ -1,175 +0,0 @@
|
|||||||
New in SVN
|
|
||||||
----------
|
|
||||||
|
|
||||||
* Updated the type system's behavior, in order to better support backwards
|
|
||||||
compatibility with code that was written before 64-bit integer support was
|
|
||||||
introduced. Here's how it works now:
|
|
||||||
|
|
||||||
* isInt, isInt64, isUInt, and isUInt64 return true if and only if the
|
|
||||||
value can be exactly represented as that type. In particular, a value
|
|
||||||
constructed with a double like 17.0 will now return true for all of
|
|
||||||
these methods.
|
|
||||||
|
|
||||||
* isDouble and isFloat now return true for all numeric values, since all
|
|
||||||
numeric values can be converted to a double or float without
|
|
||||||
truncation. Note however that the conversion may not be exact -- for
|
|
||||||
example, doubles cannot exactly represent all integers above 2^53 + 1.
|
|
||||||
|
|
||||||
* isBool, isNull, isString, isArray, and isObject now return true if and
|
|
||||||
only if the value is of that type.
|
|
||||||
|
|
||||||
* isConvertibleTo(fooValue) indicates that it is safe to call asFoo.
|
|
||||||
(For each type foo, isFoo always implies isConvertibleTo(fooValue).)
|
|
||||||
asFoo returns an approximate or exact representation as appropriate.
|
|
||||||
For example, a double value may be truncated when asInt is called.
|
|
||||||
|
|
||||||
* For backwards compatibility with old code, isConvertibleTo(intValue)
|
|
||||||
may return false even if type() == intValue. This is because the value
|
|
||||||
may have been constructed with a 64-bit integer larger than maxInt,
|
|
||||||
and calling asInt() would cause an exception. If you're writing new
|
|
||||||
code, use isInt64 to find out whether the value is exactly
|
|
||||||
representable using an Int64, or asDouble() combined with minInt64 and
|
|
||||||
maxInt64 to figure out whether it is approximately representable.
|
|
||||||
|
|
||||||
* Value
|
|
||||||
- Patch #10: BOOST_FOREACH compatibility. Made Json::iterator more
|
|
||||||
standard compliant, added missing iterator_category and value_type
|
|
||||||
typedefs (contribued by Robert A. Iannucci).
|
|
||||||
|
|
||||||
* Compilation
|
|
||||||
|
|
||||||
- New CMake based build system. Based in part on contribution from
|
|
||||||
Igor Okulist and Damien Buhl (Patch #14).
|
|
||||||
|
|
||||||
- New header json/version.h now contains version number macros
|
|
||||||
(JSONCPP_VERSION_MAJOR, JSONCPP_VERSION_MINOR, JSONCPP_VERSION_PATCH
|
|
||||||
and JSONCPP_VERSION_HEXA).
|
|
||||||
|
|
||||||
- Patch #11: added missing JSON_API on some classes causing link issues
|
|
||||||
when building as a dynamic library on Windows
|
|
||||||
(contributed by Francis Bolduc).
|
|
||||||
|
|
||||||
- Visual Studio DLL: suppressed warning "C4251: <data member>: <type>
|
|
||||||
needs to have dll-interface to be used by..." via pragma push/pop
|
|
||||||
in json-cpp headers.
|
|
||||||
|
|
||||||
- Added Travis CI intregration: https://travis-ci.org/blep/jsoncpp-mirror
|
|
||||||
|
|
||||||
* Bug fixes
|
|
||||||
- Patch #15: Copy constructor does not initialize allocated_ for stringValue
|
|
||||||
(contributed by rmongia).
|
|
||||||
|
|
||||||
- Patch #16: Missing field copy in Json::Value::iterator causing infinite
|
|
||||||
loop when using experimental internal map (#define JSON_VALUE_USE_INTERNAL_MAP)
|
|
||||||
(contributed by Ming-Lin Kao).
|
|
||||||
|
|
||||||
|
|
||||||
New in JsonCpp 0.6.0:
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
* Compilation
|
|
||||||
|
|
||||||
- LD_LIBRARY_PATH and LIBRARY_PATH environment variables are now
|
|
||||||
propagated to the build environment as this is required for some
|
|
||||||
compiler installation.
|
|
||||||
|
|
||||||
- Added support for Microsoft Visual Studio 2008 (bug #2930462):
|
|
||||||
The platform "msvc90" has been added.
|
|
||||||
|
|
||||||
Notes: you need to setup the environment by running vcvars32.bat
|
|
||||||
(e.g. MSVC 2008 command prompt in start menu) before running scons.
|
|
||||||
|
|
||||||
- Added support for amalgamated source and header generation (a la sqlite).
|
|
||||||
Refer to README.md section "Generating amalgamated source and header"
|
|
||||||
for detail.
|
|
||||||
|
|
||||||
* Value
|
|
||||||
|
|
||||||
- Removed experimental ValueAllocator, it caused static
|
|
||||||
initialization/destruction order issues (bug #2934500).
|
|
||||||
The DefaultValueAllocator has been inlined in code.
|
|
||||||
|
|
||||||
- Added support for 64 bits integer:
|
|
||||||
|
|
||||||
Types Json::Int64 and Json::UInt64 have been added. They are aliased
|
|
||||||
to 64 bits integers on system that support them (based on __int64 on
|
|
||||||
Microsoft Visual Studio platform, and long long on other platforms).
|
|
||||||
|
|
||||||
Types Json::LargestInt and Json::LargestUInt have been added. They are
|
|
||||||
aliased to the largest integer type supported:
|
|
||||||
either Json::Int/Json::UInt or Json::Int64/Json::UInt64 respectively.
|
|
||||||
|
|
||||||
Json::Value::asInt() and Json::Value::asUInt() still returns plain
|
|
||||||
"int" based types, but asserts if an attempt is made to retrieve
|
|
||||||
a 64 bits value that can not represented as the return type.
|
|
||||||
|
|
||||||
Json::Value::asInt64() and Json::Value::asUInt64() have been added
|
|
||||||
to obtain the 64 bits integer value.
|
|
||||||
|
|
||||||
Json::Value::asLargestInt() and Json::Value::asLargestUInt() returns
|
|
||||||
the integer as a LargestInt/LargestUInt respectively. Those functions
|
|
||||||
functions are typically used when implementing writer.
|
|
||||||
|
|
||||||
The reader attempts to read number as 64 bits integer, and fall back
|
|
||||||
to reading a double if the number is not in the range of 64 bits
|
|
||||||
integer.
|
|
||||||
|
|
||||||
Warning: Json::Value::asInt() and Json::Value::asUInt() now returns
|
|
||||||
long long. This changes break code that was passing the return value
|
|
||||||
to *printf() function.
|
|
||||||
|
|
||||||
Support for 64 bits integer can be disabled by defining the macro
|
|
||||||
JSON_NO_INT64 (uncomment it in json/config.h for example), though
|
|
||||||
it should have no impact on existing usage.
|
|
||||||
|
|
||||||
- The type Json::ArrayIndex is used for indexes of a JSON value array. It
|
|
||||||
is an unsigned int (typically 32 bits).
|
|
||||||
|
|
||||||
- Array index can be passed as int to operator[], allowing use of literal:
|
|
||||||
Json::Value array;
|
|
||||||
array.append( 1234 );
|
|
||||||
int value = array[0].asInt(); // did not compile previously
|
|
||||||
|
|
||||||
- Added float Json::Value::asFloat() to obtain a floating point value as a
|
|
||||||
float (avoid lost of precision warning caused by used of asDouble()
|
|
||||||
to initialize a float).
|
|
||||||
|
|
||||||
* Reader
|
|
||||||
|
|
||||||
- Renamed Reader::getFormatedErrorMessages() to getFormattedErrorMessages.
|
|
||||||
Bug #3023708 (Formatted has 2 't'). The old member function is deprecated
|
|
||||||
but still present for backward compatibility.
|
|
||||||
|
|
||||||
* Tests
|
|
||||||
|
|
||||||
- Added test to ensure that the escape sequence "\/" is corrected handled
|
|
||||||
by the parser.
|
|
||||||
|
|
||||||
* Bug fixes
|
|
||||||
|
|
||||||
- Bug #3139677: JSON [1 2 3] was incorrectly parsed as [1, 3]. Error is now
|
|
||||||
correctly detected.
|
|
||||||
|
|
||||||
- Bug #3139678: stack buffer overflow when parsing a double with a
|
|
||||||
length of 32 characters.
|
|
||||||
|
|
||||||
- Fixed Value::operator <= implementation (had the semantic of operator >=).
|
|
||||||
Found when adding unit tests for comparison operators.
|
|
||||||
|
|
||||||
- Value::compare() is now const and has an actual implementation with
|
|
||||||
unit tests.
|
|
||||||
|
|
||||||
- Bug #2407932: strpbrk() can fail for NULL pointer.
|
|
||||||
|
|
||||||
- Bug #3306345: Fixed minor typo in Path::resolve().
|
|
||||||
|
|
||||||
- Bug #3314841/#3306896: errors in amalgamate.py
|
|
||||||
|
|
||||||
- Fixed some Coverity warnings and line-endings.
|
|
||||||
|
|
||||||
* License
|
|
||||||
|
|
||||||
- See file LICENSE for details. Basically JsonCpp is now licensed under
|
|
||||||
MIT license, or public domain if desired and recognized in your jurisdiction.
|
|
||||||
Thanks to Stephan G. Beal [http://wanderinghorse.net/home/stephan/]) who
|
|
||||||
helped figuring out the solution to the public domain issue.
|
|
183
README.md
183
README.md
@@ -1,5 +1,6 @@
|
|||||||
Introduction
|
# JsonCpp
|
||||||
------------
|
|
||||||
|
[](http://www.conan.io/source/jsoncpp/1.8.0/theirix/ci)
|
||||||
|
|
||||||
[JSON][json-org] is a lightweight data-interchange format. It can represent
|
[JSON][json-org] is a lightweight data-interchange format. It can represent
|
||||||
numbers, strings, ordered sequences of values, and collections of name/value
|
numbers, strings, ordered sequences of values, and collections of name/value
|
||||||
@@ -7,133 +8,52 @@ pairs.
|
|||||||
|
|
||||||
[json-org]: http://json.org/
|
[json-org]: http://json.org/
|
||||||
|
|
||||||
[JsonCpp][] is a C++ library that allows manipulating JSON values, including
|
JsonCpp is a C++ library that allows manipulating JSON values, including
|
||||||
serialization and deserialization to and from strings. It can also preserve
|
serialization and deserialization to and from strings. It can also preserve
|
||||||
existing comment in unserialization/serialization steps, making it a convenient
|
existing comment in unserialization/serialization steps, making it a convenient
|
||||||
format to store user input files.
|
format to store user input files.
|
||||||
|
|
||||||
[JsonCpp]: http://open-source-parsers.github.io/jsoncpp-docs/doxygen/index.html
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
[JsonCpp documentation][JsonCpp-documentation] is generated using [Doxygen][].
|
||||||
|
|
||||||
|
[JsonCpp-documentation]: http://open-source-parsers.github.io/jsoncpp-docs/doxygen/index.html
|
||||||
|
[Doxygen]: http://www.doxygen.org
|
||||||
|
|
||||||
|
|
||||||
## A note on backward-compatibility
|
## A note on backward-compatibility
|
||||||
|
|
||||||
* `1.y.z` is built with C++11.
|
* `1.y.z` is built with C++11.
|
||||||
* `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
|
## Contributing to JsonCpp
|
||||||
-----------------------------
|
|
||||||
The recommended approach to integrating JsonCpp in your project is to include
|
|
||||||
the [amalgamated source](#generating-amalgamated-source-and-header) (a single
|
|
||||||
`.cpp` file and two `.h` files) in your project, and compile and build as you
|
|
||||||
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
|
### Building and testing with Meson/Ninja
|
||||||
should be included as follow:
|
Thanks to David Seifert (@SoapGentoo), we (the maintainers) now use [meson](http://mesonbuild.com/) and [ninja](https://ninja-build.org/) to build for debugging, as well as for continuous integration (see [`travis.sh`](travis.sh) ). Other systems may work, but minor things like version strings might break.
|
||||||
|
|
||||||
#include <json/json.h>
|
First, install both meson (which requires Python3) and ninja.
|
||||||
|
If you wish to install to a directory other than /usr/local, set an environment variable called DESTDIR with the desired path:
|
||||||
|
DESTDIR=/path/to/install/dir
|
||||||
|
|
||||||
If JsonCpp was built as a dynamic library on Windows, then your project needs to
|
Then,
|
||||||
define the macro `JSON_DLL`.
|
|
||||||
|
|
||||||
Generating amalgamated source and header
|
cd jsoncpp/
|
||||||
----------------------------------------
|
BUILD_TYPE=debug
|
||||||
JsonCpp is provided with a script to generate a single header and a single
|
#BUILD_TYPE=release
|
||||||
source file to ease inclusion into an existing project. The amalgamated source
|
LIB_TYPE=shared
|
||||||
can be generated at any time by running the following command from the
|
#LIB_TYPE=static
|
||||||
top-directory (this requires Python 2.6):
|
meson --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} . build-${LIB_TYPE}
|
||||||
|
ninja -v -C build-${LIB_TYPE} test
|
||||||
|
cd build-${LIB_TYPE}
|
||||||
|
sudo ninja install
|
||||||
|
|
||||||
python amalgamate.py
|
### Building and testing with other build systems
|
||||||
|
See https://github.com/open-source-parsers/jsoncpp/wiki/Building
|
||||||
|
|
||||||
It is possible to specify header name. See the `-h` option for detail.
|
### Running the tests manually
|
||||||
|
|
||||||
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
|
|
||||||
-------------------------------
|
|
||||||
[CMake][] is a C++ Makefiles/Solution generator. It is usually available on most
|
|
||||||
Linux system as package. On Ubuntu:
|
|
||||||
|
|
||||||
sudo apt-get install cmake
|
|
||||||
|
|
||||||
[CMake]: http://www.cmake.org
|
|
||||||
|
|
||||||
Note that Python is also required to run the JSON reader/writer tests. If
|
|
||||||
missing, the build will skip running those tests.
|
|
||||||
|
|
||||||
When running CMake, a few parameters are required:
|
|
||||||
|
|
||||||
* a build directory where the makefiles/solution are generated. It is also used
|
|
||||||
to store objects, libraries and executables files.
|
|
||||||
* the generator to use: makefiles or Visual Studio solution? What version or
|
|
||||||
Visual Studio, 32 or 64 bits solution?
|
|
||||||
|
|
||||||
Steps for generating solution/makefiles using `cmake-gui`:
|
|
||||||
|
|
||||||
* Make "source code" point to the source directory.
|
|
||||||
* Make "where to build the binary" point to the directory to use for the build.
|
|
||||||
* Click on the "Grouped" check box.
|
|
||||||
* Review JsonCpp build options (tick `BUILD_SHARED_LIBS` to build as a
|
|
||||||
dynamic library).
|
|
||||||
* Click the configure button at the bottom, then the generate button.
|
|
||||||
* The generated solution/makefiles can be found in the binary directory.
|
|
||||||
|
|
||||||
Alternatively, from the command-line on Unix in the source directory:
|
|
||||||
|
|
||||||
mkdir -p build/debug
|
|
||||||
cd build/debug
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" ../..
|
|
||||||
make
|
|
||||||
|
|
||||||
Running `cmake -h` will display the list of available generators (passed using
|
|
||||||
the `-G` option).
|
|
||||||
|
|
||||||
By default CMake hides compilation commands. This can be modified by specifying
|
|
||||||
`-DCMAKE_VERBOSE_MAKEFILE=true` when generating makefiles.
|
|
||||||
|
|
||||||
Building and testing with SCons
|
|
||||||
-------------------------------
|
|
||||||
**Note:** The SCons-based build system is deprecated. Please use CMake; see the
|
|
||||||
section above.
|
|
||||||
|
|
||||||
JsonCpp can use [Scons][] as a build system. Note that SCons requires Python to
|
|
||||||
be installed.
|
|
||||||
|
|
||||||
[SCons]: http://www.scons.org/
|
|
||||||
|
|
||||||
Invoke SCons as follows:
|
|
||||||
|
|
||||||
scons platform=$PLATFORM [TARGET]
|
|
||||||
|
|
||||||
where `$PLATFORM` may be one of:
|
|
||||||
|
|
||||||
* `suncc`: Sun C++ (Solaris)
|
|
||||||
* `vacpp`: Visual Age C++ (AIX)
|
|
||||||
* `mingw`
|
|
||||||
* `msvc6`: Microsoft Visual Studio 6 service pack 5-6
|
|
||||||
* `msvc70`: Microsoft Visual Studio 2002
|
|
||||||
* `msvc71`: Microsoft Visual Studio 2003
|
|
||||||
* `msvc80`: Microsoft Visual Studio 2005
|
|
||||||
* `msvc90`: Microsoft Visual Studio 2008
|
|
||||||
* `linux-gcc`: Gnu C++ (linux, also reported to work for Mac OS X)
|
|
||||||
|
|
||||||
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
|
|
||||||
running SCons.
|
|
||||||
|
|
||||||
## 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
|
||||||
@@ -156,21 +76,16 @@ In the instructions below, replace `path/to/jsontest` with the path of the
|
|||||||
# You can run the tests using valgrind:
|
# You can run the tests using valgrind:
|
||||||
python rununittests.py --valgrind path/to/test_lib_json
|
python rununittests.py --valgrind path/to/test_lib_json
|
||||||
|
|
||||||
## Running the tests using scons
|
### Building the documentation
|
||||||
Note that tests can be run using SCons using the `check` target:
|
|
||||||
|
|
||||||
scons platform=$PLATFORM check
|
|
||||||
|
|
||||||
Building the documentation
|
|
||||||
--------------------------
|
|
||||||
Run the Python script `doxybuild.py` from the top directory:
|
Run the Python script `doxybuild.py` from the top directory:
|
||||||
|
|
||||||
python doxybuild.py --doxygen=$(which doxygen) --open --with-dot
|
python doxybuild.py --doxygen=$(which doxygen) --open --with-dot
|
||||||
|
|
||||||
See `doxybuild.py --help` for options.
|
See `doxybuild.py --help` for options.
|
||||||
|
|
||||||
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:
|
||||||
|
|
||||||
* a `TESTNAME.json` file, that contains the input document in JSON format.
|
* a `TESTNAME.json` file, that contains the input document in JSON format.
|
||||||
@@ -179,21 +94,19 @@ To add a test, you need to create two files in test/data:
|
|||||||
|
|
||||||
The `TESTNAME.expected` file format is as follows:
|
The `TESTNAME.expected` file format is as follows:
|
||||||
|
|
||||||
* each line represents a JSON element of the element tree represented by the
|
* Each line represents a JSON element of the element tree represented by the
|
||||||
input document.
|
input document.
|
||||||
* each line has two parts: the path to access the element separated from the
|
* Each line has two parts: the path to access the element separated from the
|
||||||
element value by `=`. Array and object values are always empty (i.e.
|
element value by `=`. Array and object values are always empty (i.e.
|
||||||
represented by either `[]` or `{}`).
|
represented by either `[]` or `{}`).
|
||||||
* element path: `.` represents the root element, and is used to separate object
|
* Element path `.` represents the root element, and is used to separate object
|
||||||
members. `[N]` is used to specify the value of an array element at index `N`.
|
members. `[N]` is used to specify the value of an array element at index `N`.
|
||||||
|
|
||||||
See the examples `test_complex_01.json` and `test_complex_01.expected` to better
|
See the examples `test_complex_01.json` and `test_complex_01.expected` to better understand element paths.
|
||||||
understand element paths.
|
|
||||||
|
|
||||||
Understanding reader/writer test output
|
### Understanding reader/writer test output
|
||||||
---------------------------------------
|
|
||||||
When a test is run, output files are generated beside the input test files.
|
When a test is run, output files are generated beside the input test files. Below is a short description of the content of each file:
|
||||||
Below is a short description of the content of each file:
|
|
||||||
|
|
||||||
* `test_complex_01.json`: input JSON document.
|
* `test_complex_01.json`: input JSON document.
|
||||||
* `test_complex_01.expected`: flattened JSON element tree used to check if
|
* `test_complex_01.expected`: flattened JSON element tree used to check if
|
||||||
@@ -208,7 +121,15 @@ Below is a short description of the content of each file:
|
|||||||
* `test_complex_01.process-output`: `jsontest` output, typically useful for
|
* `test_complex_01.process-output`: `jsontest` output, typically useful for
|
||||||
understanding parsing errors.
|
understanding parsing errors.
|
||||||
|
|
||||||
License
|
## Using JsonCpp in your project
|
||||||
-------
|
|
||||||
|
### Amalgamated source
|
||||||
|
https://github.com/open-source-parsers/jsoncpp/wiki/Amalgamated
|
||||||
|
|
||||||
|
### Other ways
|
||||||
|
If you have trouble, see the Wiki, or post a question as an Issue.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
See the `LICENSE` file for details. In summary, JsonCpp is licensed under the
|
See the `LICENSE` file for details. In summary, JsonCpp is licensed under the
|
||||||
MIT license, or public domain if desired and recognized in your jurisdiction.
|
MIT license, or public domain if desired and recognized in your jurisdiction.
|
||||||
|
248
SConstruct
248
SConstruct
@@ -1,248 +0,0 @@
|
|||||||
"""
|
|
||||||
Notes:
|
|
||||||
- shared library support is buggy: it assumes that a static and dynamic library can be build from the same object files. This is not true on many platforms. For this reason it is only enabled on linux-gcc at the current time.
|
|
||||||
|
|
||||||
To add a platform:
|
|
||||||
- add its name in options allowed_values below
|
|
||||||
- add tool initialization for this platform. Search for "if platform == 'suncc'" as an example.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
import os.path
|
|
||||||
import sys
|
|
||||||
|
|
||||||
JSONCPP_VERSION = open(File('#version').abspath,'rt').read().strip()
|
|
||||||
DIST_DIR = '#dist'
|
|
||||||
|
|
||||||
options = Variables()
|
|
||||||
options.Add( EnumVariable('platform',
|
|
||||||
'Platform (compiler/stl) used to build the project',
|
|
||||||
'msvc71',
|
|
||||||
allowed_values='suncc vacpp mingw msvc6 msvc7 msvc71 msvc80 msvc90 linux-gcc'.split(),
|
|
||||||
ignorecase=2) )
|
|
||||||
|
|
||||||
try:
|
|
||||||
platform = ARGUMENTS['platform']
|
|
||||||
if platform == 'linux-gcc':
|
|
||||||
CXX = 'g++' # not quite right, but env is not yet available.
|
|
||||||
import commands
|
|
||||||
version = commands.getoutput('%s -dumpversion' %CXX)
|
|
||||||
platform = 'linux-gcc-%s' %version
|
|
||||||
print "Using platform '%s'" %platform
|
|
||||||
LD_LIBRARY_PATH = os.environ.get('LD_LIBRARY_PATH', '')
|
|
||||||
LD_LIBRARY_PATH = "%s:libs/%s" %(LD_LIBRARY_PATH, platform)
|
|
||||||
os.environ['LD_LIBRARY_PATH'] = LD_LIBRARY_PATH
|
|
||||||
print "LD_LIBRARY_PATH =", LD_LIBRARY_PATH
|
|
||||||
except KeyError:
|
|
||||||
print 'You must specify a "platform"'
|
|
||||||
sys.exit(2)
|
|
||||||
|
|
||||||
print "Building using PLATFORM =", platform
|
|
||||||
|
|
||||||
rootbuild_dir = Dir('#buildscons')
|
|
||||||
build_dir = os.path.join( '#buildscons', platform )
|
|
||||||
bin_dir = os.path.join( '#bin', platform )
|
|
||||||
lib_dir = os.path.join( '#libs', platform )
|
|
||||||
sconsign_dir_path = Dir(build_dir).abspath
|
|
||||||
sconsign_path = os.path.join( sconsign_dir_path, '.sconsign.dbm' )
|
|
||||||
|
|
||||||
# Ensure build directory exist (SConsignFile fail otherwise!)
|
|
||||||
if not os.path.exists( sconsign_dir_path ):
|
|
||||||
os.makedirs( sconsign_dir_path )
|
|
||||||
|
|
||||||
# Store all dependencies signature in a database
|
|
||||||
SConsignFile( sconsign_path )
|
|
||||||
|
|
||||||
def make_environ_vars():
|
|
||||||
"""Returns a dictionnary with environment variable to use when compiling."""
|
|
||||||
# PATH is required to find the compiler
|
|
||||||
# TEMP is required for at least mingw
|
|
||||||
# LD_LIBRARY_PATH & co is required on some system for the compiler
|
|
||||||
vars = {}
|
|
||||||
for name in ('PATH', 'TEMP', 'TMP', 'LD_LIBRARY_PATH', 'LIBRARY_PATH'):
|
|
||||||
if name in os.environ:
|
|
||||||
vars[name] = os.environ[name]
|
|
||||||
return vars
|
|
||||||
|
|
||||||
|
|
||||||
env = Environment( ENV = make_environ_vars(),
|
|
||||||
toolpath = ['scons-tools'],
|
|
||||||
tools=[] ) #, tools=['default'] )
|
|
||||||
|
|
||||||
if platform == 'suncc':
|
|
||||||
env.Tool( 'sunc++' )
|
|
||||||
env.Tool( 'sunlink' )
|
|
||||||
env.Tool( 'sunar' )
|
|
||||||
env.Append( CCFLAGS = ['-mt'] )
|
|
||||||
elif platform == 'vacpp':
|
|
||||||
env.Tool( 'default' )
|
|
||||||
env.Tool( 'aixcc' )
|
|
||||||
env['CXX'] = 'xlC_r' #scons does not pick-up the correct one !
|
|
||||||
# using xlC_r ensure multi-threading is enabled:
|
|
||||||
# http://publib.boulder.ibm.com/infocenter/pseries/index.jsp?topic=/com.ibm.vacpp7a.doc/compiler/ref/cuselect.htm
|
|
||||||
env.Append( CCFLAGS = '-qrtti=all',
|
|
||||||
LINKFLAGS='-bh:5' ) # -bh:5 remove duplicate symbol warning
|
|
||||||
elif platform == 'msvc6':
|
|
||||||
env['MSVS_VERSION']='6.0'
|
|
||||||
for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
|
|
||||||
env.Tool( tool )
|
|
||||||
env['CXXFLAGS']='-GR -GX /nologo /MT'
|
|
||||||
elif platform == 'msvc70':
|
|
||||||
env['MSVS_VERSION']='7.0'
|
|
||||||
for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
|
|
||||||
env.Tool( tool )
|
|
||||||
env['CXXFLAGS']='-GR -GX /nologo /MT'
|
|
||||||
elif platform == 'msvc71':
|
|
||||||
env['MSVS_VERSION']='7.1'
|
|
||||||
for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
|
|
||||||
env.Tool( tool )
|
|
||||||
env['CXXFLAGS']='-GR -GX /nologo /MT'
|
|
||||||
elif platform == 'msvc80':
|
|
||||||
env['MSVS_VERSION']='8.0'
|
|
||||||
for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
|
|
||||||
env.Tool( tool )
|
|
||||||
env['CXXFLAGS']='-GR -EHsc /nologo /MT'
|
|
||||||
elif platform == 'msvc90':
|
|
||||||
env['MSVS_VERSION']='9.0'
|
|
||||||
# Scons 1.2 fails to detect the correct location of the platform SDK.
|
|
||||||
# So we propagate those from the environment. This requires that the
|
|
||||||
# user run vcvars32.bat before compiling.
|
|
||||||
if 'INCLUDE' in os.environ:
|
|
||||||
env['ENV']['INCLUDE'] = os.environ['INCLUDE']
|
|
||||||
if 'LIB' in os.environ:
|
|
||||||
env['ENV']['LIB'] = os.environ['LIB']
|
|
||||||
for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
|
|
||||||
env.Tool( tool )
|
|
||||||
env['CXXFLAGS']='-GR -EHsc /nologo /MT'
|
|
||||||
elif platform == 'mingw':
|
|
||||||
env.Tool( 'mingw' )
|
|
||||||
env.Append( CPPDEFINES=[ "WIN32", "NDEBUG", "_MT" ] )
|
|
||||||
elif platform.startswith('linux-gcc'):
|
|
||||||
env.Tool( 'default' )
|
|
||||||
env.Append( LIBS = ['pthread'], CCFLAGS = os.environ.get("CXXFLAGS", "-Wall"), LINKFLAGS=os.environ.get("LDFLAGS", "") )
|
|
||||||
env['SHARED_LIB_ENABLED'] = True
|
|
||||||
else:
|
|
||||||
print "UNSUPPORTED PLATFORM."
|
|
||||||
env.Exit(1)
|
|
||||||
|
|
||||||
env.Tool('targz')
|
|
||||||
env.Tool('srcdist')
|
|
||||||
env.Tool('globtool')
|
|
||||||
|
|
||||||
env.Append( CPPPATH = ['#include'],
|
|
||||||
LIBPATH = lib_dir )
|
|
||||||
short_platform = platform
|
|
||||||
if short_platform.startswith('msvc'):
|
|
||||||
short_platform = short_platform[2:]
|
|
||||||
# Notes: on Windows you need to rebuild the source for each variant
|
|
||||||
# Build script does not support that yet so we only build static libraries.
|
|
||||||
# This also fails on AIX because both dynamic and static library ends with
|
|
||||||
# extension .a.
|
|
||||||
env['SHARED_LIB_ENABLED'] = env.get('SHARED_LIB_ENABLED', False)
|
|
||||||
env['LIB_PLATFORM'] = short_platform
|
|
||||||
env['LIB_LINK_TYPE'] = 'lib' # static
|
|
||||||
env['LIB_CRUNTIME'] = 'mt'
|
|
||||||
env['LIB_NAME_SUFFIX'] = '${LIB_PLATFORM}_${LIB_LINK_TYPE}${LIB_CRUNTIME}' # must match autolink naming convention
|
|
||||||
env['JSONCPP_VERSION'] = JSONCPP_VERSION
|
|
||||||
env['BUILD_DIR'] = env.Dir(build_dir)
|
|
||||||
env['ROOTBUILD_DIR'] = env.Dir(rootbuild_dir)
|
|
||||||
env['DIST_DIR'] = DIST_DIR
|
|
||||||
if 'TarGz' in env['BUILDERS']:
|
|
||||||
class SrcDistAdder:
|
|
||||||
def __init__( self, env ):
|
|
||||||
self.env = env
|
|
||||||
def __call__( self, *args, **kw ):
|
|
||||||
apply( self.env.SrcDist, (self.env['SRCDIST_TARGET'],) + args, kw )
|
|
||||||
env['SRCDIST_BUILDER'] = env.TarGz
|
|
||||||
else: # If tarfile module is missing
|
|
||||||
class SrcDistAdder:
|
|
||||||
def __init__( self, env ):
|
|
||||||
pass
|
|
||||||
def __call__( self, *args, **kw ):
|
|
||||||
pass
|
|
||||||
env['SRCDIST_ADD'] = SrcDistAdder( env )
|
|
||||||
env['SRCDIST_TARGET'] = os.path.join( DIST_DIR, 'jsoncpp-src-%s.tar.gz' % env['JSONCPP_VERSION'] )
|
|
||||||
|
|
||||||
env_testing = env.Clone( )
|
|
||||||
env_testing.Append( LIBS = ['json_${LIB_NAME_SUFFIX}'] )
|
|
||||||
|
|
||||||
def buildJSONExample( env, target_sources, target_name ):
|
|
||||||
env = env.Clone()
|
|
||||||
env.Append( CPPPATH = ['#'] )
|
|
||||||
exe = env.Program( target=target_name,
|
|
||||||
source=target_sources )
|
|
||||||
env['SRCDIST_ADD']( source=[target_sources] )
|
|
||||||
global bin_dir
|
|
||||||
return env.Install( bin_dir, exe )
|
|
||||||
|
|
||||||
def buildJSONTests( env, target_sources, target_name ):
|
|
||||||
jsontests_node = buildJSONExample( env, target_sources, target_name )
|
|
||||||
check_alias_target = env.Alias( 'check', jsontests_node, RunJSONTests( jsontests_node, jsontests_node ) )
|
|
||||||
env.AlwaysBuild( check_alias_target )
|
|
||||||
|
|
||||||
def buildUnitTests( env, target_sources, target_name ):
|
|
||||||
jsontests_node = buildJSONExample( env, target_sources, target_name )
|
|
||||||
check_alias_target = env.Alias( 'check', jsontests_node,
|
|
||||||
RunUnitTests( jsontests_node, jsontests_node ) )
|
|
||||||
env.AlwaysBuild( check_alias_target )
|
|
||||||
|
|
||||||
def buildLibrary( env, target_sources, target_name ):
|
|
||||||
static_lib = env.StaticLibrary( target=target_name + '_${LIB_NAME_SUFFIX}',
|
|
||||||
source=target_sources )
|
|
||||||
global lib_dir
|
|
||||||
env.Install( lib_dir, static_lib )
|
|
||||||
if env['SHARED_LIB_ENABLED']:
|
|
||||||
shared_lib = env.SharedLibrary( target=target_name + '_${LIB_NAME_SUFFIX}',
|
|
||||||
source=target_sources )
|
|
||||||
env.Install( lib_dir, shared_lib )
|
|
||||||
env['SRCDIST_ADD']( source=[target_sources] )
|
|
||||||
|
|
||||||
Export( 'env env_testing buildJSONExample buildLibrary buildJSONTests buildUnitTests' )
|
|
||||||
|
|
||||||
def buildProjectInDirectory( target_directory ):
|
|
||||||
global build_dir
|
|
||||||
target_build_dir = os.path.join( build_dir, target_directory )
|
|
||||||
target = os.path.join( target_directory, 'sconscript' )
|
|
||||||
SConscript( target, build_dir=target_build_dir, duplicate=0 )
|
|
||||||
env['SRCDIST_ADD']( source=[target] )
|
|
||||||
|
|
||||||
|
|
||||||
def runJSONTests_action( target, source = None, env = None ):
|
|
||||||
# Add test scripts to python path
|
|
||||||
jsontest_path = Dir( '#test' ).abspath
|
|
||||||
sys.path.insert( 0, jsontest_path )
|
|
||||||
data_path = os.path.join( jsontest_path, 'data' )
|
|
||||||
import runjsontests
|
|
||||||
return runjsontests.runAllTests( os.path.abspath(source[0].path), data_path )
|
|
||||||
|
|
||||||
def runJSONTests_string( target, source = None, env = None ):
|
|
||||||
return 'RunJSONTests("%s")' % source[0]
|
|
||||||
|
|
||||||
import SCons.Action
|
|
||||||
ActionFactory = SCons.Action.ActionFactory
|
|
||||||
RunJSONTests = ActionFactory(runJSONTests_action, runJSONTests_string )
|
|
||||||
|
|
||||||
def runUnitTests_action( target, source = None, env = None ):
|
|
||||||
# Add test scripts to python path
|
|
||||||
jsontest_path = Dir( '#test' ).abspath
|
|
||||||
sys.path.insert( 0, jsontest_path )
|
|
||||||
import rununittests
|
|
||||||
return rununittests.runAllTests( os.path.abspath(source[0].path) )
|
|
||||||
|
|
||||||
def runUnitTests_string( target, source = None, env = None ):
|
|
||||||
return 'RunUnitTests("%s")' % source[0]
|
|
||||||
|
|
||||||
RunUnitTests = ActionFactory(runUnitTests_action, runUnitTests_string )
|
|
||||||
|
|
||||||
env.Alias( 'check' )
|
|
||||||
|
|
||||||
srcdist_cmd = env['SRCDIST_ADD']( source = """
|
|
||||||
AUTHORS README.md SConstruct
|
|
||||||
""".split() )
|
|
||||||
env.Alias( 'src-dist', srcdist_cmd )
|
|
||||||
|
|
||||||
buildProjectInDirectory( 'src/jsontestrunner' )
|
|
||||||
buildProjectInDirectory( 'src/lib_json' )
|
|
||||||
buildProjectInDirectory( 'src/test_lib_json' )
|
|
||||||
#print env.Dump()
|
|
||||||
|
|
@@ -1,9 +1,9 @@
|
|||||||
"""Amalgate json-cpp library sources into a single source and header file.
|
"""Amalgamate json-cpp library sources into a single source and header file.
|
||||||
|
|
||||||
Works with python2.6+ and python3.4+.
|
Works with python2.6+ and python3.4+.
|
||||||
|
|
||||||
Example of invocation (must be invoked from json-cpp top directory):
|
Example of invocation (must be invoked from json-cpp top directory):
|
||||||
python amalgate.py
|
python amalgamate.py
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
@@ -50,20 +50,20 @@ class AmalgamationFile:
|
|||||||
def amalgamate_source(source_top_dir=None,
|
def amalgamate_source(source_top_dir=None,
|
||||||
target_source_path=None,
|
target_source_path=None,
|
||||||
header_include_path=None):
|
header_include_path=None):
|
||||||
"""Produces amalgated source.
|
"""Produces amalgamated source.
|
||||||
Parameters:
|
Parameters:
|
||||||
source_top_dir: top-directory
|
source_top_dir: top-directory
|
||||||
target_source_path: output .cpp path
|
target_source_path: output .cpp path
|
||||||
header_include_path: generated header path relative to target_source_path.
|
header_include_path: generated header path relative to target_source_path.
|
||||||
"""
|
"""
|
||||||
print("Amalgating header...")
|
print("Amalgamating header...")
|
||||||
header = AmalgamationFile(source_top_dir)
|
header = AmalgamationFile(source_top_dir)
|
||||||
header.add_text("/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/).")
|
header.add_text("/// Json-cpp amalgamated header (http://jsoncpp.sourceforge.net/).")
|
||||||
header.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
|
header.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
|
||||||
header.add_file("LICENSE", wrap_in_comment=True)
|
header.add_file("LICENSE", wrap_in_comment=True)
|
||||||
header.add_text("#ifndef JSON_AMALGATED_H_INCLUDED")
|
header.add_text("#ifndef JSON_AMALGAMATED_H_INCLUDED")
|
||||||
header.add_text("# define JSON_AMALGATED_H_INCLUDED")
|
header.add_text("# define JSON_AMALGAMATED_H_INCLUDED")
|
||||||
header.add_text("/// If defined, indicates that the source file is amalgated")
|
header.add_text("/// If defined, indicates that the source file is amalgamated")
|
||||||
header.add_text("/// to prevent private header inclusion.")
|
header.add_text("/// to prevent private header inclusion.")
|
||||||
header.add_text("#define JSON_IS_AMALGAMATION")
|
header.add_text("#define JSON_IS_AMALGAMATION")
|
||||||
header.add_file("include/json/version.h")
|
header.add_file("include/json/version.h")
|
||||||
@@ -75,37 +75,37 @@ def amalgamate_source(source_top_dir=None,
|
|||||||
header.add_file("include/json/reader.h")
|
header.add_file("include/json/reader.h")
|
||||||
header.add_file("include/json/writer.h")
|
header.add_file("include/json/writer.h")
|
||||||
header.add_file("include/json/assertions.h")
|
header.add_file("include/json/assertions.h")
|
||||||
header.add_text("#endif //ifndef JSON_AMALGATED_H_INCLUDED")
|
header.add_text("#endif //ifndef JSON_AMALGAMATED_H_INCLUDED")
|
||||||
|
|
||||||
target_header_path = os.path.join(os.path.dirname(target_source_path), header_include_path)
|
target_header_path = os.path.join(os.path.dirname(target_source_path), header_include_path)
|
||||||
print("Writing amalgated header to %r" % target_header_path)
|
print("Writing amalgamated header to %r" % target_header_path)
|
||||||
header.write_to(target_header_path)
|
header.write_to(target_header_path)
|
||||||
|
|
||||||
base, ext = os.path.splitext(header_include_path)
|
base, ext = os.path.splitext(header_include_path)
|
||||||
forward_header_include_path = base + "-forwards" + ext
|
forward_header_include_path = base + "-forwards" + ext
|
||||||
print("Amalgating forward header...")
|
print("Amalgamating forward header...")
|
||||||
header = AmalgamationFile(source_top_dir)
|
header = AmalgamationFile(source_top_dir)
|
||||||
header.add_text("/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/).")
|
header.add_text("/// Json-cpp amalgamated forward header (http://jsoncpp.sourceforge.net/).")
|
||||||
header.add_text('/// It is intended to be used with #include "%s"' % forward_header_include_path)
|
header.add_text('/// It is intended to be used with #include "%s"' % forward_header_include_path)
|
||||||
header.add_text("/// This header provides forward declaration for all JsonCpp types.")
|
header.add_text("/// This header provides forward declaration for all JsonCpp types.")
|
||||||
header.add_file("LICENSE", wrap_in_comment=True)
|
header.add_file("LICENSE", wrap_in_comment=True)
|
||||||
header.add_text("#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED")
|
header.add_text("#ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED")
|
||||||
header.add_text("# define JSON_FORWARD_AMALGATED_H_INCLUDED")
|
header.add_text("# define JSON_FORWARD_AMALGAMATED_H_INCLUDED")
|
||||||
header.add_text("/// If defined, indicates that the source file is amalgated")
|
header.add_text("/// If defined, indicates that the source file is amalgamated")
|
||||||
header.add_text("/// to prevent private header inclusion.")
|
header.add_text("/// to prevent private header inclusion.")
|
||||||
header.add_text("#define JSON_IS_AMALGAMATION")
|
header.add_text("#define JSON_IS_AMALGAMATION")
|
||||||
header.add_file("include/json/config.h")
|
header.add_file("include/json/config.h")
|
||||||
header.add_file("include/json/forwards.h")
|
header.add_file("include/json/forwards.h")
|
||||||
header.add_text("#endif //ifndef JSON_FORWARD_AMALGATED_H_INCLUDED")
|
header.add_text("#endif //ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED")
|
||||||
|
|
||||||
target_forward_header_path = os.path.join(os.path.dirname(target_source_path),
|
target_forward_header_path = os.path.join(os.path.dirname(target_source_path),
|
||||||
forward_header_include_path)
|
forward_header_include_path)
|
||||||
print("Writing amalgated forward header to %r" % target_forward_header_path)
|
print("Writing amalgamated forward header to %r" % target_forward_header_path)
|
||||||
header.write_to(target_forward_header_path)
|
header.write_to(target_forward_header_path)
|
||||||
|
|
||||||
print("Amalgating source...")
|
print("Amalgamating source...")
|
||||||
source = AmalgamationFile(source_top_dir)
|
source = AmalgamationFile(source_top_dir)
|
||||||
source.add_text("/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/).")
|
source.add_text("/// Json-cpp amalgamated source (http://jsoncpp.sourceforge.net/).")
|
||||||
source.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
|
source.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
|
||||||
source.add_file("LICENSE", wrap_in_comment=True)
|
source.add_file("LICENSE", wrap_in_comment=True)
|
||||||
source.add_text("")
|
source.add_text("")
|
||||||
@@ -123,12 +123,12 @@ def amalgamate_source(source_top_dir=None,
|
|||||||
source.add_file(os.path.join(lib_json, "json_value.cpp"))
|
source.add_file(os.path.join(lib_json, "json_value.cpp"))
|
||||||
source.add_file(os.path.join(lib_json, "json_writer.cpp"))
|
source.add_file(os.path.join(lib_json, "json_writer.cpp"))
|
||||||
|
|
||||||
print("Writing amalgated source to %r" % target_source_path)
|
print("Writing amalgamated source to %r" % target_source_path)
|
||||||
source.write_to(target_source_path)
|
source.write_to(target_source_path)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
usage = """%prog [options]
|
usage = """%prog [options]
|
||||||
Generate a single amalgated source and header file from the sources.
|
Generate a single amalgamated source and header file from the sources.
|
||||||
"""
|
"""
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
parser = OptionParser(usage=usage)
|
parser = OptionParser(usage=usage)
|
||||||
@@ -136,7 +136,7 @@ Generate a single amalgated source and header file from the sources.
|
|||||||
parser.add_option("-s", "--source", dest="target_source_path", action="store", default="dist/jsoncpp.cpp",
|
parser.add_option("-s", "--source", dest="target_source_path", action="store", default="dist/jsoncpp.cpp",
|
||||||
help="""Output .cpp source path. [Default: %default]""")
|
help="""Output .cpp source path. [Default: %default]""")
|
||||||
parser.add_option("-i", "--include", dest="header_include_path", action="store", default="json/json.h",
|
parser.add_option("-i", "--include", dest="header_include_path", action="store", default="json/json.h",
|
||||||
help="""Header include path. Used to include the header from the amalgated source file. [Default: %default]""")
|
help="""Header include path. Used to include the header from the amalgamated source file. [Default: %default]""")
|
||||||
parser.add_option("-t", "--top-dir", dest="top_dir", action="store", default=os.getcwd(),
|
parser.add_option("-t", "--top-dir", dest="top_dir", action="store", default=os.getcwd(),
|
||||||
help="""Source top-directory. [Default: %default]""")
|
help="""Source top-directory. [Default: %default]""")
|
||||||
parser.enable_interspersed_args()
|
parser.enable_interspersed_args()
|
||||||
@@ -149,7 +149,7 @@ Generate a single amalgated source and header file from the sources.
|
|||||||
sys.stderr.write(msg + "\n")
|
sys.stderr.write(msg + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
print("Source succesfully amalagated")
|
print("Source successfully amalgamated")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
35
appveyor.yml
35
appveyor.yml
@@ -1,30 +1,17 @@
|
|||||||
# This is a comment.
|
|
||||||
|
|
||||||
version: build.{build}
|
|
||||||
|
|
||||||
os: Windows Server 2012 R2
|
|
||||||
|
|
||||||
clone_folder: c:\projects\jsoncpp
|
clone_folder: c:\projects\jsoncpp
|
||||||
|
|
||||||
platform:
|
environment:
|
||||||
- Win32
|
matrix:
|
||||||
- x64
|
- CMAKE_GENERATOR: Visual Studio 12 2013
|
||||||
|
- CMAKE_GENERATOR: Visual Studio 12 2013 Win64
|
||||||
|
- CMAKE_GENERATOR: Visual Studio 14 2015
|
||||||
|
- CMAKE_GENERATOR: Visual Studio 14 2015 Win64
|
||||||
|
|
||||||
configuration:
|
build_script:
|
||||||
- Debug
|
- cmake --version
|
||||||
- Release
|
- cd c:\projects\jsoncpp
|
||||||
|
- cmake -G "%CMAKE_GENERATOR%" -DCMAKE_INSTALL_PREFIX=%CD:\=/%/install -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON .
|
||||||
# scripts to run before build
|
- cmake --build . --config Release --target install
|
||||||
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:
|
deploy:
|
||||||
provider: GitHub
|
provider: GitHub
|
||||||
|
@@ -12,7 +12,7 @@ jsoncpp-%.tar.gz:
|
|||||||
curl https://github.com/open-source-parsers/jsoncpp/archive/$*.tar.gz -o $@
|
curl https://github.com/open-source-parsers/jsoncpp/archive/$*.tar.gz -o $@
|
||||||
dox:
|
dox:
|
||||||
python doxybuild.py --doxygen=$$(which doxygen) --in doc/web_doxyfile.in
|
python doxybuild.py --doxygen=$$(which doxygen) --in doc/web_doxyfile.in
|
||||||
rsync -va --delete dist/doxygen/jsoncpp-api-html-${VER}/ ../jsoncpp-docs/doxygen/
|
rsync -va -c --delete dist/doxygen/jsoncpp-api-html-${VER}/ ../jsoncpp-docs/doxygen/
|
||||||
# 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
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2010 Baptiste Lepilleur
|
# Copyright 2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
# Distributed under MIT license, or public domain if desired and
|
# Distributed under MIT license, or public domain if desired and
|
||||||
# recognized in your jurisdiction.
|
# recognized in your jurisdiction.
|
||||||
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
# Copyright 2009 Baptiste Lepilleur
|
# Copyright 2009 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
# Distributed under MIT license, or public domain if desired and
|
# Distributed under MIT license, or public domain if desired and
|
||||||
# recognized in your jurisdiction.
|
# recognized in your jurisdiction.
|
||||||
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2010 Baptiste Lepilleur
|
# Copyright 2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
# Distributed under MIT license, or public domain if desired and
|
# Distributed under MIT license, or public domain if desired and
|
||||||
# recognized in your jurisdiction.
|
# recognized in your jurisdiction.
|
||||||
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -6,7 +6,7 @@ from __future__ import print_function
|
|||||||
# and ends with the first blank line.
|
# and ends with the first blank line.
|
||||||
LICENSE_BEGIN = "// Copyright "
|
LICENSE_BEGIN = "// Copyright "
|
||||||
|
|
||||||
BRIEF_LICENSE = LICENSE_BEGIN + """2007-2010 Baptiste Lepilleur
|
BRIEF_LICENSE = LICENSE_BEGIN + """2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2010 Baptiste Lepilleur
|
# Copyright 2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
# Distributed under MIT license, or public domain if desired and
|
# Distributed under MIT license, or public domain if desired and
|
||||||
# recognized in your jurisdiction.
|
# recognized in your jurisdiction.
|
||||||
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -271,7 +271,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
|
|||||||
# parses. With this tag you can assign which parser to use for a given
|
# parses. With this tag you can assign which parser to use for a given
|
||||||
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
||||||
# using this tag. The format is ext=language, where ext is a file extension, and
|
# using this tag. The format is ext=language, where ext is a file extension, and
|
||||||
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
|
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
|
||||||
# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
|
# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
|
||||||
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
|
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
|
||||||
# (default is Fortran), use: inc=Fortran f=C.
|
# (default is Fortran), use: inc=Fortran f=C.
|
||||||
@@ -984,7 +984,8 @@ VERBATIM_HEADERS = YES
|
|||||||
# classes, structs, unions or interfaces.
|
# classes, structs, unions or interfaces.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
ALPHABETICAL_INDEX = NO
|
ALPHABETICAL_INDEX = YES
|
||||||
|
TOC_INCLUDE_HEADINGS = 2
|
||||||
|
|
||||||
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
|
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
|
||||||
# which the alphabetical index list will be split.
|
# which the alphabetical index list will be split.
|
||||||
@@ -1407,7 +1408,7 @@ FORMULA_FONTSIZE = 10
|
|||||||
FORMULA_TRANSPARENT = YES
|
FORMULA_TRANSPARENT = YES
|
||||||
|
|
||||||
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
|
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
|
||||||
# http://www.mathjax.org) which uses client side Javascript for the rendering
|
# http://www.mathjax.org) which uses client side JavaScript for the rendering
|
||||||
# instead of using prerendered bitmaps. Use this if you do not have LaTeX
|
# instead of using prerendered bitmaps. Use this if you do not have LaTeX
|
||||||
# installed or if you want to formulas look prettier in the HTML output. When
|
# installed or if you want to formulas look prettier in the HTML output. When
|
||||||
# enabled you may also need to install MathJax separately and configure the path
|
# enabled you may also need to install MathJax separately and configure the path
|
||||||
@@ -1477,7 +1478,7 @@ MATHJAX_CODEFILE =
|
|||||||
SEARCHENGINE = NO
|
SEARCHENGINE = NO
|
||||||
|
|
||||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||||
# implemented using a web server instead of a web client using Javascript. There
|
# implemented using a web server instead of a web client using JavaScript. There
|
||||||
# are two flavours of web server based searching depending on the
|
# are two flavours of web server based searching depending on the
|
||||||
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
|
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
|
||||||
# searching and an index file used by the script. When EXTERNAL_SEARCH is
|
# searching and an index file used by the script. When EXTERNAL_SEARCH is
|
||||||
@@ -1958,7 +1959,7 @@ PREDEFINED = "_MSC_VER=1400" \
|
|||||||
EXPAND_AS_DEFINED =
|
EXPAND_AS_DEFINED =
|
||||||
|
|
||||||
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
|
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
|
||||||
# remove all refrences to function-like macros that are alone on a line, have an
|
# remove all references to function-like macros that are alone on a line, have an
|
||||||
# all uppercase name, and do not end with a semicolon. Such function macros are
|
# all uppercase name, and do not end with a semicolon. Such function macros are
|
||||||
# typically used for boiler-plate code, and will confuse the parser if not
|
# typically used for boiler-plate code, and will confuse the parser if not
|
||||||
# removed.
|
# removed.
|
||||||
|
@@ -1,3 +1,21 @@
|
|||||||
<hr>
|
<!-- HTML footer for doxygen 1.8.13-->
|
||||||
|
<!-- start footer part -->
|
||||||
|
<!--BEGIN GENERATE_TREEVIEW-->
|
||||||
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||||
|
<ul>
|
||||||
|
$navpath
|
||||||
|
<li class="footer">$generatedby
|
||||||
|
<a href="http://www.doxygen.org/index.html">
|
||||||
|
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!--END GENERATE_TREEVIEW-->
|
||||||
|
<!--BEGIN !GENERATE_TREEVIEW-->
|
||||||
|
<hr class="footer"/><address class="footer"><small>
|
||||||
|
$generatedby  <a href="http://www.doxygen.org/index.html">
|
||||||
|
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/>
|
||||||
|
</a> $doxygenversion
|
||||||
|
</small></address>
|
||||||
|
<!--END !GENERATE_TREEVIEW-->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -1,24 +1,64 @@
|
|||||||
<html>
|
<!-- HTML header for doxygen 1.8.13-->
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<title>
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||||
JsonCpp - JSON data format manipulation library
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||||
</title>
|
<meta name="generator" content="Doxygen $doxygenversion"/>
|
||||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
<link href="tabs.css" rel="stylesheet" type="text/css">
|
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
|
||||||
|
<script type="text/javascript" src="$relpath^jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="$relpath^dynsections.js"></script>
|
||||||
|
$treeview
|
||||||
|
$search
|
||||||
|
$mathjax
|
||||||
|
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
|
||||||
|
$extrastylesheet
|
||||||
</head>
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||||
|
|
||||||
|
<!--BEGIN TITLEAREA-->
|
||||||
|
<div id="titlearea">
|
||||||
|
<table cellspacing="0" cellpadding="0">
|
||||||
|
<tbody>
|
||||||
|
<tr style="height: 56px;">
|
||||||
|
<!--BEGIN PROJECT_LOGO-->
|
||||||
|
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
|
||||||
|
<!--END PROJECT_LOGO-->
|
||||||
|
<!--BEGIN DISABLE_INDEX-->
|
||||||
|
<!--BEGIN SEARCHENGINE-->
|
||||||
|
<td>$searchbox</td>
|
||||||
|
<!--END SEARCHENGINE-->
|
||||||
|
<!--END DISABLE_INDEX-->
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<!--END TITLEAREA-->
|
||||||
<body bgcolor="#ffffff">
|
<body bgcolor="#ffffff">
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td width="40%" align="left" valign="center">
|
<td width="30%" align="left" valign="center">
|
||||||
<a href="https://github.com/open-source-parsers/jsoncpp">
|
<a href="https://github.com/open-source-parsers/jsoncpp">
|
||||||
JsonCpp project page
|
JsonCpp project page
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td width="40%" align="right" valign="center">
|
<td width="20%" align="center" valign="center">
|
||||||
|
<a href="hierarchy.html">
|
||||||
|
Classes
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td width="20%" align="center" valign="center">
|
||||||
|
<a href="namespace_json.html">
|
||||||
|
Namespace
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td width="30%" align="right" valign="center">
|
||||||
<a href="http://open-source-parsers.github.io/jsoncpp-docs/doxygen/">JsonCpp home page</a>
|
<a href="http://open-source-parsers.github.io/jsoncpp-docs/doxygen/">JsonCpp home page</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
<!-- end header part -->
|
||||||
|
@@ -44,7 +44,7 @@ PROJECT_NUMBER = %JSONCPP_VERSION%
|
|||||||
# for a project that appears at the top of each page and should give viewer a
|
# for a project that appears at the top of each page and should give viewer a
|
||||||
# quick idea about the purpose of the project. Keep the description short.
|
# quick idea about the purpose of the project. Keep the description short.
|
||||||
|
|
||||||
PROJECT_BRIEF =
|
PROJECT_BRIEF = "JSON data format manipulation library"
|
||||||
|
|
||||||
# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
|
# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
|
||||||
# the documentation. The maximum height of the logo should not exceed 55 pixels
|
# the documentation. The maximum height of the logo should not exceed 55 pixels
|
||||||
@@ -271,7 +271,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
|
|||||||
# parses. With this tag you can assign which parser to use for a given
|
# parses. With this tag you can assign which parser to use for a given
|
||||||
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
||||||
# using this tag. The format is ext=language, where ext is a file extension, and
|
# using this tag. The format is ext=language, where ext is a file extension, and
|
||||||
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
|
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
|
||||||
# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
|
# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
|
||||||
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
|
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
|
||||||
# (default is Fortran), use: inc=Fortran f=C.
|
# (default is Fortran), use: inc=Fortran f=C.
|
||||||
@@ -984,7 +984,8 @@ VERBATIM_HEADERS = NO
|
|||||||
# classes, structs, unions or interfaces.
|
# classes, structs, unions or interfaces.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
ALPHABETICAL_INDEX = NO
|
ALPHABETICAL_INDEX = YES
|
||||||
|
TOC_INCLUDE_HEADINGS = 2
|
||||||
|
|
||||||
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
|
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
|
||||||
# which the alphabetical index list will be split.
|
# which the alphabetical index list will be split.
|
||||||
@@ -1124,7 +1125,7 @@ HTML_COLORSTYLE_GAMMA = 80
|
|||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
HTML_TIMESTAMP = YES
|
HTML_TIMESTAMP = NO
|
||||||
|
|
||||||
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
|
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
|
||||||
# documentation will contain sections that can be hidden and shown after the
|
# documentation will contain sections that can be hidden and shown after the
|
||||||
@@ -1360,7 +1361,7 @@ DISABLE_INDEX = NO
|
|||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
GENERATE_TREEVIEW = NO
|
GENERATE_TREEVIEW = YES
|
||||||
|
|
||||||
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
|
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
|
||||||
# doxygen will group on one line in the generated HTML documentation.
|
# doxygen will group on one line in the generated HTML documentation.
|
||||||
@@ -1407,7 +1408,7 @@ FORMULA_FONTSIZE = 10
|
|||||||
FORMULA_TRANSPARENT = YES
|
FORMULA_TRANSPARENT = YES
|
||||||
|
|
||||||
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
|
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
|
||||||
# http://www.mathjax.org) which uses client side Javascript for the rendering
|
# http://www.mathjax.org) which uses client side JavaScript for the rendering
|
||||||
# instead of using prerendered bitmaps. Use this if you do not have LaTeX
|
# instead of using prerendered bitmaps. Use this if you do not have LaTeX
|
||||||
# installed or if you want to formulas look prettier in the HTML output. When
|
# installed or if you want to formulas look prettier in the HTML output. When
|
||||||
# enabled you may also need to install MathJax separately and configure the path
|
# enabled you may also need to install MathJax separately and configure the path
|
||||||
@@ -1477,7 +1478,7 @@ MATHJAX_CODEFILE =
|
|||||||
SEARCHENGINE = NO
|
SEARCHENGINE = NO
|
||||||
|
|
||||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||||
# implemented using a web server instead of a web client using Javascript. There
|
# implemented using a web server instead of a web client using JavaScript. There
|
||||||
# are two flavours of web server based searching depending on the
|
# are two flavours of web server based searching depending on the
|
||||||
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
|
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
|
||||||
# searching and an index file used by the script. When EXTERNAL_SEARCH is
|
# searching and an index file used by the script. When EXTERNAL_SEARCH is
|
||||||
@@ -1797,18 +1798,6 @@ GENERATE_XML = NO
|
|||||||
|
|
||||||
XML_OUTPUT = xml
|
XML_OUTPUT = xml
|
||||||
|
|
||||||
# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
|
|
||||||
# validating XML parser to check the syntax of the XML files.
|
|
||||||
# This tag requires that the tag GENERATE_XML is set to YES.
|
|
||||||
|
|
||||||
XML_SCHEMA =
|
|
||||||
|
|
||||||
# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
|
|
||||||
# validating XML parser to check the syntax of the XML files.
|
|
||||||
# This tag requires that the tag GENERATE_XML is set to YES.
|
|
||||||
|
|
||||||
XML_DTD =
|
|
||||||
|
|
||||||
# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
|
# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
|
||||||
# listings (including syntax highlighting and cross-referencing information) to
|
# listings (including syntax highlighting and cross-referencing information) to
|
||||||
# the XML output. Note that enabling this will significantly increase the size
|
# the XML output. Note that enabling this will significantly increase the size
|
||||||
@@ -1958,7 +1947,7 @@ PREDEFINED = "_MSC_VER=1400" \
|
|||||||
EXPAND_AS_DEFINED =
|
EXPAND_AS_DEFINED =
|
||||||
|
|
||||||
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
|
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
|
||||||
# remove all refrences to function-like macros that are alone on a line, have an
|
# remove all references to function-like macros that are alone on a line, have an
|
||||||
# all uppercase name, and do not end with a semicolon. Such function macros are
|
# all uppercase name, and do not end with a semicolon. Such function macros are
|
||||||
# typically used for boiler-plate code, and will confuse the parser if not
|
# typically used for boiler-plate code, and will confuse the parser if not
|
||||||
# removed.
|
# removed.
|
||||||
|
@@ -156,7 +156,7 @@ def build_doc(options, make_release=False):
|
|||||||
def main():
|
def main():
|
||||||
usage = """%prog
|
usage = """%prog
|
||||||
Generates doxygen documentation in build/doxygen.
|
Generates doxygen documentation in build/doxygen.
|
||||||
Optionaly makes a tarball of the documentation to dist/.
|
Optionally makes a tarball of the documentation to dist/.
|
||||||
|
|
||||||
Must be started in the project top directory.
|
Must be started in the project top directory.
|
||||||
"""
|
"""
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
FILE(GLOB INCLUDE_FILES "json/*.h")
|
FILE(GLOB INCLUDE_FILES "json/*.h")
|
||||||
INSTALL(FILES ${INCLUDE_FILES} DESTINATION ${INCLUDE_INSTALL_DIR}/json)
|
INSTALL(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/json)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#pragma pack(push, 8)
|
||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class SecureAllocator {
|
class SecureAllocator {
|
||||||
@@ -91,4 +93,6 @@ bool operator!=(const SecureAllocator<T>&, const SecureAllocator<U>&) {
|
|||||||
|
|
||||||
} //namespace Json
|
} //namespace Json
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
#endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED
|
#endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
@@ -6,7 +6,8 @@
|
|||||||
#ifndef JSON_CONFIG_H_INCLUDED
|
#ifndef JSON_CONFIG_H_INCLUDED
|
||||||
#define JSON_CONFIG_H_INCLUDED
|
#define JSON_CONFIG_H_INCLUDED
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string> //typdef String
|
#include <string> //typedef String
|
||||||
|
#include <stdint.h> //typedef int64_t, uint64_t
|
||||||
|
|
||||||
/// If defined, indicates that json library is embedded in CppTL library.
|
/// If defined, indicates that json library is embedded in CppTL library.
|
||||||
//# define JSON_IN_CPPTL 1
|
//# define JSON_IN_CPPTL 1
|
||||||
@@ -24,9 +25,9 @@
|
|||||||
#define JSON_USE_EXCEPTION 1
|
#define JSON_USE_EXCEPTION 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// If defined, indicates that the source file is amalgated
|
/// If defined, indicates that the source file is amalgamated
|
||||||
/// to prevent private header inclusion.
|
/// to prevent private header inclusion.
|
||||||
/// Remarks: it is automatically defined in the generated amalgated header.
|
/// Remarks: it is automatically defined in the generated amalgamated header.
|
||||||
// #define JSON_IS_AMALGAMATION
|
// #define JSON_IS_AMALGAMATION
|
||||||
|
|
||||||
#ifdef JSON_IN_CPPTL
|
#ifdef JSON_IN_CPPTL
|
||||||
@@ -77,15 +78,21 @@
|
|||||||
|
|
||||||
#endif // defined(_MSC_VER)
|
#endif // defined(_MSC_VER)
|
||||||
|
|
||||||
// In c++11 the override keyword allows you to explicity define that a function
|
// In c++11 the override keyword allows you to explicitly define that a function
|
||||||
// is intended to override the base-class version. This makes the code more
|
// is intended to override the base-class version. This makes the code more
|
||||||
// managable and fixes a set of common hard-to-find bugs.
|
// managable and fixes a set of common hard-to-find bugs.
|
||||||
#if __cplusplus >= 201103L
|
#if __cplusplus >= 201103L
|
||||||
# define JSONCPP_OVERRIDE override
|
# define JSONCPP_OVERRIDE override
|
||||||
#elif defined(_MSC_VER) && _MSC_VER > 1600
|
# define JSONCPP_NOEXCEPT noexcept
|
||||||
|
#elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900
|
||||||
# define JSONCPP_OVERRIDE override
|
# define JSONCPP_OVERRIDE override
|
||||||
|
# define JSONCPP_NOEXCEPT throw()
|
||||||
|
#elif defined(_MSC_VER) && _MSC_VER >= 1900
|
||||||
|
# define JSONCPP_OVERRIDE override
|
||||||
|
# define JSONCPP_NOEXCEPT noexcept
|
||||||
#else
|
#else
|
||||||
# define JSONCPP_OVERRIDE
|
# define JSONCPP_OVERRIDE
|
||||||
|
# define JSONCPP_NOEXCEPT throw()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef JSON_HAS_RVALUE_REFERENCES
|
#ifndef JSON_HAS_RVALUE_REFERENCES
|
||||||
@@ -113,6 +120,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
|
# if __has_extension(attribute_deprecated_with_message)
|
||||||
|
# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
|
||||||
|
# endif
|
||||||
#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
|
#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
|
||||||
# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
|
# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
|
||||||
# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
|
# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
@@ -10,6 +10,8 @@
|
|||||||
#include "forwards.h"
|
#include "forwards.h"
|
||||||
#endif // if !defined(JSON_IS_AMALGAMATION)
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
||||||
|
|
||||||
|
#pragma pack(push, 8)
|
||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
/** \brief Configuration passed to reader and writer.
|
/** \brief Configuration passed to reader and writer.
|
||||||
@@ -54,4 +56,6 @@ public:
|
|||||||
|
|
||||||
} // namespace Json
|
} // namespace Json
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
#endif // CPPTL_JSON_FEATURES_H_INCLUDED
|
#endif // CPPTL_JSON_FEATURES_H_INCLUDED
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
@@ -23,6 +23,8 @@
|
|||||||
#pragma warning(disable : 4251)
|
#pragma warning(disable : 4251)
|
||||||
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
|
||||||
|
#pragma pack(push, 8)
|
||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a
|
/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a
|
||||||
@@ -30,7 +32,7 @@ namespace Json {
|
|||||||
*
|
*
|
||||||
* \deprecated Use CharReader and CharReaderBuilder.
|
* \deprecated Use CharReader and CharReaderBuilder.
|
||||||
*/
|
*/
|
||||||
class JSON_API Reader {
|
class JSONCPP_DEPRECATED("Use CharReader and CharReaderBuilder instead") JSON_API Reader {
|
||||||
public:
|
public:
|
||||||
typedef char Char;
|
typedef char Char;
|
||||||
typedef const Char* Location;
|
typedef const Char* Location;
|
||||||
@@ -228,6 +230,9 @@ private:
|
|||||||
void addComment(Location begin, Location end, CommentPlacement placement);
|
void addComment(Location begin, Location end, CommentPlacement placement);
|
||||||
void skipCommentTokens(Token& token);
|
void skipCommentTokens(Token& token);
|
||||||
|
|
||||||
|
static bool containsNewLine(Location begin, Location end);
|
||||||
|
static JSONCPP_STRING normalizeEOL(Location begin, Location end);
|
||||||
|
|
||||||
typedef std::stack<Value*> Nodes;
|
typedef std::stack<Value*> Nodes;
|
||||||
Nodes nodes_;
|
Nodes nodes_;
|
||||||
Errors errors_;
|
Errors errors_;
|
||||||
@@ -397,6 +402,8 @@ JSON_API JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM&, Value&);
|
|||||||
|
|
||||||
} // namespace Json
|
} // namespace Json
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
@@ -42,6 +42,8 @@
|
|||||||
#pragma warning(disable : 4251)
|
#pragma warning(disable : 4251)
|
||||||
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
|
||||||
|
#pragma pack(push, 8)
|
||||||
|
|
||||||
/** \brief JSON (JavaScript Object Notation).
|
/** \brief JSON (JavaScript Object Notation).
|
||||||
*/
|
*/
|
||||||
namespace Json {
|
namespace Json {
|
||||||
@@ -53,8 +55,8 @@ namespace Json {
|
|||||||
class JSON_API Exception : public std::exception {
|
class JSON_API Exception : public std::exception {
|
||||||
public:
|
public:
|
||||||
Exception(JSONCPP_STRING const& msg);
|
Exception(JSONCPP_STRING const& msg);
|
||||||
~Exception() throw() JSONCPP_OVERRIDE;
|
~Exception() JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
|
||||||
char const* what() const throw() JSONCPP_OVERRIDE;
|
char const* what() const JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
JSONCPP_STRING msg_;
|
JSONCPP_STRING msg_;
|
||||||
};
|
};
|
||||||
@@ -114,7 +116,7 @@ enum CommentPlacement {
|
|||||||
|
|
||||||
/** \brief Lightweight wrapper to tag static string.
|
/** \brief Lightweight wrapper to tag static string.
|
||||||
*
|
*
|
||||||
* Value constructor and objectValue member assignement takes advantage of the
|
* Value constructor and objectValue member assignment takes advantage of the
|
||||||
* StaticString and avoid the cost of string duplication when storing the
|
* StaticString and avoid the cost of string duplication when storing the
|
||||||
* string or the member name.
|
* string or the member name.
|
||||||
*
|
*
|
||||||
@@ -188,6 +190,9 @@ public:
|
|||||||
typedef Json::LargestUInt LargestUInt;
|
typedef Json::LargestUInt LargestUInt;
|
||||||
typedef Json::ArrayIndex ArrayIndex;
|
typedef Json::ArrayIndex ArrayIndex;
|
||||||
|
|
||||||
|
// Required for boost integration, e. g. BOOST_TEST
|
||||||
|
typedef std::string value_type;
|
||||||
|
|
||||||
static const Value& null; ///< We regret this reference to a global instance; prefer the simpler Value().
|
static const Value& null; ///< We regret this reference to a global instance; prefer the simpler Value().
|
||||||
static const Value& nullRef; ///< just a kludge for binary-compatibility; same as null
|
static const Value& nullRef; ///< just a kludge for binary-compatibility; same as null
|
||||||
static Value const& nullSingleton(); ///< Prefer this to null or nullRef.
|
static Value const& nullSingleton(); ///< Prefer this to null or nullRef.
|
||||||
@@ -231,7 +236,12 @@ private:
|
|||||||
CZString(CZString&& other);
|
CZString(CZString&& other);
|
||||||
#endif
|
#endif
|
||||||
~CZString();
|
~CZString();
|
||||||
CZString& operator=(CZString other);
|
CZString& operator=(const CZString& other);
|
||||||
|
|
||||||
|
#if JSON_HAS_RVALUE_REFERENCES
|
||||||
|
CZString& operator=(CZString&& other);
|
||||||
|
#endif
|
||||||
|
|
||||||
bool operator<(CZString const& other) const;
|
bool operator<(CZString const& other) const;
|
||||||
bool operator==(CZString const& other) const;
|
bool operator==(CZString const& other) const;
|
||||||
ArrayIndex index() const;
|
ArrayIndex index() const;
|
||||||
@@ -321,11 +331,17 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
/// Deep copy, then swap(other).
|
/// Deep copy, then swap(other).
|
||||||
/// \note Over-write existing comments. To preserve comments, use #swapPayload().
|
/// \note Over-write existing comments. To preserve comments, use #swapPayload().
|
||||||
Value& operator=(Value other);
|
Value& operator=(Value other);
|
||||||
|
|
||||||
/// Swap everything.
|
/// Swap everything.
|
||||||
void swap(Value& other);
|
void swap(Value& other);
|
||||||
/// Swap values but leave comments and source offsets in place.
|
/// Swap values but leave comments and source offsets in place.
|
||||||
void swapPayload(Value& other);
|
void swapPayload(Value& other);
|
||||||
|
|
||||||
|
/// copy everything.
|
||||||
|
void copy(const Value& other);
|
||||||
|
/// copy values but leave comments and source offsets in place.
|
||||||
|
void copyPayload(const Value& other);
|
||||||
|
|
||||||
ValueType type() const;
|
ValueType type() const;
|
||||||
|
|
||||||
/// Compare payload only, not comments etc.
|
/// Compare payload only, not comments etc.
|
||||||
@@ -384,8 +400,8 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
/// otherwise, false.
|
/// otherwise, false.
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
|
|
||||||
/// Return isNull()
|
/// Return !isNull()
|
||||||
bool operator!() const;
|
explicit operator bool() const;
|
||||||
|
|
||||||
/// Remove all object members and array elements.
|
/// Remove all object members and array elements.
|
||||||
/// \pre type() is arrayValue, objectValue, or nullValue
|
/// \pre type() is arrayValue, objectValue, or nullValue
|
||||||
@@ -436,6 +452,10 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
/// Equivalent to jsonvalue[jsonvalue.size()] = value;
|
/// Equivalent to jsonvalue[jsonvalue.size()] = value;
|
||||||
Value& append(const Value& value);
|
Value& append(const Value& value);
|
||||||
|
|
||||||
|
#if JSON_HAS_RVALUE_REFERENCES
|
||||||
|
Value& append(Value&& value);
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Access an object value by name, create a null member if it does not exist.
|
/// Access an object value by name, create a null member if it does not exist.
|
||||||
/// \note Because of our implementation, keys are limited to 2^30 -1 chars.
|
/// \note Because of our implementation, keys are limited to 2^30 -1 chars.
|
||||||
/// Exceeding that will cause an exception.
|
/// Exceeding that will cause an exception.
|
||||||
@@ -501,11 +521,11 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
/// \pre type() is objectValue or nullValue
|
/// \pre type() is objectValue or nullValue
|
||||||
/// \post type() is unchanged
|
/// \post type() is unchanged
|
||||||
/// \deprecated
|
/// \deprecated
|
||||||
Value removeMember(const char* key);
|
void removeMember(const char* key);
|
||||||
/// Same as removeMember(const char*)
|
/// Same as removeMember(const char*)
|
||||||
/// \param key may contain embedded nulls.
|
/// \param key may contain embedded nulls.
|
||||||
/// \deprecated
|
/// \deprecated
|
||||||
Value removeMember(const JSONCPP_STRING& key);
|
void removeMember(const JSONCPP_STRING& key);
|
||||||
/// Same as removeMember(const char* begin, 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);
|
||||||
@@ -859,6 +879,7 @@ template<>
|
|||||||
inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); }
|
inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
@@ -3,10 +3,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 "1.7.5"
|
# define JSONCPP_VERSION_STRING "1.8.4"
|
||||||
# define JSONCPP_VERSION_MAJOR 1
|
# define JSONCPP_VERSION_MAJOR 1
|
||||||
# define JSONCPP_VERSION_MINOR 7
|
# define JSONCPP_VERSION_MINOR 8
|
||||||
# define JSONCPP_VERSION_PATCH 5
|
# define JSONCPP_VERSION_PATCH 4
|
||||||
# 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,4 +1,4 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
@@ -15,11 +15,13 @@
|
|||||||
|
|
||||||
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
|
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
|
||||||
// be used by...
|
// be used by...
|
||||||
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) && defined(_MSC_VER)
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4251)
|
#pragma warning(disable : 4251)
|
||||||
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
|
||||||
|
#pragma pack(push, 8)
|
||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
class Value;
|
class Value;
|
||||||
@@ -97,7 +99,7 @@ public:
|
|||||||
- "dropNullPlaceholders": false or true
|
- "dropNullPlaceholders": false or true
|
||||||
- Drop the "null" string from the writer's output for nullValues.
|
- Drop the "null" string from the writer's output for nullValues.
|
||||||
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
|
- "useSpecialFloats": false or true
|
||||||
- If true, outputs non-finite floating point values in the following way:
|
- If true, outputs non-finite floating point values in the following way:
|
||||||
@@ -138,7 +140,7 @@ public:
|
|||||||
/** \brief Abstract class for writers.
|
/** \brief Abstract class for writers.
|
||||||
* \deprecated Use StreamWriter. (And really, this is an implementation detail.)
|
* \deprecated Use StreamWriter. (And really, this is an implementation detail.)
|
||||||
*/
|
*/
|
||||||
class JSON_API Writer {
|
class JSONCPP_DEPRECATED("Use StreamWriter instead") JSON_API Writer {
|
||||||
public:
|
public:
|
||||||
virtual ~Writer();
|
virtual ~Writer();
|
||||||
|
|
||||||
@@ -154,8 +156,11 @@ public:
|
|||||||
* \sa Reader, Value
|
* \sa Reader, Value
|
||||||
* \deprecated Use StreamWriterBuilder.
|
* \deprecated Use StreamWriterBuilder.
|
||||||
*/
|
*/
|
||||||
class JSON_API FastWriter : public Writer {
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4996) // Deriving from deprecated class
|
||||||
|
#endif
|
||||||
|
class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter : public Writer {
|
||||||
public:
|
public:
|
||||||
FastWriter();
|
FastWriter();
|
||||||
~FastWriter() JSONCPP_OVERRIDE {}
|
~FastWriter() JSONCPP_OVERRIDE {}
|
||||||
@@ -164,7 +169,7 @@ public:
|
|||||||
|
|
||||||
/** \brief Drop the "null" string from the writer's output for nullValues.
|
/** \brief Drop the "null" string from the writer's output for nullValues.
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
void dropNullPlaceholders();
|
void dropNullPlaceholders();
|
||||||
@@ -178,10 +183,13 @@ private:
|
|||||||
void writeValue(const Value& value);
|
void writeValue(const Value& value);
|
||||||
|
|
||||||
JSONCPP_STRING document_;
|
JSONCPP_STRING document_;
|
||||||
bool yamlCompatiblityEnabled_;
|
bool yamlCompatibilityEnabled_;
|
||||||
bool dropNullPlaceholders_;
|
bool dropNullPlaceholders_;
|
||||||
bool omitEndingLineFeed_;
|
bool omitEndingLineFeed_;
|
||||||
};
|
};
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
|
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
|
||||||
*human friendly way.
|
*human friendly way.
|
||||||
@@ -207,7 +215,11 @@ private:
|
|||||||
* \sa Reader, Value, Value::setComment()
|
* \sa Reader, Value, Value::setComment()
|
||||||
* \deprecated Use StreamWriterBuilder.
|
* \deprecated Use StreamWriterBuilder.
|
||||||
*/
|
*/
|
||||||
class JSON_API StyledWriter : public Writer {
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4996) // Deriving from deprecated class
|
||||||
|
#endif
|
||||||
|
class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API StyledWriter : public Writer {
|
||||||
public:
|
public:
|
||||||
StyledWriter();
|
StyledWriter();
|
||||||
~StyledWriter() JSONCPP_OVERRIDE {}
|
~StyledWriter() JSONCPP_OVERRIDE {}
|
||||||
@@ -222,7 +234,7 @@ public: // overridden from Writer
|
|||||||
private:
|
private:
|
||||||
void writeValue(const Value& value);
|
void writeValue(const Value& value);
|
||||||
void writeArrayValue(const Value& value);
|
void writeArrayValue(const Value& value);
|
||||||
bool isMultineArray(const Value& value);
|
bool isMultilineArray(const Value& value);
|
||||||
void pushValue(const JSONCPP_STRING& value);
|
void pushValue(const JSONCPP_STRING& value);
|
||||||
void writeIndent();
|
void writeIndent();
|
||||||
void writeWithIndent(const JSONCPP_STRING& value);
|
void writeWithIndent(const JSONCPP_STRING& value);
|
||||||
@@ -242,6 +254,9 @@ private:
|
|||||||
unsigned int indentSize_;
|
unsigned int indentSize_;
|
||||||
bool addChildValues_;
|
bool addChildValues_;
|
||||||
};
|
};
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
|
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
|
||||||
human friendly way,
|
human friendly way,
|
||||||
@@ -265,12 +280,18 @@ private:
|
|||||||
* If the Value have comments then they are outputed according to their
|
* If the Value have comments then they are outputed according to their
|
||||||
#CommentPlacement.
|
#CommentPlacement.
|
||||||
*
|
*
|
||||||
* \param indentation Each level will be indented by this amount extra.
|
|
||||||
* \sa Reader, Value, Value::setComment()
|
* \sa Reader, Value, Value::setComment()
|
||||||
* \deprecated Use StreamWriterBuilder.
|
* \deprecated Use StreamWriterBuilder.
|
||||||
*/
|
*/
|
||||||
class JSON_API StyledStreamWriter {
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4996) // Deriving from deprecated class
|
||||||
|
#endif
|
||||||
|
class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API StyledStreamWriter {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* \param indentation Each level will be indented by this amount extra.
|
||||||
|
*/
|
||||||
StyledStreamWriter(JSONCPP_STRING indentation = "\t");
|
StyledStreamWriter(JSONCPP_STRING indentation = "\t");
|
||||||
~StyledStreamWriter() {}
|
~StyledStreamWriter() {}
|
||||||
|
|
||||||
@@ -286,7 +307,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void writeValue(const Value& value);
|
void writeValue(const Value& value);
|
||||||
void writeArrayValue(const Value& value);
|
void writeArrayValue(const Value& value);
|
||||||
bool isMultineArray(const Value& value);
|
bool isMultilineArray(const Value& value);
|
||||||
void pushValue(const JSONCPP_STRING& value);
|
void pushValue(const JSONCPP_STRING& value);
|
||||||
void writeIndent();
|
void writeIndent();
|
||||||
void writeWithIndent(const JSONCPP_STRING& value);
|
void writeWithIndent(const JSONCPP_STRING& value);
|
||||||
@@ -307,6 +328,9 @@ private:
|
|||||||
bool addChildValues_ : 1;
|
bool addChildValues_ : 1;
|
||||||
bool indented_ : 1;
|
bool indented_ : 1;
|
||||||
};
|
};
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(JSON_HAS_INT64)
|
#if defined(JSON_HAS_INT64)
|
||||||
JSONCPP_STRING JSON_API valueToString(Int value);
|
JSONCPP_STRING JSON_API valueToString(Int value);
|
||||||
@@ -324,6 +348,8 @@ JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root);
|
|||||||
|
|
||||||
} // namespace Json
|
} // namespace Json
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2010 Baptiste Lepilleur
|
# Copyright 2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
# Distributed under MIT license, or public domain if desired and
|
# Distributed under MIT license, or public domain if desired and
|
||||||
# recognized in your jurisdiction.
|
# recognized in your jurisdiction.
|
||||||
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
@@ -265,7 +265,7 @@ Performs an svn export of tag release version, and build a source tarball.
|
|||||||
|
|
||||||
Must be started in the project top directory.
|
Must be started in the project top directory.
|
||||||
|
|
||||||
Warning: --force should only be used when developping/testing the release script.
|
Warning: --force should only be used when developing/testing the release script.
|
||||||
"""
|
"""
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
parser = OptionParser(usage=usage)
|
parser = OptionParser(usage=usage)
|
||||||
@@ -377,7 +377,7 @@ Warning: --force should only be used when developping/testing the release script
|
|||||||
user=options.user, sftp=options.sftp)
|
user=options.user, sftp=options.sftp)
|
||||||
print('Source and doc release tarballs uploaded')
|
print('Source and doc release tarballs uploaded')
|
||||||
else:
|
else:
|
||||||
print('No upload user specified. Web site and download tarbal were not uploaded.')
|
print('No upload user specified. Web site and download tarball were not uploaded.')
|
||||||
print('Tarball can be found at:', doc_tarball_path)
|
print('Tarball can be found at:', doc_tarball_path)
|
||||||
|
|
||||||
# Set next version number and commit
|
# Set next version number and commit
|
||||||
|
103
meson.build
Normal file
103
meson.build
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
project(
|
||||||
|
'jsoncpp',
|
||||||
|
'cpp',
|
||||||
|
version : '1.8.4',
|
||||||
|
default_options : [
|
||||||
|
'buildtype=release',
|
||||||
|
'warning_level=1'],
|
||||||
|
license : 'Public Domain',
|
||||||
|
meson_version : '>= 0.41.1')
|
||||||
|
|
||||||
|
jsoncpp_ver_arr = meson.project_version().split('.')
|
||||||
|
jsoncpp_major_version = jsoncpp_ver_arr[0]
|
||||||
|
jsoncpp_minor_version = jsoncpp_ver_arr[1]
|
||||||
|
jsoncpp_patch_version = jsoncpp_ver_arr[2]
|
||||||
|
|
||||||
|
jsoncpp_cdata = configuration_data()
|
||||||
|
jsoncpp_cdata.set('JSONCPP_VERSION', meson.project_version())
|
||||||
|
jsoncpp_cdata.set('JSONCPP_VERSION_MAJOR', jsoncpp_major_version)
|
||||||
|
jsoncpp_cdata.set('JSONCPP_VERSION_MINOR', jsoncpp_minor_version)
|
||||||
|
jsoncpp_cdata.set('JSONCPP_VERSION_PATCH', jsoncpp_patch_version)
|
||||||
|
jsoncpp_cdata.set('JSONCPP_USE_SECURE_MEMORY',0)
|
||||||
|
|
||||||
|
jsoncpp_gen_sources = configure_file(
|
||||||
|
input : 'src/lib_json/version.h.in',
|
||||||
|
output : 'version.h',
|
||||||
|
configuration : jsoncpp_cdata,
|
||||||
|
install : true,
|
||||||
|
install_dir : join_paths(get_option('prefix'), get_option('includedir'), 'json')
|
||||||
|
)
|
||||||
|
|
||||||
|
jsoncpp_headers = [
|
||||||
|
'include/json/allocator.h',
|
||||||
|
'include/json/assertions.h',
|
||||||
|
'include/json/autolink.h',
|
||||||
|
'include/json/config.h',
|
||||||
|
'include/json/features.h',
|
||||||
|
'include/json/forwards.h',
|
||||||
|
'include/json/json.h',
|
||||||
|
'include/json/reader.h',
|
||||||
|
'include/json/value.h',
|
||||||
|
'include/json/writer.h']
|
||||||
|
jsoncpp_include_directories = include_directories('include')
|
||||||
|
|
||||||
|
install_headers(
|
||||||
|
jsoncpp_headers,
|
||||||
|
subdir : 'json')
|
||||||
|
|
||||||
|
jsoncpp_lib = library(
|
||||||
|
'jsoncpp',
|
||||||
|
[ jsoncpp_gen_sources,
|
||||||
|
jsoncpp_headers,
|
||||||
|
'src/lib_json/json_tool.h',
|
||||||
|
'src/lib_json/json_reader.cpp',
|
||||||
|
'src/lib_json/json_value.cpp',
|
||||||
|
'src/lib_json/json_writer.cpp'],
|
||||||
|
soversion : 20,
|
||||||
|
install : true,
|
||||||
|
include_directories : jsoncpp_include_directories)
|
||||||
|
|
||||||
|
import('pkgconfig').generate(
|
||||||
|
libraries : jsoncpp_lib,
|
||||||
|
version : meson.project_version(),
|
||||||
|
name : 'jsoncpp',
|
||||||
|
filebase : 'jsoncpp',
|
||||||
|
description : 'A C++ library for interacting with JSON')
|
||||||
|
|
||||||
|
# for libraries bundling jsoncpp
|
||||||
|
jsoncpp_dep = declare_dependency(
|
||||||
|
include_directories : jsoncpp_include_directories,
|
||||||
|
link_with : jsoncpp_lib,
|
||||||
|
version : meson.project_version(),
|
||||||
|
sources : jsoncpp_gen_sources)
|
||||||
|
|
||||||
|
# tests
|
||||||
|
python = import('python3').find_python()
|
||||||
|
|
||||||
|
jsoncpp_test = executable(
|
||||||
|
'jsoncpp_test',
|
||||||
|
[ 'src/test_lib_json/jsontest.cpp',
|
||||||
|
'src/test_lib_json/jsontest.h',
|
||||||
|
'src/test_lib_json/main.cpp'],
|
||||||
|
include_directories : jsoncpp_include_directories,
|
||||||
|
link_with : jsoncpp_lib,
|
||||||
|
install : false)
|
||||||
|
test(
|
||||||
|
'unittest_jsoncpp_test',
|
||||||
|
jsoncpp_test)
|
||||||
|
|
||||||
|
jsontestrunner = executable(
|
||||||
|
'jsontestrunner',
|
||||||
|
'src/jsontestrunner/main.cpp',
|
||||||
|
include_directories : jsoncpp_include_directories,
|
||||||
|
link_with : jsoncpp_lib,
|
||||||
|
install : false)
|
||||||
|
test(
|
||||||
|
'unittest_jsontestrunner',
|
||||||
|
python,
|
||||||
|
args : [
|
||||||
|
'-B',
|
||||||
|
join_paths(meson.current_source_dir(), 'test/runjsontests.py'),
|
||||||
|
jsontestrunner,
|
||||||
|
join_paths(meson.current_source_dir(), 'test/data')]
|
||||||
|
)
|
@@ -1,7 +1,5 @@
|
|||||||
prefix=@CMAKE_INSTALL_PREFIX@
|
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||||
exec_prefix=${prefix}
|
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||||
libdir=${exec_prefix}/@LIBRARY_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,58 +0,0 @@
|
|||||||
# 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 os
|
|
||||||
|
|
||||||
def generate(env):
|
|
||||||
def Glob(env, includes = None, excludes = None, dir = '.'):
|
|
||||||
"""Adds Glob(includes = Split('*'), excludes = None, dir = '.')
|
|
||||||
helper function to environment.
|
|
||||||
|
|
||||||
Glob both the file-system files.
|
|
||||||
|
|
||||||
includes: list of file name pattern included in the return list when matched.
|
|
||||||
excludes: list of file name pattern exluced from the return list.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
sources = env.Glob(("*.cpp", '*.h'), "~*.cpp", "#src")
|
|
||||||
"""
|
|
||||||
def filterFilename(path):
|
|
||||||
abs_path = os.path.join(dir, path)
|
|
||||||
if not os.path.isfile(abs_path):
|
|
||||||
return 0
|
|
||||||
fn = os.path.basename(path)
|
|
||||||
match = 0
|
|
||||||
for include in includes:
|
|
||||||
if fnmatch.fnmatchcase(fn, include):
|
|
||||||
match = 1
|
|
||||||
break
|
|
||||||
if match == 1 and not excludes is None:
|
|
||||||
for exclude in excludes:
|
|
||||||
if fnmatch.fnmatchcase(fn, exclude):
|
|
||||||
match = 0
|
|
||||||
break
|
|
||||||
return match
|
|
||||||
if includes is None:
|
|
||||||
includes = ('*',)
|
|
||||||
elif type(includes) in (type(''), type(u'')):
|
|
||||||
includes = (includes,)
|
|
||||||
if type(excludes) in (type(''), type(u'')):
|
|
||||||
excludes = (excludes,)
|
|
||||||
dir = env.Dir(dir).abspath
|
|
||||||
paths = os.listdir(dir)
|
|
||||||
def makeAbsFileNode(path):
|
|
||||||
return env.File(os.path.join(dir, path))
|
|
||||||
nodes = filter(filterFilename, paths)
|
|
||||||
return map(makeAbsFileNode, nodes)
|
|
||||||
|
|
||||||
from SCons.Script import Environment
|
|
||||||
Environment.Glob = Glob
|
|
||||||
|
|
||||||
def exists(env):
|
|
||||||
"""
|
|
||||||
Tool always exists.
|
|
||||||
"""
|
|
||||||
return True
|
|
@@ -1,183 +0,0 @@
|
|||||||
# 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.path
|
|
||||||
from fnmatch import fnmatch
|
|
||||||
import targz
|
|
||||||
|
|
||||||
##def DoxyfileParse(file_contents):
|
|
||||||
## """
|
|
||||||
## Parse a Doxygen source file and return a dictionary of all the values.
|
|
||||||
## Values will be strings and lists of strings.
|
|
||||||
## """
|
|
||||||
## data = {}
|
|
||||||
##
|
|
||||||
## import shlex
|
|
||||||
## lex = shlex.shlex(instream = file_contents, posix = True)
|
|
||||||
## lex.wordchars += "*+./-:"
|
|
||||||
## lex.whitespace = lex.whitespace.replace("\n", "")
|
|
||||||
## lex.escape = ""
|
|
||||||
##
|
|
||||||
## lineno = lex.lineno
|
|
||||||
## last_backslash_lineno = lineno
|
|
||||||
## token = lex.get_token()
|
|
||||||
## key = token # the first token should be a key
|
|
||||||
## last_token = ""
|
|
||||||
## key_token = False
|
|
||||||
## next_key = False
|
|
||||||
## new_data = True
|
|
||||||
##
|
|
||||||
## def append_data(data, key, new_data, token):
|
|
||||||
## if new_data or len(data[key]) == 0:
|
|
||||||
## data[key].append(token)
|
|
||||||
## else:
|
|
||||||
## data[key][-1] += token
|
|
||||||
##
|
|
||||||
## while token:
|
|
||||||
## if token in ['\n']:
|
|
||||||
## if last_token not in ['\\']:
|
|
||||||
## key_token = True
|
|
||||||
## elif token in ['\\']:
|
|
||||||
## pass
|
|
||||||
## elif key_token:
|
|
||||||
## key = token
|
|
||||||
## key_token = False
|
|
||||||
## else:
|
|
||||||
## if token == "+=":
|
|
||||||
## if not data.has_key(key):
|
|
||||||
## data[key] = list()
|
|
||||||
## elif token == "=":
|
|
||||||
## data[key] = list()
|
|
||||||
## else:
|
|
||||||
## append_data(data, key, new_data, token)
|
|
||||||
## new_data = True
|
|
||||||
##
|
|
||||||
## last_token = token
|
|
||||||
## token = lex.get_token()
|
|
||||||
##
|
|
||||||
## if last_token == '\\' and token != '\n':
|
|
||||||
## new_data = False
|
|
||||||
## append_data(data, key, new_data, '\\')
|
|
||||||
##
|
|
||||||
## # compress lists of len 1 into single strings
|
|
||||||
## for (k, v) in data.items():
|
|
||||||
## if len(v) == 0:
|
|
||||||
## data.pop(k)
|
|
||||||
##
|
|
||||||
## # items in the following list will be kept as lists and not converted to strings
|
|
||||||
## if k in ["INPUT", "FILE_PATTERNS", "EXCLUDE_PATTERNS"]:
|
|
||||||
## continue
|
|
||||||
##
|
|
||||||
## if len(v) == 1:
|
|
||||||
## data[k] = v[0]
|
|
||||||
##
|
|
||||||
## return data
|
|
||||||
##
|
|
||||||
##def DoxySourceScan(node, env, path):
|
|
||||||
## """
|
|
||||||
## Doxygen Doxyfile source scanner. This should scan the Doxygen file and add
|
|
||||||
## any files used to generate docs to the list of source files.
|
|
||||||
## """
|
|
||||||
## default_file_patterns = [
|
|
||||||
## '*.c', '*.cc', '*.cxx', '*.cpp', '*.c++', '*.java', '*.ii', '*.ixx',
|
|
||||||
## '*.ipp', '*.i++', '*.inl', '*.h', '*.hh ', '*.hxx', '*.hpp', '*.h++',
|
|
||||||
## '*.idl', '*.odl', '*.cs', '*.php', '*.php3', '*.inc', '*.m', '*.mm',
|
|
||||||
## '*.py',
|
|
||||||
## ]
|
|
||||||
##
|
|
||||||
## default_exclude_patterns = [
|
|
||||||
## '*~',
|
|
||||||
## ]
|
|
||||||
##
|
|
||||||
## sources = []
|
|
||||||
##
|
|
||||||
## data = DoxyfileParse(node.get_contents())
|
|
||||||
##
|
|
||||||
## if data.get("RECURSIVE", "NO") == "YES":
|
|
||||||
## recursive = True
|
|
||||||
## else:
|
|
||||||
## recursive = False
|
|
||||||
##
|
|
||||||
## file_patterns = data.get("FILE_PATTERNS", default_file_patterns)
|
|
||||||
## exclude_patterns = data.get("EXCLUDE_PATTERNS", default_exclude_patterns)
|
|
||||||
##
|
|
||||||
## for node in data.get("INPUT", []):
|
|
||||||
## if os.path.isfile(node):
|
|
||||||
## sources.add(node)
|
|
||||||
## elif os.path.isdir(node):
|
|
||||||
## if recursive:
|
|
||||||
## for root, dirs, files in os.walk(node):
|
|
||||||
## for f in files:
|
|
||||||
## filename = os.path.join(root, f)
|
|
||||||
##
|
|
||||||
## pattern_check = reduce(lambda x, y: x or bool(fnmatch(filename, y)), file_patterns, False)
|
|
||||||
## exclude_check = reduce(lambda x, y: x and fnmatch(filename, y), exclude_patterns, True)
|
|
||||||
##
|
|
||||||
## if pattern_check and not exclude_check:
|
|
||||||
## sources.append(filename)
|
|
||||||
## else:
|
|
||||||
## for pattern in file_patterns:
|
|
||||||
## sources.extend(glob.glob("/".join([node, pattern])))
|
|
||||||
## sources = map(lambda path: env.File(path), sources)
|
|
||||||
## return sources
|
|
||||||
##
|
|
||||||
##
|
|
||||||
##def DoxySourceScanCheck(node, env):
|
|
||||||
## """Check if we should scan this file"""
|
|
||||||
## return os.path.isfile(node.path)
|
|
||||||
|
|
||||||
def srcDistEmitter(source, target, env):
|
|
||||||
## """Doxygen Doxyfile emitter"""
|
|
||||||
## # possible output formats and their default values and output locations
|
|
||||||
## output_formats = {
|
|
||||||
## "HTML": ("YES", "html"),
|
|
||||||
## "LATEX": ("YES", "latex"),
|
|
||||||
## "RTF": ("NO", "rtf"),
|
|
||||||
## "MAN": ("YES", "man"),
|
|
||||||
## "XML": ("NO", "xml"),
|
|
||||||
## }
|
|
||||||
##
|
|
||||||
## data = DoxyfileParse(source[0].get_contents())
|
|
||||||
##
|
|
||||||
## targets = []
|
|
||||||
## out_dir = data.get("OUTPUT_DIRECTORY", ".")
|
|
||||||
##
|
|
||||||
## # add our output locations
|
|
||||||
## for (k, v) in output_formats.items():
|
|
||||||
## if data.get("GENERATE_" + k, v[0]) == "YES":
|
|
||||||
## targets.append(env.Dir(os.path.join(out_dir, data.get(k + "_OUTPUT", v[1]))))
|
|
||||||
##
|
|
||||||
## # don't clobber targets
|
|
||||||
## for node in targets:
|
|
||||||
## env.Precious(node)
|
|
||||||
##
|
|
||||||
## # set up cleaning stuff
|
|
||||||
## for node in targets:
|
|
||||||
## env.Clean(node, node)
|
|
||||||
##
|
|
||||||
## return (targets, source)
|
|
||||||
return (target,source)
|
|
||||||
|
|
||||||
def generate(env):
|
|
||||||
"""
|
|
||||||
Add builders and construction variables for the
|
|
||||||
SrcDist tool.
|
|
||||||
"""
|
|
||||||
## doxyfile_scanner = env.Scanner(## DoxySourceScan,
|
|
||||||
## "DoxySourceScan",
|
|
||||||
## scan_check = DoxySourceScanCheck,
|
|
||||||
##)
|
|
||||||
|
|
||||||
if targz.exists(env):
|
|
||||||
srcdist_builder = targz.makeBuilder(srcDistEmitter)
|
|
||||||
|
|
||||||
env['BUILDERS']['SrcDist'] = srcdist_builder
|
|
||||||
|
|
||||||
def exists(env):
|
|
||||||
"""
|
|
||||||
Make sure srcdist exists.
|
|
||||||
"""
|
|
||||||
return targz.exists(env)
|
|
@@ -1,85 +0,0 @@
|
|||||||
# 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
|
|
||||||
from SCons.Script import * # the usual scons stuff you get in a SConscript
|
|
||||||
import collections
|
|
||||||
|
|
||||||
def generate(env):
|
|
||||||
"""
|
|
||||||
Add builders and construction variables for the
|
|
||||||
SubstInFile tool.
|
|
||||||
|
|
||||||
Adds SubstInFile builder, which substitutes the keys->values of SUBST_DICT
|
|
||||||
from the source to the target.
|
|
||||||
The values of SUBST_DICT first have any construction variables expanded
|
|
||||||
(its keys are not expanded).
|
|
||||||
If a value of SUBST_DICT is a python callable function, it is called and
|
|
||||||
the result is expanded as the value.
|
|
||||||
If there's more than one source and more than one target, each target gets
|
|
||||||
substituted from the corresponding source.
|
|
||||||
"""
|
|
||||||
def do_subst_in_file(targetfile, sourcefile, dict):
|
|
||||||
"""Replace all instances of the keys of dict with their values.
|
|
||||||
For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'},
|
|
||||||
then all instances of %VERSION% in the file will be replaced with 1.2345 etc.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
f = open(sourcefile, 'rb')
|
|
||||||
contents = f.read()
|
|
||||||
f.close()
|
|
||||||
except:
|
|
||||||
raise SCons.Errors.UserError("Can't read source file %s"%sourcefile)
|
|
||||||
for (k,v) in list(dict.items()):
|
|
||||||
contents = re.sub(k, v, contents)
|
|
||||||
try:
|
|
||||||
f = open(targetfile, 'wb')
|
|
||||||
f.write(contents)
|
|
||||||
f.close()
|
|
||||||
except:
|
|
||||||
raise SCons.Errors.UserError("Can't write target file %s"%targetfile)
|
|
||||||
return 0 # success
|
|
||||||
|
|
||||||
def subst_in_file(target, source, env):
|
|
||||||
if 'SUBST_DICT' not in env:
|
|
||||||
raise SCons.Errors.UserError("SubstInFile requires SUBST_DICT to be set.")
|
|
||||||
d = dict(env['SUBST_DICT']) # copy it
|
|
||||||
for (k,v) in list(d.items()):
|
|
||||||
if isinstance(v, collections.Callable):
|
|
||||||
d[k] = env.subst(v()).replace('\\','\\\\')
|
|
||||||
elif SCons.Util.is_String(v):
|
|
||||||
d[k] = env.subst(v).replace('\\','\\\\')
|
|
||||||
else:
|
|
||||||
raise SCons.Errors.UserError("SubstInFile: key %s: %s must be a string or callable"%(k, repr(v)))
|
|
||||||
for (t,s) in zip(target, source):
|
|
||||||
return do_subst_in_file(str(t), str(s), d)
|
|
||||||
|
|
||||||
def subst_in_file_string(target, source, env):
|
|
||||||
"""This is what gets printed on the console."""
|
|
||||||
return '\n'.join(['Substituting vars from %s into %s'%(str(s), str(t))
|
|
||||||
for (t,s) in zip(target, source)])
|
|
||||||
|
|
||||||
def subst_emitter(target, source, env):
|
|
||||||
"""Add dependency from substituted SUBST_DICT to target.
|
|
||||||
Returns original target, source tuple unchanged.
|
|
||||||
"""
|
|
||||||
d = env['SUBST_DICT'].copy() # copy it
|
|
||||||
for (k,v) in list(d.items()):
|
|
||||||
if isinstance(v, collections.Callable):
|
|
||||||
d[k] = env.subst(v())
|
|
||||||
elif SCons.Util.is_String(v):
|
|
||||||
d[k]=env.subst(v)
|
|
||||||
Depends(target, SCons.Node.Python.Value(d))
|
|
||||||
return target, source
|
|
||||||
|
|
||||||
## env.Append(TOOLS = 'substinfile') # this should be automaticaly done by Scons ?!?
|
|
||||||
subst_action = SCons.Action.Action(subst_in_file, subst_in_file_string)
|
|
||||||
env['BUILDERS']['SubstInFile'] = Builder(action=subst_action, emitter=subst_emitter)
|
|
||||||
|
|
||||||
def exists(env):
|
|
||||||
"""
|
|
||||||
Make sure tool exists.
|
|
||||||
"""
|
|
||||||
return True
|
|
@@ -1,87 +0,0 @@
|
|||||||
# 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
|
|
||||||
|
|
||||||
Tool-specific initialization for tarball.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
## Commands to tackle a command based implementation:
|
|
||||||
##to unpack on the fly...
|
|
||||||
##gunzip < FILE.tar.gz | tar xvf -
|
|
||||||
##to pack on the fly...
|
|
||||||
##tar cvf - FILE-LIST | gzip -c > FILE.tar.gz
|
|
||||||
|
|
||||||
import os.path
|
|
||||||
|
|
||||||
import SCons.Builder
|
|
||||||
import SCons.Node.FS
|
|
||||||
import SCons.Util
|
|
||||||
|
|
||||||
try:
|
|
||||||
import gzip
|
|
||||||
import tarfile
|
|
||||||
internal_targz = 1
|
|
||||||
except ImportError:
|
|
||||||
internal_targz = 0
|
|
||||||
|
|
||||||
TARGZ_DEFAULT_COMPRESSION_LEVEL = 9
|
|
||||||
|
|
||||||
if internal_targz:
|
|
||||||
def targz(target, source, env):
|
|
||||||
def archive_name(path):
|
|
||||||
path = os.path.normpath(os.path.abspath(path))
|
|
||||||
common_path = os.path.commonprefix((base_dir, path))
|
|
||||||
archive_name = path[len(common_path):]
|
|
||||||
return archive_name
|
|
||||||
|
|
||||||
def visit(tar, dirname, names):
|
|
||||||
for name in names:
|
|
||||||
path = os.path.join(dirname, name)
|
|
||||||
if os.path.isfile(path):
|
|
||||||
tar.add(path, archive_name(path))
|
|
||||||
compression = env.get('TARGZ_COMPRESSION_LEVEL',TARGZ_DEFAULT_COMPRESSION_LEVEL)
|
|
||||||
base_dir = os.path.normpath(env.get('TARGZ_BASEDIR', env.Dir('.')).abspath)
|
|
||||||
target_path = str(target[0])
|
|
||||||
fileobj = gzip.GzipFile(target_path, 'wb', compression)
|
|
||||||
tar = tarfile.TarFile(os.path.splitext(target_path)[0], 'w', fileobj)
|
|
||||||
for source in source:
|
|
||||||
source_path = str(source)
|
|
||||||
if source.isdir():
|
|
||||||
os.path.walk(source_path, visit, tar)
|
|
||||||
else:
|
|
||||||
tar.add(source_path, archive_name(source_path)) # filename, arcname
|
|
||||||
tar.close()
|
|
||||||
|
|
||||||
targzAction = SCons.Action.Action(targz, varlist=['TARGZ_COMPRESSION_LEVEL','TARGZ_BASEDIR'])
|
|
||||||
|
|
||||||
def makeBuilder(emitter = None):
|
|
||||||
return SCons.Builder.Builder(action = SCons.Action.Action('$TARGZ_COM', '$TARGZ_COMSTR'),
|
|
||||||
source_factory = SCons.Node.FS.Entry,
|
|
||||||
source_scanner = SCons.Defaults.DirScanner,
|
|
||||||
suffix = '$TARGZ_SUFFIX',
|
|
||||||
multi = 1)
|
|
||||||
TarGzBuilder = makeBuilder()
|
|
||||||
|
|
||||||
def generate(env):
|
|
||||||
"""Add Builders and construction variables for zip to an Environment.
|
|
||||||
The following environnement variables may be set:
|
|
||||||
TARGZ_COMPRESSION_LEVEL: integer, [0-9]. 0: no compression, 9: best compression (same as gzip compression level).
|
|
||||||
TARGZ_BASEDIR: base-directory used to determine archive name (this allow archive name to be relative
|
|
||||||
to something other than top-dir).
|
|
||||||
"""
|
|
||||||
env['BUILDERS']['TarGz'] = TarGzBuilder
|
|
||||||
env['TARGZ_COM'] = targzAction
|
|
||||||
env['TARGZ_COMPRESSION_LEVEL'] = TARGZ_DEFAULT_COMPRESSION_LEVEL # range 0-9
|
|
||||||
env['TARGZ_SUFFIX'] = '.tar.gz'
|
|
||||||
env['TARGZ_BASEDIR'] = env.Dir('.') # Sources archive name are made relative to that directory.
|
|
||||||
else:
|
|
||||||
def generate(env):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def exists(env):
|
|
||||||
return internal_targz
|
|
@@ -1,8 +1,15 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#pragma warning(disable : 4996)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This executable is used for testing parser/writer using real JSON files.
|
/* This executable is used for testing parser/writer using real JSON files.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -11,10 +18,6 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1310
|
|
||||||
#pragma warning(disable : 4996) // disable fopen deprecation warning
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct Options
|
struct Options
|
||||||
{
|
{
|
||||||
JSONCPP_STRING path;
|
JSONCPP_STRING path;
|
||||||
@@ -324,3 +327,7 @@ int main(int argc, const char* argv[]) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
Import( 'env_testing buildJSONTests' )
|
|
||||||
|
|
||||||
buildJSONTests( env_testing, Split( """
|
|
||||||
main.cpp
|
|
||||||
""" ),
|
|
||||||
'jsontestrunner' )
|
|
||||||
|
|
||||||
# For 'check' to work, 'libs' must be built first.
|
|
||||||
env_testing.Depends('jsontestrunner', '#libs')
|
|
@@ -1,13 +1,41 @@
|
|||||||
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")
|
||||||
endif()
|
ENDIF()
|
||||||
endif( CMAKE_COMPILER_IS_GNUCXX )
|
ENDIF( CMAKE_COMPILER_IS_GNUCXX )
|
||||||
|
|
||||||
|
INCLUDE(CheckIncludeFileCXX)
|
||||||
|
INCLUDE(CheckTypeSize)
|
||||||
|
INCLUDE(CheckStructHasMember)
|
||||||
|
INCLUDE(CheckCXXSymbolExists)
|
||||||
|
|
||||||
|
check_include_file_cxx(clocale HAVE_CLOCALE)
|
||||||
|
check_cxx_symbol_exists(localeconv clocale HAVE_LOCALECONV)
|
||||||
|
|
||||||
|
IF(CMAKE_VERSION VERSION_LESS 3.0.0)
|
||||||
|
# The "LANGUAGE CXX" parameter is not supported in CMake versions below 3,
|
||||||
|
# so the C compiler and header has to be used.
|
||||||
|
check_include_file(locale.h HAVE_LOCALE_H)
|
||||||
|
SET(CMAKE_EXTRA_INCLUDE_FILES locale.h)
|
||||||
|
check_type_size("struct lconv" LCONV_SIZE)
|
||||||
|
UNSET(CMAKE_EXTRA_INCLUDE_FILES)
|
||||||
|
check_struct_has_member("struct lconv" decimal_point locale.h HAVE_DECIMAL_POINT)
|
||||||
|
ELSE()
|
||||||
|
SET(CMAKE_EXTRA_INCLUDE_FILES clocale)
|
||||||
|
check_type_size(lconv LCONV_SIZE LANGUAGE CXX)
|
||||||
|
UNSET(CMAKE_EXTRA_INCLUDE_FILES)
|
||||||
|
check_struct_has_member(lconv decimal_point clocale HAVE_DECIMAL_POINT LANGUAGE CXX)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(NOT (HAVE_CLOCALE AND HAVE_LCONV_SIZE AND HAVE_DECIMAL_POINT AND HAVE_LOCALECONV))
|
||||||
|
MESSAGE(WARNING "Locale functionality is not supported")
|
||||||
|
ADD_DEFINITIONS(-DJSONCPP_NO_LOCALE_SUPPORT)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
SET( JSONCPP_INCLUDE_DIR ../../include )
|
SET( JSONCPP_INCLUDE_DIR ../../include )
|
||||||
|
|
||||||
@@ -42,18 +70,23 @@ ENDIF()
|
|||||||
IF(BUILD_SHARED_LIBS)
|
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_SOVERSION})
|
||||||
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} )
|
DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
|
||||||
|
|
||||||
|
# Set library's runtime search path on OSX
|
||||||
|
IF(APPLE)
|
||||||
|
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES INSTALL_RPATH "@loader_path/." )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
INSTALL( TARGETS jsoncpp_lib ${INSTALL_EXPORT}
|
INSTALL( TARGETS jsoncpp_lib ${INSTALL_EXPORT}
|
||||||
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION ${ARCHIVE_INSTALL_DIR})
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
|
||||||
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:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>)
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@@ -61,20 +94,24 @@ ENDIF()
|
|||||||
|
|
||||||
IF(BUILD_STATIC_LIBS)
|
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_SOVERSION})
|
||||||
SET_TARGET_PROPERTIES( jsoncpp_lib_static PROPERTIES OUTPUT_NAME jsoncpp
|
# avoid name clashes on windows as the shared import lib is also named jsoncpp.lib
|
||||||
DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
|
if (NOT DEFINED STATIC_SUFFIX AND BUILD_SHARED_LIBS)
|
||||||
|
set (STATIC_SUFFIX "_static")
|
||||||
|
endif ()
|
||||||
|
set_target_properties (jsoncpp_lib_static PROPERTIES OUTPUT_NAME jsoncpp${STATIC_SUFFIX}
|
||||||
|
DEBUG_OUTPUT_NAME jsoncpp${STATIC_SUFFIX}${DEBUG_LIBNAME_SUFFIX})
|
||||||
|
|
||||||
INSTALL( TARGETS jsoncpp_lib_static ${INSTALL_EXPORT}
|
INSTALL( TARGETS jsoncpp_lib_static ${INSTALL_EXPORT}
|
||||||
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION ${ARCHIVE_INSTALL_DIR})
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
|
||||||
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:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
|
||||||
)
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
// Copyright 2007-2011 Baptiste Lepilleur
|
// Copyright 2007-2011 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
|
// Copyright (C) 2016 InfoTeCS JSC. All rights reserved.
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
@@ -44,8 +45,12 @@
|
|||||||
#pragma warning(disable : 4996)
|
#pragma warning(disable : 4996)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int const stackLimit_g = 1000;
|
// Define JSONCPP_DEPRECATED_STACK_LIMIT as an appropriate integer at compile time to change the stack limit
|
||||||
static int stackDepth_g = 0; // see readValue()
|
#if !defined(JSONCPP_DEPRECATED_STACK_LIMIT)
|
||||||
|
#define JSONCPP_DEPRECATED_STACK_LIMIT 1000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static size_t const stackLimit_g = JSONCPP_DEPRECATED_STACK_LIMIT; // see readValue()
|
||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
@@ -76,7 +81,7 @@ Features Features::strictMode() {
|
|||||||
// Implementation of class Reader
|
// Implementation of class Reader
|
||||||
// ////////////////////////////////
|
// ////////////////////////////////
|
||||||
|
|
||||||
static bool containsNewLine(Reader::Location begin, Reader::Location end) {
|
bool Reader::containsNewLine(Reader::Location begin, Reader::Location end) {
|
||||||
for (; begin < end; ++begin)
|
for (; begin < end; ++begin)
|
||||||
if (*begin == '\n' || *begin == '\r')
|
if (*begin == '\n' || *begin == '\r')
|
||||||
return true;
|
return true;
|
||||||
@@ -98,8 +103,7 @@ Reader::Reader(const Features& features)
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
Reader::parse(const std::string& document, Value& root, bool collectComments) {
|
Reader::parse(const std::string& document, Value& root, bool collectComments) {
|
||||||
JSONCPP_STRING documentCopy(document.data(), document.data() + document.capacity());
|
document_.assign(document.begin(), document.end());
|
||||||
std::swap(documentCopy, document_);
|
|
||||||
const char* begin = document_.c_str();
|
const char* begin = document_.c_str();
|
||||||
const char* end = begin + document_.length();
|
const char* end = begin + document_.length();
|
||||||
return parse(begin, end, root, collectComments);
|
return parse(begin, end, root, collectComments);
|
||||||
@@ -132,13 +136,12 @@ bool Reader::parse(const char* beginDoc,
|
|||||||
current_ = begin_;
|
current_ = begin_;
|
||||||
lastValueEnd_ = 0;
|
lastValueEnd_ = 0;
|
||||||
lastValue_ = 0;
|
lastValue_ = 0;
|
||||||
commentsBefore_ = "";
|
commentsBefore_.clear();
|
||||||
errors_.clear();
|
errors_.clear();
|
||||||
while (!nodes_.empty())
|
while (!nodes_.empty())
|
||||||
nodes_.pop();
|
nodes_.pop();
|
||||||
nodes_.push(&root);
|
nodes_.push(&root);
|
||||||
|
|
||||||
stackDepth_g = 0; // Yes, this is bad coding, but options are limited.
|
|
||||||
bool successful = readValue();
|
bool successful = readValue();
|
||||||
Token token;
|
Token token;
|
||||||
skipCommentTokens(token);
|
skipCommentTokens(token);
|
||||||
@@ -161,12 +164,10 @@ bool Reader::parse(const char* beginDoc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Reader::readValue() {
|
bool Reader::readValue() {
|
||||||
// This is a non-reentrant way to support a stackLimit. Terrible!
|
// readValue() may call itself only if it calls readObject() or ReadArray().
|
||||||
// But this deprecated class has a security problem: Bad input can
|
// These methods execute nodes_.push() just before and nodes_.pop)() just after calling readValue().
|
||||||
// cause a seg-fault. This seems like a fair, binary-compatible way
|
// parse() executes one nodes_.push(), so > instead of >=.
|
||||||
// to prevent the problem.
|
if (nodes_.size() > stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue().");
|
||||||
if (stackDepth_g >= stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue().");
|
|
||||||
++stackDepth_g;
|
|
||||||
|
|
||||||
Token token;
|
Token token;
|
||||||
skipCommentTokens(token);
|
skipCommentTokens(token);
|
||||||
@@ -174,7 +175,7 @@ bool Reader::readValue() {
|
|||||||
|
|
||||||
if (collectComments_ && !commentsBefore_.empty()) {
|
if (collectComments_ && !commentsBefore_.empty()) {
|
||||||
currentValue().setComment(commentsBefore_, commentBefore);
|
currentValue().setComment(commentsBefore_, commentBefore);
|
||||||
commentsBefore_ = "";
|
commentsBefore_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (token.type_) {
|
switch (token.type_) {
|
||||||
@@ -240,7 +241,6 @@ bool Reader::readValue() {
|
|||||||
lastValue_ = ¤tValue();
|
lastValue_ = ¤tValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
--stackDepth_g;
|
|
||||||
return successful;
|
return successful;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,7 +369,7 @@ bool Reader::readComment() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSONCPP_STRING normalizeEOL(Reader::Location begin, Reader::Location end) {
|
JSONCPP_STRING Reader::normalizeEOL(Reader::Location begin, Reader::Location end) {
|
||||||
JSONCPP_STRING normalized;
|
JSONCPP_STRING normalized;
|
||||||
normalized.reserve(static_cast<size_t>(end - begin));
|
normalized.reserve(static_cast<size_t>(end - begin));
|
||||||
Reader::Location current = begin;
|
Reader::Location current = begin;
|
||||||
@@ -401,7 +401,7 @@ Reader::addComment(Location begin, Location end, CommentPlacement placement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Reader::readCStyleComment() {
|
bool Reader::readCStyleComment() {
|
||||||
while (current_ != end_) {
|
while ((current_ + 1) < end_) {
|
||||||
Char c = getNextChar();
|
Char c = getNextChar();
|
||||||
if (c == '*' && *current_ == '/')
|
if (c == '*' && *current_ == '/')
|
||||||
break;
|
break;
|
||||||
@@ -473,7 +473,7 @@ bool Reader::readObject(Token& tokenStart) {
|
|||||||
break;
|
break;
|
||||||
if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object
|
if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object
|
||||||
return true;
|
return true;
|
||||||
name = "";
|
name.clear();
|
||||||
if (tokenName.type_ == tokenString) {
|
if (tokenName.type_ == tokenString) {
|
||||||
if (!decodeString(tokenName, name))
|
if (!decodeString(tokenName, name))
|
||||||
return recoverFromError(tokenObjectEnd);
|
return recoverFromError(tokenObjectEnd);
|
||||||
@@ -520,7 +520,7 @@ bool Reader::readArray(Token& tokenStart) {
|
|||||||
currentValue().swapPayload(init);
|
currentValue().swapPayload(init);
|
||||||
currentValue().setOffsetStart(tokenStart.start_ - begin_);
|
currentValue().setOffsetStart(tokenStart.start_ - begin_);
|
||||||
skipSpaces();
|
skipSpaces();
|
||||||
if (*current_ == ']') // empty array
|
if (current_ != end_ && *current_ == ']') // empty array
|
||||||
{
|
{
|
||||||
Token endArray;
|
Token endArray;
|
||||||
readToken(endArray);
|
readToken(endArray);
|
||||||
@@ -1018,6 +1018,9 @@ private:
|
|||||||
void addComment(Location begin, Location end, CommentPlacement placement);
|
void addComment(Location begin, Location end, CommentPlacement placement);
|
||||||
void skipCommentTokens(Token& token);
|
void skipCommentTokens(Token& token);
|
||||||
|
|
||||||
|
static JSONCPP_STRING normalizeEOL(Location begin, Location end);
|
||||||
|
static bool containsNewLine(Location begin, Location end);
|
||||||
|
|
||||||
typedef std::stack<Value*> Nodes;
|
typedef std::stack<Value*> Nodes;
|
||||||
Nodes nodes_;
|
Nodes nodes_;
|
||||||
Errors errors_;
|
Errors errors_;
|
||||||
@@ -1028,7 +1031,6 @@ private:
|
|||||||
Location lastValueEnd_;
|
Location lastValueEnd_;
|
||||||
Value* lastValue_;
|
Value* lastValue_;
|
||||||
JSONCPP_STRING commentsBefore_;
|
JSONCPP_STRING commentsBefore_;
|
||||||
int stackDepth_;
|
|
||||||
|
|
||||||
OurFeatures const features_;
|
OurFeatures const features_;
|
||||||
bool collectComments_;
|
bool collectComments_;
|
||||||
@@ -1036,10 +1038,16 @@ private:
|
|||||||
|
|
||||||
// complete copy of Read impl, for OurReader
|
// complete copy of Read impl, for OurReader
|
||||||
|
|
||||||
|
bool OurReader::containsNewLine(OurReader::Location begin, OurReader::Location end) {
|
||||||
|
for (; begin < end; ++begin)
|
||||||
|
if (*begin == '\n' || *begin == '\r')
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
OurReader::OurReader(OurFeatures const& features)
|
OurReader::OurReader(OurFeatures const& features)
|
||||||
: errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(),
|
: errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(),
|
||||||
lastValue_(), commentsBefore_(),
|
lastValue_(), commentsBefore_(),
|
||||||
stackDepth_(0),
|
|
||||||
features_(features), collectComments_() {
|
features_(features), collectComments_() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1057,13 +1065,12 @@ bool OurReader::parse(const char* beginDoc,
|
|||||||
current_ = begin_;
|
current_ = begin_;
|
||||||
lastValueEnd_ = 0;
|
lastValueEnd_ = 0;
|
||||||
lastValue_ = 0;
|
lastValue_ = 0;
|
||||||
commentsBefore_ = "";
|
commentsBefore_.clear();
|
||||||
errors_.clear();
|
errors_.clear();
|
||||||
while (!nodes_.empty())
|
while (!nodes_.empty())
|
||||||
nodes_.pop();
|
nodes_.pop();
|
||||||
nodes_.push(&root);
|
nodes_.push(&root);
|
||||||
|
|
||||||
stackDepth_ = 0;
|
|
||||||
bool successful = readValue();
|
bool successful = readValue();
|
||||||
Token token;
|
Token token;
|
||||||
skipCommentTokens(token);
|
skipCommentTokens(token);
|
||||||
@@ -1092,15 +1099,15 @@ bool OurReader::parse(const char* beginDoc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OurReader::readValue() {
|
bool OurReader::readValue() {
|
||||||
if (stackDepth_ >= features_.stackLimit_) throwRuntimeError("Exceeded stackLimit in readValue().");
|
// To preserve the old behaviour we cast size_t to int.
|
||||||
++stackDepth_;
|
if (static_cast<int>(nodes_.size()) > features_.stackLimit_) throwRuntimeError("Exceeded stackLimit in readValue().");
|
||||||
Token token;
|
Token token;
|
||||||
skipCommentTokens(token);
|
skipCommentTokens(token);
|
||||||
bool successful = true;
|
bool successful = true;
|
||||||
|
|
||||||
if (collectComments_ && !commentsBefore_.empty()) {
|
if (collectComments_ && !commentsBefore_.empty()) {
|
||||||
currentValue().setComment(commentsBefore_, commentBefore);
|
currentValue().setComment(commentsBefore_, commentBefore);
|
||||||
commentsBefore_ = "";
|
commentsBefore_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (token.type_) {
|
switch (token.type_) {
|
||||||
@@ -1190,7 +1197,6 @@ bool OurReader::readValue() {
|
|||||||
lastValue_ = ¤tValue();
|
lastValue_ = ¤tValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
--stackDepth_;
|
|
||||||
return successful;
|
return successful;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1231,7 +1237,7 @@ bool OurReader::readToken(Token& token) {
|
|||||||
token.type_ = tokenString;
|
token.type_ = tokenString;
|
||||||
ok = readStringSingleQuote();
|
ok = readStringSingleQuote();
|
||||||
break;
|
break;
|
||||||
} // else continue
|
} // else fall through
|
||||||
case '/':
|
case '/':
|
||||||
token.type_ = tokenComment;
|
token.type_ = tokenComment;
|
||||||
ok = readComment();
|
ok = readComment();
|
||||||
@@ -1348,6 +1354,25 @@ bool OurReader::readComment() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSONCPP_STRING OurReader::normalizeEOL(OurReader::Location begin, OurReader::Location end) {
|
||||||
|
JSONCPP_STRING normalized;
|
||||||
|
normalized.reserve(static_cast<size_t>(end - begin));
|
||||||
|
OurReader::Location current = begin;
|
||||||
|
while (current != end) {
|
||||||
|
char c = *current++;
|
||||||
|
if (c == '\r') {
|
||||||
|
if (current != end && *current == '\n')
|
||||||
|
// convert dos EOL
|
||||||
|
++current;
|
||||||
|
// convert Mac EOL
|
||||||
|
normalized += '\n';
|
||||||
|
} else {
|
||||||
|
normalized += c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return normalized;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
OurReader::addComment(Location begin, Location end, CommentPlacement placement) {
|
OurReader::addComment(Location begin, Location end, CommentPlacement placement) {
|
||||||
assert(collectComments_);
|
assert(collectComments_);
|
||||||
@@ -1361,7 +1386,7 @@ OurReader::addComment(Location begin, Location end, CommentPlacement placement)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OurReader::readCStyleComment() {
|
bool OurReader::readCStyleComment() {
|
||||||
while (current_ != end_) {
|
while ((current_ + 1) < end_) {
|
||||||
Char c = getNextChar();
|
Char c = getNextChar();
|
||||||
if (c == '*' && *current_ == '/')
|
if (c == '*' && *current_ == '/')
|
||||||
break;
|
break;
|
||||||
@@ -1450,7 +1475,7 @@ bool OurReader::readObject(Token& tokenStart) {
|
|||||||
break;
|
break;
|
||||||
if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object
|
if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object
|
||||||
return true;
|
return true;
|
||||||
name = "";
|
name.clear();
|
||||||
if (tokenName.type_ == tokenString) {
|
if (tokenName.type_ == tokenString) {
|
||||||
if (!decodeString(tokenName, name))
|
if (!decodeString(tokenName, name))
|
||||||
return recoverFromError(tokenObjectEnd);
|
return recoverFromError(tokenObjectEnd);
|
||||||
@@ -1503,7 +1528,7 @@ bool OurReader::readArray(Token& tokenStart) {
|
|||||||
currentValue().swapPayload(init);
|
currentValue().swapPayload(init);
|
||||||
currentValue().setOffsetStart(tokenStart.start_ - begin_);
|
currentValue().setOffsetStart(tokenStart.start_ - begin_);
|
||||||
skipSpaces();
|
skipSpaces();
|
||||||
if (*current_ == ']') // empty array
|
if (current_ != end_ && *current_ == ']') // empty array
|
||||||
{
|
{
|
||||||
Token endArray;
|
Token endArray;
|
||||||
readToken(endArray);
|
readToken(endArray);
|
||||||
@@ -2027,10 +2052,6 @@ JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM& sin, Value& root) {
|
|||||||
JSONCPP_STRING errs;
|
JSONCPP_STRING errs;
|
||||||
bool ok = parseFromStream(b, sin, &root, &errs);
|
bool ok = parseFromStream(b, sin, &root, &errs);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
fprintf(stderr,
|
|
||||||
"Error from reader: %s",
|
|
||||||
errs.c_str());
|
|
||||||
|
|
||||||
throwRuntimeError(errs);
|
throwRuntimeError(errs);
|
||||||
}
|
}
|
||||||
return sin;
|
return sin;
|
||||||
|
@@ -1,11 +1,20 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
||||||
#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
// Also support old flag NO_LOCALE_SUPPORT
|
||||||
|
#ifdef NO_LOCALE_SUPPORT
|
||||||
|
#define JSONCPP_NO_LOCALE_SUPPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef JSONCPP_NO_LOCALE_SUPPORT
|
||||||
#include <clocale>
|
#include <clocale>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This header provides common string manipulation support, such as UTF-8,
|
/* This header provides common string manipulation support, such as UTF-8,
|
||||||
* portable conversion from/to string...
|
* portable conversion from/to string...
|
||||||
@@ -14,26 +23,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
static char getDecimalPoint() {
|
||||||
/// Fallback for decimal_point on android, where the lconv is an empty struct.
|
#ifdef JSONCPP_NO_LOCALE_SUPPORT
|
||||||
template<typename Lconv, bool=(sizeof(Lconv) >= sizeof(char*))>
|
return '\0';
|
||||||
struct Locale {
|
#else
|
||||||
static char decimalPoint() {
|
struct lconv* lc = localeconv();
|
||||||
return '\0';
|
return lc ? *(lc->decimal_point) : '\0';
|
||||||
}
|
#endif
|
||||||
};
|
}
|
||||||
|
|
||||||
/// Return decimal_point for the current locale.
|
|
||||||
template<typename Lconv>
|
|
||||||
struct Locale<Lconv, true> {
|
|
||||||
static char decimalPoint() {
|
|
||||||
Lconv* lc = localeconv();
|
|
||||||
if (lc == NULL) {
|
|
||||||
return '\0';
|
|
||||||
}
|
|
||||||
return *(lc->decimal_point);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Converts a unicode code-point to UTF-8.
|
/// Converts a unicode code-point to UTF-8.
|
||||||
static inline JSONCPP_STRING codePointToUTF8(unsigned int cp) {
|
static inline JSONCPP_STRING codePointToUTF8(unsigned int cp) {
|
||||||
@@ -64,9 +61,6 @@ static inline JSONCPP_STRING codePointToUTF8(unsigned int cp) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if ch is a control character (in range [1,31]).
|
|
||||||
static inline bool isControlCharacter(char ch) { return ch > 0 && ch <= 0x1F; }
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
/// Constant that specify the size of the buffer that must be passed to
|
/// Constant that specify the size of the buffer that must be passed to
|
||||||
/// uintToString.
|
/// uintToString.
|
||||||
@@ -77,7 +71,7 @@ enum {
|
|||||||
typedef char UIntToStringBuffer[uintToStringBufferSize];
|
typedef char UIntToStringBuffer[uintToStringBufferSize];
|
||||||
|
|
||||||
/** Converts an unsigned integer to string.
|
/** Converts an unsigned integer to string.
|
||||||
* @param value Unsigned interger to convert to string
|
* @param value Unsigned integer to convert to string
|
||||||
* @param current Input/Output string buffer.
|
* @param current Input/Output string buffer.
|
||||||
* Must have at least uintToStringBufferSize chars free.
|
* Must have at least uintToStringBufferSize chars free.
|
||||||
*/
|
*/
|
||||||
@@ -104,7 +98,7 @@ static inline void fixNumericLocale(char* begin, char* end) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void fixNumericLocaleInput(char* begin, char* end) {
|
static inline void fixNumericLocaleInput(char* begin, char* end) {
|
||||||
char decimalPoint = Locale<struct lconv>::decimalPoint();
|
char decimalPoint = getDecimalPoint();
|
||||||
if (decimalPoint != '\0' && decimalPoint != '.') {
|
if (decimalPoint != '\0' && decimalPoint != '.') {
|
||||||
while (begin < end) {
|
while (begin < end) {
|
||||||
if (*begin == '.') {
|
if (*begin == '.') {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2011 Baptiste Lepilleur
|
// Copyright 2011 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
@@ -193,9 +193,9 @@ namespace Json {
|
|||||||
Exception::Exception(JSONCPP_STRING const& msg)
|
Exception::Exception(JSONCPP_STRING const& msg)
|
||||||
: msg_(msg)
|
: msg_(msg)
|
||||||
{}
|
{}
|
||||||
Exception::~Exception() throw()
|
Exception::~Exception() JSONCPP_NOEXCEPT
|
||||||
{}
|
{}
|
||||||
char const* Exception::what() const throw()
|
char const* Exception::what() const JSONCPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return msg_.c_str();
|
return msg_.c_str();
|
||||||
}
|
}
|
||||||
@@ -292,18 +292,28 @@ void Value::CZString::swap(CZString& other) {
|
|||||||
std::swap(index_, other.index_);
|
std::swap(index_, other.index_);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value::CZString& Value::CZString::operator=(CZString other) {
|
Value::CZString& Value::CZString::operator=(const CZString& other) {
|
||||||
swap(other);
|
cstr_ = other.cstr_;
|
||||||
|
index_ = other.index_;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if JSON_HAS_RVALUE_REFERENCES
|
||||||
|
Value::CZString& Value::CZString::operator=(CZString&& other) {
|
||||||
|
cstr_ = other.cstr_;
|
||||||
|
index_ = other.index_;
|
||||||
|
other.cstr_ = nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool Value::CZString::operator<(const CZString& other) const {
|
bool Value::CZString::operator<(const CZString& other) const {
|
||||||
if (!cstr_) return index_ < other.index_;
|
if (!cstr_) return index_ < other.index_;
|
||||||
//return strcmp(cstr_, other.cstr_) < 0;
|
//return strcmp(cstr_, other.cstr_) < 0;
|
||||||
// Assume both are strings.
|
// Assume both are strings.
|
||||||
unsigned this_len = this->storage_.length_;
|
unsigned this_len = this->storage_.length_;
|
||||||
unsigned other_len = other.storage_.length_;
|
unsigned other_len = other.storage_.length_;
|
||||||
unsigned min_len = std::min(this_len, other_len);
|
unsigned min_len = std::min<unsigned>(this_len, other_len);
|
||||||
JSON_ASSERT(this->cstr_ && other.cstr_);
|
JSON_ASSERT(this->cstr_ && other.cstr_);
|
||||||
int comp = memcmp(this->cstr_, other.cstr_, min_len);
|
int comp = memcmp(this->cstr_, other.cstr_, min_len);
|
||||||
if (comp < 0) return true;
|
if (comp < 0) return true;
|
||||||
@@ -343,7 +353,7 @@ bool Value::CZString::isStaticString() const { return storage_.policy_ == noDupl
|
|||||||
* This optimization is used in ValueInternalMap fast allocator.
|
* This optimization is used in ValueInternalMap fast allocator.
|
||||||
*/
|
*/
|
||||||
Value::Value(ValueType vtype) {
|
Value::Value(ValueType vtype) {
|
||||||
static char const empty[] = "";
|
static char const emptyString[] = "";
|
||||||
initBasic(vtype);
|
initBasic(vtype);
|
||||||
switch (vtype) {
|
switch (vtype) {
|
||||||
case nullValue:
|
case nullValue:
|
||||||
@@ -357,7 +367,7 @@ Value::Value(ValueType vtype) {
|
|||||||
break;
|
break;
|
||||||
case stringValue:
|
case stringValue:
|
||||||
// allocated_ == false, so this is safe.
|
// allocated_ == false, so this is safe.
|
||||||
value_.string_ = const_cast<char*>(static_cast<char const*>(empty));
|
value_.string_ = const_cast<char*>(static_cast<char const*>(emptyString));
|
||||||
break;
|
break;
|
||||||
case arrayValue:
|
case arrayValue:
|
||||||
case objectValue:
|
case objectValue:
|
||||||
@@ -398,6 +408,7 @@ Value::Value(double value) {
|
|||||||
|
|
||||||
Value::Value(const char* value) {
|
Value::Value(const char* value) {
|
||||||
initBasic(stringValue, true);
|
initBasic(stringValue, true);
|
||||||
|
JSON_ASSERT_MESSAGE(value != NULL, "Null Value Passed to Value Constructor");
|
||||||
value_.string_ = duplicateAndPrefixStringValue(value, static_cast<unsigned>(strlen(value)));
|
value_.string_ = duplicateAndPrefixStringValue(value, static_cast<unsigned>(strlen(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,6 +533,12 @@ void Value::swapPayload(Value& other) {
|
|||||||
other.allocated_ = temp2 & 0x1;
|
other.allocated_ = temp2 & 0x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Value::copyPayload(const Value& other) {
|
||||||
|
type_ = other.type_;
|
||||||
|
value_ = other.value_;
|
||||||
|
allocated_ = other.allocated_;
|
||||||
|
}
|
||||||
|
|
||||||
void Value::swap(Value& other) {
|
void Value::swap(Value& other) {
|
||||||
swapPayload(other);
|
swapPayload(other);
|
||||||
std::swap(comments_, other.comments_);
|
std::swap(comments_, other.comments_);
|
||||||
@@ -529,6 +546,13 @@ void Value::swap(Value& other) {
|
|||||||
std::swap(limit_, other.limit_);
|
std::swap(limit_, other.limit_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Value::copy(const Value& other) {
|
||||||
|
copyPayload(other);
|
||||||
|
comments_ = other.comments_;
|
||||||
|
start_ = other.start_;
|
||||||
|
limit_ = other.limit_;
|
||||||
|
}
|
||||||
|
|
||||||
ValueType Value::type() const { return type_; }
|
ValueType Value::type() const { return type_; }
|
||||||
|
|
||||||
int Value::compare(const Value& other) const {
|
int Value::compare(const Value& other) const {
|
||||||
@@ -566,7 +590,7 @@ bool Value::operator<(const Value& other) const {
|
|||||||
char const* other_str;
|
char const* other_str;
|
||||||
decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
|
decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
|
||||||
decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str);
|
decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str);
|
||||||
unsigned min_len = std::min(this_len, other_len);
|
unsigned min_len = std::min<unsigned>(this_len, other_len);
|
||||||
JSON_ASSERT(this_str && other_str);
|
JSON_ASSERT(this_str && other_str);
|
||||||
int comp = memcmp(this_str, other_str, min_len);
|
int comp = memcmp(this_str, other_str, min_len);
|
||||||
if (comp < 0) return true;
|
if (comp < 0) return true;
|
||||||
@@ -879,7 +903,7 @@ bool Value::isConvertibleTo(ValueType other) const {
|
|||||||
case nullValue:
|
case nullValue:
|
||||||
return (isNumeric() && asDouble() == 0.0) ||
|
return (isNumeric() && asDouble() == 0.0) ||
|
||||||
(type_ == booleanValue && value_.bool_ == false) ||
|
(type_ == booleanValue && value_.bool_ == false) ||
|
||||||
(type_ == stringValue && asString() == "") ||
|
(type_ == stringValue && asString().empty()) ||
|
||||||
(type_ == arrayValue && value_.map_->size() == 0) ||
|
(type_ == arrayValue && value_.map_->size() == 0) ||
|
||||||
(type_ == objectValue && value_.map_->size() == 0) ||
|
(type_ == objectValue && value_.map_->size() == 0) ||
|
||||||
type_ == nullValue;
|
type_ == nullValue;
|
||||||
@@ -938,7 +962,7 @@ bool Value::empty() const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Value::operator!() const { return isNull(); }
|
Value::operator bool() const { return ! isNull(); }
|
||||||
|
|
||||||
void Value::clear() {
|
void Value::clear() {
|
||||||
JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue ||
|
JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue ||
|
||||||
@@ -1123,6 +1147,10 @@ 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; }
|
||||||
|
|
||||||
|
#if JSON_HAS_RVALUE_REFERENCES
|
||||||
|
Value& Value::append(Value&& value) { return (*this)[size()] = std::move(value); }
|
||||||
|
#endif
|
||||||
|
|
||||||
Value Value::get(char const* key, char const* cend, Value const& defaultValue) const
|
Value Value::get(char const* key, char const* cend, Value const& defaultValue) const
|
||||||
{
|
{
|
||||||
Value const* found = find(key, cend);
|
Value const* found = find(key, cend);
|
||||||
@@ -1159,20 +1187,19 @@ bool Value::removeMember(JSONCPP_STRING const& key, Value* removed)
|
|||||||
{
|
{
|
||||||
return removeMember(key.data(), key.data() + key.length(), removed);
|
return removeMember(key.data(), key.data() + key.length(), removed);
|
||||||
}
|
}
|
||||||
Value Value::removeMember(const char* key)
|
void Value::removeMember(const char* key)
|
||||||
{
|
{
|
||||||
JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == objectValue,
|
JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == objectValue,
|
||||||
"in Json::Value::removeMember(): requires objectValue");
|
"in Json::Value::removeMember(): requires objectValue");
|
||||||
if (type_ == nullValue)
|
if (type_ == nullValue)
|
||||||
return nullSingleton();
|
return;
|
||||||
|
|
||||||
Value removed; // null
|
CZString actualKey(key, unsigned(strlen(key)), CZString::noDuplication);
|
||||||
removeMember(key, key + strlen(key), &removed);
|
value_.map_->erase(actualKey);
|
||||||
return removed; // still null if removeMember() did nothing
|
|
||||||
}
|
}
|
||||||
Value Value::removeMember(const JSONCPP_STRING& key)
|
void Value::removeMember(const JSONCPP_STRING& key)
|
||||||
{
|
{
|
||||||
return removeMember(key.c_str());
|
removeMember(key.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Value::removeIndex(ArrayIndex index, Value* removed) {
|
bool Value::removeIndex(ArrayIndex index, Value* removed) {
|
||||||
@@ -1279,7 +1306,11 @@ bool Value::isBool() const { return type_ == booleanValue; }
|
|||||||
bool Value::isInt() const {
|
bool Value::isInt() const {
|
||||||
switch (type_) {
|
switch (type_) {
|
||||||
case intValue:
|
case intValue:
|
||||||
|
#if defined(JSON_HAS_INT64)
|
||||||
return value_.int_ >= minInt && value_.int_ <= maxInt;
|
return value_.int_ >= minInt && value_.int_ <= maxInt;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
case uintValue:
|
case uintValue:
|
||||||
return value_.uint_ <= UInt(maxInt);
|
return value_.uint_ <= UInt(maxInt);
|
||||||
case realValue:
|
case realValue:
|
||||||
@@ -1294,9 +1325,17 @@ bool Value::isInt() const {
|
|||||||
bool Value::isUInt() const {
|
bool Value::isUInt() const {
|
||||||
switch (type_) {
|
switch (type_) {
|
||||||
case intValue:
|
case intValue:
|
||||||
|
#if defined(JSON_HAS_INT64)
|
||||||
return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt);
|
return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt);
|
||||||
|
#else
|
||||||
|
return value_.int_ >= 0;
|
||||||
|
#endif
|
||||||
case uintValue:
|
case uintValue:
|
||||||
|
#if defined(JSON_HAS_INT64)
|
||||||
return value_.uint_ <= maxUInt;
|
return value_.uint_ <= maxUInt;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
case realValue:
|
case realValue:
|
||||||
return value_.real_ >= 0 && value_.real_ <= maxUInt &&
|
return value_.real_ >= 0 && value_.real_ <= maxUInt &&
|
||||||
IsIntegral(value_.real_);
|
IsIntegral(value_.real_);
|
||||||
@@ -1347,16 +1386,28 @@ bool Value::isUInt64() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Value::isIntegral() const {
|
bool Value::isIntegral() const {
|
||||||
|
switch (type_) {
|
||||||
|
case intValue:
|
||||||
|
case uintValue:
|
||||||
|
return true;
|
||||||
|
case realValue:
|
||||||
#if defined(JSON_HAS_INT64)
|
#if defined(JSON_HAS_INT64)
|
||||||
return isInt64() || isUInt64();
|
// Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a
|
||||||
|
// double, so double(maxUInt64) will be rounded up to 2^64. Therefore we
|
||||||
|
// require the value to be strictly less than the limit.
|
||||||
|
return value_.real_ >= double(minInt64) && value_.real_ < maxUInt64AsDouble && IsIntegral(value_.real_);
|
||||||
#else
|
#else
|
||||||
return isInt() || isUInt();
|
return value_.real_ >= minInt && value_.real_ <= maxUInt && IsIntegral(value_.real_);
|
||||||
#endif
|
#endif // JSON_HAS_INT64
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Value::isDouble() const { return type_ == realValue || isIntegral(); }
|
bool Value::isDouble() const { return type_ == intValue || type_ == uintValue || type_ == realValue; }
|
||||||
|
|
||||||
bool Value::isNumeric() const { return isIntegral() || isDouble(); }
|
bool Value::isNumeric() const { return isDouble(); }
|
||||||
|
|
||||||
bool Value::isString() const { return type_ == stringValue; }
|
bool Value::isString() const { return type_ == stringValue; }
|
||||||
|
|
||||||
@@ -1401,8 +1452,13 @@ ptrdiff_t Value::getOffsetStart() const { return start_; }
|
|||||||
ptrdiff_t Value::getOffsetLimit() const { return limit_; }
|
ptrdiff_t Value::getOffsetLimit() const { return limit_; }
|
||||||
|
|
||||||
JSONCPP_STRING Value::toStyledString() const {
|
JSONCPP_STRING Value::toStyledString() const {
|
||||||
StyledWriter writer;
|
StreamWriterBuilder builder;
|
||||||
return writer.write(*this);
|
|
||||||
|
JSONCPP_STRING out = this->hasComment(commentBefore) ? "\n" : "";
|
||||||
|
out += Json::writeString(builder, *this);
|
||||||
|
out += "\n";
|
||||||
|
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value::const_iterator Value::begin() const {
|
Value::const_iterator Value::begin() const {
|
||||||
@@ -1481,6 +1537,7 @@ Path::Path(const JSONCPP_STRING& path,
|
|||||||
const PathArgument& a4,
|
const PathArgument& a4,
|
||||||
const PathArgument& a5) {
|
const PathArgument& a5) {
|
||||||
InArgs in;
|
InArgs in;
|
||||||
|
in.reserve(5);
|
||||||
in.push_back(&a1);
|
in.push_back(&a1);
|
||||||
in.push_back(&a2);
|
in.push_back(&a2);
|
||||||
in.push_back(&a3);
|
in.push_back(&a3);
|
||||||
@@ -1504,12 +1561,12 @@ void Path::makePath(const JSONCPP_STRING& path, const InArgs& in) {
|
|||||||
index = index * 10 + ArrayIndex(*current - '0');
|
index = index * 10 + ArrayIndex(*current - '0');
|
||||||
args_.push_back(index);
|
args_.push_back(index);
|
||||||
}
|
}
|
||||||
if (current == end || *current++ != ']')
|
if (current == end || *++current != ']')
|
||||||
invalidPath(path, int(current - path.c_str()));
|
invalidPath(path, int(current - path.c_str()));
|
||||||
} else if (*current == '%') {
|
} else if (*current == '%') {
|
||||||
addPathInArg(path, in, itInArg, PathArgument::kindKey);
|
addPathInArg(path, in, itInArg, PathArgument::kindKey);
|
||||||
++current;
|
++current;
|
||||||
} else if (*current == '.') {
|
} else if (*current == '.' || *current == ']') {
|
||||||
++current;
|
++current;
|
||||||
} else {
|
} else {
|
||||||
const char* beginName = current;
|
const char* beginName = current;
|
||||||
@@ -1529,7 +1586,7 @@ void Path::addPathInArg(const JSONCPP_STRING& /*path*/,
|
|||||||
} else if ((*itInArg)->kind_ != kind) {
|
} else if ((*itInArg)->kind_ != kind) {
|
||||||
// Error: bad argument type
|
// Error: bad argument type
|
||||||
} else {
|
} else {
|
||||||
args_.push_back(**itInArg);
|
args_.push_back(**itInArg++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1544,16 +1601,19 @@ const Value& Path::resolve(const Value& root) const {
|
|||||||
if (arg.kind_ == PathArgument::kindIndex) {
|
if (arg.kind_ == PathArgument::kindIndex) {
|
||||||
if (!node->isArray() || !node->isValidIndex(arg.index_)) {
|
if (!node->isArray() || !node->isValidIndex(arg.index_)) {
|
||||||
// Error: unable to resolve path (array value expected at position...
|
// Error: unable to resolve path (array value expected at position...
|
||||||
|
return Value::null;
|
||||||
}
|
}
|
||||||
node = &((*node)[arg.index_]);
|
node = &((*node)[arg.index_]);
|
||||||
} else if (arg.kind_ == PathArgument::kindKey) {
|
} else if (arg.kind_ == PathArgument::kindKey) {
|
||||||
if (!node->isObject()) {
|
if (!node->isObject()) {
|
||||||
// Error: unable to resolve path (object value expected at position...)
|
// Error: unable to resolve path (object value expected at position...)
|
||||||
|
return Value::null;
|
||||||
}
|
}
|
||||||
node = &((*node)[arg.key_]);
|
node = &((*node)[arg.key_]);
|
||||||
if (node == &Value::nullSingleton()) {
|
if (node == &Value::nullSingleton()) {
|
||||||
// Error: unable to resolve path (object has no member named '' at
|
// Error: unable to resolve path (object has no member named '' at
|
||||||
// position...)
|
// position...)
|
||||||
|
return Value::null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2011 Baptiste Lepilleur
|
// Copyright 2011 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
@@ -81,24 +81,6 @@ typedef std::unique_ptr<StreamWriter> StreamWriterPtr;
|
|||||||
typedef std::auto_ptr<StreamWriter> StreamWriterPtr;
|
typedef std::auto_ptr<StreamWriter> StreamWriterPtr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool containsControlCharacter(const char* str) {
|
|
||||||
while (*str) {
|
|
||||||
if (isControlCharacter(*(str++)))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool containsControlCharacter0(const char* str, unsigned len) {
|
|
||||||
char const* end = str + len;
|
|
||||||
while (end != str) {
|
|
||||||
if (isControlCharacter(*str) || 0==*str)
|
|
||||||
return true;
|
|
||||||
++str;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONCPP_STRING valueToString(LargestInt value) {
|
JSONCPP_STRING valueToString(LargestInt value) {
|
||||||
UIntToStringBuffer buffer;
|
UIntToStringBuffer buffer;
|
||||||
char* current = buffer + sizeof(buffer);
|
char* current = buffer + sizeof(buffer);
|
||||||
@@ -139,17 +121,24 @@ namespace {
|
|||||||
JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int precision) {
|
JSONCPP_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[36];
|
||||||
int len = -1;
|
int len = -1;
|
||||||
|
|
||||||
char formatString[6];
|
char formatString[15];
|
||||||
sprintf(formatString, "%%.%dg", precision);
|
snprintf(formatString, sizeof(formatString), "%%.%ug", precision);
|
||||||
|
|
||||||
// Print into the buffer. We need not request the alternative representation
|
// Print into the buffer. We need not request the alternative representation
|
||||||
// that always has a decimal point because JSON doesn't distingish the
|
// that always has a decimal point because JSON doesn't distinguish the
|
||||||
// concepts of reals and integers.
|
// concepts of reals and integers.
|
||||||
if (isfinite(value)) {
|
if (isfinite(value)) {
|
||||||
len = snprintf(buffer, sizeof(buffer), formatString, value);
|
len = snprintf(buffer, sizeof(buffer), formatString, value);
|
||||||
|
fixNumericLocale(buffer, buffer + len);
|
||||||
|
|
||||||
|
// try to ensure we preserve the fact that this was given to us as a double on input
|
||||||
|
if (!strchr(buffer, '.') && !strchr(buffer, 'e')) {
|
||||||
|
strcat(buffer, ".0");
|
||||||
|
}
|
||||||
|
|
||||||
} 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) {
|
||||||
@@ -159,10 +148,8 @@ JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int p
|
|||||||
} else {
|
} else {
|
||||||
len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "Infinity" : "1e+9999");
|
len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "Infinity" : "1e+9999");
|
||||||
}
|
}
|
||||||
// For those, we do not need to call fixNumLoc, but it is fast.
|
|
||||||
}
|
}
|
||||||
assert(len >= 0);
|
assert(len >= 0);
|
||||||
fixNumericLocale(buffer, buffer + len);
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,89 +158,103 @@ JSONCPP_STRING valueToString(double value) { return valueToString(value, false,
|
|||||||
|
|
||||||
JSONCPP_STRING valueToString(bool value) { return value ? "true" : "false"; }
|
JSONCPP_STRING valueToString(bool value) { return value ? "true" : "false"; }
|
||||||
|
|
||||||
JSONCPP_STRING valueToQuotedString(const char* value) {
|
static bool isAnyCharRequiredQuoting(char const* s, size_t n) {
|
||||||
if (value == NULL)
|
assert(s || !n);
|
||||||
return "";
|
|
||||||
// Not sure how to handle unicode...
|
|
||||||
if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL &&
|
|
||||||
!containsControlCharacter(value))
|
|
||||||
return JSONCPP_STRING("\"") + value + "\"";
|
|
||||||
// We have to walk value and escape any special characters.
|
|
||||||
// Appending to JSONCPP_STRING is not efficient, but this should be rare.
|
|
||||||
// (Note: forward slashes are *not* rare, but I am not escaping them.)
|
|
||||||
JSONCPP_STRING::size_type maxsize =
|
|
||||||
strlen(value) * 2 + 3; // allescaped+quotes+NULL
|
|
||||||
JSONCPP_STRING result;
|
|
||||||
result.reserve(maxsize); // to avoid lots of mallocs
|
|
||||||
result += "\"";
|
|
||||||
for (const char* c = value; *c != 0; ++c) {
|
|
||||||
switch (*c) {
|
|
||||||
case '\"':
|
|
||||||
result += "\\\"";
|
|
||||||
break;
|
|
||||||
case '\\':
|
|
||||||
result += "\\\\";
|
|
||||||
break;
|
|
||||||
case '\b':
|
|
||||||
result += "\\b";
|
|
||||||
break;
|
|
||||||
case '\f':
|
|
||||||
result += "\\f";
|
|
||||||
break;
|
|
||||||
case '\n':
|
|
||||||
result += "\\n";
|
|
||||||
break;
|
|
||||||
case '\r':
|
|
||||||
result += "\\r";
|
|
||||||
break;
|
|
||||||
case '\t':
|
|
||||||
result += "\\t";
|
|
||||||
break;
|
|
||||||
// case '/':
|
|
||||||
// Even though \/ is considered a legal escape in JSON, a bare
|
|
||||||
// slash is also legal, so I see no reason to escape it.
|
|
||||||
// (I hope I am not misunderstanding something.
|
|
||||||
// blep notes: actually escaping \/ may be useful in javascript to avoid </
|
|
||||||
// sequence.
|
|
||||||
// Should add a flag to allow this compatibility mode and prevent this
|
|
||||||
// sequence from occurring.
|
|
||||||
default:
|
|
||||||
if (isControlCharacter(*c)) {
|
|
||||||
JSONCPP_OSTRINGSTREAM oss;
|
|
||||||
oss << "\\u" << std::hex << std::uppercase << std::setfill('0')
|
|
||||||
<< std::setw(4) << static_cast<int>(*c);
|
|
||||||
result += oss.str();
|
|
||||||
} else {
|
|
||||||
result += *c;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result += "\"";
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://github.com/upcaste/upcaste/blob/master/src/upcore/src/cstring/strnpbrk.cpp
|
|
||||||
static char const* strnpbrk(char const* s, char const* accept, size_t n) {
|
|
||||||
assert((s || !n) && accept);
|
|
||||||
|
|
||||||
char const* const end = s + n;
|
char const* const end = s + n;
|
||||||
for (char const* cur = s; cur < end; ++cur) {
|
for (char const* cur = s; cur < end; ++cur) {
|
||||||
int const c = *cur;
|
if (*cur == '\\' || *cur == '\"' || *cur < ' '
|
||||||
for (char const* a = accept; *a; ++a) {
|
|| static_cast<unsigned char>(*cur) < 0x80)
|
||||||
if (*a == c) {
|
return true;
|
||||||
return cur;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned int utf8ToCodepoint(const char*& s, const char* e) {
|
||||||
|
const unsigned int REPLACEMENT_CHARACTER = 0xFFFD;
|
||||||
|
|
||||||
|
unsigned int firstByte = static_cast<unsigned char>(*s);
|
||||||
|
|
||||||
|
if (firstByte < 0x80)
|
||||||
|
return firstByte;
|
||||||
|
|
||||||
|
if (firstByte < 0xE0) {
|
||||||
|
if (e - s < 2)
|
||||||
|
return REPLACEMENT_CHARACTER;
|
||||||
|
|
||||||
|
unsigned int calculated = ((firstByte & 0x1F) << 6)
|
||||||
|
| (static_cast<unsigned int>(s[1]) & 0x3F);
|
||||||
|
s += 1;
|
||||||
|
// oversized encoded characters are invalid
|
||||||
|
return calculated < 0x80 ? REPLACEMENT_CHARACTER : calculated;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstByte < 0xF0) {
|
||||||
|
if (e - s < 3)
|
||||||
|
return REPLACEMENT_CHARACTER;
|
||||||
|
|
||||||
|
unsigned int calculated = ((firstByte & 0x0F) << 12)
|
||||||
|
| ((static_cast<unsigned int>(s[1]) & 0x3F) << 6)
|
||||||
|
| (static_cast<unsigned int>(s[2]) & 0x3F);
|
||||||
|
s += 2;
|
||||||
|
// surrogates aren't valid codepoints itself
|
||||||
|
// shouldn't be UTF-8 encoded
|
||||||
|
if (calculated >= 0xD800 && calculated <= 0xDFFF)
|
||||||
|
return REPLACEMENT_CHARACTER;
|
||||||
|
// oversized encoded characters are invalid
|
||||||
|
return calculated < 0x800 ? REPLACEMENT_CHARACTER : calculated;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstByte < 0xF8) {
|
||||||
|
if (e - s < 4)
|
||||||
|
return REPLACEMENT_CHARACTER;
|
||||||
|
|
||||||
|
unsigned int calculated = ((firstByte & 0x07) << 24)
|
||||||
|
| ((static_cast<unsigned int>(s[1]) & 0x3F) << 12)
|
||||||
|
| ((static_cast<unsigned int>(s[2]) & 0x3F) << 6)
|
||||||
|
| (static_cast<unsigned int>(s[3]) & 0x3F);
|
||||||
|
s += 3;
|
||||||
|
// oversized encoded characters are invalid
|
||||||
|
return calculated < 0x10000 ? REPLACEMENT_CHARACTER : calculated;
|
||||||
|
}
|
||||||
|
|
||||||
|
return REPLACEMENT_CHARACTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char hex2[] =
|
||||||
|
"000102030405060708090a0b0c0d0e0f"
|
||||||
|
"101112131415161718191a1b1c1d1e1f"
|
||||||
|
"202122232425262728292a2b2c2d2e2f"
|
||||||
|
"303132333435363738393a3b3c3d3e3f"
|
||||||
|
"404142434445464748494a4b4c4d4e4f"
|
||||||
|
"505152535455565758595a5b5c5d5e5f"
|
||||||
|
"606162636465666768696a6b6c6d6e6f"
|
||||||
|
"707172737475767778797a7b7c7d7e7f"
|
||||||
|
"808182838485868788898a8b8c8d8e8f"
|
||||||
|
"909192939495969798999a9b9c9d9e9f"
|
||||||
|
"a0a1a2a3a4a5a6a7a8a9aaabacadaeaf"
|
||||||
|
"b0b1b2b3b4b5b6b7b8b9babbbcbdbebf"
|
||||||
|
"c0c1c2c3c4c5c6c7c8c9cacbcccdcecf"
|
||||||
|
"d0d1d2d3d4d5d6d7d8d9dadbdcdddedf"
|
||||||
|
"e0e1e2e3e4e5e6e7e8e9eaebecedeeef"
|
||||||
|
"f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";
|
||||||
|
|
||||||
|
static JSONCPP_STRING toHex16Bit(unsigned int x) {
|
||||||
|
const unsigned int hi = (x >> 8) & 0xff;
|
||||||
|
const unsigned int lo = x & 0xff;
|
||||||
|
JSONCPP_STRING result(4, ' ');
|
||||||
|
result[0] = hex2[2 * hi];
|
||||||
|
result[1] = hex2[2 * hi + 1];
|
||||||
|
result[2] = hex2[2 * lo];
|
||||||
|
result[3] = hex2[2 * lo + 1];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static JSONCPP_STRING valueToQuotedStringN(const char* value, unsigned length) {
|
static JSONCPP_STRING valueToQuotedStringN(const char* value, unsigned length) {
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
return "";
|
return "";
|
||||||
// Not sure how to handle unicode...
|
|
||||||
if (strnpbrk(value, "\"\\\b\f\n\r\t", length) == NULL &&
|
if (!isAnyCharRequiredQuoting(value, length))
|
||||||
!containsControlCharacter0(value, length))
|
|
||||||
return JSONCPP_STRING("\"") + value + "\"";
|
return JSONCPP_STRING("\"") + value + "\"";
|
||||||
// We have to walk value and escape any special characters.
|
// We have to walk value and escape any special characters.
|
||||||
// Appending to JSONCPP_STRING is not efficient, but this should be rare.
|
// Appending to JSONCPP_STRING is not efficient, but this should be rare.
|
||||||
@@ -295,14 +296,24 @@ static JSONCPP_STRING valueToQuotedStringN(const char* value, unsigned length) {
|
|||||||
// sequence.
|
// sequence.
|
||||||
// Should add a flag to allow this compatibility mode and prevent this
|
// Should add a flag to allow this compatibility mode and prevent this
|
||||||
// sequence from occurring.
|
// sequence from occurring.
|
||||||
default:
|
default: {
|
||||||
if ((isControlCharacter(*c)) || (*c == 0)) {
|
unsigned int cp = utf8ToCodepoint(c, end);
|
||||||
JSONCPP_OSTRINGSTREAM oss;
|
// don't escape non-control characters
|
||||||
oss << "\\u" << std::hex << std::uppercase << std::setfill('0')
|
// (short escape sequence are applied above)
|
||||||
<< std::setw(4) << static_cast<int>(*c);
|
if (cp < 0x80 && cp >= 0x20)
|
||||||
result += oss.str();
|
result += static_cast<char>(cp);
|
||||||
} else {
|
else if (cp < 0x10000) { // codepoint is in Basic Multilingual Plane
|
||||||
result += *c;
|
result += "\\u";
|
||||||
|
result += toHex16Bit(cp);
|
||||||
|
}
|
||||||
|
else { // codepoint is not in Basic Multilingual Plane
|
||||||
|
// convert to surrogate pair first
|
||||||
|
cp -= 0x10000;
|
||||||
|
result += "\\u";
|
||||||
|
result += toHex16Bit((cp >> 10) + 0xD800);
|
||||||
|
result += "\\u";
|
||||||
|
result += toHex16Bit((cp & 0x3FF) + 0xDC00);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -311,6 +322,10 @@ static JSONCPP_STRING valueToQuotedStringN(const char* value, unsigned length) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSONCPP_STRING valueToQuotedString(const char* value) {
|
||||||
|
return valueToQuotedStringN(value, static_cast<unsigned int>(strlen(value)));
|
||||||
|
}
|
||||||
|
|
||||||
// Class Writer
|
// Class Writer
|
||||||
// //////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////
|
||||||
Writer::~Writer() {}
|
Writer::~Writer() {}
|
||||||
@@ -319,17 +334,17 @@ Writer::~Writer() {}
|
|||||||
// //////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
FastWriter::FastWriter()
|
FastWriter::FastWriter()
|
||||||
: yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false),
|
: yamlCompatibilityEnabled_(false), dropNullPlaceholders_(false),
|
||||||
omitEndingLineFeed_(false) {}
|
omitEndingLineFeed_(false) {}
|
||||||
|
|
||||||
void FastWriter::enableYAMLCompatibility() { yamlCompatiblityEnabled_ = true; }
|
void FastWriter::enableYAMLCompatibility() { yamlCompatibilityEnabled_ = true; }
|
||||||
|
|
||||||
void FastWriter::dropNullPlaceholders() { dropNullPlaceholders_ = true; }
|
void FastWriter::dropNullPlaceholders() { dropNullPlaceholders_ = true; }
|
||||||
|
|
||||||
void FastWriter::omitEndingLineFeed() { omitEndingLineFeed_ = true; }
|
void FastWriter::omitEndingLineFeed() { omitEndingLineFeed_ = true; }
|
||||||
|
|
||||||
JSONCPP_STRING FastWriter::write(const Value& root) {
|
JSONCPP_STRING FastWriter::write(const Value& root) {
|
||||||
document_ = "";
|
document_.clear();
|
||||||
writeValue(root);
|
writeValue(root);
|
||||||
if (!omitEndingLineFeed_)
|
if (!omitEndingLineFeed_)
|
||||||
document_ += "\n";
|
document_ += "\n";
|
||||||
@@ -382,7 +397,7 @@ void FastWriter::writeValue(const Value& value) {
|
|||||||
if (it != members.begin())
|
if (it != members.begin())
|
||||||
document_ += ',';
|
document_ += ',';
|
||||||
document_ += valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length()));
|
document_ += valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length()));
|
||||||
document_ += yamlCompatiblityEnabled_ ? ": " : ":";
|
document_ += yamlCompatibilityEnabled_ ? ": " : ":";
|
||||||
writeValue(value[name]);
|
writeValue(value[name]);
|
||||||
}
|
}
|
||||||
document_ += '}';
|
document_ += '}';
|
||||||
@@ -397,9 +412,9 @@ StyledWriter::StyledWriter()
|
|||||||
: rightMargin_(74), indentSize_(3), addChildValues_() {}
|
: rightMargin_(74), indentSize_(3), addChildValues_() {}
|
||||||
|
|
||||||
JSONCPP_STRING StyledWriter::write(const Value& root) {
|
JSONCPP_STRING StyledWriter::write(const Value& root) {
|
||||||
document_ = "";
|
document_.clear();
|
||||||
addChildValues_ = false;
|
addChildValues_ = false;
|
||||||
indentString_ = "";
|
indentString_.clear();
|
||||||
writeCommentBeforeValue(root);
|
writeCommentBeforeValue(root);
|
||||||
writeValue(root);
|
writeValue(root);
|
||||||
writeCommentAfterValueOnSameLine(root);
|
writeCommentAfterValueOnSameLine(root);
|
||||||
@@ -471,7 +486,7 @@ void StyledWriter::writeArrayValue(const Value& value) {
|
|||||||
if (size == 0)
|
if (size == 0)
|
||||||
pushValue("[]");
|
pushValue("[]");
|
||||||
else {
|
else {
|
||||||
bool isArrayMultiLine = isMultineArray(value);
|
bool isArrayMultiLine = isMultilineArray(value);
|
||||||
if (isArrayMultiLine) {
|
if (isArrayMultiLine) {
|
||||||
writeWithIndent("[");
|
writeWithIndent("[");
|
||||||
indent();
|
indent();
|
||||||
@@ -509,7 +524,7 @@ void StyledWriter::writeArrayValue(const Value& value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StyledWriter::isMultineArray(const Value& value) {
|
bool StyledWriter::isMultilineArray(const Value& value) {
|
||||||
ArrayIndex const size = value.size();
|
ArrayIndex const size = value.size();
|
||||||
bool isMultiLine = size * 3 >= rightMargin_;
|
bool isMultiLine = size * 3 >= rightMargin_;
|
||||||
childValues_.clear();
|
childValues_.clear();
|
||||||
@@ -577,7 +592,7 @@ void StyledWriter::writeCommentBeforeValue(const Value& root) {
|
|||||||
while (iter != comment.end()) {
|
while (iter != comment.end()) {
|
||||||
document_ += *iter;
|
document_ += *iter;
|
||||||
if (*iter == '\n' &&
|
if (*iter == '\n' &&
|
||||||
(iter != comment.end() && *(iter + 1) == '/'))
|
((iter+1) != comment.end() && *(iter + 1) == '/'))
|
||||||
writeIndent();
|
writeIndent();
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
@@ -613,7 +628,7 @@ StyledStreamWriter::StyledStreamWriter(JSONCPP_STRING indentation)
|
|||||||
void StyledStreamWriter::write(JSONCPP_OSTREAM& out, const Value& root) {
|
void StyledStreamWriter::write(JSONCPP_OSTREAM& out, const Value& root) {
|
||||||
document_ = &out;
|
document_ = &out;
|
||||||
addChildValues_ = false;
|
addChildValues_ = false;
|
||||||
indentString_ = "";
|
indentString_.clear();
|
||||||
indented_ = true;
|
indented_ = true;
|
||||||
writeCommentBeforeValue(root);
|
writeCommentBeforeValue(root);
|
||||||
if (!indented_) writeIndent();
|
if (!indented_) writeIndent();
|
||||||
@@ -688,7 +703,7 @@ void StyledStreamWriter::writeArrayValue(const Value& value) {
|
|||||||
if (size == 0)
|
if (size == 0)
|
||||||
pushValue("[]");
|
pushValue("[]");
|
||||||
else {
|
else {
|
||||||
bool isArrayMultiLine = isMultineArray(value);
|
bool isArrayMultiLine = isMultilineArray(value);
|
||||||
if (isArrayMultiLine) {
|
if (isArrayMultiLine) {
|
||||||
writeWithIndent("[");
|
writeWithIndent("[");
|
||||||
indent();
|
indent();
|
||||||
@@ -728,7 +743,7 @@ void StyledStreamWriter::writeArrayValue(const Value& value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StyledStreamWriter::isMultineArray(const Value& value) {
|
bool StyledStreamWriter::isMultilineArray(const Value& value) {
|
||||||
ArrayIndex const size = value.size();
|
ArrayIndex const size = value.size();
|
||||||
bool isMultiLine = size * 3 >= rightMargin_;
|
bool isMultiLine = size * 3 >= rightMargin_;
|
||||||
childValues_.clear();
|
childValues_.clear();
|
||||||
@@ -793,7 +808,7 @@ void StyledStreamWriter::writeCommentBeforeValue(const Value& root) {
|
|||||||
while (iter != comment.end()) {
|
while (iter != comment.end()) {
|
||||||
*document_ << *iter;
|
*document_ << *iter;
|
||||||
if (*iter == '\n' &&
|
if (*iter == '\n' &&
|
||||||
(iter != comment.end() && *(iter + 1) == '/'))
|
((iter+1) != comment.end() && *(iter + 1) == '/'))
|
||||||
// writeIndent(); // would include newline
|
// writeIndent(); // would include newline
|
||||||
*document_ << indentString_;
|
*document_ << indentString_;
|
||||||
++iter;
|
++iter;
|
||||||
@@ -845,7 +860,7 @@ struct BuiltStyledStreamWriter : public StreamWriter
|
|||||||
private:
|
private:
|
||||||
void writeValue(Value const& value);
|
void writeValue(Value const& value);
|
||||||
void writeArrayValue(Value const& value);
|
void writeArrayValue(Value const& value);
|
||||||
bool isMultineArray(Value const& value);
|
bool isMultilineArray(Value const& value);
|
||||||
void pushValue(JSONCPP_STRING const& value);
|
void pushValue(JSONCPP_STRING const& value);
|
||||||
void writeIndent();
|
void writeIndent();
|
||||||
void writeWithIndent(JSONCPP_STRING const& value);
|
void writeWithIndent(JSONCPP_STRING const& value);
|
||||||
@@ -895,7 +910,7 @@ int BuiltStyledStreamWriter::write(Value const& root, JSONCPP_OSTREAM* sout)
|
|||||||
sout_ = sout;
|
sout_ = sout;
|
||||||
addChildValues_ = false;
|
addChildValues_ = false;
|
||||||
indented_ = true;
|
indented_ = true;
|
||||||
indentString_ = "";
|
indentString_.clear();
|
||||||
writeCommentBeforeValue(root);
|
writeCommentBeforeValue(root);
|
||||||
if (!indented_) writeIndent();
|
if (!indented_) writeIndent();
|
||||||
indented_ = true;
|
indented_ = true;
|
||||||
@@ -969,7 +984,7 @@ void BuiltStyledStreamWriter::writeArrayValue(Value const& value) {
|
|||||||
if (size == 0)
|
if (size == 0)
|
||||||
pushValue("[]");
|
pushValue("[]");
|
||||||
else {
|
else {
|
||||||
bool isMultiLine = (cs_ == CommentStyle::All) || isMultineArray(value);
|
bool isMultiLine = (cs_ == CommentStyle::All) || isMultilineArray(value);
|
||||||
if (isMultiLine) {
|
if (isMultiLine) {
|
||||||
writeWithIndent("[");
|
writeWithIndent("[");
|
||||||
indent();
|
indent();
|
||||||
@@ -1011,7 +1026,7 @@ void BuiltStyledStreamWriter::writeArrayValue(Value const& value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuiltStyledStreamWriter::isMultineArray(Value const& value) {
|
bool BuiltStyledStreamWriter::isMultilineArray(Value const& value) {
|
||||||
ArrayIndex const size = value.size();
|
ArrayIndex const size = value.size();
|
||||||
bool isMultiLine = size * 3 >= rightMargin_;
|
bool isMultiLine = size * 3 >= rightMargin_;
|
||||||
childValues_.clear();
|
childValues_.clear();
|
||||||
@@ -1081,7 +1096,7 @@ void BuiltStyledStreamWriter::writeCommentBeforeValue(Value const& root) {
|
|||||||
while (iter != comment.end()) {
|
while (iter != comment.end()) {
|
||||||
*sout_ << *iter;
|
*sout_ << *iter;
|
||||||
if (*iter == '\n' &&
|
if (*iter == '\n' &&
|
||||||
(iter != comment.end() && *(iter + 1) == '/'))
|
((iter+1) != comment.end() && *(iter + 1) == '/'))
|
||||||
// writeIndent(); // would write extra newline
|
// writeIndent(); // would write extra newline
|
||||||
*sout_ << indentString_;
|
*sout_ << indentString_;
|
||||||
++iter;
|
++iter;
|
||||||
@@ -1149,10 +1164,10 @@ StreamWriter* StreamWriterBuilder::newStreamWriter() const
|
|||||||
}
|
}
|
||||||
JSONCPP_STRING nullSymbol = "null";
|
JSONCPP_STRING nullSymbol = "null";
|
||||||
if (dnp) {
|
if (dnp) {
|
||||||
nullSymbol = "";
|
nullSymbol.clear();
|
||||||
}
|
}
|
||||||
if (pre > 17) pre = 17;
|
if (pre > 17) pre = 17;
|
||||||
JSONCPP_STRING endingLineFeedSymbol = "";
|
JSONCPP_STRING endingLineFeedSymbol;
|
||||||
return new BuiltStyledStreamWriter(
|
return new BuiltStyledStreamWriter(
|
||||||
indentation, cs,
|
indentation, cs,
|
||||||
colonSymbol, nullSymbol, endingLineFeedSymbol, usf, pre);
|
colonSymbol, nullSymbol, endingLineFeedSymbol, usf, pre);
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
Import( 'env buildLibrary' )
|
|
||||||
|
|
||||||
buildLibrary( env, Split( """
|
|
||||||
json_reader.cpp
|
|
||||||
json_value.cpp
|
|
||||||
json_writer.cpp
|
|
||||||
""" ),
|
|
||||||
'json' )
|
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
@@ -398,7 +398,7 @@ void Runner::preventDialogOnCrash() {
|
|||||||
_CrtSetReportHook(&msvcrtSilentReportHook);
|
_CrtSetReportHook(&msvcrtSilentReportHook);
|
||||||
#endif // if defined(_MSC_VER)
|
#endif // if defined(_MSC_VER)
|
||||||
|
|
||||||
// @todo investiguate this handler (for buffer overflow)
|
// @todo investigate this handler (for buffer overflow)
|
||||||
// _set_security_error_handler
|
// _set_security_error_handler
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -1,8 +1,15 @@
|
|||||||
// Copyright 2007-2010 Baptiste Lepilleur
|
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
// Distributed under MIT license, or public domain if desired and
|
// Distributed under MIT license, or public domain if desired and
|
||||||
// recognized in your jurisdiction.
|
// recognized in your jurisdiction.
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#pragma warning(disable : 4996)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "jsontest.h"
|
#include "jsontest.h"
|
||||||
#include <json/config.h>
|
#include <json/config.h>
|
||||||
#include <json/json.h>
|
#include <json/json.h>
|
||||||
@@ -301,6 +308,12 @@ JSONTEST_FIXTURE(ValueTest, null) {
|
|||||||
JSONTEST_ASSERT_STRING_EQUAL("", null_.asString());
|
JSONTEST_ASSERT_STRING_EQUAL("", null_.asString());
|
||||||
|
|
||||||
JSONTEST_ASSERT_EQUAL(Json::Value::null, null_);
|
JSONTEST_ASSERT_EQUAL(Json::Value::null, null_);
|
||||||
|
|
||||||
|
// Test using a Value in a boolean context (false iff null)
|
||||||
|
JSONTEST_ASSERT_EQUAL(null_,false);
|
||||||
|
JSONTEST_ASSERT_EQUAL(object1_,true);
|
||||||
|
JSONTEST_ASSERT_EQUAL(!null_,true);
|
||||||
|
JSONTEST_ASSERT_EQUAL(!object1_,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONTEST_FIXTURE(ValueTest, strings) {
|
JSONTEST_FIXTURE(ValueTest, strings) {
|
||||||
@@ -479,7 +492,7 @@ JSONTEST_FIXTURE(ValueTest, integers) {
|
|||||||
JSONTEST_ASSERT_EQUAL(0.0, val.asDouble());
|
JSONTEST_ASSERT_EQUAL(0.0, val.asDouble());
|
||||||
JSONTEST_ASSERT_EQUAL(0.0, val.asFloat());
|
JSONTEST_ASSERT_EQUAL(0.0, val.asFloat());
|
||||||
JSONTEST_ASSERT_EQUAL(false, val.asBool());
|
JSONTEST_ASSERT_EQUAL(false, val.asBool());
|
||||||
JSONTEST_ASSERT_STRING_EQUAL("0", val.asString());
|
JSONTEST_ASSERT_STRING_EQUAL("0.0", val.asString());
|
||||||
|
|
||||||
// Zero (signed constructor arg)
|
// Zero (signed constructor arg)
|
||||||
val = Json::Value(0);
|
val = Json::Value(0);
|
||||||
@@ -563,7 +576,7 @@ JSONTEST_FIXTURE(ValueTest, integers) {
|
|||||||
JSONTEST_ASSERT_EQUAL(0.0, val.asDouble());
|
JSONTEST_ASSERT_EQUAL(0.0, val.asDouble());
|
||||||
JSONTEST_ASSERT_EQUAL(0.0, val.asFloat());
|
JSONTEST_ASSERT_EQUAL(0.0, val.asFloat());
|
||||||
JSONTEST_ASSERT_EQUAL(false, val.asBool());
|
JSONTEST_ASSERT_EQUAL(false, val.asBool());
|
||||||
JSONTEST_ASSERT_STRING_EQUAL("0", val.asString());
|
JSONTEST_ASSERT_STRING_EQUAL("0.0", val.asString());
|
||||||
|
|
||||||
// 2^20 (signed constructor arg)
|
// 2^20 (signed constructor arg)
|
||||||
val = Json::Value(1 << 20);
|
val = Json::Value(1 << 20);
|
||||||
@@ -646,7 +659,7 @@ JSONTEST_FIXTURE(ValueTest, integers) {
|
|||||||
JSONTEST_ASSERT_EQUAL((1 << 20), val.asDouble());
|
JSONTEST_ASSERT_EQUAL((1 << 20), val.asDouble());
|
||||||
JSONTEST_ASSERT_EQUAL((1 << 20), val.asFloat());
|
JSONTEST_ASSERT_EQUAL((1 << 20), val.asFloat());
|
||||||
JSONTEST_ASSERT_EQUAL(true, val.asBool());
|
JSONTEST_ASSERT_EQUAL(true, val.asBool());
|
||||||
JSONTEST_ASSERT_STRING_EQUAL("1048576",
|
JSONTEST_ASSERT_STRING_EQUAL("1048576.0",
|
||||||
normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
|
normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
|
||||||
|
|
||||||
// -2^20
|
// -2^20
|
||||||
@@ -887,7 +900,7 @@ JSONTEST_FIXTURE(ValueTest, integers) {
|
|||||||
JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asDouble());
|
JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asDouble());
|
||||||
JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asFloat());
|
JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asFloat());
|
||||||
JSONTEST_ASSERT_EQUAL(true, val.asBool());
|
JSONTEST_ASSERT_EQUAL(true, val.asBool());
|
||||||
JSONTEST_ASSERT_STRING_EQUAL("1099511627776",
|
JSONTEST_ASSERT_STRING_EQUAL("1099511627776.0",
|
||||||
normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
|
normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
|
||||||
|
|
||||||
// -2^40
|
// -2^40
|
||||||
@@ -1259,7 +1272,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.0f), val.asFloat());
|
JSONTEST_ASSERT_EQUAL(float(2199023255552000.0f), val.asFloat());
|
||||||
JSONTEST_ASSERT_STRING_EQUAL("2199023255552000",
|
JSONTEST_ASSERT_STRING_EQUAL("2199023255552000.0",
|
||||||
normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
|
normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
|
||||||
|
|
||||||
// A very large floating point number.
|
// A very large floating point number.
|
||||||
@@ -2033,7 +2046,7 @@ JSONTEST_FIXTURE(CharReaderFailIfExtraTest, issue164) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
JSONTEST_FIXTURE(CharReaderFailIfExtraTest, issue107) {
|
JSONTEST_FIXTURE(CharReaderFailIfExtraTest, issue107) {
|
||||||
// This is interpretted as an int value followed by a colon.
|
// This is interpreted as an int value followed by a colon.
|
||||||
Json::CharReaderBuilder b;
|
Json::CharReaderBuilder b;
|
||||||
Json::Value root;
|
Json::Value root;
|
||||||
char const doc[] =
|
char const doc[] =
|
||||||
@@ -2587,3 +2600,7 @@ int main(int argc, const char* argv[]) {
|
|||||||
|
|
||||||
return runner.runCommandLine(argc, argv);
|
return runner.runCommandLine(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
Import( 'env_testing buildUnitTests' )
|
|
||||||
|
|
||||||
buildUnitTests( env_testing, Split( """
|
|
||||||
main.cpp
|
|
||||||
jsontest.cpp
|
|
||||||
""" ),
|
|
||||||
'test_lib_json' )
|
|
||||||
|
|
||||||
# For 'check' to work, 'libs' must be built first.
|
|
||||||
env_testing.Depends('test_lib_json', '#libs')
|
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2007 Baptiste Lepilleur
|
# Copyright 2007 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
# Distributed under MIT license, or public domain if desired and
|
# Distributed under MIT license, or public domain if desired and
|
||||||
# recognized in your jurisdiction.
|
# recognized in your jurisdiction.
|
||||||
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
1
test/data/fail_test_stack_limit.json
Normal file
1
test/data/fail_test_stack_limit.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2007 Baptiste Lepilleur
|
# Copyright 2007 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
# Distributed under MIT license, or public domain if desired and
|
# Distributed under MIT license, or public domain if desired and
|
||||||
# recognized in your jurisdiction.
|
# recognized in your jurisdiction.
|
||||||
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2007 Baptiste Lepilleur
|
# Copyright 2007 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
# Distributed under MIT license, or public domain if desired and
|
# Distributed under MIT license, or public domain if desired and
|
||||||
# recognized in your jurisdiction.
|
# recognized in your jurisdiction.
|
||||||
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2007 Baptiste Lepilleur
|
# Copyright 2007 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
# Distributed under MIT license, or public domain if desired and
|
# Distributed under MIT license, or public domain if desired and
|
||||||
# recognized in your jurisdiction.
|
# recognized in your jurisdiction.
|
||||||
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2009 Baptiste Lepilleur
|
# Copyright 2009 Baptiste Lepilleur and The JsonCpp Authors
|
||||||
# Distributed under MIT license, or public domain if desired and
|
# Distributed under MIT license, or public domain if desired and
|
||||||
# recognized in your jurisdiction.
|
# recognized in your jurisdiction.
|
||||||
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
||||||
|
16
travis.sh
16
travis.sh
@@ -17,15 +17,7 @@ set -vex
|
|||||||
|
|
||||||
env | sort
|
env | sort
|
||||||
|
|
||||||
cmake -DJSONCPP_WITH_CMAKE_PACKAGE=$CMAKE_PKG -DBUILD_SHARED_LIBS=$SHARED_LIB -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_VERBOSE_MAKEFILE=$VERBOSE_MAKE .
|
meson --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} . build-${LIB_TYPE}
|
||||||
make
|
ninja -v -C build-${LIB_TYPE}
|
||||||
cmake -DJSONCPP_WITH_CMAKE_PACKAGE=$CMAKE_PKG -DBUILD_SHARED_LIBS=$SHARED_LIB -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_VERBOSE_MAKEFILE=$VERBOSE_MAKE -DJSONCPP_USE_SECURE_MEMORY=1 .
|
ninja -v -C build-${LIB_TYPE} test
|
||||||
make
|
rm -r build-${LIB_TYPE}
|
||||||
|
|
||||||
# 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