avoid ambiguity with template AppendAttr

This commit is contained in:
Glenn Maynard
2006-10-09 05:13:08 +00:00
parent 9b0c213a03
commit f588a033a8
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -284,7 +284,7 @@ static void MergeIniUnder( XNode *pFrom, XNode *pTo )
FOREACHM( RString, XNodeValue *, pSectionNode->m_attrs, it2 )
{
/* Don't overwrite existing nodes. */
pChildNode->AppendAttr( it2->first, it2->second->Copy(), false );
pChildNode->AppendAttrFrom( it2->first, it2->second->Copy(), false );
}
}
+2 -2
View File
@@ -30,7 +30,7 @@ XNode::XNode( const XNode &cpy ):
{
m_pValue = cpy.m_pValue->Copy();
FOREACH_CONST_Attr( &cpy, pAttr )
this->AppendAttr( pAttr->first, pAttr->second->Copy() );
this->AppendAttrFrom( pAttr->first, pAttr->second->Copy() );
FOREACH_CONST_Child( &cpy, c )
this->AppendChild( new XNode(*c) );
}
@@ -179,7 +179,7 @@ bool XNode::RemoveAttr( const RString &sName )
/* If bOverwrite is true and a node already exists with that name, the old value will be deleted.
* If bOverwrite is false and a node already exists with that name, the new value will be deleted. */
XNodeValue *XNode::AppendAttr( const RString &sName, XNodeValue *pValue, bool bOverwrite )
XNodeValue *XNode::AppendAttrFrom( const RString &sName, XNodeValue *pValue, bool bOverwrite )
{
DEBUG_ASSERT( sName.size() );
pair<XAttrs::iterator,bool> ret = m_attrs.insert( make_pair(sName, (XNodeValue *) NULL) );
+2 -1
View File
@@ -93,6 +93,7 @@ public:
const RString &GetName() const { return m_sName; }
RString GetValue() const { return m_pValue->GetValue<RString>(); }
void SetValueFrom( XNodeValue *pValue ) { delete m_pValue; m_pValue = pValue; }
template <typename T>
void GetValue( T &out ) const { m_pValue->GetValue(out); }
template <typename T>
@@ -119,7 +120,7 @@ public:
XNode *AppendChild( XNode *node );
bool RemoveChild( XNode *node, bool bDelete = true );
XNodeValue *AppendAttr( const RString &sName, XNodeValue *pValue, bool bOverwrite = true );
XNodeValue *AppendAttrFrom( const RString &sName, XNodeValue *pValue, bool bOverwrite = true );
XNodeValue *AppendAttr( const RString &sName );
template <typename T>
XNodeValue *AppendAttr( const RString &sName, T value ) { XNodeValue *pVal = AppendAttr( sName ); pVal->SetValue( value ); return pVal; }