• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ XMLTag类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: applyTag

/**
 * Gets the pass and layer from the tag.
 */
void ColorBlock::applyTag(const XMLTag &tag) {
  const XMLTag *subtag;

  // add the shader
  subtag = tag.getSubTag(SHADER_TAG);
  if (subtag && subtag->hasAttribute(ATT_NAME))
    _shader = _hostDisplay->getShader(subtag->getAttribute(ATT_NAME));

  // add the mesh
  subtag = tag.getSubTag(MESH_TAG);
  if (subtag && subtag->hasAttribute(ATT_NAME))
    _mesh = _hostDisplay->getMesh(subtag->getAttribute(ATT_NAME));

  // add a texture
  subtag = tag.getSubTag(TEXTURE_TAG);
  if (subtag && subtag->hasAttribute(ATT_NAME))
    _textures.push_back(_hostDisplay->getTexture(subtag->getAttribute(ATT_NAME)));

  // add textures
  subtag = tag.getSubTag(TEXTURES_TAG);
  if (subtag) {
    XMLTag::const_iterator itr;
    for (itr = subtag->begin(); itr != subtag->end(); ++itr) {
      if (**itr == TEXTURE_TAG && (*itr)->hasAttribute(ATT_NAME))
        _textures.push_back(_hostDisplay->getTexture((*itr)->getAttribute(ATT_NAME)));
    }
  }
}
开发者ID:robmcrosby,项目名称:FelixEngineIOS,代码行数:31,代码来源:ColorBlock.cpp


示例2: GetEmbeddedTagByNameAndAttr

XMLTag* XMLTag::GetEmbeddedTagByNameAndAttr(const char* tagName, const char* attrName, const char* attrValue, const UInt32 index)
{
    if (fEmbeddedTags.GetLength() <= index)
        return NULL;
    
    XMLTag* result = NULL;
    UInt32 curIndex = 0;
    for (OSQueueIter iter(&fEmbeddedTags); !iter.IsDone(); iter.Next())
    {
        XMLTag* temp = (XMLTag*)iter.GetCurrent()->GetEnclosingObject();
        if (!strcmp(temp->GetTagName(), tagName) && (temp->GetAttributeValue(attrName) != NULL) && 
            (!strcmp(temp->GetAttributeValue(attrName), attrValue)))
        {
            if (curIndex == index)
            {
                result = temp;
                break;
            }
                
            curIndex++;
        }
    }
    
    return result;
}
开发者ID:435420057,项目名称:EasyDarwin,代码行数:25,代码来源:XMLParser.cpp


示例3: XMLTag

XMLTag* TwoInOneAlg::Save()
{
  XMLTag* tag = new XMLTag(XML_NODE_TWOINONEALG);
  tag->AddChild(m_firstAlg->Save());
  tag->AddChild(m_secondAlg->Save());
  return tag;
}
开发者ID:code-iai,项目名称:ias_perception_aux,代码行数:7,代码来源:TwoInOneAlg.cpp


示例4: GetPrefValueByRef

char* XMLPrefsParser::GetPrefValueByRef(ContainerRef pref, const UInt32 inValueIndex,
                                            char** outPrefName, char** outDataType)
{
    if (outPrefName != NULL)
        *outPrefName = pref->GetAttributeValue(kNameAttr);
    if (outDataType != NULL)
    {
        *outDataType = pref->GetAttributeValue(kTypeAttr);
        if (*outDataType == NULL)
            *outDataType = "CharArray";
    }
    
    if (!strcmp(pref->GetTagName(), kPref))
    {
        if (inValueIndex > 0)
            return NULL;
        else
            return pref->GetValue();
    }
    
    if (!strcmp(pref->GetTagName(), kListPref))
    {
        XMLTag* value = pref->GetEmbeddedTag(inValueIndex);
        if (value != NULL)
            return value->GetValue();
    }
    
    if (!strcmp(pref->GetTagName(), kObject) || !strcmp(pref->GetTagName(), kObjectList))
        *outDataType = "QTSS_Object";
        
    return NULL;
}
开发者ID:12307,项目名称:EasyDarwin,代码行数:32,代码来源:XMLPrefsParser.cpp


示例5: XMLTag

