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


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

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


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

示例1: isDeepEqual

bool TestBaseLine::isDeepEqual(const QDomNode &n1, const QDomNode &n2)
{
    if(n1.nodeType() != n2.nodeType())
        return false;

    switch(n1.nodeType())
    {
        case QDomNode::CommentNode:
        /* Fallthrough. */
        case QDomNode::TextNode:
        {
            return static_cast<const QDomCharacterData &>(n1).data() ==
                   static_cast<const QDomCharacterData &>(n2).data();
        }
        case QDomNode::ProcessingInstructionNode:
        {
            return n1.nodeName() == n2.nodeName() &&
                   n1.nodeValue() == n2.nodeValue();
        }
        case QDomNode::DocumentNode:
            return isChildrenDeepEqual(n1.childNodes(), n2.childNodes());
        case QDomNode::ElementNode:
        {
            return n1.localName() == n2.localName()                     &&
                   n1.namespaceURI() == n2.namespaceURI()               &&
                   n1.nodeName() == n2.nodeName()                       && /* Yes, this one is needed in addition to localName(). */
                   isAttributesEqual(n1.attributes(), n2.attributes())  &&
                   isChildrenDeepEqual(n1.childNodes(), n2.childNodes());
        }
        /* Fallthrough all these. */
        case QDomNode::EntityReferenceNode:
        case QDomNode::CDATASectionNode:
        case QDomNode::EntityNode:
        case QDomNode::DocumentTypeNode:
        case QDomNode::DocumentFragmentNode:
        case QDomNode::NotationNode:
        case QDomNode::BaseNode:
        case QDomNode::CharacterDataNode:
        {
            Q_ASSERT_X(false, Q_FUNC_INFO,
                       "An unsupported node type was encountered.");
            return false;
        }
        case QDomNode::AttributeNode:
        {
            Q_ASSERT_X(false, Q_FUNC_INFO,
                       "This should never happen. QDom doesn't allow us to compare DOM attributes "
                       "properly.");
            return false;
        }
        default:
        {
            Q_ASSERT_X(false, Q_FUNC_INFO, "Unhandled QDom::NodeType value.");
            return false;
        }
    }
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:57,代码来源:TestBaseLine.cpp

示例2: QString

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

示例3: addEvent

void CWMPEventParser::addEvent(const QDomNode &event) {
    QDomNode node = event.firstChild();
    QString eventCode, cmdKey;

    while(!node.isNull()) {
        if(QString("EventCode") == node.localName()) {
            eventCode = node.firstChild().toText().data();
        } else if(QString("CommandKey") == node.localName()) {
            cmdKey = node.firstChild().toText().data();
        }

        node = node.nextSibling();
    }

    _event.events().append(
            CWMPEvent::Event(eventCode, cmdKey));
}
开发者ID:Prezu,项目名称:CWMP,代码行数:17,代码来源:cwmpEventParser.cpp

示例4: isAttributesEqual

bool TestBaseLine::isAttributesEqual(const QDomNamedNodeMap &cl1, const QDomNamedNodeMap &cl2)
{
    const unsigned int len = cl1.length();
    pDebug() << "LEN:" << len;

    if(len == cl2.length())
    {
        for(unsigned int i1 = 0; i1 < len; ++i1)
        {
            const QDomNode attr1(cl1.item(i1));
            Q_ASSERT(!attr1.isNull());

            /* This is set if attr1 cannot be found at all in cl2. */
            bool earlyExit = false;

            for(unsigned int i2 = 0; i2 < len; ++i2)
            {
                const QDomNode attr2(cl2.item(i2));
                Q_ASSERT(!attr2.isNull());
                pDebug() << "ATTR1:" << attr1.localName() << attr1.namespaceURI() << attr1.prefix() << attr1.nodeName();
                pDebug() << "ATTR2:" << attr2.localName() << attr2.namespaceURI() << attr2.prefix() << attr2.nodeName();

                if(attr1.localName() == attr2.localName()       &&
                   attr1.namespaceURI() == attr2.namespaceURI() &&
                   attr1.prefix() == attr2.prefix()             &&
                   attr1.nodeName() == attr2.nodeName()         && /* Yes, needed in addition to all the other. */
                   attr1.nodeValue() == attr2.nodeValue())
                {
                    earlyExit = true;
                    break;
                }
            }

            if(!earlyExit)
            {
                /* An attribute was found that doesn't exist in the other list so exit. */
                return false;
            }
        }

        return true;
    }
    else
        return false;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:45,代码来源:TestBaseLine.cpp

示例5: while

CWMPEventParser::CWMPEventParser(const QDomNode &eventNode) {
    QDomNode node = eventNode.firstChild();
    while(!node.isNull()) {
        QByteArray dbgA = node.localName().toLatin1();
        qDebug("%s, %d: Node's name is %s", __FUNCTION__, __LINE__, dbgA.constData());
        addEvent(node);

        node = node.nextSibling();
    }
}
开发者ID:Prezu,项目名称:CWMP,代码行数:10,代码来源:cwmpEventParser.cpp

示例6: while

CWMPDeviceIDParser::CWMPDeviceIDParser(const QDomNode &deviceIDNode) {
    QDomNode node = deviceIDNode.firstChild();
    QByteArray dbgA;

    while(!node.isNull()) {
        QByteArray dbgA = node.localName().toLatin1();
        dbgA = node.firstChild().toText().data().toLatin1();
        if(QString("Manufacturer") == node.localName()) {
            _deviceID.setManufacturer(node.firstChild().toText().data());
        } else if(QString("OUI") == node.localName()) {
            _deviceID.setOui(node.firstChild().toText().data());
        } else if(QString("ProductClass") == node.localName()) {
            _deviceID.setProductClass(node.firstChild().toText().data());
        } else if(QString("SerialNumber") == node.localName()) {
            _deviceID.setSerialNumber(node.firstChild().toText().data());
        }

        node = node.nextSibling();
    }
}
开发者ID:Prezu,项目名称:CWMP,代码行数:20,代码来源:cwmpDeviceIDParser.cpp

示例7: processStanza

void XmppReg::processStanza(const Stanza& s)
{
	QDomNode node;
	switch (state)
	{
	case Start:
		if (s.type() != "result")
		{
			//emit error();
			return;
		}
		node = s.node().firstChild().firstChild();
		while (!node.isNull())
		{
			printf("[XMPPREG] node = %s\n", node.localName().toLatin1().constData());
			if (node.localName() == "username")
				needUsername = true;
			if (node.localName() == "password")
				needPassword = true;
			if (node.localName() == "email")
				needEmail = true;
			node = node.nextSibling();
		}
		sendRegistration();
		state = WaitResult;
		break;
	case WaitResult:
		if (s.type() == "result")
		{
			//registerOk = true;
			emit finished();
		}
		if (s.type() == "error")
		{
			;
			//registerOk = false;
			//emit error();
		}
		break;
	}
}
开发者ID:BackupTheBerlios,项目名称:kapture-svn,代码行数:41,代码来源:xmppreg.cpp

示例8: processEvent

void Xmpp::processEvent(Event *event)
{
	/*
	 * WARNING: An event is NOT still the same as before.
	 * Now, an event contains all data from depth = 1 
	 * to depth back to 1.
	 */
	//printf("Elem = %s\n", event->node().localName().toLatin1().constData());
	switch (state)
	{
		case isHandShaking:
			break;
		case PrepareRegistering:
		case waitStream:
			if (event->type() == Event::Stream)
			{
				printf("[XMPP] Ok, received the stream tag.\n");
				if (state != PrepareRegistering)
					state = waitFeatures;
				else
				{
					state = active;
					emit registerReady();
				}
			}
			//else
			//	printf(" ! Didn't receive the stream ! \n");
			break;
		case waitFeatures:
			if (event->node().localName() == "features")
			{
				printf("[XMPP] Ok, received the features tag.\n");
				if (!tlsDone && useTls)
				{
					QDomNode node = event->node().firstChild();
					printf("[XMPP] Next Status : ");
					//state = waitStartTls;
					printf("[XMPP]     %s\n", node.localName().toLatin1().constData());
					if (node.localName() == QString("mechanisms"))
					{
						printf("[XMPP] Must directly switch to SASL authentication\n");
						useTls = false;
						node = node.firstChild();
						// Must directly switch to SASL authentication
						printf("[XMPP]     %s\n", node.localName().toLatin1().constData());
						while(node.localName() == QString("mechanism"))
						{
							printf("[XMPP] Ok, received a mechanism tag.\n");
							if (node.firstChild().toText().data() == QString("PLAIN"))
							{
								plainMech = true;
								printf("[XMPP] Ok, PLAIN mechanism supported\n");

								// Sstartauth method.
								QDomDocument doc("");
								QDomElement e = doc.createElement("auth");
								doc.appendChild(e);
								e.setAttribute(QString("xmlns"), QString("urn:ietf:params:xml:ns:xmpp-sasl"));
								e.setAttribute(QString("mechanism"), QString("PLAIN"));
								QString text = QString("%1%2%3%4").arg('\0').arg(username).arg('\0').arg(password);
								QDomText t = doc.createTextNode(text.toLatin1().toBase64());
								e.appendChild(t);
								QByteArray sData = doc.toString().toLatin1();
								sendData(sData);
								state = waitSuccess;
								
							}
							node = node.nextSibling();
						}
					
					}
					if (node.localName() == QString("starttls"))
					{
						printf("[XMPP] Ok, received the starttls tag.\n");
						// Send starttls tag
						QDomDocument doc("");
						QDomElement e = doc.createElement("starttls");
						doc.appendChild(e);
						e.setAttribute(QString("xmlns"), QString("urn:ietf:params:xml:ns:xmpp-tls"));
						QByteArray sData = doc.toString().toLatin1();
						sendData(sData);
						// Next state
						state = waitProceed;
						// Even if TLS isn't required, I use TLS.
					}
				}
				else
				{
					if (!saslDone)
					{
						//TODO:Must first check that event->node().firstChild() == mechanisms
						QDomNode node = event->node().firstChild().firstChild();
						printf("[XMPP] Tls done or not used. --> sasl\n");
						while(node.localName() == QString("mechanism"))
						{
							printf("[XMPP] Ok, received a mechanism tag.\n");
							if (node.firstChild().toText().data() == QString("PLAIN"))
							{
								plainMech = true;
								printf("[XMPP] Ok, PLAIN mechanism supported\n");
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:kapture-svn,代码行数:101,代码来源:xmpp.cpp


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