+++ /dev/null
-/build/
-*.pyc
-*.swp
-*.actual
-*.actual-rewrite
-*.process-output
-*.rewrite
-/bin/
-/buildscons/
-/libs/
-/doc/doxyfile
-/dist/
-#/version
-#/include/json/version.h
-
-# MSVC project files:
-*.sln
-*.vcxproj
-*.filters
-*.user
-*.sdf
-*.opensdf
-*.suo
-
-# MSVC build files:
-*.lib
-*.obj
-*.tlog/
-*.pdb
-
-# CMake-generated files:
-CMakeFiles/
-CTestTestFile.cmake
-cmake_install.cmake
-pkg-config/jsoncpp.pc
-jsoncpp_lib_static.dir/
PROJECT(jsoncpp)
ENABLE_TESTING()
-OPTION(JSONCPP_WITH_TESTS "Compile and (for jsoncpp_check) run JsonCpp test executables" OFF)
-OPTION(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" OFF)
+OPTION(JSONCPP_WITH_TESTS "Compile and (for jsoncpp_check) run JsonCpp test executables" ON)
+OPTION(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" ON)
OPTION(JSONCPP_WITH_WARNING_AS_ERROR "Force compilation to fail if a warning occurs" OFF)
OPTION(JSONCPP_WITH_STRICT_ISO "Issue all the warnings demanded by strict ISO C and ISO C++" ON)
OPTION(JSONCPP_WITH_PKGCONFIG_SUPPORT "Generate and install .pc files" ON)
OPTION(JSONCPP_WITH_CMAKE_PACKAGE "Generate and install cmake package files" OFF)
-OPTION(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." ON)
-OPTION(BUILD_STATIC_LIBS "Build jsoncpp_lib static library." OFF)
+OPTION(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." OFF)
+OPTION(BUILD_STATIC_LIBS "Build jsoncpp_lib static library." ON)
# Ensures that CMAKE_BUILD_TYPE is visible in cmake-gui on Unix
IF(NOT WIN32)
ENDIF()
ENDIF()
+# Enable runtime search path support for dynamic libraries on OSX
+IF(APPLE)
+ SET(CMAKE_MACOSX_RPATH 1)
+ENDIF()
+
SET(DEBUG_LIBNAME_SUFFIX "" CACHE STRING "Optional suffix to append to the library name for a debug build")
SET(LIB_SUFFIX "" CACHE STRING "Optional arch-dependent suffix for the library installation directory")
SET(RUNTIME_INSTALL_DIR bin
CACHE PATH "Install dir for executables and dlls")
-SET(ARCHIVE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
+SET(ARCHIVE_INSTALL_DIR lib${LIB_SUFFIX}
CACHE PATH "Install dir for static libraries")
-SET(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
+SET(LIBRARY_INSTALL_DIR lib${LIB_SUFFIX}
CACHE PATH "Install dir for shared libraries")
-SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include
+SET(INCLUDE_INSTALL_DIR include
CACHE PATH "Install dir for headers")
SET(PACKAGE_INSTALL_DIR lib${LIB_SUFFIX}/cmake
CACHE PATH "Install dir for cmake package config files")
#SET( JSONCPP_VERSION_MAJOR X )
#SET( JSONCPP_VERSION_MINOR Y )
#SET( JSONCPP_VERSION_PATCH Z )
-SET( JSONCPP_VERSION 1.6.5 )
+SET( JSONCPP_VERSION 1.7.7 )
jsoncpp_parse_version( ${JSONCPP_VERSION} JSONCPP_VERSION )
#IF(NOT JSONCPP_VERSION_FOUND)
# MESSAGE(FATAL_ERROR "Failed to parse version string properly. Expect X.Y.Z")
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# using regular Clang or AppleClang
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wno-sign-conversion")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Werror=conversion -Werror=sign-compare")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using GCC
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)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=conversion -pedantic")
+ endif ()
+elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
+ # using Intel compiler
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wextra -Werror=conversion")
+
+ if (JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
endif ()
endif()
+++ /dev/null
-Introduction
-------------
-
-[JSON][json-org] is a lightweight data-interchange format. It can represent
-numbers, strings, ordered sequences of values, and collections of name/value
-pairs.
-
-[json-org]: http://json.org/
-
-[JsonCpp][] is a C++ library that allows manipulating JSON values, including
-serialization and deserialization to and from strings. It can also preserve
-existing comment in unserialization/serialization steps, making it a convenient
-format to store user input files.
-
-[JsonCpp]: http://open-source-parsers.github.io/jsoncpp-docs/doxygen/index.html
-
-## A note on backward-compatibility
-* `1.y.z` is built with C++11.
-* `0.y.z` can be used with older compilers.
-* Major versions maintain binary-compatibility.
-
-# Using JsonCpp in your project
------------------------------
-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
-should be included as follow:
-
- #include <json/json.h>
-
-If JsonCpp was built as a dynamic library on Windows, then your project needs to
-define the macro `JSON_DLL`.
-
-Generating amalgamated source and header
-----------------------------------------
-JsonCpp is provided with a script to generate a single header and a single
-source file to ease inclusion into an existing project. The amalgamated source
-can be generated at any time by running the following command from the
-top-directory (this requires Python 2.6):
-
- python amalgamate.py
-
-It is possible to specify header name. See the `-h` option for detail.
-
-By default, the following files are generated:
-* `dist/jsoncpp.cpp`: source file that needs to be added to your project.
-* `dist/json/json.h`: corresponding header file for use in your project. It is
- equivalent to including `json/json.h` in non-amalgamated source. This header
- only depends on standard headers.
-* `dist/json/json-forwards.h`: header that provides forward declaration of all
- JsonCpp types.
-
-The amalgamated sources are generated by concatenating JsonCpp source in the
-correct order and defining the macro `JSON_IS_AMALGAMATION` to prevent inclusion
-of other headers.
-
-# Contributing to JsonCpp
-
-Building and testing with CMake
--------------------------------
-[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.
-
-In the instructions below, replace `path/to/jsontest` with the path of the
-`jsontest` executable that was compiled on your platform.
-
- cd test
- # This will run the Reader/Writer tests
- python runjsontests.py path/to/jsontest
-
- # This will run the Reader/Writer tests, using JSONChecker test suite
- # (http://www.json.org/JSON_checker/).
- # Notes: not all tests pass: JsonCpp is too lenient (for example,
- # it allows an integer to start with '0'). The goal is to improve
- # strict mode parsing to get all tests to pass.
- python runjsontests.py --with-json-checker path/to/jsontest
-
- # This will run the unit tests (mostly Value)
- python rununittests.py path/to/test_lib_json
-
- # You can run the tests using valgrind:
- python rununittests.py --valgrind path/to/test_lib_json
-
-## Running the tests using scons
-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:
-
- python doxybuild.py --doxygen=$(which doxygen) --open --with-dot
-
-See `doxybuild.py --help` for options.
-
-Adding a reader/writer test
----------------------------
-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.expected` file, that contains a flatened representation of the
- input document.
-
-The `TESTNAME.expected` file format is as follows:
-
-* each line represents a JSON element of the element tree represented by the
- input document.
-* 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.
- represented by either `[]` or `{}`).
-* 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`.
-
-See the examples `test_complex_01.json` and `test_complex_01.expected` to better
-understand element paths.
-
-Understanding reader/writer test output
----------------------------------------
-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:
-
-* `test_complex_01.json`: input JSON document.
-* `test_complex_01.expected`: flattened JSON element tree used to check if
- parsing was corrected.
-* `test_complex_01.actual`: flattened JSON element tree produced by `jsontest`
- from reading `test_complex_01.json`.
-* `test_complex_01.rewrite`: JSON document written by `jsontest` using the
- `Json::Value` parsed from `test_complex_01.json` and serialized using
- `Json::StyledWritter`.
-* `test_complex_01.actual-rewrite`: flattened JSON element tree produced by
- `jsontest` from reading `test_complex_01.rewrite`.
-* `test_complex_01.process-output`: `jsontest` output, typically useful for
- understanding parsing errors.
-
-License
--------
-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.
+++ /dev/null
-"""Amalgate json-cpp library sources into a single source and header file.
-
-Requires Python 2.6
-
-Example of invocation (must be invoked from json-cpp top directory):
-python amalgate.py
-"""
-import os
-import os.path
-import sys
-
-class AmalagatedFile:
- def __init__( self, top_dir ):
- self.top_dir = top_dir
- self.blocks = []
-
- def add_text( self, text ):
- if not text.endswith( '\n' ):
- text += '\n'
- self.blocks.append( text )
-
- def add_file( self, relative_input_path, wrap_in_comment=False ):
- def add_marker( prefix ):
- self.add_text( '' )
- self.add_text( '// ' + '/'*70 )
- self.add_text( '// %s of content of file: %s' % (prefix, relative_input_path.replace('\\','/')) )
- self.add_text( '// ' + '/'*70 )
- self.add_text( '' )
- add_marker( 'Beginning' )
- f = open( os.path.join( self.top_dir, relative_input_path ), 'rt' )
- content = f.read()
- if wrap_in_comment:
- content = '/*\n' + content + '\n*/'
- self.add_text( content )
- f.close()
- add_marker( 'End' )
- self.add_text( '\n\n\n\n' )
-
- def get_value( self ):
- return ''.join( self.blocks ).replace('\r\n','\n')
-
- def write_to( self, output_path ):
- output_dir = os.path.dirname( output_path )
- if output_dir and not os.path.isdir( output_dir ):
- os.makedirs( output_dir )
- f = open( output_path, 'wb' )
- f.write( self.get_value() )
- f.close()
-
-def amalgate_source( source_top_dir=None,
- target_source_path=None,
- header_include_path=None ):
- """Produces amalgated source.
- Parameters:
- source_top_dir: top-directory
- target_source_path: output .cpp path
- header_include_path: generated header path relative to target_source_path.
- """
- print 'Amalgating header...'
- header = AmalagatedFile( source_top_dir )
- header.add_text( '/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/).' )
- header.add_text( '/// It is intented to be used with #include <%s>' % header_include_path )
- header.add_file( 'LICENSE', wrap_in_comment=True )
- header.add_text( '#ifndef JSON_AMALGATED_H_INCLUDED' )
- header.add_text( '# define JSON_AMALGATED_H_INCLUDED' )
- header.add_text( '/// If defined, indicates that the source file is amalgated' )
- header.add_text( '/// to prevent private header inclusion.' )
- header.add_text( '#define JSON_IS_AMALGATED' )
- header.add_file( 'include/json/config.h' )
- header.add_file( 'include/json/forwards.h' )
- header.add_file( 'include/json/features.h' )
- header.add_file( 'include/json/value.h' )
- header.add_file( 'include/json/reader.h' )
- header.add_file( 'include/json/writer.h' )
- header.add_text( '#endif //ifndef JSON_AMALGATED_H_INCLUDED' )
-
- target_header_path = os.path.join( os.path.dirname(target_source_path), header_include_path )
- print 'Writing amalgated header to %r' % target_header_path
- header.write_to( target_header_path )
-
- base, ext = os.path.splitext( header_include_path )
- forward_header_include_path = base + '-forwards' + ext
- print 'Amalgating forward header...'
- header = AmalagatedFile( source_top_dir )
- header.add_text( '/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/).' )
- header.add_text( '/// It is intented to be used with #include <%s>' % forward_header_include_path )
- header.add_text( '/// This header provides forward declaration for all JsonCpp types.' )
- header.add_file( 'LICENSE', wrap_in_comment=True )
- header.add_text( '#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED' )
- header.add_text( '# define JSON_FORWARD_AMALGATED_H_INCLUDED' )
- header.add_text( '/// If defined, indicates that the source file is amalgated' )
- header.add_text( '/// to prevent private header inclusion.' )
- header.add_text( '#define JSON_IS_AMALGATED' )
- header.add_file( 'include/json/config.h' )
- header.add_file( 'include/json/forwards.h' )
- header.add_text( '#endif //ifndef JSON_FORWARD_AMALGATED_H_INCLUDED' )
-
- target_forward_header_path = os.path.join( os.path.dirname(target_source_path),
- forward_header_include_path )
- print 'Writing amalgated forward header to %r' % target_forward_header_path
- header.write_to( target_forward_header_path )
-
- print 'Amalgating source...'
- source = AmalagatedFile( source_top_dir )
- source.add_text( '/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/).' )
- source.add_text( '/// It is intented to be used with #include <%s>' % header_include_path )
- source.add_file( 'LICENSE', wrap_in_comment=True )
- source.add_text( '' )
- source.add_text( '#include <%s>' % header_include_path )
- source.add_text( '' )
- source.add_file( 'src/lib_json\json_tool.h' )
- source.add_file( 'src/lib_json\json_reader.cpp' )
- source.add_file( 'src/lib_json\json_batchallocator.h' )
- source.add_file( 'src/lib_json\json_valueiterator.inl' )
- source.add_file( 'src/lib_json\json_value.cpp' )
- source.add_file( 'src/lib_json\json_writer.cpp' )
-
- print 'Writing amalgated source to %r' % target_source_path
- source.write_to( target_source_path )
-
-def main():
- usage = """%prog [options]
-Generate a single amalgated source and header file from the sources.
-"""
- from optparse import OptionParser
- parser = OptionParser(usage=usage)
- parser.allow_interspersed_args = False
- parser.add_option('-s', '--source', dest="target_source_path", action='store', default='dist/jsoncpp.cpp',
- help="""Output .cpp source path. [Default: %default]""")
- 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]""")
- parser.add_option('-t', '--top-dir', dest="top_dir", action='store', default=os.getcwd(),
- help="""Source top-directory. [Default: %default]""")
- parser.enable_interspersed_args()
- options, args = parser.parse_args()
-
- msg = amalgate_source( source_top_dir=options.top_dir,
- target_source_path=options.target_source_path,
- header_include_path=options.header_include_path )
- if msg:
- sys.stderr.write( msg + '\n' )
- sys.exit( 1 )
- else:
- print 'Source succesfully amalagated'
-
-if __name__ == '__main__':
- main()
+++ /dev/null
-VERSION='0.1.0'
-APPNAME='CppUnit2'
-srcdir = '.'
-blddir = 'build'
-
-import Options
-import Logs
-import UnitTest
-import Utils
-import os.path
-import sys
-import glob
-
-CPPUT_EXAMPLES = '''
- checking_assertions
- ignore_failure_demo
- input_test
- light_fixture
- log_demo
- parametrized_test
- stringize_demo
- test_function
- '''.split()
-
-BROKEN_CPPUT_EXAMPLES = '''
- input_based_test
- opentest_demo
- table_fixture
- '''.split()
-
-def _get_example_dirs():
- return [ os.path.join( 'examples', d )
- for d in CPPUT_EXAMPLES ]
-
-def _get_main_script_dir():
- """Gets the path of the directory containing this script."""
- # The main script path is only valid once the it has been executed, hence this can not be a global var.
- assert Utils.g_module is not None
- return os.path.split( Utils.g_module.root_path )[0]
-
-def _fix_import_path():
- """Adds the main script directory to be able to import waftools modules."""
- import_dir = _get_main_script_dir()
- if import_dir not in sys.path:
- sys.path.append( import_dir )
-
-def _get_tool_dir():
- return os.path.join( main_script_dir, 'waftools' )
-
-def set_options(opt):
- """Always called first during the build."""
- _fix_import_path()
- import waftools.log_output
- waftools.log_output.set_options( opt )
-
- # Adds command-line options for compiler
- opt.tool_options('compiler_cxx')
-
- # from compiler_cxx tools, set_options
- import Tools.ccroot as ccroot
- opt.add_option('-d', '--debug-level',
- action = 'store',
- default = ccroot.DEBUG_LEVELS.RELEASE,
- help = "Specify the debug level, does nothing if CXXFLAGS is set in the environment. [Allowed Values: '%s'] " % "', '".join(ccroot.DEBUG_LEVELS.ALL) +
- "[default: %default]",
- choices = ccroot.DEBUG_LEVELS.ALL,
- dest = 'debug_level')
-
-def init():
- """Called set_options() once the command-line has been parsed.
- Command-line options value are accessed through Options.options.
- """
- import waftools.log_output
- waftools.log_output.init()
-
-
-def configure(conf):
- # There is a link issue with msvc 9!
- conf.env['MSVC_VERSIONS'] = ['msvc 8.0']
-
- # CXX=g++-3.0 ./waf.py configure will use g++-3.0 instead of 'g++'
- conf.check_tool('compiler_cxx')
-
- # Select debug/optimize flags
- debug_level = Options.options.debug_level.upper()
- conf.env.append_unique('CXXFLAGS', conf.env['CXXFLAGS_' + debug_level])
-
- compiler = conf.env['COMPILER_CXX']
- if compiler == 'msvc': # Microsoft Visual Studio specifics
- # Select run-time library variant
- if 'DEBUG' in debug_level:
- crt_variant = 'MULTITHREADED_DLL_DBG'
- else:
- crt_variant = 'MULTITHREADED_DLL'
- # MULTITHREADED, MULTITHREADED_DLL, MULTITHREADED_DBG, MULTITHREADED_DLL_DBG
- conf.env.append_unique('CPPFLAGS', conf.env['CPPFLAGS_CRT_' + crt_variant])
- conf.env.append_unique('CPPDEFINES', conf.env['CPPDEFINES_CRT_' + crt_variant])
-
- ## batched builds can be enabled by including the module optim_cc
- # conf.check_tool('batched_cc')
-
-
-# WAF command:
-
-def build(bld):
- # process subfolders from here
- bld.add_subdirs('''src/cpptl
- src/cpput
- src/cpputtest''')
-
- bld.add_subdirs( _get_example_dirs() )
-
-def gen_examples_wscript(ctx):
- for example_dir in _get_example_dirs():
- wscript_path = os.path.join( example_dir, 'wscript_build' )
- sources = glob.glob( os.path.join( example_dir, '*.cpp' ) )
- Logs.info( 'Generating "%s"' % wscript_path )
- open( wscript_path, 'wb' ).write( """\
-#! /usr/bin/env python
-# encoding: utf-8
-# Baptiste Lepilleur, 2009
-
-bld.new_task_gen(
- features = 'cxx cprogram',
- source = '''%(sources)s''',
- includes = '../.. ../../include', # for examples/common
- uselib_local = 'cpptl cpput',
- name = 'example_%(name)s',
- target = 'example_%(name)s' )
-""" % {
- 'sources': ' '.join( [os.path.basename(s) for s in sources] ),
- 'name': os.path.basename( example_dir )
- } )
-
-def _fix_python_source( path, is_dry_run = True, verbose = True ):
- """Makes sure that all sources have unix EOL and replace tabs with 4 spaces."""
- from waftools import reindent
- if not os.path.isfile( path ):
- raise ValueError( 'Path "%s" is not a file' % path )
- try:
- f = open(path, 'rb')
- except IOError, msg:
- print >> sys.stderr, "%s: I/O Error: %s" % (file, str(msg))
- return False
-
- if verbose:
- print '%s =>' % path,
- try:
- r = reindent.Reindenter(f)
- finally:
- f.close()
- if r.run(): # File need to be fixed ?
- if not is_dry_run:
- f = open(path, "wb")
- try:
- r.write(f)
- finally:
- f.close()
- if verbose:
- print is_dry_run and ' NEED FIX' or ' FIXED'
- elif verbose:
- print ' OK'
- return True
-
-def _fix_source_eol( path, is_dry_run = True, verbose = True, eol = '\n' ):
- """Makes sure that all sources have the specified eol sequence (default: unix)."""
- if not os.path.isfile( path ):
- raise ValueError( 'Path "%s" is not a file' % path )
- try:
- f = open(path, 'rb')
- except IOError, msg:
- print >> sys.stderr, "%s: I/O Error: %s" % (file, str(msg))
- return False
- try:
- raw_lines = f.readlines()
- finally:
- f.close()
- fixed_lines = [line.rstrip('\r\n') + eol for line in raw_lines]
- if raw_lines != fixed_lines:
- print '%s =>' % path,
- if not is_dry_run:
- f = open(path, "wb")
- try:
- f.writelines(fixed_lines)
- finally:
- f.close()
- if verbose:
- print is_dry_run and ' NEED FIX' or ' FIXED'
- return True
-
-
-
-def _do_fix( is_dry_run = True ):
- from waftools import antglob
- python_sources = antglob.glob( '.',
- includes = '**/*.py **/wscript **/wscript_build',
- excludes = antglob.default_excludes + './waf.py',
- prune_dirs = antglob.prune_dirs + 'waf-* ./build' )
- for path in python_sources:
- _fix_python_source( path, is_dry_run )
-
- cpp_sources = antglob.glob( '.',
- includes = '**/*.cpp **/*.h **/*.inl',
- prune_dirs = antglob.prune_dirs + 'waf-* ./build' )
- for path in cpp_sources:
- _fix_source_eol( path, is_dry_run )
-
-
-def dry_fix(context):
- _do_fix( is_dry_run = True )
-
-def fix(context):
- _do_fix( is_dry_run = False )
-
-def shutdown():
- pass
-
-def check(context):
- # Unit tests are run when "check" target is used
- ut = UnitTest.unit_test()
- ut.change_to_testfile_dir = True
- ut.want_to_see_test_output = True
- ut.want_to_see_test_error = True
- ut.run()
- ut.print_results()
#endif // defined(_MSC_VER)
+// In c++11 the override keyword allows you to explicity define that a function
+// is intended to override the base-class version. This makes the code more
+// managable and fixes a set of common hard-to-find bugs.
+#if __cplusplus >= 201103L
+# define JSONCPP_OVERRIDE override
+#elif defined(_MSC_VER) && _MSC_VER > 1600
+# define JSONCPP_OVERRIDE override
+#else
+# define JSONCPP_OVERRIDE
+#endif
#ifndef JSON_HAS_RVALUE_REFERENCES
Json::Value settings_;
CharReaderBuilder();
- ~CharReaderBuilder() override;
+ ~CharReaderBuilder() JSONCPP_OVERRIDE;
- CharReader* newCharReader() const override;
+ CharReader* newCharReader() const JSONCPP_OVERRIDE;
/** \return true if 'settings' are legal and consistent;
* otherwise, indicate bad settings via 'invalid'.
*/
class JSON_API Exception : public std::exception {
public:
- Exception(std::string const& msg);
- ~Exception() throw() override;
- char const* what() const throw() override;
+ Exception(JSONCPP_STRING const& msg);
+ ~Exception() throw() JSONCPP_OVERRIDE;
+ char const* what() const throw() JSONCPP_OVERRIDE;
protected:
- std::string msg_;
+ JSONCPP_STRING msg_;
};
/** Exceptions which the user cannot easily avoid.
*/
class JSON_API RuntimeError : public Exception {
public:
- RuntimeError(std::string const& msg);
+ RuntimeError(JSONCPP_STRING const& msg);
};
/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
*/
class JSON_API LogicError : public Exception {
public:
- LogicError(std::string const& msg);
+ LogicError(JSONCPP_STRING const& msg);
};
/// used internally
/// Same as removeMember(const char*)
/// \param key may contain embedded nulls.
/// \deprecated
- Value removeMember(const std::string& key);
+ Value removeMember(const JSONCPP_STRING& key);
/// Same as removeMember(const char* begin, const char* end, Value* removed),
/// but 'key' is null-terminated.
bool removeMember(const char* key, Value* removed);
\param key may contain embedded nulls.
\return true iff removed (no exceptions)
*/
- bool removeMember(std::string const& key, Value* removed);
- /// Same as removeMember(std::string const& key, Value* removed)
+ bool removeMember(JSONCPP_STRING const& key, Value* removed);
+ /// Same as removeMember(JSONCPP_STRING const& key, Value* removed)
bool removeMember(const char* begin, const char* end, Value* removed);
/** \brief Remove the indexed array element.
bool isMember(const char* key) const;
/// Return true if the object has a member named key.
/// \param key may contain embedded nulls.
- bool isMember(const std::string& key) const;
- /// Same as isMember(std::string const& key)const
+ bool isMember(const JSONCPP_STRING& key) const;
+ /// Same as isMember(JSONCPP_STRING const& key)const
bool isMember(const char* begin, const char* end) const;
#ifdef JSON_USE_CPPTL
/// Return true if the object has a member named key.
#ifndef JSON_VERSION_H_INCLUDED
# define JSON_VERSION_H_INCLUDED
-# define JSONCPP_VERSION_STRING "1.6.5"
+# define JSONCPP_VERSION_STRING "1.7.7"
# define JSONCPP_VERSION_MAJOR 1
-# define JSONCPP_VERSION_MINOR 6
-# define JSONCPP_VERSION_PATCH 5
+# define JSONCPP_VERSION_MINOR 7
+# define JSONCPP_VERSION_PATCH 7
# define JSONCPP_VERSION_QUALIFIER
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
Json::Value settings_;
StreamWriterBuilder();
- ~StreamWriterBuilder() override;
+ ~StreamWriterBuilder() JSONCPP_OVERRIDE;
/**
* \throw std::exception if something goes wrong (e.g. invalid settings)
*/
- StreamWriter* newStreamWriter() const override;
+ StreamWriter* newStreamWriter() const JSONCPP_OVERRIDE;
/** \return true if 'settings' are legal and consistent;
* otherwise, indicate bad settings via 'invalid'.
public:
FastWriter();
- ~FastWriter() override {}
+ ~FastWriter() JSONCPP_OVERRIDE {}
void enableYAMLCompatibility();
void omitEndingLineFeed();
public: // overridden from Writer
- std::string write(const Value& root) override;
+ JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
private:
void writeValue(const Value& value);
class JSON_API StyledWriter : public Writer {
public:
StyledWriter();
- ~StyledWriter() override {}
+ ~StyledWriter() JSONCPP_OVERRIDE {}
public: // overridden from Writer
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
* \param root Value to serialize.
* \return String containing the JSON document that represents the root value.
*/
- std::string write(const Value& root) override;
+ JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
private:
void writeValue(const Value& value);
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="jsontest"
- ProjectGUID="{25AF2DD2-D396-4668-B188-488C33B8E620}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../build/vs71/debug/jsontest"
- IntermediateDirectory="../../build/vs71/debug/jsontest"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/jsontest.exe"
- LinkIncremental="2"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/jsontest.pdb"
- SubSystem="1"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../build/vs71/release/jsontest"
- IntermediateDirectory="../../build/vs71/release/jsontest"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/jsontest.exe"
- LinkIncremental="1"
- GenerateDebugInformation="TRUE"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath="..\..\src\jsontestrunner\main.cpp">
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="lib_json"
- ProjectGUID="{B84F7231-16CE-41D8-8C08-7B523FF4225B}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../build/vs71/debug/lib_json"
- IntermediateDirectory="../../build/vs71/debug/lib_json"
- ConfigurationType="4"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
- StringPooling="TRUE"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- EnableFunctionLevelLinking="TRUE"
- DisableLanguageExtensions="TRUE"
- ForceConformanceInForLoopScope="FALSE"
- RuntimeTypeInfo="TRUE"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)/json_vc71_libmtd.lib"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../build/vs71/release/lib_json"
- IntermediateDirectory="../../build/vs71/release/lib_json"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="TRUE">
- <Tool
- Name="VCCLCompilerTool"
- GlobalOptimizations="TRUE"
- EnableIntrinsicFunctions="TRUE"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
- StringPooling="TRUE"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="TRUE"
- DisableLanguageExtensions="TRUE"
- ForceConformanceInForLoopScope="FALSE"
- RuntimeTypeInfo="TRUE"
- UsePrecompiledHeader="0"
- AssemblerOutput="4"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)/json_vc71_libmt.lib"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="dummy|Win32"
- OutputDirectory="$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="TRUE">
- <Tool
- Name="VCCLCompilerTool"
- GlobalOptimizations="TRUE"
- EnableIntrinsicFunctions="TRUE"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
- StringPooling="TRUE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- DisableLanguageExtensions="TRUE"
- ForceConformanceInForLoopScope="FALSE"
- RuntimeTypeInfo="TRUE"
- UsePrecompiledHeader="0"
- AssemblerOutput="4"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath="..\..\include\json\autolink.h">
- </File>
- <File
- RelativePath="..\..\include\json\config.h">
- </File>
- <File
- RelativePath="..\..\include\json\features.h">
- </File>
- <File
- RelativePath="..\..\include\json\forwards.h">
- </File>
- <File
- RelativePath="..\..\include\json\json.h">
- </File>
- <File
- RelativePath="..\..\src\lib_json\json_reader.cpp">
- </File>
- <File
- RelativePath="..\..\src\lib_json\json_value.cpp">
- </File>
- <File
- RelativePath="..\..\src\lib_json\json_valueiterator.inl">
- </File>
- <File
- RelativePath="..\..\src\lib_json\json_writer.cpp">
- </File>
- <File
- RelativePath="..\..\include\json\reader.h">
- </File>
- <File
- RelativePath="..\..\include\json\value.h">
- </File>
- <File
- RelativePath="..\..\include\json\writer.h">
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
%global jsondir json
Name: jsoncpp
-Version: 1.6.5
-Release: 0
+Version: 1.7.7
+Release: 0
Summary: JSON library implemented in C++
Group: System Environment/Libraries
License: Public Domain or MIT
URL: https://github.com/open-source-parsers/jsoncpp
Source0: https://github.com/open-source-parsers/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
-Source1: baselibs.conf
-Source1001: jsoncpp.manifest
+Source1: baselibs.conf
+Source1001: jsoncpp.manifest
BuildRequires: doxygen cmake
BuildRequires: python
%build
-%cmake -DBUILD_STATIC_LIBS=OFF .
+%cmake -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF .
make %{?_smp_mflags}
# Build the doc
python doxybuild.py --doxygen %{_bindir}/doxygen
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
-libdir=@LIBRARY_INSTALL_DIR@
-includedir=@INCLUDE_INSTALL_DIR@
+libdir=${exec_prefix}/@LIBRARY_INSTALL_DIR@
+includedir=${prefix}/@INCLUDE_INSTALL_DIR@
Name: jsoncpp
Description: A C++ library for interacting with JSON
+++ /dev/null
-# Big issue:
-# emitter depends on doxyfile which is generated from doxyfile.in.
-# build fails after cleaning and relaunching the build.
-
-# Todo:
-# Add helper function to environment like for glob
-# Easier passage of header/footer
-# Automatic deduction of index.html path based on custom parameters passed to doxyfile
-
-import os
-import os.path
-import glob
-from fnmatch import fnmatch
-import SCons
-
-def Doxyfile_emitter(target, source, env):
- """
- Modify the target and source lists to use the defaults if nothing
- else has been specified.
-
- Dependencies on external HTML documentation references are also
- appended to the source list.
- """
- doxyfile_template = env.File(env['DOXYFILE_FILE'])
- source.insert(0, doxyfile_template)
-
- return target, source
-
-def Doxyfile_Builder(target, source, env):
- """Input:
- DOXYFILE_FILE
- Path of the template file for the output doxyfile
-
- DOXYFILE_DICT
- A dictionnary of parameter to append to the generated doxyfile
- """
- subdir = os.path.split(source[0].abspath)[0]
- doc_top_dir = os.path.split(target[0].abspath)[0]
- doxyfile_path = source[0].abspath
- doxy_file = file( target[0].abspath, 'wt' )
- try:
- # First, output the template file
- try:
- f = file(doxyfile_path, 'rt')
- doxy_file.write( f.read() )
- f.close()
- doxy_file.write( '\n' )
- doxy_file.write( '# Generated content:\n' )
- except:
- raise SCons.Errors.UserError, "Can't read doxygen template file '%s'" % doxyfile_path
- # Then, the input files
- doxy_file.write( 'INPUT = \\\n' )
- for source in source:
- if source.abspath != doxyfile_path: # skip doxyfile path, which is the first source
- doxy_file.write( '"%s" \\\n' % source.abspath )
- doxy_file.write( '\n' )
- # Dot...
- values_dict = { 'HAVE_DOT': env.get('DOT') and 'YES' or 'NO',
- 'DOT_PATH': env.get('DOT') and os.path.split(env['DOT'])[0] or '',
- 'OUTPUT_DIRECTORY': doc_top_dir,
- 'WARN_LOGFILE': target[0].abspath + '-warning.log'}
- values_dict.update( env['DOXYFILE_DICT'] )
- # Finally, output user dictionary values which override any of the previously set parameters.
- for key, value in values_dict.iteritems():
- doxy_file.write ('%s = "%s"\n' % (key, str(value)))
- finally:
- doxy_file.close()
-
-def generate(env):
- """
- Add builders and construction variables for the
- Doxygen tool.
- """
- ## Doxyfile builder
- def doxyfile_message (target, source, env):
- return "creating Doxygen config file '%s'" % target[0]
-
- doxyfile_variables = [
- 'DOXYFILE_DICT',
- 'DOXYFILE_FILE'
- ]
-
- #doxyfile_action = SCons.Action.Action( Doxyfile_Builder, doxyfile_message,
- # doxyfile_variables )
- doxyfile_action = SCons.Action.Action( Doxyfile_Builder, doxyfile_message)
-
- doxyfile_builder = SCons.Builder.Builder( action = doxyfile_action,
- emitter = Doxyfile_emitter )
-
- env['BUILDERS']['Doxyfile'] = doxyfile_builder
- env['DOXYFILE_DICT'] = {}
- env['DOXYFILE_FILE'] = 'doxyfile.in'
-
- ## Doxygen builder
- def Doxygen_emitter(target, source, env):
- output_dir = str( source[0].dir )
- if str(target[0]) == str(source[0]):
- target = env.File( os.path.join( output_dir, 'html', 'index.html' ) )
- return target, source
-
- doxygen_action = SCons.Action.Action( [ '$DOXYGEN_COM'] )
- doxygen_builder = SCons.Builder.Builder( action = doxygen_action,
- emitter = Doxygen_emitter )
- env['BUILDERS']['Doxygen'] = doxygen_builder
- env['DOXYGEN_COM'] = '$DOXYGEN $DOXYGEN_FLAGS $SOURCE'
- env['DOXYGEN_FLAGS'] = ''
- env['DOXYGEN'] = 'doxygen'
-
- dot_path = env.WhereIs("dot")
- if dot_path:
- env['DOT'] = dot_path
-
-def exists(env):
- """
- Make sure doxygen exists.
- """
- return env.Detect("doxygen")
+++ /dev/null
-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
IF(BUILD_SHARED_LIBS)
ADD_DEFINITIONS( -DJSON_DLL_BUILD )
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
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}
RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
IF(BUILD_STATIC_LIBS)
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
DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
#elif defined(__ANDROID__) || defined(__QNXNTO__)
#define snprintf snprintf
#elif __cplusplus >= 201103L
+#if !defined(__MINGW32__) && !defined(__CYGWIN__)
#define snprintf std::snprintf
#endif
+#endif
#if defined(__QNXNTO__)
#define sscanf std::sscanf
bool Reader::decodeDouble(Token& token, Value& decoded) {
double value = 0;
- std::string buffer(token.start_, token.end_);
- std::istringstream is(buffer);
+ JSONCPP_STRING buffer(token.start_, token.end_);
+ JSONCPP_ISTRINGSTREAM is(buffer);
if (!(is >> value))
- return addError("'" + std::string(token.start_, token.end_) +
+ return addError("'" + JSONCPP_STRING(token.start_, token.end_) +
"' is not a number.",
token);
decoded = value;
{}
bool parse(
char const* beginDoc, char const* endDoc,
- Value* root, std::string* errs) override {
+ Value* root, JSONCPP_STRING* errs) JSONCPP_OVERRIDE {
bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_);
if (errs) {
*errs = reader_.getFormattedErrorMessages();
static inline void uintToString(LargestUInt value, char*& current) {
*--current = 0;
do {
- *--current = static_cast<signed char>(value % 10U + static_cast<unsigned>('0'));
+ *--current = static_cast<char>(value % 10U + static_cast<unsigned>('0'));
value /= 10;
} while (value != 0);
}
namespace Json {
-Exception::Exception(std::string const& msg)
+Exception::Exception(JSONCPP_STRING const& msg)
: msg_(msg)
{}
Exception::~Exception() throw()
storage_.length_ = ulength & 0x3FFFFFFF;
}
-Value::CZString::CZString(const CZString& other)
- : cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0
- ? duplicateStringValue(other.cstr_, other.storage_.length_)
- : other.cstr_) {
- storage_.policy_ = (other.cstr_
+Value::CZString::CZString(const CZString& other) {
+ cstr_ = (other.storage_.policy_ != noDuplication && other.cstr_ != 0
+ ? duplicateStringValue(other.cstr_, other.storage_.length_)
+ : other.cstr_);
+ storage_.policy_ = static_cast<unsigned>(other.cstr_
? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
? noDuplication : duplicate)
- : static_cast<DuplicationPolicy>(other.storage_.policy_));
+ : static_cast<DuplicationPolicy>(other.storage_.policy_)) & 3U;
storage_.length_ = other.storage_.length_;
}
* This optimization is used in ValueInternalMap fast allocator.
*/
Value::Value(ValueType vtype) {
+ static char const empty[] = "";
initBasic(vtype);
switch (vtype) {
case nullValue:
return this_str;
}
+#if JSONCPP_USING_SECURE_MEMORY
+unsigned Value::getCStringLength() const {
+ JSON_ASSERT_MESSAGE(type_ == stringValue,
+ "in Json::Value::asCString(): requires stringValue");
+ if (value_.string_ == 0) return 0;
+ unsigned this_len;
+ char const* this_str;
+ decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
+ return this_len;
+}
+#endif
+
bool Value::getString(char const** str, char const** cend) const {
if (type_ != stringValue) return false;
if (value_.string_ == 0) return false;
return Value::UInt(-1);
}
-std::string ValueIteratorBase::name() const {
+JSONCPP_STRING ValueIteratorBase::name() const {
char const* keey;
char const* end;
keey = memberName(&end);
- if (!keey) return std::string();
- return std::string(keey, end);
+ if (!keey) return JSONCPP_STRING();
+ return JSONCPP_STRING(keey, end);
}
char const* ValueIteratorBase::memberName() const {
#define snprintf _snprintf
#endif
-#if defined(__BORLANDC__)
-#include <float.h>
-#define isfinite _finite
-#define snprintf _snprintf
-#endif
-
#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
// Disable warning about strdup being deprecated.
#pragma warning(disable : 4996)
#endif // # if defined(JSON_HAS_INT64)
-std::string valueToString(double value, bool useSpecialFloats, unsigned int precision) {
+namespace {
+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
// precision requested below.
char buffer[32];
JSONCPP_STRING valueToString(double value) { return valueToString(value, false, 17); }
-std::string valueToString(double value) { return valueToString(value, false, 17); }
-
-std::string valueToString(bool value) { return value ? "true" : "false"; }
+JSONCPP_STRING valueToString(bool value) { return value ? "true" : "false"; }
JSONCPP_STRING valueToQuotedString(const char* value) {
if (value == NULL)
BuiltStyledStreamWriter(
JSONCPP_STRING const& indentation,
CommentStyle::Enum cs,
- std::string const& colonSymbol,
- std::string const& nullSymbol,
- std::string const& endingLineFeedSymbol,
+ JSONCPP_STRING const& colonSymbol,
+ JSONCPP_STRING const& nullSymbol,
+ JSONCPP_STRING const& endingLineFeedSymbol,
bool useSpecialFloats,
unsigned int precision);
- int write(Value const& root, std::ostream* sout) override;
+ int write(Value const& root, JSONCPP_OSTREAM* sout) JSONCPP_OVERRIDE;
private:
void writeValue(Value const& value);
void writeArrayValue(Value const& value);
BuiltStyledStreamWriter::BuiltStyledStreamWriter(
JSONCPP_STRING const& indentation,
CommentStyle::Enum cs,
- std::string const& colonSymbol,
- std::string const& nullSymbol,
- std::string const& endingLineFeedSymbol,
+ JSONCPP_STRING const& colonSymbol,
+ JSONCPP_STRING const& nullSymbol,
+ JSONCPP_STRING const& endingLineFeedSymbol,
bool useSpecialFloats,
unsigned int precision)
: rightMargin_(74)
nullSymbol = "";
}
if (pre > 17) pre = 17;
- std::string endingLineFeedSymbol = "";
+ JSONCPP_STRING endingLineFeedSymbol = "";
return new BuiltStyledStreamWriter(
indentation, cs,
colonSymbol, nullSymbol, endingLineFeedSymbol, usf, pre);
} \
\
public: /* overidden from TestCase */ \
- const char* testName() const override { return #FixtureType "/" #name; } \
- void runTestCase() override; \
+ const char* testName() const JSONCPP_OVERRIDE { return #FixtureType "/" #name; } \
+ void runTestCase() JSONCPP_OVERRIDE; \
}; \
\
void Test##FixtureType##name::runTestCase()
b.settings_["useSpecialFloats"] = true;
Json::Value v = std::numeric_limits<double>::quiet_NaN();
- std::string expected = "NaN";
- std::string result = Json::writeString(b, v);
+ JSONCPP_STRING expected = "NaN";
+ JSONCPP_STRING result = Json::writeString(b, v);
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
v = std::numeric_limits<double>::infinity();
b.settings_["precision"] = 5;
Json::Value v = 100.0/3;
- std::string expected = "33.333";
- std::string result = Json::writeString(b, v);
+ JSONCPP_STRING expected = "33.333";
+ JSONCPP_STRING result = Json::writeString(b, v);
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
v = 0.25000000;
Json::CharReaderBuilder b;
b.settings_["allowSpecialFloats"] = true;
Json::Value root;
- std::string errs;
+ JSONCPP_STRING errs;
Json::CharReader* reader(b.newCharReader());
{
char const doc[] = "{\"a\":NaN,\"b\":Infinity,\"c\":-Infinity}";
struct TestData {
int line;
bool ok;
- std::string in;
+ JSONCPP_STRING in;
};
const TestData test_data[] = {
{__LINE__, 1, "{\"a\":9}"},
for(int i = 9; i < 12; ++i)
{
- std::ostringstream out;
+ JSONCPP_OSTRINGSTREAM out;
out << std::setw(2) << i;
- std::string str = out.str();
+ JSONCPP_STRING str = out.str();
value[str] = str;
}
- std::ostringstream out;
+ JSONCPP_OSTRINGSTREAM out;
//in old code, this will get a compile error
Json::Value::const_iterator iter = value.begin();
for(; iter != value.end(); ++iter)
{
out << *iter << ',';
}
- std::string expected = "\" 9\",\"10\",\"11\",";
+ JSONCPP_STRING expected = "\" 9\",\"10\",\"11\",";
JSONTEST_ASSERT_STRING_EQUAL(expected, out.str());
}
+++ /dev/null
-// C++ style comment
-.=null
-
+++ /dev/null
-/* C style comment
- */
-.=null
-
+++ /dev/null
-.={}
-// Comment for array
-.test=[]
-// Comment within array
-.test[0]={}
-.test[0].a="aaa"
-.test[1]={}
-.test[1].b="bbb"
-.test[2]={}
-.test[2].c="ccc"
+++ /dev/null
-{
- "test":
- // Comment for array
- [
- // Comment within array
- { "a" : "aaa" }, // Comment for a
- { "b" : "bbb" }, // Comment for b
- { "c" : "ccc" } // Comment for c
- ]
-}
+++ /dev/null
-// Max signed integer
-.=2147483647
+++ /dev/null
-// Min signed integer
-.=-2147483648
+++ /dev/null
-// Max unsigned integer
-.=4294967295
+++ /dev/null
-// Min unsigned integer
-.=0
-
+++ /dev/null
-/* A comment
- at the beginning of the file.
- */
-.={}
-.first=1
-/* Comment before 'second'
- */
-.second=2
-/* A comment at
- the end of the file.
- */
+++ /dev/null
-// 2^33 => out of integer range, switch to double
-.=8589934592
-
+++ /dev/null
-// -2^32 => out of signed integer range, switch to double
-.=-4294967295
-
+++ /dev/null
-// -2^32 => out of signed integer range, switch to double
-.=-4294967295
-
+++ /dev/null
-// 1.2345678
-.=1.2345678
-
+++ /dev/null
-// 1234567.8
-.=1234567.8
-
-
+++ /dev/null
-// -1.2345678
-.=-1.2345678
-
-
+++ /dev/null
-// -1234567.8
-.=-1234567.8
-
-
+++ /dev/null
-"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
+++ /dev/null
-"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
+++ /dev/null
-# Simple implementation of a json test runner to run the test against json-py.
-
-import sys
-import os.path
-import json
-import types
-
-if len(sys.argv) != 2:
- print "Usage: %s input-json-file", sys.argv[0]
- sys.exit(3)
-
-input_path = sys.argv[1]
-base_path = os.path.splitext(input_path)[0]
-actual_path = base_path + '.actual'
-rewrite_path = base_path + '.rewrite'
-rewrite_actual_path = base_path + '.actual-rewrite'
-
-def valueTreeToString( fout, value, path = '.' ):
- ty = type(value)
- if ty is types.DictType:
- fout.write( '%s={}\n' % path )
- suffix = path[-1] != '.' and '.' or ''
- names = value.keys()
- names.sort()
- for name in names:
- valueTreeToString( fout, value[name], path + suffix + name )
- elif ty is types.ListType:
- fout.write( '%s=[]\n' % path )
- for index, childValue in zip( xrange(0,len(value)), value ):
- valueTreeToString( fout, childValue, path + '[%d]' % index )
- elif ty is types.StringType:
- fout.write( '%s="%s"\n' % (path,value) )
- elif ty is types.IntType:
- fout.write( '%s=%d\n' % (path,value) )
- elif ty is types.FloatType:
- fout.write( '%s=%.16g\n' % (path,value) )
- elif value is True:
- fout.write( '%s=true\n' % path )
- elif value is False:
- fout.write( '%s=false\n' % path )
- elif value is None:
- fout.write( '%s=null\n' % path )
- else:
- assert False and "Unexpected value type"
-
-def parseAndSaveValueTree( input, actual_path ):
- root = json.read( input )
- fout = file( actual_path, 'wt' )
- valueTreeToString( fout, root )
- fout.close()
- return root
-
-def rewriteValueTree( value, rewrite_path ):
- rewrite = json.write( value )
- rewrite = rewrite[1:-1] # Somehow the string is quoted ! jsonpy bug ?
- file( rewrite_path, 'wt').write( rewrite + '\n' )
- return rewrite
-
-input = file( input_path, 'rt' ).read()
-root = parseAndSaveValueTree( input, actual_path )
-rewrite = rewriteValueTree( json.write( root ), rewrite_path )
-rewrite_root = parseAndSaveValueTree( rewrite, rewrite_actual_path )
-
-sys.exit( 0 )
cmake -DJSONCPP_WITH_CMAKE_PACKAGE=$CMAKE_PKG -DBUILD_SHARED_LIBS=$SHARED_LIB -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_VERBOSE_MAKEFILE=$VERBOSE_MAKE .
make
+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 .
+make
# Python is not available in Travis for osx.
# https://github.com/travis-ci/travis-ci/issues/2320