Commit Graph

303 Commits

Author SHA1 Message Date
Jordan Bayles
9704cedb20 Issue 1100: Drop CPPTL support
CPPTL support is no longer relevant to JsonCpp, and can be removed from
the library. This patch removes all mentions of CPPTL, by removing all
definitions and code sections conditionally compiled only when JsonCpp
is used with CPPTL. Include guards are also renamed to not refer to
CPPTL where appropriate.
2019-11-14 09:38:11 -08:00
Jacob Bundgaard
1c8f7d8ae5 Run clang-format 2019-11-14 00:05:24 -06:00
Jacob Bundgaard
01db7b7430 Allow trailing comma in objects 2019-11-14 00:05:24 -06:00
Billy Donahue
53c8e2cb3b
Issue 1066 (#1080)
Implemented `as<T>()` and `is<T>()` with accompanying tests
2019-11-11 22:43:52 -05:00
Hans Johnson
b082693b9e COMP: Improve const correctness for ValueIterators (#1056)
The protected deref method had inconsistent interface
of being a const function that returned a non-const
reference.  Resolves #914.
2019-10-17 10:52:13 -07:00
dota17
bdacfd7bc0
add a new method to insert a new value in an array at specific index. (#949)
* add a new method to insert a new value in an array at specific index.

* update: index > length, return false;

* fix clang-format
2019-10-16 14:33:53 +08:00
Rosen Penev
bcad4e4de2 clang-tidy cleanups 2 (#1048)
* [clang-tidy] Add explicit to single argument constructor

Found with hicpp-explicit-conversions

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* [clang-tidy] Fix mismatching declaration

Found with readability-inconsistent-declaration-parameter-name

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* [clang-tidy] Replace {} with = default

Found with modernize-use-equals-default

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* [clang-tidy] Remove redundant .c_Str

Found with readability-redundant-string-cstr

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* [clang-tidy] Simplify boolean expressions

Found with readability-simplify-boolean-expr

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* [clang-tidy] Use std::move

Found with modernize-pass-by-value

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* [clang-tidy] Uppercase literal suffixes

Found with hicpp-uppercase-literal-suffix

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-10-15 15:27:23 +08:00
es1x
2ee3b1dbb1 Re-add JSONCPP_NORETURN (#1041)
Fixes Visual Studio 2013 compatibility.
2019-10-11 11:33:36 -07:00
Jordan Bayles
f34bf24bbd
Issue #958: Travis CI should enforce clang-format standards (#1026)
* Issue #958: Travis CI should enfore clang-format standards

This patch adds clang format support to the travis bots.

* Update path

* Roll back to version 8 since 9 is in test

* Cleanup clang

* Revert "Delete JSONCPP_DEPRECATED, use [[deprecated]] instead. (#978)" (#1029)

This reverts commit b27c83f691.
2019-10-11 11:19:00 -07:00
Jordan Bayles
00b979f086
Issue #970: Rename features.h to json_features.h (#1024)
This patch fixes a build issue on CMake, presumably due to the new glibc
having a features.h include file. This patch renames our features.h file
to avoid a name collision.
2019-09-25 14:04:53 -07:00
Jordan Bayles
81ae1d55f7
Just run clang format (#1025) 2019-09-16 12:37:14 -07:00
m-gupta
3013ed48b3 jsoncpp: Define JSON_USE_INT64_DOUBLE_CONVERSION for clang as well. (#1002)
The current check to define JSON_USE_INT64_DOUBLE_CONVERSION
works for GCC but not clang.

Clang does define __GNUC__ but with a value 4 which misses
the check for >= 6.

This avoids the -Wimplicit-int-float-conversion warning
when jsoncpp is built with a recent version of clang.

Signed-off-by: Manoj Gupta <manojgupta@google.com>
2019-09-16 12:24:13 -07:00
dota17
abcd3f7b1f Modify code comments in write.h (#987)
* modify code comments in write.h

* update
2019-09-16 10:40:35 -07:00
dota17
db61dba885 Improving Code Readability (#1004) 2019-09-16 10:35:48 -07:00
dota17
7ef0f9fa5b [Language Conformance] Use constexpr restriction in jsoncpp (#1005)
* use constexpr restriction in jsoncpp

* remove TODO comment
2019-09-16 10:33:47 -07:00
aliha
472adb60ee Fix a coupe of typos (#1007) 2019-08-26 12:37:05 -07:00
Jordan Bayles
7b28698c5c
Cleanup versioning strategy relanding (#989) (#997)
* Cleanup versioning strategy

Currently, versioning is a mess. CMake and Meson have seperate build
version number storage locations, with no way of knowing you need to
have both. Plus, due to recent revisions the amalgamate script is broken
unless you build first, and may still be broken afterwards.

This PR fixes some issues with versioning, and adds comments clarifying
what has to be done when doing a release.

* Run clang format

* Update SOVERSION....
2019-08-13 22:41:43 -07:00
Jordan Bayles
0d27381acf
Revert "Cleanup versioning strategy (#989)" (#996)
This reverts commit 12325b814f.
2019-07-31 11:26:48 -07:00
Jordan Bayles
12325b814f
Cleanup versioning strategy (#989)
* Cleanup versioning strategy

Currently, versioning is a mess. CMake and Meson have seperate build
version number storage locations, with no way of knowing you need to
have both. Plus, due to recent revisions the amalgamate script is broken
unless you build first, and may still be broken afterwards.

This PR fixes some issues with versioning, and adds comments clarifying
what has to be done when doing a release.

* Run clang format

* Update SOVERSION....
2019-07-22 15:25:23 -07:00
dota17
b27c83f691 Delete JSONCPP_DEPRECATED, use [[deprecated]] instead. (#978)
* delete JSONCPP_DEPRECATED, use [[deprecated]]

* add pragma warning(disable:4996)

* add error C2416

* update

* update

* update
2019-07-17 13:35:33 -07:00
Billy Donahue
483eba84a7 Improve code comment formatting (Issue #985) 2019-07-17 13:04:53 -07:00
Jordan Bayles
b3507948e2 Fix definition check for GNUC 2019-07-17 13:03:23 -07:00
Jordan Bayles
645250b669 \#979 Fix parseFromStream definition
This patch fixes issue #979, where the parseFromStream definition in
the header is different from the implementation.
2019-07-11 14:38:06 -07:00
Jordan Bayles
25c57812e2 Add new JSON_USE_NULLREF flag
This patch adds a new flag, JSON_USE_NULLREF, which removes
the legacy singletons null, nullRef for consumers that require not
having static initialized globals, like Chromium.
2019-07-11 14:34:51 -07:00
Jordan Bayles
9ef812a097 \#964 Delete JSONCPP_NORETURN for [[noreturn]]
This patch removes the custom JSONCPP_NORETURN macro in favor of the
C++11 standard [[noreturn]] attribute.
2019-07-10 18:57:47 -07:00
Olivier LIESS
629a727b5f version.h : wrong file was deployed, added required include path and 2019-06-26 09:05:34 -07:00
Jordan Bayles
d5bd1a7716 Run clang format
Clang format hasn't been run on some recent checkins. This patch updates
the repository with clang format properly run on all files.
2019-06-24 14:06:45 -07:00
Jordan Bayles
3e4c8f8f1d
Merge pull request #935 from abigailbunyan/forward-declarations
Add missing classes to forwards.h
2019-06-24 12:50:59 -07:00
Jordan Bayles
83cc92161b Fix JSON_USE_EXCEPTION=0 use case
This patch fixes the JSON_USE_EXCEPTION flag. Currently, due to the
throwRuntimeError and throwLogicError methods implemented in json_value,
even if JSON_USE_EXCEPTION is set to 0 jsoncpp will still throw. This
breaks integration into projects with -fno-exceptions set, such as
Chromium.
2019-06-21 18:16:52 -05:00
Abigail Bunyan
1234f4227b Add missing classes to forwards.h
Fixes #904.
2019-06-03 15:04:01 +01:00
Frank Richter
b16abf8ce1 Explicitly set JSON_API to 'default' visibility on clang & gcc 2019-04-08 18:08:25 -05:00
Christopher Dunn
cd1121290a
Merge pull request #901 from res2k/demand
Implement Value::demand()
2019-03-30 09:39:32 -05:00
Frank Richter
99a99d4032 Cast to unsigned char in Value::setType() to appease gcc (issue #888) 2019-03-23 15:04:30 +01:00
Frank Richter
d76fe5687d Implement Value::demand() 2019-03-23 14:32:13 +01:00
Billy Donahue
9a55d22d3d remove JSON_HAS_RVALUE_REFERENCES 2019-03-01 06:32:18 -06:00
Billy Donahue
00558b38db VS2013 doesn't allow move ops to be =default 2019-03-01 06:31:58 -06:00
Billy Donahue
433107f1d9 refactor comments_ into a class 2019-03-01 06:31:58 -06:00
Marcel Raad
36d8cfd768 Fix macro redefinition warning with clang-cl
clang-cl defines _MSC_VER by default, so JSONCPP_DEPRECATED was first
defined for MSVC and then redefined for clang. Integrate the MSVC
definition into the block with clang and GCC's JSONCPP_DEPRECATED
definitions to fix this.
2019-02-28 22:19:13 -06:00
Billy Donahue
0c1cc6e1a3
pack the {type,allocated} bitfield (#876)
* pack the {type,allocated} bitfield (Issue#873)
This allows special functions to be implemented more easily.
2019-01-20 23:59:16 -05:00
Billy Donahue
2b593a9da8 apply the C++11 style change in .clang-format 2019-01-18 07:02:16 -06:00
Billy Donahue
1c2ed7a10f convert JSONCPP_STRING etc from macros to typedefs 2019-01-17 23:14:18 -05:00
Billy Donahue
dc4a7f9b61 Reapply clang-format.
$ clang-format -i -style=file \
        $(find  . | egrep '.*\.(h|cpp|inl)$')
2019-01-17 11:11:55 -05:00
Hans Johnson
e3e05c7085 STYLE: Pefer = default to explicitly trivial implementations
This check replaces default bodies of special member functions with
= default;. The explicitly defaulted function declarations enable more
opportunities in optimization, because the compiler might treat
explicitly defaulted functions as trivial.

Additionally, the C++11 use of = default more clearly expreses the
intent for the special member functions.

SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD

cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-equals-default  -header-filter=.* -fix
2019-01-15 18:30:49 -06:00
Hans Johnson
e817e4fc25 STYLE: Use default member initialization
Converts a default constructor’s member initializers into the new
default member initializers in C++11. Other member initializers that match the
default member initializer are removed. This can reduce repeated code or allow
use of ‘= default’.

SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD

cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-default-member-init  -header-filter=.* -fix
2019-01-15 18:30:49 -06:00
Hans Johnson
b5093e8122 PERF: Allow compiler to choose best way to construct a copy
With move semantics added to the language and the standard library updated with
move constructors added for many types it is now interesting to take an
argument directly by value, instead of by const-reference, and then copy. This
check allows the compiler to take care of choosing the best way to construct
the copy.

The transformation is usually beneficial when the calling code passes an rvalue
and assumes the move construction is a cheap operation. This short example
illustrates how the construction of the value happens:

SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD

cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-pass-by-value  -header-filter=.* -fix
2019-01-15 18:30:49 -06:00
Hans Johnson
31d65711d6 ENH: Remove conditionals for unsupported VS compilers
Visual Studio 12 (2013) with _MSC_VER=1800 is the oldest supported
compiler with sufficient C++11 capabilities

See:
https://blogs.msdn.microsoft.com/vcblog/2013/12/02/c1114-core-language-features-in-vs-2013-and-the-nov-2013-ctp/
for details related to language features supported.
2019-01-14 16:27:52 -06:00
Hans Johnson
2853b1cdac COMP: Use C++11 override directly
The override support in C++11 is required so avoid aliasing
this feature.  Compilers that do not support the override keyword
are no longer supported.
2019-01-14 16:14:12 -06:00
Orivej Desh
d8723104f3 Update removeMember docs after #693 2018-12-31 07:37:07 +07:00
Mathias L. Baumann
08ddeed927 JsonValue documentation: Rephrase confusing sentence 2018-12-30 15:33:43 -06:00
Hans Johnson
0417e626c0 STYLE: Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands.  Later command names
became case-insensitive.  Now the preferred style is lower-case.
2018-12-30 15:32:57 -06:00