mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-26 18:51:04 +08:00
link web docs
This commit is contained in:
parent
3ebba5cea8
commit
da0fcfbaa2
42
README.md
42
README.md
@ -7,17 +7,20 @@ 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
|
||||||
|
|
||||||
## A note on backward-compatibility
|
## A note on backward-compatibility
|
||||||
Very soon, we are switching to C++11 only. For older compilers, try the `pre-C++11` branch.
|
* `1.y.z` is built with C++11.
|
||||||
|
* `0.8.z` can be used with older compilers.
|
||||||
|
* Major versions maintain binary-compatibility.
|
||||||
|
|
||||||
Using JsonCpp in your project
|
Using JsonCpp in your project
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
The recommended approach to integrating JsonCpp in your project is to build
|
The recommended approach to integrating JsonCpp in your project is to build
|
||||||
the amalgamated source (a single `.cpp` file) with your own build system. This
|
the amalgamated source (a single `.cpp` file) with your own build system. This
|
||||||
ensures consistency of compilation flags and ABI compatibility. See the section
|
ensures consistency of compilation flags and ABI compatibility. See the section
|
||||||
@ -28,13 +31,11 @@ should be included as follow:
|
|||||||
|
|
||||||
#include <json/json.h>
|
#include <json/json.h>
|
||||||
|
|
||||||
If JsonCpp was build as a dynamic library on Windows, then your project needs to
|
If JsonCpp was built as a dynamic library on Windows, then your project needs to
|
||||||
define the macro `JSON_DLL`.
|
define the macro `JSON_DLL`.
|
||||||
|
|
||||||
|
Building and testing with CMake
|
||||||
Building and testing with new CMake
|
-------------------------------
|
||||||
-----------------------------------
|
|
||||||
|
|
||||||
[CMake][] is a C++ Makefiles/Solution generator. It is usually available on most
|
[CMake][] is a C++ Makefiles/Solution generator. It is usually available on most
|
||||||
Linux system as package. On Ubuntu:
|
Linux system as package. On Ubuntu:
|
||||||
|
|
||||||
@ -75,10 +76,8 @@ the `-G` option).
|
|||||||
By default CMake hides compilation commands. This can be modified by specifying
|
By default CMake hides compilation commands. This can be modified by specifying
|
||||||
`-DCMAKE_VERBOSE_MAKEFILE=true` when generating makefiles.
|
`-DCMAKE_VERBOSE_MAKEFILE=true` when generating makefiles.
|
||||||
|
|
||||||
|
|
||||||
Building and testing with SCons
|
Building and testing with SCons
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
**Note:** The SCons-based build system is deprecated. Please use CMake; see the
|
**Note:** The SCons-based build system is deprecated. Please use CMake; see the
|
||||||
section above.
|
section above.
|
||||||
|
|
||||||
@ -107,14 +106,7 @@ If you are building with Microsoft Visual Studio 2008, you need to set up the
|
|||||||
environment by running `vcvars32.bat` (e.g. MSVC 2008 command prompt) before
|
environment by running `vcvars32.bat` (e.g. MSVC 2008 command prompt) before
|
||||||
running SCons.
|
running SCons.
|
||||||
|
|
||||||
|
# Running the tests manually
|
||||||
Running the tests manually
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
Note that test can be run using SCons using the `check` target:
|
|
||||||
|
|
||||||
scons platform=$PLATFORM check
|
|
||||||
|
|
||||||
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
|
||||||
@ -137,20 +129,21 @@ 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
|
||||||
|
Note that tests can be run using SCons using the `check` target:
|
||||||
|
|
||||||
|
scons platform=$PLATFORM check
|
||||||
|
|
||||||
Building the documentation
|
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.
|
||||||
|
|
||||||
|
|
||||||
Generating amalgamated source and header
|
Generating amalgamated source and header
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
|
|
||||||
JsonCpp is provided with a script to generate a single header and a single
|
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
|
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
|
can be generated at any time by running the following command from the
|
||||||
@ -172,10 +165,8 @@ The amalgamated sources are generated by concatenating JsonCpp source in the
|
|||||||
correct order and defining the macro `JSON_IS_AMALGAMATION` to prevent inclusion
|
correct order and defining the macro `JSON_IS_AMALGAMATION` to prevent inclusion
|
||||||
of other headers.
|
of other headers.
|
||||||
|
|
||||||
|
|
||||||
Adding a reader/writer test
|
Adding a reader/writer test
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
To add a test, you need to create two files in test/data:
|
To add a test, you need to create two files in test/data:
|
||||||
|
|
||||||
* a `TESTNAME.json` file, that contains the input document in JSON format.
|
* a `TESTNAME.json` file, that contains the input document in JSON format.
|
||||||
@ -195,10 +186,8 @@ The `TESTNAME.expected` file format is as follows:
|
|||||||
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:
|
||||||
|
|
||||||
@ -215,10 +204,7 @@ 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
|
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.
|
||||||
|
|
||||||
|
@ -152,6 +152,7 @@ Basically JsonCpp is licensed under MIT license, or public domain if desired
|
|||||||
and recognized in your jurisdiction.
|
and recognized in your jurisdiction.
|
||||||
|
|
||||||
\author Baptiste Lepilleur <blep@users.sourceforge.net> (originator)
|
\author Baptiste Lepilleur <blep@users.sourceforge.net> (originator)
|
||||||
|
\author Christopher Dunn <cdunn2001@gmail.com> (primary maintainer)
|
||||||
\version \include version
|
\version \include version
|
||||||
We make strong guarantees about binary-compatibility, consistent with
|
We make strong guarantees about binary-compatibility, consistent with
|
||||||
<a href="http://apr.apache.org/versioning.html">the Apache versioning scheme</a>.
|
<a href="http://apr.apache.org/versioning.html">the Apache versioning scheme</a>.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user