SetValue, etc -> SetTextValue

This commit is contained in:
Glenn Maynard
2007-02-11 06:26:06 +00:00
parent 549ad65b3c
commit fb8e73ac58
7 changed files with 28 additions and 28 deletions
+2 -2
View File
@@ -85,7 +85,7 @@ void Bookkeeper::LoadFromNode( const XNode *pNode )
} }
int iCoins; int iCoins;
day->GetValue( iCoins ); day->GetTextValue( iCoins );
m_mapCoinsForHour[d] = iCoins; m_mapCoinsForHour[d] = iCoins;
} }
@@ -108,7 +108,7 @@ XNode* Bookkeeper::CreateNode() const
pDay->AppendAttr( "Year", d.m_iYear ); pDay->AppendAttr( "Year", d.m_iYear );
int iCoins = it->second; int iCoins = it->second;
pDay->SetValue( iCoins ); pDay->SetTextValue( iCoins );
} }
} }
+2 -2
View File
@@ -54,10 +54,10 @@ void ExportStrings::LuaInformation()
pNode->AppendAttr( "xsi:schemaLocation", "http://www.stepmania.com Lua.xsd" ); pNode->AppendAttr( "xsi:schemaLocation", "http://www.stepmania.com Lua.xsd" );
XNode *pVersionNode = pNode->AppendChild( "Version" ); XNode *pVersionNode = pNode->AppendChild( "Version" );
pVersionNode->SetValue( PRODUCT_ID_VER ); pVersionNode->SetTextValue( PRODUCT_ID_VER );
XNode *pDateNode = pNode->AppendChild( "Date" ); XNode *pDateNode = pNode->AppendChild( "Date" );
pDateNode->SetValue( DateTime::GetNowDate().GetString() ); pDateNode->SetTextValue( DateTime::GetNowDate().GetString() );
XmlFileUtil::SaveToFile( pNode, "Lua.xml", "Lua.xsl" ); XmlFileUtil::SaveToFile( pNode, "Lua.xml", "Lua.xsl" );
+2 -2
View File
@@ -308,12 +308,12 @@ void HighScoreList::LoadFromNode( const XNode* pHighScoreList )
{ {
if( p->GetName() == "NumTimesPlayed" ) if( p->GetName() == "NumTimesPlayed" )
{ {
p->GetValue( iNumTimesPlayed ); p->GetTextValue( iNumTimesPlayed );
} }
else if( p->GetName() == "LastPlayed" ) else if( p->GetName() == "LastPlayed" )
{ {
RString s; RString s;
p->GetValue( s ); p->GetTextValue( s );
dtLastPlayed.FromString( s ); dtLastPlayed.FromString( s );
} }
else if( p->GetName() == "HighScore" ) else if( p->GetName() == "HighScore" )
+4 -4
View File
@@ -1109,7 +1109,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
int iNumPlays = iter->second; int iNumPlays = iter->second;
XNode *pStyleNode = s.CreateNode(); XNode *pStyleNode = s.CreateNode();
pStyleNode->SetValue( iNumPlays ); pStyleNode->SetTextValue( iNumPlays );
pNumSongsPlayedByStyle->AppendChild( pStyleNode ); pNumSongsPlayedByStyle->AppendChild( pStyleNode );
} }
@@ -1242,7 +1242,7 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
{ {
FOREACH_CONST_Child( pDefaultModifiers, game_type ) FOREACH_CONST_Child( pDefaultModifiers, game_type )
{ {
game_type->GetValue( m_sDefaultModifiers[game_type->GetName()] ); game_type->GetTextValue( m_sDefaultModifiers[game_type->GetName()] );
} }
} }
} }
@@ -1282,7 +1282,7 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
if( !s.IsValid() ) if( !s.IsValid() )
WARN_AND_CONTINUE; WARN_AND_CONTINUE;
style->GetValue( m_iNumSongsPlayedByStyle[s] ); style->GetTextValue( m_iNumSongsPlayedByStyle[s] );
} }
} }
} }
@@ -1673,7 +1673,7 @@ void Profile::LoadCalorieDataFromNode( const XNode* pCalorieData )
float fCaloriesBurned = 0; float fCaloriesBurned = 0;
pCaloriesBurned->GetValue(fCaloriesBurned); pCaloriesBurned->GetTextValue(fCaloriesBurned);
m_mapDayToCaloriesBurned[date].fCals = fCaloriesBurned; m_mapDayToCaloriesBurned[date].fCals = fCaloriesBurned;
} }
+1 -1
View File
@@ -191,7 +191,7 @@ bool Workout::LoadFromFile( RString sFile )
if( songGenre->GetName() == "SongGenre" ) if( songGenre->GetName() == "SongGenre" )
{ {
RString s; RString s;
songGenre->GetValue( s ); songGenre->GetTextValue( s );
m_vsSongGenres.push_back( s ); m_vsSongGenres.push_back( s );
} }
} }
+7 -7
View File
@@ -92,14 +92,14 @@ public:
void SetName( const RString &sName ) { m_sName = sName; } void SetName( const RString &sName ) { m_sName = sName; }
const RString &GetName() const { return m_sName; } const RString &GetName() const { return m_sName; }
const XNodeValue *GetValue() const { return m_pValue; } const XNodeValue *GetTextValue() const { return m_pValue; }
XNodeValue *GetValue() { return m_pValue; } XNodeValue *GetTextValue() { return m_pValue; }
void SetValueFrom( XNodeValue *pValue ) { delete m_pValue; m_pValue = pValue; } void SetTextValueFrom( XNodeValue *pValue ) { delete m_pValue; m_pValue = pValue; }
template <typename T> template <typename T>
void GetValue( T &out ) const { m_pValue->GetValue(out); } void GetTextValue( T &out ) const { m_pValue->GetValue(out); }
template <typename T> template <typename T>
void SetValue( const T val ) { m_pValue->SetValue(val); } void SetTextValue( const T val ) { m_pValue->SetValue(val); }
// in own attribute list // in own attribute list
const XNodeValue *GetAttr( const RString &sAttrName ) const; const XNodeValue *GetAttr( const RString &sAttrName ) const;
@@ -112,12 +112,12 @@ public:
const XNode *GetChild( const RString &sName ) const; const XNode *GetChild( const RString &sName ) const;
XNode *GetChild( const RString &sName ); XNode *GetChild( const RString &sName );
template <typename T> template <typename T>
bool GetChildValue( const RString &sName, T &out ) const { const XNode *pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetValue(out); return true; } bool GetChildValue( const RString &sName, T &out ) const { const XNode *pChild=GetChild(sName); if(pChild==NULL) return false; pChild->GetTextValue(out); return true; }
bool PushChildValue( lua_State *L, const RString &sName ) const; bool PushChildValue( lua_State *L, const RString &sName ) const;
// modify DOM // modify DOM
template <typename T> template <typename T>
XNode *AppendChild( const RString &sName, T value ) { XNode *p=new XNode(sName); p->SetValue(value); return AppendChild(p); } XNode *AppendChild( const RString &sName, T value ) { XNode *p=new XNode(sName); p->SetTextValue(value); return AppendChild(p); }
XNode *AppendChild( const RString &sName ) { XNode *p=new XNode(sName); return AppendChild(p); } XNode *AppendChild( const RString &sName ) { XNode *p=new XNode(sName); return AppendChild(p); }
XNode *AppendChild( XNode *node ); XNode *AppendChild( XNode *node );
bool RemoveChild( XNode *node, bool bDelete = true ); bool RemoveChild( XNode *node, bool bDelete = true );
+10 -10
View File
@@ -293,7 +293,7 @@ unsigned LoadInternal( XNode *pNode, const RString &xml, RString &sErrorOut, uns
// open/close tag <TAG ..> ... </TAG> // open/close tag <TAG ..> ... </TAG>
// ^- current pointer // ^- current pointer
if( XIsEmptyString(pNode->GetValue()->GetValue<RString>()) ) if( XIsEmptyString(pNode->GetTextValue()->GetValue<RString>()) )
{ {
// Text Value // Text Value
++iOffset; ++iOffset;
@@ -312,7 +312,7 @@ unsigned LoadInternal( XNode *pNode, const RString &xml, RString &sErrorOut, uns
iOffset = iEnd; iOffset = iEnd;
ReplaceEntityText( sValue, g_mapEntitiesToChars ); ReplaceEntityText( sValue, g_mapEntitiesToChars );
pNode->SetValue( sValue ); pNode->SetTextValue( sValue );
} }
// generate child nodes // generate child nodes
@@ -377,7 +377,7 @@ unsigned LoadInternal( XNode *pNode, const RString &xml, RString &sErrorOut, uns
} }
else // Alone child Tag Loaded else // Alone child Tag Loaded
{ {
if( XIsEmptyString(pNode->GetValue()->GetValue<RString>()) && iOffset < xml.size() && xml[iOffset] != chXMLTagOpen ) if( XIsEmptyString(pNode->GetTextValue()->GetValue<RString>()) && iOffset < xml.size() && xml[iOffset] != chXMLTagOpen )
{ {
// Text Value // Text Value
unsigned iEnd = xml.find( chXMLTagOpen, iOffset ); unsigned iEnd = xml.find( chXMLTagOpen, iOffset );
@@ -394,7 +394,7 @@ unsigned LoadInternal( XNode *pNode, const RString &xml, RString &sErrorOut, uns
iOffset = iEnd; iOffset = iEnd;
ReplaceEntityText( sValue, g_mapEntitiesToChars ); ReplaceEntityText( sValue, g_mapEntitiesToChars );
pNode->SetValue( sValue ); pNode->SetTextValue( sValue );
} }
} }
} }
@@ -428,7 +428,7 @@ bool GetXMLInternal( const XNode *pNode, RageFileBasic &f, bool bWriteTabs, int
WRITE( "' " ); WRITE( "' " );
} }
if( pNode->m_childs.empty() && pNode->GetValue()->GetValue<RString>().empty() ) if( pNode->m_childs.empty() && pNode->GetTextValue()->GetValue<RString>().empty() )
{ {
// <TAG Attr1="Val1"/> alone tag // <TAG Attr1="Val1"/> alone tag
WRITE( "/>" ); WRITE( "/>" );
@@ -446,7 +446,7 @@ bool GetXMLInternal( const XNode *pNode, RageFileBasic &f, bool bWriteTabs, int
return false; return false;
// Text Value // Text Value
if( !pNode->GetValue()->GetValue<RString>().empty() ) if( !pNode->GetTextValue()->GetValue<RString>().empty() )
{ {
if( !pNode->m_childs.empty() ) if( !pNode->m_childs.empty() )
{ {
@@ -456,7 +456,7 @@ bool GetXMLInternal( const XNode *pNode, RageFileBasic &f, bool bWriteTabs, int
WRITE( "\t" ); WRITE( "\t" );
} }
RString s; RString s;
pNode->GetValue( s ); pNode->GetTextValue( s );
ReplaceEntityText( s, g_mapCharsToEntities ); ReplaceEntityText( s, g_mapCharsToEntities );
WRITE( s ); WRITE( s );
} }
@@ -617,8 +617,8 @@ void XmlFileUtil::CompileXNodeTree( XNode *pNode, const RString &sFile )
FOREACH_Child( pNode, pChild ) FOREACH_Child( pNode, pChild )
aToCompile.push_back( pChild ); aToCompile.push_back( pChild );
XNodeValue *pValue = CompileXMLNodeValue( L, pNode->GetName(), pNode->GetValue(), sFile ); XNodeValue *pValue = CompileXMLNodeValue( L, pNode->GetName(), pNode->GetTextValue(), sFile );
pNode->SetValueFrom( pValue ); pNode->SetTextValueFrom( pValue );
FOREACH_Attr( pNode, pAttr ) FOREACH_Attr( pNode, pAttr )
{ {
@@ -642,7 +642,7 @@ namespace
XNodeLuaValue *pValue = new XNodeLuaValue; XNodeLuaValue *pValue = new XNodeLuaValue;
lua_pushvalue( L, -1 ); lua_pushvalue( L, -1 );
pValue->SetValueFromStack( L ); pValue->SetValueFromStack( L );
pNode->SetValueFrom( pValue ); pNode->SetTextValueFrom( pValue );
} }
/* Iterate over the table, pulling out attributes and tables to process. */ /* Iterate over the table, pulling out attributes and tables to process. */