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


C++ QDomElement::lineNumber方法代码示例

本文整理汇总了C++中QDomElement::lineNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomElement::lineNumber方法的具体用法?C++ QDomElement::lineNumber怎么用?C++ QDomElement::lineNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDomElement的用法示例。


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

示例1: f

Font::Font(QString image_path, QString xml_path)
{
    QFile f(xml_path);
    QString errorStr("");
    int errorLine(0);
    int errorColumn(0);
    QDomDocument doc;
    QDomElement root;
    
    if (!f.open(QFile::ReadOnly | QFile::Text)) {
        qCritical("ERROR: Failed to open config file \"%s\": %s",
                  xml_path.toUtf8().constData(),
                  f.errorString().toUtf8().constData()
                  );
        return;
    }
    
    if (!doc.setContent(&f, false, &errorStr, &errorLine, &errorColumn)) {
        qCritical("ERROR: Failed to parse config file \"%s\" at line %d, column %d:\n%s",
                  xml_path.toUtf8().constData(),
                  errorLine,
                  errorColumn,
                  errorStr.toUtf8().constData()
                  );
        return;
    }
    
    root = doc.documentElement();
    if (root.tagName() != "Font") {
        qCritical("ERROR: Unexpected root element \"%s\" at line %d, column %d",
                  root.tagName().toUtf8().constData(),
                  root.lineNumber(),
                  root.columnNumber());
        return;
    }
    
    this->size = root.attribute("size").toInt();
    this->family = root.attribute("family");
    this->height = root.attribute("height").toInt();
    this->style = root.attribute("style");
    
//    qDebug("Font: %d, %s, %d, %s", this->size, this->family.toUtf8().constData(), this->height, this->style.toUtf8().constData());
    
    _minChar = 127;
    _maxChar = 0;
    QDomElement childElement = root.firstChildElement();
    while (!childElement.isNull()) {
        QString tagName = childElement.tagName();
        if (tagName == "Char") {
            Char *c = new Char(childElement);
            this->_chars[c->code] = c;
            if (c->code > _maxChar)
                _maxChar = c->code;
            if (c->code < _minChar)
                _minChar = c->code;
        }
        childElement = childElement.nextSiblingElement();
    }
    
    QImageReader image_reader(image_path);
    this->_image = image_reader.read();
}
开发者ID:jnwatts,项目名称:FontImageToHeaders,代码行数:62,代码来源:font.cpp

示例2: stream

/**
 * @brief VExceptionWrongId exception wrong parameter id
 * @param what string with error
 * @param domElement som element
 */
VExceptionWrongId::VExceptionWrongId(const QString &what, const QDomElement &domElement)
    :VException(what), tagText(QString()), tagName(QString()), lineNumber(-1)
{
    Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
    QTextStream stream(&tagText);
    domElement.save(stream, 4);
    tagName = domElement.tagName();
    lineNumber = domElement.lineNumber();
}
开发者ID:a-dilla,项目名称:Valentina,代码行数:14,代码来源:vexceptionwrongid.cpp

示例3: VERBOSE_XML

void VERBOSE_XML(
    unsigned int verbose_type,
    const QString &filename, const QDomElement &element, QString msg)
{
    VERBOSE(verbose_type,
            QString("%1\n\t\t\t"
                    "Location: %2 @ %3\n\t\t\t"
                    "Name: '%4'\tType: '%5'")
            .arg(msg).arg(filename).arg(element.lineNumber())
            .arg(element.attribute("name", "")).arg(element.tagName()));
}
开发者ID:DocOnDev,项目名称:mythtv,代码行数:11,代码来源:xmlparsebase.cpp

示例4: parseID

QString TBase::parseID(QDomElement element)
{
    QString ret = "";
    if (element.hasAttribute("id"))
        ret = element.attribute("id");
    if (element.hasAttribute("xml:id")) // In SMIL 3.0 superset old SMIL 2.0 id.
        ret = element.attribute("xml:id");
    if (ret == "") // get line and column number as alternative when no
    {

        ret = element.tagName()+"_"+QString::number(element.lineNumber()) + "_" + QString::number(element.columnNumber());
    }
    return ret;
}
开发者ID:sagiadinos,项目名称:garlic-player,代码行数:14,代码来源:base.cpp

示例5: domError

