cphot 0.1
A C++ tool for computing photometry from spectra.
|
|
Go to the documentation of this file.
15 #ifndef RAPIDJSON_DOCUMENT_H_
16 #define RAPIDJSON_DOCUMENT_H_
30 RAPIDJSON_DIAG_OFF(4127)
31 RAPIDJSON_DIAG_OFF(4244)
35 RAPIDJSON_DIAG_OFF(padded)
36 RAPIDJSON_DIAG_OFF(
switch-
enum)
37 RAPIDJSON_DIAG_OFF(
c++98-compat)
41 RAPIDJSON_DIAG_OFF(effc++)
43 RAPIDJSON_DIAG_OFF(terminate)
47 #ifndef RAPIDJSON_NOMEMBERITERATORCLASS
51 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
58 template <
typename Encoding,
typename Allocator>
61 template <
typename Encoding,
typename Allocator,
typename StackAllocator>
70 template <
typename Encoding,
typename Allocator>
79 #ifndef RAPIDJSON_NOMEMBERITERATORCLASS
100 template <
bool Const,
typename Encoding,
typename Allocator>
102 :
public std::iterator<std::random_access_iterator_tag
103 , typename internal::MaybeAddConst<Const,GenericMember<Encoding,Allocator> >::Type> {
110 typedef std::iterator<std::random_access_iterator_tag,ValueType> BaseType;
196 #else // RAPIDJSON_NOMEMBERITERATORCLASS
200 template <
bool Const,
typename Encoding,
typename Allocator>
204 template <
typename Encoding,
typename Allocator>
210 template <
typename Encoding,
typename Allocator>
216 #endif // RAPIDJSON_NOMEMBERITERATORCLASS
248 template<
typename CharType>
253 #ifndef __clang__ // -Wdocumentation
282 #ifndef __clang__ // -Wdocumentation
306 #ifndef __clang__ // -Wdocumentation
320 operator const Ch *()
const {
return s; }
345 template<
typename CharType>
365 template<
typename CharType>
370 #if RAPIDJSON_HAS_STDSTRING
383 template<
typename CharType>
393 template <
typename T,
typename Encoding =
void,
typename Allocator =
void>
398 : IsBaseOf<GenericValue<typename T::EncodingType, typename T::AllocatorType>, T>
::Type {};
410 template <
typename ValueType,
typename T>
413 template<
typename ValueType>
415 static bool Is(
const ValueType& v) {
return v.IsBool(); }
416 static bool Get(
const ValueType& v) {
return v.GetBool(); }
417 static ValueType&
Set(ValueType& v,
bool data) {
return v.SetBool(data); }
418 static ValueType&
Set(ValueType& v,
bool data,
typename ValueType::AllocatorType&) {
return v.SetBool(data); }
421 template<
typename ValueType>
423 static bool Is(
const ValueType& v) {
return v.IsInt(); }
424 static int Get(
const ValueType& v) {
return v.GetInt(); }
425 static ValueType&
Set(ValueType& v,
int data) {
return v.SetInt(data); }
426 static ValueType&
Set(ValueType& v,
int data,
typename ValueType::AllocatorType&) {
return v.SetInt(data); }
429 template<
typename ValueType>
431 static bool Is(
const ValueType& v) {
return v.IsUint(); }
432 static unsigned Get(
const ValueType& v) {
return v.GetUint(); }
433 static ValueType&
Set(ValueType& v,
unsigned data) {
return v.SetUint(data); }
434 static ValueType&
Set(ValueType& v,
unsigned data,
typename ValueType::AllocatorType&) {
return v.SetUint(data); }
437 template<
typename ValueType>
439 static bool Is(
const ValueType& v) {
return v.IsInt64(); }
440 static int64_t Get(
const ValueType& v) {
return v.GetInt64(); }
441 static ValueType&
Set(ValueType& v,
int64_t data) {
return v.SetInt64(data); }
442 static ValueType&
Set(ValueType& v,
int64_t data,
typename ValueType::AllocatorType&) {
return v.SetInt64(data); }
445 template<
typename ValueType>
447 static bool Is(
const ValueType& v) {
return v.IsUint64(); }
449 static ValueType&
Set(ValueType& v,
uint64_t data) {
return v.SetUint64(data); }
450 static ValueType&
Set(ValueType& v,
uint64_t data,
typename ValueType::AllocatorType&) {
return v.SetUint64(data); }
453 template<
typename ValueType>
455 static bool Is(
const ValueType& v) {
return v.IsDouble(); }
456 static double Get(
const ValueType& v) {
return v.GetDouble(); }
457 static ValueType&
Set(ValueType& v,
double data) {
return v.SetDouble(data); }
458 static ValueType&
Set(ValueType& v,
double data,
typename ValueType::AllocatorType&) {
return v.SetDouble(data); }
461 template<
typename ValueType>
463 static bool Is(
const ValueType& v) {
return v.IsFloat(); }
464 static float Get(
const ValueType& v) {
return v.GetFloat(); }
465 static ValueType&
Set(ValueType& v,
float data) {
return v.SetFloat(data); }
466 static ValueType&
Set(ValueType& v,
float data,
typename ValueType::AllocatorType&) {
return v.SetFloat(data); }
469 template<
typename ValueType>
470 struct TypeHelper<ValueType, const typename ValueType::Ch*> {
472 static bool Is(
const ValueType& v) {
return v.IsString(); }
473 static StringType
Get(
const ValueType& v) {
return v.GetString(); }
474 static ValueType&
Set(ValueType& v,
const StringType data) {
return v.SetString(
typename ValueType::StringRefType(data)); }
475 static ValueType&
Set(ValueType& v,
const StringType data,
typename ValueType::AllocatorType&
a) {
return v.SetString(data,
a); }
478 #if RAPIDJSON_HAS_STDSTRING
479 template<
typename ValueType>
480 struct TypeHelper<ValueType, std::basic_string<typename ValueType::Ch> > {
481 typedef std::basic_string<typename ValueType::Ch> StringType;
482 static bool Is(
const ValueType& v) {
return v.IsString(); }
483 static StringType Get(
const ValueType& v) {
return StringType(v.GetString(), v.GetStringLength()); }
484 static ValueType& Set(ValueType& v,
const StringType& data,
typename ValueType::AllocatorType&
a) {
return v.SetString(data,
a); }
488 template<
typename ValueType>
491 static bool Is(
const ValueType& v) {
return v.IsArray(); }
493 static ValueType&
Set(ValueType& v,
ArrayType data) {
return v = data; }
494 static ValueType&
Set(ValueType& v,
ArrayType data,
typename ValueType::AllocatorType&) {
return v = data; }
497 template<
typename ValueType>
498 struct TypeHelper<ValueType, typename ValueType::ConstArray> {
500 static bool Is(
const ValueType& v) {
return v.IsArray(); }
504 template<
typename ValueType>
507 static bool Is(
const ValueType& v) {
return v.IsObject(); }
510 static ValueType&
Set(ValueType& v,
ObjectType data,
typename ValueType::AllocatorType&) { v = data; }
513 template<
typename ValueType>
514 struct TypeHelper<ValueType, typename ValueType::ConstObject> {
516 static bool Is(
const ValueType& v) {
return v.IsObject(); }
539 template <
typename Encoding,
typename Allocator = MemoryPoolAllocator<> >
546 typedef typename Encoding::Ch
Ch;
564 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
575 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
577 template <
typename StackAllocator>
581 template <
typename StackAllocator>
593 static const uint16_t defaultFlags[7] = {
612 template<
typename SourceAllocator >
621 #ifndef RAPIDJSON_DOXYGEN_RUNNING // hide SFINAE from Doxygen
622 template <
typename T>
623 explicit GenericValue(T b, RAPIDJSON_ENABLEIF((internal::IsSame<bool, T>))) RAPIDJSON_NOEXCEPT
687 #if RAPIDJSON_HAS_STDSTRING
701 a.value_.data_ = Data();
712 o.value_.data_ = Data();
720 if (Allocator::kNeedFree) {
762 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
765 return *
this = rhs.Move();
791 template <
typename T>
804 template <
typename SourceAllocator>
806 RAPIDJSON_ASSERT(
static_cast<void*
>(
this) !=
static_cast<void const*
>(&rhs));
821 other.RawAssign(temp);
841 GenericValue& Move() RAPIDJSON_NOEXCEPT {
return *
this; }
851 template <
typename SourceAllocator>
854 if (GetType() != rhs.GetType())
861 for (
ConstMemberIterator lhsMemberItr = MemberBegin(); lhsMemberItr != MemberEnd(); ++lhsMemberItr) {
862 typename RhsType::ConstMemberIterator rhsMemberItr = rhs.FindMember(lhsMemberItr->name);
863 if (rhsMemberItr == rhs.MemberEnd() || lhsMemberItr->value != rhsMemberItr->value)
872 if ((*
this)[i] != rhs[i])
880 if (IsDouble() || rhs.IsDouble()) {
881 double a = GetDouble();
882 double b = rhs.GetDouble();
883 return a >= b &&
a <= b;
896 #if RAPIDJSON_HAS_STDSTRING
911 template <
typename SourceAllocator>
915 bool operator!=(
const Ch* rhs)
const {
return !(*
this == rhs); }
952 bool IsLosslessDouble()
const {
953 if (!IsNumber())
return false;
956 volatile double d =
static_cast<double>(u);
958 && (d < static_cast<double>(std::numeric_limits<uint64_t>::max()))
963 volatile double d =
static_cast<double>(i);
964 return (d >=
static_cast<double>(std::numeric_limits<int64_t>::min()))
965 && (d <
static_cast<double>(std::numeric_limits<int64_t>::max()))
966 && (i ==
static_cast<int64_t>(d));
972 bool IsFloat()
const {
975 double d = GetDouble();
976 return d >= -3.4028234e38 && d <= 3.4028234e38;
979 bool IsLosslessFloat()
const {
980 if (!IsNumber())
return false;
981 double a = GetDouble();
982 if (
a <
static_cast<double>(-std::numeric_limits<float>::max())
983 ||
a >
static_cast<double>(std::numeric_limits<float>::max()))
985 double b =
static_cast<double>(
static_cast<float>(
a));
986 return a >= b &&
a <= b;
1030 template <
typename T>
1035 template <
typename T>
1047 template <
typename SourceAllocator>
1050 if (member != MemberEnd())
1051 return member->value;
1064 template <
typename SourceAllocator>
1067 #if RAPIDJSON_HAS_STDSTRING
1094 bool HasMember(
const Ch* name)
const {
return FindMember(name) != MemberEnd(); }
1096 #if RAPIDJSON_HAS_STDSTRING
1105 bool HasMember(
const std::basic_string<Ch>& name)
const {
return FindMember(name) != MemberEnd(); }
1117 template <
typename SourceAllocator>
1134 return FindMember(n);
1152 template <
typename SourceAllocator>
1157 for ( ; member != MemberEnd(); ++member)
1164 #if RAPIDJSON_HAS_STDSTRING
1191 if (o.size >= o.capacity) {
1192 if (o.capacity == 0) {
1198 o.capacity += (oldCapacity + 1) / 2;
1203 members[o.size].name.RawAssign(name);
1204 members[o.size].value.RawAssign(
value);
1220 return AddMember(name, v, allocator);
1223 #if RAPIDJSON_HAS_STDSTRING
1235 return AddMember(name, v, allocator);
1256 template <
typename T>
1260 return AddMember(name, v, allocator);
1263 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
1265 return AddMember(name,
value, allocator);
1268 return AddMember(name,
value, allocator);
1271 return AddMember(name,
value, allocator);
1275 return AddMember(n,
value, allocator);
1277 #endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
1292 return AddMember(n,
value, allocator);
1306 return AddMember(name, v, allocator);
1326 template <
typename T>
1330 return AddMember(n,
value, allocator);
1337 void RemoveAllMembers() {
1352 bool RemoveMember(
const Ch* name) {
1354 return RemoveMember(n);
1357 #if RAPIDJSON_HAS_STDSTRING
1358 bool RemoveMember(
const std::basic_string<Ch>& name) {
return RemoveMember(
GenericValue(
StringRef(name))); }
1361 template <
typename SourceAllocator>
1364 if (m != MemberEnd()) {
1405 return EraseMember(pos, pos +1);
1428 std::memmove(&*pos, &*last,
static_cast<size_t>(MemberEnd() - last) *
sizeof(
Member));
1438 bool EraseMember(
const Ch* name) {
1440 return EraseMember(n);
1443 #if RAPIDJSON_HAS_STDSTRING
1444 bool EraseMember(
const std::basic_string<Ch>& name) {
return EraseMember(
GenericValue(
StringRef(name))); }
1447 template <
typename SourceAllocator>
1450 if (m != MemberEnd()) {
1549 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
1551 return PushBack(
value, allocator);
1553 #endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
1565 return (*this).template PushBack<StringRefType>(
value, allocator);
1585 template <
typename T>
1589 return PushBack(v, allocator);
1611 return Erase(pos, pos + 1);
1632 std::memmove(pos, last,
static_cast<size_t>(End() - last) *
sizeof(
GenericValue));
1653 double GetDouble()
const {
1665 float GetFloat()
const {
1666 return static_cast<float>(GetDouble());
1723 #if RAPIDJSON_HAS_STDSTRING
1731 GenericValue& SetString(
const std::basic_string<Ch>& s,
Allocator& allocator) {
return SetString(s.data(),
SizeType(s.size()), allocator); }
1743 template <
typename T>
1746 template <
typename T>
1749 template <
typename T>
1752 template<
typename T>
1755 template<
typename T>
1767 template <
typename Handler>
1768 bool Accept(
Handler& handler)
const {
1772 case kTrueType:
return handler.Bool(
true);
1799 if (IsDouble())
return handler.Double(
data_.
n.
d);
1800 else if (IsInt())
return handler.Int(
data_.
n.
i.
i);
1801 else if (IsUint())
return handler.Uint(
data_.
n.
u.
u);
1802 else if (IsInt64())
return handler.Int64(
data_.
n.
i64);
1803 else return handler.Uint64(
data_.
n.
u64);
1808 template <
typename,
typename>
friend class GenericValue;
1846 #if RAPIDJSON_48BITPOINTER_OPTIMIZATION
1848 #elif RAPIDJSON_64BIT
1881 #if RAPIDJSON_ENDIAN == RAPIDJSON_LITTLEENDIAN
1952 std::memcpy(m, members, count *
sizeof(
Member));
1976 str =
static_cast<Ch *
>(allocator.Malloc((s.
length + 1) *
sizeof(
Ch)));
1979 std::memcpy(str, s, s.
length *
sizeof(
Ch));
1990 template <
typename SourceAllocator>
1995 const SizeType len1 = GetStringLength();
1996 const SizeType len2 = rhs.GetStringLength();
1997 if(len1 != len2) {
return false; }
1999 const Ch*
const str1 = GetString();
2000 const Ch*
const str2 = rhs.GetString();
2001 if(str1 == str2) {
return true; }
2003 return (std::memcmp(str1, str2,
sizeof(
Ch) * len1) == 0);
2023 template <
typename Encoding,
typename Allocator = MemoryPoolAllocator<>,
typename StackAllocator = CrtAllocator>
2026 typedef typename Encoding::Ch
Ch;
2051 allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_()
2057 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
2060 :
ValueType(std::forward<ValueType>(rhs)),
2061 allocator_(rhs.allocator_),
2062 ownAllocator_(rhs.ownAllocator_),
2063 stack_(std::move(rhs.stack_)),
2064 parseResult_(rhs.parseResult_)
2067 rhs.ownAllocator_ = 0;
2076 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
2087 allocator_ = rhs.allocator_;
2088 ownAllocator_ = rhs.ownAllocator_;
2089 stack_ = std::move(rhs.stack_);
2090 parseResult_ = rhs.parseResult_;
2093 rhs.ownAllocator_ = 0;
2108 stack_.
Swap(rhs.stack_);
2134 template <
typename Generator>
2136 ClearStackOnExit scope(*
this);
2154 template <
unsigned parseFlags,
typename SourceEncoding,
typename InputStream>
2158 ClearStackOnExit scope(*
this);
2159 parseResult_ = reader.template Parse<parseFlags>(is, *
this);
2173 template <
unsigned parseFlags,
typename InputStream>
2175 return ParseStream<parseFlags, Encoding, InputStream>(is);
2183 template <
typename InputStream>
2185 return ParseStream<kParseDefaultFlags, Encoding, InputStream>(is);
2197 template <
unsigned parseFlags>
2200 return ParseStream<parseFlags | kParseInsituFlag>(s);
2208 return ParseInsitu<kParseDefaultFlags>(str);
2220 template <
unsigned parseFlags,
typename SourceEncoding>
2224 return ParseStream<parseFlags, SourceEncoding>(s);
2231 template <
unsigned parseFlags>
2233 return Parse<parseFlags, Encoding>(str);
2240 return Parse<kParseDefaultFlags>(str);
2243 template <
unsigned parseFlags,
typename SourceEncoding>
2246 MemoryStream ms(
static_cast<const char*
>(str), length *
sizeof(
typename SourceEncoding::Ch));
2248 ParseStream<parseFlags, SourceEncoding>(is);
2252 template <
unsigned parseFlags>
2254 return Parse<parseFlags, Encoding>(str, length);
2258 return Parse<kParseDefaultFlags>(str, length);
2261 #if RAPIDJSON_HAS_STDSTRING
2262 template <
unsigned parseFlags,
typename SourceEncoding>
2265 return Parse<parseFlags, SourceEncoding>(str.c_str());
2268 template <
unsigned parseFlags>
2270 return Parse<parseFlags, Encoding>(str.c_str());
2274 return Parse<kParseDefaultFlags>(str);
2276 #endif // RAPIDJSON_HAS_STDSTRING
2293 #ifndef __clang // -Wdocumentation
2318 struct ClearStackOnExit {
2320 ~ClearStackOnExit() { d_.ClearStack(); }
2322 ClearStackOnExit(
const ClearStackOnExit&);
2323 ClearStackOnExit& operator=(
const ClearStackOnExit&);
2333 bool Null() {
new (stack_.template Push<ValueType>())
ValueType();
return true; }
2334 bool Bool(
bool b) {
new (stack_.template Push<ValueType>())
ValueType(b);
return true; }
2335 bool Int(
int i) {
new (stack_.template Push<ValueType>())
ValueType(i);
return true; }
2336 bool Uint(
unsigned i) {
new (stack_.template Push<ValueType>())
ValueType(i);
return true; }
2339 bool Double(
double d) {
new (stack_.template Push<ValueType>())
ValueType(d);
return true; }
2345 new (stack_.template Push<ValueType>())
ValueType(str, length);
2353 new (stack_.template Push<ValueType>())
ValueType(str, length);
2362 typename ValueType::Member* members = stack_.template Pop<typename ValueType::Member>(memberCount);
2363 stack_.template Top<ValueType>()->SetObjectRaw(members, memberCount,
GetAllocator());
2370 ValueType* elements = stack_.template Pop<ValueType>(elementCount);
2371 stack_.template Top<ValueType>()->SetArrayRaw(elements, elementCount,
GetAllocator());
2382 if (Allocator::kNeedFree)
2384 (stack_.template Pop<ValueType>(1))->~
ValueType();
2394 static const size_t kDefaultStackCapacity = 1024;
2405 template <
typename Encoding,
typename Allocator>
2406 template <
typename SourceAllocator>
2410 switch (rhs.GetType()) {
2415 RawAssign(*d.stack_.template Pop<GenericValue>(1));
2421 data_ = *
reinterpret_cast<const Data*
>(&rhs.
data_);
2428 data_ = *
reinterpret_cast<const Data*
>(&rhs.
data_);
2438 template <
bool Const,
typename ValueT>
2450 template <
typename,
typename>
2459 bool Empty()
const {
return value_.Empty(); }
2466 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
2468 #endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
2475 #if RAPIDJSON_HAS_CXX11_RANGE_FOR
2491 template <
bool Const,
typename ValueT>
2503 typedef typename ValueType::Ch
Ch;
2505 template <
typename,
typename>
2516 #if RAPIDJSON_HAS_STDSTRING
2521 bool HasMember(
const Ch* name)
const {
return value_.HasMember(name); }
2522 #if RAPIDJSON_HAS_STDSTRING
2523 bool HasMember(
const std::basic_string<Ch>& name)
const {
return value_.HasMember(name); }
2528 #if RAPIDJSON_HAS_STDSTRING
2533 #if RAPIDJSON_HAS_STDSTRING
2537 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
2542 #endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
2548 #if RAPIDJSON_HAS_STDSTRING
2549 bool RemoveMember(
const std::basic_string<Ch>& name)
const {
return value_.RemoveMember(name); }
2556 #if RAPIDJSON_HAS_STDSTRING
2561 #if RAPIDJSON_HAS_CXX11_RANGE_FOR
2575 #endif // RAPIDJSON_DOCUMENT_H_
GenericMemberIterator< false, Encoding, Allocator >::Iterator MemberIterator
Member iterator for iterating in object.
MemberIterator FindMember(const GenericValue< EncodingType, SourceAllocator > &name) const
ValueType::EncodingType EncodingType
GenericDocument & ParseStream(InputStream &is)
Parse JSON text from an input stream (with Encoding conversion)
CharType Ch
character type of the string
GenericObject AddMember(StringRefType name, ValueType &value, AllocatorType &allocator) const
GenericMemberIterator< true, typename ValueT::EncodingType, typename ValueT::AllocatorType > ConstMemberIterator
Represents a JSON Pointer. Use Pointer for UTF8 encoding and default allocator.
Iterator & operator+=(DifferenceType n)
bool StringEqual(const GenericValue< Encoding, SourceAllocator > &rhs) const
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
GenericObject(const GenericObject &rhs)
AllocatorType &const allocator
GenericObject AddMember(ValueType &name, StringRefType value, AllocatorType &allocator) const
GenericObject< true, ValueType > ConstObject
ValueType::ConstArray ArrayType
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
GenericArray Reserve(SizeType newCapacity, AllocatorType &allocator) const
A document for parsing JSON text as DOM.
GenericStringRef(const GenericStringRef &rhs)
bool HasMember(const GenericValue< EncodingType, SourceAllocator > &name) const
ParseErrorCode GetParseError() const
Get the ParseErrorCode of last parsing.
GenericStringRef(const CharType *str, SizeType len)
Create constant string reference from pointer and length.
RAPIDJSON_FORCEINLINE GenericValue * SetElementsPointer(GenericValue *elements)
SizeType GetLength() const
Concept for allocating, resizing and freeing memory block.
GenericDocument< UTF8<> > Document
GenericDocument with UTF8 encoding.
size_t GetCapacity() const
const typedef GenericValue * ConstValueIterator
Constant value iterator for iterating in array.
static ValueType & Set(ValueType &v, int data, typename ValueType::AllocatorType &)
static ValueType & Set(ValueType &v, float data, typename ValueType::AllocatorType &)
bool operator!=(ConstIterator that) const
const typedef ValueT * ConstValueIterator
static const SizeType kDefaultArrayCapacity
GenericStringRef(const CharType *str)
Explicitly create string reference from const character pointer.
GenericDocument & ParseStream(InputStream &is)
Parse JSON text from an input stream.
struct GenericValue::Number::I i
internal::MaybeAddConst< Const, PlainType >::Type ValueType
MemberIterator FindMember(const Ch *name) const
GenericDocument & Parse(const typename SourceEncoding::Ch *str, size_t length)
GenericDocument & ParseInsitu(Ch *str)
Parse JSON text from a mutable string.
static ObjectType Get(const ValueType &v)
const Ch *const s
plain CharType pointer
static uint64_t Get(const ValueType &v)
GenericDocument & Parse(const Ch *str, size_t length)
ValueIterator Erase(ConstValueIterator first, ConstValueIterator last) const
GenericArray< true, ValueT > ConstArray
static bool Is(const ValueType &v)
MemberIterator EraseMember(ConstMemberIterator first, ConstMemberIterator last) const
const SizeType length
length of the string (excluding the trailing NULL terminator)
Reference operator*() const
GenericStringRef< Ch > StringRefType
Reference to a constant string.
static ValueType & Set(ValueType &v, uint64_t data, typename ValueType::AllocatorType &)
RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr< internal::IsPointer< T >, internal::IsGenericValue< T > >),(const GenericArray &)) PushBack(T value
GenericValue(Object o) RAPIDJSON_NOEXCEPT
Constructor for Object.
Iterator & operator=(const NonConstIterator &it)
Helper class for accessing Value of array type.
GenericMemberIterator< true, Encoding, Allocator >::Iterator ConstMemberIterator
Constant member iterator for iterating in object.
const RAPIDJSON_FORCEINLINE Ch * SetStringPointer(const Ch *str)
GenericObject AddMember(ValueType &name, ValueType &value, AllocatorType &allocator) const
size_t GetErrorOffset() const
Get the position of last parsing error in input, 0 otherwise.
SizeType Capacity() const
static ValueType & Set(ValueType &v, float data)
static bool Is(const ValueType &v)
constexpr bool operator==(const RQuantity< M, l, T, A, C, L, S, D > &lhs, const RQuantity< M, l, T, A, C, L, S, D > &rhs)
static ValueType & Set(ValueType &v, int64_t data, typename ValueType::AllocatorType &)
size_t Offset() const
Get the error offset, if IsError(), 0 otherwise.
ValueIterator Erase(ConstValueIterator pos) const
BaseType::difference_type DifferenceType
Signed integer type (e.g. ptrdiff_t)
static bool Is(const ValueType &v)
Represents an in-memory input byte stream.
ValueType::AllocatorType AllocatorType
bool RemoveMember(const Ch *name) const
A read-write string stream.
static bool Is(const ValueType &v)
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
ValueType * ValueIterator
GenericValue< Encoding, Allocator > value
value of member.
GenericObject< true, ValueT > ConstObject
static ValueType & Set(ValueType &v, unsigned data)
static StringType Get(const ValueType &v)
static ValueType & Set(ValueType &v, ArrayType data, typename ValueType::AllocatorType &)
bool IsError() const
Whether the result is an error.
GenericValue(int64_t i64) RAPIDJSON_NOEXCEPT
Constructor for int64_t value.
GenericValue & operator=(StringRefType str) RAPIDJSON_NOEXCEPT
Assignment of constant string reference (no copy)
Encoding::Ch Ch
Character type derived from Encoding.
GenericStringRef< CharType > StringRef(const CharType *str)
Mark a character pointer as constant string.
ValueType::ConstObject ObjectType
bool EndArray(SizeType elementCount)
friend class GenericMemberIterator
GenericValue(const Ch *s, SizeType length) RAPIDJSON_NOEXCEPT
Constructor for constant string (i.e. do not make a copy of string)
@ kParseInsituFlag
In-situ(destructive) parsing.
bool Key(const Ch *str, SizeType length, bool copy)
SizeType MemberCount() const
void SetArrayRaw(GenericValue *values, SizeType count, Allocator &allocator)
MemberIterator RemoveMember(MemberIterator m) const
static bool Is(const ValueType &v)
MemberIterator MemberBegin() const
bool operator<(ConstIterator that) const
GenericValue & operator=(GenericValue &rhs) RAPIDJSON_NOEXCEPT
Assignment with move semantics.
Iterator & operator-=(DifferenceType n)
GenericValue(const Ch *s, Allocator &allocator)
Constructor for copy-string (i.e. do make a copy of string)
GenericDocument(Allocator *allocator=0, size_t stackCapacity=kDefaultStackCapacity, StackAllocator *stackAllocator=0)
Constructor.
static ValueType & Set(ValueType &v, const StringType data)
Allocator & GetAllocator()
Get the allocator of this document.
const typedef ValueType::Ch * StringType
#define RAPIDJSON_ASSERT(x)
Assertion.
static bool Is(const ValueType &v)
static unsigned Get(const ValueType &v)
static ValueType & Set(ValueType &v, ObjectType data)
static ValueType & Set(ValueType &v, double data)
static bool Is(const ValueType &v)
GenericStringRef< CharType > StringRef(const CharType *str)
Mark a character pointer as constant string.
static const SizeType kDefaultObjectCapacity
GenericValue(unsigned u) RAPIDJSON_NOEXCEPT
Constructor for unsigned value.
ParseErrorCode
Error code of parsing.
bool EndObject(SizeType memberCount)
static ArrayType Get(const ValueType &v)
static int64_t Get(const ValueType &v)
static ValueType & Set(ValueType &v, bool data, typename ValueType::AllocatorType &)
unsigned __int64 uint64_t
GenericDocument & Populate(Generator &g)
Populate this document by a generator which produces SAX events.
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
bool RawNumber(const Ch *str, SizeType length, bool copy)
GenericDocument & ParseInsitu(Ch *str)
Parse JSON text from a mutable string (with kParseDefaultFlags)
BaseType::reference Reference
Reference to (const) GenericMember.
RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr< internal::IsPointer< T >, internal::IsGenericValue< T > >),(ValueType &)) AddMember(ValueType &name
static ValueType & Set(ValueType &v, unsigned data, typename ValueType::AllocatorType &)
ValueType & operator[](T *name) const
friend void swap(GenericDocument &a, GenericDocument &b) RAPIDJSON_NOEXCEPT
free-standing swap function helper
size_t GetStackCapacity() const
Get the capacity of stack in bytes.
RAPIDJSON_DISABLEIF_RETURN((internal::IsPointer< T >),(GenericValue &)) operator
Assignment with primitive types.
GenericMemberIterator()
Default constructor (singular value)
static ValueType & Set(ValueType &v, bool data)
bool HasParseError() const
Whether a parse error has occured in the last parsing.
DifferenceType operator-(ConstIterator that) const
Distance.
Result of parsing (wraps ParseErrorCode)
GenericArray< true, ValueType > ConstArray
Encoding EncodingType
Encoding type from template parameter.
GenericValue< Encoding, Allocator > name
name of member (must be a string)
ValueType & operator[](const GenericValue< EncodingType, SourceAllocator > &name) const
GenericMemberIterator< false, Encoding, Allocator > NonConstIterator
Non-constant iterator type.
bool EraseMember(const GenericValue< EncodingType, SourceAllocator > &name) const
GenericValue(T b, RAPIDJSON_ENABLEIF((internal::IsSame< bool, T >))) RAPIDJSON_NOEXCEPT
Constructor for boolean value.
GenericDocument & ParseStream(InputStream &is)
Parse JSON text from an input stream (with kParseDefaultFlags)
#define RAPIDJSON_GETPOINTER(type, p)
ValueType::StringRefType StringRefType
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
static ValueType & Set(ValueType &v, ObjectType data, typename ValueType::AllocatorType &)
T AllocatorType &const allocator
ValueIterator End() const
Allocator & GetAllocator()
#define RAPIDJSON_NEW(x)
! customization point for global new
GenericMemberIterator< true, Encoding, Allocator > ConstIterator
Constant iterator type.
bool HasAllocator() const
BaseType::pointer Pointer
Pointer to (const) GenericMember.
ValueIterator Begin() const
#define RAPIDJSON_DELETE(x)
! customization point for global delete
GenericObject AddMember(StringRefType name, StringRefType value, AllocatorType &allocator) const
static ValueType & Set(ValueType &v, uint64_t data)
SAX-style JSON parser. Use Reader for UTF8 encoding and default allocator.
GenericValue(const Ch *s, SizeType length, Allocator &allocator)
Constructor for copy-string (i.e. do make a copy of string)
static ArrayType Get(ValueType &v)
static bool Usable(SizeType len)
Pointer operator->() const
bool operator>=(ConstIterator that) const
Represents a JSON value. Use Value for UTF8 encoding and default allocator.
void RawAssign(GenericValue &rhs) RAPIDJSON_NOEXCEPT
Assignment without calling destructor.
static ObjectType Get(ValueType &v)
static ValueType & Set(ValueType &v, const StringType data, typename ValueType::AllocatorType &a)
static float Get(const ValueType &v)
static bool Is(const ValueType &v)
GenericValue() RAPIDJSON_NOEXCEPT
Default constructor creates a null value.
ParseErrorCode Code() const
Get the error code.
internal::MaybeAddConst< Const, PlainType >::Type ValueType
constexpr bool operator!=(const RQuantity< M, l, T, A, C, L, S, D > &lhs, const RQuantity< M, l, T, A, C, L, S, D > &rhs)
Name-value pair in a JSON object value.
static bool Is(const ValueType &v)
const GenericPointer< typename T::ValueType > & pointer
ValueType::AllocatorType AllocatorType
static ValueType & Set(ValueType &v, ArrayType data)
MemberIterator MemberEnd() const
static bool Is(const ValueType &v)
void Swap(T &a, T &b) RAPIDJSON_NOEXCEPT
Custom swap() to avoid dependency on C++ <algorithm> header.
GenericDocument(Type type, Allocator *allocator=0, size_t stackCapacity=kDefaultStackCapacity, StackAllocator *stackAllocator=0)
Constructor.
GenericObject & operator=(const GenericObject &rhs)
GenericArray PopBack() const
bool operator==(ConstIterator that) const
static double Get(const ValueType &v)
~GenericValue()
Destructor.
Reference to a constant string (not taking a copy)
GenericValue(StringRefType s) RAPIDJSON_NOEXCEPT
Constructor for constant string (i.e. do not make a copy of string)
GenericMember< Encoding, Allocator > Member
Name-value pair in an object.
GenericArray(const GenericArray &rhs)
GenericArray< false, ValueType > Array
Encoding::Ch Ch
Character type derived from Encoding.
GenericValue< Encoding, Allocator > ValueType
Value type of itself.
MemberIterator EraseMember(ConstMemberIterator pos) const
static ValueType & Set(ValueType &v, int64_t data)
void Swap(Stack &rhs) RAPIDJSON_NOEXCEPT
static bool Is(const ValueType &v)
bool operator>(ConstIterator that) const
Allocator AllocatorType
Allocator type from template parameter.
ValueType::StringRefType StringRefType
GenericArray< false, ValueT > Array
Helper class for accessing Value of object type.
RAPIDJSON_FORCEINLINE GenericValue * GetElementsPointer() const
GenericDocument & Parse(const Ch *str, size_t length)
GenericDocument & Parse(const Ch *str)
Parse JSON text from a read-only string.
bool RemoveMember(const GenericValue< EncodingType, SourceAllocator > &name) const
GenericDocument & Parse(const typename SourceEncoding::Ch *str)
Parse JSON text from a read-only string (with Encoding conversion)
(Constant) member iterator for a JSON object value
RAPIDJSON_FORCEINLINE Member * GetMembersPointer() const
static ValueType & Set(ValueType &v, int data)
GenericValue * ValueIterator
Value iterator for iterating in array.
Iterator operator+(DifferenceType n) const
GenericArray PushBack(ValueType &value, AllocatorType &allocator) const
GenericValue(int i) RAPIDJSON_NOEXCEPT
Constructor for int value.
struct GenericValue::Number::U u
GenericArray PushBack(StringRefType value, AllocatorType &allocator) const
RAPIDJSON_FORCEINLINE Member * SetMembersPointer(Member *members)
const RAPIDJSON_FORCEINLINE Ch * GetStringPointer() const
SizeType hashcode
reserved
bool HasMember(const Ch *name) const
GenericArray & operator=(const GenericArray &rhs)
#define RAPIDJSON_SETPOINTER(type, p, x)
const GenericPointer< typename T::ValueType > T2 value
ValueType::Array ArrayType
void SetObjectRaw(Member *members, SizeType count, Allocator &allocator)
Initialize this value as object with initial data, without calling destructor.
void SetLength(SizeType len)
ValueType::Object ObjectType
GenericObject< false, ValueType > Object
static ValueType & Set(ValueType &v, double data, typename ValueType::AllocatorType &)
ValueType & operator[](SizeType index) const
Reference operator[](DifferenceType n) const
GenericValue(Array a) RAPIDJSON_NOEXCEPT
Constructor for Array.
GenericValue(uint64_t u64) RAPIDJSON_NOEXCEPT
Constructor for uint64_t value.
GenericValue(Type type) RAPIDJSON_NOEXCEPT
Constructor with JSON value type.
#define RAPIDJSON_UNLIKELY(x)
Compiler branching hint for expression with low probability to be true.
GenericObject< false, ValueT > Object
Iterator operator-(DifferenceType n) const
GenericStringRef(const CharType(&str)[N]) RAPIDJSON_NOEXCEPT
Create string reference from const character array.
bool String(const Ch *str, SizeType length, bool copy)
bool operator<=(ConstIterator that) const
Allocator AllocatorType
Allocator type from template parameter.
static bool Is(const ValueType &v)
GenericMemberIterator< Const, typename ValueT::EncodingType, typename ValueT::AllocatorType > MemberIterator
void SetStringRaw(StringRefType s) RAPIDJSON_NOEXCEPT
Initialize this value as constant string, without calling destructor.
Concept for encoding of Unicode characters.
GenericMemberIterator Iterator
Iterator type itself.
#define RAPIDJSON_UINT64_C2(high32, low32)
Construct a 64-bit literal by a pair of 32-bit integer.
GenericValue(double d) RAPIDJSON_NOEXCEPT
Constructor for double value.
GenericMemberIterator(const NonConstIterator &it)
Iterator conversions to more const.
static int Get(const ValueType &v)
SizeType StrLen(const Ch *s)
Custom strlen() which works on different character types.
GenericDocument & Swap(GenericDocument &rhs) RAPIDJSON_NOEXCEPT
Exchange the contents of this document with those of another.
static bool Get(const ValueType &v)
void SetStringRaw(StringRefType s, Allocator &allocator)
Initialize this value as copy string with initial data, without calling destructor.
GenericValue< Encoding, Allocator > ValueType
Value type of the document.
GenericDocument & Parse(const Ch *str)
Parse JSON text from a read-only string (with kParseDefaultFlags)
Concept for receiving events from GenericReader upon parsing. The functions return true if no error o...
bool EraseMember(const Ch *name) const
char payload[sizeof(SizeType) *2+sizeof(void *)+2]
#define RAPIDJSON_STATIC_ASSERT(x)
(Internal) macro to check for conditions at compile-time