Skip to content

Commit 9fa4e84

Browse files
committed
Ran clang-format over all .h and .cpp files.
clang-format -i $(find . -name '*.h' -or -name '*.cpp')
1 parent 1b137a3 commit 9fa4e84

File tree

19 files changed

+6354
-7451
lines changed

19 files changed

+6354
-7451
lines changed

include/json/assertions.h

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,38 @@
44
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
55

66
#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED
7-
# define CPPTL_JSON_ASSERTIONS_H_INCLUDED
7+
#define CPPTL_JSON_ASSERTIONS_H_INCLUDED
88

99
#include <stdlib.h>
1010

1111
#if !defined(JSON_IS_AMALGAMATION)
12-
# include <json/config.h>
12+
#include <json/config.h>
1313
#endif // if !defined(JSON_IS_AMALGAMATION)
1414

1515
#if JSON_USE_EXCEPTION
16-
# include <stdexcept>
17-
#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw
18-
#define JSON_FAIL_MESSAGE( message ) throw std::runtime_error( message );
19-
#else // JSON_USE_EXCEPTION
20-
#define JSON_ASSERT( condition ) assert( condition );
16+
#include <stdexcept>
17+
#define JSON_ASSERT(condition) \
18+
assert(condition); // @todo <= change this into an exception throw
19+
#define JSON_FAIL_MESSAGE(message) throw std::runtime_error(message);
20+
#else // JSON_USE_EXCEPTION
21+
#define JSON_ASSERT(condition) assert(condition);
2122

2223
// The call to assert() will show the failure message in debug builds. In
2324
// release bugs we write to invalid memory in order to crash hard, so that a
2425
// debugger or crash reporter gets the chance to take over. We still call exit()
2526
// afterward in order to tell the compiler that this macro doesn't return.
26-
#define JSON_FAIL_MESSAGE( message ) { assert(false && message); strcpy(reinterpret_cast<char*>(666), message); exit(123); }
27+
#define JSON_FAIL_MESSAGE(message) \
28+
{ \
29+
assert(false &&message); \
30+
strcpy(reinterpret_cast<char *>(666), message); \
31+
exit(123); \
32+
}
2733

2834
#endif
2935

30-
#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) { JSON_FAIL_MESSAGE( message ) }
36+
#define JSON_ASSERT_MESSAGE(condition, message) \
37+
if (!(condition)) { \
38+
JSON_FAIL_MESSAGE(message) \
39+
}
3140

3241
#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED

include/json/autolink.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@
44
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
55

66
#ifndef JSON_AUTOLINK_H_INCLUDED
7-
# define JSON_AUTOLINK_H_INCLUDED
7+
#define JSON_AUTOLINK_H_INCLUDED
88

9-
# include "config.h"
9+
#include "config.h"
1010

11-
# ifdef JSON_IN_CPPTL
12-
# include <cpptl/cpptl_autolink.h>
13-
# endif
11+
#ifdef JSON_IN_CPPTL
12+
#include <cpptl/cpptl_autolink.h>
13+
#endif
1414

15-
# if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && !defined(JSON_IN_CPPTL)
16-
# define CPPTL_AUTOLINK_NAME "json"
17-
# undef CPPTL_AUTOLINK_DLL
18-
# ifdef JSON_DLL
19-
# define CPPTL_AUTOLINK_DLL
20-
# endif
21-
# include "autolink.h"
22-
# endif
15+
#if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && \
16+
!defined(JSON_IN_CPPTL)
17+
#define CPPTL_AUTOLINK_NAME "json"
18+
#undef CPPTL_AUTOLINK_DLL
19+
#ifdef JSON_DLL
20+
#define CPPTL_AUTOLINK_DLL
21+
#endif
22+
#include "autolink.h"
23+
#endif
2324

2425
#endif // JSON_AUTOLINK_H_INCLUDED

include/json/config.h

Lines changed: 61 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,105 +4,109 @@
44
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
55

66
#ifndef JSON_CONFIG_H_INCLUDED
7-
# define JSON_CONFIG_H_INCLUDED
7+
#define JSON_CONFIG_H_INCLUDED
88

99
/// If defined, indicates that json library is embedded in CppTL library.
1010
//# define JSON_IN_CPPTL 1
1111