void domError(QDomElement e)
      {
      QString s = domElementPath(e);
      if (!docName.isEmpty())
            fprintf(stderr, "<%s>:", qPrintable(docName));
      int ln = e.lineNumber();
      if (ln != -1)
            fprintf(stderr, "line:%d ", ln);
      int col = e.columnNumber();
      if (col != -1)
            fprintf(stderr, "col:%d ", col);
      fprintf(stderr, "%s: Unknown Node <%s>, type %d\n",
         qPrintable(s), qPrintable(e.tagName()), e.nodeType());
      if (e.isText())
            fprintf(stderr, "  text node <%s>\n", qPrintable(e.toText().data()));
      }
开发者ID:gthomas,项目名称:MuseScore,代码行数:16,代码来源:xml.cpp

示例6: domError

void domError(const QDomElement& e)
      {
      QString m;
      QString s = domElementPath(e);
      if (!docName.isEmpty())
            m = QString("<%1>:").arg(docName);
      int ln = e.lineNumber();
      if (ln != -1)
            m += QString("line:%1 ").arg(ln);
      int col = e.columnNumber();
      if (col != -1)
            m += QString("col:%1 ").arg(col);
      m += QString("%1: Unknown Node <%2>, type %3").arg(s).arg(e.tagName()).arg(e.nodeType());
      if (e.isText())
            m += QString("  text node <%1>").arg(e.toText().data());
      qDebug("%s", qPrintable(m));
      }
开发者ID:amitjamadagni,项目名称:MuseScore,代码行数:17,代码来源:musicxmlsupport.cpp

示例7: loadIncludes

void ConfigLoader::loadIncludes(QDomDocument const &config, QFileInfo const &currentFile)
{
    QDomNodeList includes = config.elementsByTagName("include");
    for (unsigned i = 0; i < includes.length(); i++) {
        QDomElement includeElement = includes.at(i).toElement();
        QString includeName = includeElement.attribute("name");
        QFileInfo included = QFileInfo(currentFile.dir(), includeName);
        if (included.exists()) {
            load(included.canonicalFilePath());
        } else {
            fprintf(stderr, "Error 13 (%s:%d,%d) : Include '%s' is unknown.\n",
                    currentFile.fileName().toLatin1().constData(),
                    includeElement.lineNumber(),
                    includeElement.columnNumber(),
                    includeName.toLatin1().constData()
            );
        }

    }
}
开发者ID:Pechckin,项目名称:test,代码行数:20,代码来源:configLoader.cpp

示例8: variableNodeToText

QString SkinContext::variableNodeToText(const QDomElement& variableNode) const {
    if (variableNode.hasAttribute("expression")) {
        QScriptValue result = m_pScriptEngine->evaluate(
            variableNode.attribute("expression"), m_xmlPath,
            variableNode.lineNumber());
        return result.toString();
    } else if (variableNode.hasAttribute("name")) {
        QString variableName = variableNode.attribute("name");
        if (variableNode.hasAttribute("format")) {
            QString formatString = variableNode.attribute("format");
            return formatString.arg(variable(variableName));
        } else if (variableNode.nodeName() == "SetVariable") {
            // If we are setting the variable name and we didn't get a format
            // string then return the node text. Use nodeToString to translate
            // embedded variable references.
            return nodeToString(variableNode);
        } else {
            return variable(variableName);
        }
    }
    return nodeToString(variableNode);
}
开发者ID:GorgiAstro,项目名称:mixxx,代码行数:22,代码来源:skincontext.cpp

示例9: updateMonsterXml

