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


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

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


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

示例1: qHash

uint qHash (const QDomNode& node)
{
	if (node.lineNumber () == -1 ||
			node.columnNumber () == -1)
	{
		qWarning () << Q_FUNC_INFO
			<< "node is unhasheable";
		return -1;
	}
	return (node.lineNumber () << 24) + node.columnNumber ();
}
开发者ID:aboduo,项目名称:leechcraft,代码行数:11,代码来源:parser.cpp

示例2: lineNumber

int QDomNodeProto:: lineNumber() const
{
  QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject());
  if (item)
    return item->lineNumber();
  return 0;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: logWarning

QDebug SkinContext::logWarning(const char* file, const int line,
                               const QDomNode& node) const {
    return qWarning() << QString("%1:%2 SKIN ERROR at %3:%4 <%5>:")
                             .arg(file, QString::number(line), m_xmlPath,
                                  QString::number(node.lineNumber()),
                                  node.nodeName())
                             .toUtf8()
                             .constData();
}
开发者ID:GorgiAstro,项目名称:mixxx,代码行数:9,代码来源:skincontext.cpp

示例4: findDomNodeScan

/**
 * @brief XmlEditWidgetPrivate::findDomNodeScan find the nearest match to a position
 * @param node
 * @param nodeTarget
 * @param lineSearched
 * @param columnSearched
 * @param lastKnownNode: last known "good" position
 * @return
 */
bool XmlEditWidgetPrivate::findDomNodeScan(QDomNode node, QDomNode nodeTarget, const int lineSearched, const int columnSearched, FindNodeWithLocationInfo &info)
{
    int row = node.lineNumber();
    int col = node.columnNumber();
    if(!node.isDocument()) {
        if((lineSearched == row) && (columnSearched == col)) {
            info.matchedNode = nodeTarget ;
            return true ;
        }

        if((lineSearched == row) && (columnSearched == col)) {
            info.matchedNode = nodeTarget ;
            return true ;
        }
        if((lineSearched == row) && (columnSearched < col)) {
            info.matchedNode = nodeTarget ;
            return true ;
        }
        if((lineSearched < row)) {
            info.matchedNode = nodeTarget ;
            return true ;
        }
        if((lineSearched <= row)) {
            info.lastKnownNode = nodeTarget ;
        }

        if(node.nodeType() == QDomNode::ElementNode) {
            QDomElement element = node.toElement();
            QDomNamedNodeMap attributes = element.attributes();
            int numAttrs = attributes.length();
            for(int i = 0 ; i < numAttrs ; i++) {
                QDomNode node = attributes.item(i);
                QDomAttr attr = node.toAttr();
                if(findDomNodeScan(attr, nodeTarget, lineSearched, columnSearched, info)) {
                    return true;
                }
            } // for
        }
    }

    int nodes = node.childNodes().count();
    for(int i = 0 ; i < nodes ; i ++) {
        QDomNode childNode = node.childNodes().item(i) ;
        if(childNode.isText() || childNode.isCDATASection()) {
            if(findDomNodeScan(childNode, nodeTarget, lineSearched, columnSearched, info)) {
                return true;
            }
        } else {
            if(findDomNodeScan(childNode, childNode, lineSearched, columnSearched, info)) {
                return true ;
            }
        }
    }
    return false ;
}
开发者ID:ericsium,项目名称:qxmledit,代码行数:64,代码来源:validationresults.cpp

示例5: doc

