Obsolete Members for 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

此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。

Returns a binary representation of the document.

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 .