Skip to content

Commit cc1f661

Browse files
author
liuhuahang
committed
Merge remote-tracking branch 'origin/master' into gm
2 parents adb8300 + 3515db1 commit cc1f661

File tree

225 files changed

+20439
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+20439
-0
lines changed

.clang-format

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
# BasedOnStyle: LLVM
3+
AccessModifierOffset: -2
4+
ConstructorInitializerIndentWidth: 4
5+
AlignEscapedNewlinesLeft: false
6+
AlignTrailingComments: true
7+
AllowAllParametersOfDeclarationOnNextLine: true
8+
AllowShortIfStatementsOnASingleLine: false
9+
AllowShortLoopsOnASingleLine: false
10+
AlwaysBreakTemplateDeclarations: false
11+
AlwaysBreakBeforeMultilineStrings: false
12+
BreakBeforeBinaryOperators: false
13+
BreakBeforeTernaryOperators: true
14+
BreakConstructorInitializersBeforeComma: false
15+
BinPackParameters: false
16+
ColumnLimit: 80
17+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
18+
DerivePointerBinding: false
19+
ExperimentalAutoDetectBinPacking: false
20+
IndentCaseLabels: false
21+
MaxEmptyLinesToKeep: 1
22+
NamespaceIndentation: None
23+
ObjCSpaceBeforeProtocolList: true
24+
PenaltyBreakBeforeFirstCallParameter: 19
25+
PenaltyBreakComment: 60
26+
PenaltyBreakString: 1000
27+
PenaltyBreakFirstLessLess: 120
28+
PenaltyExcessCharacter: 1000000
29+
PenaltyReturnTypeOnItsOwnLine: 60
30+
PointerBindsToType: false
31+
SpacesBeforeTrailingComments: 1
32+
Cpp11BracedListStyle: false
33+
Standard: Cpp03
34+
IndentWidth: 2
35+
TabWidth: 8
36+
UseTab: Never
37+
BreakBeforeBraces: Attach
38+
IndentFunctionDeclarationAfterType: false
39+
SpacesInParentheses: false
40+
SpacesInAngles: false
41+
SpaceInEmptyParentheses: false
42+
SpacesInCStyleCastParentheses: false
43+
SpaceAfterControlStatementKeyword: true
44+
SpaceBeforeAssignmentOperators: true
45+
ContinuationIndentWidth: 4
46+
...
47+

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*.pyc
2+
*.swp
3+
4+
*.actual
5+
*.actual-rewrite
6+
*.process-output
7+
*.rewrite
8+
/bin/
9+
/buildscons/
10+
/libs/
11+
/doc/doxyfile
12+
/dist/
13+
/include/json/version.h

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Build matrix / environment variable are explained on:
2+
# http://about.travis-ci.org/docs/user/build-configuration/
3+
# This file can be validated on:
4+
# http://lint.travis-ci.org/
5+
before_install: sudo apt-get install cmake
6+
language: cpp
7+
compiler:
8+
- gcc
9+
- clang
10+
script: cmake -DJSONCPP_LIB_BUILD_SHARED=$SHARED_LIBRARY -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_VERBOSE_MAKEFILE=$VERBOSE_MAKE . && make
11+
env:
12+
matrix:
13+
- SHARED_LIBRARY=ON BUILD_TYPE=release VERBOSE_MAKE=false
14+
- SHARED_LIBRARY=OFF BUILD_TYPE=release VERBOSE_MAKE=false
15+
- SHARED_LIBRARY=OFF BUILD_TYPE=debug VERBOSE VERBOSE_MAKE=true
16+
notifications:
17+
email:
18+

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Baptiste Lepilleur <[email protected]>

