re-add typedefs

This commit is contained in:
Chris Danford
2005-01-07 03:18:11 +00:00
parent a864f8372c
commit afc06a1d92
2 changed files with 23 additions and 21 deletions
+14 -14
View File
@@ -661,9 +661,9 @@ XAttr *XNode::GetAttr( const char* attrname )
// Coder Date Desc // Coder Date Desc
// bro 2002-10-29 // bro 2002-10-29
//======================================================== //========================================================
vector<XAttr*> XNode::GetAttrs( const char* name ) XAttrs XNode::GetAttrs( const char* name )
{ {
vector<XAttr*> attrs; XAttrs attrs;
for( unsigned i = 0 ; i < attrs.size(); i++ ) for( unsigned i = 0 ; i < attrs.size(); i++ )
{ {
XAttr *attr = attrs[i]; XAttr *attr = attrs[i];
@@ -691,7 +691,7 @@ const char* XNode::GetAttrValue( const char* attrname )
return attr ? (const char*)attr->value : NULL; return attr ? (const char*)attr->value : NULL;
} }
vector<XNode*> XNode::GetChilds() XNodes XNode::GetChilds()
{ {
return childs; return childs;
} }
@@ -705,9 +705,9 @@ vector<XNode*> XNode::GetChilds()
// Coder Date Desc // Coder Date Desc
// bro 2002-10-29 // bro 2002-10-29
//======================================================== //========================================================
vector<XNode*> XNode::GetChilds( const char* name ) XNodes XNode::GetChilds( const char* name )
{ {
vector<XNode*> nodes; XNodes nodes;
for( unsigned i = 0 ; i < childs.size(); i++ ) for( unsigned i = 0 ; i < childs.size(); i++ )
{ {
XNode *node = childs[i]; XNode *node = childs[i];
@@ -824,9 +824,9 @@ const char* XNode::GetChildAttrValue( const char* name, const char* attrname )
// Coder Date Desc // Coder Date Desc
// bro 2002-10-29 // bro 2002-10-29
//======================================================== //========================================================
vector<XNode*>::iterator XNode::GetChildIterator( XNode *node ) XNodes::iterator XNode::GetChildIterator( XNode *node )
{ {
vector<XNode*>::iterator it = childs.begin(); XNodes::iterator it = childs.begin();
for( ; it != childs.end() ; ++(it) ) for( ; it != childs.end() ; ++(it) )
{ {
if( *it == node ) if( *it == node )
@@ -877,7 +877,7 @@ XNode *XNode::AppendChild( XNode *node )
//======================================================== //========================================================
bool XNode::RemoveChild( XNode *node ) bool XNode::RemoveChild( XNode *node )
{ {
vector<XNode*>::iterator it = GetChildIterator( node ); XNodes::iterator it = GetChildIterator( node );
if( it != childs.end() ) if( it != childs.end() )
{ {
delete *it; delete *it;
@@ -907,14 +907,14 @@ XAttr *XNode::GetAttr( int i )
// Name : GetAttrIterator // Name : GetAttrIterator
// Desc : get attribute iterator // Desc : get attribute iterator
// Param : // Param :
// Return : vector<XAttr*>::iterator // Return : XAttrs::iterator
//-------------------------------------------------------- //--------------------------------------------------------
// Coder Date Desc // Coder Date Desc
// bro 2002-10-29 // bro 2002-10-29
//======================================================== //========================================================
vector<XAttr*>::iterator XNode::GetAttrIterator( XAttr *attr ) XAttrs::iterator XNode::GetAttrIterator( XAttr *attr )
{ {
vector<XAttr*>::iterator it = attrs.begin(); XAttrs::iterator it = attrs.begin();
for( ; it != attrs.end() ; ++(it) ) for( ; it != attrs.end() ; ++(it) )
{ {
if( *it == attr ) if( *it == attr )
@@ -950,7 +950,7 @@ XAttr *XNode::AppendAttr( XAttr *attr )
//======================================================== //========================================================
bool XNode::RemoveAttr( XAttr *attr ) bool XNode::RemoveAttr( XAttr *attr )
{ {
vector<XAttr*>::iterator it = GetAttrIterator( attr ); XAttrs::iterator it = GetAttrIterator( attr );
if( it != attrs.end() ) if( it != attrs.end() )
{ {
delete *it; delete *it;
@@ -1023,7 +1023,7 @@ XAttr *XNode::AppendAttr( const char* name, unsigned value ) { return AppendAttr
//======================================================== //========================================================
XNode *XNode::DetachChild( XNode *node ) XNode *XNode::DetachChild( XNode *node )
{ {
vector<XNode*>::iterator it = GetChildIterator( node ); XNodes::iterator it = GetChildIterator( node );
if( it != childs.end() ) if( it != childs.end() )
{ {
childs.erase( it ); childs.erase( it );
@@ -1043,7 +1043,7 @@ XNode *XNode::DetachChild( XNode *node )
//======================================================== //========================================================
XAttr *XNode::DetachAttr( XAttr *attr ) XAttr *XNode::DetachAttr( XAttr *attr )
{ {
vector<XAttr*>::iterator it = GetAttrIterator( attr ); XAttrs::iterator it = GetAttrIterator( attr );
if( it != attrs.end() ) if( it != attrs.end() )
{ {
attrs.erase( it ); attrs.erase( it );
+9 -7
View File
@@ -24,7 +24,9 @@ struct DateTime;
class RageFileBasic; class RageFileBasic;
struct XAttr; struct XAttr;
typedef vector<XAttr*> XAttrs;
struct XNode; struct XNode;
typedef vector<XNode*> XNodes;
// Entity Encode/Decode Support // Entity Encode/Decode Support
struct XENTITY struct XENTITY
@@ -138,8 +140,8 @@ struct XNode
// internal variables // internal variables
XNode *parent; // parent node XNode *parent; // parent node
vector<XNode*> childs; // child node XNodes childs; // child node
vector<XAttr*> attrs; // attributes XAttrs attrs; // attributes
// Load/Save XML // Load/Save XML
char* Load( const char* pszXml, PARSEINFO *pi = &piDefault ); char* Load( const char* pszXml, PARSEINFO *pi = &piDefault );
@@ -160,7 +162,7 @@ struct XNode
bool GetAttrValue(const char* name,bool &out) const { const XAttr* pAttr=GetAttr(name); if(pAttr==NULL) return false; pAttr->GetValue(out); return true; } bool GetAttrValue(const char* name,bool &out) const { const XAttr* pAttr=GetAttr(name); if(pAttr==NULL) return false; pAttr->GetValue(out); return true; }
bool GetAttrValue(const char* name,unsigned &out) const { const XAttr* pAttr=GetAttr(name); if(pAttr==NULL) return false; pAttr->GetValue(out); return true; } bool GetAttrValue(const char* name,unsigned &out) const { const XAttr* pAttr=GetAttr(name); if(pAttr==NULL) return false; pAttr->GetValue(out); return true; }
bool GetAttrValue(const char* name,DateTime &out) const { const XAttr* pAttr=GetAttr(name); if(pAttr==NULL) return false; pAttr->GetValue(out); return true; } bool GetAttrValue(const char* name,DateTime &out) const { const XAttr* pAttr=GetAttr(name); if(pAttr==NULL) return false; pAttr->GetValue(out); return true; }
vector<XAttr*> GetAttrs( const char* name ); XAttrs GetAttrs( const char* name );
// in one level child nodes // in one level child nodes
const XNode *GetChild( const char* name ) const; const XNode *GetChild( const char* name ) const;
@@ -172,8 +174,8 @@ struct XNode
bool GetChildValue(const char* name,bool &out) const { const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; } bool GetChildValue(const char* name,bool &out) const { const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
bool GetChildValue(const char* name,unsigned &out) const{ const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; } bool GetChildValue(const char* name,unsigned &out) const{ const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
bool GetChildValue(const char* name,DateTime &out) const{ const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; } bool GetChildValue(const char* name,DateTime &out) const{ const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
vector<XNode*> GetChilds( const char* name ); XNodes GetChilds( const char* name );
vector<XNode*> GetChilds(); XNodes GetChilds();
XAttr *GetChildAttr( const char* name, const char* attrname ); XAttr *GetChildAttr( const char* name, const char* attrname );
const char* GetChildAttrValue( const char* name, const char* attrname ); const char* GetChildAttrValue( const char* name, const char* attrname );
@@ -181,7 +183,7 @@ struct XNode
// modify DOM // modify DOM
int GetChildCount(); int GetChildCount();
XNode *GetChild( int i ); XNode *GetChild( int i );
vector<XNode*>::iterator GetChildIterator( XNode *node ); XNodes::iterator GetChildIterator( XNode *node );
XNode *CreateNode( const char* name = NULL, const char* value = NULL ); XNode *CreateNode( const char* name = NULL, const char* value = NULL );
XNode *AppendChild( const char* name = NULL, const char* value = NULL ); XNode *AppendChild( const char* name = NULL, const char* value = NULL );
XNode *AppendChild( const char* name, float value ); XNode *AppendChild( const char* name, float value );
@@ -194,7 +196,7 @@ struct XNode
XAttr *GetAttr( int i ); XAttr *GetAttr( int i );
vector<XAttr*>::iterator GetAttrIterator( XAttr *node ); XAttrs::iterator GetAttrIterator( XAttr *node );
XAttr *CreateAttr( const char* anem = NULL, const char* value = NULL ); XAttr *CreateAttr( const char* anem = NULL, const char* value = NULL );
XAttr *AppendAttr( const char* name = NULL, const char* value = NULL ); XAttr *AppendAttr( const char* name = NULL, const char* value = NULL );
XAttr *AppendAttr( const char* name, float value ); XAttr *AppendAttr( const char* name, float value );