QJsonDocument 過時成員

以下成員源於類 QJsonDocument 已過時。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。

公共函數

(obsolete) const char * rawData (int * size ) const
(obsolete) QByteArray toBinaryData () const

靜態公共成員

(obsolete) QJsonDocument fromBinaryData (const QByteArray & data , QJsonDocument::DataValidation validation = Validate)
(obsolete) QJsonDocument fromRawData (const char * data , int size , QJsonDocument::DataValidation validation = Validate)

成員函數文檔編製

[static] QJsonDocument QJsonDocument:: fromBinaryData (const QByteArray & data , QJsonDocument::DataValidation validation = Validate)

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

創建 QJsonDocument from data .

validation decides whether the data is checked for validity before being used. By default the data is validated. If the data is not valid, the method returns a null document.

注意: Deprecated in Qt 5.15. The binary JSON encoding is only retained for backwards compatibility. It is undocumented and restrictive in the maximum size of JSON documents that can be encoded. Qt JSON types can be converted to Qt CBOR types, which can in turn be serialized into the CBOR binary format and vice versa. The CBOR format is a well-defined and less restrictive binary representation for a superset of JSON.

另請參閱 toBinaryData (), fromRawData (), isNull (), DataValidation ,和 QCborValue .

[static] QJsonDocument QJsonDocument:: fromRawData (const char * data , int size , QJsonDocument::DataValidation validation = Validate)

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

創建 QJsonDocument that uses the first size 字節來自 data . It assumes data contains a binary encoded JSON document. The created document does not take ownership of data . The data is copied into a different data structure, and the original data can be deleted or modified afterwards.

data 必須對齊 4 字節邊界。

validation decides whether the data is checked for validity before being used. By default the data is validated. If the data is not valid, the method returns a null document.

返迴 QJsonDocument 錶示數據。

注意: Deprecated in Qt 5.15. The binary JSON encoding is only retained for backwards compatibility. It is undocumented and restrictive in the maximum size of JSON documents that can be encoded. Qt JSON types can be converted to Qt CBOR types, which can in turn be serialized into the CBOR binary format and vice versa. The CBOR format is a well-defined and less restrictive binary representation for a superset of JSON.

注意: Before Qt 5.15, the caller had to guarantee that data would not be deleted or modified as long as any QJsonDocument , QJsonObject or QJsonArray still referenced the data. From Qt 5.15 on, this is not necessary anymore.

另請參閱 rawData (), fromBinaryData (), isNull (), DataValidation ,和 QCborValue .

const char *QJsonDocument:: rawData ( int * size ) const

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

Returns the raw binary representation of the data size 將包含返迴數據的大小。

This method is useful to e.g. stream the JSON document in its binary form to a file.

注意: Deprecated in Qt 5.15. The binary JSON encoding is only retained for backwards compatibility. It is undocumented and restrictive in the maximum size of JSON documents that can be encoded. Qt JSON types can be converted to Qt CBOR types, which can in turn be serialized into the CBOR binary format and vice versa. The CBOR format is a well-defined and less restrictive binary representation for a superset of JSON.

另請參閱 QCborValue .

QByteArray QJsonDocument:: toBinaryData () const

此函數已過時。提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。

返迴文檔的二進製錶示。

The binary representation is also the native format used internally in Qt, and is very efficient and fast to convert to and from.

The binary format can be stored on disk and interchanged with other applications or computers. fromBinaryData () can be used to convert it back into a JSON document.

注意: Deprecated in Qt 5.15. The binary JSON encoding is only retained for backwards compatibility. It is undocumented and restrictive in the maximum size of JSON documents that can be encoded. Qt JSON types can be converted to Qt CBOR types, which can in turn be serialized into the CBOR binary format and vice versa. The CBOR format is a well-defined and less restrictive binary representation for a superset of JSON.

另請參閱 fromBinaryData () 和 QCborValue .