diff --git a/stepmania/src/XmlFile.cpp b/stepmania/src/XmlFile.cpp index d756a56d14..b13ec684cc 100644 --- a/stepmania/src/XmlFile.cpp +++ b/stepmania/src/XmlFile.cpp @@ -34,19 +34,19 @@ XENTITYS entityDefault((LPXENTITY)x_EntityTable, sizeof(x_EntityTable)/sizeof(x_ //======================================================== // Name : _tcschrs -// Desc : same with _tcspbrk +// Desc : same with strpbrk // Param : // Return : //-------------------------------------------------------- // Coder Date Desc // bro 2002-10-29 //======================================================== -LPTSTR _tcschrs( LPCTSTR psz, LPCTSTR pszchs ) +char* _tcschrs( const char* psz, const char* pszchs ) { while( psz && *psz ) { if( strchr( pszchs, *psz ) ) - return (LPTSTR)psz; + return (char*)psz; psz++; } return NULL; @@ -61,26 +61,26 @@ LPTSTR _tcschrs( LPCTSTR psz, LPCTSTR pszchs ) // Coder Date Desc // bro 2002-10-29 //======================================================== -LPTSTR _tcsskip( LPCTSTR psz ) +char* _tcsskip( const char* psz ) { while( psz && *psz == ' ' ) psz++; - return (LPTSTR)psz; + return (char*)psz; } //======================================================== // Name : _tcsechr -// Desc : similar with _tcschr with escape process +// Desc : similar with strchr with escape process // Param : escape - will be escape character // Return : //-------------------------------------------------------- // Coder Date Desc // bro 2002-10-29 //======================================================== -LPTSTR _tcsechr( LPCTSTR psz, int ch, int escape ) +char* _tcsechr( const char* psz, int ch, int escape ) { - LPTSTR pch = (LPTSTR)psz; - LPTSTR prev_escape = NULL; + char* pch = (char*)psz; + char* prev_escape = NULL; while( pch && *pch ) { if( *pch == escape && prev_escape == NULL ) @@ -88,7 +88,7 @@ LPTSTR _tcsechr( LPCTSTR psz, int ch, int escape ) else { prev_escape = NULL; - if( *pch == ch ) return (LPTSTR)pch; + if( *pch == ch ) return (char*)pch; } pch++; } @@ -97,19 +97,19 @@ LPTSTR _tcsechr( LPCTSTR psz, int ch, int escape ) //======================================================== // Name : _tcselen -// Desc : similar with _tcslen with escape process +// Desc : similar with strlen with escape process // Param : escape - will be escape character // Return : //-------------------------------------------------------- // Coder Date Desc // bro 2002-10-29 //======================================================== -int _tcselen( int escape, LPTSTR srt, LPTSTR end = NULL ) +int _tcselen( int escape, char* srt, char* end = NULL ) { int len = 0; - LPTSTR pch = srt; - if( end==NULL ) end = (LPTSTR)sizeof(long); - LPTSTR prev_escape = NULL; + char* pch = srt; + if( end==NULL ) end = (char*)sizeof(long); + char* prev_escape = NULL; while( pch && *pch && pchGetBufferSetLength( len ); +// char* pss = ps->GetBufferSetLength( len ); char* szTemp = new char[len]; - _tcsecpy( szTemp, escape, psz, end ); + strlen( szTemp, escape, psz, end ); *ps = szTemp; } else { -// LPTSTR pss = ps->GetBufferSetLength(len + 1 ); +// char* pss = ps->GetBufferSetLength(len + 1 ); char* szTemp = new char[len+1]; memcpy( szTemp, psz, len ); szTemp[len] = '\0'; @@ -261,9 +261,9 @@ void _tagXMLNode::Close() // Coder Date Desc // bro 2002-10-29 //======================================================== -LPTSTR _tagXMLNode::LoadAttributes( LPCTSTR pszAttrs , LPPARSEINFO pi /*= &piDefault*/) +char* _tagXMLNode::LoadAttributes( const char* pszAttrs , LPPARSEINFO pi /*= &piDefault*/) { - LPTSTR xml = (LPTSTR)pszAttrs; + char* xml = (char*)pszAttrs; while( xml && *xml ) { @@ -277,7 +277,7 @@ LPTSTR _tagXMLNode::LoadAttributes( LPCTSTR pszAttrs , LPPARSEINFO pi /*= &piDef return xml; // XML Attr Name - TCHAR* pEnd = _tcspbrk( xml, " =" ); + TCHAR* pEnd = strpbrk( xml, " =" ); if( pEnd == NULL ) { // error @@ -306,7 +306,7 @@ LPTSTR _tagXMLNode::LoadAttributes( LPCTSTR pszAttrs , LPPARSEINFO pi /*= &piDef if( !xml ) continue; - //if( xml = _tcschr( xml, '=' ) ) + //if( xml = strchr( xml, '=' ) ) if( *xml == '=' ) { xml = _tcsskip( ++xml ); @@ -358,14 +358,14 @@ LPTSTR _tagXMLNode::LoadAttributes( LPCTSTR pszAttrs , LPPARSEINFO pi /*= &piDef // Coder Date Desc // bro 2002-10-29 //======================================================== -LPTSTR _tagXMLNode::Load( LPCTSTR pszXml, LPPARSEINFO pi /*= &piDefault*/ ) +char* _tagXMLNode::Load( const char* pszXml, LPPARSEINFO pi /*= &piDefault*/ ) { // Close it Close(); - LPTSTR xml = (LPTSTR)pszXml; + char* xml = (char*)pszXml; - xml = _tcschr( xml, chXMLTagOpen ); + xml = strchr( xml, chXMLTagOpen ); if( xml == NULL ) return NULL; @@ -375,7 +375,7 @@ LPTSTR _tagXMLNode::Load( LPCTSTR pszXml, LPPARSEINFO pi /*= &piDefault*/ ) // XML Node Tag Name Open xml++; - TCHAR* pTagEnd = _tcspbrk( xml, " />" ); + TCHAR* pTagEnd = strpbrk( xml, " />" ); _SetString( xml, pTagEnd, &name ); xml = pTagEnd; // Generate XML Attributte List @@ -409,7 +409,7 @@ LPTSTR _tagXMLNode::Load( LPCTSTR pszXml, LPPARSEINFO pi /*= &piDefault*/ ) // ^- current pointer { // text value EֵѴ. - //if( this->value.IsEmpty() || this->value == ("") ) + //if( this->value.empty() || this->value == ("") ) if( XIsEmptyString( value ) ) { // Text Value @@ -445,7 +445,7 @@ LPTSTR _tagXMLNode::Load( LPCTSTR pszXml, LPPARSEINFO pi /*= &piDefault*/ ) node->parent = this; xml = node->Load( xml,pi ); - if( node->name.IsEmpty() == FALSE ) + if( node->name.empty() == false ) { childs.push_back( node ); } @@ -467,7 +467,7 @@ LPTSTR _tagXMLNode::Load( LPCTSTR pszXml, LPPARSEINFO pi /*= &piDefault*/ ) return NULL; CString closename; - TCHAR* pEnd = _tcspbrk( xml, " >" ); + TCHAR* pEnd = strpbrk( xml, " >" ); if( pEnd == NULL ) { if( pi->erorr_occur == false ) @@ -507,7 +507,7 @@ LPTSTR _tagXMLNode::Load( LPCTSTR pszXml, LPPARSEINFO pi /*= &piDefault*/ ) // else ؾϴEƾϴEǽɰ. { - //if( xml && this->value.IsEmpty() && *xml !=chXMLTagOpen ) + //if( xml && this->value.empty() && *xml !=chXMLTagOpen ) if( xml && XIsEmptyString( value ) && *xml !=chXMLTagOpen ) { // Text Value @@ -554,9 +554,9 @@ LPTSTR _tagXMLNode::Load( LPCTSTR pszXml, LPPARSEINFO pi /*= &piDefault*/ ) CString _tagXMLAttr::GetXML( LPDISP_OPT opt /*= &optDefault*/ ) { std::ostringstream os; - //os << (LPCTSTR)name << "='" << (LPCTSTR)value << "' "; - os << (LPCTSTR)name << "='" - << (LPCTSTR)(opt->reference_value&&opt->entitys?opt->entitys->Entity2Ref(value):value) << "' "; + //os << (const char*)name << "='" << (const char*)value << "' "; + os << (const char*)name << "='" + << (const char*)(opt->reference_value&&opt->entitys?opt->entitys->Entity2Ref(value):value) << "' "; return os.str().c_str(); } @@ -583,16 +583,16 @@ CString _tagXMLNode::GetXML( LPDISP_OPT opt /*= &optDefault*/ ) } // GetXML(opt); + os << (const char*)attrs[i]->GetXML(opt); } - if( childs.empty() && value.IsEmpty() ) + if( childs.empty() && value.empty() ) { // alone tag os << "/>"; @@ -607,7 +607,7 @@ CString _tagXMLNode::GetXML( LPDISP_OPT opt /*= &optDefault*/ ) } for( unsigned i = 0 ; i < childs.size(); i++ ) - os << (LPCTSTR)childs[i]->GetXML( opt ); + os << (const char*)childs[i]->GetXML( opt ); // Text Value if( value != ("") ) @@ -619,7 +619,7 @@ CString _tagXMLNode::GetXML( LPDISP_OPT opt /*= &optDefault*/ ) for( int i = 0 ; i < opt->tab_base ; i++) os << '\t'; } - os << (LPCTSTR)(opt->reference_value&&opt->entitys?opt->entitys->Entity2Ref(value):value); + os << (const char*)(opt->reference_value&&opt->entitys?opt->entitys->Entity2Ref(value):value); } // CloseTag @@ -629,7 +629,7 @@ CString _tagXMLNode::GetXML( LPDISP_OPT opt /*= &optDefault*/ ) for( int i = 0 ; i < opt->tab_base-1 ; i++) os << '\t'; } - os << "'; + os << "'; if( opt && opt->newline ) { @@ -650,7 +650,7 @@ CString _tagXMLNode::GetXML( LPDISP_OPT opt /*= &optDefault*/ ) // Coder Date Desc // bro 2002-10-29 //======================================================== -const LPXAttr _tagXMLNode::GetAttr( LPCTSTR attrname ) const +const LPXAttr _tagXMLNode::GetAttr( const char* attrname ) const { for( unsigned i = 0 ; i < attrs.size(); i++ ) { @@ -664,7 +664,7 @@ const LPXAttr _tagXMLNode::GetAttr( LPCTSTR attrname ) const return NULL; } -LPXAttr _tagXMLNode::GetAttr( LPCTSTR attrname ) +LPXAttr _tagXMLNode::GetAttr( const char* attrname ) { for( unsigned i = 0 ; i < attrs.size(); i++ ) { @@ -687,7 +687,7 @@ LPXAttr _tagXMLNode::GetAttr( LPCTSTR attrname ) // Coder Date Desc // bro 2002-10-29 //======================================================== -XAttrs _tagXMLNode::GetAttrs( LPCTSTR name ) +XAttrs _tagXMLNode::GetAttrs( const char* name ) { XAttrs attrs; for( unsigned i = 0 ; i < attrs.size(); i++ ) @@ -711,10 +711,10 @@ XAttrs _tagXMLNode::GetAttrs( LPCTSTR name ) // Coder Date Desc // bro 2002-10-29 //======================================================== -LPCTSTR _tagXMLNode::GetAttrValue( LPCTSTR attrname ) +const char* _tagXMLNode::GetAttrValue( const char* attrname ) { LPXAttr attr = GetAttr( attrname ); - return attr ? (LPCTSTR)attr->value : NULL; + return attr ? (const char*)attr->value : NULL; } XNodes _tagXMLNode::GetChilds() @@ -731,7 +731,7 @@ XNodes _tagXMLNode::GetChilds() // Coder Date Desc // bro 2002-10-29 //======================================================== -XNodes _tagXMLNode::GetChilds( LPCTSTR name ) +XNodes _tagXMLNode::GetChilds( const char* name ) { XNodes nodes; for( unsigned i = 0 ; i < childs.size(); i++ ) @@ -785,7 +785,7 @@ int _tagXMLNode::GetChildCount() // Coder Date Desc // bro 2002-10-29 //======================================================== -LPXNode _tagXMLNode::GetChild( LPCTSTR name ) +LPXNode _tagXMLNode::GetChild( const char* name ) { for( unsigned i = 0 ; i < childs.size(); i++ ) { @@ -799,7 +799,7 @@ LPXNode _tagXMLNode::GetChild( LPCTSTR name ) return NULL; } -const LPXNode _tagXMLNode::GetChild( LPCTSTR name ) const +const LPXNode _tagXMLNode::GetChild( const char* name ) const { for( unsigned i = 0 ; i < childs.size(); i++ ) { @@ -822,22 +822,22 @@ const LPXNode _tagXMLNode::GetChild( LPCTSTR name ) const // Coder Date Desc // bro 2002-10-29 //======================================================== -LPCTSTR _tagXMLNode::GetChildValue( LPCTSTR name ) +const char* _tagXMLNode::GetChildValue( const char* name ) { LPXNode node = GetChild( name ); - return (node != NULL)? (LPCTSTR)node->value : NULL; + return (node != NULL)? (const char*)node->value : NULL; } -LPXAttr _tagXMLNode::GetChildAttr( LPCTSTR name, LPCTSTR attrname ) +LPXAttr _tagXMLNode::GetChildAttr( const char* name, const char* attrname ) { LPXNode node = GetChild(name); return node ? node->GetAttr(attrname) : NULL; } -LPCTSTR _tagXMLNode::GetChildAttrValue( LPCTSTR name, LPCTSTR attrname ) +const char* _tagXMLNode::GetChildAttrValue( const char* name, const char* attrname ) { LPXAttr attr = GetChildAttr( name, attrname ); - return attr ? (LPCTSTR)attr->value : NULL; + return attr ? (const char*)attr->value : NULL; } @@ -870,17 +870,17 @@ XNodes::iterator _tagXMLNode::GetChildIterator( LPXNode node ) // Coder Date Desc // bro 2002-10-29 //======================================================== -LPXNode _tagXMLNode::AppendChild( LPCTSTR name /*= NULL*/, LPCTSTR value /*= NULL*/ ) +LPXNode _tagXMLNode::AppendChild( const char* name /*= NULL*/, const char* value /*= NULL*/ ) { return AppendChild( CreateNode( name, value ) ); } -LPXNode _tagXMLNode::AppendChild( LPCTSTR name /*= NULL*/, float value /*= NULL*/ ) +LPXNode _tagXMLNode::AppendChild( const char* name /*= NULL*/, float value /*= NULL*/ ) { return AppendChild( name, ssprintf("%f",value) ); } -LPXNode _tagXMLNode::AppendChild( LPCTSTR name /*= NULL*/, int value /*= NULL*/ ) +LPXNode _tagXMLNode::AppendChild( const char* name /*= NULL*/, int value /*= NULL*/ ) { return AppendChild( name, ssprintf("%d",value) ); } @@ -1004,7 +1004,7 @@ bool _tagXMLNode::RemoveAttr( LPXAttr attr ) // Coder Date Desc // bro 2002-10-29 //======================================================== -LPXNode _tagXMLNode::CreateNode( LPCTSTR name /*= NULL*/, LPCTSTR value /*= NULL*/ ) +LPXNode _tagXMLNode::CreateNode( const char* name /*= NULL*/, const char* value /*= NULL*/ ) { LPXNode node = new XNode; node->name = name; @@ -1021,7 +1021,7 @@ LPXNode _tagXMLNode::CreateNode( LPCTSTR name /*= NULL*/, LPCTSTR value /*= NULL // Coder Date Desc // bro 2002-10-29 //======================================================== -LPXAttr _tagXMLNode::CreateAttr( LPCTSTR name /*= NULL*/, LPCTSTR value /*= NULL*/ ) +LPXAttr _tagXMLNode::CreateAttr( const char* name /*= NULL*/, const char* value /*= NULL*/ ) { LPXAttr attr = new XAttr; attr->name = name; @@ -1038,13 +1038,13 @@ LPXAttr _tagXMLNode::CreateAttr( LPCTSTR name /*= NULL*/, LPCTSTR value /*= NULL // Coder Date Desc // bro 2002-10-29 //======================================================== -LPXAttr _tagXMLNode::AppendAttr( LPCTSTR name /*= NULL*/, LPCTSTR value /*= NULL*/ ) +LPXAttr _tagXMLNode::AppendAttr( const char* name /*= NULL*/, const char* value /*= NULL*/ ) { return AppendAttr( CreateAttr( name, value ) ); } -LPXAttr _tagXMLNode::AppendAttr( LPCTSTR name, float value ){ return AppendAttr(name,ssprintf("%f",value)); } -LPXAttr _tagXMLNode::AppendAttr( LPCTSTR name, int value ) { return AppendAttr(name,ssprintf("%d",value)); } +LPXAttr _tagXMLNode::AppendAttr( const char* name, float value ){ return AppendAttr(name,ssprintf("%f",value)); } +LPXAttr _tagXMLNode::AppendAttr( const char* name, int value ) { return AppendAttr(name,ssprintf("%d",value)); } //======================================================== // Name : DetachChild @@ -1102,12 +1102,12 @@ LPXENTITY _tagXMLEntitys::GetEntity( int entity ) return NULL; } -LPXENTITY _tagXMLEntitys::GetEntity( LPTSTR entity ) +LPXENTITY _tagXMLEntitys::GetEntity( char* entity ) { for( unsigned i = 0 ; i < size(); i ++ ) { - LPTSTR ref = (LPTSTR)at(i).ref; - LPTSTR ps = entity; + char* ref = (char*)at(i).ref; + char* ps = entity; while( ref && *ref ) if( *ref++ != *ps++ ) break; @@ -1117,20 +1117,20 @@ LPXENTITY _tagXMLEntitys::GetEntity( LPTSTR entity ) return NULL; } -int _tagXMLEntitys::GetEntityCount( LPCTSTR str ) +int _tagXMLEntitys::GetEntityCount( const char* str ) { int nCount = 0; - LPTSTR ps = (LPTSTR)str; + char* ps = (char*)str; while( ps && *ps ) if( GetEntity( *ps++ ) ) nCount ++; return nCount; } -int _tagXMLEntitys::Ref2Entity( LPCTSTR estr, LPTSTR str, int strlen ) +int _tagXMLEntitys::Ref2Entity( const char* estr, char* str, int strlen ) { - LPTSTR pes = (LPTSTR)estr; - LPTSTR ps = str; - LPTSTR ps_end = ps+strlen; + char* pes = (char*)estr; + char* ps = str; + char* ps_end = ps+strlen; while( pes && *pes && ps < ps_end ) { LPXENTITY ent = GetEntity( pes ); @@ -1150,18 +1150,18 @@ int _tagXMLEntitys::Ref2Entity( LPCTSTR estr, LPTSTR str, int strlen ) return ps-str; } -int _tagXMLEntitys::Entity2Ref( LPCTSTR str, LPTSTR estr, int estrlen ) +int _tagXMLEntitys::Entity2Ref( const char* str, char* estr, int estrlen ) { - LPTSTR ps = (LPTSTR)str; - LPTSTR pes = (LPTSTR)estr; - LPTSTR pes_end = pes+estrlen; + char* ps = (char*)str; + char* pes = (char*)estr; + char* pes_end = pes+estrlen; while( ps && *ps && pes < pes_end ) { LPXENTITY ent = GetEntity( *ps ); if( ent ) { // copy entity string - LPTSTR ref = (LPTSTR)ent->ref; + char* ref = (char*)ent->ref; while( ref && *ref ) *pes++ = *ref++; } @@ -1175,13 +1175,13 @@ int _tagXMLEntitys::Entity2Ref( LPCTSTR str, LPTSTR estr, int estrlen ) return pes-estr; } -CString _tagXMLEntitys::Ref2Entity( LPCTSTR estr ) +CString _tagXMLEntitys::Ref2Entity( const char* estr ) { CString es; if( estr ) { - int len = _tcslen(estr); -// LPTSTR esbuf = es.GetBufferSetLength( len+1 ); + int len = strlen(estr); +// char* esbuf = es.GetBufferSetLength( len+1 ); char* szTemp = new char[len+1]; if( szTemp ) Ref2Entity( estr, szTemp, len ); @@ -1190,7 +1190,7 @@ CString _tagXMLEntitys::Ref2Entity( LPCTSTR estr ) return es; } -CString _tagXMLEntitys::Entity2Ref( LPCTSTR str ) +CString _tagXMLEntitys::Entity2Ref( const char* str ) { CString s; if( str ) @@ -1198,8 +1198,8 @@ CString _tagXMLEntitys::Entity2Ref( LPCTSTR str ) int nEntityCount = GetEntityCount(str); if( nEntityCount == 0 ) return CString(str); - int len = _tcslen(str) + nEntityCount*10 ; - //LPTSTR sbuf = s.GetBufferSetLength( len+1 ); + int len = strlen(str) + nEntityCount*10 ; + //char* sbuf = s.GetBufferSetLength( len+1 ); char* szTemp = new char[len+1]; if( szTemp ) Entity2Ref( str, szTemp, len ); @@ -1208,12 +1208,12 @@ CString _tagXMLEntitys::Entity2Ref( LPCTSTR str ) return s; } -CString XRef2Entity( LPCTSTR estr ) +CString XRef2Entity( const char* estr ) { return entityDefault.Ref2Entity( estr ); } -CString XEntity2Ref( LPCTSTR str ) +CString XEntity2Ref( const char* str ) { return entityDefault.Entity2Ref( str ); } diff --git a/stepmania/src/XmlFile.h b/stepmania/src/XmlFile.h index 54941aa3e3..1d052d4ea5 100644 --- a/stepmania/src/XmlFile.h +++ b/stepmania/src/XmlFile.h @@ -22,19 +22,6 @@ #include #include -// TCHAR defines -#define LPTSTR char* -#define LPCTSTR const char* -#define _tcschr strchr -#ifndef FALSE -# define FALSE false -#endif -#define _istspace isspace -#define _tcspbrk strpbrk -#define IsEmpty empty -#define _tcslen strlen -#define _tcsecpy strlen - struct _tagXMLAttr; typedef _tagXMLAttr XAttr, *LPXAttr; typedef std::vector XAttrs; @@ -53,19 +40,19 @@ typedef struct _tagXmlEntity typedef struct _tagXMLEntitys : public std::vector { LPXENTITY GetEntity( int entity ); - LPXENTITY GetEntity( LPTSTR entity ); - int GetEntityCount( LPCTSTR str ); - int Ref2Entity( LPCTSTR estr, LPTSTR str, int strlen ); - int Entity2Ref( LPCTSTR str, LPTSTR estr, int estrlen ); - CString Ref2Entity( LPCTSTR estr ); - CString Entity2Ref( LPCTSTR str ); + LPXENTITY GetEntity( char* entity ); + int GetEntityCount( const char* str ); + int Ref2Entity( const char* estr, char* str, int strlen ); + int Entity2Ref( const char* str, char* estr, int estrlen ); + CString Ref2Entity( const char* estr ); + CString Entity2Ref( const char* str ); _tagXMLEntitys(){}; _tagXMLEntitys( LPXENTITY entities, int count ); }XENTITYS,*LPXENTITYS; extern XENTITYS entityDefault; -CString XRef2Entity( LPCTSTR estr ); -CString XEntity2Ref( LPCTSTR str ); +CString XRef2Entity( const char* estr ); +CString XEntity2Ref( const char* str ); typedef enum { @@ -84,9 +71,9 @@ typedef struct _tagParseInfo LPXENTITYS entitys; // [set] entity table for entity decode TCHAR escape_value; // [set] escape value (default '\\') - LPTSTR xml; // [get] xml source + char* xml; // [get] xml source bool erorr_occur; // [get] is occurance of error? - LPTSTR error_pointer; // [get] error position of xml source + char* error_pointer; // [get] error position of xml source PCODE error_code; // [get] error code CString error_string; // [get] error string @@ -138,45 +125,45 @@ typedef struct _tagXMLNode XAttrs attrs; // attributes // Load/Save XML - LPTSTR Load( LPCTSTR pszXml, LPPARSEINFO pi = &piDefault ); - LPTSTR LoadAttributes( LPCTSTR pszAttrs, LPPARSEINFO pi = &piDefault ); + char* Load( const char* pszXml, LPPARSEINFO pi = &piDefault ); + char* LoadAttributes( const char* pszAttrs, LPPARSEINFO pi = &piDefault ); CString GetXML( LPDISP_OPT opt = &optDefault ); bool LoadFromFile( CString sFile, LPPARSEINFO pi = &piDefault ); bool SaveToFile( CString sFile, LPDISP_OPT opt = &optDefault ); // in own attribute list - const LPXAttr GetAttr( LPCTSTR attrname ) const; - LPXAttr GetAttr( LPCTSTR attrname ); - LPCTSTR GetAttrValue( LPCTSTR attrname ); - bool GetAttrValue(LPCTSTR name,CString &out) const { const XAttr* pAttr=GetAttr(name); if(pAttr==NULL) return false; pAttr->GetValue(out); return true; } - bool GetAttrValue(LPCTSTR name,int &out) const { const XAttr* pAttr=GetAttr(name); if(pAttr==NULL) return false; pAttr->GetValue(out); return true; } - bool GetAttrValue(LPCTSTR name,float &out) const { const XAttr* pAttr=GetAttr(name); if(pAttr==NULL) return false; pAttr->GetValue(out); return true; } - bool GetAttrValue(LPCTSTR name,bool &out) const { const XAttr* pAttr=GetAttr(name); if(pAttr==NULL) return false; pAttr->GetValue(out); return true; } - XAttrs GetAttrs( LPCTSTR name ); + const LPXAttr GetAttr( const char* attrname ) const; + LPXAttr GetAttr( const char* attrname ); + const char* GetAttrValue( const char* attrname ); + bool GetAttrValue(const char* name,CString &out) const { const XAttr* pAttr=GetAttr(name); if(pAttr==NULL) return false; pAttr->GetValue(out); return true; } + bool GetAttrValue(const char* name,int &out) const { const XAttr* pAttr=GetAttr(name); if(pAttr==NULL) return false; pAttr->GetValue(out); return true; } + bool GetAttrValue(const char* name,float &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; } + XAttrs GetAttrs( const char* name ); // in one level child nodes - const LPXNode GetChild( LPCTSTR name ) const; - LPXNode GetChild( LPCTSTR name ); - LPCTSTR GetChildValue( LPCTSTR name ); - bool GetChildValue(LPCTSTR name,CString &out) const { const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; } - bool GetChildValue(LPCTSTR name,int &out) const { const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; } - bool GetChildValue(LPCTSTR name,float &out) const { const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; } - bool GetChildValue(LPCTSTR name,bool &out) const { const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; } - XNodes GetChilds( LPCTSTR name ); + const LPXNode GetChild( const char* name ) const; + LPXNode GetChild( const char* name ); + const char* GetChildValue( const char* name ); + bool GetChildValue(const char* name,CString &out) const { const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; } + bool GetChildValue(const char* name,int &out) const { const XNode* pChild=GetChild(name); if(pChild==NULL) return false; pChild->GetValue(out); return true; } + bool GetChildValue(const char* name,float &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; } + XNodes GetChilds( const char* name ); XNodes GetChilds(); - LPXAttr GetChildAttr( LPCTSTR name, LPCTSTR attrname ); - LPCTSTR GetChildAttrValue( LPCTSTR name, LPCTSTR attrname ); + LPXAttr GetChildAttr( const char* name, const char* attrname ); + const char* GetChildAttrValue( const char* name, const char* attrname ); // modify DOM int GetChildCount(); LPXNode GetChild( int i ); XNodes::iterator GetChildIterator( LPXNode node ); - LPXNode CreateNode( LPCTSTR name = NULL, LPCTSTR value = NULL ); - LPXNode AppendChild( LPCTSTR name = NULL, LPCTSTR value = NULL ); - LPXNode AppendChild( LPCTSTR name, float value ); - LPXNode AppendChild( LPCTSTR name, int value ); + LPXNode CreateNode( const char* name = NULL, const char* value = NULL ); + LPXNode AppendChild( const char* name = NULL, const char* value = NULL ); + LPXNode AppendChild( const char* name, float value ); + LPXNode AppendChild( const char* name, int value ); LPXNode AppendChild( LPXNode node ); bool RemoveChild( LPXNode node ); LPXNode DetachChild( LPXNode node ); @@ -184,10 +171,10 @@ typedef struct _tagXMLNode LPXAttr GetAttr( int i ); XAttrs::iterator GetAttrIterator( LPXAttr node ); - LPXAttr CreateAttr( LPCTSTR anem = NULL, LPCTSTR value = NULL ); - LPXAttr AppendAttr( LPCTSTR name = NULL, LPCTSTR value = NULL ); - LPXAttr AppendAttr( LPCTSTR name, float value ); - LPXAttr AppendAttr( LPCTSTR name, int value ); + LPXAttr CreateAttr( const char* anem = NULL, const char* value = NULL ); + LPXAttr AppendAttr( const char* name = NULL, const char* value = NULL ); + LPXAttr AppendAttr( const char* name, float value ); + LPXAttr AppendAttr( const char* name, int value ); LPXAttr AppendAttr( LPXAttr attr ); bool RemoveAttr( LPXAttr attr ); LPXAttr DetachAttr( LPXAttr attr ); @@ -202,12 +189,12 @@ typedef struct _tagXMLNode }XNode, *LPXNode; // Helper Funtion -inline long XStr2Int( LPCTSTR str, long default_value = 0 ) +inline long XStr2Int( const char* str, long default_value = 0 ) { return str ? atol(str) : default_value; } -inline bool XIsEmptyString( LPCTSTR str ) +inline bool XIsEmptyString( const char* str ) { CString s(str); TrimLeft( s );