Lines Matching full:a
3 // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip.
6 // in compliance with the License. You may obtain a copy of the License at
47 // a former included windows.h might have defined a macro called GetObject, which affects
113 //! Name-value pair in a JSON object value.
115 This class was internal to GenericValue. It used to be a inner struct.
116 …But a compiler (IBM XL C/C++ for AIX) have reported to have problem with that so it moved as a nam…
122 GenericValue<Encoding, Allocator> name; //!< name of member (must be a string)
140 …/*! \param rhs Source of the assignment. Its name and value will become a null value after assignm…
151 friend inline void swap(GenericMember& a, GenericMember& b) RAPIDJSON_NOEXCEPT { in swap() argument
152 a.name.Swap(b.name); in swap()
153 a.value.Swap(b.value); in swap()
166 //! (Constant) member iterator for a JSON object value
168 \tparam Const Is this a constant iterator?
169 …ing Encoding of the value. (Even non-string values need to have the same encoding in a document)
172 This class implements a Random Access Iterator for GenericMember elements
173 of a GenericValue, see ISO/IEC 14882:2003(E) C++ standard, 24.1 [lib.iterator.requirements].
179 \note Define \c RAPIDJSON_NOMEMBERITERATORCLASS to fall back to a
229 that is "less const". Especially, creating a non-constant iterator
230 from a constant iterator are disabled:
237 constructor effectively defines a regular copy-constructor.
318 //! Reference to a constant string (not taking a copy)
328 string pointers have a sufficient lifetime, which exceeds the lifetime
352 This constructor implicitly creates a constant string reference from
353 a \c const character array. It has better performance than
361 than the use of the string in e.g. a GenericValue
366 \note There is a hidden, private overload to disallow references to
381 This constructor can be used to \b explicitly create a reference to
382 a constant string pointer.
387 than the use of the string in e.g. a GenericValue
391 \note There is a hidden, private overload to disallow references to
404 …tr constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue
428 /// Empty string - used when passing in a NULL pointer
441 //! Mark a character pointer as constant string
442 /*! Mark a plain character pointer as a "string literal". This function
443 can be used to avoid copying a character string to be referenced as a
444 value in a JSON GenericValue object, if the string's lifetime is known
447 …\param str Constant string, lifetime assumed to be longer than the use of the string in e.g. a Gen…
458 //! Mark a character pointer as constant string
459 /*! Mark a plain character pointer as a "string literal". This function
460 can be used to avoid copying a character string to be referenced as a
461 value in a JSON GenericValue object, if the string's lifetime is known
468 …\param str Constant string, lifetime assumed to be longer than the use of the string in e.g. a Gen…
479 //! Mark a string object as constant string
480 /*! Mark a string object (e.g. \c std::string) as a "string literal".
481 This function can be used to avoid copying a string to be referenced as a
482 value in a JSON GenericValue object, if the string's lifetime is known
486 …\param str Constant string, lifetime assumed to be longer than the use of the string in e.g. a Gen…
603 …e& v, const StringType data, typename ValueType::AllocatorType& a) { return v.SetString(data, a); }
612 …& v, const StringType& data, typename ValueType::AllocatorType& a) { return v.SetString(data, a); }
657 //! Represents a JSON value. Use Value for UTF8 encoding and default allocator.
659 A JSON value can be one of 7 types. This class is a variant type supporting
664 …ing Encoding of the value. (Even non-string values need to have the same encoding in a document)
675 typedef GenericStringRef<Ch> StringRefType; //!< Reference to a constant string
689 //! Default constructor creates a null value.
704 //! Moving from a GenericDocument is not permitted.
708 //! Move assignment from a GenericDocument is not permitted.
716 /*! This creates a Value of specified type with default content.
734 /*! Creates a copy of a Value by using the given Allocator
748 SizeType count = rhs.data_.a.size;
754 data_.a.size = data_.a.capacity = count;
777 to \c bool, if you want to construct a boolean JSON value in such cases.
836 //! Constructor for constant string (i.e. do not make a copy of string)
839 //! Constructor for constant string (i.e. do not make a copy of string)
842 //! Constructor for copy-string (i.e. do make a copy of string)
845 //! Constructor for copy-string (i.e. do make a copy of string)
849 //! Constructor for copy-string from a string object (i.e. do make a copy of string)
857 \param a An array obtained by \c GetArray().
861 GenericValue(Array a) RAPIDJSON_NOEXCEPT : data_(a.value_.data_) {
862 a.value_.data_ = Data();
863 a.value_.data_.f.flags = kArrayFlag;
889 for (GenericValue* v = e; v != e + data_.a.size; ++v)
919 /*! \param rhs Source of the assignment. It will become a null value after assignment.
971 /*! Assigns a \b copy of the Value to the current Value object
1002 void swap(MyClass& a, MyClass& b) {
1004 swap(a.value, b.value);
1010 friend inline void swap(GenericValue& a, GenericValue& b) RAPIDJSON_NOEXCEPT { a.Swap(b); }
1042 if (data_.a.size != rhs.data_.a.size)
1044 for (SizeType i = 0; i < data_.a.size; i++)
1054 double a = GetDouble(); // May convert from integer to double.
1056 return a >= b && a <= b; // Prevent -Wfloat-equal
1126 // Checks whether a number can be losslessly converted to a double.
1146 // Checks whether a number is a float (possible lossy).
1153 // Checks whether a number can be losslessly converted to a float.
1156 double a = GetDouble();
1157 if (a < static_cast<double>(-(std::numeric_limits<float>::max)())
1158 || a > static_cast<double>((std::numeric_limits<float>::max)()))
1160 double b = static_cast<double>(static_cast<float>(a));
1161 return a >= b && a <= b; // Prevent -Wfloat-equal
1199 //! Get a value from an object associated with the name.
1202 …\note In version 0.1x, if the member is not found, this function returns a null value. This makes …
1204 If user is unsure whether a member exists, user should use HasMember() first.
1205 A better approach is to use FindMember().
1216 //! Get a value from an object associated with the name.
1220 … \note Compared to \ref operator[](T*), this version is faster because it does not need a StrLen().
1261 //! Get a value from an object associated with name (string object).
1291 //! Check whether a member exists in the object.
1295 \return Whether a member with that name exists.
1302 //! Check whether a member exists in the object with string object.
1306 \return Whether a member with that name exists.
1313 //! Check whether a member exists in the object with GenericValue name.
1315 …This version is faster because it does not need a StrLen(). It can also handle string with null ch…
1318 \return Whether a member with that name exists.
1332 \note Earlier versions of Rapidjson returned a \c NULL pointer, in case
1346 …This version is faster because it does not need a StrLen(). It can also handle string with null ch…
1352 \note Earlier versions of Rapidjson returned a \c NULL pointer, in case
1377 //! Add a member (name-value pair) to the object.
1378 /*! \param name A string value as name of member.
1394 //! Add a constant string value as member (name-value pair) to the object.
1395 /*! \param name A string value as name of member.
1409 //! Add a string object as member (name-value pair) to the object.
1410 /*! \param name A string value as name of member.
1426 \param name A string value as name of member.
1465 //! Add a member (name-value pair) to the object.
1466 /*! \param name A constant string reference as name of member.
1480 //! Add a constant string value as member (name-value pair) to the object.
1481 /*! \param name A constant string reference as name of member.
1496 \param name A constant string reference as name of member.
1527 //! Remove a member in object by its name.
1555 //! Remove a member in object by iterator.
1571 //! Remove a member from an object by iterator.
1603 //! Erase a member in object by its name.
1643 SizeType Size() const { RAPIDJSON_ASSERT(IsArray()); return data_.a.size; }
1646 SizeType Capacity() const { RAPIDJSON_ASSERT(IsArray()); return data_.a.capacity; }
1649 bool Empty() const { RAPIDJSON_ASSERT(IsArray()); return data_.a.size == 0; }
1658 for (GenericValue* v = e; v != e + data_.a.size; ++v)
1660 data_.a.size = 0;
1670 RAPIDJSON_ASSERT(index < data_.a.size);
1680 ValueIterator End() { RAPIDJSON_ASSERT(IsArray()); return GetElementsPointer() + data_.a.size; }
1696 if (newCapacity > data_.a.capacity) {
1697 …interpret_cast<GenericValue*>(allocator.Realloc(GetElementsPointer(), data_.a.capacity * sizeof(Ge…
1698 data_.a.capacity = newCapacity;
1703 //! Append a GenericValue at the end of the array.
1715 if (data_.a.size >= data_.a.capacity)
1716 …Reserve(data_.a.capacity == 0 ? kDefaultArrayCapacity : (data_.a.capacity + (data_.a.capacity + 1)…
1717 GetElementsPointer()[data_.a.size++].RawAssign(value);
1727 //! Append a constant string reference at the end of the array.
1740 //! Append a primitive value at the end of the array.
1771 GetElementsPointer()[--data_.a.size].~GenericValue();
1796 RAPIDJSON_ASSERT(data_.a.size > 0);
1805 data_.a.size -= static_cast<SizeType>(last - first);
1860 //! Set this value as a string without copying source string.
1870 //! Set this value as a string without copying source string.
1877 //! Set this value as a string by copying from source string.
1887 //! Set this value as a string by copying from source string.
1895 //! Set this value as a string by copying from source string.
1904 //! Set this value as a string by copying from source string.
1940 //! Generate events of this value to a Handler.
1942 Typical usage is to output this JSON value as JSON text via Writer, which is a Handler.
1943 It can also be used to deep clone this value via GenericDocument, which is also a Handler.
1972 return handler.EndArray(data_.a.size);
2044 // (excluding the terminating zero) and store a value to determine the length of the contained
2103 ArrayData a;
2116 …cValue* GetElementsPointer() const { return RAPIDJSON_GETPOINTER(GenericValue, data_.a.elements); }
2117 …r(GenericValue* elements) { return RAPIDJSON_SETPOINTER(GenericValue, data_.a.elements, elements);…
2411 data_.a.size = data_.a.capacity = count;
2490 //! A document for parsing JSON text as DOM.
2496 …l destructor. To avoid memory leaks, do not \c delete a GenericDocument object via a pointer to a…
2606 void swap(MyClass& a, MyClass& b) {
2608 swap(a.doc, b.doc);
2614 … friend inline void swap(GenericDocument& a, GenericDocument& b) RAPIDJSON_NOEXCEPT { a.Swap(b); }
2616 //! Populate this document by a generator which produces SAX events.
2617 /*! \tparam Generator A functor with <tt>bool f(Handler)</tt> prototype.
2679 //! Parse JSON text from a mutable string
2690 //! Parse JSON text from a mutable string (with \ref kParseDefaultFlags)
2702 //! Parse JSON text from a read-only string (with Encoding conversion)
2714 //! Parse JSON text from a read-only string
2723 //! Parse JSON text from a read-only string (with \ref kParseDefaultFlags)
2770 //! Whether a parse error has occurred in the last parsing.