void XMLPrefsParser::AddNewObject( ContainerRef pref )
{
    if (!strcmp(pref->GetTagName(), kEmptyObject))
    {
        // just flag that this is now a real object instead of a placeholder
        pref->SetTagName(kObject);
        return;
    }
    
    if (!strcmp(pref->GetTagName(), kObject))
    {
        // change the object to be an object list and go to code below
        XMLTag* subObject = NEW XMLTag(kObject);
        XMLTag* objectPref;
        // copy all this objects tags into the new listed object
        while((objectPref = pref->GetEmbeddedTag()) != NULL)
        {
            pref->RemoveEmbeddedTag(objectPref);
            subObject->AddEmbeddedTag(objectPref);
        }

        pref->SetTagName(kObjectList);
        pref->AddEmbeddedTag(subObject);
    }
    
    // we want to fall through from second case above, so this isn't an else
    if (!strcmp(pref->GetTagName(), kObjectList))
    {
        XMLTag* subObject = NEW XMLTag(kObject);
        pref->AddEmbeddedTag(subObject);
    }
}
开发者ID:12307,项目名称:EasyDarwin,代码行数:32,代码来源:XMLPrefsParser.cpp


示例6: AllocateOutputArray

void RCFSourceInfo::ParseRelayDestinations(XMLTag* relayTag)
{
	// parse the NAME attribute of the relay tag and store it in the relayname attribute
	char* name = relayTag->GetAttributeValue("NAME");
	if (name != NULL)
	{
		fName = new char[::strlen(name) + 1];
		::strcpy(fName, name);
	}

	UInt32 numTags = relayTag->GetNumEmbeddedTags();
	AllocateOutputArray(numTags);   // not all these are relay tags, but most are

	// Now actually go through and figure out what to put into these OutputInfo structures,
	// based on what's on the relay_destination line
	fNumOutputs = 0;
	for (UInt32 y = 0; y < numTags; y++)
	{
		XMLTag* destTag = relayTag->GetEmbeddedTagByNameAndAttr("OBJECT", "CLASS", "destination", y);
		if (destTag == NULL)
			return;

		char* destType = destTag->GetAttributeValue("TYPE");
		if (destType == NULL)
			return;

		if (!strcmp(destType, "udp_destination"))
			ParseDestination(destTag, y);
		else if (!strcmp(destType, "announced_destination"))
			ParseAnnouncedDestination(destTag, y);

		fNumOutputs++;
	}
}
开发者ID:dreamsxin,项目名称:EasyDarwin,代码行数:34,代码来源:RCFSourceInfo.cpp


示例7: Save

XMLTag* CameraDriverRelay::Save()
{
  XMLTag* tag = CameraDriver::Save();
  tag->SetName(GetName());
  tag->AddProperty(XML_ATTRIBUTE_TOPICNAME, m_stTopic);
  tag->AddProperty(XML_ATTRIBUTE_RATE, m_rate);
  return tag;
}
开发者ID:code-iai,项目名称:ias_perception_aux,代码行数:8,代码来源:CameraDriver.cpp


示例8: atoi