1212
/// If defined, indicates that json may leverage CppTL library
1313
//# define JSON_USE_CPPTL 1
14-
/// If defined, indicates that cpptl vector based map should be used instead of std::map
14+
/// If defined, indicates that cpptl vector based map should be used instead of
15+
/// std::map
1516
/// as Value container.
1617
//# define JSON_USE_CPPTL_SMALLMAP 1
1718
/// If defined, indicates that Json specific container should be used
1819
/// (hash table & simple deque container with customizable allocator).
1920
/// THIS FEATURE IS STILL EXPERIMENTAL! There is know bugs: See #3177332
2021
//# define JSON_VALUE_USE_INTERNAL_MAP 1
21-
/// Force usage of standard new/malloc based allocator instead of memory pool based allocator.
22-
/// The memory pools allocator used optimization (initializing Value and ValueInternalLink
22+
/// Force usage of standard new/malloc based allocator instead of memory pool
23+
/// based allocator.
24+
/// The memory pools allocator used optimization (initializing Value and
25+
/// ValueInternalLink
2326
/// as if it was a POD) that may cause some validation tool to report errors.
2427
/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined.
2528
//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1
2629

2730
// If non-zero, the library uses exceptions to report bad input instead of C
2831
// assertion macros. The default is to use exceptions.
29-
# ifndef JSON_USE_EXCEPTION
30-
# define JSON_USE_EXCEPTION 1
31-
# endif
32+
#ifndef JSON_USE_EXCEPTION
33+
#define JSON_USE_EXCEPTION 1
34+
#endif
3235

3336
/// If defined, indicates that the source file is amalgated
3437
/// to prevent private header inclusion.
3538
/// Remarks: it is automatically defined in the generated amalgated header.
3639
// #define JSON_IS_AMALGAMATION
3740

41+
#ifdef JSON_IN_CPPTL
42+
#include <cpptl/config.h>
43+
#ifndef JSON_USE_CPPTL
44+
#define JSON_USE_CPPTL 1
45+
#endif
46+
#endif
3847

39-
# ifdef JSON_IN_CPPTL
40-
# include <cpptl/config.h>
41-
# ifndef JSON_USE_CPPTL
42-
# define JSON_USE_CPPTL 1
43-
# endif
44-
# endif
45-
46-
# ifdef JSON_IN_CPPTL
47-
# define JSON_API CPPTL_API
48-
# elif defined(JSON_DLL_BUILD)
49-
# if defined(_MSC_VER)
50-
# define JSON_API __declspec(dllexport)
51-
# define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
52-
# endif // if defined(_MSC_VER)
53-
# elif defined(JSON_DLL)
54-
# if defined(_MSC_VER)
55-
# define JSON_API __declspec(dllimport)
56-
# define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
57-
# endif // if defined(_MSC_VER)
58-
# endif // ifdef JSON_IN_CPPTL
59-
# if !defined(JSON_API)
60-
# define JSON_API
61-
# endif
48+
#ifdef JSON_IN_CPPTL
49+
#define JSON_API CPPTL_API
50+
#elif defined(JSON_DLL_BUILD)
51+
#if defined(_MSC_VER)
52+
#define JSON_API __declspec(dllexport)
53+
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
54+
#endif // if defined(_MSC_VER)
55+
#elif defined(JSON_DLL)
56+
#if defined(_MSC_VER)
57+
#define JSON_API __declspec(dllimport)
58+
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
59+
#endif // if defined(_MSC_VER)
60+
#endif // ifdef JSON_IN_CPPTL
61+
#if !defined(JSON_API)
62+
#define JSON_API
63+
#endif
6264

63-
// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for integer
65+
// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
66+
// integer
6467
// Storages, and 64 bits integer support is disabled.
6568
// #define JSON_NO_INT64 1
6669

67-
#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6
70+
#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6
6871
// Microsoft Visual Studio 6 only support conversion from __int64 to double
6972
// (no conversion from unsigned __int64).
7073
#define JSON_USE_INT64_DOUBLE_CONVERSION 1
71-
// Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' characters in the debug information)
72-
// All projects I've ever seen with VS6 were using this globally (not bothering with pragma push/pop).
74+
// Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
75+
// characters in the debug information)
76+
// All projects I've ever seen with VS6 were using this globally (not bothering
77+
// with pragma push/pop).
7378
#pragma warning(disable : 4786)
7479
#endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6
7580

76-
#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
81+
#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
7782
/// Indicates that the following function is deprecated.
78-
# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
83+
#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
7984
#endif
8085

8186
#if !defined(JSONCPP_DEPRECATED)
82-
# define JSONCPP_DEPRECATED(message)
87+
#define JSONCPP_DEPRECATED(message)
8388
#endif // if !defined(JSONCPP_DEPRECATED)
8489

