Commit Graph

282 Commits

Author SHA1 Message Date
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
e50bfefef1 COMP: Prefer the C++ headers over the C99 headers
Using the C++11 headers keeps the library cleaner and more
rigorously scoped use of namespaces.
2018-12-30 15:29:22 -06:00
Hans Johnson
5c8e539af4 ENH: MSVS 2013 snprintf compatible substitute
Simplify the backwards compatible snprintf configuration for pre
1900 version of MSVC.  Otherwise prefer C++11 syntax using std::snprintf.
2018-12-30 15:29:22 -06:00
Radoslav Atanasov
ccd077ffce Fix MSVC 15.9 (2017) warning C4866
by changing operator[] param type from JSONCPP_STRING to const JSONCPP_STRING& for CharReaderBuilder and StreamWriterBuilder (as it is already in Value).

https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c4866?view=vs-2017
2018-12-30 15:28:09 -06:00
Hans Johnson
f64244ed3f COMP: Use nullptr instead of 0 or NULL
The check converts the usage of null pointer constants (eg. NULL, 0) to
use the new C++11 nullptr keyword.

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-nullptr  -header-filter=.* -fix
2018-12-12 13:41:06 -06:00
YantaoZhao
e32ee4717c allow nullptr when not care the removed array value 2018-07-03 21:29:18 +08:00
Marian Klymov
fc20134c92 Fix different names for parameters in declaration and definition 2018-06-02 20:15:26 +03:00
Marian Klymov
48112c8b62 Make several methods static. 2018-06-02 19:43:31 +03:00
Marian Klymov
c8bb600d27 Pass string as a const reference. 2018-06-02 19:41:57 +03:00
Billy Donahue
b5e1fe89aa Apply the formatting specified in .clang-format file.
$ clang-format --version
  clang-format version 7.0.0 (tags/google/stable/2018-01-11)
  $ clang-format -i --style=file $(find . -name '*.cpp' -o -name '*.h')
2018-05-20 18:38:42 -04:00
Mike R
a07fc53287 Add setting precision for json writers and also add decimal places precision type. (#752)
* Added setting precision for writers.
* Added special case for precise precision and global precision.
* Added good setting of type of precision and also added this type to BuiltStreamWriter and for its settings.
* Added some tests.
2018-03-13 15:35:31 -05:00
Billy Donahue
1d95628ba8
Remove std::swap<Json::Value> in favor of ADL
Comply with http://en.cppreference.com/w/cpp/concept/Swappable
Don't open namespace std.
2018-03-06 12:51:58 -05:00
uvok cheetah
c7728e8658 Clarify documentation regarding indentation / newline 2018-03-03 12:45:54 +01:00
luzpaz
5b45aa55ca Misc-typos (#741)
Found in downstream CMake repo via `codespell -q 3`
2018-02-08 19:05:50 -06:00
drgler
04abe38148 Issue #731: Provide new JSONCPP_OP_EXPLICIT macro to restore VS 2012 support after recent introduction of explicit conversion function in JSON::Value. 2018-01-20 15:38:39 -06:00
Christof Krüger
edb4bdb7ec Do not deprecate whole class but only constructors of Json::Reader.
This should fix warning C4996 issued by Visual Studio in cases where
Json::Reader is not even used by client code.
2018-01-20 15:32:22 -06:00
Andrey Okoshkin
9b569c8ce3 Make Value copy constructor simplier
Helper private methods Value::dupPayload() and Value::dupMeta() are added.
Value copy constructor doesn't attempt to delete its data first.
* Value::dupPayload() duplicates a payload.
* Value::dupMeta() duplicates comments and an offset position with a limit.
2018-01-12 15:59:20 +03:00
Andrey Okoshkin
c69148c946 Fix Value::copyPayload() and Value::copy() (#704)
Value copy constructor shares the same code with Value::copy() and Value::copyPayload().
New Value::releasePayload() is used to free payload memory.
Fixes: #704
2018-01-12 14:33:47 +03:00
Darcy Beurle
798f6ba055
CZString as public when using NVCC, see issue #486 2017-12-22 22:48:20 +01:00
Christopher Dunn
ddabf50f72 1.8.4; soversion=20 2017-12-20 15:07:10 -06:00