当前位置: 首页>>代码示例>>C++>>正文


C++ qjsonobject::const_iterator类代码示例

本文整理汇总了C++中qjsonobject::const_iterator的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator类的具体用法?C++ const_iterator怎么用?C++ const_iterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了const_iterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: syncRoles

    void syncRoles()
    {
        QJsonObject firstObject(_data.first().toObject()); // TODO it expects certain data structure in all objects, add way to specify roles

        if (!_roles.count()) {
            _roles.reserve(firstObject.count());
            _roles[SyncedRole] = EnginioString::_synced; // TODO Use a proper name, can we make it an attached property in qml? Does it make sense to try?
            _roles[CreatedAtRole] = EnginioString::createdAt;
            _roles[UpdatedAtRole] = EnginioString::updatedAt;
            _roles[IdRole] = EnginioString::id;
            _roles[ObjectTypeRole] = EnginioString::objectType;
            _rolesCounter = LastRole;
        }

        // estimate additional dynamic roles:
        QSet<QString> definedRoles = _roles.values().toSet();
        for (QJsonObject::const_iterator i = firstObject.constBegin(); i != firstObject.constEnd(); ++i) {
            const QString key = i.key();
            if (definedRoles.contains(key)) {
                // we skip predefined keys so we can keep constant id for them
                if (Q_UNLIKELY(key == EnginioString::_synced))
                    qWarning("EnginioModel can not be used with objects having \"_synced\" property. The property will be overriden.");
            } else
                _roles[_rolesCounter++] = i.key();
        }
    }
开发者ID:416365416c,项目名称:enginio-qt,代码行数:26,代码来源:enginiomodel.cpp

示例2: fromJsonValue

v8::Local<v8::Object> QV8JsonWrapper::fromJsonObject(const QJsonObject &object)
{
    v8::Local<v8::Object> v8object = v8::Object::New();
    for (QJsonObject::const_iterator it = object.begin(); it != object.end(); ++it)
        v8object->Set(QJSConverter::toString(it.key()), fromJsonValue(it.value()));
    return v8object;
}
开发者ID:SamuelNevala,项目名称:qtdeclarative,代码行数:7,代码来源:qv8jsonwrapper.cpp

示例3: json

QMap<QString, QMap<QString, QString>> Info::getServiceServerAddressMeta()
{
   QString filename = getAddressMetaFilename();
   QByteArray json("[]");
   if(Filesystem::fileExist(filename)){
      json = Filesystem::fileGetContents(filename);
   }
   QJsonParseError parserError;
   QJsonDocument doc = QJsonDocument::fromJson(json, &parserError);
   QMap<QString, QMap<QString, QString>> ret;
   if(parserError.error == QJsonParseError::NoError){
      QJsonArray array = doc.array();
      QJsonArray::const_iterator ait = array.constBegin();
      QJsonArray::const_iterator aendmarker = array.constEnd();
      while(ait != aendmarker){
         QJsonValue v = *ait;
         if(v.isObject()){
            QJsonObject item = v.toObject();
            QJsonObject::const_iterator oit = item.constBegin();
            QJsonObject::const_iterator oendmarker = item.constEnd();
            QMap<QString, QString> dataItem;
            while(oit != oendmarker){
               dataItem.insert(oit.key(), oit.value().toString());
               oit++;
            }
            ret.insert(dataItem.value("key"), dataItem);
         }
         ait++;
      }
   }
   return ret;
}
开发者ID:asdf20122012,项目名称:upgrademgr_master,代码行数:32,代码来源:server_info.cpp

示例4: while

static PyObject *convertFrom_QJsonObject(void *sipCppV, PyObject *sipTransferObj)
{
    QJsonObject *sipCpp = reinterpret_cast<QJsonObject *>(sipCppV);

#line 28 "C:\\Users\\marcus\\Downloads\\PyQt-gpl-5.4\\PyQt-gpl-5.4\\sip/QtCore/qjsonobject.sip"
    PyObject *d = PyDict_New();

    if (!d)
        return 0;

    QJsonObject::const_iterator it = sipCpp->constBegin();
    QJsonObject::const_iterator end = sipCpp->constEnd();

    while (it != end)
    {
        QString *k = new QString(it.key());
        PyObject *kobj = sipConvertFromNewType(k, sipType_QString,
                                               sipTransferObj);

        if (!kobj)
        {
            delete k;
            Py_DECREF(d);

            return 0;
        }

        QJsonValue *v = new QJsonValue(it.value());
        PyObject *vobj = sipConvertFromNewType(v, sipType_QJsonValue,
                                               sipTransferObj);

        if (!vobj)
        {
            delete v;
            Py_DECREF(kobj);
            Py_DECREF(d);

            return 0;
        }

        int rc = PyDict_SetItem(d, kobj, vobj);

        Py_DECREF(vobj);
        Py_DECREF(kobj);

        if (rc < 0)
        {
            Py_DECREF(d);

            return 0;
        }

        ++it;
    }

    return d;
#line 182 "C:\\Users\\marcus\\Downloads\\PyQt-gpl-5.4\\PyQt-gpl-5.4\\QtCore/sipQtCoreQJsonObject.cpp"
}
开发者ID:rff255,项目名称:python-qt5,代码行数:58,代码来源:sipQtCoreQJsonObject.cpp