CMakeLists.txt

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2+
PROJECT(jsoncpp)
3+
ENABLE_TESTING()
4+
5+
OPTION(JSONCPP_WITH_TESTS "Compile and run JsonCpp test executables" ON)
6+
OPTION(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" ON)
7+
OPTION(JSONCPP_WITH_WARNING_AS_ERROR "Force compilation to fail if a warning occurs" OFF)
8+
9+
# Ensures that CMAKE_BUILD_TYPE is visible in cmake-gui on Unix
10+
IF(NOT WIN32)
11+
IF(NOT CMAKE_BUILD_TYPE)
12+
SET(CMAKE_BUILD_TYPE Release CACHE STRING
13+
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage."
14+
FORCE)
15+
ENDIF(NOT CMAKE_BUILD_TYPE)
16+
ENDIF(NOT WIN32)
17+
18+
# This ensures shared DLL are in the same dir as executable on Windows.
19+
# Put all executables / libraries are in a project global directory.
20+
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib
21+
CACHE PATH "Single directory for all static libraries.")
22+
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib
23+
CACHE PATH "Single directory for all dynamic libraries on Unix.")
24+
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin
25+
CACHE PATH "Single directory for all executable and dynamic libraries on Windows.")
26+
MARK_AS_ADVANCED( CMAKE_RUNTIME_OUTPUT_DIRECTORY CMAKE_LIBRARY_OUTPUT_DIRECTORY CMAKE_ARCHIVE_OUTPUT_DIRECTORY )
27+
28+
# Set variable named ${VAR_NAME} to value ${VALUE}
29+
FUNCTION(set_using_dynamic_name VAR_NAME VALUE)
30+
SET( "${VAR_NAME}" "${VALUE}" PARENT_SCOPE)
31+
ENDFUNCTION(set_using_dynamic_name)
32+
33+
# Extract major, minor, patch and qualifier from version text
34+
# Parse a version string "X.Y.Z[-qualifier]" and outputs
35+
# version parts in ${OUPUT_PREFIX}_MAJOR, _MINOR, _PATCH, _QUALIFIER.
36+
# If parse succed then ${OUPUT_PREFIX}_FOUND is TRUE.
37+
MACRO(jsoncpp_parse_version VERSION_TEXT OUPUT_PREFIX)
38+
SET(VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9_]+)?")
39+
IF( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
40+
STRING(REGEX MATCHALL "[0-9]+|-([A-Za-z0-9_]+)" VERSION_PARTS ${VERSION_TEXT})
41+
list(APPEND VERSION_PARTS "") # empty qualifier to handle no qualifier case
42+
LIST(GET VERSION_PARTS 0 ${OUPUT_PREFIX}_MAJOR)
43+
LIST(GET VERSION_PARTS 1 ${OUPUT_PREFIX}_MINOR)
44+
LIST(GET VERSION_PARTS 2 ${OUPUT_PREFIX}_PATCH)
45+
LIST(GET VERSION_PARTS 3 ${OUPUT_PREFIX}_QUALIFIER)
46+
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" TRUE )
47+
ELSE( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
48+
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" FALSE )
49+
ENDIF( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
50+
ENDMACRO(jsoncpp_parse_version)
51+
52+
# Read out version from "version" file
53+
FILE(STRINGS "version" JSONCPP_VERSION)
54+
55+
jsoncpp_parse_version( ${JSONCPP_VERSION} JSONCPP_VERSION )
56+
IF(NOT JSONCPP_VERSION_FOUND)
57+
MESSAGE(FATAL_ERROR "Failed to parse version string properly. Expect X.Y.Z[-qualifier]")
58+
ENDIF(NOT JSONCPP_VERSION_FOUND)
59+
60+
MESSAGE(STATUS "JsonCpp Version: ${JSONCPP_VERSION_MAJOR}.${JSONCPP_VERSION_MINOR}.${JSONCPP_VERSION_PATCH}${JSONCPP_VERSION_QUALIFIER}")
61+
# File version.h is only regenerated on CMake configure step
62+
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/lib_json/version.h.in"
63+
"${PROJECT_SOURCE_DIR}/include/json/version.h" )
64+
65+
macro(UseCompilationWarningAsError)
66+
if ( MSVC )
67+
# Only enabled in debug because some old versions of VS STL generate
68+
# warnings when compiled in release configuration.
69+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /WX ")
70+
endif( MSVC )
71+
endmacro()
72+
73+
# Include our configuration header
74+
INCLUDE_DIRECTORIES( ${jsoncpp_SOURCE_DIR}/include )
75+
76+
if ( MSVC )
77+
# Only enabled in debug because some old versions of VS STL generate
78+
# unreachable code warning when compiled in release configuration.
79+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W4 ")
80+
endif( MSVC )
81+
82+
IF(JSONCPP_WITH_WARNING_AS_ERROR)
83+
UseCompilationWarningAsError()
84+
ENDIF(JSONCPP_WITH_WARNING_AS_ERROR)
85+
86+
# Build the different applications
87+
ADD_SUBDIRECTORY( src )
88+
89+
#install the includes
90+
ADD_SUBDIRECTORY( include )

LICENSE

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
The JsonCpp library's source code, including accompanying documentation,
2+
tests and demonstration applications, are licensed under the following
3+
conditions...
4+
5+
The author (Baptiste Lepilleur) explicitly disclaims copyright in all
6+
jurisdictions which recognize such a disclaimer. In such jurisdictions,
7+
this software is released into the Public Domain.
8+
9+
In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
10+
2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
11+
released under the terms of the MIT License (see below).
12+
13+
In jurisdictions which recognize Public Domain property, the user of this
14+
software may choose to accept it either as 1) Public Domain, 2) under the
15+
conditions of the MIT License (see below), or 3) under the terms of dual
16+
Public Domain/MIT License conditions described here, as they choose.
17+
18+
The MIT License is about as close to Public Domain as a license can get, and is
19+
described in clear, concise terms at:
20+
21+
http://en.wikipedia.org/wiki/MIT_License
22+
23+
The full text of the MIT License follows:
24+
25+
========================================================================
26+
Copyright (c) 2007-2010 Baptiste Lepilleur
27+
28+
Permission is hereby granted, free of charge, to any person
29+
obtaining a copy of this software and associated documentation
30+
files (the "Software"), to deal in the Software without
31+
restriction, including without limitation the rights to use, copy,
32+
modify, merge, publish, distribute, sublicense, and/or sell copies
33+
of the Software, and to permit persons to whom the Software is
34+
furnished to do so, subject to the following conditions:
35+
36+
The above copyright notice and this permission notice shall be
37+
included in all copies or substantial portions of the Software.
38+
39+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
40+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
41+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
42+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
43+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
44+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
45+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
46+
SOFTWARE.
47+
========================================================================
48+
(END LICENSE TEXT)
49+
50+
The MIT license is compatible with both the GPL and commercial
51+
software, affording one all of the rights of Public Domain with the
52+
minor nuisance of being required to keep the above copyright notice
53+
and license text in the source code. Note also that by accepting the
54+
Public Domain "license" you can re-license your copy using whatever
55+
license you like.

0 commit comments

Comments
 (0)