本文整理汇总了C++中TiXmlElement::ValueStr方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlElement::ValueStr方法的具体用法?C++ TiXmlElement::ValueStr怎么用?C++ TiXmlElement::ValueStr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlElement
的用法示例。
在下文中一共展示了TiXmlElement::ValueStr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VisitExit
bool XMLSceneVisitor::VisitExit( const TiXmlElement& element)
{
if(element.ValueStr() == "scene")
{
return (element.Parent() == element.GetDocument());
}
else if (element.ValueStr() == "materials")
{
return true;
}
else if (element.ValueStr() == "primitives")
{
return true;
}
else if (element.ValueStr() == "plane")
{
m_scene->insert_primitive(m_current);
m_current = NULL;
return true;
}
else if (element.ValueStr() == "sphere")
{
m_scene->insert_primitive(m_current);
m_current = NULL;
return true;
}
else
return false;
}
示例2: LoadFromXml
bool Rule::LoadFromXml(TiXmlElement *node)
{
TiXmlAttribute *attr = node->ToElement()->FirstAttribute();
for (; attr; attr = attr->Next())
{
if (string(attr->Name()) != "name" && string(attr->Name()) != "type")
params.Add(attr->Name(), attr->ValueStr());
}
TiXmlElement *cnode = node->FirstChildElement();
for (; cnode; cnode = cnode->NextSiblingElement())
{
if (cnode->ValueStr() == "calaos:condition")
{
Condition *cond = RulesFactory::CreateCondition(cnode);
if (cond)
AddCondition(cond);
}
else if (cnode->ValueStr() == "calaos:action")
{
Action *action = RulesFactory::CreateAction(cnode);
if (action)
AddAction(action);
}
}
return true;
}
示例3: MapRemote
void CIRTranslator::MapRemote(TiXmlNode *pRemote, const std::string &szDevice)
{
CLog::Log(LOGINFO, "* Adding remote mapping for device '%s'", szDevice.c_str());
std::vector<std::string> remoteNames;
auto it = m_irRemotesMap.find(szDevice);
if (it == m_irRemotesMap.end())
m_irRemotesMap[szDevice].reset(new IRButtonMap);
std::shared_ptr<IRButtonMap>& buttons = m_irRemotesMap[szDevice];
TiXmlElement *pButton = pRemote->FirstChildElement();
while (pButton != nullptr)
{
if (!pButton->NoChildren())
{
if (pButton->ValueStr() == "altname")
remoteNames.push_back(pButton->FirstChild()->ValueStr());
else
(*buttons)[pButton->FirstChild()->ValueStr()] = pButton->ValueStr();
}
pButton = pButton->NextSiblingElement();
}
for (const auto& remoteName : remoteNames)
{
CLog::Log(LOGINFO, "* Linking remote mapping for '%s' to '%s'", szDevice.c_str(), remoteName.c_str());
m_irRemotesMap[remoteName] = buttons;
}
}
示例4: LoadAnimsFromXML
void ModelLibrary::LoadAnimsFromXML(TiXmlElement* parent, vector<SAnimation*>* anims, vector<SSound*>* sounds)
{
TiXmlElement* child;
for(child = parent->FirstChildElement(); child; child = child->NextSiblingElement())
{
if (child->ValueStr() == "sound")
{
SSound* s = new SSound();
s->filename = child->Attribute(FILENAME);
child->Attribute(SOUNDLOOP, &s->soundloop);
sounds->push_back(s);
Ogre::LogManager::getSingleton().logMessage("XML: SOUND: "+s->filename);
}
else if (child->ValueStr() == "animation")
{
SAnimation* a = new SAnimation();
a->name = child->Attribute(ANIMNAME);
child->Attribute(FRAMES, &a->frames);
child->Attribute(LOOP, &a->loop);
anims->push_back(a);
Ogre::LogManager::getSingleton().logMessage("XML: ANIM: "+a->name);
}
else
{
Ogre::LogManager::getSingleton().logMessage("XML: subPart : should never get here *giggles*");
Ogre::LogManager::getSingleton().logMessage("XML: subPart : culporate: "+child->ValueStr());
};
}
}
示例5: parseFile
void PRFParser::parseFile (TiXmlElement *elem)
{
DEBUG(4, PRFParser, "In parseFile.");
TiXmlElement *prop = elem->FirstChildElement();
DEBUG(8, PRFParser, "Process property entries");
for ( ; prop; prop = prop->NextSiblingElement()) {
DEBUG(8, PRFParser, "Found property " << prop->ValueStr());
std::string str = prop->ValueStr();
if (str == "simple") addProperty (new PRFSimpleProperty(prop));
if (str == "simplesequence") addProperty (new PRFSimpleSequenceProperty(prop));
}
DEBUG(9, PRFParser, "Done processing property entries");
for (unsigned int i = 0; i < configProperties.size(); i++)
allProperties.push_back (configProperties[i]);
for (unsigned int i = 0; i < capacityProperties.size (); i++)
allProperties.push_back (capacityProperties[i]);
for (unsigned int i = 0; i < matchingProperties.size (); i++)
allProperties.push_back (matchingProperties[i]);
for (unsigned int i = 0; i < execProperties.size (); i++)
allProperties.push_back (execProperties[i]);
for (unsigned int i = 0; i < factoryProperties.size (); i++)
allProperties.push_back (factoryProperties[i]);
}
示例6: loadCreatureBuffer
void CreatureManager::loadCreatureBuffer(const std::string& buffer)
{
TiXmlDocument doc;
doc.Parse(buffer.c_str());
if(doc.Error())
stdext::throw_exception(stdext::format("cannot load creature buffer: %s", doc.ErrorDesc()));
TiXmlElement* root = doc.FirstChildElement();
if(!root || (root->ValueStr() != "monster" && root->ValueStr() != "npc"))
stdext::throw_exception("invalid root tag name");
std::string cName = root->Attribute("name");
stdext::tolower(cName);
stdext::trim(cName);
stdext::ucwords(cName);
CreatureTypePtr newType(new CreatureType(cName));
for(TiXmlElement* attrib = root->FirstChildElement(); attrib; attrib = attrib->NextSiblingElement()) {
if(attrib->ValueStr() != "look")
continue;
internalLoadCreatureBuffer(attrib, newType);
break;
}
doc.Clear();
}
示例7:
TiXmlElement *FirstChildScraperElement(TiXmlElement *element)
{
for (TiXmlElement *child = element->FirstChildElement(); child; child = child->NextSiblingElement())
{
if (child->ValueStr() == "RegExp" || child->ValueStr() == "XSLT")
return child;
}
return NULL;
}
示例8: VisitEnter
virtual bool VisitEnter(const TiXmlElement &elt, const TiXmlAttribute *)
{
if (elt.Attribute("name") &&
( elt.ValueStr() == std::string("actuator")
|| elt.ValueStr() == std::string("rightActuator")
|| elt.ValueStr() == std::string("leftActuator") ))
actuators.insert(elt.Attribute("name"));
return true;
}
示例9: LoadXML
void CSvsFile::LoadXML()
{
UnloadXML();
TiXmlDocument XmlDoc;
XmlDoc.SetCondenseWhiteSpace(false);
ifstream iXML( m_strFile.c_str() );
if (!iXML)
{
GenErr("技能配置表转换文件读取错误", m_strFile);
}
iXML>>XmlDoc;
iXML.close();
TiXmlNode* pBody = XmlDoc.FirstChild("body");
TiXmlNode* pTable = pBody->FirstChild("table");
for ( TiXmlNode* pTr = pTable->FirstChild(); pTr; pTr = pTr->NextSibling() )
{
TiXmlElement* pElemet = pTr->ToElement();
if (!pElemet)
continue;
if(pElemet->ValueStr() != "tr")
continue;
m_vecTR.resize(m_vecTR.size() + 1);
TableRow& vecTD = m_vecTR.back();
for ( TiXmlNode* pTd = pTr->FirstChild(); pTd; pTd=pTd->NextSibling() )
{
TiXmlElement* pElemet = pTd->ToElement();
if (!pElemet)
continue;
if(pElemet->ValueStr() != "td")
continue;
TiXmlNode* pParagraph = pTd->FirstChild();
TiXmlElement* pParaElemet = pParagraph->ToElement();
if(!pParaElemet || pParaElemet->ValueStr() != "p")
{
GenErr("<td>读取<p>不存在");
}
TableData aTD;
aTD.m_eTDType = GetTableDataType(pParaElemet->Attribute("t"));
if(pParaElemet->FirstChild())
{
aTD.m_sTDValue = utf8_to_gbk(pParaElemet->GetText());
XMLDecode(aTD.m_sTDValue);
}
vecTD.push_back(aTD);
}
}
}
示例10: VisitEnter
bool XMLSceneVisitor::VisitEnter(const TiXmlElement& element, const TiXmlAttribute* attribute)
{
if(element.ValueStr() == "scene")
{
return (element.Parent() == element.GetDocument());
}
else if (element.ValueStr() == "materials")
{
return true;
}
else if (element.ValueStr() == "primitives")
{
return (element.Parent()->ValueStr() == "scene");
}
else if (element.ValueStr() == "plane")
{
if(element.Parent()->ValueStr() != "primitives")
return false;
assert(m_current == NULL);
double nx(0.0f), ny(1.0f), nz(0.0f), value(0.0f);
element.Attribute("nx", &nx);
element.Attribute("ny", &ny);
element.Attribute("nz", &nz);
element.Attribute("value", &value);
glm::vec3 normal(nx, ny, nz);
normal = glm::normalize(normal);
m_current = new Scene::Plane(normal, value);
return true;
}
else if (element.ValueStr() == "sphere")
{
if(element.Parent()->ValueStr() != "primitives")
return false;
assert(m_current == NULL);
double cx(0.0f), cy(1.0f), cz(0.0f), radius(0.0f);
element.Attribute("cx", &cx);
element.Attribute("cy", &cy);
element.Attribute("cz", &cz);
element.Attribute("radius", &radius);
glm::vec3 center(cx, cy, cz);
m_current = new Scene::Sphere(center, radius);
return true;
}
else
return false;
}
示例11:
TiXmlElement *FirstChildScraperElement(TiXmlElement *element)
{
for (TiXmlElement *child = element->FirstChildElement(); child; child = child->NextSiblingElement())
{
#ifdef HAVE_LIBXSLT
if (child->ValueStr() == "XSLT")
return child;
#endif
if (child->ValueStr() == "RegExp")
return child;
}
return NULL;
}
示例12:
RobotInterface::ParamList RobotInterface::XMLReader::Private::readParamListTag(TiXmlElement* paramListElem)
{
if (paramListElem->ValueStr().compare("paramlist") != 0) {
SYNTAX_ERROR(paramListElem->Row()) << "Expected \"paramlist\". Found" << paramListElem->ValueStr();
}
ParamList params;
Param mainparam;
if (paramListElem->QueryStringAttribute("name", &mainparam.name()) != TIXML_SUCCESS) {
SYNTAX_ERROR(paramListElem->Row()) << "\"paramlist\" element should contain the \"name\" attribute";
}
params.push_back(mainparam);
// yDebug() << "Found paramlist [" << params.at(0).name() << "]";
for (TiXmlElement* childElem = paramListElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
if (childElem->ValueStr().compare("elem") != 0) {
SYNTAX_ERROR(childElem->Row()) << "Expected \"elem\". Found" << childElem->ValueStr();
}
Param childParam;
if (childElem->QueryStringAttribute("name", &childParam.name()) != TIXML_SUCCESS) {
SYNTAX_ERROR(childElem->Row()) << "\"elem\" element should contain the \"name\" attribute";
}
const char *valueText = childElem->GetText();
if (!valueText) {
SYNTAX_ERROR(childElem->Row()) << "\"elem\" element should have a value [ \"name\" = " << childParam.name() << "]";
}
childParam.value() = valueText;
params.push_back(childParam);
}
if (params.empty()) {
SYNTAX_ERROR(paramListElem->Row()) << "\"paramlist\" cannot be empty";
}
// +1 skips the first element, that is the main param
for (ParamList::iterator it = params.begin() + 1; it != params.end(); ++it) {
Param ¶m = *it;
params.at(0).value() += (params.at(0).value().empty() ? "(" : " ") + param.name();
}
params.at(0).value() += ")";
// yDebug() << params;
return params;
}
示例13: readXml
bool Facade::readXml(TiXmlElement* e)
{
// reset for reloading
reset();
TiXmlElement* child = e->FirstChildElement();
while(child != NULL)
{
if(child->ValueStr() == "move")
{
int x = Xml::getAttrInt(child, "x");
int y = Xml::getAttrInt(child, "y");
moveSides(x, y);
LOG_DEBUG << "Facade: Moving sides: " << x << " " << y << endl;
}
else if(child->ValueStr() == "sides")
{
TiXmlElement* child2 = child->FirstChildElement();
while(child2 != NULL)
{
if(child2->ValueStr() == "MainEast")
parseSideXml(child2, facade::SIDE_MAIN_EAST);
else if(child2->ValueStr() == "MainNorth")
parseSideXml(child2, facade::SIDE_MAIN_NORTH);
else if(child2->ValueStr() == "MainWest")
parseSideXml(child2, facade::SIDE_MAIN_WEST);
else if(child2->ValueStr() == "MainSouth")
parseSideXml(child2, facade::SIDE_MAIN_SOUTH);
else if(child2->ValueStr() == "MainSouthStreet")
parseSideXml(child2, facade::SIDE_MAIN_SOUTH_STREET);
else if(child2->ValueStr() == "LabEast")
parseSideXml(child2, facade::SIDE_LAB_EAST);
else if(child2->ValueStr() == "LabNorth")
parseSideXml(child2, facade::SIDE_LAB_NORTH);
else if(child2->ValueStr() == "LabSouth")
parseSideXml(child2, facade::SIDE_LAB_SOUTH);
else
LOG_WARN << "Facade: Unknown element \""
<< child->ValueStr() << "\"" << endl;
child2 = child2->NextSiblingElement();
}
}
child = child->NextSiblingElement();
}
recomputeSize();
return true;
}
示例14: VisitEnter
bool CPluginDefVisitor::VisitEnter(const TiXmlElement &element, const TiXmlAttribute *firstAttribute)
{
if(element.ValueStr() == _plugin)
return ProcessPluginDef(element, firstAttribute);
else if (element.ValueStr() == _prereq)
return ProcessPrerequisites(element, firstAttribute);
else if (element.ValueStr() == _exports)
return ProcessExports(element, firstAttribute);
else if (element.ValueStr() == _provides)
return ProcessProvides(element, firstAttribute);
else if (element.ValueStr() == _extends)
return ProcessExtends(element, firstAttribute);
return false;
}
示例15: readDevices
RobotInterface::Robot& RobotInterface::XMLReader::Private::readRobotTag(TiXmlElement *robotElem)
{
if (robotElem->ValueStr().compare("robot") != 0) {
SYNTAX_ERROR(robotElem->Row()) << "Root element should be \"robot\". Found" << robotElem->ValueStr();
}
if (robotElem->QueryStringAttribute("name", &robot.name()) != TIXML_SUCCESS) {
SYNTAX_ERROR(robotElem->Row()) << "\"robot\" element should contain the \"name\" attribute";
}
#if TINYXML_UNSIGNED_INT_BUG
if (robotElem->QueryUnsignedAttribute("build", &robot.build()) != TIXML_SUCCESS) {
// No build attribute. Assuming build="0"
SYNTAX_WARNING(robotElem->Row()) << "\"robot\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
}
#else
int tmp;
if (robotElem->QueryIntAttribute("build", &tmp) != TIXML_SUCCESS || tmp < 0) {
// No build attribute. Assuming build="0"
SYNTAX_WARNING(robotElem->Row()) << "\"robot\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
tmp = 0;
}
robot.build() = (unsigned)tmp;
#endif
if (robotElem->QueryStringAttribute("portprefix", &robot.portprefix()) != TIXML_SUCCESS) {
SYNTAX_WARNING(robotElem->Row()) << "\"robot\" element should contain the \"portprefix\" attribute. Using \"name\" attribute";
robot.portprefix() = robot.name();
}
// yDebug() << "Found robot [" << robot.name() << "] build [" << robot.build() << "] portprefix [" << robot.portprefix() << "]";
for (TiXmlElement* childElem = robotElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
if (childElem->ValueStr().compare("device") == 0 || childElem->ValueStr().compare("devices") == 0) {
DeviceList childDevices = readDevices(childElem);
for (DeviceList::const_iterator it = childDevices.begin(); it != childDevices.end(); ++it) {
robot.devices().push_back(*it);
}
} else {
ParamList childParams = readParams(childElem);
for (ParamList::const_iterator it = childParams.begin(); it != childParams.end(); ++it) {
robot.params().push_back(*it);
}
}
}
return robot;
}