示例5: testFaces

void GetFaceResourceTest::testFaces(const QString& fileName) {
    QString base = testResources + QDir::separator() + fileName;
    QFile file(base + ".jpg");
    QJsonDocument current;
    int status = faceResource->getJSONFaces(&file, current);
    file.close();
    QCOMPARE(HttpHeaders::STATUS_SUCCESS, status);

    QFile jsonFile(base + ".json");

    QVERIFY(jsonFile.exists());

    jsonFile.open(QIODevice::ReadOnly | QIODevice::Text);
    QJsonDocument expected = QJsonDocument().fromJson(jsonFile.readAll());
    jsonFile.close();

    QJsonArray currentArray = current.array();
    QJsonArray expectedArray = expected.array();

    // Make sure we're not comparing zero to zero
    QVERIFY(expectedArray.size() > 0);
    QCOMPARE(currentArray.size(), expectedArray.size());

    for (int i=0; i<currentArray.size(); ++i) {
        QJsonObject cFaceParts = currentArray[i].toObject();
        QJsonObject eFaceParts = expectedArray[i].toObject();

        QJsonObject cFace = eFaceParts["face"].toObject();
        QJsonObject eFace = eFaceParts["face"].toObject();
        compareDoubles(cFace["x1"].toDouble(), eFace["x1"].toDouble(), 0.0001);
        compareDoubles(cFace["x2"].toDouble(), eFace["x2"].toDouble(), 0.0001);
        compareDoubles(cFace["y1"].toDouble(), eFace["y1"].toDouble(), 0.0001);
        compareDoubles(cFace["y2"].toDouble(), eFace["y2"].toDouble(), 0.0001);

        QCOMPARE(cFaceParts["pose"], eFaceParts["pose"]);
        QCOMPARE(cFaceParts["model"], eFaceParts["model"]);

        QJsonObject cParts = cFaceParts["parts"].toObject();
        QJsonObject eParts = eFaceParts["parts"].toObject();

        QCOMPARE(cParts.size(), eParts.size());

        for (QJsonObject::const_iterator cIter = cParts.constBegin(); cIter != cParts.constEnd(); ++cIter) {
            QJsonArray cSubpart = cIter.value().toArray();
            QJsonArray eSubpart = cParts[cIter.key()].toArray();

            QCOMPARE(cSubpart.size(), eSubpart.size());

            for (int i=0; i<cSubpart.size(); ++i) {
                QJsonObject cPart = cSubpart[i].toObject();
                QJsonObject ePart = eSubpart[i].toObject();
                compareDoubles(cPart["x"].toDouble(), ePart["x"].toDouble(), 0.0001);
                compareDoubles(cPart["y"].toDouble(), ePart["y"].toDouble(), 0.0001);
                QCOMPARE(cPart["num"], ePart["num"]);
            }
        }
    }
}
开发者ID:davidgev,项目名称:face-parts-service,代码行数:58,代码来源:tst_getfaceresource.cpp

示例6: buildObject

void QJsonView::buildObject(const QString& name, const QJsonObject &obj, QTreeWidgetItem *parent)
{
   QTreeWidgetItem *item = createItem(name + (!name.isEmpty()? " " : "") + "{...}", parent, TYPE_ITEM_OBJECT);
   QJsonObject::const_iterator iterator = obj.begin();
   while( iterator != obj.end() ) {
       addItem(iterator.key(), iterator.value(), item);
       ++iterator;
   }
}
开发者ID:ScotterC,项目名称:qrestclient,代码行数:9,代码来源:qjsonview.cpp

示例7: fields

QStringList DBSchema::fields(QString tableName) const
{
    QJsonArray table = jsondoc.object().value(tableName).toArray();
    QStringList li;
    for (int i = 0; i < table.size(); ++i){
        QJsonObject field = table.at(i).toObject();
        QJsonObject::const_iterator it = field.constBegin();
        li.append( it.key() );
    }
    return li;
}
开发者ID:theme,项目名称:MangaLib,代码行数:11,代码来源:dbschema.cpp

