本文整理汇总了C++中XMLElement::GetAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLElement::GetAttributeValue方法的具体用法?C++ XMLElement::GetAttributeValue怎么用?C++ XMLElement::GetAttributeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLElement
的用法示例。
在下文中一共展示了XMLElement::GetAttributeValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConfigParser
CfgDrivers::CfgDrivers(ConfigParser *parent)
{
XMLElement *xel;
config = new ConfigParser(parent, Cfg_Drivers);
xel = config->getElement();
drivers.FreeOnDelete(true);
for (int i=0; (xel!=0) && (i<xel->GetChildrenCount()); i++)
{
XMLElement *el = xel->GetChild(i);
ASSERT (el != 0);
if (el != 0)
{
String *h = el->GetAttributeValue(Cfg_DriverHarmful);
String *n = el->GetAttributeValue(Cfg_DriverName);
if ((h != 0) && (n != 0))
{
Driver *d = new Driver;
d->driver = *n;
d->harmful = (h->ToLong() != 0) ? true : false;
drivers << d;
}
}
}
}
示例2: DeserializeFields
void ArchiveXML::DeserializeFields( void* structure, const Structure* type )
{
if ( m_Iterator.GetCurrent()->GetFirstChild() )
{
// advance to the first child
m_Iterator.Advance();
for ( XMLElement* sibling = m_Iterator.GetCurrent(); sibling != NULL; sibling = sibling->GetNextSibling() )
{
HELIUM_ASSERT( m_Iterator.GetCurrent() == sibling );
const String* fieldNameStr = sibling->GetAttributeValue( Name( TXT("Name") ) );
uint32_t fieldNameCrc = fieldNameStr ? Crc32( fieldNameStr->GetData() ) : 0x0;
const Field* field = type->FindFieldByName(fieldNameCrc);
if ( field )
{
#ifdef REFLECT_ARCHIVE_VERBOSE
m_Indent.Get(stdout);
Log::Debug(TXT("Deserializing field %s\n"), field->m_Name);
m_Indent.Push();
#endif
// pull and structure and downcast to data
DataPtr latentData = SafeCast<Data>( Allocate() );
if (!latentData.ReferencesObject())
{
// this should never happen, the type id read from the file is bogus
throw Reflect::TypeInformationException( TXT( "Unknown data for field %s (%s)" ), field->m_Name, m_Path.c_str() );
#pragma TODO("Support blind data")
}
// if the types match we are a natural fit to just deserialize directly into the field data
if ( field->m_DataClass == field->m_DataClass )
{
// set data pointer
latentData->ConnectField( structure, field );
// process natively
DeserializeInstance( (ObjectPtr&)latentData );
// disconnect
latentData->Disconnect();
}
else // else the type does not match, deserialize it into temp data then attempt to cast it into the field data
{
REFLECT_SCOPE_TIMER(("Casting"));
// construct current serialization structure
ObjectPtr currentObject = Registry::GetInstance()->CreateInstance( field->m_DataClass );
// downcast to data
DataPtr currentData = SafeCast<Data>(currentObject);
if (!currentData.ReferencesObject())
{
// this should never happen, the type id in the rtti data is bogus
throw Reflect::TypeInformationException( TXT( "Invalid type id for field %s (%s)" ), field->m_Name, m_Path.c_str() );
}
// process into temporary memory
currentData->ConnectField(structure, field);
// process natively
DeserializeInstance( (ObjectPtr&)latentData );
// attempt cast data into new definition
Data::CastValue( latentData, currentData, DataFlags::Shallow );
// disconnect
currentData->Disconnect();
}
}
#ifdef REFLECT_ARCHIVE_VERBOSE
m_Indent.Pop();
#endif
}
}
else
{
// advance to the next element
m_Iterator.Advance();
}
}