本文整理汇总了C++中TiXmlAttribute::Value方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlAttribute::Value方法的具体用法?C++ TiXmlAttribute::Value怎么用?C++ TiXmlAttribute::Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlAttribute
的用法示例。
在下文中一共展示了TiXmlAttribute::Value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CopyTo
void TiXmlElement::CopyTo( TiXmlElement* target ) const
{
// superclass:
TiXmlNode::CopyTo( target );
// Element class:
// Clone the attributes, then clone the children.
TiXmlAttribute* attribute = 0;
for( attribute = attributeSet.First();
attribute;
attribute = attribute->Next() )
{
target->SetAttribute( attribute->Name(), attribute->Value() );
}
TiXmlNode* node = 0;
for ( node = firstChild; node; node = node->NextSibling() )
{
target->LinkEndChild( node->Clone() );
}
}
示例2: readElement
daeElementRef daeTinyXMLPlugin::readElement(TiXmlElement* tinyXmlElement, daeElement* parentElement) {
std::vector<attrPair> attributes;
for (TiXmlAttribute* attrib = tinyXmlElement->FirstAttribute(); attrib != NULL; attrib = attrib->Next())
attributes.push_back(attrPair(attrib->Name(), attrib->Value()));
daeElementRef element = beginReadElement(parentElement, tinyXmlElement->Value(),
attributes, getCurrentLineNumber(tinyXmlElement));
if (!element) {
// We couldn't create the element. beginReadElement already printed an error message.
return NULL;
}
if (tinyXmlElement->GetText() != NULL)
readElementText(element, tinyXmlElement->GetText(), getCurrentLineNumber(tinyXmlElement));
// Recurse children
for (TiXmlElement* child = tinyXmlElement->FirstChildElement(); child != NULL; child = child->NextSiblingElement())
element->placeElement(readElement(child, element));
return element;
}
示例3: getVipAttr
void CRedisProxyCfg::getVipAttr(const TiXmlElement* vidNode) {
TiXmlAttribute *addrAttr = (TiXmlAttribute *)vidNode->FirstAttribute();
for (; addrAttr != NULL; addrAttr = addrAttr->Next()) {
const char* name = addrAttr->Name();
const char* value = addrAttr->Value();
if (value == NULL) value = "";
if (0 == strcasecmp(name, "if_alias_name")) {
strcpy(m_vip.if_alias_name, value);
continue;
}
if (0 == strcasecmp(name, "vip_address")) {
strcpy(m_vip.vip_address, value);
continue;
}
if (0 == strcasecmp(name, "enable")) {
if(strcasecmp(value, "0") != 0 && strcasecmp(value, "") != 0 ) {
m_vip.enable = true;
}
}
}
}
示例4: ParseFilterInVCProjectFile
bool CConverToMK::ParseFilterInVCProjectFile( TiXmlElement* pkElement,
StringVector& kVector)
{
if (0 == pkElement)
{
return false;
}
TiXmlElement* pkFilter = pkElement->FirstChildElement();
if (0 == pkFilter)
{
return false;
}
do
{
TiXmlAttribute* pkAttr = pkFilter->FirstAttribute();
string strType = pkFilter->Value();
if (strcmp("Filter",strType.c_str()) == 0)
{
ParseFilterInVCProjectFile(pkFilter,kVector);
}
else if (strcmp("File",strType.c_str()) == 0)
{
string strName = pkAttr->Value();
if (!IsFilterWord(strName.c_str()))
{
continue;
}
kVector.push_back(strName);
}
} while (pkFilter = pkFilter->NextSiblingElement());
return true;
}
示例5: LoadLircMap
bool CButtonTranslator::LoadLircMap()
{
// load our xml file, and fill up our mapping tables
TiXmlDocument xmlDoc;
// Load the config file
CStdString lircmapPath = g_settings.GetUserDataItem("Lircmap.xml");
CLog::Log(LOGINFO, "Loading %s", lircmapPath.c_str());
if (!xmlDoc.LoadFile(lircmapPath))
{
g_LoadErrorStr.Format("%s, Line %d\n%s", lircmapPath.c_str(), xmlDoc.ErrorRow(), xmlDoc.ErrorDesc());
return true; // This is so people who don't have the file won't fail, just warn
}
lircRemotesMap.clear();
TiXmlElement* pRoot = xmlDoc.RootElement();
CStdString strValue = pRoot->Value();
if (strValue != "lircmap")
{
g_LoadErrorStr.Format("%sl Doesn't contain <lircmap>", lircmapPath.c_str());
return false;
}
// run through our window groups
TiXmlNode* pRemote = pRoot->FirstChild();
while (pRemote)
{
const char *szRemote = pRemote->Value();
if (szRemote)
{
TiXmlAttribute* pAttr = pRemote->ToElement()->FirstAttribute();
const char* szDeviceName = pAttr->Value();
MapRemote(pRemote, szDeviceName);
}
pRemote = pRemote->NextSibling();
}
return true;
}
示例6: dump_attribs_to_stdout
int dump_attribs_to_stdout(TiXmlElement* pElement, unsigned int indent)
{
if (!pElement) return 0;
TiXmlAttribute* pAttrib = pElement->FirstAttribute();
int i = 0;
int ival;
double dval;
const char* pIndent = getIndent(indent);
printf("\n");
while (pAttrib)
{
printf("%s%s: value=[%s]", pIndent, pAttrib->Name(), pAttrib->Value());
if (pAttrib->QueryIntValue(&ival) == TIXML_SUCCESS) printf(" int=%d", ival);
if (pAttrib->QueryDoubleValue(&dval) == TIXML_SUCCESS) printf(" d=%1.1f", dval);
printf("\n");
i++;
pAttrib = pAttrib->Next();
}
return i;
}
示例7: handle
void SE_ShaderHandler::handle(SE_Element* parent, TiXmlElement* xmlElement, unsigned int indent)
{
if(!xmlElement)
return;
TiXmlAttribute* pAttribute = xmlElement->FirstAttribute();
SE_ResourceManager* resourceManager = SE_Application::getInstance()->getResourceManager();
std::string vertexShaderFilePath;
std::string fragmentShaderFilePath;
while(pAttribute)
{
const char* name = pAttribute->Name();
const char* value = pAttribute->Value();
if(!strcmp(name , "VertexShader"))
{
vertexShaderFilePath = std::string(resourceManager->getDataPath()) + SE_SEP + value;
}
else if(!strcmp(name, "FragmentShader"))
{
fragmentShaderFilePath = std::string(resourceManager->getDataPath()) + SE_SEP + value;
}
pAttribute = pAttribute->Next();
}
char* vertexShader;
char* fragmentShader;
int vertexShaderLen =0;
int fragmentShaderLen = 0;
SE_IO::readFileAll(vertexShaderFilePath.c_str(), vertexShader, vertexShaderLen);
SE_IO::readFileAll(fragmentShaderFilePath.c_str(), fragmentShader, fragmentShaderLen);
char* vs = new char[vertexShaderLen + 1];
char* fs = new char[fragmentShaderLen + 1];
memset(vs, 0, vertexShaderLen + 1);
memset(fs, 0, fragmentShaderLen + 1);
memcpy(vs, vertexShader, vertexShaderLen);
memcpy(fs, fragmentShader, fragmentShaderLen);
SE_ProgramDataID id("main_vertex_shader");
//resourceManager->setShaderProgram(id, vs, fs);
delete[] vertexShader;
delete[] fragmentShader;
}
示例8: setKeyMappingNode
void CRedisProxyCfg::setKeyMappingNode(TiXmlElement* pNode) {
TiXmlElement* pNext = pNode->FirstChildElement();
for (; pNext != NULL; pNext = pNext->NextSiblingElement()) {
CKeyMapping hashMap;
if (0 == strcasecmp(pNext->Value(), "key")) {
TiXmlAttribute *addrAttr = pNext->FirstAttribute();
for (; addrAttr != NULL; addrAttr = addrAttr->Next()) {
const char* name = addrAttr->Name();
const char* value = addrAttr->Value();
if (value == NULL) value = "";
if (0 == strcasecmp(name, "key_name")) {
strcpy(hashMap.key, value);
continue;
}
if (0 == strcasecmp(name, "group_name")) {
strcpy(hashMap.group_name, value);
}
}
m_keyMappingList->push_back(hashMap);
}
}
}
示例9: parse_element
View* XmlParser::parse_element(TiXmlElement *e, View *parent /* = NULL */)
{
if (!e)
{
return NULL;
}
View *view = ResourceCreator::instance().get_view(e->Value());
if (!view)
{
return NULL;
}
if (parent)
{
view->set_parent(parent);
parent->push_child(view);
}
TiXmlAttribute *a = e->FirstAttribute();
PropMap props;
while(a)
{
props.insert(make_pair(a->Name(), a->Value()));
a = a->Next();
}
view->parse(props);
TiXmlNode *node = e->FirstChild();
if (!node)
{
return view;
}
TiXmlElement *sub = node->ToElement();
while (sub)
{
View* sv = parse_element(sub, view);
sub = sub->NextSiblingElement();
}
return view;
}
示例10: parseAttributes
inline bool TamlXmlParser::parseAttributes( TiXmlElement* pXmlElement, TamlVisitor& visitor )
{
// Debug Profiling.
PROFILE_SCOPE(TamlXmlParser_ParseAttribute);
// Calculate if element is at the root or not.
const bool isRoot = pXmlElement->GetDocument()->RootElement() == pXmlElement;
// Create a visitor property state.
TamlVisitor::PropertyState propertyState;
propertyState.setObjectName( pXmlElement->Value(), isRoot );
// Iterate attributes.
for ( TiXmlAttribute* pAttribute = pXmlElement->FirstAttribute(); pAttribute; pAttribute = pAttribute->Next() )
{
// Configure property state.
propertyState.setProperty( pAttribute->Name(), pAttribute->Value() );
// Visit this attribute.
const bool visitStatus = visitor.visit( *this, propertyState );
// Was the property value changed?
if ( propertyState.getPropertyValueDirty() )
{
// Yes, so update the attribute.
pAttribute->SetValue( propertyState.getPropertyValue() );
// Flag the document as dirty.
mDocumentDirty = true;
}
// Finish if requested.
if ( !visitStatus )
return false;
}
return true;
}
示例11:
int em::EmXml::ReadRootAttrMap( EmMapStr &rMapStr )
{
int iResult = 0;
rMapStr.clear();
TiXmlElement *pElemRoot = m_pDoc->RootElement();
if(pElemRoot == NULL)
{
return 0;
}
TiXmlAttribute *pAttr = pElemRoot->FirstAttribute();
while(true)
{
if(pAttr == NULL)
{
break;
}
rMapStr[ pAttr->Name() ] = pAttr->Value() ;
pAttr = pAttr->Next();
}
iResult = rMapStr.size();
return iResult;
}
示例12: UIModify
void CALLBACK CUICommandHistory::UIModify(TiXmlNode* pNode)
{
TiXmlElement* pElement = pNode->ToElement();
CStringA strName = pElement->Attribute("name");
pElement->RemoveAttribute("name");
if(strName.IsEmpty())
return;
CPaintManagerUI* pManager = g_pMainFrame->GetActiveUIView()->GetPaintManager();
CControlUI* pControl = pManager->FindControl(StringConvertor::Utf8ToWide(strName));
TiXmlAttribute* pAttrib = pElement->FirstAttribute();
if(pControl == NULL)
return;
while(pAttrib)
{
pControl->SetAttribute(StringConvertor::Utf8ToWide(pAttrib->Name())
, StringConvertor::Utf8ToWide(pAttrib->Value()));
pAttrib = pAttrib->Next();
}
CControlUI* pParent = pControl->GetParent();
pParent->SetPos(pParent->GetPos());
}
示例13: xml_QueryNode_Attribute
/*!
* /brief 通过节点查询。
*
* /param XmlFile xml文件全路径。
* /param strNodeName 要查询的节点名
* /param AttMap 要查询的属性值,这是一个map,前一个为属性名,后一个为属性值
* /return 是否成功。true为成功,false表示失败。
*/
bool xml_QueryNode_Attribute(TiXmlElement *pRootEle, std::string strNodeName,
std::map<std::string, std::string> &AttMap)
{
// 定义一个TiXmlDocument类指针
typedef std::pair<std::string, std::string> String_Pair;
if (NULL == pRootEle) {
return false;
}
TiXmlElement *pNode = NULL;
xml_GetNodePointerByName(pRootEle, strNodeName, pNode);
if (NULL != pNode) {
TiXmlAttribute* pAttr = NULL;
for (pAttr = pNode->FirstAttribute(); pAttr; pAttr = pAttr->Next()) {
std::string strAttName = pAttr->Name();
std::string strAttValue = pAttr->Value();
AttMap.insert(String_Pair(strAttName, strAttValue));
}
return true;
} else {
return false;
}
return true;
}
示例14: GetXmlDataAll
/***********************************************************************************************************
* 程序作者:赵进军
* 函数功能:获取 XML文件所有的数据
* 参数说明:null
* 注意事项:null
* 修改日期:2015/12/14 23:10:00
***********************************************************************************************************/
void OperationProfile_XML::GetXmlDataAll(TiXmlNode* pRootEle, char* groupName)
{
if (NULL == pRootEle)
return;
TiXmlNode* pElement = pRootEle->FirstChild();
TiXmlElement* element;
TiXmlAttribute* attr;
int kl;
for (; pElement; pElement = pElement->NextSibling())
{
int nType = pElement->Type();
switch (nType)
{
case TiXmlNode::TINYXML_ELEMENT:
element = pElement->ToElement();
if (element != NULL)
{
attr = element->FirstAttribute();
if (attr != NULL)
std::cout << attr->Value() << std::endl;
}
GetXmlDataAll(pElement, groupName);
break;
case TiXmlNode::TINYXML_TEXT:
std::cout << pElement->Value() << std::endl;
break;
case TiXmlNode::TINYXML_DOCUMENT:
kl = 0;
break;
default:
break;
}
}
}
示例15: readXml
void readXml()
{
TiXmlDocument* myDocument = new TiXmlDocument();
myDocument->LoadFile("student.xml");
myDocument->Print();
TiXmlElement* rootElement = myDocument->RootElement(); //Class
TiXmlElement* studentsElement = rootElement->FirstChildElement(); //Students
TiXmlElement* studentElement = studentsElement->FirstChildElement(); //Students
//std::cout<<studentElement->GetText() ;
while ( studentElement )
{
TiXmlAttribute* attributeOfStudent = studentElement->FirstAttribute(); //获得student的name属性
while ( attributeOfStudent )
{
std::cout << attributeOfStudent->Name() << " : " << attributeOfStudent->Value() << std::endl;
attributeOfStudent = attributeOfStudent->Next();
}
TiXmlElement* phoneElement = studentElement->FirstChildElement();//获得student的phone元素
std::cout << "phone" << " : " << phoneElement->GetText() << std::endl;
TiXmlElement* addressElement = phoneElement->NextSiblingElement();
std::cout << "address" << " : " << phoneElement->GetText() << std::endl;
studentElement = studentElement->NextSiblingElement();
}
}