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


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

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


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

示例3: 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

示例4: 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

示例5: loadClasses


//.........这里部分代码省略.........
            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

示例6: 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

示例7: 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


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