QCborArray 類是用於保持 CBOR (簡明二進製對象錶示) 元素的數組。 更多...
| 頭: | #include <QCborArray> |
| qmake: | QT += core |
| Since: | Qt 5.12 |
該類在 Qt 5.12 引入。
注意: 此類的所有函數 可重入 .
| class | ConstIterator |
| class | Iterator |
| typedef | const_iterator |
| typedef | const_pointer |
| typedef | const_reference |
| typedef | difference_type |
| typedef | iterator |
| typedef | pointer |
| typedef | reference |
| typedef | size_type |
| typedef | value_type |
| QCborArray (std::initializer_list<QCborValue> args ) | |
| QCborArray (const QCborArray & other ) | |
| QCborArray () | |
| QCborArray & | operator= (const QCborArray & other ) |
| ~QCborArray () | |
| void | append (const QCborValue & value ) |
| void | append (QCborValue && value ) |
| QCborValue | at (qsizetype i ) const |
| QCborArray::iterator | begin () |
| QCborArray::const_iterator | begin () const |
| QCborArray::const_iterator | cbegin () const |
| QCborArray::const_iterator | cend () const |
| void | clear () |
| int | compare (const QCborArray & other ) const |
| QCborArray::const_iterator | constBegin () const |
| QCborArray::const_iterator | constEnd () const |
| bool | contains (const QCborValue & value ) const |
| bool | empty () const |
| QCborArray::iterator | end () |
| QCborArray::const_iterator | end () const |
| QCborArray::iterator | erase (QCborArray::iterator it ) |
| QCborArray::iterator | erase (QCborArray::const_iterator it ) |
| QCborValue | extract (QCborArray::ConstIterator it ) |
| QCborValue | extract (QCborArray::Iterator it ) |
| QCborValue | first () const |
| QCborValueRef | first () |
| void | insert (qsizetype i , const QCborValue & value ) |
| void | insert (qsizetype i , QCborValue && value ) |
| QCborArray::iterator | insert (QCborArray::iterator before , const QCborValue & value ) |
| QCborArray::iterator | insert (QCborArray::const_iterator before , const QCborValue & value ) |
| bool | isEmpty () const |
| QCborValue | last () const |
| QCborValueRef | last () |
| void | pop_back () |
| void | pop_front () |
| void | prepend (const QCborValue & value ) |
| void | prepend (QCborValue && value ) |
| void | push_back (const QCborValue & t ) |
| void | push_front (const QCborValue & t ) |
| void | removeAt (qsizetype i ) |
| void | removeFirst () |
| void | removeLast () |
| qsizetype | size () const |
| void | swap (QCborArray & other ) |
| QCborValue | takeAt (qsizetype i ) |
| QCborValue | takeFirst () |
| QCborValue | takeLast () |
| QCborValue | toCborValue () const |
| QJsonArray | toJsonArray () const |
| QVariantList | toVariantList () const |
| bool | operator!= (const QCborArray & other ) const |
| QCborArray | operator+ (const QCborValue & v ) const |
| QCborArray & | operator+= (const QCborValue & v ) |
| bool | operator< (const QCborArray & other ) const |
| QCborArray & | operator<< (const QCborValue & v ) |
| bool | operator== (const QCborArray & other ) const |
| const QCborValue | operator[] (qsizetype i ) const |
| QCborValueRef | operator[] (qsizetype i ) |
| QCborArray | fromJsonArray (const QJsonArray & array ) |
| QCborArray | fromStringList (const QStringList & list ) |
| QCborArray | fromVariantList (const QVariantList & list ) |
This class can be used to hold one sequential container in CBOR (an array). CBOR is the Concise Binary Object Representation, a very compact form of binary data encoding that is a superset of JSON. It was created by the IETF Constrained RESTful Environments (CoRE) WG, which has used it in many new RFCs. It is meant to be used alongside the CoAP protocol .
QCborArray 非常類似 QVariantList and QJsonArray and its API is almost identical to those two classes. It can also be converted to and from those two, though there may be loss of information in some conversions.
另請參閱 QCborValue , QCborMap , QJsonArray , QList ,和 QVector .
同義詞 QCborArray::ConstIterator .
A typedef to
const QCborValue *
, for compatibility with generic algorithms.
A typedef to
const QCborValue &
, for compatibility with generic algorithms.
A typedef to qsizetype.
同義詞 QCborArray::Iterator .
A typedef to
QCborValue *
, for compatibility with generic algorithms.
A typedef to
QCborValue &
, for compatibility with generic algorithms.
A typedef to qsizetype.
The type of values that can be held in a QCborArray : that is, QCborValue .
Removes the element pointed to by the array iterator it from this array, then returns an iterator to the next element (the one that took the same position in the array that it used to occupy).
另請參閱 insert (), removeAt (), takeAt (), takeFirst (),和 takeLast ().
這是重載函數。
插入 value into this array before element before and returns an array iterator pointing to the just-inserted element.
另請參閱 erase (), removeAt (), prepend (),和 append ().
追加 value into the array after all other elements it may already contain.
另請參閱 at (), operator[] (), first (), last (), insert (), prepend (), removeAt (),和 takeAt ().
前置 value into the array before any other elements it may already contain.
另請參閱 at (), operator[] (), first (), last (), insert (), append (), removeAt (),和 takeAt ().
Extracts a value from the array at the position indicated by iterator it and returns the value so extracted.
另請參閱 insert (), erase (), takeAt (),和 removeAt ().
插入 value into the array at position i in this array. If i is -1, the entry is appended to the array. Pads the array with invalid entries if i is greater than the prior size of the array.
另請參閱 at (), operator[] (), first (), last (), prepend (), append (), removeAt (), takeAt (),和 extract ().
Initializes this QCborArray from the C++ brace-enclosed list found in args , as in the following example:
QCborArray a = { null, 0, 1, 1.5, 2, "Hello", QByteArray("World") };
Copies the contents of other 到此對象。
構造空的 QCborArray。
Replaces the contents of this array with that found in other , then returns a reference to this object.
銷毀此 QCborArray 並釋放任何關聯資源。
返迴 QCborValue element at position i in the array.
若數組 < i elements, this function returns a QCborValue containing an undefined value. For that reason, it is not possible with this function to tell apart the situation where the array is not large enough from the case where the array starts with an undefined value.
另請參閱 operator[] (), first (), last (), insert (), prepend (), append (), removeAt (),和 takeAt ().
Returns an array iterator pointing to the first item in this array. If the array is empty, then this function returns the same as end ().
另請參閱 constBegin () 和 end ().
Returns an array iterator pointing to the first item in this array. If the array is empty, then this function returns the same as end ().
另請參閱 constBegin () 和 constEnd ().
Returns an array iterator pointing to the first item in this array. If the array is empty, then this function returns the same as end ().
另請參閱 constBegin () 和 constEnd ().
Returns an array iterator pointing to just after the last element in this array.
另請參閱 constBegin () 和 constEnd ().
清空此數組。
另請參閱 isEmpty ().
比較此數組和 other , comparing each element in sequence, and returns an integer that indicates whether this array should be sorted before (if the result is negative) or after other (if the result is positive). If this function returns 0, the two arrays are equal and contain the same elements.
For more information on CBOR sorting order, see QCborValue::compare ().
另請參閱 QCborValue::compare (), QCborMap::compare (),和 operator== ().
Returns an array iterator pointing to the first item in this array. If the array is empty, then this function returns the same as end ().
Returns an array iterator pointing to just after the last element in this array.
另請參閱 constBegin () 和 end ().
Returns true if this array contains an element that is equal to value .
同義詞 isEmpty (). This function is provided for compatibility with generic code that uses the Standard Library API.
返迴 true 若此數組為空 ( size () == 0).
Returns an array iterator pointing to just after the last element in this array.
Returns an array iterator pointing to just after the last element in this array.
另請參閱 constBegin () 和 constEnd ().
返迴第一 QCborValue of this array.
若數組為空,此函數返迴 QCborValue containing an undefined value. For that reason, it is not possible with this function to tell apart the situation where the array is not large enough from the case where the array ends with an undefined value.
另請參閱 operator[] (), at (), last (), insert (), prepend (), append (), removeAt (),和 takeAt ().
Returns a reference to the first QCborValue of this array. The array must not be empty.
QCborValueRef has the exact same API as QCborValue , with one important difference: if you assign new values to it, this array will be updated with that new value.
另請參閱 operator[] (), at (), last (), insert (), prepend (), append (), removeAt (),和 takeAt ().
[static]
QCborArray
QCborArray::
fromJsonArray
(const
QJsonArray
&
array
)
Converts all JSON items found in the array array to CBOR using QCborValue::fromJson(), and returns the CBOR array composed of those elements.
This conversion is lossless, as the CBOR type system is a superset of JSON's. Moreover, the array returned by this function can be converted back to the original array by using toJsonArray ().
另請參閱 toJsonArray (), toVariantList (), QCborValue::fromJsonValue (),和 QCborMap::fromJsonObject ().
[static]
QCborArray
QCborArray::
fromStringList
(const
QStringList
&
list
)
返迴 QCborArray containing all the strings found in the list 列錶。
另請參閱 fromVariantList () 和 fromJsonArray ().
[static]
QCborArray
QCborArray::
fromVariantList
(const
QVariantList
&
list
)
Converts all the items in the list to CBOR using QCborValue::fromVariant () and returns the array composed of those elements.
Conversion from QVariant is not completely lossless. Please see the documentation in QCborValue::fromVariant () 瞭解更多信息。
另請參閱 toVariantList (), fromStringList (), fromJsonArray (),和 QCborMap::fromVariantMap ().
返迴 true,若此 QCborArray is empty (that is if size () is 0).
Returns the last QCborValue of this array.
若數組為空,此函數返迴 QCborValue containing an undefined value. For that reason, it is not possible with this function to tell apart the situation where the array is not large enough from the case where the array ends with an undefined value.
另請參閱 operator[] (), at (), first (), insert (), prepend (), append (), removeAt (),和 takeAt ().
Returns a reference to the last QCborValue of this array. The array must not be empty.
QCborValueRef has the exact same API as QCborValue , with one important difference: if you assign new values to it, this array will be updated with that new value.
另請參閱 operator[] (), at (), first (), insert (), prepend (), append (), removeAt (),和 takeAt ().
同義詞 removeLast (). This function is provided for compatibility with generic code that uses the Standard Library API.
Removes the last element of this array. The array must not be empty before the removal
另請參閱 removeLast (), takeLast (), pop_front (), push_back (), append (),和 insert ().
同義詞 removeFirst (). This function is provided for compatibility with generic code that uses the Standard Library API.
Removes the first element of this array. The array must not be empty before the removal
另請參閱 removeFirst (), takeFirst (), pop_back (), push_front (), prepend (),和 insert ().
同義詞 append (). This function is provided for compatibility with generic code that uses the Standard Library API.
追加元素 t 到此數組。
另請參閱 append (), push_front (), pop_back (), prepend (),和 insert ().
同義詞 prepend (). This function is provided for compatibility with generic code that uses the Standard Library API.
Prepends the element t 到此數組。
另請參閱 prepend (), push_back (), pop_front (), append (),和 insert ().
Removes the item at position i from the array. The array must have more than i elements before the removal.
另請參閱 takeAt (), removeFirst (), removeLast (), at (), operator[] (), insert (), prepend (),和 append ().
Removes the first item in the array, making the second element become the first. The array must not be empty before this call.
另請參閱 removeAt (), takeFirst (), removeLast (), at (), operator[] (), insert (), prepend (),和 append ().
Removes the last item in the array. The array must not be empty before this call.
另請參閱 removeAt (), takeLast (), removeFirst (), at (), operator[] (), insert (), prepend (),和 append ().
返迴此數組的大小。
另請參閱 isEmpty ().
交換此對象的內容和 other .
Removes the item at position i from the array and returns it. The array must have more than i elements before the removal.
另請參閱 removeAt (), removeFirst (), removeLast (), at (), operator[] (), insert (), prepend (),和 append ().
Removes the first item in the array and returns it, making the second element become the first. The array must not be empty before this call.
另請參閱 takeAt (), removeFirst (), removeLast (), at (), operator[] (), insert (), prepend (),和 append ().
Removes the last item in the array and returns it. The array must not be empty before this call.
另請參閱 takeAt (), removeLast (), removeFirst (), at (), operator[] (), insert (), prepend (),和 append ().
Explicitly construcuts a QCborValue object that represents this array. This function is usually not necessary since QCborValue has a constructor for QCborArray , so the conversion is implicit.
轉換 QCborArray to QCborValue allows it to be used in any context where QCborValues can be used, including as items in QCborArrays and as keys and mapped types in QCborMap . Converting an array to QCborValue allows access to QCborValue::toCbor ().
另請參閱 QCborValue::QCborValue (const QCborArray &).
Recursively converts every QCborValue element in this array to JSON using QCborValue::toJsonValue () and returns the corresponding QJsonArray composed of those elements.
Please note that CBOR contains a richer and wider type set than JSON, so some information may be lost in this conversion. For more details on what conversions are applied, see QCborValue::toJsonValue ().
另請參閱 fromJsonArray (), QCborValue::toJsonValue (), QCborMap::toJsonObject (),和 toVariantList ().
Recursively converts each QCborValue in this array using QCborValue::toVariant () and returns the QVariantList composed of the converted items.
Conversion to QVariant is not completely lossless. Please see the documentation in QCborValue::toVariant () 瞭解更多信息。
另請參閱 fromVariantList (), fromStringList (), toJsonArray (), QCborValue::toVariant (),和 QCborMap::toVariantMap ().
比較此數組和 other , comparing each element in sequence, and returns true if the two arrays' contents are different, false otherwise.
For more information on CBOR equality in Qt, see, QCborValue::compare ().
另請參閱 compare (), QCborValue::operator== (), QCborMap::operator== (), operator== (),和 operator< ().
返迴新的 QCborArray containing the same elements as this array, plus v appended as the last element.
另請參閱 operator+= (), operator<< (),和 append ().
追加 v to this array and returns a reference to this array.
另請參閱 append (), insert (), operator+ (),和 operator<< ().
比較此數組和 other , comparing each element in sequence, and returns true if this array should be sorted before other , false otherwise.
For more information on CBOR sorting order, see QCborValue::compare ().
另請參閱 compare (), QCborValue::operator== (), QCborMap::operator== (), operator== (),和 operator!= ().
追加 v to this array and returns a reference to this array.
另請參閱 append (), insert (), operator+ (),和 operator+= ().
比較此數組和 other , comparing each element in sequence, and returns true if both arrays contains the same elements, false otherwise.
For more information on CBOR equality in Qt, see, QCborValue::compare ().
另請參閱 compare (), QCborValue::operator== (), QCborMap::operator== (), operator!= (),和 operator< ().
返迴 QCborValue element at position i in the array.
若數組 < i elements, this function returns a QCborValue containing an undefined value. For that reason, it is not possible with this function to tell apart the situation where the array is not large enough from the case where the array contains an undefined value at position i .
另請參閱 at (), first (), last (), insert (), prepend (), append (), removeAt (),和 takeAt ().
Returns a reference to the QCborValue element at position i in the array. Indices beyond the end of the array will grow the array, filling with undefined entries, until it has an entry at the specified index.
QCborValueRef has the exact same API as QCborValue , with one important difference: if you assign new values to it, this array will be updated with that new value.
另請參閱 at (), first (), last (), insert (), prepend (), append (), removeAt (),和 takeAt ().