CString -> RString
This commit is contained in:
+44
-44
@@ -27,8 +27,8 @@ static const char chXMLExclamation = '!';
|
|||||||
static const char chXMLDash = '-';
|
static const char chXMLDash = '-';
|
||||||
|
|
||||||
|
|
||||||
static map<CString,CString> g_mapEntitiesToChars;
|
static map<RString,RString> g_mapEntitiesToChars;
|
||||||
static map<char,CString> g_mapCharsToEntities;
|
static map<char,RString> g_mapCharsToEntities;
|
||||||
|
|
||||||
static void InitEntities()
|
static void InitEntities()
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ static void InitEntities()
|
|||||||
for( unsigned i = 0; i < ARRAYSIZE(EntityTable); ++i )
|
for( unsigned i = 0; i < ARRAYSIZE(EntityTable); ++i )
|
||||||
{
|
{
|
||||||
const Entity &ent = EntityTable[i];
|
const Entity &ent = EntityTable[i];
|
||||||
g_mapEntitiesToChars[ent.pEntity] = CString(1, ent.c);
|
g_mapEntitiesToChars[ent.pEntity] = RString(1, ent.c);
|
||||||
g_mapCharsToEntities[ent.c] = ent.pEntity;
|
g_mapCharsToEntities[ent.c] = ent.pEntity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,18 +63,18 @@ static struct RunInitEntities
|
|||||||
} g_RunInitEntities;
|
} g_RunInitEntities;
|
||||||
|
|
||||||
// skip spaces
|
// skip spaces
|
||||||
static void tcsskip( const CString &s, unsigned &i )
|
static void tcsskip( const RString &s, unsigned &i )
|
||||||
{
|
{
|
||||||
i = s.find_first_not_of( " \t\r\n", i );
|
i = s.find_first_not_of( " \t\r\n", i );
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool XIsEmptyString( const CString &s )
|
static bool XIsEmptyString( const RString &s )
|
||||||
{
|
{
|
||||||
return s.find_first_not_of( "\r\n\t " ) == s.npos;
|
return s.find_first_not_of( "\r\n\t " ) == s.npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
// put string of (psz~end) on ps string
|
// put string of (psz~end) on ps string
|
||||||
static void SetString( const CString &s, int iStart, int iEnd, CString* ps, bool trim = false )
|
static void SetString( const RString &s, int iStart, int iEnd, RString* ps, bool trim = false )
|
||||||
{
|
{
|
||||||
if( trim )
|
if( trim )
|
||||||
{
|
{
|
||||||
@@ -119,7 +119,7 @@ void XNode::Clear()
|
|||||||
// Param : pszAttrs - xml of attributes
|
// Param : pszAttrs - xml of attributes
|
||||||
// pi = parser information
|
// pi = parser information
|
||||||
// Return : advanced string pointer. (error return npos)
|
// Return : advanced string pointer. (error return npos)
|
||||||
unsigned XNode::LoadAttributes( const CString &xml, PARSEINFO *pi, unsigned iOffset )
|
unsigned XNode::LoadAttributes( const RString &xml, PARSEINFO *pi, unsigned iOffset )
|
||||||
{
|
{
|
||||||
while( iOffset < xml.size() )
|
while( iOffset < xml.size() )
|
||||||
{
|
{
|
||||||
@@ -148,13 +148,13 @@ unsigned XNode::LoadAttributes( const CString &xml, PARSEINFO *pi, unsigned iOff
|
|||||||
}
|
}
|
||||||
|
|
||||||
// XML Attr Name
|
// XML Attr Name
|
||||||
CString sName;
|
RString sName;
|
||||||
SetString( xml, iOffset, iEnd, &sName );
|
SetString( xml, iOffset, iEnd, &sName );
|
||||||
|
|
||||||
// add new attribute
|
// add new attribute
|
||||||
DEBUG_ASSERT( sName.size() );
|
DEBUG_ASSERT( sName.size() );
|
||||||
pair<XAttrs::iterator,bool> it = m_attrs.insert( make_pair(sName, CString()) );
|
pair<XAttrs::iterator,bool> it = m_attrs.insert( make_pair(sName, RString()) );
|
||||||
CString &sValue = it.first->second;
|
RString &sValue = it.first->second;
|
||||||
iOffset = iEnd;
|
iOffset = iEnd;
|
||||||
|
|
||||||
// XML Attr Value
|
// XML Attr Value
|
||||||
@@ -221,7 +221,7 @@ unsigned XNode::LoadAttributes( const CString &xml, PARSEINFO *pi, unsigned iOff
|
|||||||
// Param : pszXml - plain xml text
|
// Param : pszXml - plain xml text
|
||||||
// pi = parser information
|
// pi = parser information
|
||||||
// Return : advanced string pointer (error return npos)
|
// Return : advanced string pointer (error return npos)
|
||||||
unsigned XNode::Load( const CString &xml, PARSEINFO *pi, unsigned iOffset )
|
unsigned XNode::Load( const RString &xml, PARSEINFO *pi, unsigned iOffset )
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
@@ -380,7 +380,7 @@ unsigned XNode::Load( const CString &xml, PARSEINFO *pi, unsigned iOffset )
|
|||||||
return string::npos;
|
return string::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString closename;
|
RString closename;
|
||||||
SetString( xml, iOffset, iEnd, &closename );
|
SetString( xml, iOffset, iEnd, &closename );
|
||||||
iOffset = iEnd+1;
|
iOffset = iEnd+1;
|
||||||
if( closename == this->m_sName )
|
if( closename == this->m_sName )
|
||||||
@@ -437,9 +437,9 @@ unsigned XNode::Load( const CString &xml, PARSEINFO *pi, unsigned iOffset )
|
|||||||
|
|
||||||
// Desc : convert plain xml text from parsed xml attirbute
|
// Desc : convert plain xml text from parsed xml attirbute
|
||||||
// Return : converted plain string
|
// Return : converted plain string
|
||||||
bool XNode::GetAttrXML( RageFileBasic &f, DISP_OPT &opt, const CString &sName, const CString &sValue ) const
|
bool XNode::GetAttrXML( RageFileBasic &f, DISP_OPT &opt, const RString &sName, const RString &sValue ) const
|
||||||
{
|
{
|
||||||
CString s(sValue);
|
RString s(sValue);
|
||||||
if( opt.reference_value )
|
if( opt.reference_value )
|
||||||
ReplaceEntityText( s, g_mapCharsToEntities );
|
ReplaceEntityText( s, g_mapCharsToEntities );
|
||||||
return f.Write(sName + "='" + s + "' ") != -1;
|
return f.Write(sName + "='" + s + "' ") != -1;
|
||||||
@@ -506,7 +506,7 @@ bool XNode::GetXML( RageFileBasic &f, DISP_OPT &opt ) const
|
|||||||
if( f.Write("\t") == -1 )
|
if( f.Write("\t") == -1 )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CString s( m_sValue );
|
RString s( m_sValue );
|
||||||
if( opt.reference_value )
|
if( opt.reference_value )
|
||||||
ReplaceEntityText( s, g_mapCharsToEntities );
|
ReplaceEntityText( s, g_mapCharsToEntities );
|
||||||
if( f.Write(s) == -1 )
|
if( f.Write(s) == -1 )
|
||||||
@@ -537,7 +537,7 @@ bool XNode::GetXML( RageFileBasic &f, DISP_OPT &opt ) const
|
|||||||
|
|
||||||
// Desc : convert plain xml text from parsed xml node
|
// Desc : convert plain xml text from parsed xml node
|
||||||
// Return : converted plain string
|
// Return : converted plain string
|
||||||
CString XNode::GetXML() const
|
RString XNode::GetXML() const
|
||||||
{
|
{
|
||||||
RageFileObjMem f;
|
RageFileObjMem f;
|
||||||
DISP_OPT opt;
|
DISP_OPT opt;
|
||||||
@@ -545,19 +545,19 @@ CString XNode::GetXML() const
|
|||||||
return f.GetString();
|
return f.GetString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XNode::GetValue( CString &out ) const { out = m_sValue; }
|
void XNode::GetValue( RString &out ) const { out = m_sValue; }
|
||||||
void XNode::GetValue( int &out ) const { out = atoi(m_sValue); }
|
void XNode::GetValue( int &out ) const { out = atoi(m_sValue); }
|
||||||
void XNode::GetValue( float &out ) const { out = strtof(m_sValue, NULL); }
|
void XNode::GetValue( float &out ) const { out = strtof(m_sValue, NULL); }
|
||||||
void XNode::GetValue( bool &out ) const { out = atoi(m_sValue) != 0; }
|
void XNode::GetValue( bool &out ) const { out = atoi(m_sValue) != 0; }
|
||||||
void XNode::GetValue( unsigned &out ) const { out = 0; sscanf(m_sValue,"%u",&out); }
|
void XNode::GetValue( unsigned &out ) const { out = 0; sscanf(m_sValue,"%u",&out); }
|
||||||
void XNode::GetValue( DateTime &out ) const { out.FromString( m_sValue ); }
|
void XNode::GetValue( DateTime &out ) const { out.FromString( m_sValue ); }
|
||||||
|
|
||||||
bool XNode::GetAttrValue( const CString &sName, CString &out ) const { const CString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = *pAttr; return true; }
|
bool XNode::GetAttrValue( const RString &sName, RString &out ) const { const RString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = *pAttr; return true; }
|
||||||
bool XNode::GetAttrValue( const CString &sName, int &out ) const { const CString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = atoi(*pAttr); return true; }
|
bool XNode::GetAttrValue( const RString &sName, int &out ) const { const RString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = atoi(*pAttr); return true; }
|
||||||
bool XNode::GetAttrValue( const CString &sName, float &out ) const { const CString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = strtof(*pAttr, NULL); return true; }
|
bool XNode::GetAttrValue( const RString &sName, float &out ) const { const RString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = strtof(*pAttr, NULL); return true; }
|
||||||
bool XNode::GetAttrValue( const CString &sName, bool &out ) const { const CString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = atoi(*pAttr) != 0; return true; }
|
bool XNode::GetAttrValue( const RString &sName, bool &out ) const { const RString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = atoi(*pAttr) != 0; return true; }
|
||||||
bool XNode::GetAttrValue( const CString &sName, unsigned &out ) const { const CString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = 0; sscanf(*pAttr,"%u",&out); return true; }
|
bool XNode::GetAttrValue( const RString &sName, unsigned &out ) const { const RString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out = 0; sscanf(*pAttr,"%u",&out); return true; }
|
||||||
bool XNode::GetAttrValue( const CString &sName, DateTime &out ) const { const CString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out.FromString( *pAttr ); return true; }
|
bool XNode::GetAttrValue( const RString &sName, DateTime &out ) const { const RString* pAttr=GetAttr(sName); if(pAttr==NULL) return false; out.FromString( *pAttr ); return true; }
|
||||||
|
|
||||||
void XNode::SetValue( int v ) { m_sValue = ssprintf("%d",v); }
|
void XNode::SetValue( int v ) { m_sValue = ssprintf("%d",v); }
|
||||||
void XNode::SetValue( float v ) { m_sValue = ssprintf("%f",v); }
|
void XNode::SetValue( float v ) { m_sValue = ssprintf("%f",v); }
|
||||||
@@ -565,17 +565,17 @@ void XNode::SetValue( bool v ) { m_sValue = ssprintf("%d",v); }
|
|||||||
void XNode::SetValue( unsigned v ) { m_sValue = ssprintf("%u",v); }
|
void XNode::SetValue( unsigned v ) { m_sValue = ssprintf("%u",v); }
|
||||||
void XNode::SetValue( const DateTime &v ) { m_sValue = v.GetString(); }
|
void XNode::SetValue( const DateTime &v ) { m_sValue = v.GetString(); }
|
||||||
|
|
||||||
const CString *XNode::GetAttr( const CString &attrname ) const
|
const RString *XNode::GetAttr( const RString &attrname ) const
|
||||||
{
|
{
|
||||||
map<CString, CString>::const_iterator it = m_attrs.find( attrname );
|
map<RString, RString>::const_iterator it = m_attrs.find( attrname );
|
||||||
if( it != m_attrs.end() )
|
if( it != m_attrs.end() )
|
||||||
return &it->second;
|
return &it->second;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString *XNode::GetAttr( const CString &attrname )
|
RString *XNode::GetAttr( const RString &attrname )
|
||||||
{
|
{
|
||||||
map<CString, CString>::iterator it = m_attrs.find( attrname );
|
map<RString, RString>::iterator it = m_attrs.find( attrname );
|
||||||
if( it != m_attrs.end() )
|
if( it != m_attrs.end() )
|
||||||
return &it->second;
|
return &it->second;
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -583,9 +583,9 @@ CString *XNode::GetAttr( const CString &attrname )
|
|||||||
|
|
||||||
// Desc : Find child with name and return child
|
// Desc : Find child with name and return child
|
||||||
// Return : NULL return if no child.
|
// Return : NULL return if no child.
|
||||||
XNode *XNode::GetChild( const CString &sName )
|
XNode *XNode::GetChild( const RString &sName )
|
||||||
{
|
{
|
||||||
multimap<CString, XNode*>::iterator it = m_childs.find( sName );
|
multimap<RString, XNode*>::iterator it = m_childs.find( sName );
|
||||||
if( it != m_childs.end() )
|
if( it != m_childs.end() )
|
||||||
{
|
{
|
||||||
DEBUG_ASSERT( sName == it->second->m_sName );
|
DEBUG_ASSERT( sName == it->second->m_sName );
|
||||||
@@ -594,9 +594,9 @@ XNode *XNode::GetChild( const CString &sName )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const XNode *XNode::GetChild( const CString &sName ) const
|
const XNode *XNode::GetChild( const RString &sName ) const
|
||||||
{
|
{
|
||||||
multimap<CString, XNode*>::const_iterator it = m_childs.find( sName );
|
multimap<RString, XNode*>::const_iterator it = m_childs.find( sName );
|
||||||
if( it != m_childs.end() )
|
if( it != m_childs.end() )
|
||||||
{
|
{
|
||||||
DEBUG_ASSERT( sName == it->second->m_sName );
|
DEBUG_ASSERT( sName == it->second->m_sName );
|
||||||
@@ -605,25 +605,25 @@ const XNode *XNode::GetChild( const CString &sName ) const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
XNode *XNode::AppendChild( const CString &sName, const CString &value ) { XNode *p = new XNode; p->m_sName = sName; p->m_sValue = value; return AppendChild( p ); }
|
XNode *XNode::AppendChild( const RString &sName, const RString &value ) { XNode *p = new XNode; p->m_sName = sName; p->m_sValue = value; return AppendChild( p ); }
|
||||||
XNode *XNode::AppendChild( const CString &sName, float value ) { XNode *p = new XNode; p->m_sName = sName; p->SetValue( value ); return AppendChild( p ); }
|
XNode *XNode::AppendChild( const RString &sName, float value ) { XNode *p = new XNode; p->m_sName = sName; p->SetValue( value ); return AppendChild( p ); }
|
||||||
XNode *XNode::AppendChild( const CString &sName, int value ) { XNode *p = new XNode; p->m_sName = sName; p->SetValue( value ); return AppendChild( p ); }
|
XNode *XNode::AppendChild( const RString &sName, int value ) { XNode *p = new XNode; p->m_sName = sName; p->SetValue( value ); return AppendChild( p ); }
|
||||||
XNode *XNode::AppendChild( const CString &sName, unsigned value ) { XNode *p = new XNode; p->m_sName = sName; p->SetValue( value ); return AppendChild( p ); }
|
XNode *XNode::AppendChild( const RString &sName, unsigned value ) { XNode *p = new XNode; p->m_sName = sName; p->SetValue( value ); return AppendChild( p ); }
|
||||||
XNode *XNode::AppendChild( const CString &sName, const DateTime &value ) { XNode *p = new XNode; p->m_sName = sName; p->SetValue( value ); return AppendChild( p ); }
|
XNode *XNode::AppendChild( const RString &sName, const DateTime &value ) { XNode *p = new XNode; p->m_sName = sName; p->SetValue( value ); return AppendChild( p ); }
|
||||||
|
|
||||||
XNode *XNode::AppendChild( XNode *node )
|
XNode *XNode::AppendChild( XNode *node )
|
||||||
{
|
{
|
||||||
DEBUG_ASSERT( node->m_sName.size() );
|
DEBUG_ASSERT( node->m_sName.size() );
|
||||||
|
|
||||||
/* Hinted insert: optimize for alphabetical inserts, for the copy ctor. */
|
/* Hinted insert: optimize for alphabetical inserts, for the copy ctor. */
|
||||||
m_childs.insert( m_childs.end(), pair<CString,XNode*>(node->m_sName,node) );
|
m_childs.insert( m_childs.end(), pair<RString,XNode*>(node->m_sName,node) );
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
// detach node and delete object
|
// detach node and delete object
|
||||||
bool XNode::RemoveChild( XNode *node )
|
bool XNode::RemoveChild( XNode *node )
|
||||||
{
|
{
|
||||||
FOREACHMM( CString, XNode*, m_childs, p )
|
FOREACHMM( RString, XNode*, m_childs, p )
|
||||||
{
|
{
|
||||||
if( p->second == node )
|
if( p->second == node )
|
||||||
{
|
{
|
||||||
@@ -637,21 +637,21 @@ bool XNode::RemoveChild( XNode *node )
|
|||||||
|
|
||||||
|
|
||||||
// detach attribute
|
// detach attribute
|
||||||
bool XNode::RemoveAttr( const CString &sName )
|
bool XNode::RemoveAttr( const RString &sName )
|
||||||
{
|
{
|
||||||
return m_attrs.erase(sName) > 0;
|
return m_attrs.erase(sName) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XNode::AppendAttr( const CString &sName, const CString &sValue )
|
void XNode::AppendAttr( const RString &sName, const RString &sValue )
|
||||||
{
|
{
|
||||||
pair<XAttrs::iterator,bool> ret = m_attrs.insert( make_pair(sName,sValue) );
|
pair<XAttrs::iterator,bool> ret = m_attrs.insert( make_pair(sName,sValue) );
|
||||||
if( !ret.second )
|
if( !ret.second )
|
||||||
ret.first->second = sValue; // already existed
|
ret.first->second = sValue; // already existed
|
||||||
}
|
}
|
||||||
|
|
||||||
void XNode::AppendAttr( const CString &sName, float value ){ AppendAttr(sName,ssprintf("%f",value)); }
|
void XNode::AppendAttr( const RString &sName, float value ){ AppendAttr(sName,ssprintf("%f",value)); }
|
||||||
void XNode::AppendAttr( const CString &sName, int value ) { AppendAttr(sName,ssprintf("%d",value)); }
|
void XNode::AppendAttr( const RString &sName, int value ) { AppendAttr(sName,ssprintf("%d",value)); }
|
||||||
void XNode::AppendAttr( const CString &sName, unsigned value ) { AppendAttr(sName,ssprintf("%u",value)); }
|
void XNode::AppendAttr( const RString &sName, unsigned value ) { AppendAttr(sName,ssprintf("%u",value)); }
|
||||||
|
|
||||||
bool XNode::SaveToFile( RageFileBasic &f, DISP_OPT &opt ) const
|
bool XNode::SaveToFile( RageFileBasic &f, DISP_OPT &opt ) const
|
||||||
{
|
{
|
||||||
@@ -665,7 +665,7 @@ bool XNode::SaveToFile( RageFileBasic &f, DISP_OPT &opt ) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XNode::SaveToFile( const CString &sFile, DISP_OPT &opt ) const
|
bool XNode::SaveToFile( const RString &sFile, DISP_OPT &opt ) const
|
||||||
{
|
{
|
||||||
RageFile f;
|
RageFile f;
|
||||||
if( !f.Open(sFile, RageFile::WRITE) )
|
if( !f.Open(sFile, RageFile::WRITE) )
|
||||||
|
|||||||
+39
-39
@@ -7,9 +7,9 @@
|
|||||||
struct DateTime;
|
struct DateTime;
|
||||||
class RageFileBasic;
|
class RageFileBasic;
|
||||||
|
|
||||||
typedef map<CString,CString> XAttrs;
|
typedef map<RString,RString> XAttrs;
|
||||||
class XNode;
|
class XNode;
|
||||||
typedef multimap<CString,XNode*> XNodes;
|
typedef multimap<RString,XNode*> XNodes;
|
||||||
|
|
||||||
#define FOREACH_Attr( pNode, Var ) \
|
#define FOREACH_Attr( pNode, Var ) \
|
||||||
for( XAttrs::iterator Var = (pNode)->m_attrs.begin(); \
|
for( XAttrs::iterator Var = (pNode)->m_attrs.begin(); \
|
||||||
@@ -55,7 +55,7 @@ struct PARSEINFO
|
|||||||
bool error_occur; // [get] is occurance of error?
|
bool error_occur; // [get] is occurance of error?
|
||||||
const char* error_pointer; // [get] error position of xml source
|
const char* error_pointer; // [get] error position of xml source
|
||||||
PCODE error_code; // [get] error code
|
PCODE error_code; // [get] error code
|
||||||
CString error_string; // [get] error string
|
RString error_string; // [get] error string
|
||||||
|
|
||||||
PARSEINFO() { trim_value = true; entity_value = true; xml = NULL; error_occur = false; error_pointer = NULL; error_code = PIE_PARSE_WELL_FORMED; }
|
PARSEINFO() { trim_value = true; entity_value = true; xml = NULL; error_occur = false; error_pointer = NULL; error_code = PIE_PARSE_WELL_FORMED; }
|
||||||
};
|
};
|
||||||
@@ -65,7 +65,7 @@ struct DISP_OPT
|
|||||||
{
|
{
|
||||||
bool newline; // newline when new tag
|
bool newline; // newline when new tag
|
||||||
bool reference_value; // do convert from entity to reference ( < -> < )
|
bool reference_value; // do convert from entity to reference ( < -> < )
|
||||||
CString stylesheet; // empty string = no stylesheet
|
RString stylesheet; // empty string = no stylesheet
|
||||||
bool write_tabs; // if false, don't write tab indent characters
|
bool write_tabs; // if false, don't write tab indent characters
|
||||||
|
|
||||||
int tab_base; // internal usage
|
int tab_base; // internal usage
|
||||||
@@ -83,12 +83,12 @@ struct DISP_OPT
|
|||||||
class XNode
|
class XNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CString m_sName; // a duplicate of the m_sName in the parent's map
|
RString m_sName; // a duplicate of the m_sName in the parent's map
|
||||||
CString m_sValue;
|
RString m_sValue;
|
||||||
XNodes m_childs; // child node
|
XNodes m_childs; // child node
|
||||||
XAttrs m_attrs; // attributes
|
XAttrs m_attrs; // attributes
|
||||||
|
|
||||||
void GetValue( CString &out ) const;
|
void GetValue( RString &out ) const;
|
||||||
void GetValue( int &out ) const;
|
void GetValue( int &out ) const;
|
||||||
void GetValue( float &out ) const;
|
void GetValue( float &out ) const;
|
||||||
void GetValue( bool &out ) const;
|
void GetValue( bool &out ) const;
|
||||||
@@ -101,50 +101,50 @@ public:
|
|||||||
void SetValue( const DateTime &v );
|
void SetValue( const DateTime &v );
|
||||||
|
|
||||||
// Load/Save XML
|
// Load/Save XML
|
||||||
unsigned Load( const CString &sXml, PARSEINFO *pi, unsigned iOffset = 0 );
|
unsigned Load( const RString &sXml, PARSEINFO *pi, unsigned iOffset = 0 );
|
||||||
unsigned LoadAttributes( const CString &sAttrs, PARSEINFO *pi, unsigned iOffset );
|
unsigned LoadAttributes( const RString &sAttrs, PARSEINFO *pi, unsigned iOffset );
|
||||||
bool GetXML( RageFileBasic &f, DISP_OPT &opt ) const;
|
bool GetXML( RageFileBasic &f, DISP_OPT &opt ) const;
|
||||||
bool GetAttrXML( RageFileBasic &f, DISP_OPT &opt, const CString &sName, const CString &sValue ) const;
|
bool GetAttrXML( RageFileBasic &f, DISP_OPT &opt, const RString &sName, const RString &sValue ) const;
|
||||||
CString GetXML() const;
|
RString GetXML() const;
|
||||||
|
|
||||||
bool SaveToFile( const CString &sFile, DISP_OPT &opt ) const;
|
bool SaveToFile( const RString &sFile, DISP_OPT &opt ) const;
|
||||||
bool SaveToFile( RageFileBasic &f, DISP_OPT &opt ) const;
|
bool SaveToFile( RageFileBasic &f, DISP_OPT &opt ) const;
|
||||||
|
|
||||||
// in own attribute list
|
// in own attribute list
|
||||||
const CString *GetAttr( const CString &sAttrName ) const;
|
const RString *GetAttr( const RString &sAttrName ) const;
|
||||||
CString *GetAttr( const CString &sAttrName );
|
RString *GetAttr( const RString &sAttrName );
|
||||||
bool GetAttrValue( const CString &sName, CString &out ) const;
|
bool GetAttrValue( const RString &sName, RString &out ) const;
|
||||||
bool GetAttrValue( const CString &sName, int &out ) const;
|
bool GetAttrValue( const RString &sName, int &out ) const;
|
||||||
bool GetAttrValue( const CString &sName, float &out ) const;
|
bool GetAttrValue( const RString &sName, float &out ) const;
|
||||||
bool GetAttrValue( const CString &sName, bool &out ) const;
|
bool GetAttrValue( const RString &sName, bool &out ) const;
|
||||||
bool GetAttrValue( const CString &sName, unsigned &out ) const;
|
bool GetAttrValue( const RString &sName, unsigned &out ) const;
|
||||||
bool GetAttrValue( const CString &sName, DateTime &out ) const;
|
bool GetAttrValue( const RString &sName, DateTime &out ) const;
|
||||||
|
|
||||||
// in one level child nodes
|
// in one level child nodes
|
||||||
const XNode *GetChild( const CString &sName ) const;
|
const XNode *GetChild( const RString &sName ) const;
|
||||||
XNode *GetChild( const CString &sName );
|
XNode *GetChild( const RString &sName );
|
||||||
bool GetChildValue( const CString &sName, CString &out ) const { const XNode* pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
bool GetChildValue( const RString &sName, RString &out ) const { const XNode* pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
||||||
bool GetChildValue( const CString &sName, int &out ) const { const XNode* pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
bool GetChildValue( const RString &sName, int &out ) const { const XNode* pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
||||||
bool GetChildValue( const CString &sName, float &out ) const { const XNode* pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
bool GetChildValue( const RString &sName, float &out ) const { const XNode* pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
||||||
bool GetChildValue( const CString &sName, bool &out ) const { const XNode* pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
bool GetChildValue( const RString &sName, bool &out ) const { const XNode* pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
||||||
bool GetChildValue( const CString &sName, unsigned &out ) const { const XNode* pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
bool GetChildValue( const RString &sName, unsigned &out ) const { const XNode* pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
||||||
bool GetChildValue( const CString &sName, DateTime &out ) const { const XNode* pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
bool GetChildValue( const RString &sName, DateTime &out ) const { const XNode* pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetValue(out); return true; }
|
||||||
|
|
||||||
// modify DOM
|
// modify DOM
|
||||||
XNode *AppendChild( const CString &sName = CString(), const CString &value = CString() );
|
XNode *AppendChild( const RString &sName = RString(), const RString &value = RString() );
|
||||||
XNode *AppendChild( const CString &sName, float value );
|
XNode *AppendChild( const RString &sName, float value );
|
||||||
XNode *AppendChild( const CString &sName, int value );
|
XNode *AppendChild( const RString &sName, int value );
|
||||||
XNode *AppendChild( const CString &sName, unsigned value );
|
XNode *AppendChild( const RString &sName, unsigned value );
|
||||||
XNode *AppendChild( const CString &sName, const DateTime &value );
|
XNode *AppendChild( const RString &sName, const DateTime &value );
|
||||||
XNode *AppendChild( XNode *node );
|
XNode *AppendChild( XNode *node );
|
||||||
bool RemoveChild( XNode *node );
|
bool RemoveChild( XNode *node );
|
||||||
|
|
||||||
void AppendAttr( const CString &sName = CString(), const CString &sValue = CString() );
|
void AppendAttr( const RString &sName = RString(), const RString &sValue = RString() );
|
||||||
void AppendAttr( const CString &sName, float value );
|
void AppendAttr( const RString &sName, float value );
|
||||||
void AppendAttr( const CString &sName, int value );
|
void AppendAttr( const RString &sName, int value );
|
||||||
void AppendAttr( const CString &sName, unsigned value );
|
void AppendAttr( const RString &sName, unsigned value );
|
||||||
void AppendAttr( const CString &sName, const DateTime &value );
|
void AppendAttr( const RString &sName, const DateTime &value );
|
||||||
bool RemoveAttr( const CString &sName );
|
bool RemoveAttr( const RString &sName );
|
||||||
|
|
||||||
XNode() { }
|
XNode() { }
|
||||||
XNode( const XNode &cpy );
|
XNode( const XNode &cpy );
|
||||||
|
|||||||
Reference in New Issue
Block a user