本文整理汇总了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();
}
示例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()));
}
示例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));
}
示例4: loadIncludes
void ConfigLoader::loadIncludes(QDomDocument const &config, QFileInfo const ¤tFile)
{
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()
);
}
}
}
示例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;
}
示例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() ) );
}
}
示例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;
}