本文整理汇总了C++中TiXmlElement::ToText方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlElement::ToText方法的具体用法?C++ TiXmlElement::ToText怎么用?C++ TiXmlElement::ToText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlElement
的用法示例。
在下文中一共展示了TiXmlElement::ToText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setConfigSetting
void Configuration::setConfigSetting(string sectionName, string settingName, string settingValue)
{
TiXmlElement* setting = findConfigSetting(sectionName, settingName);
if (setting)
{
TiXmlText* settingText = setting->ToText();
if (settingText)
settingText->SetValue(settingValue);
}
else
{
// Check to see if the section exists
TiXmlHandle docHandle(&configs);
TiXmlElement* newSection = docHandle.FirstChild("osdb").FirstChild(sectionName).ToElement();
if (!newSection)
{
newSection = new TiXmlElement(sectionName);
configs.RootElement()->LinkEndChild(newSection);
}
TiXmlElement* newSettingElement = new TiXmlElement(settingName);
newSettingElement->LinkEndChild(new TiXmlText(settingValue));
newSection->LinkEndChild(newSettingElement);
}
saveConfig();
}
示例2: loadAlarmDefinitions
bool cAlarmServer::loadAlarmDefinitions(const UtlString& alarmFile)
{
OsSysLog::add(FAC_ALARM, PRI_DEBUG, "Loading alarm def file '%s'", alarmFile.data());
TiXmlDocument doc(alarmFile);
TiXmlHandle docHandle( &doc );
if (!doc.LoadFile())
{
UtlString errorMsg;
XmlErrorMsg( doc, errorMsg );
OsSysLog::add(FAC_ALARM, PRI_ERR, "Failed to load alarm file: %s", errorMsg.data());
return false;
}
TiXmlHandle docH( &doc );
//load alarm definitions
TiXmlElement* alarmDefElement = docH.FirstChildElement("alarm_server").
FirstChildElement("definitions").Element();
if (alarmDefElement)
{
TiXmlElement* element = alarmDefElement->FirstChildElement();
cAlarmData* pAlarmData;
for (; element; element=element->NextSiblingElement() )
{
pAlarmData = new cAlarmData();
if (loadAlarmData(element, pAlarmData))
{
UtlString* idStr = new UtlString(pAlarmData->getId());
if (!mAlarmMap.insertKeyAndValue(idStr, pAlarmData))
{
OsSysLog::add(FAC_ALARM, PRI_ERR, "Alarm id '%s' is already defined",
pAlarmData->getId().data());
delete pAlarmData;
}
}
else
{
OsSysLog::add(FAC_ALARM, PRI_ERR, "Alarm element '%s' is incorrectly defined",
(char *)element->ToText());
delete pAlarmData;
}
}
}
return true;
}