avoid ambiguity with template AppendAttr
This commit is contained in:
@@ -284,7 +284,7 @@ static void MergeIniUnder( XNode *pFrom, XNode *pTo )
|
|||||||
FOREACHM( RString, XNodeValue *, pSectionNode->m_attrs, it2 )
|
FOREACHM( RString, XNodeValue *, pSectionNode->m_attrs, it2 )
|
||||||
{
|
{
|
||||||
/* Don't overwrite existing nodes. */
|
/* Don't overwrite existing nodes. */
|
||||||
pChildNode->AppendAttr( it2->first, it2->second->Copy(), false );
|
pChildNode->AppendAttrFrom( it2->first, it2->second->Copy(), false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ XNode::XNode( const XNode &cpy ):
|
|||||||
{
|
{
|
||||||
m_pValue = cpy.m_pValue->Copy();
|
m_pValue = cpy.m_pValue->Copy();
|
||||||
FOREACH_CONST_Attr( &cpy, pAttr )
|
FOREACH_CONST_Attr( &cpy, pAttr )
|
||||||
this->AppendAttr( pAttr->first, pAttr->second->Copy() );
|
this->AppendAttrFrom( pAttr->first, pAttr->second->Copy() );
|
||||||
FOREACH_CONST_Child( &cpy, c )
|
FOREACH_CONST_Child( &cpy, c )
|
||||||
this->AppendChild( new XNode(*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 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. */
|
* 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() );
|
DEBUG_ASSERT( sName.size() );
|
||||||
pair<XAttrs::iterator,bool> ret = m_attrs.insert( make_pair(sName, (XNodeValue *) NULL) );
|
pair<XAttrs::iterator,bool> ret = m_attrs.insert( make_pair(sName, (XNodeValue *) NULL) );
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ public:
|
|||||||
const RString &GetName() const { return m_sName; }
|
const RString &GetName() const { return m_sName; }
|
||||||
RString GetValue() const { return m_pValue->GetValue<RString>(); }
|
RString GetValue() const { return m_pValue->GetValue<RString>(); }
|
||||||
|
|
||||||
|
void SetValueFrom( XNodeValue *pValue ) { delete m_pValue; m_pValue = pValue; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void GetValue( T &out ) const { m_pValue->GetValue(out); }
|
void GetValue( T &out ) const { m_pValue->GetValue(out); }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@@ -119,7 +120,7 @@ public:
|
|||||||
XNode *AppendChild( XNode *node );
|
XNode *AppendChild( XNode *node );
|
||||||
bool RemoveChild( XNode *node, bool bDelete = true );
|
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 );
|
XNodeValue *AppendAttr( const RString &sName );
|
||||||
template <typename T>
|
template <typename T>
|
||||||
XNodeValue *AppendAttr( const RString &sName, T value ) { XNodeValue *pVal = AppendAttr( sName ); pVal->SetValue( value ); return pVal; }
|
XNodeValue *AppendAttr( const RString &sName, T value ) { XNodeValue *pVal = AppendAttr( sName ); pVal->SetValue( value ); return pVal; }
|
||||||
|
|||||||
Reference in New Issue
Block a user