QJsonObject

发布时间 2023-07-13 20:03:24作者: 西北逍遥

QJsonObject 

#include <QJsonObject>

 

Public Types

class const_iterator
class iterator
typedef ConstIterator
typedef Iterator
typedef key_type
typedef mapped_type
typedef size_type

Public Functions

  QJsonObject()
  QJsonObject(std::initializer_list<QPair<QString, QJsonValue> > args)
  QJsonObject(const QJsonObject &other)
  QJsonObject(QJsonObject &&other)
  ~QJsonObject()
QJsonObject::iterator begin()
QJsonObject::const_iterator begin() const
QJsonObject::const_iterator constBegin() const
QJsonObject::const_iterator constEnd() const
QJsonObject::const_iterator constFind(const QString &key) const
QJsonObject::const_iterator constFind(QLatin1String key) const
bool contains(const QString &key) const
bool contains(QLatin1String key) const
int count() const
bool empty() const
QJsonObject::iterator end()
QJsonObject::const_iterator end() const
QJsonObject::iterator erase(QJsonObject::iterator it)
QJsonObject::iterator find(const QString &key)
QJsonObject::iterator find(QLatin1String key)
QJsonObject::const_iterator find(const QString &key) const
QJsonObject::const_iterator find(QLatin1String key) const
QJsonObject::iterator insert(const QString &key, const QJsonValue &value)
bool isEmpty() const
QStringList keys() const
int length() const
void remove(const QString &key)
int size() const
void swap(QJsonObject &other)
QJsonValue take(const QString &key)
QVariantHash toVariantHash() const
QVariantMap toVariantMap() const
QJsonValue value(const QString &key) const
QJsonValue value(QLatin1String key) const
bool operator!=(const QJsonObject &other) const
QJsonObject & operator=(const QJsonObject &other)
QJsonObject & operator=(QJsonObject &&other)
bool operator==(const QJsonObject &other) const
QJsonValue operator[](const QString &key) const
QJsonValue operator[](QLatin1String key) const
QJsonValueRef operator[](const QString &key)
QJsonValueRef operator[](QLatin1String key)

Static Public Members

QJsonObject fromVariantHash(const QVariantHash &hash)
QJsonObject fromVariantMap(const QVariantMap &map)

 

 

 

 

 

详细说明

QJsonObject类封装了一个JSON对象。

 

JSON对象是键值对的列表,其中键是唯一的字符串,值由QJsonValue表示。

 

QJsonObject可以转换为QVariantMap,也可以从QVariantMap。您可以使用size()、insert()和remove()条目查询(key,value)对的数量,并使用标准C++迭代器模式对其内容进行迭代。

 

QJsonObject是一个隐式共享类,只要不修改数据,它就与创建数据的文档共享数据。

 

您可以通过QJsonDocument将对象转换为基于文本的JSON或从基于文本的JSON转换对象。

 

 

 

##########################