QList<GLObject*> XML::readXML(const QString &path)
{
    _error     = false;
    _errorText = "";

    QDomDocument doc("vd");
    QFile file(path);

    if (!file.open(QIODevice::ReadOnly))
    {
        _error     = true;
        _errorText = "Can not open XML-File!";
        return QList<GLObject*>();
    }

    QString xmlError;
    int     xmlErrorLine;

    if (!doc.setContent(&file,false,&xmlError,&xmlErrorLine))
    {
        _error     = true;
        _errorText = "XML parser error: " + xmlError + "<br/>"
                     "Line: " + QString::number(xmlErrorLine);

        file.close();
        return QList<GLObject*>();
    }

    QDomElement root = doc.documentElement();

    if( root.tagName() != "vd" )
    {
        _error     = true;
        _errorText = "XML root tag is not valid!";
        return QList<GLObject*>();
    }

    QList<GLObject*> objectList;
    QDomNode node = root.firstChild();

    QProgressDialog progress("Read XML-File...", "Cancel", 0, root.childNodes().size());
    progress.setCancelButton(0);
    progress.show();
    int count = 0;

    while (!node.isNull())
    {
        progress.setValue(count);

        if (QDomNode::ElementNode == node.nodeType())
        {
            QDomElement object = node.toElement();
            QString type = object.attribute("type");

            if (type == "point")
                objectList.append(GLPoint::fromXml(object));
            else if (type == "vector")
                objectList.append(GLVector::fromXml(object));
            else if (type == "plane")
                objectList.append(GLPlane::fromXml(object));
            else if (type == "line")
                objectList.append(GLLine::fromXml(object));
            else if (type == "angle")
                objectList.append(GLAngle::fromXml(object, objectList));
            else if (type == "delete")
                objectList.append(GLDelete::fromXml(object, objectList));
            else
            {
                _error     = true;
                _errorText = "Object type not found!<br/>"
                             "Line: " + QString::number(node.lineNumber()) + ", Type: " + type;
            }

        }

        for(int i = 0; i < objectList.size()-1; i++)
        {
            if(objectList.at(i)->id() == objectList.last()->id())
            {
                _error     = true;
                _errorText = "Another object with this id was found!<br/>"
                             "Line: " + QString::number(node.lineNumber()) + ", ID: " + objectList.last()->id();
                qDeleteAll(objectList);
                return QList<GLObject*>();
            }
        }

        node = node.nextSibling();        
        count++;
    }

    return objectList;
}
开发者ID:starchimpsgroup,项目名称:3dvv,代码行数:93,代码来源:xml.cpp

示例6: buildObjects

/**
 * This method is designed to parse the object config file
 * and to initialize the required objects in the UIObjectHandler
 */
bool ConfigParser::buildObjects(const QString object_cfgv)
    {
    this->getNodeList(object_cfgv,OBJECT_CFG_TAG);
    /*if at least 1 tag was found proceed otherwise return false*/
    if(!this->temp_node_list->count() > 0)
		{
        this->core->configLogError(QString(MISSING_OBJ_TAG));
		return false;
		}
    /*iterate through the dom nodes*/
    for(int i = 0;i <this->temp_node_list->count();i++)
		{
		QDomNode node = this->temp_node_list->item(i);
		QDomNamedNodeMap map = node.attributes();
		/*iterate through the attributes*/
		for(uint i = 1; i <= map.length();i++)
			{
			if(map.item(i-1).isAttr())
				{
				QDomAttr attr = map.item(i-1).toAttr();
				/* handle the different object types */
				if(attr.name() == OBJECT_CFG_TYPE_ATTR)
					{
					if(attr.value() == OBJECT_TYPE_SCREEN)
						{
						ScreenObject* temp_screen = new ScreenObject();
						temp_screen->buildScreenObject(this,map);
						this->screen_list_ref->append(temp_screen);
						this->core->configLogInfo(this->screen_list_ref->last()->getObjLogEntry());
						}
					else if(attr.value() == OBJECT_TYPE_BUTTON_C)
						{
						ButtonCObject *temp_buttonc = new ButtonCObject();
						temp_buttonc->buildButtonCObject(this,map);
						this->buttonc_list_ref->append(temp_buttonc);
						this->core->configLogInfo(this->buttonc_list_ref->last()->getObjLogEntry());
						}
					else
						{
						this->core->configLogWarning(QString(UNHA_OBJ_TYPE_MSG).replace("#_1",attr.value())+"in "+object_cfgv+" on line "+QString::number(node.lineNumber()));
						}
					}
				}
			}
		}
    return true;
    }
开发者ID:ZSchneidi,项目名称:Projekt-42,代码行数:51,代码来源:configparser.cpp


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