passenger 6.0.15 → 6.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +25 -2
- data/src/agent/Core/Config.h +1 -1
- data/src/agent/Core/Controller/Config.h +1 -1
- data/src/agent/Watchdog/Config.h +1 -1
- data/src/cxx_supportlib/Constants.h +1 -1
- data/src/cxx_supportlib/vendor-modified/jsoncpp/json-forwards.h +143 -261
- data/src/cxx_supportlib/vendor-modified/jsoncpp/json.h +763 -947
- data/src/cxx_supportlib/vendor-modified/jsoncpp/jsoncpp.cpp +1477 -1487
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +1 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +3 -2
- data/src/ruby_supportlib/phusion_passenger/platform_info/binary_compatibility.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +4 -4
- data/src/ruby_supportlib/phusion_passenger.rb +1 -1
- metadata +2 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
/// Json-cpp
|
1
|
+
/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/).
|
2
2
|
/// It is intended to be used with #include "json/json.h"
|
3
3
|
|
4
4
|
// //////////////////////////////////////////////////////////////////////
|
@@ -10,13 +10,13 @@ The JsonCpp library's source code, including accompanying documentation,
|
|
10
10
|
tests and demonstration applications, are licensed under the following
|
11
11
|
conditions...
|
12
12
|
|
13
|
-
|
13
|
+
The JsonCpp Authors explicitly disclaim copyright in all
|
14
14
|
jurisdictions which recognize such a disclaimer. In such jurisdictions,
|
15
15
|
this software is released into the Public Domain.
|
16
16
|
|
17
17
|
In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
|
18
|
-
2010), this software is Copyright (c) 2007-2010 by
|
19
|
-
|
18
|
+
2010), this software is Copyright (c) 2007-2010 by The JsonCpp Authors, and is
|
19
|
+
released under the terms of the MIT License (see below).
|
20
20
|
|
21
21
|
In jurisdictions which recognize Public Domain property, the user of this
|
22
22
|
software may choose to accept it either as 1) Public Domain, 2) under the
|
@@ -31,7 +31,7 @@ described in clear, concise terms at:
|
|
31
31
|
The full text of the MIT License follows:
|
32
32
|
|
33
33
|
========================================================================
|
34
|
-
Copyright (c) 2007-2010
|
34
|
+
Copyright (c) 2007-2010 The JsonCpp Authors
|
35
35
|
|
36
36
|
Permission is hereby granted, free of charge, to any person
|
37
37
|
obtaining a copy of this software and associated documentation
|
@@ -72,9 +72,9 @@ license you like.
|
|
72
72
|
|
73
73
|
|
74
74
|
|
75
|
-
#ifndef
|
76
|
-
# define
|
77
|
-
/// If defined, indicates that the source file is
|
75
|
+
#ifndef JSON_AMALGATED_H_INCLUDED
|
76
|
+
# define JSON_AMALGATED_H_INCLUDED
|
77
|
+
/// If defined, indicates that the source file is amalgated
|
78
78
|
/// to prevent private header inclusion.
|
79
79
|
#define JSON_IS_AMALGAMATION
|
80
80
|
|
@@ -82,25 +82,17 @@ license you like.
|
|
82
82
|
// Beginning of content of file: include/json/version.h
|
83
83
|
// //////////////////////////////////////////////////////////////////////
|
84
84
|
|
85
|
+
// DO NOT EDIT. This file (and "version") is generated by CMake.
|
86
|
+
// Run CMake configure step to update it.
|
85
87
|
#ifndef JSON_VERSION_H_INCLUDED
|
86
|
-
#define JSON_VERSION_H_INCLUDED
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
// IMPORTANT: also update the SOVERSION!!
|
95
|
-
|
96
|
-
#define JSONCPP_VERSION_STRING "1.9.5"
|
97
|
-
#define JSONCPP_VERSION_MAJOR 1
|
98
|
-
#define JSONCPP_VERSION_MINOR 9
|
99
|
-
#define JSONCPP_VERSION_PATCH 5
|
100
|
-
#define JSONCPP_VERSION_QUALIFIER
|
101
|
-
#define JSONCPP_VERSION_HEXA \
|
102
|
-
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \
|
103
|
-
(JSONCPP_VERSION_PATCH << 8))
|
88
|
+
# define JSON_VERSION_H_INCLUDED
|
89
|
+
|
90
|
+
# define JSONCPP_VERSION_STRING "1.8.1"
|
91
|
+
# define JSONCPP_VERSION_MAJOR 1
|
92
|
+
# define JSONCPP_VERSION_MINOR 8
|
93
|
+
# define JSONCPP_VERSION_PATCH 1
|
94
|
+
# define JSONCPP_VERSION_QUALIFIER
|
95
|
+
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
|
104
96
|
|
105
97
|
#ifdef JSONCPP_USING_SECURE_MEMORY
|
106
98
|
#undef JSONCPP_USING_SECURE_MEMORY
|
@@ -120,129 +112,30 @@ license you like.
|
|
120
112
|
|
121
113
|
|
122
114
|
|
123
|
-
// //////////////////////////////////////////////////////////////////////
|
124
|
-
// Beginning of content of file: include/json/allocator.h
|
125
|
-
// //////////////////////////////////////////////////////////////////////
|
126
|
-
|
127
|
-
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
128
|
-
// Distributed under MIT license, or public domain if desired and
|
129
|
-
// recognized in your jurisdiction.
|
130
|
-
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
131
|
-
|
132
|
-
#ifndef JSON_ALLOCATOR_H_INCLUDED
|
133
|
-
#define JSON_ALLOCATOR_H_INCLUDED
|
134
|
-
|
135
|
-
#include <cstring>
|
136
|
-
#include <memory>
|
137
|
-
|
138
|
-
#pragma pack(push, 8)
|
139
|
-
|
140
|
-
namespace Passenger {
|
141
|
-
namespace Json {
|
142
|
-
template <typename T> class SecureAllocator {
|
143
|
-
public:
|
144
|
-
// Type definitions
|
145
|
-
using value_type = T;
|
146
|
-
using pointer = T*;
|
147
|
-
using const_pointer = const T*;
|
148
|
-
using reference = T&;
|
149
|
-
using const_reference = const T&;
|
150
|
-
using size_type = std::size_t;
|
151
|
-
using difference_type = std::ptrdiff_t;
|
152
|
-
|
153
|
-
/**
|
154
|
-
* Allocate memory for N items using the standard allocator.
|
155
|
-
*/
|
156
|
-
pointer allocate(size_type n) {
|
157
|
-
// allocate using "global operator new"
|
158
|
-
return static_cast<pointer>(::operator new(n * sizeof(T)));
|
159
|
-
}
|
160
|
-
|
161
|
-
/**
|
162
|
-
* Release memory which was allocated for N items at pointer P.
|
163
|
-
*
|
164
|
-
* The memory block is filled with zeroes before being released.
|
165
|
-
*/
|
166
|
-
void deallocate(pointer p, size_type n) {
|
167
|
-
// memset_s is used because memset may be optimized away by the compiler
|
168
|
-
memset_s(p, n * sizeof(T), 0, n * sizeof(T));
|
169
|
-
// free using "global operator delete"
|
170
|
-
::operator delete(p);
|
171
|
-
}
|
172
|
-
|
173
|
-
/**
|
174
|
-
* Construct an item in-place at pointer P.
|
175
|
-
*/
|
176
|
-
template <typename... Args> void construct(pointer p, Args&&... args) {
|
177
|
-
// construct using "placement new" and "perfect forwarding"
|
178
|
-
::new (static_cast<void*>(p)) T(std::forward<Args>(args)...);
|
179
|
-
}
|
180
|
-
|
181
|
-
size_type max_size() const { return size_t(-1) / sizeof(T); }
|
182
|
-
|
183
|
-
pointer address(reference x) const { return std::addressof(x); }
|
184
|
-
|
185
|
-
const_pointer address(const_reference x) const { return std::addressof(x); }
|
186
|
-
|
187
|
-
/**
|
188
|
-
* Destroy an item in-place at pointer P.
|
189
|
-
*/
|
190
|
-
void destroy(pointer p) {
|
191
|
-
// destroy using "explicit destructor"
|
192
|
-
p->~T();
|
193
|
-
}
|
194
|
-
|
195
|
-
// Boilerplate
|
196
|
-
SecureAllocator() {}
|
197
|
-
template <typename U> SecureAllocator(const SecureAllocator<U>&) {}
|
198
|
-
template <typename U> struct rebind { using other = SecureAllocator<U>; };
|
199
|
-
};
|
200
|
-
|
201
|
-
template <typename T, typename U>
|
202
|
-
bool operator==(const SecureAllocator<T>&, const SecureAllocator<U>&) {
|
203
|
-
return true;
|
204
|
-
}
|
205
|
-
|
206
|
-
template <typename T, typename U>
|
207
|
-
bool operator!=(const SecureAllocator<T>&, const SecureAllocator<U>&) {
|
208
|
-
return false;
|
209
|
-
}
|
210
|
-
|
211
|
-
} // namespace Json
|
212
|
-
} // namespace Passenger
|
213
|
-
|
214
|
-
#pragma pack(pop)
|
215
|
-
|
216
|
-
#endif // JSON_ALLOCATOR_H_INCLUDED
|
217
|
-
|
218
|
-
// //////////////////////////////////////////////////////////////////////
|
219
|
-
// End of content of file: include/json/allocator.h
|
220
|
-
// //////////////////////////////////////////////////////////////////////
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
115
|
// //////////////////////////////////////////////////////////////////////
|
228
116
|
// Beginning of content of file: include/json/config.h
|
229
117
|
// //////////////////////////////////////////////////////////////////////
|
230
118
|
|
231
|
-
// Copyright 2007-2010 Baptiste Lepilleur
|
119
|
+
// Copyright 2007-2010 Baptiste Lepilleur
|
232
120
|
// Distributed under MIT license, or public domain if desired and
|
233
121
|
// recognized in your jurisdiction.
|
234
122
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
235
123
|
|
236
124
|
#ifndef JSON_CONFIG_H_INCLUDED
|
237
125
|
#define JSON_CONFIG_H_INCLUDED
|
238
|
-
#include <
|
239
|
-
#include <
|
240
|
-
#include <
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
126
|
+
#include <stddef.h>
|
127
|
+
#include <string> //typedef String
|
128
|
+
#include <stdint.h> //typedef int64_t, uint64_t
|
129
|
+
|
130
|
+
/// If defined, indicates that json library is embedded in CppTL library.
|
131
|
+
//# define JSON_IN_CPPTL 1
|
132
|
+
|
133
|
+
/// If defined, indicates that json may leverage CppTL library
|
134
|
+
//# define JSON_USE_CPPTL 1
|
135
|
+
/// If defined, indicates that cpptl vector based map should be used instead of
|
136
|
+
/// std::map
|
137
|
+
/// as Value container.
|
138
|
+
//# define JSON_USE_CPPTL_SMALLMAP 1
|
246
139
|
|
247
140
|
// If non-zero, the library uses exceptions to report bad input instead of C
|
248
141
|
// assertion macros. The default is to use exceptions.
|
@@ -250,134 +143,163 @@ bool operator!=(const SecureAllocator<T>&, const SecureAllocator<U>&) {
|
|
250
143
|
#define JSON_USE_EXCEPTION 1
|
251
144
|
#endif
|
252
145
|
|
253
|
-
|
254
|
-
#ifndef JSON_USE_NULLREF
|
255
|
-
#define JSON_USE_NULLREF 1
|
256
|
-
#endif
|
257
|
-
|
258
|
-
/// If defined, indicates that the source file is amalgamated
|
146
|
+
/// If defined, indicates that the source file is amalgated
|
259
147
|
/// to prevent private header inclusion.
|
260
|
-
/// Remarks: it is automatically defined in the generated
|
148
|
+
/// Remarks: it is automatically defined in the generated amalgated header.
|
261
149
|
// #define JSON_IS_AMALGAMATION
|
262
150
|
|
263
|
-
|
264
|
-
#
|
151
|
+
#ifdef JSON_IN_CPPTL
|
152
|
+
#include <cpptl/config.h>
|
153
|
+
#ifndef JSON_USE_CPPTL
|
154
|
+
#define JSON_USE_CPPTL 1
|
155
|
+
#endif
|
156
|
+
#endif
|
157
|
+
|
158
|
+
#ifdef JSON_IN_CPPTL
|
159
|
+
#define JSON_API CPPTL_API
|
160
|
+
#elif defined(JSON_DLL_BUILD)
|
265
161
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
266
162
|
#define JSON_API __declspec(dllexport)
|
267
163
|
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
|
268
|
-
#elif defined(__GNUC__) || defined(__clang__)
|
269
|
-
#define JSON_API __attribute__((visibility("default")))
|
270
164
|
#endif // if defined(_MSC_VER)
|
271
|
-
|
272
165
|
#elif defined(JSON_DLL)
|
273
166
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
274
167
|
#define JSON_API __declspec(dllimport)
|
275
168
|
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
|
276
169
|
#endif // if defined(_MSC_VER)
|
277
|
-
#endif // ifdef
|
278
|
-
|
170
|
+
#endif // ifdef JSON_IN_CPPTL
|
279
171
|
#if !defined(JSON_API)
|
280
172
|
#define JSON_API
|
281
173
|
#endif
|
282
174
|
|
283
|
-
#if defined(_MSC_VER) && _MSC_VER < 1800
|
284
|
-
#error \
|
285
|
-
"ERROR: Visual Studio 12 (2013) with _MSC_VER=1800 is the oldest supported compiler with sufficient C++11 capabilities"
|
286
|
-
#endif
|
287
|
-
|
288
|
-
#if defined(_MSC_VER) && _MSC_VER < 1900
|
289
|
-
// As recommended at
|
290
|
-
// https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
|
291
|
-
extern JSON_API int msvc_pre1900_c99_snprintf(char* outBuf, size_t size,
|
292
|
-
const char* format, ...);
|
293
|
-
#define jsoncpp_snprintf msvc_pre1900_c99_snprintf
|
294
|
-
#else
|
295
|
-
#define jsoncpp_snprintf std::snprintf
|
296
|
-
#endif
|
297
|
-
|
298
175
|
// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
|
299
176
|
// integer
|
300
177
|
// Storages, and 64 bits integer support is disabled.
|
301
178
|
// #define JSON_NO_INT64 1
|
302
179
|
|
303
|
-
|
304
|
-
|
305
|
-
|
180
|
+
#if defined(_MSC_VER) // MSVC
|
181
|
+
# if _MSC_VER <= 1200 // MSVC 6
|
182
|
+
// Microsoft Visual Studio 6 only support conversion from __int64 to double
|
183
|
+
// (no conversion from unsigned __int64).
|
184
|
+
# define JSON_USE_INT64_DOUBLE_CONVERSION 1
|
185
|
+
// Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
|
186
|
+
// characters in the debug information)
|
187
|
+
// All projects I've ever seen with VS6 were using this globally (not bothering
|
188
|
+
// with pragma push/pop).
|
189
|
+
# pragma warning(disable : 4786)
|
190
|
+
# endif // MSVC 6
|
191
|
+
|
192
|
+
# if _MSC_VER >= 1500 // MSVC 2008
|
193
|
+
/// Indicates that the following function is deprecated.
|
194
|
+
# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
|
195
|
+
# endif
|
196
|
+
|
197
|
+
#endif // defined(_MSC_VER)
|
198
|
+
|
199
|
+
// In c++11 the override keyword allows you to explicity define that a function
|
200
|
+
// is intended to override the base-class version. This makes the code more
|
201
|
+
// managable and fixes a set of common hard-to-find bugs.
|
202
|
+
#if __cplusplus >= 201103L
|
203
|
+
# define JSONCPP_OVERRIDE override
|
204
|
+
# define JSONCPP_NOEXCEPT noexcept
|
205
|
+
#elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900
|
206
|
+
# define JSONCPP_OVERRIDE override
|
207
|
+
# define JSONCPP_NOEXCEPT throw()
|
208
|
+
#elif defined(_MSC_VER) && _MSC_VER >= 1900
|
209
|
+
# define JSONCPP_OVERRIDE override
|
210
|
+
# define JSONCPP_NOEXCEPT noexcept
|
211
|
+
#else
|
212
|
+
# define JSONCPP_OVERRIDE
|
213
|
+
# define JSONCPP_NOEXCEPT throw()
|
214
|
+
#endif
|
215
|
+
|
216
|
+
#ifndef JSON_HAS_RVALUE_REFERENCES
|
217
|
+
|
218
|
+
#if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
|
219
|
+
#define JSON_HAS_RVALUE_REFERENCES 1
|
220
|
+
#endif // MSVC >= 2010
|
306
221
|
|
307
222
|
#ifdef __clang__
|
308
|
-
#if
|
309
|
-
#define
|
223
|
+
#if __has_feature(cxx_rvalue_references)
|
224
|
+
#define JSON_HAS_RVALUE_REFERENCES 1
|
225
|
+
#endif // has_feature
|
226
|
+
|
227
|
+
#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
|
228
|
+
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
|
229
|
+
#define JSON_HAS_RVALUE_REFERENCES 1
|
230
|
+
#endif // GXX_EXPERIMENTAL
|
231
|
+
|
232
|
+
#endif // __clang__ || __GNUC__
|
233
|
+
|
234
|
+
#endif // not defined JSON_HAS_RVALUE_REFERENCES
|
235
|
+
|
236
|
+
#ifndef JSON_HAS_RVALUE_REFERENCES
|
237
|
+
#define JSON_HAS_RVALUE_REFERENCES 0
|
310
238
|
#endif
|
311
|
-
|
312
|
-
#
|
313
|
-
#
|
314
|
-
#
|
315
|
-
#define JSONCPP_DEPRECATED(message)
|
316
|
-
#
|
317
|
-
#
|
318
|
-
|
319
|
-
#
|
320
|
-
#endif // __clang__ || __GNUC__ || _MSC_VER
|
239
|
+
|
240
|
+
#ifdef __clang__
|
241
|
+
#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
|
242
|
+
# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
|
243
|
+
# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
|
244
|
+
# elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
|
245
|
+
# define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
|
246
|
+
# endif // GNUC version
|
247
|
+
#endif // __clang__ || __GNUC__
|
321
248
|
|
322
249
|
#if !defined(JSONCPP_DEPRECATED)
|
323
250
|
#define JSONCPP_DEPRECATED(message)
|
324
251
|
#endif // if !defined(JSONCPP_DEPRECATED)
|
325
252
|
|
326
|
-
#if
|
327
|
-
#define JSON_USE_INT64_DOUBLE_CONVERSION 1
|
253
|
+
#if __GNUC__ >= 6
|
254
|
+
# define JSON_USE_INT64_DOUBLE_CONVERSION 1
|
328
255
|
#endif
|
329
256
|
|
330
257
|
#if !defined(JSON_IS_AMALGAMATION)
|
331
258
|
|
332
|
-
#include "
|
333
|
-
|
259
|
+
# include "version.h"
|
260
|
+
|
261
|
+
# if JSONCPP_USING_SECURE_MEMORY
|
262
|
+
# include "allocator.h" //typedef Allocator
|
263
|
+
# endif
|
334
264
|
|
335
265
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
336
266
|
|
337
267
|
namespace Passenger {
|
338
268
|
namespace Json {
|
339
|
-
|
340
|
-
|
269
|
+
typedef int Int;
|
270
|
+
typedef unsigned int UInt;
|
341
271
|
#if defined(JSON_NO_INT64)
|
342
|
-
|
343
|
-
|
272
|
+
typedef int LargestInt;
|
273
|
+
typedef unsigned int LargestUInt;
|
344
274
|
#undef JSON_HAS_INT64
|
345
275
|
#else // if defined(JSON_NO_INT64)
|
346
276
|
// For Microsoft Visual use specific types as long long is not supported
|
347
277
|
#if defined(_MSC_VER) // Microsoft Visual Studio
|
348
|
-
|
349
|
-
|
278
|
+
typedef __int64 Int64;
|
279
|
+
typedef unsigned __int64 UInt64;
|
350
280
|
#else // if defined(_MSC_VER) // Other platforms, use long long
|
351
|
-
|
352
|
-
|
353
|
-
#endif
|
354
|
-
|
355
|
-
|
281
|
+
typedef int64_t Int64;
|
282
|
+
typedef uint64_t UInt64;
|
283
|
+
#endif // if defined(_MSC_VER)
|
284
|
+
typedef Int64 LargestInt;
|
285
|
+
typedef UInt64 LargestUInt;
|
356
286
|
#define JSON_HAS_INT64
|
357
287
|
#endif // if defined(JSON_NO_INT64)
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
} // namespace
|
373
|
-
} // namespace Passenger
|
374
|
-
|
375
|
-
// Legacy names (formerly macros).
|
376
|
-
using JSONCPP_STRING = Passenger::Json::String;
|
377
|
-
using JSONCPP_ISTRINGSTREAM = Passenger::Json::IStringStream;
|
378
|
-
using JSONCPP_OSTRINGSTREAM = Passenger::Json::OStringStream;
|
379
|
-
using JSONCPP_ISTREAM = Passenger::Json::IStream;
|
380
|
-
using JSONCPP_OSTREAM = Passenger::Json::OStream;
|
288
|
+
#if JSONCPP_USING_SECURE_MEMORY
|
289
|
+
#define JSONCPP_STRING std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
|
290
|
+
#define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
|
291
|
+
#define JSONCPP_OSTREAM std::basic_ostream<char, std::char_traits<char>>
|
292
|
+
#define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
|
293
|
+
#define JSONCPP_ISTREAM std::istream
|
294
|
+
#else
|
295
|
+
#define JSONCPP_STRING std::string
|
296
|
+
#define JSONCPP_OSTRINGSTREAM std::ostringstream
|
297
|
+
#define JSONCPP_OSTREAM std::ostream
|
298
|
+
#define JSONCPP_ISTRINGSTREAM std::istringstream
|
299
|
+
#define JSONCPP_ISTREAM std::istream
|
300
|
+
#endif // if JSONCPP_USING_SECURE_MEMORY
|
301
|
+
} // end namespace Json
|
302
|
+
} // end namespace Passenger
|
381
303
|
|
382
304
|
#endif // JSON_CONFIG_H_INCLUDED
|
383
305
|
|
@@ -394,7 +316,7 @@ using JSONCPP_OSTREAM = Passenger::Json::OStream;
|
|
394
316
|
// Beginning of content of file: include/json/forwards.h
|
395
317
|
// //////////////////////////////////////////////////////////////////////
|
396
318
|
|
397
|
-
// Copyright 2007-2010 Baptiste Lepilleur
|
319
|
+
// Copyright 2007-2010 Baptiste Lepilleur
|
398
320
|
// Distributed under MIT license, or public domain if desired and
|
399
321
|
// recognized in your jurisdiction.
|
400
322
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
@@ -410,23 +332,17 @@ namespace Passenger {
|
|
410
332
|
namespace Json {
|
411
333
|
|
412
334
|
// writer.h
|
413
|
-
class StreamWriter;
|
414
|
-
class StreamWriterBuilder;
|
415
|
-
class Writer;
|
416
335
|
class FastWriter;
|
417
336
|
class StyledWriter;
|
418
|
-
class StyledStreamWriter;
|
419
337
|
|
420
338
|
// reader.h
|
421
339
|
class Reader;
|
422
|
-
class CharReader;
|
423
|
-
class CharReaderBuilder;
|
424
340
|
|
425
|
-
//
|
341
|
+
// features.h
|
426
342
|
class Features;
|
427
343
|
|
428
344
|
// value.h
|
429
|
-
|
345
|
+
typedef unsigned int ArrayIndex;
|
430
346
|
class StaticString;
|
431
347
|
class Path;
|
432
348
|
class PathArgument;
|
@@ -450,16 +366,16 @@ class ValueConstIterator;
|
|
450
366
|
|
451
367
|
|
452
368
|
// //////////////////////////////////////////////////////////////////////
|
453
|
-
// Beginning of content of file: include/json/
|
369
|
+
// Beginning of content of file: include/json/features.h
|
454
370
|
// //////////////////////////////////////////////////////////////////////
|
455
371
|
|
456
|
-
// Copyright 2007-2010 Baptiste Lepilleur
|
372
|
+
// Copyright 2007-2010 Baptiste Lepilleur
|
457
373
|
// Distributed under MIT license, or public domain if desired and
|
458
374
|
// recognized in your jurisdiction.
|
459
375
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
460
376
|
|
461
|
-
#ifndef
|
462
|
-
#define
|
377
|
+
#ifndef CPPTL_JSON_FEATURES_H_INCLUDED
|
378
|
+
#define CPPTL_JSON_FEATURES_H_INCLUDED
|
463
379
|
|
464
380
|
#if !defined(JSON_IS_AMALGAMATION)
|
465
381
|
#include "forwards.h"
|
@@ -497,17 +413,17 @@ public:
|
|
497
413
|
Features();
|
498
414
|
|
499
415
|
/// \c true if comments are allowed. Default: \c true.
|
500
|
-
bool allowComments_
|
416
|
+
bool allowComments_;
|
501
417
|
|
502
418
|
/// \c true if root must be either an array or an object value. Default: \c
|
503
419
|
/// false.
|
504
|
-
bool strictRoot_
|
420
|
+
bool strictRoot_;
|
505
421
|
|
506
422
|
/// \c true if dropped null placeholders are allowed. Default: \c false.
|
507
|
-
bool allowDroppedNullPlaceholders_
|
423
|
+
bool allowDroppedNullPlaceholders_;
|
508
424
|
|
509
425
|
/// \c true if numeric object key are allowed. Default: \c false.
|
510
|
-
bool allowNumericKeys_
|
426
|
+
bool allowNumericKeys_;
|
511
427
|
};
|
512
428
|
|
513
429
|
} // namespace Json
|
@@ -515,10 +431,10 @@ public:
|
|
515
431
|
|
516
432
|
#pragma pack(pop)
|
517
433
|
|
518
|
-
#endif //
|
434
|
+
#endif // CPPTL_JSON_FEATURES_H_INCLUDED
|
519
435
|
|
520
436
|
// //////////////////////////////////////////////////////////////////////
|
521
|
-
// End of content of file: include/json/
|
437
|
+
// End of content of file: include/json/features.h
|
522
438
|
// //////////////////////////////////////////////////////////////////////
|
523
439
|
|
524
440
|
|
@@ -530,59 +446,48 @@ public:
|
|
530
446
|
// Beginning of content of file: include/json/value.h
|
531
447
|
// //////////////////////////////////////////////////////////////////////
|
532
448
|
|
533
|
-
// Copyright 2007-2010 Baptiste Lepilleur
|
449
|
+
// Copyright 2007-2010 Baptiste Lepilleur
|
534
450
|
// Distributed under MIT license, or public domain if desired and
|
535
451
|
// recognized in your jurisdiction.
|
536
452
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
537
453
|
|
538
|
-
#ifndef
|
539
|
-
#define
|
454
|
+
#ifndef CPPTL_JSON_H_INCLUDED
|
455
|
+
#define CPPTL_JSON_H_INCLUDED
|
540
456
|
|
541
457
|
#if !defined(JSON_IS_AMALGAMATION)
|
542
458
|
#include "forwards.h"
|
543
459
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
460
|
+
#include <string>
|
461
|
+
#include <vector>
|
462
|
+
#include <exception>
|
544
463
|
|
545
|
-
|
546
|
-
|
547
|
-
// b) possibly improve optimization opportunities.
|
548
|
-
#if !defined(JSONCPP_NORETURN)
|
549
|
-
#if defined(_MSC_VER) && _MSC_VER == 1800
|
550
|
-
#define JSONCPP_NORETURN __declspec(noreturn)
|
464
|
+
#ifndef JSON_USE_CPPTL_SMALLMAP
|
465
|
+
#include <map>
|
551
466
|
#else
|
552
|
-
#
|
467
|
+
#include <cpptl/smallmap.h>
|
553
468
|
#endif
|
469
|
+
#ifdef JSON_USE_CPPTL
|
470
|
+
#include <cpptl/forwards.h>
|
554
471
|
#endif
|
555
472
|
|
556
|
-
//
|
557
|
-
//
|
558
|
-
//
|
559
|
-
#if !defined(
|
560
|
-
#if defined(
|
561
|
-
#
|
562
|
-
#
|
563
|
-
#
|
564
|
-
#
|
565
|
-
#
|
566
|
-
#
|
567
|
-
#endif
|
568
|
-
#endif
|
569
|
-
#if !defined(JSONCPP_TEMPLATE_DELETE)
|
570
|
-
#define JSONCPP_TEMPLATE_DELETE = delete
|
571
|
-
#endif
|
473
|
+
//Conditional NORETURN attribute on the throw functions would:
|
474
|
+
// a) suppress false positives from static code analysis
|
475
|
+
// b) possibly improve optimization opportunities.
|
476
|
+
#if !defined(JSONCPP_NORETURN)
|
477
|
+
# if defined(_MSC_VER)
|
478
|
+
# define JSONCPP_NORETURN __declspec(noreturn)
|
479
|
+
# elif defined(__GNUC__)
|
480
|
+
# define JSONCPP_NORETURN __attribute__ ((__noreturn__))
|
481
|
+
# else
|
482
|
+
# define JSONCPP_NORETURN
|
483
|
+
# endif
|
572
484
|
#endif
|
573
485
|
|
574
|
-
#include <array>
|
575
|
-
#include <exception>
|
576
|
-
#include <map>
|
577
|
-
#include <memory>
|
578
|
-
#include <string>
|
579
|
-
#include <vector>
|
580
|
-
|
581
486
|
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
|
582
487
|
// be used by...
|
583
488
|
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
584
489
|
#pragma warning(push)
|
585
|
-
#pragma warning(disable : 4251
|
490
|
+
#pragma warning(disable : 4251)
|
586
491
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
587
492
|
|
588
493
|
#pragma pack(push, 8)
|
@@ -592,19 +497,17 @@ public:
|
|
592
497
|
namespace Passenger {
|
593
498
|
namespace Json {
|
594
499
|
|
595
|
-
#if JSON_USE_EXCEPTION
|
596
500
|
/** Base class for all exceptions we throw.
|
597
501
|
*
|
598
502
|
* We use nothing but these internally. Of course, STL can throw others.
|
599
503
|
*/
|
600
504
|
class JSON_API Exception : public std::exception {
|
601
505
|
public:
|
602
|
-
Exception(
|
603
|
-
~Exception()
|
604
|
-
char const* what() const
|
605
|
-
|
506
|
+
Exception(JSONCPP_STRING const& msg);
|
507
|
+
~Exception() JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
|
508
|
+
char const* what() const JSONCPP_NOEXCEPT JSONCPP_OVERRIDE;
|
606
509
|
protected:
|
607
|
-
|
510
|
+
JSONCPP_STRING msg_;
|
608
511
|
};
|
609
512
|
|
610
513
|
/** Exceptions which the user cannot easily avoid.
|
@@ -615,7 +518,7 @@ protected:
|
|
615
518
|
*/
|
616
519
|
class JSON_API RuntimeError : public Exception {
|
617
520
|
public:
|
618
|
-
RuntimeError(
|
521
|
+
RuntimeError(JSONCPP_STRING const& msg);
|
619
522
|
};
|
620
523
|
|
621
524
|
/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
|
@@ -626,14 +529,13 @@ public:
|
|
626
529
|
*/
|
627
530
|
class JSON_API LogicError : public Exception {
|
628
531
|
public:
|
629
|
-
LogicError(
|
532
|
+
LogicError(JSONCPP_STRING const& msg);
|
630
533
|
};
|
631
|
-
#endif
|
632
534
|
|
633
535
|
/// used internally
|
634
|
-
JSONCPP_NORETURN void throwRuntimeError(
|
536
|
+
JSONCPP_NORETURN void throwRuntimeError(JSONCPP_STRING const& msg);
|
635
537
|
/// used internally
|
636
|
-
JSONCPP_NORETURN void throwLogicError(
|
538
|
+
JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const& msg);
|
637
539
|
|
638
540
|
/** \brief Type of the value held by a Value object.
|
639
541
|
*/
|
@@ -656,16 +558,14 @@ enum CommentPlacement {
|
|
656
558
|
numberOfCommentPlacement
|
657
559
|
};
|
658
560
|
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
decimalPlaces ///< we set max number of digits after "." in string
|
664
|
-
};
|
561
|
+
//# ifdef JSON_USE_CPPTL
|
562
|
+
// typedef CppTL::AnyEnumerator<const char *> EnumMemberNames;
|
563
|
+
// typedef CppTL::AnyEnumerator<const Value &> EnumValues;
|
564
|
+
//# endif
|
665
565
|
|
666
566
|
/** \brief Lightweight wrapper to tag static string.
|
667
567
|
*
|
668
|
-
* Value constructor and objectValue member
|
568
|
+
* Value constructor and objectValue member assignement takes advantage of the
|
669
569
|
* StaticString and avoid the cost of string duplication when storing the
|
670
570
|
* string or the member name.
|
671
571
|
*
|
@@ -714,7 +614,7 @@ private:
|
|
714
614
|
* The get() methods can be used to obtain default value in the case the
|
715
615
|
* required element does not exist.
|
716
616
|
*
|
717
|
-
* It is possible to iterate over the list of
|
617
|
+
* It is possible to iterate over the list of a #objectValue values using
|
718
618
|
* the getMemberNames() method.
|
719
619
|
*
|
720
620
|
* \note #Value string-length fit in size_t, but keys must be < 2^30.
|
@@ -725,86 +625,68 @@ private:
|
|
725
625
|
*/
|
726
626
|
class JSON_API Value {
|
727
627
|
friend class ValueIteratorBase;
|
728
|
-
|
729
628
|
public:
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
629
|
+
typedef std::vector<JSONCPP_STRING> Members;
|
630
|
+
typedef ValueIterator iterator;
|
631
|
+
typedef ValueConstIterator const_iterator;
|
632
|
+
typedef Json::UInt UInt;
|
633
|
+
typedef Json::Int Int;
|
735
634
|
#if defined(JSON_HAS_INT64)
|
736
|
-
|
737
|
-
|
635
|
+
typedef Json::UInt64 UInt64;
|
636
|
+
typedef Json::Int64 Int64;
|
738
637
|
#endif // defined(JSON_HAS_INT64)
|
739
|
-
|
740
|
-
|
741
|
-
|
638
|
+
typedef Json::LargestInt LargestInt;
|
639
|
+
typedef Json::LargestUInt LargestUInt;
|
640
|
+
typedef Json::ArrayIndex ArrayIndex;
|
742
641
|
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
#if JSON_USE_NULLREF
|
747
|
-
// Binary compatibility kludges, do not use.
|
748
|
-
static const Value& null;
|
749
|
-
static const Value& nullRef;
|
750
|
-
#endif
|
751
|
-
|
752
|
-
// null and nullRef are deprecated, use this instead.
|
753
|
-
static Value const& nullSingleton();
|
642
|
+
static const Value& null; ///< We regret this reference to a global instance; prefer the simpler Value().
|
643
|
+
static const Value& nullRef; ///< just a kludge for binary-compatibility; same as null
|
644
|
+
static Value const& nullSingleton(); ///< Prefer this to null or nullRef.
|
754
645
|
|
755
646
|
/// Minimum signed integer value that can be stored in a Json::Value.
|
756
|
-
static
|
757
|
-
LargestInt(~(LargestUInt(-1) / 2));
|
647
|
+
static const LargestInt minLargestInt;
|
758
648
|
/// Maximum signed integer value that can be stored in a Json::Value.
|
759
|
-
static
|
649
|
+
static const LargestInt maxLargestInt;
|
760
650
|
/// Maximum unsigned integer value that can be stored in a Json::Value.
|
761
|
-
static
|
651
|
+
static const LargestUInt maxLargestUInt;
|
762
652
|
|
763
653
|
/// Minimum signed int value that can be stored in a Json::Value.
|
764
|
-
static
|
654
|
+
static const Int minInt;
|
765
655
|
/// Maximum signed int value that can be stored in a Json::Value.
|
766
|
-
static
|
656
|
+
static const Int maxInt;
|
767
657
|
/// Maximum unsigned int value that can be stored in a Json::Value.
|
768
|
-
static
|
658
|
+
static const UInt maxUInt;
|
769
659
|
|
770
660
|
#if defined(JSON_HAS_INT64)
|
771
661
|
/// Minimum signed 64 bits int value that can be stored in a Json::Value.
|
772
|
-
static
|
662
|
+
static const Int64 minInt64;
|
773
663
|
/// Maximum signed 64 bits int value that can be stored in a Json::Value.
|
774
|
-
static
|
664
|
+
static const Int64 maxInt64;
|
775
665
|
/// Maximum unsigned 64 bits int value that can be stored in a Json::Value.
|
776
|
-
static
|
666
|
+
static const UInt64 maxUInt64;
|
777
667
|
#endif // defined(JSON_HAS_INT64)
|
778
|
-
|
779
|
-
static constexpr UInt defaultRealPrecision = 17;
|
780
|
-
// The constant is hard-coded because some compiler have trouble
|
781
|
-
// converting Value::maxUInt64 to a double correctly (AIX/xlC).
|
782
|
-
// Assumes that UInt64 is a 64 bits integer.
|
783
|
-
static constexpr double maxUInt64AsDouble = 18446744073709551615.0;
|
784
|
-
// Workaround for bug in the NVIDIAs CUDA 9.1 nvcc compiler
|
785
|
-
// when using gcc and clang backend compilers. CZString
|
786
|
-
// cannot be defined as private. See issue #486
|
787
|
-
#ifdef __NVCC__
|
788
|
-
public:
|
789
|
-
#else
|
668
|
+
|
790
669
|
private:
|
791
|
-
#endif
|
792
670
|
#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
|
793
671
|
class CZString {
|
794
672
|
public:
|
795
|
-
enum DuplicationPolicy {
|
673
|
+
enum DuplicationPolicy {
|
674
|
+
noDuplication = 0,
|
675
|
+
duplicate,
|
676
|
+
duplicateOnCopy
|
677
|
+
};
|
796
678
|
CZString(ArrayIndex index);
|
797
679
|
CZString(char const* str, unsigned length, DuplicationPolicy allocate);
|
798
680
|
CZString(CZString const& other);
|
799
|
-
|
681
|
+
#if JSON_HAS_RVALUE_REFERENCES
|
682
|
+
CZString(CZString&& other);
|
683
|
+
#endif
|
800
684
|
~CZString();
|
801
|
-
CZString& operator=(
|
802
|
-
CZString& operator=(CZString&& other) noexcept;
|
803
|
-
|
685
|
+
CZString& operator=(CZString other);
|
804
686
|
bool operator<(CZString const& other) const;
|
805
687
|
bool operator==(CZString const& other) const;
|
806
688
|
ArrayIndex index() const;
|
807
|
-
//
|
689
|
+
//const char* c_str() const; ///< \deprecated
|
808
690
|
char const* data() const;
|
809
691
|
unsigned length() const;
|
810
692
|
bool isStaticString() const;
|
@@ -813,11 +695,11 @@ private:
|
|
813
695
|
void swap(CZString& other);
|
814
696
|
|
815
697
|
struct StringStorage {
|
816
|
-
unsigned policy_
|
817
|
-
unsigned length_
|
698
|
+
unsigned policy_: 2;
|
699
|
+
unsigned length_: 30; // 1GB max
|
818
700
|
};
|
819
701
|
|
820
|
-
char const* cstr_;
|
702
|
+
char const* cstr_; // actually, a prefixed string, unless policy is noDup
|
821
703
|
union {
|
822
704
|
ArrayIndex index_;
|
823
705
|
StringStorage storage_;
|
@@ -825,26 +707,29 @@ private:
|
|
825
707
|
};
|
826
708
|
|
827
709
|
public:
|
710
|
+
#ifndef JSON_USE_CPPTL_SMALLMAP
|
828
711
|
typedef std::map<CZString, Value> ObjectValues;
|
712
|
+
#else
|
713
|
+
typedef CppTL::SmallMap<CZString, Value> ObjectValues;
|
714
|
+
#endif // ifndef JSON_USE_CPPTL_SMALLMAP
|
829
715
|
#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
|
830
716
|
|
831
717
|
public:
|
832
|
-
/**
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
*/
|
718
|
+
/** \brief Create a default Value of the given type.
|
719
|
+
|
720
|
+
This is a very useful constructor.
|
721
|
+
To create an empty array, pass arrayValue.
|
722
|
+
To create an empty object, pass objectValue.
|
723
|
+
Another Value can then be set to this one by assignment.
|
724
|
+
This is useful since clear() and resize() will not alter types.
|
725
|
+
|
726
|
+
Examples:
|
727
|
+
\code
|
728
|
+
Json::Value null_value; // null
|
729
|
+
Json::Value arr_value(Json::arrayValue); // []
|
730
|
+
Json::Value obj_value(Json::objectValue); // {}
|
731
|
+
\endcode
|
732
|
+
*/
|
848
733
|
Value(ValueType type = nullValue);
|
849
734
|
Value(Int value);
|
850
735
|
Value(UInt value);
|
@@ -855,46 +740,43 @@ public:
|
|
855
740
|
Value(double value);
|
856
741
|
Value(const char* value); ///< Copy til first 0. (NULL causes to seg-fault.)
|
857
742
|
Value(const char* begin, const char* end); ///< Copy all, incl zeroes.
|
858
|
-
/**
|
859
|
-
|
860
|
-
*
|
743
|
+
/** \brief Constructs a value from a static string.
|
744
|
+
|
861
745
|
* Like other value string constructor but do not duplicate the string for
|
862
|
-
* internal storage. The given string must remain alive after the call to
|
863
|
-
*
|
864
|
-
*
|
746
|
+
* internal storage. The given string must remain alive after the call to this
|
747
|
+
* constructor.
|
865
748
|
* \note This works only for null-terminated strings. (We cannot change the
|
866
|
-
*
|
867
|
-
* computed later for various operations.)
|
749
|
+
* size of this class, so we have nowhere to store the length,
|
750
|
+
* which might be computed later for various operations.)
|
868
751
|
*
|
869
752
|
* Example of usage:
|
870
|
-
*
|
871
|
-
*
|
872
|
-
*
|
873
|
-
*
|
753
|
+
* \code
|
754
|
+
* static StaticString foo("some text");
|
755
|
+
* Json::Value aValue(foo);
|
756
|
+
* \endcode
|
874
757
|
*/
|
875
758
|
Value(const StaticString& value);
|
876
|
-
Value(const
|
759
|
+
Value(const JSONCPP_STRING& value); ///< Copy data() til size(). Embedded zeroes too.
|
760
|
+
#ifdef JSON_USE_CPPTL
|
761
|
+
Value(const CppTL::ConstString& value);
|
762
|
+
#endif
|
877
763
|
Value(bool value);
|
878
|
-
|
764
|
+
/// Deep copy.
|
879
765
|
Value(const Value& other);
|
880
|
-
|
766
|
+
#if JSON_HAS_RVALUE_REFERENCES
|
767
|
+
/// Move constructor
|
768
|
+
Value(Value&& other);
|
769
|
+
#endif
|
881
770
|
virtual ~Value();
|
882
771
|
|
883
|
-
///
|
884
|
-
/// #swapPayload().
|
885
|
-
Value& operator=(
|
886
|
-
Value& operator=(Value&& other) noexcept;
|
887
|
-
|
772
|
+
/// Deep copy, then swap(other).
|
773
|
+
/// \note Over-write existing comments. To preserve comments, use #swapPayload().
|
774
|
+
Value& operator=(Value other);
|
888
775
|
/// Swap everything.
|
889
776
|
void swap(Value& other);
|
890
777
|
/// Swap values but leave comments and source offsets in place.
|
891
778
|
void swapPayload(Value& other);
|
892
779
|
|
893
|
-
/// copy everything.
|
894
|
-
void copy(const Value& other);
|
895
|
-
/// copy values but leave comments and source offsets in place.
|
896
|
-
void copyPayload(const Value& other);
|
897
|
-
|
898
780
|
ValueType type() const;
|
899
781
|
|
900
782
|
/// Compare payload only, not comments etc.
|
@@ -908,14 +790,17 @@ public:
|
|
908
790
|
|
909
791
|
const char* asCString() const; ///< Embedded zeroes could cause you trouble!
|
910
792
|
#if JSONCPP_USING_SECURE_MEMORY
|
911
|
-
unsigned getCStringLength() const; //
|
912
|
-
// the CString
|
793
|
+
unsigned getCStringLength() const; //Allows you to understand the length of the CString
|
913
794
|
#endif
|
914
|
-
|
795
|
+
JSONCPP_STRING asString() const; ///< Embedded zeroes are possible.
|
915
796
|
/** Get raw char* of string-value.
|
916
797
|
* \return false if !string. (Seg-fault if str or end are NULL.)
|
917
798
|
*/
|
918
|
-
bool getString(
|
799
|
+
bool getString(
|
800
|
+
char const** begin, char const** end) const;
|
801
|
+
#ifdef JSON_USE_CPPTL
|
802
|
+
CppTL::ConstString asConstString() const;
|
803
|
+
#endif
|
919
804
|
Int asInt() const;
|
920
805
|
UInt asUInt() const;
|
921
806
|
#if defined(JSON_HAS_INT64)
|
@@ -941,10 +826,6 @@ public:
|
|
941
826
|
bool isArray() const;
|
942
827
|
bool isObject() const;
|
943
828
|
|
944
|
-
/// The `as<T>` and `is<T>` member function templates and specializations.
|
945
|
-
template <typename T> T as() const JSONCPP_TEMPLATE_DELETE;
|
946
|
-
template <typename T> bool is() const JSONCPP_TEMPLATE_DELETE;
|
947
|
-
|
948
829
|
bool isConvertibleTo(ValueType other) const;
|
949
830
|
|
950
831
|
/// Number of values in array or object
|
@@ -954,41 +835,50 @@ public:
|
|
954
835
|
/// otherwise, false.
|
955
836
|
bool empty() const;
|
956
837
|
|
957
|
-
/// Return
|
958
|
-
|
838
|
+
/// Return isNull()
|
839
|
+
bool operator!() const;
|
959
840
|
|
960
841
|
/// Remove all object members and array elements.
|
961
842
|
/// \pre type() is arrayValue, objectValue, or nullValue
|
962
843
|
/// \post type() is unchanged
|
963
844
|
void clear();
|
964
845
|
|
965
|
-
/// Resize the array to
|
846
|
+
/// Resize the array to size elements.
|
966
847
|
/// New elements are initialized to null.
|
967
848
|
/// May only be called on nullValue or arrayValue.
|
968
849
|
/// \pre type() is arrayValue or nullValue
|
969
850
|
/// \post type() is arrayValue
|
970
|
-
void resize(ArrayIndex
|
851
|
+
void resize(ArrayIndex size);
|
971
852
|
|
972
|
-
|
973
|
-
///
|
974
|
-
///
|
975
|
-
/// its size is index+1.
|
853
|
+
/// Access an array element (zero based index ).
|
854
|
+
/// If the array contains less than index element, then null value are
|
855
|
+
/// inserted
|
856
|
+
/// in the array so that its size is index+1.
|
976
857
|
/// (You may need to say 'value[0u]' to get your compiler to distinguish
|
977
|
-
///
|
858
|
+
/// this from the operator[] which takes a string.)
|
978
859
|
Value& operator[](ArrayIndex index);
|
860
|
+
|
861
|
+
/// Access an array element (zero based index ).
|
862
|
+
/// If the array contains less than index element, then null value are
|
863
|
+
/// inserted
|
864
|
+
/// in the array so that its size is index+1.
|
865
|
+
/// (You may need to say 'value[0u]' to get your compiler to distinguish
|
866
|
+
/// this from the operator[] which takes a string.)
|
979
867
|
Value& operator[](int index);
|
980
|
-
//@}
|
981
868
|
|
982
|
-
|
983
|
-
/// Access an array element (zero based index).
|
869
|
+
/// Access an array element (zero based index )
|
984
870
|
/// (You may need to say 'value[0u]' to get your compiler to distinguish
|
985
|
-
///
|
871
|
+
/// this from the operator[] which takes a string.)
|
986
872
|
const Value& operator[](ArrayIndex index) const;
|
873
|
+
|
874
|
+
/// Access an array element (zero based index )
|
875
|
+
/// (You may need to say 'value[0u]' to get your compiler to distinguish
|
876
|
+
/// this from the operator[] which takes a string.)
|
987
877
|
const Value& operator[](int index) const;
|
988
|
-
//@}
|
989
878
|
|
990
879
|
/// If the array contains at least index+1 elements, returns the element
|
991
|
-
/// value,
|
880
|
+
/// value,
|
881
|
+
/// otherwise returns defaultValue.
|
992
882
|
Value get(ArrayIndex index, const Value& defaultValue) const;
|
993
883
|
/// Return true if index < size().
|
994
884
|
bool isValidIndex(ArrayIndex index) const;
|
@@ -996,51 +886,57 @@ public:
|
|
996
886
|
///
|
997
887
|
/// Equivalent to jsonvalue[jsonvalue.size()] = value;
|
998
888
|
Value& append(const Value& value);
|
999
|
-
Value& append(Value&& value);
|
1000
|
-
|
1001
|
-
/// \brief Insert value in array at specific index
|
1002
|
-
bool insert(ArrayIndex index, const Value& newValue);
|
1003
|
-
bool insert(ArrayIndex index, Value&& newValue);
|
1004
889
|
|
1005
890
|
/// Access an object value by name, create a null member if it does not exist.
|
1006
891
|
/// \note Because of our implementation, keys are limited to 2^30 -1 chars.
|
1007
|
-
///
|
892
|
+
/// Exceeding that will cause an exception.
|
1008
893
|
Value& operator[](const char* key);
|
1009
894
|
/// Access an object value by name, returns null if there is no member with
|
1010
895
|
/// that name.
|
1011
896
|
const Value& operator[](const char* key) const;
|
1012
897
|
/// Access an object value by name, create a null member if it does not exist.
|
1013
898
|
/// \param key may contain embedded nulls.
|
1014
|
-
Value& operator[](const
|
899
|
+
Value& operator[](const JSONCPP_STRING& key);
|
1015
900
|
/// Access an object value by name, returns null if there is no member with
|
1016
901
|
/// that name.
|
1017
902
|
/// \param key may contain embedded nulls.
|
1018
|
-
const Value& operator[](const
|
903
|
+
const Value& operator[](const JSONCPP_STRING& key) const;
|
1019
904
|
/** \brief Access an object value by name, create a null member if it does not
|
1020
|
-
|
1021
|
-
|
1022
|
-
* If the object has no entry for that name, then the member name used to
|
1023
|
-
*
|
905
|
+
exist.
|
906
|
+
|
907
|
+
* If the object has no entry for that name, then the member name used to store
|
908
|
+
* the new entry is not duplicated.
|
1024
909
|
* Example of use:
|
1025
|
-
*
|
1026
|
-
*
|
1027
|
-
*
|
1028
|
-
*
|
1029
|
-
*
|
910
|
+
* \code
|
911
|
+
* Json::Value object;
|
912
|
+
* static const StaticString code("code");
|
913
|
+
* object[code] = 1234;
|
914
|
+
* \endcode
|
1030
915
|
*/
|
1031
916
|
Value& operator[](const StaticString& key);
|
917
|
+
#ifdef JSON_USE_CPPTL
|
918
|
+
/// Access an object value by name, create a null member if it does not exist.
|
919
|
+
Value& operator[](const CppTL::ConstString& key);
|
920
|
+
/// Access an object value by name, returns null if there is no member with
|
921
|
+
/// that name.
|
922
|
+
const Value& operator[](const CppTL::ConstString& key) const;
|
923
|
+
#endif
|
1032
924
|
/// Return the member named key if it exist, defaultValue otherwise.
|
1033
925
|
/// \note deep copy
|
1034
926
|
Value get(const char* key, const Value& defaultValue) const;
|
1035
927
|
/// Return the member named key if it exist, defaultValue otherwise.
|
1036
928
|
/// \note deep copy
|
1037
929
|
/// \note key may contain embedded nulls.
|
1038
|
-
Value get(const char* begin, const char* end,
|
1039
|
-
const Value& defaultValue) const;
|
930
|
+
Value get(const char* begin, const char* end, const Value& defaultValue) const;
|
1040
931
|
/// Return the member named key if it exist, defaultValue otherwise.
|
1041
932
|
/// \note deep copy
|
1042
933
|
/// \param key may contain embedded nulls.
|
1043
|
-
Value get(const
|
934
|
+
Value get(const JSONCPP_STRING& key, const Value& defaultValue) const;
|
935
|
+
#ifdef JSON_USE_CPPTL
|
936
|
+
/// Return the member named key if it exist, defaultValue otherwise.
|
937
|
+
/// \note deep copy
|
938
|
+
Value get(const CppTL::ConstString& key, const Value& defaultValue) const;
|
939
|
+
#endif
|
1044
940
|
/// Most general and efficient version of isMember()const, get()const,
|
1045
941
|
/// and operator[]const
|
1046
942
|
/// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
|
@@ -1048,44 +944,51 @@ public:
|
|
1048
944
|
/// Most general and efficient version of object-mutators.
|
1049
945
|
/// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
|
1050
946
|
/// \return non-zero, but JSON_ASSERT if this is neither object nor nullValue.
|
1051
|
-
Value* demand(char const* begin, char const* end);
|
947
|
+
Value const* demand(char const* begin, char const* end);
|
1052
948
|
/// \brief Remove and return the named member.
|
1053
949
|
///
|
1054
950
|
/// Do nothing if it did not exist.
|
951
|
+
/// \return the removed Value, or null.
|
1055
952
|
/// \pre type() is objectValue or nullValue
|
1056
953
|
/// \post type() is unchanged
|
1057
|
-
|
954
|
+
/// \deprecated
|
955
|
+
Value removeMember(const char* key);
|
1058
956
|
/// Same as removeMember(const char*)
|
1059
957
|
/// \param key may contain embedded nulls.
|
1060
|
-
|
958
|
+
/// \deprecated
|
959
|
+
Value removeMember(const JSONCPP_STRING& key);
|
1061
960
|
/// Same as removeMember(const char* begin, const char* end, Value* removed),
|
1062
961
|
/// but 'key' is null-terminated.
|
1063
962
|
bool removeMember(const char* key, Value* removed);
|
1064
963
|
/** \brief Remove the named map member.
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
bool removeMember(
|
1071
|
-
/// Same as removeMember(
|
964
|
+
|
965
|
+
Update 'removed' iff removed.
|
966
|
+
\param key may contain embedded nulls.
|
967
|
+
\return true iff removed (no exceptions)
|
968
|
+
*/
|
969
|
+
bool removeMember(JSONCPP_STRING const& key, Value* removed);
|
970
|
+
/// Same as removeMember(JSONCPP_STRING const& key, Value* removed)
|
1072
971
|
bool removeMember(const char* begin, const char* end, Value* removed);
|
1073
972
|
/** \brief Remove the indexed array element.
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
bool removeIndex(ArrayIndex
|
973
|
+
|
974
|
+
O(n) expensive operations.
|
975
|
+
Update 'removed' iff removed.
|
976
|
+
\return true iff removed (no exceptions)
|
977
|
+
*/
|
978
|
+
bool removeIndex(ArrayIndex i, Value* removed);
|
1080
979
|
|
1081
980
|
/// Return true if the object has a member named key.
|
1082
981
|
/// \note 'key' must be null-terminated.
|
1083
982
|
bool isMember(const char* key) const;
|
1084
983
|
/// Return true if the object has a member named key.
|
1085
984
|
/// \param key may contain embedded nulls.
|
1086
|
-
bool isMember(const
|
1087
|
-
/// Same as isMember(
|
985
|
+
bool isMember(const JSONCPP_STRING& key) const;
|
986
|
+
/// Same as isMember(JSONCPP_STRING const& key)const
|
1088
987
|
bool isMember(const char* begin, const char* end) const;
|
988
|
+
#ifdef JSON_USE_CPPTL
|
989
|
+
/// Return true if the object has a member named key.
|
990
|
+
bool isMember(const CppTL::ConstString& key) const;
|
991
|
+
#endif
|
1089
992
|
|
1090
993
|
/// \brief Return a list of the member names.
|
1091
994
|
///
|
@@ -1094,22 +997,23 @@ public:
|
|
1094
997
|
/// \post if type() was nullValue, it remains nullValue
|
1095
998
|
Members getMemberNames() const;
|
1096
999
|
|
1000
|
+
//# ifdef JSON_USE_CPPTL
|
1001
|
+
// EnumMemberNames enumMemberNames() const;
|
1002
|
+
// EnumValues enumValues() const;
|
1003
|
+
//# endif
|
1004
|
+
|
1097
1005
|
/// \deprecated Always pass len.
|
1098
|
-
JSONCPP_DEPRECATED("Use setComment(
|
1099
|
-
void setComment(const char* comment, CommentPlacement placement)
|
1100
|
-
setComment(String(comment, strlen(comment)), placement);
|
1101
|
-
}
|
1006
|
+
JSONCPP_DEPRECATED("Use setComment(JSONCPP_STRING const&) instead.")
|
1007
|
+
void setComment(const char* comment, CommentPlacement placement);
|
1102
1008
|
/// Comments must be //... or /* ... */
|
1103
|
-
void setComment(const char* comment, size_t len, CommentPlacement placement)
|
1104
|
-
setComment(String(comment, len), placement);
|
1105
|
-
}
|
1009
|
+
void setComment(const char* comment, size_t len, CommentPlacement placement);
|
1106
1010
|
/// Comments must be //... or /* ... */
|
1107
|
-
void setComment(
|
1011
|
+
void setComment(const JSONCPP_STRING& comment, CommentPlacement placement);
|
1108
1012
|
bool hasComment(CommentPlacement placement) const;
|
1109
1013
|
/// Include delimiters and embedded newlines.
|
1110
|
-
|
1014
|
+
JSONCPP_STRING getComment(CommentPlacement placement) const;
|
1111
1015
|
|
1112
|
-
|
1016
|
+
JSONCPP_STRING toStyledString() const;
|
1113
1017
|
|
1114
1018
|
const_iterator begin() const;
|
1115
1019
|
const_iterator end() const;
|
@@ -1125,20 +1029,20 @@ public:
|
|
1125
1029
|
ptrdiff_t getOffsetLimit() const;
|
1126
1030
|
|
1127
1031
|
private:
|
1128
|
-
void setType(ValueType v) {
|
1129
|
-
bits_.value_type_ = static_cast<unsigned char>(v);
|
1130
|
-
}
|
1131
|
-
bool isAllocated() const { return bits_.allocated_; }
|
1132
|
-
void setIsAllocated(bool v) { bits_.allocated_ = v; }
|
1133
|
-
|
1134
1032
|
void initBasic(ValueType type, bool allocated = false);
|
1135
|
-
void dupPayload(const Value& other);
|
1136
|
-
void releasePayload();
|
1137
|
-
void dupMeta(const Value& other);
|
1138
1033
|
|
1139
1034
|
Value& resolveReference(const char* key);
|
1140
1035
|
Value& resolveReference(const char* key, const char* end);
|
1141
1036
|
|
1037
|
+
struct CommentInfo {
|
1038
|
+
CommentInfo();
|
1039
|
+
~CommentInfo();
|
1040
|
+
|
1041
|
+
void setComment(const char* text, size_t len);
|
1042
|
+
|
1043
|
+
char* comment_;
|
1044
|
+
};
|
1045
|
+
|
1142
1046
|
// struct MemberNamesTransform
|
1143
1047
|
//{
|
1144
1048
|
// typedef const char *result_type;
|
@@ -1153,33 +1057,13 @@ private:
|
|
1153
1057
|
LargestUInt uint_;
|
1154
1058
|
double real_;
|
1155
1059
|
bool bool_;
|
1156
|
-
char* string_;
|
1060
|
+
char* string_; // actually ptr to unsigned, followed by str, unless !allocated_
|
1157
1061
|
ObjectValues* map_;
|
1158
1062
|
} value_;
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
// Unless allocated_, string_ must be null-terminated.
|
1164
|
-
unsigned int allocated_ : 1;
|
1165
|
-
} bits_;
|
1166
|
-
|
1167
|
-
class Comments {
|
1168
|
-
public:
|
1169
|
-
Comments() = default;
|
1170
|
-
Comments(const Comments& that);
|
1171
|
-
Comments(Comments&& that) noexcept;
|
1172
|
-
Comments& operator=(const Comments& that);
|
1173
|
-
Comments& operator=(Comments&& that) noexcept;
|
1174
|
-
bool has(CommentPlacement slot) const;
|
1175
|
-
String get(CommentPlacement slot) const;
|
1176
|
-
void set(CommentPlacement slot, String comment);
|
1177
|
-
|
1178
|
-
private:
|
1179
|
-
using Array = std::array<String, numberOfCommentPlacement>;
|
1180
|
-
std::unique_ptr<Array> ptr_;
|
1181
|
-
};
|
1182
|
-
Comments comments_;
|
1063
|
+
ValueType type_ : 8;
|
1064
|
+
unsigned int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
|
1065
|
+
// If not allocated_, string_ must be null-terminated.
|
1066
|
+
CommentInfo* comments_;
|
1183
1067
|
|
1184
1068
|
// [start, limit) byte offsets in the source JSON text from which this Value
|
1185
1069
|
// was extracted.
|
@@ -1187,36 +1071,6 @@ private:
|
|
1187
1071
|
ptrdiff_t limit_;
|
1188
1072
|
};
|
1189
1073
|
|
1190
|
-
template <> inline bool Value::as<bool>() const { return asBool(); }
|
1191
|
-
template <> inline bool Value::is<bool>() const { return isBool(); }
|
1192
|
-
|
1193
|
-
template <> inline Int Value::as<Int>() const { return asInt(); }
|
1194
|
-
template <> inline bool Value::is<Int>() const { return isInt(); }
|
1195
|
-
|
1196
|
-
template <> inline UInt Value::as<UInt>() const { return asUInt(); }
|
1197
|
-
template <> inline bool Value::is<UInt>() const { return isUInt(); }
|
1198
|
-
|
1199
|
-
#if defined(JSON_HAS_INT64)
|
1200
|
-
template <> inline Int64 Value::as<Int64>() const { return asInt64(); }
|
1201
|
-
template <> inline bool Value::is<Int64>() const { return isInt64(); }
|
1202
|
-
|
1203
|
-
template <> inline UInt64 Value::as<UInt64>() const { return asUInt64(); }
|
1204
|
-
template <> inline bool Value::is<UInt64>() const { return isUInt64(); }
|
1205
|
-
#endif
|
1206
|
-
|
1207
|
-
template <> inline double Value::as<double>() const { return asDouble(); }
|
1208
|
-
template <> inline bool Value::is<double>() const { return isDouble(); }
|
1209
|
-
|
1210
|
-
template <> inline String Value::as<String>() const { return asString(); }
|
1211
|
-
template <> inline bool Value::is<String>() const { return isString(); }
|
1212
|
-
|
1213
|
-
/// These `as` specializations are type conversions, and do not have a
|
1214
|
-
/// corresponding `is`.
|
1215
|
-
template <> inline float Value::as<float>() const { return asFloat(); }
|
1216
|
-
template <> inline const char* Value::as<const char*>() const {
|
1217
|
-
return asCString();
|
1218
|
-
}
|
1219
|
-
|
1220
1074
|
/** \brief Experimental and untested: represents an element of the "path" to
|
1221
1075
|
* access a node.
|
1222
1076
|
*/
|
@@ -1227,13 +1081,17 @@ public:
|
|
1227
1081
|
PathArgument();
|
1228
1082
|
PathArgument(ArrayIndex index);
|
1229
1083
|
PathArgument(const char* key);
|
1230
|
-
PathArgument(
|
1084
|
+
PathArgument(const JSONCPP_STRING& key);
|
1231
1085
|
|
1232
1086
|
private:
|
1233
|
-
enum Kind {
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1087
|
+
enum Kind {
|
1088
|
+
kindNone = 0,
|
1089
|
+
kindIndex,
|
1090
|
+
kindKey
|
1091
|
+
};
|
1092
|
+
JSONCPP_STRING key_;
|
1093
|
+
ArrayIndex index_;
|
1094
|
+
Kind kind_;
|
1237
1095
|
};
|
1238
1096
|
|
1239
1097
|
/** \brief Experimental and untested: represents a "path" to access a node.
|
@@ -1245,11 +1103,12 @@ private:
|
|
1245
1103
|
* - ".name1.name2.name3"
|
1246
1104
|
* - ".[0][1][2].name1[3]"
|
1247
1105
|
* - ".%" => member name is provided as parameter
|
1248
|
-
* - ".[%]" => index is
|
1106
|
+
* - ".[%]" => index is provied as parameter
|
1249
1107
|
*/
|
1250
1108
|
class JSON_API Path {
|
1251
1109
|
public:
|
1252
|
-
Path(const
|
1110
|
+
Path(const JSONCPP_STRING& path,
|
1111
|
+
const PathArgument& a1 = PathArgument(),
|
1253
1112
|
const PathArgument& a2 = PathArgument(),
|
1254
1113
|
const PathArgument& a3 = PathArgument(),
|
1255
1114
|
const PathArgument& a4 = PathArgument(),
|
@@ -1262,13 +1121,15 @@ public:
|
|
1262
1121
|
Value& make(Value& root) const;
|
1263
1122
|
|
1264
1123
|
private:
|
1265
|
-
|
1266
|
-
|
1124
|
+
typedef std::vector<const PathArgument*> InArgs;
|
1125
|
+
typedef std::vector<PathArgument> Args;
|
1267
1126
|
|
1268
|
-
void makePath(const
|
1269
|
-
void addPathInArg(const
|
1270
|
-
InArgs
|
1271
|
-
|
1127
|
+
void makePath(const JSONCPP_STRING& path, const InArgs& in);
|
1128
|
+
void addPathInArg(const JSONCPP_STRING& path,
|
1129
|
+
const InArgs& in,
|
1130
|
+
InArgs::const_iterator& itInArg,
|
1131
|
+
PathArgument::Kind kind);
|
1132
|
+
void invalidPath(const JSONCPP_STRING& path, int location);
|
1272
1133
|
|
1273
1134
|
Args args_;
|
1274
1135
|
};
|
@@ -1278,10 +1139,10 @@ private:
|
|
1278
1139
|
*/
|
1279
1140
|
class JSON_API ValueIteratorBase {
|
1280
1141
|
public:
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1142
|
+
typedef std::bidirectional_iterator_tag iterator_category;
|
1143
|
+
typedef unsigned int size_t;
|
1144
|
+
typedef int difference_type;
|
1145
|
+
typedef ValueIteratorBase SelfType;
|
1285
1146
|
|
1286
1147
|
bool operator==(const SelfType& other) const { return isEqual(other); }
|
1287
1148
|
|
@@ -1295,19 +1156,17 @@ public:
|
|
1295
1156
|
/// Value.
|
1296
1157
|
Value key() const;
|
1297
1158
|
|
1298
|
-
/// Return the index of the referenced Value, or -1 if it is not an
|
1299
|
-
/// arrayValue.
|
1159
|
+
/// Return the index of the referenced Value, or -1 if it is not an arrayValue.
|
1300
1160
|
UInt index() const;
|
1301
1161
|
|
1302
1162
|
/// Return the member name of the referenced Value, or "" if it is not an
|
1303
1163
|
/// objectValue.
|
1304
1164
|
/// \note Avoid `c_str()` on result, as embedded zeroes are possible.
|
1305
|
-
|
1165
|
+
JSONCPP_STRING name() const;
|
1306
1166
|
|
1307
1167
|
/// Return the member name of the referenced Value. "" if it is not an
|
1308
1168
|
/// objectValue.
|
1309
|
-
/// \deprecated This cannot be used for UTF-8 strings, since there can be
|
1310
|
-
/// embedded nulls.
|
1169
|
+
/// \deprecated This cannot be used for UTF-8 strings, since there can be embedded nulls.
|
1311
1170
|
JSONCPP_DEPRECATED("Use `key = name();` instead.")
|
1312
1171
|
char const* memberName() const;
|
1313
1172
|
/// Return the member name of the referenced Value, or NULL if it is not an
|
@@ -1316,14 +1175,7 @@ public:
|
|
1316
1175
|
char const* memberName(char const** end) const;
|
1317
1176
|
|
1318
1177
|
protected:
|
1319
|
-
|
1320
|
-
* other iterator functions. The const and non-const versions
|
1321
|
-
* of the "deref" protected methods expose the protected
|
1322
|
-
* current_ member variable in a way that can often be
|
1323
|
-
* optimized away by the compiler.
|
1324
|
-
*/
|
1325
|
-
const Value& deref() const;
|
1326
|
-
Value& deref();
|
1178
|
+
Value& deref() const;
|
1327
1179
|
|
1328
1180
|
void increment();
|
1329
1181
|
|
@@ -1338,7 +1190,7 @@ protected:
|
|
1338
1190
|
private:
|
1339
1191
|
Value::ObjectValues::iterator current_;
|
1340
1192
|
// Indicates that iterator is for a null value.
|
1341
|
-
bool isNull_
|
1193
|
+
bool isNull_;
|
1342
1194
|
|
1343
1195
|
public:
|
1344
1196
|
// For some reason, BORLAND needs these at the end, rather
|
@@ -1354,21 +1206,20 @@ class JSON_API ValueConstIterator : public ValueIteratorBase {
|
|
1354
1206
|
friend class Value;
|
1355
1207
|
|
1356
1208
|
public:
|
1357
|
-
|
1358
|
-
//
|
1359
|
-
//
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1209
|
+
typedef const Value value_type;
|
1210
|
+
//typedef unsigned int size_t;
|
1211
|
+
//typedef int difference_type;
|
1212
|
+
typedef const Value& reference;
|
1213
|
+
typedef const Value* pointer;
|
1214
|
+
typedef ValueConstIterator SelfType;
|
1363
1215
|
|
1364
1216
|
ValueConstIterator();
|
1365
1217
|
ValueConstIterator(ValueIterator const& other);
|
1366
1218
|
|
1367
1219
|
private:
|
1368
|
-
|
1369
|
-
|
1220
|
+
/*! \internal Use by Value to create an iterator.
|
1221
|
+
*/
|
1370
1222
|
explicit ValueConstIterator(const Value::ObjectValues::iterator& current);
|
1371
|
-
|
1372
1223
|
public:
|
1373
1224
|
SelfType& operator=(const ValueIteratorBase& other);
|
1374
1225
|
|
@@ -1405,22 +1256,21 @@ class JSON_API ValueIterator : public ValueIteratorBase {
|
|
1405
1256
|
friend class Value;
|
1406
1257
|
|
1407
1258
|
public:
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1259
|
+
typedef Value value_type;
|
1260
|
+
typedef unsigned int size_t;
|
1261
|
+
typedef int difference_type;
|
1262
|
+
typedef Value& reference;
|
1263
|
+
typedef Value* pointer;
|
1264
|
+
typedef ValueIterator SelfType;
|
1414
1265
|
|
1415
1266
|
ValueIterator();
|
1416
1267
|
explicit ValueIterator(const ValueConstIterator& other);
|
1417
1268
|
ValueIterator(const ValueIterator& other);
|
1418
1269
|
|
1419
1270
|
private:
|
1420
|
-
|
1421
|
-
|
1271
|
+
/*! \internal Use by Value to create an iterator.
|
1272
|
+
*/
|
1422
1273
|
explicit ValueIterator(const Value::ObjectValues::iterator& current);
|
1423
|
-
|
1424
1274
|
public:
|
1425
1275
|
SelfType& operator=(const SelfType& other);
|
1426
1276
|
|
@@ -1446,27 +1296,28 @@ public:
|
|
1446
1296
|
return *this;
|
1447
1297
|
}
|
1448
1298
|
|
1449
|
-
|
1450
|
-
* changed, so the these functions are not const
|
1451
|
-
* because the returned references/pointers can be used
|
1452
|
-
* to change state of the base class.
|
1453
|
-
*/
|
1454
|
-
reference operator*() const { return const_cast<reference>(deref()); }
|
1455
|
-
pointer operator->() const { return const_cast<pointer>(&deref()); }
|
1456
|
-
};
|
1299
|
+
reference operator*() const { return deref(); }
|
1457
1300
|
|
1458
|
-
|
1301
|
+
pointer operator->() const { return &deref(); }
|
1302
|
+
};
|
1459
1303
|
|
1460
1304
|
} // namespace Json
|
1461
1305
|
} // namespace Passenger
|
1462
1306
|
|
1307
|
+
|
1308
|
+
namespace std {
|
1309
|
+
/// Specialize std::swap() for Json::Value.
|
1310
|
+
template<>
|
1311
|
+
inline void swap(Passenger::Json::Value& a, Passenger::Json::Value& b) { a.swap(b); }
|
1312
|
+
}
|
1313
|
+
|
1463
1314
|
#pragma pack(pop)
|
1464
1315
|
|
1465
1316
|
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
1466
1317
|
#pragma warning(pop)
|
1467
1318
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
1468
1319
|
|
1469
|
-
#endif //
|
1320
|
+
#endif // CPPTL_JSON_H_INCLUDED
|
1470
1321
|
|
1471
1322
|
// //////////////////////////////////////////////////////////////////////
|
1472
1323
|
// End of content of file: include/json/value.h
|
@@ -1481,23 +1332,23 @@ inline void swap(Value& a, Value& b) { a.swap(b); }
|
|
1481
1332
|
// Beginning of content of file: include/json/reader.h
|
1482
1333
|
// //////////////////////////////////////////////////////////////////////
|
1483
1334
|
|
1484
|
-
// Copyright 2007-2010 Baptiste Lepilleur
|
1335
|
+
// Copyright 2007-2010 Baptiste Lepilleur
|
1485
1336
|
// Distributed under MIT license, or public domain if desired and
|
1486
1337
|
// recognized in your jurisdiction.
|
1487
1338
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
1488
1339
|
|
1489
|
-
#ifndef
|
1490
|
-
#define
|
1340
|
+
#ifndef CPPTL_JSON_READER_H_INCLUDED
|
1341
|
+
#define CPPTL_JSON_READER_H_INCLUDED
|
1491
1342
|
|
1492
1343
|
#if !defined(JSON_IS_AMALGAMATION)
|
1493
|
-
#include "
|
1344
|
+
#include "features.h"
|
1494
1345
|
#include "value.h"
|
1495
1346
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
1496
1347
|
#include <deque>
|
1497
1348
|
#include <iosfwd>
|
1498
|
-
#include <istream>
|
1499
1349
|
#include <stack>
|
1500
1350
|
#include <string>
|
1351
|
+
#include <istream>
|
1501
1352
|
|
1502
1353
|
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
|
1503
1354
|
// be used by...
|
@@ -1512,129 +1363,132 @@ namespace Passenger {
|
|
1512
1363
|
namespace Json {
|
1513
1364
|
|
1514
1365
|
/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a
|
1515
|
-
*
|
1366
|
+
*Value.
|
1516
1367
|
*
|
1517
1368
|
* \deprecated Use CharReader and CharReaderBuilder.
|
1518
1369
|
*/
|
1519
|
-
|
1520
1370
|
class JSON_API Reader {
|
1521
1371
|
public:
|
1522
|
-
|
1523
|
-
|
1372
|
+
typedef char Char;
|
1373
|
+
typedef const Char* Location;
|
1524
1374
|
|
1525
1375
|
/** \brief An error tagged with where in the JSON text it was encountered.
|
1526
1376
|
*
|
1527
1377
|
* The offsets give the [start, limit) range of bytes within the text. Note
|
1528
1378
|
* that this is bytes, not codepoints.
|
1379
|
+
*
|
1529
1380
|
*/
|
1530
1381
|
struct StructuredError {
|
1531
1382
|
ptrdiff_t offset_start;
|
1532
1383
|
ptrdiff_t offset_limit;
|
1533
|
-
|
1384
|
+
JSONCPP_STRING message;
|
1534
1385
|
};
|
1535
1386
|
|
1536
|
-
/** \brief Constructs a Reader allowing all features
|
1537
|
-
|
1387
|
+
/** \brief Constructs a Reader allowing all features
|
1388
|
+
* for parsing.
|
1538
1389
|
*/
|
1539
1390
|
Reader();
|
1540
1391
|
|
1541
|
-
/** \brief Constructs a Reader allowing the specified feature set
|
1542
|
-
|
1392
|
+
/** \brief Constructs a Reader allowing the specified feature set
|
1393
|
+
* for parsing.
|
1543
1394
|
*/
|
1544
1395
|
Reader(const Features& features);
|
1545
1396
|
|
1546
1397
|
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
|
1547
1398
|
* document.
|
1548
|
-
*
|
1549
|
-
* \param
|
1550
|
-
*
|
1551
|
-
* \param
|
1552
|
-
*
|
1553
|
-
* \
|
1554
|
-
*
|
1555
|
-
*
|
1556
|
-
*
|
1399
|
+
* \param document UTF-8 encoded string containing the document to read.
|
1400
|
+
* \param root [out] Contains the root value of the document if it was
|
1401
|
+
* successfully parsed.
|
1402
|
+
* \param collectComments \c true to collect comment and allow writing them
|
1403
|
+
* back during
|
1404
|
+
* serialization, \c false to discard comments.
|
1405
|
+
* This parameter is ignored if
|
1406
|
+
* Features::allowComments_
|
1407
|
+
* is \c false.
|
1557
1408
|
* \return \c true if the document was successfully parsed, \c false if an
|
1558
1409
|
* error occurred.
|
1559
1410
|
*/
|
1560
|
-
bool
|
1561
|
-
|
1411
|
+
bool
|
1412
|
+
parse(const std::string& document, Value& root, bool collectComments = true);
|
1562
1413
|
|
1563
1414
|
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
|
1564
|
-
|
1565
|
-
*
|
1566
|
-
|
1567
|
-
*
|
1568
|
-
|
1569
|
-
*
|
1570
|
-
* \param[out]
|
1571
|
-
*
|
1572
|
-
* \param
|
1573
|
-
|
1574
|
-
*
|
1575
|
-
*
|
1415
|
+
document.
|
1416
|
+
* \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the
|
1417
|
+
document to read.
|
1418
|
+
* \param endDoc Pointer on the end of the UTF-8 encoded string of the
|
1419
|
+
document to read.
|
1420
|
+
* Must be >= beginDoc.
|
1421
|
+
* \param root [out] Contains the root value of the document if it was
|
1422
|
+
* successfully parsed.
|
1423
|
+
* \param collectComments \c true to collect comment and allow writing them
|
1424
|
+
back during
|
1425
|
+
* serialization, \c false to discard comments.
|
1426
|
+
* This parameter is ignored if
|
1427
|
+
Features::allowComments_
|
1428
|
+
* is \c false.
|
1576
1429
|
* \return \c true if the document was successfully parsed, \c false if an
|
1577
|
-
|
1430
|
+
error occurred.
|
1578
1431
|
*/
|
1579
|
-
bool parse(const char* beginDoc,
|
1432
|
+
bool parse(const char* beginDoc,
|
1433
|
+
const char* endDoc,
|
1434
|
+
Value& root,
|
1580
1435
|
bool collectComments = true);
|
1581
1436
|
|
1582
1437
|
/// \brief Parse from input stream.
|
1583
1438
|
/// \see Json::operator>>(std::istream&, Json::Value&).
|
1584
|
-
bool parse(
|
1439
|
+
bool parse(JSONCPP_ISTREAM& is, Value& root, bool collectComments = true);
|
1585
1440
|
|
1586
1441
|
/** \brief Returns a user friendly string that list errors in the parsed
|
1587
1442
|
* document.
|
1588
|
-
*
|
1589
|
-
*
|
1590
|
-
*
|
1591
|
-
* occurred
|
1443
|
+
* \return Formatted error message with the list of errors with their location
|
1444
|
+
* in
|
1445
|
+
* the parsed document. An empty string is returned if no error
|
1446
|
+
* occurred
|
1447
|
+
* during parsing.
|
1592
1448
|
* \deprecated Use getFormattedErrorMessages() instead (typo fix).
|
1593
1449
|
*/
|
1594
1450
|
JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.")
|
1595
|
-
|
1451
|
+
JSONCPP_STRING getFormatedErrorMessages() const;
|
1596
1452
|
|
1597
1453
|
/** \brief Returns a user friendly string that list errors in the parsed
|
1598
1454
|
* document.
|
1599
|
-
*
|
1600
|
-
*
|
1601
|
-
*
|
1602
|
-
* occurred
|
1455
|
+
* \return Formatted error message with the list of errors with their location
|
1456
|
+
* in
|
1457
|
+
* the parsed document. An empty string is returned if no error
|
1458
|
+
* occurred
|
1459
|
+
* during parsing.
|
1603
1460
|
*/
|
1604
|
-
|
1461
|
+
JSONCPP_STRING getFormattedErrorMessages() const;
|
1605
1462
|
|
1606
|
-
/** \brief Returns a vector of structured
|
1607
|
-
*
|
1463
|
+
/** \brief Returns a vector of structured erros encounted while parsing.
|
1608
1464
|
* \return A (possibly empty) vector of StructuredError objects. Currently
|
1609
|
-
*
|
1610
|
-
*
|
1611
|
-
*
|
1465
|
+
* only one error can be returned, but the caller should tolerate
|
1466
|
+
* multiple
|
1467
|
+
* errors. This can occur if the parser recovers from a non-fatal
|
1468
|
+
* parse error and then encounters additional errors.
|
1612
1469
|
*/
|
1613
1470
|
std::vector<StructuredError> getStructuredErrors() const;
|
1614
1471
|
|
1615
1472
|
/** \brief Add a semantic error message.
|
1616
|
-
*
|
1617
|
-
* \param value JSON Value location associated with the error
|
1473
|
+
* \param value JSON Value location associated with the error
|
1618
1474
|
* \param message The error message.
|
1619
|
-
* \return \c true if the error was successfully added, \c false if the
|
1620
|
-
* offset exceeds the document size.
|
1475
|
+
* \return \c true if the error was successfully added, \c false if the
|
1476
|
+
* Value offset exceeds the document size.
|
1621
1477
|
*/
|
1622
|
-
bool pushError(const Value& value, const
|
1478
|
+
bool pushError(const Value& value, const JSONCPP_STRING& message);
|
1623
1479
|
|
1624
1480
|
/** \brief Add a semantic error message with extra context.
|
1625
|
-
*
|
1626
|
-
* \param value JSON Value location associated with the error
|
1481
|
+
* \param value JSON Value location associated with the error
|
1627
1482
|
* \param message The error message.
|
1628
|
-
* \param extra
|
1483
|
+
* \param extra Additional JSON Value location to contextualize the error
|
1629
1484
|
* \return \c true if the error was successfully added, \c false if either
|
1630
1485
|
* Value offset exceeds the document size.
|
1631
1486
|
*/
|
1632
|
-
bool pushError(const Value& value, const
|
1487
|
+
bool pushError(const Value& value, const JSONCPP_STRING& message, const Value& extra);
|
1633
1488
|
|
1634
1489
|
/** \brief Return whether there are any errors.
|
1635
|
-
*
|
1636
|
-
*
|
1637
|
-
* occurred.
|
1490
|
+
* \return \c true if there are no errors to report \c false if
|
1491
|
+
* errors have occurred.
|
1638
1492
|
*/
|
1639
1493
|
bool good() const;
|
1640
1494
|
|
@@ -1666,15 +1520,15 @@ private:
|
|
1666
1520
|
class ErrorInfo {
|
1667
1521
|
public:
|
1668
1522
|
Token token_;
|
1669
|
-
|
1523
|
+
JSONCPP_STRING message_;
|
1670
1524
|
Location extra_;
|
1671
1525
|
};
|
1672
1526
|
|
1673
|
-
|
1527
|
+
typedef std::deque<ErrorInfo> Errors;
|
1674
1528
|
|
1675
1529
|
bool readToken(Token& token);
|
1676
1530
|
void skipSpaces();
|
1677
|
-
bool match(
|
1531
|
+
bool match(Location pattern, int patternLength);
|
1678
1532
|
bool readComment();
|
1679
1533
|
bool readCStyleComment();
|
1680
1534
|
bool readCppStyleComment();
|
@@ -1686,141 +1540,140 @@ private:
|
|
1686
1540
|
bool decodeNumber(Token& token);
|
1687
1541
|
bool decodeNumber(Token& token, Value& decoded);
|
1688
1542
|
bool decodeString(Token& token);
|
1689
|
-
bool decodeString(Token& token,
|
1543
|
+
bool decodeString(Token& token, JSONCPP_STRING& decoded);
|
1690
1544
|
bool decodeDouble(Token& token);
|
1691
1545
|
bool decodeDouble(Token& token, Value& decoded);
|
1692
|
-
bool decodeUnicodeCodePoint(Token& token,
|
1546
|
+
bool decodeUnicodeCodePoint(Token& token,
|
1547
|
+
Location& current,
|
1548
|
+
Location end,
|
1693
1549
|
unsigned int& unicode);
|
1694
|
-
bool decodeUnicodeEscapeSequence(Token& token,
|
1695
|
-
Location
|
1696
|
-
|
1550
|
+
bool decodeUnicodeEscapeSequence(Token& token,
|
1551
|
+
Location& current,
|
1552
|
+
Location end,
|
1553
|
+
unsigned int& unicode);
|
1554
|
+
bool addError(const JSONCPP_STRING& message, Token& token, Location extra = 0);
|
1697
1555
|
bool recoverFromError(TokenType skipUntilToken);
|
1698
|
-
bool addErrorAndRecover(const
|
1556
|
+
bool addErrorAndRecover(const JSONCPP_STRING& message,
|
1557
|
+
Token& token,
|
1699
1558
|
TokenType skipUntilToken);
|
1700
1559
|
void skipUntilSpace();
|
1701
1560
|
Value& currentValue();
|
1702
1561
|
Char getNextChar();
|
1703
|
-
void
|
1704
|
-
|
1705
|
-
|
1562
|
+
void
|
1563
|
+
getLocationLineAndColumn(Location location, int& line, int& column) const;
|
1564
|
+
JSONCPP_STRING getLocationLineAndColumn(Location location) const;
|
1706
1565
|
void addComment(Location begin, Location end, CommentPlacement placement);
|
1707
1566
|
void skipCommentTokens(Token& token);
|
1708
1567
|
|
1709
|
-
|
1710
|
-
static String normalizeEOL(Location begin, Location end);
|
1711
|
-
|
1712
|
-
using Nodes = std::stack<Value*>;
|
1568
|
+
typedef std::stack<Value*> Nodes;
|
1713
1569
|
Nodes nodes_;
|
1714
1570
|
Errors errors_;
|
1715
|
-
|
1716
|
-
Location begin_
|
1717
|
-
Location end_
|
1718
|
-
Location current_
|
1719
|
-
Location lastValueEnd_
|
1720
|
-
Value* lastValue_
|
1721
|
-
|
1571
|
+
JSONCPP_STRING document_;
|
1572
|
+
Location begin_;
|
1573
|
+
Location end_;
|
1574
|
+
Location current_;
|
1575
|
+
Location lastValueEnd_;
|
1576
|
+
Value* lastValue_;
|
1577
|
+
JSONCPP_STRING commentsBefore_;
|
1722
1578
|
Features features_;
|
1723
|
-
bool collectComments_
|
1724
|
-
};
|
1579
|
+
bool collectComments_;
|
1580
|
+
}; // Reader
|
1725
1581
|
|
1726
1582
|
/** Interface for reading JSON from a char array.
|
1727
1583
|
*/
|
1728
1584
|
class JSON_API CharReader {
|
1729
1585
|
public:
|
1730
|
-
virtual ~CharReader()
|
1586
|
+
virtual ~CharReader() {}
|
1731
1587
|
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
|
1732
|
-
|
1733
|
-
* document to read.
|
1588
|
+
document.
|
1589
|
+
* The document must be a UTF-8 encoded string containing the document to read.
|
1734
1590
|
*
|
1735
|
-
* \param
|
1736
|
-
|
1737
|
-
* \param
|
1738
|
-
|
1739
|
-
*
|
1740
|
-
*
|
1741
|
-
*
|
1742
|
-
*
|
1743
|
-
*
|
1591
|
+
* \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the
|
1592
|
+
document to read.
|
1593
|
+
* \param endDoc Pointer on the end of the UTF-8 encoded string of the
|
1594
|
+
document to read.
|
1595
|
+
* Must be >= beginDoc.
|
1596
|
+
* \param root [out] Contains the root value of the document if it was
|
1597
|
+
* successfully parsed.
|
1598
|
+
* \param errs [out] Formatted error messages (if not NULL)
|
1599
|
+
* a user friendly string that lists errors in the parsed
|
1600
|
+
* document.
|
1744
1601
|
* \return \c true if the document was successfully parsed, \c false if an
|
1745
|
-
|
1602
|
+
error occurred.
|
1746
1603
|
*/
|
1747
|
-
virtual bool parse(
|
1748
|
-
|
1604
|
+
virtual bool parse(
|
1605
|
+
char const* beginDoc, char const* endDoc,
|
1606
|
+
Value* root, JSONCPP_STRING* errs) = 0;
|
1749
1607
|
|
1750
1608
|
class JSON_API Factory {
|
1751
1609
|
public:
|
1752
|
-
virtual ~Factory()
|
1610
|
+
virtual ~Factory() {}
|
1753
1611
|
/** \brief Allocate a CharReader via operator new().
|
1754
1612
|
* \throw std::exception if something goes wrong (e.g. invalid settings)
|
1755
1613
|
*/
|
1756
1614
|
virtual CharReader* newCharReader() const = 0;
|
1757
|
-
};
|
1758
|
-
};
|
1615
|
+
}; // Factory
|
1616
|
+
}; // CharReader
|
1759
1617
|
|
1760
1618
|
/** \brief Build a CharReader implementation.
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1619
|
+
|
1620
|
+
Usage:
|
1621
|
+
\code
|
1622
|
+
using namespace Passenger;
|
1623
|
+
using namespace Json;
|
1624
|
+
CharReaderBuilder builder;
|
1625
|
+
builder["collectComments"] = false;
|
1626
|
+
Value value;
|
1627
|
+
JSONCPP_STRING errs;
|
1628
|
+
bool ok = parseFromStream(builder, std::cin, &value, &errs);
|
1629
|
+
\endcode
|
1630
|
+
*/
|
1772
1631
|
class JSON_API CharReaderBuilder : public CharReader::Factory {
|
1773
1632
|
public:
|
1774
1633
|
// Note: We use a Json::Value so that we can add data-members to this class
|
1775
1634
|
// without a major version bump.
|
1776
1635
|
/** Configuration of this builder.
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
* it is skipped.
|
1813
|
-
*
|
1814
|
-
* You can examine 'settings_` yourself to see the defaults. You can also
|
1815
|
-
* write and read them just like any JSON Value.
|
1816
|
-
* \sa setDefaults()
|
1817
|
-
*/
|
1636
|
+
These are case-sensitive.
|
1637
|
+
Available settings (case-sensitive):
|
1638
|
+
- `"collectComments": false or true`
|
1639
|
+
- true to collect comment and allow writing them
|
1640
|
+
back during serialization, false to discard comments.
|
1641
|
+
This parameter is ignored if allowComments is false.
|
1642
|
+
- `"allowComments": false or true`
|
1643
|
+
- true if comments are allowed.
|
1644
|
+
- `"strictRoot": false or true`
|
1645
|
+
- true if root must be either an array or an object value
|
1646
|
+
- `"allowDroppedNullPlaceholders": false or true`
|
1647
|
+
- true if dropped null placeholders are allowed. (See StreamWriterBuilder.)
|
1648
|
+
- `"allowNumericKeys": false or true`
|
1649
|
+
- true if numeric object keys are allowed.
|
1650
|
+
- `"allowSingleQuotes": false or true`
|
1651
|
+
- true if '' are allowed for strings (both keys and values)
|
1652
|
+
- `"stackLimit": integer`
|
1653
|
+
- Exceeding stackLimit (recursive depth of `readValue()`) will
|
1654
|
+
cause an exception.
|
1655
|
+
- This is a security issue (seg-faults caused by deeply nested JSON),
|
1656
|
+
so the default is low.
|
1657
|
+
- `"failIfExtra": false or true`
|
1658
|
+
- If true, `parse()` returns false when extra non-whitespace trails
|
1659
|
+
the JSON value in the input string.
|
1660
|
+
- `"rejectDupKeys": false or true`
|
1661
|
+
- If true, `parse()` returns false when a key is duplicated within an object.
|
1662
|
+
- `"allowSpecialFloats": false or true`
|
1663
|
+
- If true, special float values (NaNs and infinities) are allowed
|
1664
|
+
and their values are lossfree restorable.
|
1665
|
+
|
1666
|
+
You can examine 'settings_` yourself
|
1667
|
+
to see the defaults. You can also write and read them just like any
|
1668
|
+
JSON Value.
|
1669
|
+
\sa setDefaults()
|
1670
|
+
*/
|
1818
1671
|
Json::Value settings_;
|
1819
1672
|
|
1820
1673
|
CharReaderBuilder();
|
1821
|
-
~CharReaderBuilder()
|
1674
|
+
~CharReaderBuilder() JSONCPP_OVERRIDE;
|
1822
1675
|
|
1823
|
-
CharReader* newCharReader() const
|
1676
|
+
CharReader* newCharReader() const JSONCPP_OVERRIDE;
|
1824
1677
|
|
1825
1678
|
/** \return true if 'settings' are legal and consistent;
|
1826
1679
|
* otherwise, indicate bad settings via 'invalid'.
|
@@ -1829,7 +1682,7 @@ public:
|
|
1829
1682
|
|
1830
1683
|
/** A simple way to update a specific setting.
|
1831
1684
|
*/
|
1832
|
-
Value& operator[](
|
1685
|
+
Value& operator[](JSONCPP_STRING key);
|
1833
1686
|
|
1834
1687
|
/** Called by ctor, but you can use this to reset settings_.
|
1835
1688
|
* \pre 'settings' != NULL (but Json::null is fine)
|
@@ -1846,37 +1699,39 @@ public:
|
|
1846
1699
|
};
|
1847
1700
|
|
1848
1701
|
/** Consume entire stream and use its begin/end.
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
bool JSON_API parseFromStream(
|
1853
|
-
|
1702
|
+
* Someday we might have a real StreamReader, but for now this
|
1703
|
+
* is convenient.
|
1704
|
+
*/
|
1705
|
+
bool JSON_API parseFromStream(
|
1706
|
+
CharReader::Factory const&,
|
1707
|
+
JSONCPP_ISTREAM&,
|
1708
|
+
Value* root, std::string* errs);
|
1854
1709
|
|
1855
1710
|
/** \brief Read from 'sin' into 'root'.
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
JSON_API
|
1711
|
+
|
1712
|
+
Always keep comments from the input JSON.
|
1713
|
+
|
1714
|
+
This can be used to read a file into a particular sub-object.
|
1715
|
+
For example:
|
1716
|
+
\code
|
1717
|
+
Json::Value root;
|
1718
|
+
cin >> root["dir"]["file"];
|
1719
|
+
cout << root;
|
1720
|
+
\endcode
|
1721
|
+
Result:
|
1722
|
+
\verbatim
|
1723
|
+
{
|
1724
|
+
"dir": {
|
1725
|
+
"file": {
|
1726
|
+
// The input stream JSON would be nested here.
|
1727
|
+
}
|
1728
|
+
}
|
1729
|
+
}
|
1730
|
+
\endverbatim
|
1731
|
+
\throw std::exception on parse error.
|
1732
|
+
\see Json::operator<<()
|
1733
|
+
*/
|
1734
|
+
JSON_API JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM&, Value&);
|
1880
1735
|
|
1881
1736
|
} // namespace Json
|
1882
1737
|
} // namespace Passenger
|
@@ -1887,7 +1742,7 @@ JSON_API IStream& operator>>(IStream&, Value&);
|
|
1887
1742
|
#pragma warning(pop)
|
1888
1743
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
1889
1744
|
|
1890
|
-
#endif //
|
1745
|
+
#endif // CPPTL_JSON_READER_H_INCLUDED
|
1891
1746
|
|
1892
1747
|
// //////////////////////////////////////////////////////////////////////
|
1893
1748
|
// End of content of file: include/json/reader.h
|
@@ -1902,7 +1757,7 @@ JSON_API IStream& operator>>(IStream&, Value&);
|
|
1902
1757
|
// Beginning of content of file: include/json/writer.h
|
1903
1758
|
// //////////////////////////////////////////////////////////////////////
|
1904
1759
|
|
1905
|
-
// Copyright 2007-2010 Baptiste Lepilleur
|
1760
|
+
// Copyright 2007-2010 Baptiste Lepilleur
|
1906
1761
|
// Distributed under MIT license, or public domain if desired and
|
1907
1762
|
// recognized in your jurisdiction.
|
1908
1763
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
@@ -1913,13 +1768,13 @@ JSON_API IStream& operator>>(IStream&, Value&);
|
|
1913
1768
|
#if !defined(JSON_IS_AMALGAMATION)
|
1914
1769
|
#include "value.h"
|
1915
1770
|
#endif // if !defined(JSON_IS_AMALGAMATION)
|
1916
|
-
#include <ostream>
|
1917
|
-
#include <string>
|
1918
1771
|
#include <vector>
|
1772
|
+
#include <string>
|
1773
|
+
#include <ostream>
|
1919
1774
|
|
1920
1775
|
// Disable warning C4251: <data member>: <type> needs to have dll-interface to
|
1921
1776
|
// be used by...
|
1922
|
-
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
1777
|
+
#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
1923
1778
|
#pragma warning(push)
|
1924
1779
|
#pragma warning(disable : 4251)
|
1925
1780
|
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
|
@@ -1932,31 +1787,32 @@ namespace Json {
|
|
1932
1787
|
class Value;
|
1933
1788
|
|
1934
1789
|
/**
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1790
|
+
|
1791
|
+
Usage:
|
1792
|
+
\code
|
1793
|
+
using namespace Passenger;
|
1794
|
+
using namespace Json;
|
1795
|
+
void writeToStdout(StreamWriter::Factory const& factory, Value const& value) {
|
1796
|
+
std::unique_ptr<StreamWriter> const writer(
|
1797
|
+
factory.newStreamWriter());
|
1798
|
+
writer->write(value, &std::cout);
|
1799
|
+
std::cout << std::endl; // add lf and flush
|
1800
|
+
}
|
1801
|
+
\endcode
|
1802
|
+
*/
|
1946
1803
|
class JSON_API StreamWriter {
|
1947
1804
|
protected:
|
1948
|
-
|
1805
|
+
JSONCPP_OSTREAM* sout_; // not owned; will not delete
|
1949
1806
|
public:
|
1950
1807
|
StreamWriter();
|
1951
1808
|
virtual ~StreamWriter();
|
1952
1809
|
/** Write Value into document as configured in sub-class.
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
* configuration
|
1810
|
+
Do not take ownership of sout, but maintain a reference during function.
|
1811
|
+
\pre sout != NULL
|
1812
|
+
\return zero on success (For now, we always return zero, so check the stream instead.)
|
1813
|
+
\throw std::exception possibly, depending on configuration
|
1958
1814
|
*/
|
1959
|
-
virtual int write(Value const& root,
|
1815
|
+
virtual int write(Value const& root, JSONCPP_OSTREAM* sout) = 0;
|
1960
1816
|
|
1961
1817
|
/** \brief A simple abstract factory.
|
1962
1818
|
*/
|
@@ -1967,71 +1823,65 @@ public:
|
|
1967
1823
|
* \throw std::exception if something goes wrong (e.g. invalid settings)
|
1968
1824
|
*/
|
1969
1825
|
virtual StreamWriter* newStreamWriter() const = 0;
|
1970
|
-
};
|
1971
|
-
};
|
1826
|
+
}; // Factory
|
1827
|
+
}; // StreamWriter
|
1972
1828
|
|
1973
1829
|
/** \brief Write into stringstream, then return string, for convenience.
|
1974
1830
|
* A StreamWriter will be created from the factory, used, and then deleted.
|
1975
1831
|
*/
|
1976
|
-
|
1977
|
-
|
1832
|
+
JSONCPP_STRING JSON_API writeString(StreamWriter::Factory const& factory, Value const& root);
|
1833
|
+
|
1978
1834
|
|
1979
1835
|
/** \brief Build a StreamWriter implementation.
|
1980
1836
|
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1837
|
+
Usage:
|
1838
|
+
\code
|
1839
|
+
using namespace Passenger;
|
1840
|
+
using namespace Json;
|
1841
|
+
Value value = ...;
|
1842
|
+
StreamWriterBuilder builder;
|
1843
|
+
builder["commentStyle"] = "None";
|
1844
|
+
builder["indentation"] = " "; // or whatever you like
|
1845
|
+
std::unique_ptr<Json::StreamWriter> writer(
|
1846
|
+
builder.newStreamWriter());
|
1847
|
+
writer->write(value, &std::cout);
|
1848
|
+
std::cout << std::endl; // add lf and flush
|
1849
|
+
\endcode
|
1993
1850
|
*/
|
1994
1851
|
class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
|
1995
1852
|
public:
|
1996
1853
|
// Note: We use a Json::Value so that we can add data-members to this class
|
1997
1854
|
// without a major version bump.
|
1998
1855
|
/** Configuration of this builder.
|
1999
|
-
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
* - If true, outputs raw UTF8 strings instead of escaping them.
|
2020
|
-
|
2021
|
-
* You can examine 'settings_` yourself
|
2022
|
-
* to see the defaults. You can also write and read them just like any
|
2023
|
-
* JSON Value.
|
2024
|
-
* \sa setDefaults()
|
2025
|
-
*/
|
1856
|
+
Available settings (case-sensitive):
|
1857
|
+
- "commentStyle": "None" or "All"
|
1858
|
+
- "indentation": "<anything>"
|
1859
|
+
- "enableYAMLCompatibility": false or true
|
1860
|
+
- slightly change the whitespace around colons
|
1861
|
+
- "dropNullPlaceholders": false or true
|
1862
|
+
- Drop the "null" string from the writer's output for nullValues.
|
1863
|
+
Strictly speaking, this is not valid JSON. But when the output is being
|
1864
|
+
fed to a browser's Javascript, it makes for smaller output and the
|
1865
|
+
browser can handle the output just fine.
|
1866
|
+
- "useSpecialFloats": false or true
|
1867
|
+
- If true, outputs non-finite floating point values in the following way:
|
1868
|
+
NaN values as "NaN", positive infinity as "Infinity", and negative infinity
|
1869
|
+
as "-Infinity".
|
1870
|
+
|
1871
|
+
You can examine 'settings_` yourself
|
1872
|
+
to see the defaults. You can also write and read them just like any
|
1873
|
+
JSON Value.
|
1874
|
+
\sa setDefaults()
|
1875
|
+
*/
|
2026
1876
|
Json::Value settings_;
|
2027
1877
|
|
2028
1878
|
StreamWriterBuilder();
|
2029
|
-
~StreamWriterBuilder()
|
1879
|
+
~StreamWriterBuilder() JSONCPP_OVERRIDE;
|
2030
1880
|
|
2031
1881
|
/**
|
2032
1882
|
* \throw std::exception if something goes wrong (e.g. invalid settings)
|
2033
1883
|
*/
|
2034
|
-
StreamWriter* newStreamWriter() const
|
1884
|
+
StreamWriter* newStreamWriter() const JSONCPP_OVERRIDE;
|
2035
1885
|
|
2036
1886
|
/** \return true if 'settings' are legal and consistent;
|
2037
1887
|
* otherwise, indicate bad settings via 'invalid'.
|
@@ -2039,7 +1889,7 @@ public:
|
|
2039
1889
|
bool validate(Json::Value* invalid) const;
|
2040
1890
|
/** A simple way to update a specific setting.
|
2041
1891
|
*/
|
2042
|
-
Value& operator[](
|
1892
|
+
Value& operator[](JSONCPP_STRING key);
|
2043
1893
|
|
2044
1894
|
/** Called by ctor, but you can use this to reset settings_.
|
2045
1895
|
* \pre 'settings' != NULL (but Json::null is fine)
|
@@ -2056,7 +1906,7 @@ class JSON_API Writer {
|
|
2056
1906
|
public:
|
2057
1907
|
virtual ~Writer();
|
2058
1908
|
|
2059
|
-
virtual
|
1909
|
+
virtual JSONCPP_STRING write(const Value& root) = 0;
|
2060
1910
|
};
|
2061
1911
|
|
2062
1912
|
/** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format
|
@@ -2064,25 +1914,21 @@ public:
|
|
2064
1914
|
*
|
2065
1915
|
* The JSON document is written in a single line. It is not intended for 'human'
|
2066
1916
|
*consumption,
|
2067
|
-
* but may be
|
1917
|
+
* but may be usefull to support feature such as RPC where bandwith is limited.
|
2068
1918
|
* \sa Reader, Value
|
2069
1919
|
* \deprecated Use StreamWriterBuilder.
|
2070
1920
|
*/
|
2071
|
-
|
2072
|
-
|
2073
|
-
#pragma warning(disable : 4996) // Deriving from deprecated class
|
2074
|
-
#endif
|
2075
|
-
class JSON_API FastWriter
|
2076
|
-
: public Writer {
|
1921
|
+
class JSON_API FastWriter : public Writer {
|
1922
|
+
|
2077
1923
|
public:
|
2078
1924
|
FastWriter();
|
2079
|
-
~FastWriter()
|
1925
|
+
~FastWriter() JSONCPP_OVERRIDE {}
|
2080
1926
|
|
2081
1927
|
void enableYAMLCompatibility();
|
2082
1928
|
|
2083
1929
|
/** \brief Drop the "null" string from the writer's output for nullValues.
|
2084
1930
|
* Strictly speaking, this is not valid JSON. But when the output is being
|
2085
|
-
* fed to a browser's
|
1931
|
+
* fed to a browser's Javascript, it makes for smaller output and the
|
2086
1932
|
* browser can handle the output just fine.
|
2087
1933
|
*/
|
2088
1934
|
void dropNullPlaceholders();
|
@@ -2090,19 +1936,16 @@ public:
|
|
2090
1936
|
void omitEndingLineFeed();
|
2091
1937
|
|
2092
1938
|
public: // overridden from Writer
|
2093
|
-
|
1939
|
+
JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
|
2094
1940
|
|
2095
1941
|
private:
|
2096
1942
|
void writeValue(const Value& value);
|
2097
1943
|
|
2098
|
-
|
2099
|
-
bool
|
2100
|
-
bool dropNullPlaceholders_
|
2101
|
-
bool omitEndingLineFeed_
|
1944
|
+
JSONCPP_STRING document_;
|
1945
|
+
bool yamlCompatiblityEnabled_;
|
1946
|
+
bool dropNullPlaceholders_;
|
1947
|
+
bool omitEndingLineFeed_;
|
2102
1948
|
};
|
2103
|
-
#if defined(_MSC_VER)
|
2104
|
-
#pragma warning(pop)
|
2105
|
-
#endif
|
2106
1949
|
|
2107
1950
|
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
|
2108
1951
|
*human friendly way.
|
@@ -2128,49 +1971,41 @@ private:
|
|
2128
1971
|
* \sa Reader, Value, Value::setComment()
|
2129
1972
|
* \deprecated Use StreamWriterBuilder.
|
2130
1973
|
*/
|
2131
|
-
|
2132
|
-
#pragma warning(push)
|
2133
|
-
#pragma warning(disable : 4996) // Deriving from deprecated class
|
2134
|
-
#endif
|
2135
|
-
class JSON_API
|
2136
|
-
StyledWriter : public Writer {
|
1974
|
+
class JSON_API StyledWriter : public Writer {
|
2137
1975
|
public:
|
2138
1976
|
StyledWriter();
|
2139
|
-
~StyledWriter()
|
1977
|
+
~StyledWriter() JSONCPP_OVERRIDE {}
|
2140
1978
|
|
2141
1979
|
public: // overridden from Writer
|
2142
1980
|
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
|
2143
1981
|
* \param root Value to serialize.
|
2144
1982
|
* \return String containing the JSON document that represents the root value.
|
2145
1983
|
*/
|
2146
|
-
|
1984
|
+
JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
|
2147
1985
|
|
2148
1986
|
private:
|
2149
1987
|
void writeValue(const Value& value);
|
2150
1988
|
void writeArrayValue(const Value& value);
|
2151
|
-
bool
|
2152
|
-
void pushValue(const
|
1989
|
+
bool isMultineArray(const Value& value);
|
1990
|
+
void pushValue(const JSONCPP_STRING& value);
|
2153
1991
|
void writeIndent();
|
2154
|
-
void writeWithIndent(const
|
1992
|
+
void writeWithIndent(const JSONCPP_STRING& value);
|
2155
1993
|
void indent();
|
2156
1994
|
void unindent();
|
2157
1995
|
void writeCommentBeforeValue(const Value& root);
|
2158
1996
|
void writeCommentAfterValueOnSameLine(const Value& root);
|
2159
|
-
|
2160
|
-
static
|
1997
|
+
bool hasCommentForValue(const Value& value);
|
1998
|
+
static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text);
|
2161
1999
|
|
2162
|
-
|
2000
|
+
typedef std::vector<JSONCPP_STRING> ChildValues;
|
2163
2001
|
|
2164
2002
|
ChildValues childValues_;
|
2165
|
-
|
2166
|
-
|
2167
|
-
unsigned int rightMargin_
|
2168
|
-
unsigned int indentSize_
|
2169
|
-
bool addChildValues_
|
2003
|
+
JSONCPP_STRING document_;
|
2004
|
+
JSONCPP_STRING indentString_;
|
2005
|
+
unsigned int rightMargin_;
|
2006
|
+
unsigned int indentSize_;
|
2007
|
+
bool addChildValues_;
|
2170
2008
|
};
|
2171
|
-
#if defined(_MSC_VER)
|
2172
|
-
#pragma warning(pop)
|
2173
|
-
#endif
|
2174
2009
|
|
2175
2010
|
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
|
2176
2011
|
human friendly way,
|
@@ -2194,21 +2029,14 @@ private:
|
|
2194
2029
|
* If the Value have comments then they are outputed according to their
|
2195
2030
|
#CommentPlacement.
|
2196
2031
|
*
|
2032
|
+
* \param indentation Each level will be indented by this amount extra.
|
2197
2033
|
* \sa Reader, Value, Value::setComment()
|
2198
2034
|
* \deprecated Use StreamWriterBuilder.
|
2199
2035
|
*/
|
2200
|
-
|
2201
|
-
#pragma warning(push)
|
2202
|
-
#pragma warning(disable : 4996) // Deriving from deprecated class
|
2203
|
-
#endif
|
2204
|
-
class JSON_API
|
2205
|
-
StyledStreamWriter {
|
2036
|
+
class JSON_API StyledStreamWriter {
|
2206
2037
|
public:
|
2207
|
-
|
2208
|
-
|
2209
|
-
*/
|
2210
|
-
StyledStreamWriter(String indentation = "\t");
|
2211
|
-
~StyledStreamWriter() = default;
|
2038
|
+
StyledStreamWriter(JSONCPP_STRING indentation = "\t");
|
2039
|
+
~StyledStreamWriter() {}
|
2212
2040
|
|
2213
2041
|
public:
|
2214
2042
|
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
|
@@ -2217,51 +2045,46 @@ public:
|
|
2217
2045
|
* \note There is no point in deriving from Writer, since write() should not
|
2218
2046
|
* return a value.
|
2219
2047
|
*/
|
2220
|
-
void write(
|
2048
|
+
void write(JSONCPP_OSTREAM& out, const Value& root);
|
2221
2049
|
|
2222
2050
|
private:
|
2223
2051
|
void writeValue(const Value& value);
|
2224
2052
|
void writeArrayValue(const Value& value);
|
2225
|
-
bool
|
2226
|
-
void pushValue(const
|
2053
|
+
bool isMultineArray(const Value& value);
|
2054
|
+
void pushValue(const JSONCPP_STRING& value);
|
2227
2055
|
void writeIndent();
|
2228
|
-
void writeWithIndent(const
|
2056
|
+
void writeWithIndent(const JSONCPP_STRING& value);
|
2229
2057
|
void indent();
|
2230
2058
|
void unindent();
|
2231
2059
|
void writeCommentBeforeValue(const Value& root);
|
2232
2060
|
void writeCommentAfterValueOnSameLine(const Value& root);
|
2233
|
-
|
2234
|
-
static
|
2061
|
+
bool hasCommentForValue(const Value& value);
|
2062
|
+
static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text);
|
2235
2063
|
|
2236
|
-
|
2064
|
+
typedef std::vector<JSONCPP_STRING> ChildValues;
|
2237
2065
|
|
2238
2066
|
ChildValues childValues_;
|
2239
|
-
|
2240
|
-
|
2241
|
-
unsigned int rightMargin_
|
2242
|
-
|
2067
|
+
JSONCPP_OSTREAM* document_;
|
2068
|
+
JSONCPP_STRING indentString_;
|
2069
|
+
unsigned int rightMargin_;
|
2070
|
+
JSONCPP_STRING indentation_;
|
2243
2071
|
bool addChildValues_ : 1;
|
2244
2072
|
bool indented_ : 1;
|
2245
2073
|
};
|
2246
|
-
#if defined(_MSC_VER)
|
2247
|
-
#pragma warning(pop)
|
2248
|
-
#endif
|
2249
2074
|
|
2250
2075
|
#if defined(JSON_HAS_INT64)
|
2251
|
-
|
2252
|
-
|
2076
|
+
JSONCPP_STRING JSON_API valueToString(Int value);
|
2077
|
+
JSONCPP_STRING JSON_API valueToString(UInt value);
|
2253
2078
|
#endif // if defined(JSON_HAS_INT64)
|
2254
|
-
|
2255
|
-
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2259
|
-
String JSON_API valueToString(bool value);
|
2260
|
-
String JSON_API valueToQuotedString(const char* value);
|
2079
|
+
JSONCPP_STRING JSON_API valueToString(LargestInt value);
|
2080
|
+
JSONCPP_STRING JSON_API valueToString(LargestUInt value);
|
2081
|
+
JSONCPP_STRING JSON_API valueToString(double value);
|
2082
|
+
JSONCPP_STRING JSON_API valueToString(bool value);
|
2083
|
+
JSONCPP_STRING JSON_API valueToQuotedString(const char* value);
|
2261
2084
|
|
2262
2085
|
/// \brief Output using the StyledStreamWriter.
|
2263
2086
|
/// \see Json::operator>>()
|
2264
|
-
JSON_API
|
2087
|
+
JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root);
|
2265
2088
|
|
2266
2089
|
} // namespace Json
|
2267
2090
|
} // namespace Passenger
|
@@ -2287,15 +2110,15 @@ JSON_API OStream& operator<<(OStream&, const Value& root);
|
|
2287
2110
|
// Beginning of content of file: include/json/assertions.h
|
2288
2111
|
// //////////////////////////////////////////////////////////////////////
|
2289
2112
|
|
2290
|
-
// Copyright 2007-2010 Baptiste Lepilleur
|
2113
|
+
// Copyright 2007-2010 Baptiste Lepilleur
|
2291
2114
|
// Distributed under MIT license, or public domain if desired and
|
2292
2115
|
// recognized in your jurisdiction.
|
2293
2116
|
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
2294
2117
|
|
2295
|
-
#ifndef
|
2296
|
-
#define
|
2118
|
+
#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED
|
2119
|
+
#define CPPTL_JSON_ASSERTIONS_H_INCLUDED
|
2297
2120
|
|
2298
|
-
#include <
|
2121
|
+
#include <stdlib.h>
|
2299
2122
|
#include <sstream>
|
2300
2123
|
|
2301
2124
|
#if !defined(JSON_IS_AMALGAMATION)
|
@@ -2309,45 +2132,38 @@ JSON_API OStream& operator<<(OStream&, const Value& root);
|
|
2309
2132
|
#if JSON_USE_EXCEPTION
|
2310
2133
|
|
2311
2134
|
// @todo <= add detail about condition in exception
|
2312
|
-
#define JSON_ASSERT(condition)
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
|
2317
|
-
|
2318
|
-
|
2319
|
-
#define JSON_FAIL_MESSAGE(message) \
|
2320
|
-
do { \
|
2321
|
-
OStringStream oss; \
|
2322
|
-
oss << message; \
|
2135
|
+
# define JSON_ASSERT(condition) \
|
2136
|
+
{if (!(condition)) {Json::throwLogicError( "assert json failed" );}}
|
2137
|
+
|
2138
|
+
# define JSON_FAIL_MESSAGE(message) \
|
2139
|
+
{ \
|
2140
|
+
JSONCPP_OSTRINGSTREAM oss; oss << message; \
|
2323
2141
|
Json::throwLogicError(oss.str()); \
|
2324
2142
|
abort(); \
|
2325
|
-
}
|
2143
|
+
}
|
2326
2144
|
|
2327
2145
|
#else // JSON_USE_EXCEPTION
|
2328
2146
|
|
2329
|
-
#define JSON_ASSERT(condition) assert(condition)
|
2147
|
+
# define JSON_ASSERT(condition) assert(condition)
|
2330
2148
|
|
2331
2149
|
// The call to assert() will show the failure message in debug builds. In
|
2332
2150
|
// release builds we abort, for a core-dump or debugger.
|
2333
|
-
#define JSON_FAIL_MESSAGE(message)
|
2151
|
+
# define JSON_FAIL_MESSAGE(message) \
|
2334
2152
|
{ \
|
2335
|
-
|
2336
|
-
oss << message; \
|
2153
|
+
JSONCPP_OSTRINGSTREAM oss; oss << message; \
|
2337
2154
|
assert(false && oss.str().c_str()); \
|
2338
2155
|
abort(); \
|
2339
2156
|
}
|
2340
2157
|
|
2158
|
+
|
2341
2159
|
#endif
|
2342
2160
|
|
2343
2161
|
#define JSON_ASSERT_MESSAGE(condition, message) \
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
} \
|
2348
|
-
} while (0)
|
2162
|
+
if (!(condition)) { \
|
2163
|
+
JSON_FAIL_MESSAGE(message); \
|
2164
|
+
}
|
2349
2165
|
|
2350
|
-
#endif //
|
2166
|
+
#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED
|
2351
2167
|
|
2352
2168
|
// //////////////////////////////////////////////////////////////////////
|
2353
2169
|
// End of content of file: include/json/assertions.h
|
@@ -2357,4 +2173,4 @@ JSON_API OStream& operator<<(OStream&, const Value& root);
|
|
2357
2173
|
|
2358
2174
|
|
2359
2175
|
|
2360
|
-
#endif //ifndef
|
2176
|
+
#endif //ifndef JSON_AMALGATED_H_INCLUDED
|