Skip to content

Commit 3aa1192

Browse files
axicbaylesjBillyDonahue
authored
Introduce CharReaderBuilder::ecma404Mode (#1333)
* Introduce CharReaderBuilder::ecma404Mode * Bump micro version --------- Co-authored-by: Jordan Bayles <[email protected]> Co-authored-by: Billy Donahue <[email protected]> Co-authored-by: Jordan Bayles <[email protected]>
1 parent 99e8ca6 commit 3aa1192

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

Diff for: CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ project(jsoncpp
6262
# 2. ./include/json/version.h
6363
# 3. ./CMakeLists.txt
6464
# IMPORTANT: also update the PROJECT_SOVERSION!!
65-
VERSION 1.9.5 # <major>[.<minor>[.<patch>[.<tweak>]]]
65+
VERSION 1.9.6 # <major>[.<minor>[.<patch>[.<tweak>]]]
6666
LANGUAGES CXX)
6767

6868
message(STATUS "JsonCpp Version: ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
69-
set(PROJECT_SOVERSION 25)
69+
set(PROJECT_SOVERSION 26)
7070

7171
include(${CMAKE_CURRENT_SOURCE_DIR}/include/PreventInSourceBuilds.cmake)
7272
include(${CMAKE_CURRENT_SOURCE_DIR}/include/PreventInBuildInstalls.cmake)

Diff for: include/json/reader.h

+6
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,12 @@ class JSON_API CharReaderBuilder : public CharReader::Factory {
385385
* \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode
386386
*/
387387
static void strictMode(Json::Value* settings);
388+
/** ECMA-404 mode.
389+
* \pre 'settings' != NULL (but Json::null is fine)
390+
* \remark Defaults:
391+
* \snippet src/lib_json/json_reader.cpp CharReaderBuilderECMA404Mode
392+
*/
393+
static void ecma404Mode(Json::Value* settings);
388394
};
389395

390396
/** Consume entire stream and use its begin/end.

Diff for: include/json/version.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
// 3. /CMakeLists.txt
1010
// IMPORTANT: also update the SOVERSION!!
1111

12-
#define JSONCPP_VERSION_STRING "1.9.5"
12+
#define JSONCPP_VERSION_STRING "1.9.6"
1313
#define JSONCPP_VERSION_MAJOR 1
1414
#define JSONCPP_VERSION_MINOR 9
15-
#define JSONCPP_VERSION_PATCH 5
15+
#define JSONCPP_VERSION_PATCH 6
1616
#define JSONCPP_VERSION_QUALIFIER
1717
#define JSONCPP_VERSION_HEXA \
1818
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \

Diff for: meson.build

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ project(
99
# 2. /include/json/version.h
1010
# 3. /CMakeLists.txt
1111
# IMPORTANT: also update the SOVERSION!!
12-
version : '1.9.5',
12+
version : '1.9.6',
1313
default_options : [
1414
'buildtype=release',
1515
'cpp_std=c++11',
@@ -50,7 +50,7 @@ jsoncpp_lib = library(
5050
'src/lib_json/json_value.cpp',
5151
'src/lib_json/json_writer.cpp',
5252
]),
53-
soversion : 25,
53+
soversion : 26,
5454
install : true,
5555
include_directories : jsoncpp_include_directories,
5656
cpp_args: dll_export_flag)

Diff for: src/lib_json/json_reader.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -1961,6 +1961,22 @@ void CharReaderBuilder::setDefaults(Json::Value* settings) {
19611961
(*settings)["skipBom"] = true;
19621962
//! [CharReaderBuilderDefaults]
19631963
}
1964+
// static
1965+
void CharReaderBuilder::ecma404Mode(Json::Value* settings) {
1966+
//! [CharReaderBuilderECMA404Mode]
1967+
(*settings)["allowComments"] = false;
1968+
(*settings)["allowTrailingCommas"] = false;
1969+
(*settings)["strictRoot"] = false;
1970+
(*settings)["allowDroppedNullPlaceholders"] = false;
1971+
(*settings)["allowNumericKeys"] = false;
1972+
(*settings)["allowSingleQuotes"] = false;
1973+
(*settings)["stackLimit"] = 1000;
1974+
(*settings)["failIfExtra"] = true;
1975+
(*settings)["rejectDupKeys"] = false;
1976+
(*settings)["allowSpecialFloats"] = false;
1977+
(*settings)["skipBom"] = false;
1978+
//! [CharReaderBuilderECMA404Mode]
1979+
}
19641980

19651981
std::vector<CharReader::StructuredError>
19661982
CharReader::getStructuredErrors() const {

0 commit comments

Comments
 (0)