void RCFSourceInfo::ParseDestination(XMLTag* destTag, UInt32 index)
{
	XMLTag* prefTag;

	prefTag = destTag->GetEmbeddedTagByNameAndAttr("PREF", "NAME", "out_addr");
	if (prefTag != NULL)
	{
		char* outAddrStr = prefTag->GetValue();
		if (outAddrStr != NULL)
			fOutputArray[index].fLocalAddr = SocketUtils::ConvertStringToAddr(outAddrStr);
	}
	prefTag = destTag->GetEmbeddedTagByNameAndAttr("PREF", "NAME", "dest_addr");
	if (prefTag != NULL)
	{
		char* destAddrStr = prefTag->GetValue();
		if (destAddrStr != NULL)
			fOutputArray[index].fDestAddr = SocketUtils::ConvertStringToAddr(destAddrStr);
	}
	prefTag = destTag->GetEmbeddedTagByNameAndAttr("PREF", "NAME", "ttl");
	if (prefTag != NULL)
	{
		char* ttlStr = prefTag->GetValue();
		if (ttlStr != NULL)
			fOutputArray[index].fTimeToLive = atoi(ttlStr);
	}
	prefTag = destTag->GetEmbeddedTagByNameAndAttr("LIST-PREF", "NAME", "udp_ports");
	if (prefTag != NULL)
	{
		fOutputArray[index].fNumPorts = prefTag->GetNumEmbeddedTags();

		fOutputArray[index].fPortArray = new UInt16[fOutputArray[index].fNumPorts];
		::memset(fOutputArray[index].fPortArray, 0, fOutputArray[index].fNumPorts * sizeof(UInt16));

		for (UInt32 x = 0; x < fOutputArray[index].fNumPorts; x++)
		{
			XMLTag* portTag = prefTag->GetEmbeddedTagByName("VALUE", x);
			if (portTag != NULL)
			{
				char* portStr = portTag->GetValue();
				if (portStr != NULL)
				{
					fOutputArray[index].fPortArray[x] = atoi(portStr);
				}
			}
		}
	}
	else
	{
		prefTag = destTag->GetEmbeddedTagByNameAndAttr("PREF", "NAME", "udp_base_port");
		if (prefTag == NULL)
			qtss_printf("Missing both 'udp_base_port' and 'udp_ports' tags.\n Cannot set up the destination!\n");
		else
		{
			char* basePortStr = prefTag->GetValue();
			if (basePortStr != NULL)
				fOutputArray[index].fBasePort = atoi(basePortStr);
		}
	}
}
开发者ID:dreamsxin,项目名称:EasyDarwin,代码行数:59,代码来源:RCFSourceInfo.cpp


示例9: if

char OSISReferenceLinks::processText(std::string &text, const SWKey *key, const SWModule *module) {
    (void) key;
    (void) module;
    if (option) return 0;

    std::string token;
    bool intoken        = false;
    bool stripThisToken = false;

    std::string orig = text;
    const char *from = orig.c_str();

    for (text = ""; *from; ++from) {
        if (*from == '<') {
            intoken = true;
            token = "";
            continue;
        }
        else if (*from == '>') {    // process tokens
            intoken = false;
            if (std::strncmp(token.c_str(), "reference", 9)
                && std::strncmp(token.c_str(), "/reference", 10)) {
                text.push_back('<');
                text.append(token);
                text.push_back('>');
            }
            else {
                XMLTag tag;
                tag = token.c_str();
                if (!tag.isEndTag() && type == tag.getAttribute("type") && (!subType.size() || subType == tag.getAttribute("subType"))) {
                    stripThisToken = true;
                    continue;
                }
                else if (tag.isEndTag() && stripThisToken) {
                    stripThisToken = false;
                    continue;
                }
                text.push_back('<');
                text.append(token);
                text.push_back('>');
            }
            continue;
        }

        if (intoken) { //copy token
            token.push_back(*from);
        }
        else { //copy text which is not inside a token
            text.push_back(*from);
        }
    }
    return 0;
}
开发者ID:kalemas,项目名称:swordxx,代码行数:53,代码来源:osisreferencelinks.cpp


示例10: switch

void XMLFile::Parse()
{
	XMLTag* parentTag = m_root;
	XMLTag* currentTag = nullptr;
	std::string attrName;
	std::string attrContent;

	for (Token token : m_tokens)
	{
		switch (token.m_type)
		{
		case TokenType::OpeningTagStart:
			currentTag = new XMLTag();
			parentTag->AddChild(currentTag);
			parentTag = currentTag;

			break;
		case TokenType::ClosingTagStart:
			parentTag = parentTag->mp_parent;

			break;
		case TokenType::TagName:
			if (currentTag->m_name == "")
				currentTag->m_name = token.m_content;

			break;
		case TokenType::TagContent:
			currentTag->m_value = token.m_content;

			break;
		case TokenType::AttributeName:
			attrName = token.m_content;

			break;
		case TokenType::AttributeContent:
			attrContent = token.m_content;
			currentTag->m_attributes[attrName] = attrContent;

			break;
		case TokenType::TagEnd:
			break;
		case TokenType::EqualSign:
			break;
		case TokenType::DoubleQuote:
			break;
		}
	}
}
开发者ID:JackEdwards,项目名称:Pazuzu,代码行数:48,代码来源:XMLFile.cpp