示例8: cmopileJsonObject

void XSAppBuilder::cmopileJsonObject(const QJsonObject &obj)
{
    QJsonObject::const_iterator it = obj.constBegin();
    while(it != obj.constEnd())
    {
        if(root.contains(it.key()))
        {
            //暂时不需要json
        }
        it++;
    }
}
开发者ID:mixtile,项目名称:xskit,代码行数:12,代码来源:xsappbuilder.cpp

示例9: fromJsonObject

QV4::ReturnedValue JsonObject::fromJsonObject(ExecutionEngine *engine, const QJsonObject &object)
{
    Scope scope(engine);
    Scoped<Object> o(scope, engine->newObject());
    ScopedString s(scope);
    ScopedValue v(scope);
    for (QJsonObject::const_iterator it = object.begin(); it != object.end(); ++it) {
        v = fromJsonValue(engine, it.value());
        o->put((s = engine->newString(it.key())).getPointer(), v);
    }
    return o.asReturnedValue();
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:12,代码来源:qv4jsonobject.cpp

示例10: type

QString DBSchema::type(QString tableName, QString fieldName) const
{
    QJsonArray table = jsondoc.object().value(tableName).toArray();
    for (int i = 0; i < table.size(); ++i){
        QJsonObject field = table.at(i).toObject();
        QJsonObject::const_iterator it = field.constBegin();
        if (it.key() == fieldName ){
            return it.value().toString();
        }
    }
    return QString();
}
开发者ID:theme,项目名称:MangaLib,代码行数:12,代码来源:dbschema.cpp

示例11: syncRoles

void EnginioBaseModelPrivate::syncRoles()
{
    QJsonObject firstObject(_data.first().toObject());

    if (!_roles.count()) {
        _roles.reserve(firstObject.count());
        _roles[QtCloudServices::SyncedRole] = QtCloudServicesConstants::_synced; // TODO Use a proper name, can we make it an attached property in qml? Does it make sense to try?
        _roles[QtCloudServices::CreatedAtRole] = QtCloudServicesConstants::createdAt;
        _roles[QtCloudServices::UpdatedAtRole] = QtCloudServicesConstants::updatedAt;
        _roles[QtCloudServices::IdRole] = QtCloudServicesConstants::id;
        _roles[QtCloudServices::ObjectTypeRole] = QtCloudServicesConstants::objectType;
        _rolesCounter = QtCloudServices::CustomPropertyRole;
    }

    // check if someone does not use custom roles
    QHash<int, QByteArray> predefinedRoles = q->roleNames();
    foreach (int i, predefinedRoles.keys()) {
        if (i < QtCloudServices::CustomPropertyRole && i >= QtCloudServices::SyncedRole && predefinedRoles[i] != _roles[i].toUtf8()) {
            qWarning("Can not use custom role index lower then QtCloudServices::CustomPropertyRole, but '%i' was used for '%s'", i, predefinedRoles[i].constData());
            continue;
        }

        _roles[i] = QString::fromUtf8(predefinedRoles[i].constData());
    }

    // estimate additional dynamic roles:
    QSet<QString> definedRoles = _roles.values().toSet();
    QSet<int> definedRolesIndexes = predefinedRoles.keys().toSet();

    for (QJsonObject::const_iterator i = firstObject.constBegin(); i != firstObject.constEnd(); ++i) {
        const QString key = i.key();

        if (definedRoles.contains(key)) {
            // we skip predefined keys so we can keep constant id for them
            if (Q_UNLIKELY(key == QtCloudServicesConstants::_synced)) {
                qWarning("EnginioModel can not be used with objects having \"_synced\" property. The property will be overriden.");
            }
        } else {
            while (definedRolesIndexes.contains(_rolesCounter)) {
                ++_rolesCounter;
            }

            _roles[_rolesCounter++] = i.key();
        }
    }
}
开发者ID:jotahtin,项目名称:qtc-sdk-qt,代码行数:46,代码来源:qenginiomodel.cpp

示例12: isModified

bool QEnginioObjectShared::isModified() const
{
    QJsonObject::const_iterator i;

    for (i = iJsonObject.begin(); i != iJsonObject.end(); ++i) {
        if (i.key() == QtCloudServicesConstants::id ||
                i.key() == QtCloudServicesConstants::objectType) {
            continue;
        }

        if (!iPersistentJsonObject.contains(i.key())) {
            return true; // field added
        }

        if (iPersistentJsonObject.value(i.key()) != i.value()) {
            return true; // field changed
        }
    }

    for (i = iPersistentJsonObject.begin(); i != iPersistentJsonObject.end(); ++i) {
        if (!iPersistentJsonObject.contains(i.key())) {
            return true; // field removed
        }
    }

    return false;
}
开发者ID:jotahtin,项目名称:qtc-sdk-qt,代码行数:27,代码来源:qenginioobjectshared.cpp

示例13: createPropertyObject

void XSAppBuilder::createPropertyObject(const QString &proName, const QString &proData, xsObject *proObject)
{
    if(proObject == NULL)
    {
        return;
    }

    if(root.contains(proName))
    {
        QStringList list = proData.split(";", QString::SkipEmptyParts);
        QJsonObject obj = root.value(proName).toObject();
        QJsonObject::const_iterator it = obj.constBegin();

        while(it != obj.constEnd())
        {
            if(it.key() == "prototype" || it.key() == "@prototype")
            {
                it++;
                continue;
            }
            for(int i = 0; i < list.size(); i++)
            {
                if(list.at(i).contains(it.key()))
                {
                    if(it.key() == "@inherit")
                    {
                        createPropertyObject(it.value().toString(), proData, proObject);
                    }
                    else
                    {
                        QJsonObject subObj = it.value().toObject();
                        QStringList dataList = list.at(i).split(":",QString::SkipEmptyParts);
                        if(dataList.size() == 2)
                        {
                            xsValue property;
                            transformValue(subObj, &property, dataList.at(1), it.key());
                            proObject->setProperty(it.key().toStdString().c_str(), &property);
                        }
                    }
                }
            }

            it++;
        }
    }

    return;
}
开发者ID:mixtile,项目名称:xskit,代码行数:48,代码来源:xsappbuilder.cpp

示例14: dealLogIn

void NetWork::dealLogIn(QNetworkReply *reply)
{
	QJsonObject obj = getObject(*reply);
	if (obj.isEmpty())
		return;
	int code = obj.find("code").value().toInt();
	if (code != 200)
	{
		emit logInStatus(code, "");
		return;
	}
	QJsonObject::const_iterator it = obj.find("profile");
	if (it != obj.constEnd())
	{
		QJsonObject profileObj = it.value().toObject();
		m_userId = profileObj.find("userId").value().toInt();
		m_nickName = profileObj.find("nickname").value().toString();
		//	头像....
		logInStatus(code, m_nickName);
	}
}
开发者ID:Unymicle,项目名称:NetEase,代码行数:21,代码来源:network.cpp

示例15: updateGameStatsFromJsonResponse

void dialogGameStats::updateGameStatsFromJsonResponse(const QJsonObject &jsonObject) {

    if (!jsonObject["top"].isNull()) {



            for(QJsonObject::const_iterator iter = jsonObject.begin(); iter != jsonObject.end(); ++iter) {
                if (iter.key() == "top")
                {

                   // while (this->ui->tableWidgetGameStats->rowCount() > 0)
                   // {
                   //     this->ui->tableWidgetGameStats->removeRow(0);
                   // }

                    this->ui->treeWidgetGameStats->clear();

                    //this->ui->tableWidgetGameStats->setColumnCount(2);
                   // this->ui->tableWidgetGameStats->horizontalHeaderItem(0)->setText("Viewers");
                   // this->ui->tableWidgetGameStats->horizontalHeaderItem(1)->setText("Game");


                    for (int i = 0; i <= iter.value().toArray().size(); i++)
                    {
                   // qDebug() << iter.value().toArray().at(i).toObject()["game"].toObject()["name"].toString();
                   // qDebug() <<  iter.value().toArray().at(i).toObject()["viewers"].toDouble();


                    if (iter.value().toArray().at(i).toObject()["game"].toObject()["name"].toString() != "") {
                        QTreeWidgetItem * item = new QTreeWidgetItem();
                        item->setText(0,QString::number(i+1));
                        item->setText(1,QString::number(iter.value().toArray().at(i).toObject()["viewers"].toDouble()));
                        item->setText(2,iter.value().toArray().at(i).toObject()["game"].toObject()["name"].toString());
                        item->setTextColor(1,  QColor(85,85,255));


                        this->ui->treeWidgetGameStats->addTopLevelItem(item);

                    }





                    }







                }
            }



        }

}
开发者ID:Galbi3000,项目名称:twitcher,代码行数:60,代码来源:dialoggamestats.cpp


注:本文中的qjsonobject::const_iterator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。