void updateMonsterXml(const QString &file)
{
    QDomDocument domDocument;
    //open and quick check the file
    QFile xmlFile(file);
    QByteArray xmlContent;
    if(!xmlFile.open(QIODevice::ReadOnly))
    {
        qDebug() << (QStringLiteral("Unable to open the xml monster file: %1, error: %2").arg(file).arg(xmlFile.errorString()));
        return;
    }
    xmlContent=xmlFile.readAll();
    xmlFile.close();
    QString errorStr;
    int errorLine,errorColumn;
    if (!domDocument.setContent(xmlContent, false, &errorStr,&errorLine,&errorColumn))
    {
        qDebug() << (QStringLiteral("Unable to open the xml file: %1, Parse error at line %2, column %3: %4").arg(file).arg(errorLine).arg(errorColumn).arg(errorStr));
        return;
    }
    QDomElement root = domDocument.documentElement();
    if(root.tagName()!="monsters")
    {
        qDebug() << (QStringLiteral("Unable to open the xml file: %1, \"list\" root balise not found for the xml file").arg(file));
        return;
    }

    //load the content
    bool ok;
    QDomElement item = root.firstChildElement(text_monster);
    while(!item.isNull())
    {
        if(item.isElement())
        {
            bool attributeIsOk=true;
            if(!item.hasAttribute(text_id))
            {
                qDebug() << (QStringLiteral("Unable to open the xml file: %1, have not the monster attribute \"id\": child.tagName(): %2 (at line: %3)").arg(file).arg(item.tagName()).arg(item.lineNumber()));
                attributeIsOk=false;
            }
            if(attributeIsOk)
            {
                QSet<quint32> byitemAlreadySet;
                QSet<quint32> skillAlreadySet;
                quint32 id=item.attribute(text_id).toUInt(&ok);
                if(!ok)
                    qDebug() << (QStringLiteral("Unable to open the xml file: %1, id not a number: child.tagName(): %2 (at line: %3)").arg(file).arg(item.tagName()).arg(item.lineNumber()));
                else
                {
                    #ifdef DEBUG_MESSAGE_MONSTER_LOAD
                    qDebug() << (QStringLiteral("monster loading: %1").arg(id));
                    #endif
                    if(ok)
                    {
                        {
                            QDomElement attack_list = item.firstChildElement(text_attack_list);
                            if(!attack_list.isNull())
                            {
                                if(attack_list.isElement())
                                {
                                    //QSet<quint32> learnByItem;
                                    QDomElement attack = attack_list.firstChildElement(text_attack);
                                    while(!attack.isNull())
                                    {
                                        if(attack.isElement())
                                        {
                                            if(attack.hasAttribute(text_skill) || attack.hasAttribute(text_id))
                                            {
                                                if(attack.hasAttribute(text_byitem))
                                                {
                                                    attack.parentNode().removeChild(attack);
                                                    /*quint32 itemId;
                                                    if(ok)
                                                    {
                                                        itemId=attack.attribute(text_byitem).toUShort(&ok);
                                                        if(!ok)
                                                            qDebug() << (QStringLiteral("Unable to open the xml file: %1, item to learn is not a number %4: child.tagName(): %2 (at line: %3)").arg(file).arg(attack.tagName()).arg(attack.lineNumber()).arg(attack.attribute(text_byitem)));
                                                    }
                                                    if(ok)
                                                    {
                                                        if(learnByItem.contains(itemId))
                                                        {
                                                            qDebug() << (QStringLiteral("Unable to open the xml file: %1, item to learn is already used %4: child.tagName(): %2 (at line: %3)").arg(file).arg(attack.tagName()).arg(attack.lineNumber()).arg(itemId));
                                                            ok=false;
                                                        }
                                                    }
                                                    if(ok)
                                                        learnByItem << itemId;*/
                                                }
                                            }
                                            else
                                                qDebug() << (QStringLiteral("Unable to open the xml file: %1, missing arguements (level or skill): child.tagName(): %2 (at line: %3)").arg(file).arg(attack.tagName()).arg(attack.lineNumber()));
                                        }
                                        else
                                            qDebug() << (QStringLiteral("Unable to open the xml file: %1, attack_list balise is not an element: child.tagName(): %2 (at line: %3)").arg(file).arg(attack.tagName()).arg(attack.lineNumber()));
                                        attack = attack.nextSiblingElement(text_attack);
                                    }
                                    //add the missing skill
                                    if(monsterIdToName.contains(id))
                                        if(monsterToLink.contains(monsterIdToName.value(id)))
//.........这里部分代码省略.........
开发者ID:chiefexb,项目名称:CatchChallenger,代码行数:101,代码来源:main.cpp

示例10: parseMonstersExtra

void parseMonstersExtra()
{
    QString STATIC_DATAPACK_BASE_PATH_MONSTERS=QLatin1Literal(DATAPACK_BASE_PATH_MONSTERS);
    const QString &file=datapackPath+STATIC_DATAPACK_BASE_PATH_MONSTERS+QStringLiteral("monster.xml");
    QDomDocument domDocument;
    //open and quick check the file
    QFile xmlFile(file);
    QByteArray xmlContent;
    if(!xmlFile.open(QIODevice::ReadOnly))
    {
        qDebug() << (QStringLiteral("Unable to open the xml monster extra file: %1, error: %2").arg(file).arg(xmlFile.errorString()));
        return;
    }
    xmlContent=xmlFile.readAll();
    xmlFile.close();
    QString errorStr;
    int errorLine,errorColumn;
    if (!domDocument.setContent(xmlContent, false, &errorStr,&errorLine,&errorColumn))
    {
        qDebug() << (QStringLiteral("Unable to open the xml file: %1, Parse error at line %2, column %3: %4").arg(file).arg(errorLine).arg(errorColumn).arg(errorStr));
        return;
    }
    QDomElement root = domDocument.documentElement();
    if(root.tagName()!="monsters")
    {
        qDebug() << (QStringLiteral("Unable to open the xml file: %1, \"list\" root balise not found for the xml file").arg(file));
        return;
    }

    const QString &language="en";
    //load the content
    bool ok;
    QDomElement item = root.firstChildElement(text_monster);
    while(!item.isNull())
    {
        if(item.isElement())
        {
            if(item.hasAttribute(text_id))
            {
                quint32 id=item.attribute(text_id).toUInt(&ok);
                if(!ok)
                    qDebug() << (QStringLiteral("Unable to open the xml file: %1, id not a number: child.tagName(): %2 (at line: %3)").arg(file).arg(item.tagName()).arg(item.lineNumber()));
                else
                {
                    QString nameText;
                    #ifdef DEBUG_MESSAGE_MONSTER_LOAD
                    qDebug() << (QStringLiteral("monster extra loading: %1").arg(id));
                    #endif
                    {
                        bool found=false;
                        QDomElement name = item.firstChildElement(text_name);
                        if(!language.isEmpty() && language!=text_en)
                            while(!name.isNull())
                            {
                                if(name.isElement())
                                {
                                    if(name.hasAttribute(text_lang) && name.attribute(text_lang)==language)
                                    {
                                        nameText=name.text();
                                        found=true;
                                        break;
                                    }
                                }
                                else
                                    qDebug() << (QStringLiteral("Unable to open the xml file: %1, name balise is not an element: child.tagName(): %2 (at line: %3)").arg(file).arg(item.tagName()).arg(item.lineNumber()));
                                name = name.nextSiblingElement(text_name);
                            }
                        if(!found)
                        {
                            name = item.firstChildElement(text_name);
                            while(!name.isNull())
                            {
                                if(name.isElement())
                                {
                                    if(!name.hasAttribute(text_lang) || name.attribute(text_lang)==text_en)
                                    {
                                        nameText=name.text();
                                        break;
                                    }
                                }
                                else
                                    qDebug() << (QStringLiteral("Unable to open the xml file: %1, name balise is not an element: child.tagName(): %2 (at line: %3)").arg(file).arg(item.tagName()).arg(item.lineNumber()));
                                name = name.nextSiblingElement(text_name);
                            }
                        }
                    }
                    if(!nameText.isEmpty())
                    {
                        monsterNameToId[nameText]=id;
                        monsterIdToName[id]=nameText;
                    }
                }
            }
            else
                qDebug() << (QStringLiteral("Unable to open the xml file: %1, have not the monster id at monster extra: child.tagName(): %2 (at line: %3)").arg(file).arg(item.tagName()).arg(item.lineNumber()));
        }
        else
            qDebug() << (QStringLiteral("Unable to open the xml file: %1, is not an element: child.tagName(): %2 (at line: %3)").arg(file).arg(item.tagName()).arg(item.lineNumber()));
        item = item.nextSiblingElement(text_monster);
    }
//.........这里部分代码省略.........
开发者ID:chiefexb,项目名称:CatchChallenger,代码行数:101,代码来源:main.cpp

示例11: parseItemsExtra

void parseItemsExtra()
{
    //open and quick check the file
    QFile itemsFile(datapackPath+"items/items.xml");
    QByteArray xmlContent;
    if(!itemsFile.open(QIODevice::ReadOnly))
    {
        qDebug() << QStringLiteral("Unable to open the file: %1, error: %2").arg(itemsFile.fileName()).arg(itemsFile.errorString());
        return;
    }
    xmlContent=itemsFile.readAll();
    itemsFile.close();
    QDomDocument domDocument;
    QString errorStr;
    int errorLine,errorColumn;
    if (!domDocument.setContent(xmlContent, false, &errorStr,&errorLine,&errorColumn))
    {
        qDebug() << QStringLiteral("Unable to open the file: %1, Parse error at line %2, column %3: %4").arg(itemsFile.fileName()).arg(errorLine).arg(errorColumn).arg(errorStr);
        return;
    }
    QDomElement root = domDocument.documentElement();
    if(root.tagName()!="items")
    {
        qDebug() << QStringLiteral("Unable to open the file: %1, \"items\" root balise not found for the xml file").arg(itemsFile.fileName());
        return;
    }

    //load the content
    bool ok;
    QDomElement item = root.firstChildElement("item");
    while(!item.isNull())
    {
        if(item.isElement())
        {
            if(item.hasAttribute("id"))
            {
                item.attribute("id").toULongLong(&ok);
                if(ok)
                {
                    //load the name
                    {
                        QDomElement name = item.firstChildElement("name");
                        while(!name.isNull())
                        {
                            if(name.isElement())
                            {
                                if(!name.hasAttribute("lang") || name.attribute("lang")=="en")
                                {
                                    QString tempName=name.text();
                                    tempName.remove(QRegularExpression("[\r\n\t]+"));
                                    if(tempName.contains("TM") || tempName.contains("HM"))
                                        if(tempName.contains(QRegularExpression("^.*((TM|HM)[0-9]{2}) (.*)$",QRegularExpression::MultilineOption|QRegularExpression::DotMatchesEverythingOption)))
                                        {
                                            tempName.replace(QRegularExpression("^.*((TM|HM)[0-9]{2}) (.*)$",QRegularExpression::MultilineOption|QRegularExpression::DotMatchesEverythingOption),"\\3");
                                            //tempName=tempName.toLower();
                                            itemNameToId[tempName]=item.attribute("id").toUInt();
                                        }
                                    break;
                                }
                            }
                            name = name.nextSiblingElement("name");
                        }
                    }
                }
                else
                    qDebug() << QStringLiteral("Unable to open the file: %1, id is not a number: child.tagName(): %2 (at line: %3)").arg(itemsFile.fileName()).arg(item.tagName()).arg(item.lineNumber());
            }
            else
                qDebug() << QStringLiteral("Unable to open the file: %1, have not the item id: child.tagName(): %2 (at line: %3)").arg(itemsFile.fileName()).arg(item.tagName()).arg(item.lineNumber());
        }
        else
            qDebug() << QStringLiteral("Unable to open the file: %1, is not an element: child.tagName(): %2 (at line: %3)").arg(itemsFile.fileName()).arg(item.tagName()).arg(item.lineNumber());
        item = item.nextSiblingElement("item");
    }

    qDebug() << QStringLiteral("%1 item(s) extra loaded").arg(itemNameToId.size());
}
开发者ID:chiefexb,项目名称:CatchChallenger,代码行数:77,代码来源:main.cpp

示例12: on_itemListDelete_clicked

void MainWindow::on_itemListDelete_clicked()
{
    QList<QListWidgetItem *> selectedItems=ui->itemList->selectedItems();
    if(selectedItems.size()!=1)
    {
        QMessageBox::warning(this,tr("Error"),tr("Select a bot into the bot list"));
        return;
    }
    quint32 id=selectedItems.first()->data(99).toUInt();
    if(!items.contains(id))
    {
        QMessageBox::warning(this,tr("Error"),tr("Unable remove the bot, because the returned id is not into the list"));
        return;
    }
    bool ok;
    //load the bots
    QDomElement child = domDocument.documentElement().firstChildElement("item");
    while(!child.isNull())
    {
        if(!child.hasAttribute("id"))
            qDebug() << QStringLiteral("Has not attribute \"id\": child.tagName(): %1 (at line: %2)").arg(child.tagName()).arg(child.lineNumber());
        else if(!child.isElement())
            qDebug() << QStringLiteral("Is not an element: child.tagName(): %1, name: %2 (at line: %3)").arg(child.tagName().arg(child.attribute("name")).arg(child.lineNumber()));
        else
        {
            quint8 tempId=child.attribute("id").toUShort(&ok);
            if(ok)
            {
                if(tempId==id)
                {
                    child.parentNode().removeChild(child);
                    break;
                }
            }
            else
                qDebug() << QStringLiteral("Attribute \"id\" is not a number: bot.tagName(): %1 (at line: %2)").arg(child.tagName()).arg(child.lineNumber());
        }
        child = child.nextSiblingElement("item");
    }
    items.remove(id);
    updateItemList();
}
开发者ID:chiefexb,项目名称:CatchChallenger,代码行数:42,代码来源:MainWindow.cpp

示例13: run

//Function executed at each frame
bool FakeTrackingModule::run() {

    QDomElement e;
    Blob b;
    Object o;
    int X1,Y1,X2,Y2,id;
    double X,Y,x,y,Vx,Vy;
    ObjectType type;
    std::map<int,Object>::iterator it, end_it;

    //VideoAnalysis::appendToLog("Tracking: Se puede!! :D");
    if(!currentNode.isNull()) {
        do {
            e = currentNode.toElement();
            if( !e.isNull() ) {
                if( e.tagName() == "Image" ) {
                    currentFrame = e.attribute( "IDimage", "" ).toInt();
                } else {
                    QMessageBox::warning(0, "Error reading ground-truth.", "The ground-truth file '" + m_fileName + "', at line" + e.lineNumber() + ", contains an element different than Image, inside VideoAnalysis. Execution will be aborted.");
                    return false;
                }
            } else {
                    QMessageBox::warning(0, "Error reading ground-truth.", "Error in the ground-truth file '" + m_fileName + "' at line" + e.lineNumber() + ". Execution will be aborted.");
                    return false;
            }
            if(currentFrame < m_data->frameNumber)
                currentNode = currentNode.nextSibling();
            //std::cout << "frameNumber: " << m_data->frameNumber << std::endl;
            //std::cout << "currentFrame: " << currentFrame << std::endl;
        } while(currentFrame < m_data->frameNumber && !currentNode.isNull());

        //If frame is found, extract blobs:
        if(!currentNode.isNull() && currentFrame == m_data->frameNumber) {
            QDomNode n = currentNode.firstChild();
            end_it = m_data->fake_objects.end();
            while(!n.isNull()) {
                e = n.toElement();
                if( !e.isNull() ) {
                    if( e.tagName() == "Object" ) {
                        //These coordinates are X horizontal, Y vertical...
                        X1 = e.attribute( "beginX", "" ).toInt() - 4;
                        Y1 = e.attribute( "beginY", "" ).toInt() - 2;
                        X2 = e.attribute( "endX", "" ).toInt() - 4;
                        Y2 = e.attribute( "endY", "" ).toInt() - 2;
                        id = e.attribute( "IDobject", "" ).toInt();
                        type = Object::extractType( e.attribute( "Nameobject", ""));
                        //Vertical
                        if(Y1 < Y2) {
                            BLOB_YTOP(&b) = Y1;
                            BLOB_YBOTTOM(&b) = Y2;
                            BLOB_HEIGHT(&b) = Y2 - Y1 + 1;
                        } else {
                            BLOB_YTOP(&b) = Y2;
                            BLOB_YBOTTOM(&b) = Y1;
                            BLOB_HEIGHT(&b) = Y1 - Y2 + 1;
                        }
                        //Horizontal
                        if(X1 < X2) {
                            BLOB_XLEFT(&b) = X1;
                            BLOB_XRIGHT(&b) = X2;
                            BLOB_WIDTH(&b) = X2 - X1 + 1;
                        } else {
                            BLOB_XLEFT(&b) = X2;
                            BLOB_XRIGHT(&b) = X1;
                            BLOB_WIDTH(&b) = X1 - X2 + 1;
                        }

                        SceneModel::getXY(m_pos,X,Y,b);
                        SceneModel::imgToWorldCoordsGivenHeight(m_data->sceneModel->p_matrix, X, Y, 0.0, &x, &y);
                        if( (it = m_data->fake_objects.find(id)) != end_it) { //Existing object
                            (*it).second.info2D = b;
                            Vx = x - ((*it).second.trajectory.back()).x;
                            Vy = y - ((*it).second.trajectory.back()).y;
                            Info3D i;
                            i.x = x; i.y = y; i.Vx = Vx; i.Vy = Vy;
                            (*it).second.trajectory.push_back(i);
                        } else { //new object
                            o.info2D = b;
                            o.label = id;
                            o.type = type;
                            Info3D i;
                            i.x = x; i.y = y; i.Vx = 0.0; i.Vy = 0.0;
                            o.trajectory.push_back(i);
                            m_data->fake_objects[id] = o;
                        }
                    } else {
                        QMessageBox::warning(0, "Error reading ground-truth.", "The ground-truth file '" + m_fileName + "', at line" + e.lineNumber() + ", contains an element different than Object, inside Image. Execution will be aborted.");
                        return false;
                    }
                } else {
                    QMessageBox::warning(0, "Error reading ground-truth.", "Error in the ground-truth file '" + m_fileName + "' at line" + e.lineNumber() + ". Execution will be aborted.");
                    return false;
                }
                n = n.nextSibling();
            }
            currentNode = currentNode.nextSibling();
        }
    }

//.........这里部分代码省略.........
开发者ID:cacunas,项目名称:VAT,代码行数:101,代码来源:FakeTrackingModule.cpp

示例14: loadClasses


//.........这里部分代码省略.........
            /* TODO: Use "Type *" syntax instead */
            else if (type == "pointer")
            {
                QString targetType = fieldElement.attribute("target");
                field = new PointerFieldGen(fieldNameing, toCString(targetType));

            }
            else // composite field or enum
            {
                Reflection *reflection = mReflections.value(type);
                EnumReflection *enumRef = mEnums.value(type);

                if (reflection) // is it a field with the type of some other class?
                {
                    QDomAttr typeAttribute = fieldElement.attributeNode("size");
                    int size = typeAttribute.value().toInt();

                    if (size <= 0) {
                        field = new CompositeFieldGen(fieldNameing, toCString(type), reflection);
                    } else {
                        field = new CompositeArrayFieldGen(fieldNameing, toCString(type), size, reflection);
                    }
                }
                else if (enumRef) // then it should be a enum
                {
                    EnumWidgetType widgetType = fieldElement.attribute("widget") == "TabWidget" ?
                                                tabWidget :
                                                comboBox;

                    field = new EnumFieldGen(defaultValue.toInt(), widgetType, fieldNameing, enumRef);
                } else {
                    fprintf(stderr, "Error 12 (%s:%d,%d) : Type '%s' is unknown. Is neither enum, nor known type.\n",
                            result->name.name,
                            fieldElement.lineNumber(),
                            fieldElement.columnNumber(),
                            type.toLatin1().constData()
                    );
                }
            }

            if (field)
            {
                bool isAdavnced = fieldElement.hasAttribute("adv") | fieldElement.hasAttribute("advanced");
                field->isAdvanced = isAdavnced;
                result->fields.push_back(field);
            }
        }

        QDomNodeList embeds = classElement.elementsByTagName("embed");
        for (unsigned j = 0; j < embeds.length(); j++)
        {
            // qDebug() << "processing tag embed N" << j << " of (" << embeds.length() << ")";
            QDomElement embeddedElement = embeds.at(j).toElement();
            QString type = embeddedElement.attribute("type");

            ReflectionNaming embedNameing = getNamingFromXML(embeddedElement);

            Reflection *reflection = mReflections.value(type);
            if (!reflection) {
                fprintf(stderr, "Error 12 (%s:%d,%d) : Type '%s' is unknown.\n",
                        result->name.name,
                        embeddedElement.lineNumber(),
                        embeddedElement.columnNumber(),
                        type.toLatin1().constData()
                );
                continue;
开发者ID:Pechckin,项目名称:test,代码行数:67,代码来源:configLoader.cpp

示例15: parseInclude

void Parser::parseInclude( ParserContext *context, const QDomElement &element )
{
  QString location = element.attribute( QLatin1String("schemaLocation") );

  if( !location.isEmpty() ) {
    // don't include a schema twice
    if ( d->mIncludedSchemas.contains( location ) )
      return;
    else
      d->mIncludedSchemas.append( location );

    includeSchema( context, location );
  }
  else {
    context->messageHandler()->warning( QString::fromLatin1("include tag found at (%1, %2) contains no schemaLocation tag.").arg( element.lineNumber(), element.columnNumber() ) );
  }
}
开发者ID:mbahar94,项目名称:KDSoap,代码行数:17,代码来源:parser.cpp


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