示例11: GetNumPrefValues

void XMLPrefsParser::SetPrefValue( ContainerRef pref, const UInt32 inValueIndex,
                                        char* inNewValue)
{
    UInt32 numValues = GetNumPrefValues(pref);
    
    if (((numValues == 0) || (numValues == 1)) && (inValueIndex == 0))
    {
        pref->SetValue(inNewValue);
    }
    else if (inValueIndex == numValues) // this is an additional value
        AddPrefValue(pref, inNewValue);
    else
    {
        XMLTag* value = pref->GetEmbeddedTag(inValueIndex);
        if (value != NULL)
            value->SetValue(inNewValue);
    }
}
开发者ID:12307,项目名称:EasyDarwin,代码行数:18,代码来源:XMLPrefsParser.cpp


示例12: FormatData

void XMLTag::FormatData(ResizeableStringFormatter* formatter, UInt32 indent)
{
    for (UInt32 i=0; i<indent; i++) formatter->PutChar('\t');

    formatter->PutChar('<');
    formatter->Put(fTag);
    if (fAttributes.GetLength() > 0)
    {
        formatter->PutChar(' ');
        for (OSQueueIter iter(&fAttributes); !iter.IsDone(); iter.Next())
        {
            XMLAttribute* attr = (XMLAttribute*)iter.GetCurrent()->GetEnclosingObject();
            formatter->Put(attr->fAttrName);
            formatter->Put("=\"");
            formatter->Put(attr->fAttrValue);
            formatter->Put("\" ");
        }
    }
    formatter->PutChar('>');
    
    if (fEmbeddedTags.GetLength() == 0)
    {
        if (fValue > 0)
            formatter->Put(fValue);
    }
    else
    {
        formatter->Put(kEOLString);
        for (OSQueueIter iter(&fEmbeddedTags); !iter.IsDone(); iter.Next())
        {
            XMLTag* current = (XMLTag*)iter.GetCurrent()->GetEnclosingObject();
            current->FormatData(formatter, indent + 1);
        }

        for (UInt32 i=0; i<indent; i++) formatter->PutChar('\t');
    }
    
    formatter->Put("</");
    formatter->Put(fTag);
    formatter->PutChar('>');
    formatter->Put(kEOLString);
}
开发者ID:435420057,项目名称:EasyDarwin,代码行数:42,代码来源:XMLParser.cpp


示例13: xmlTagCallback

  void xmlTagCallback(XMLTag &callingTag)
  {
    if (callingTag.getName() == "test-double") {
      doubleValue = callingTag.getDoubleAttributeValue("attribute");
    }

    if (callingTag.getName() == "test-eigen") {
      eigenValue = callingTag.getEigenVectorXdAttributeValue("attribute", 3);
    }

    if (callingTag.getName() == "test-int") {
      intValue = callingTag.getIntAttributeValue("attribute");
    }

    if (callingTag.getName() == "test-bool") {
      boolValue = callingTag.getBooleanAttributeValue("attribute");
    }

    if (callingTag.getName() == "test-string") {
      stringValue = callingTag.getStringAttributeValue("text");
    }
  }
开发者ID:precice,项目名称:precice,代码行数:22,代码来源:ParserTest.cpp


示例14: VerseKey

char ThMLFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
	SWBuf token;
	bool intoken    = false;
	bool hide       = false;
	SWBuf tagText;
	XMLTag startTag;
	SWBuf refs = "";
	int footnoteNum = 1;
	char buf[254];
	SWKey *p = (module) ? module->createKey() : (key) ? key->clone() : new VerseKey();
        VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p);
        if (!parser) {
        	delete p;
                parser = new VerseKey();
        }
        *parser = key->getText();

	SWBuf orig = text;
	const char *from = orig.c_str();

	for (text = ""; *from; from++) {
		if (*from == '<') {
			intoken = true;
			token = "";
			continue;
		}
		if (*from == '>') {	// process tokens
			intoken = false;

			XMLTag tag(token);
			if (!strcmp(tag.getName(), "note")) {
				if (!tag.isEndTag()) {
					if (!tag.isEmpty()) {
						refs = "";
						startTag = tag;
						hide = true;
						tagText = "";
						continue;
					}
				}
				if (hide && tag.isEndTag()) {
					if (module->isProcessEntryAttributes()) {
						SWBuf fc = module->getEntryAttributes()["Footnote"]["count"]["value"];
						footnoteNum = (fc.length()) ? atoi(fc.c_str()) : 0;
						sprintf(buf, "%i", ++footnoteNum);
						module->getEntryAttributes()["Footnote"]["count"]["value"] = buf;
						StringList attributes = startTag.getAttributeNames();
						for (StringList::iterator it = attributes.begin(); it != attributes.end(); it++) {
							module->getEntryAttributes()["Footnote"][buf][it->c_str()] = startTag.getAttribute(it->c_str());
						}
						module->getEntryAttributes()["Footnote"][buf]["body"] = tagText;
						startTag.setAttribute("swordFootnote", buf);
						if ((startTag.getAttribute("type")) && (!strcmp(startTag.getAttribute("type"), "crossReference"))) {
							if (!refs.length())
								refs = parser->parseVerseList(tagText.c_str(), *parser, true).getRangeText();
							module->getEntryAttributes()["Footnote"][buf]["refList"] = refs.c_str();
						}
					}
					hide = false;
					if ((option) || ((startTag.getAttribute("type") && (!strcmp(startTag.getAttribute("type"), "crossReference"))))) {	// we want the tag in the text; crossReferences are handled by another filter
						text += startTag;
						text.append(tagText);
					}
					else	continue;
				}
			}

			// if not a note token, keep token in text
			if ((!strcmp(tag.getName(), "scripRef")) && (!tag.isEndTag())) {
				SWBuf osisRef = tag.getAttribute("passage");
				if (refs.length())
					refs += "; ";
				refs += osisRef;
			}
			if (!hide) {
				text += '<';
				text.append(token);
				text += '>';
			}
			else {
				tagText += '<';
				tagText.append(token);
				tagText += '>';
			}
			continue;
		}
		if (intoken) { //copy token
			token += *from;
		}
		else if (!hide) { //copy text which is not inside a token
			text += *from;
		}
		else tagText += *from;
	}
        delete parser;
	return 0;
}
开发者ID:raphink,项目名称:sword,代码行数:97,代码来源:thmlfootnotes.cpp


示例15: tag

bool OSISHeadings::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData) {

	MyUserData *u = (MyUserData *)userData;
	XMLTag tag(token);
	SWBuf name = tag.getName();

	// we only care about titles and divs or if we're already in a heading
	//
	// are we currently in a heading?
	if (u->currentHeadingName.size()) {
		u->heading.append(u->lastTextNode);
		if (name == u->currentHeadingName) {
			if (tag.isEndTag(u->sID)) {
				if (!u->depth-- || u->sID) {
					// see comment below about preverse div changed and needing to preserve the <title> container tag for old school pre-verse titles
					// we've just finished a heading.  It's all stored up in u->heading
					bool canonical = (SWBuf("true") == u->currentHeadingTag.getAttribute("canonical"));
					bool preverse = (SWBuf("x-preverse") == u->currentHeadingTag.getAttribute("subType") || SWBuf("x-preverse") == u->currentHeadingTag.getAttribute("subtype"));

					// do we want to put anything in EntryAttributes?
					if (u->module->isProcessEntryAttributes() && (option || canonical || !preverse)) {
						SWBuf buf; buf.appendFormatted("%i", u->headerNum++);
						// leave the actual <title...> wrapper in if we're part of an old school preverse title
						// because now frontend have to deal with preverse as a div which may or may not include <title> elements
						// and they can't simply wrap all preverse material in <h1>, like they probably did previously
						SWBuf heading;
						if (u->currentHeadingName == "title") {
							XMLTag wrapper = u->currentHeadingTag;
							if (SWBuf("x-preverse") == wrapper.getAttribute("subType")) wrapper.setAttribute("subType", 0);
							else if (SWBuf("x-preverse") == wrapper.getAttribute("subtype")) wrapper.setAttribute("subtype", 0);
							heading = wrapper;
							heading += u->heading;
							heading += tag;
						}
						else heading = u->heading;
						u->module->getEntryAttributes()["Heading"][(preverse)?"Preverse":"Interverse"][buf] = heading;

						StringList attributes = u->currentHeadingTag.getAttributeNames();
						for (StringList::const_iterator it = attributes.begin(); it != attributes.end(); it++) {
							u->module->getEntryAttributes()["Heading"][buf][it->c_str()] = u->currentHeadingTag.getAttribute(it->c_str());
						}
					}

					// do we want the heading in the body?
					if (!preverse && (option || canonical)) {
						buf.append(u->currentHeadingTag);
						buf.append(u->heading);
						buf.append(tag);
					}
					u->suspendTextPassThru = false;
					u->clear();
				}
			}
			else u->depth++;
		}
		u->heading.append(tag);
		return true;
	}

	// are we a title or a preverse div?
	else if (   name == "title"
		|| (name == "div"
			&& ( SWBuf("x-preverse") == tag.getAttribute("subType")
			  || SWBuf("x-preverse") == tag.getAttribute("subtype")))) {

		u->currentHeadingName = name;
		u->currentHeadingTag = tag;
		u->heading = "";
		u->sID = u->currentHeadingTag.getAttribute("sID");
		u->depth = 0;
		u->suspendTextPassThru = true;

		return true;
	}

	return false;
}
开发者ID:bluehavana,项目名称:sword,代码行数:77,代码来源:osisheadings.cpp