8590
namespace Json {
86-
typedef int Int;
87-
typedef unsigned int UInt;
88-
# if defined(JSON_NO_INT64)
89-
typedef int LargestInt;
90-
typedef unsigned int LargestUInt;
91-
# undef JSON_HAS_INT64
92-
# else // if defined(JSON_NO_INT64)
93-
// For Microsoft Visual use specific types as long long is not supported
94-
# if defined(_MSC_VER) // Microsoft Visual Studio
95-
typedef __int64 Int64;
96-
typedef unsigned __int64 UInt64;
97-
# else // if defined(_MSC_VER) // Other platforms, use long long
98-
typedef long long int Int64;
99-
typedef unsigned long long int UInt64;
100-
# endif // if defined(_MSC_VER)
101-
typedef Int64 LargestInt;
102-
typedef UInt64 LargestUInt;
103-
# define JSON_HAS_INT64
104-
# endif // if defined(JSON_NO_INT64)
91+
typedef int Int;
92+
typedef unsigned int UInt;
93+
#if defined(JSON_NO_INT64)
94+
typedef int LargestInt;
95+
typedef unsigned int LargestUInt;
96+
#undef JSON_HAS_INT64
97+
#else // if defined(JSON_NO_INT64)
98+
// For Microsoft Visual use specific types as long long is not supported
99+
#if defined(_MSC_VER) // Microsoft Visual Studio
100+
typedef __int64 Int64;
101+
typedef unsigned __int64 UInt64;
102+
#else // if defined(_MSC_VER) // Other platforms, use long long
103+
typedef long long int Int64;
104+
typedef unsigned long long int UInt64;
105+
#endif // if defined(_MSC_VER)
106+
typedef Int64 LargestInt;
107+
typedef UInt64 LargestUInt;
108+
#define JSON_HAS_INT64
109+
#endif // if defined(JSON_NO_INT64)
105110
} // end namespace Json
106111

107-
108112
#endif // JSON_CONFIG_H_INCLUDED

include/json/features.h

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,53 @@
44
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
55

66
#ifndef CPPTL_JSON_FEATURES_H_INCLUDED
7-
# define CPPTL_JSON_FEATURES_H_INCLUDED
7+
#define CPPTL_JSON_FEATURES_H_INCLUDED
88

99
#if !defined(JSON_IS_AMALGAMATION)
10-
# include "forwards.h"
10+
#include "forwards.h"
1111
#endif // if !defined(JSON_IS_AMALGAMATION)
1212

1313
namespace Json {
1414

15-
/** \brief Configuration passed to reader and writer.
16-
* This configuration object can be used to force the Reader or Writer
17-
* to behave in a standard conforming way.
18-
*/
19-
class JSON_API Features
20-
{
21-
public:
22-
/** \brief A configuration that allows all features and assumes all strings are UTF-8.
23-
* - C & C++ comments are allowed
24-
* - Root object can be any JSON value
25-
* - Assumes Value strings are encoded in UTF-8
26-
*/
27-
static Features all();
28-
29-
/** \brief A configuration that is strictly compatible with the JSON specification.
30-
* - Comments are forbidden.
31-
* - Root object must be either an array or an object value.
32-
* - Assumes Value strings are encoded in UTF-8
33-
*/
34-
static Features strictMode();
35-
36-
/** \brief Initialize the configuration like JsonConfig::allFeatures;
37-
*/
38-
Features();
39-
40-
/// \c true if comments are allowed. Default: \c true.
41-
bool allowComments_;
42-
43-
/// \c true if root must be either an array or an object value. Default: \c false.
44-
bool strictRoot_;
45-
46-
/// \c true if dropped null placeholders are allowed. Default: \c false.
47-
bool allowDroppedNullPlaceholders_;
48-
49-
/// \c true if numeric object key are allowed. Default: \c false.
50-
bool allowNumericKeys_;
51-
};
15+
/** \brief Configuration passed to reader and writer.
16+
* This configuration object can be used to force the Reader or Writer
17+
* to behave in a standard conforming way.
18+
*/
19+
class JSON_API Features {
20+
public:
21+
/** \brief A configuration that allows all features and assumes all strings
22+
* are UTF-8.
23+
* - C & C++ comments are allowed
24+
* - Root object can be any JSON value
25+
* - Assumes Value strings are encoded in UTF-8
26+
*/
27+
static Features all();
28+
29+
/** \brief A configuration that is strictly compatible with the JSON
30+
* specification.
31+
* - Comments are forbidden.
32+
* - Root object must be either an array or an object value.
33+
* - Assumes Value strings are encoded in UTF-8
34+
*/
35+
static Features strictMode();
36+
37+
/** \brief Initialize the configuration like JsonConfig::allFeatures;
38+
*/
39+
Features();
40+
41+
/// \c true if comments are allowed. Default: \c true.
42+
bool allowComments_;
43+
44+
/// \c true if root must be either an array or an object value. Default: \c
45+
/// false.
46+
bool strictRoot_;
47+
48+
/// \c true if dropped null placeholders are allowed. Default: \c false.
49+
bool allowDroppedNullPlaceholders_;
50+
51+
/// \c true if numeric object key are allowed. Default: \c false.
52+
bool allowNumericKeys_;
53+
};
5254

5355
} // namespace Json
5456

0 commit comments

Comments
 (0)