Commit Graph

80 Commits

Author SHA1 Message Date
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
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
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
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
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
Josh Soref
e6a588a246 Spelling (#703) 2017-12-03 10:54:29 -06:00
Hugh Bellamy
7287065b63 Fix unknown pragma warnings with clang 2017-09-16 10:01:09 +01:00
Christopher Dunn
132840aaa1 More VS warning prevention
See comment by jpo38 in SO:
* https://stackoverflow.com/questions/46151531/how-works-deprecated-warnings-and-how-to-remove-them-when-using-jsoncpp/46156833#46156833
2017-09-11 13:44:07 -05:00
Motti Lanzkron
9bb984a594 Update writer.h
fix typos
2017-09-11 13:17:21 -05:00
damiram
ef16a35328 Fixing warnings. Added JSONCPP_DEPRECATED definition for clang. Also updating .gitignore to ignore .DS_Store files (Mac OS Finder generated) 2017-08-02 22:44:42 -07:00
Devin Jeanpierre
59e4d35339 Restore BL's authorship attribution, and add "The Jsoncpp Authors" where it was missing.
Requested/noticed in https://github.com/open-source-parsers/jsoncpp/pull/610, and a
followup to https://github.com/open-source-parsers/jsoncpp/pull/607 .
2017-07-21 03:44:36 -07:00
Sergiy80
d6e666f573 Add pragma pack directive
Related to https://github.com/open-source-parsers/jsoncpp/issues/458
2016-12-03 22:29:14 +02:00
Christopher Dunn
98e981dff9 Use macro for override
b/c MS VS2010 is supposed to be C++11 but does not fulfull
the entire standard.

Resolves #410.
Re: #430.
2016-03-21 21:00:24 -05:00
Christopher Dawes
75570d7068 Fixing up for #define instead of typedef in secure allocators 2016-03-14 19:15:17 -05:00
Christopher Dunn
724ba29bd3 JSONCPP_OSTREAM 2016-03-06 11:56:38 -06:00
Christopher Dunn
fef4b75796 More conversion fixes for gcc 2016-02-06 10:10:49 -06:00
Christopher Dunn
d4513fcf45 Fix conversion warnings/errors
See #411.
  http://paste.debian.net/378673/
2016-02-06 09:25:20 -06:00
Gaurav
aadd0b1b63 C++11: override keyword
Source : http://en.cppreference.com/w/cpp/language/override
2015-09-05 12:03:38 -05:00
drgler
2084563efb Floating-point NaN or Infinity values should be allowed as a feature #209
Introduce 'allowSpecialFloats' for readers and 'useSpecialFloats' for writers, use consistent macro snprintf definition for writers and readers, provide new unit tests for #209
2015-09-03 22:19:22 +02:00
Christopher Dunn
ed495edcc1 prefer ValueIterator::name() to ::memberName()
in case of embedded nulls
2015-03-08 14:35:00 -05:00
Christopher Dunn
717b08695e clarify errors
* use macros for logic errors, not input errors
* throw on parsing failure in `operator>>()`, not assert
* throw on malloc, not assert
2015-03-08 12:06:22 -05:00
Christopher Dunn
eaa3fd8eca maybe fix DLL symbols for VS 2015-03-05 10:11:43 -06:00
Christopher Dunn
37dde9d29d fix example in docs 2015-03-05 09:18:06 -06:00
Christopher Dunn
c312dd5ef7 Builder::operator[] plus tests 2015-03-05 09:18:01 -06:00
Christopher Dunn
29501c4d9f clarify comments
And throw instead of return null for invalid settings.
2015-02-10 23:03:27 -06:00
Christopher Dunn
20d09676c2 drop experimental OldCompressingStreamWriterBuilder 2015-02-10 21:29:35 -06:00
Christopher Dunn
5a744708fc enableYAMLCompatibility and dropNullPlaceholders for StreamWriterBuilder 2015-02-10 21:28:13 -06:00
Christopher Dunn
db75cdf21e mv CommentStyle to .cpp 2015-02-09 18:54:58 -06:00
Christopher Dunn
c41609b9f9 set output stream in write(), not in builder 2015-02-09 18:44:53 -06:00
Christopher Dunn
f757c18ca0 add all features 2015-02-09 18:24:56 -06:00
Christopher Dunn
3cf9175bde remark defaults via doxygen snippet 2015-02-09 18:16:24 -06:00
Christopher Dunn
a9e1ab302d Builder::settings_
We use Json::Value to configure the builders so we can maintain
binary-compatibility easily.
2015-02-09 17:30:11 -06:00
Christopher Dunn
694dbcb328 update docs, writeString() 2015-02-09 15:25:57 -06:00
Christopher Dunn
1357cddf1e deprecate Builders
see issue #131
2015-02-09 11:46:27 -06:00
Christopher Dunn
6451412c99 simplify basic docs 2015-02-09 09:44:26 -06:00
Christopher Dunn
66a8ba255f clarify Builders 2015-02-09 01:29:43 -06:00
Christopher Dunn
198cc350c5 drop scoped enum, for pre-C++11 compatibility 2015-01-29 13:49:21 -06:00
Christopher Dunn
38042b3892 docs 2015-01-26 11:38:38 -06:00
Christopher Dunn
7eca3b4e88 gcc-4.6 (Travis CI) does not support 2015-01-26 11:17:42 -06:00
Christopher Dunn
999f5912f0 docs 2015-01-26 11:12:53 -06:00
Christopher Dunn
6065a1c142 make StreamWriterBuilder concrete 2015-01-26 11:01:15 -06:00
Christopher Dunn
28a20917b0 Move old FastWriter stuff out of new Builder 2015-01-26 10:47:42 -06:00
Christopher Dunn
177b7b8f22 OldCompressingStreamWriterBuilder 2015-01-26 10:44:20 -06:00