示例16: XMLTag

XMLTag* CameraDriver::Save()
{
  XMLTag* tag = new XMLTag(GetName());
  Camera::SaveTo(tag);
  tag->AddProperty(XML_ATTRIBUTE_CALIBFILE, m_stCalibName);
  tag->AddProperty(XML_ATTRIBUTE_HASPTU, m_hasPTU ? 1 : 0);
  tag->AddProperty(XML_ATTRIBUTE_GRABBERNAME, m_grabberName);
  tag->AddProperty(XML_ATTRIBUTE_CAMERATYPE, m_stCameraType);
  tag->AddProperty(XML_ATTRIBUTE_CAMCOLOR, (int)m_isColor);
  tag->AddProperty(XML_ATTRIBUTE_IMGWIDTH, m_imageWidth);
  tag->AddProperty(XML_ATTRIBUTE_IMGHEIGHT, m_imageHeight);
  tag->AddProperty(XML_ATTRIBUTE_CAMPORT, m_port);

  tag->AddProperty(XML_ATTRIBUTE_HRESOLUTION    ,m_hresolution);
  tag->AddProperty(XML_ATTRIBUTE_VRESOLUTION    ,m_vresolution);
  tag->AddProperty(XML_ATTRIBUTE_STARTROW       ,m_startRow);
  tag->AddProperty(XML_ATTRIBUTE_STARTCOLUMN    ,m_startColumn);
  tag->AddProperty(XML_ATTRIBUTE_FIELD          ,m_field);
  tag->AddProperty(XML_ATTRIBUTE_BITSPERCHANNEL ,m_BitsPerChannel);
  tag->AddProperty(XML_ATTRIBUTE_COLORSPACE     ,m_colorSpace);
  tag->AddProperty(XML_ATTRIBUTE_GENERIC        ,m_generic);
  tag->AddProperty(XML_ATTRIBUTE_DEVICE         ,m_device);
  tag->AddProperty(XML_ATTRIBUTE_EXTERNALTRIGGER,m_externalTrigger);
  tag->AddProperty(XML_ATTRIBUTE_LINEIN         ,m_lineIn);

  return tag;
}
开发者ID:code-iai,项目名称:ias_perception_aux,代码行数:27,代码来源:CameraDriver.cpp


示例17: handleToken

// Return true if the content was handled or is to be ignored.
//      false if the what has been seen is to be accumulated and considered later.
bool handleToken(std::string & text, XMLTag & token) {
        // The start token for the current entry;
    static XMLTag startTag;

        // Flags to indicate whether we are in a entry, entryFree or superentry
        static bool inEntry      = false;
        static bool inEntryFree  = false;
        static bool inSuperEntry = false;

        std::string const &  tokenName = token.name();

        static char const * splitPtr;
        static char const * splitPtr2 = nullptr;
        static std::array<char, 4096> splitBuffer;
    static SWKey tmpKey;
//-- START TAG -------------------------------------------------------------------------
    if (!token.isEndTag()) {

        // If we are not in an "entry" and we see one, then enter it.
        if (!inEntry && !inEntryFree && !inSuperEntry) {
            inEntry      = (tokenName == "entry");
            inEntryFree  = (tokenName == "entryFree");
            inSuperEntry = (tokenName == "superentry");
                        if (inEntry || inEntryFree || inSuperEntry) {
#ifdef DEBUG
                cout << "Entering " << tokenName << endl;
#endif
                startTag    = token;
                text        = "";

                                keyStr = token.attribute("n"); // P5 with linking and/or non-URI chars
                                if (keyStr.empty()) {
                                    keyStr = token.attribute("sortKey"); // P5 otherwise
                                    if (keyStr.empty()) {
                            keyStr = token.attribute("key"); // P4
                                        }
                                }

                return false; // make tag be part of the output
            }
        }
    }

//-- EMPTY and END TAG ---------------------------------------------------------------------------------------------
    else {

        // ENTRY end
        // If we see the end of an entry that we are in, then leave it
        if ((inEntry      && (tokenName == "entry"     )) ||
            (inEntryFree  && (tokenName == "entryFree" )) ||
            (inSuperEntry && (tokenName == "superentry"))) {
#ifdef DEBUG
            cout << "Leaving " << tokenName << endl;
#endif
            // Only one is false coming into here,
            // but all must be on leaving.
            inEntry       = false;
            inEntryFree   = false;
            inSuperEntry  = false;
            text         += token.toString();

                        entryCount++;
#ifdef DEBUG
            cout << "keyStr: " << keyStr << endl;
#endif
                        splitPtr = std::strchr(keyStr.c_str(), '|');
                        if (splitPtr) {
                                std::strncpy (splitBuffer.data(), keyStr.c_str(), splitPtr - keyStr.c_str());
                                splitBuffer[splitPtr - keyStr.c_str()] = 0;
                currentKey->setText(splitBuffer.data());
#ifdef DEBUG
                cout << "splitBuffer: " << splitBuffer.data() << endl;
                cout << "currentKey: " << currentKey->getText() << endl;
#endif
                writeEntry(*currentKey, text);
#if 1
                                while (splitPtr) {
                                    splitPtr += 1;
                                    splitPtr2 = std::strstr(splitPtr, "|");
                                        entryCount++;
                                        if (splitPtr2) {
                        std::strncpy (splitBuffer.data(), splitPtr, splitPtr2 - splitPtr);
                                                splitBuffer[splitPtr2 - splitPtr] = 0;
#ifdef DEBUG
                        cout << "splitBuffer: " << splitBuffer.data() << endl;
                        cout << "currentKey: " << currentKey->getText() << endl;
#endif
                        linkToEntry(currentKey->getText(), splitBuffer.data());
                                            splitPtr = splitPtr2;
                                        }
                                        else {
                        std::strcpy(splitBuffer.data(), splitPtr);
#ifdef DEBUG
                                      cout << "splitBuffer: " << splitBuffer.data() << endl;
                        cout << "currentKey: " << currentKey->getText() << endl;
#endif
                        linkToEntry(currentKey->getText(), splitBuffer.data());
                                                splitPtr = nullptr;
//.........这里部分代码省略.........
开发者ID:swordxx,项目名称:swordxx,代码行数:101,代码来源:tei2mod.cpp


示例18: Save

 XMLTag* Save()
 {
 XMLTag* tag = new XMLTag(GetName());
 tag->AddChild(m_firstAlg->Save());
 return tag;
 }
开发者ID:code-iai,项目名称:ias_perception,代码行数:6,代码来源:TableObjectDescriptors.cpp


示例19: XMLTag

// Accessor methods
//
XMLTag* ImageInputSystem::Save()
{
	XMLTag* tag = new XMLTag(XML_NODE_IMAGEINPUTSYSTEM);
	tag->AddChild(XMLTag::Tag(m_cameras));
	return tag;
}
开发者ID:code-iai,项目名称:ias_perception,代码行数:8,代码来源:ImageInputSystem.cpp


示例20: preciceTrace1

void GeometryConfiguration:: addTypeSpecificAttributes
(
  const std::string& type,
  utils::XMLTag&     tag )
{
  preciceTrace1("addTypeSpecificAttributes()", type);
  using utils::XMLTag;
  using utils::XMLAttribute;
  using utils::ValidatorEquals;

  XMLTag tagDiscretizationWidth(*this, TAG_DISCRETIZATION_WIDTH, XMLTag::OCCUR_ONCE);
  XMLAttribute<double> attrDoubleValue(ATTR_VALUE);
  tagDiscretizationWidth.addAttribute(attrDoubleValue);

  if (type == VALUE_BUILTIN_CUBOID){
    tag.addSubtag(tagDiscretizationWidth);

    XMLTag tagLength(*this, TAG_LENGTH, XMLTag::OCCUR_ONCE);
    XMLAttribute<utils::DynVector> attrValue(ATTR_VALUE);
    tagLength.addAttribute(attrValue);
    tag.addSubtag(tagLength);
  }
  else if (type == VALUE_BUILTIN_DRATCHET){
    tag.addSubtag(tagDiscretizationWidth);

    XMLTag tagLength (*this, TAG_LENGTH, XMLTag::OCCUR_ONCE);
    XMLAttribute<double> attrValue(ATTR_VALUE);
    //ValidatorGreaterThan<double> validValue (0.0);
    //attrValue.setValidator ( validValue );
    tagLength.addAttribute(attrValue);
    tag.addSubtag(tagLength);

    XMLTag tagPores(*this, TAG_PORES, XMLTag::OCCUR_ONCE);
    tagPores.addAttribute(attrValue);
    tag.addSubtag(tagPores);

    XMLTag tagRadius(*this, TAG_RADIUS, XMLTag::OCCUR_ONCE);
    tagRadius.addAttribute(attrValue);
    tag.addSubtag(tagRadius);
  }
  else if (type == VALUE_BUILTIN_SPHERE){
    tag.addSubtag(tagDiscretizationWidth);

    XMLTag tagRadius(*this, TAG_RADIUS, XMLTag::OCCUR_ONCE);
    XMLAttribute<double> attrValue(ATTR_VALUE);
    //ValidatorGreaterThan<double> validValue ( 0.0 );
    //attrValue.setValidator ( validValue );
    tagRadius.addAttribute(attrValue);
    tag.addSubtag(tagRadius);
  }
  else if (type == VALUE_BUILTIN_BUBBLE){
    tag.addSubtag(tagDiscretizationWidth);

    XMLTag tagRadius(*this, TAG_RADIUS, XMLTag::OCCUR_ONCE);
    XMLAttribute<double> attrValue(ATTR_VALUE);
    //ValidatorGreaterThan<double> validValue ( 0.0 );
    //attrValue.setValidator ( validValue );
    tagRadius.addAttribute(attrValue);
    tag.addSubtag(tagRadius);

    XMLTag tagDefo(*this, TAG_DEFORMATION, XMLTag::OCCUR_NOT_OR_ONCE);
    XMLAttribute<double> attrValue2(ATTR_VALUE);
    //ValidatorGreaterThan<double> validValue2 ( 0.0 );
    //attrValue2.setValidator ( validValue2 );
    tagDefo.addAttribute(attrValue2);
    tag.addSubtag(tagDefo);
  }
  else if (type == VALUE_IMPORT){
    XMLTag tagFilename(*this, TAG_FILENAME, XMLTag::OCCUR_ONCE);
    XMLAttribute<std::string> attrValue(ATTR_VALUE);
    tagFilename.addAttribute(attrValue);
    tag.addSubtag(tagFilename);

    XMLTag tagFiletype(*this, TAG_FILETYPE, XMLTag::OCCUR_ONCE);
    ValidatorEquals<std::string> validFiletype("vrml");
    attrValue.setValidator(validFiletype);
    tagFiletype.addAttribute(attrValue);
    tag.addSubtag(tagFiletype);
  }
  else {
    assertion (false);
  }
}
开发者ID:Alexander-Shukaev,项目名称:precice,代码行数:83,代码来源:GeometryConfiguration.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ XMLText类代码示例发布时间:2022-05-31
下一篇:
C++ XMLString类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap