use GetName, GetValue

This commit is contained in:
Glenn Maynard
2006-10-02 06:12:42 +00:00
parent cad383b2ab
commit d188c2fd12
15 changed files with 58 additions and 58 deletions
+4 -4
View File
@@ -196,7 +196,7 @@ Actor* ActorUtil::LoadFromNode( const RString& sDir, const XNode* pNode, Actor *
{ {
FOREACH_CONST_Child( pNode, pChild ) FOREACH_CONST_Child( pNode, pChild )
{ {
if( pChild->m_sName == "Param" ) if( pChild->GetName() == "Param" )
{ {
RString sName; RString sName;
if( !pChild->GetAttrValue( "Name", sName ) ) if( !pChild->GetAttrValue( "Name", sName ) )
@@ -220,7 +220,7 @@ Actor* ActorUtil::LoadFromNode( const RString& sDir, const XNode* pNode, Actor *
// Element name is the type in XML. // Element name is the type in XML.
// Type= is the name in INI. // Type= is the name in INI.
// TODO: Remove the backward compat fallback // TODO: Remove the backward compat fallback
RString sClass = pNode->m_sName; RString sClass = pNode->GetName();
bool bHasClass = pNode->GetAttrValue( "Class", sClass ); bool bHasClass = pNode->GetAttrValue( "Class", sClass );
if( !bHasClass ) if( !bHasClass )
bHasClass = pNode->GetAttrValue( "Type", sClass ); // for backward compatibility bHasClass = pNode->GetAttrValue( "Type", sClass ); // for backward compatibility
@@ -316,9 +316,9 @@ static void MergeActorXML( XNode *pChild, const XNode *pParent )
ssprintf( "Overriding \"%s\" (\"%s\") in XML node \"%s\" with \"%s\" in XML node \"%s\"", ssprintf( "Overriding \"%s\" (\"%s\") in XML node \"%s\" with \"%s\" in XML node \"%s\"",
p->first.c_str(), p->first.c_str(),
p->second.c_str(), p->second.c_str(),
pChild->m_sName.c_str(), pChild->GetName().c_str(),
sOld.c_str(), sOld.c_str(),
pParent->m_sName.c_str() ); pParent->GetName().c_str() );
Dialog::OK( sWarning, "XML_ATTRIB_OVERRIDE" ); Dialog::OK( sWarning, "XML_ATTRIB_OVERRIDE" );
} }
pChild->AppendAttr( p->first, p->second ); pChild->AppendAttr( p->first, p->second );
+1 -1
View File
@@ -181,7 +181,7 @@ void BackgroundImpl::Init()
XNode xml; XNode xml;
XmlFileUtil::LoadFromFileShowErrors(xml, sPath); XmlFileUtil::LoadFromFileShowErrors(xml, sPath);
ASSERT( xml.m_sName == "BackgroundTransition" ); ASSERT( xml.GetName() == "BackgroundTransition" );
BackgroundTransition &bgt = m_mapNameToTransition[sName]; BackgroundTransition &bgt = m_mapNameToTransition[sName];
RString sCmdLeaves; RString sCmdLeaves;
+1 -1
View File
@@ -70,7 +70,7 @@ void BannerCache::Demand()
FOREACH_Child( &BannerData, p ) FOREACH_Child( &BannerData, p )
{ {
RString sBannerPath = p->m_sName; RString sBannerPath = p->GetName();
if( g_BannerPathToImage.find(sBannerPath) != g_BannerPathToImage.end() ) if( g_BannerPathToImage.find(sBannerPath) != g_BannerPathToImage.end() )
continue; /* already loaded */ continue; /* already loaded */
+1 -1
View File
@@ -113,7 +113,7 @@ void BitmapText::LoadFromNode( const RString& sDir, const XNode* pNode )
if( sFont == "" ) if( sFont == "" )
RageException::Throw( "An object \"%s\" in \"%s\" is missing the Font attribute.", RageException::Throw( "An object \"%s\" in \"%s\" is missing the Font attribute.",
pNode->m_sName.c_str(), sDir.c_str() ); pNode->GetName().c_str(), sDir.c_str() );
LoadFromFont( THEME->GetPathF( "", sFont ) ); LoadFromFont( THEME->GetPathF( "", sFont ) );
SetText( sText, sAltText ); SetText( sText, sAltText );
+2 -2
View File
@@ -60,9 +60,9 @@ void Bookkeeper::Date::Set( tm pTime )
void Bookkeeper::LoadFromNode( const XNode *pNode ) void Bookkeeper::LoadFromNode( const XNode *pNode )
{ {
if( pNode->m_sName != "Bookkeeping" ) if( pNode->GetName() != "Bookkeeping" )
{ {
LOG->Warn( "Error loading bookkeeping: unexpected \"%s\"", pNode->m_sName.c_str() ); LOG->Warn( "Error loading bookkeeping: unexpected \"%s\"", pNode->GetName().c_str() );
return; return;
} }
+1 -1
View File
@@ -388,7 +388,7 @@ XNode* CourseID::CreateNode() const
void CourseID::LoadFromNode( const XNode* pNode ) void CourseID::LoadFromNode( const XNode* pNode )
{ {
ASSERT( pNode->m_sName == "Course" ); ASSERT( pNode->GetName() == "Course" );
pNode->GetAttrValue("Path", sPath); pNode->GetAttrValue("Path", sPath);
pNode->GetAttrValue("FullTitle", sFullTitle); pNode->GetAttrValue("FullTitle", sFullTitle);
} }
+6 -6
View File
@@ -108,7 +108,7 @@ XNode *HighScoreImpl::CreateNode() const
void HighScoreImpl::LoadFromNode( const XNode *pNode ) void HighScoreImpl::LoadFromNode( const XNode *pNode )
{ {
ASSERT( pNode->m_sName == "HighScore" ); ASSERT( pNode->GetName() == "HighScore" );
RString s; RString s;
@@ -301,18 +301,18 @@ void HighScoreList::LoadFromNode( const XNode* pHighScoreList )
{ {
Init(); Init();
ASSERT( pHighScoreList->m_sName == "HighScoreList" ); ASSERT( pHighScoreList->GetName() == "HighScoreList" );
FOREACH_CONST_Child( pHighScoreList, p ) FOREACH_CONST_Child( pHighScoreList, p )
{ {
if( p->m_sName == "NumTimesPlayed" ) if( p->GetName() == "NumTimesPlayed" )
{ {
p->GetValue( iNumTimesPlayed ); p->GetValue( iNumTimesPlayed );
} }
else if( p->m_sName == "LastPlayed" ) else if( p->GetName() == "LastPlayed" )
{ {
p->GetValue( dtLastPlayed ); p->GetValue( dtLastPlayed );
} }
else if( p->m_sName == "HighScore" ) else if( p->GetName() == "HighScore" )
{ {
vHighScores.resize( vHighScores.size()+1 ); vHighScores.resize( vHighScores.size()+1 );
vHighScores.back().LoadFromNode( p ); vHighScores.back().LoadFromNode( p );
@@ -362,7 +362,7 @@ XNode* Screenshot::CreateNode() const
void Screenshot::LoadFromNode( const XNode* pNode ) void Screenshot::LoadFromNode( const XNode* pNode )
{ {
ASSERT( pNode->m_sName == "Screenshot" ); ASSERT( pNode->GetName() == "Screenshot" );
pNode->GetChildValue( "FileName", sFileName ); pNode->GetChildValue( "FileName", sFileName );
pNode->GetChildValue( "MD5", sMD5 ); pNode->GetChildValue( "MD5", sMD5 );
+1 -1
View File
@@ -89,7 +89,7 @@ bool IniFile::WriteFile( RageFileBasic &f ) const
{ {
FOREACH_CONST_Child( this, pKey ) FOREACH_CONST_Child( this, pKey )
{ {
if( f.PutLine( ssprintf("[%s]", pKey->m_sName.c_str()) ) == -1 ) if( f.PutLine( ssprintf("[%s]", pKey->GetName().c_str()) ) == -1 )
{ {
m_sError = f.GetError(); m_sError = f.GetError();
return false; return false;
+5 -5
View File
@@ -469,15 +469,15 @@ void PrefsManager::ReadGamePrefsFromIni( const RString &sIni )
FOREACH_CONST_Child( &ini, section ) FOREACH_CONST_Child( &ini, section )
{ {
if( !BeginsWith(section->m_sName, GAME_SECTION_PREFIX) ) if( !BeginsWith(section->GetName(), GAME_SECTION_PREFIX) )
continue; continue;
RString sGame = section->m_sName.Right( section->m_sName.length() - GAME_SECTION_PREFIX.length() ); RString sGame = section->GetName().Right( section->GetName().length() - GAME_SECTION_PREFIX.length() );
GamePrefs &gp = m_mapGameNameToGamePrefs[ sGame ]; GamePrefs &gp = m_mapGameNameToGamePrefs[ sGame ];
ini.GetValue( section->m_sName, "Announcer", gp.m_sAnnouncer ); ini.GetValue( section->GetName(), "Announcer", gp.m_sAnnouncer );
ini.GetValue( section->m_sName, "Theme", gp.m_sTheme ); ini.GetValue( section->GetName(), "Theme", gp.m_sTheme );
ini.GetValue( section->m_sName, "DefaultModifiers", gp.m_sDefaultModifiers ); ini.GetValue( section->GetName(), "DefaultModifiers", gp.m_sDefaultModifiers );
} }
} }
+29 -29
View File
@@ -856,12 +856,12 @@ ProfileLoadResult Profile::LoadStatsXmlFromNode( const XNode *xml, bool bIgnoreE
{ {
/* The placeholder stats.xml file has an <html> tag. Don't load it, but don't /* The placeholder stats.xml file has an <html> tag. Don't load it, but don't
* warn about it. */ * warn about it. */
if( xml->m_sName == "html" ) if( xml->GetName() == "html" )
return ProfileLoadResult_FailedNoProfile; return ProfileLoadResult_FailedNoProfile;
if( xml->m_sName != "Stats" ) if( xml->GetName() != "Stats" )
{ {
WARN_M( xml->m_sName ); WARN_M( xml->GetName() );
return ProfileLoadResult_FailedTampered; return ProfileLoadResult_FailedTampered;
} }
@@ -1141,7 +1141,7 @@ ProfileLoadResult Profile::LoadEditableDataFromDir( RString sDir )
void Profile::LoadGeneralDataFromNode( const XNode* pNode ) void Profile::LoadGeneralDataFromNode( const XNode* pNode )
{ {
ASSERT( pNode->m_sName == "GeneralData" ); ASSERT( pNode->GetName() == "GeneralData" );
RString s; RString s;
const XNode* pTemp; const XNode* pTemp;
@@ -1183,7 +1183,7 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
{ {
FOREACH_CONST_Child( pDefaultModifiers, game_type ) FOREACH_CONST_Child( pDefaultModifiers, game_type )
{ {
m_sDefaultModifiers[game_type->m_sName] = game_type->m_sValue; m_sDefaultModifiers[game_type->GetName()] = game_type->GetValue();
} }
} }
} }
@@ -1214,7 +1214,7 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
{ {
FOREACH_CONST_Child( pNumSongsPlayedByStyle, style ) FOREACH_CONST_Child( pNumSongsPlayedByStyle, style )
{ {
if( style->m_sName != "Style" ) if( style->GetName() != "Style" )
continue; continue;
StyleID s; StyleID s;
@@ -1324,11 +1324,11 @@ void Profile::LoadSongScoresFromNode( const XNode* pSongScores )
{ {
CHECKPOINT; CHECKPOINT;
ASSERT( pSongScores->m_sName == "SongScores" ); ASSERT( pSongScores->GetName() == "SongScores" );
FOREACH_CONST_Child( pSongScores, pSong ) FOREACH_CONST_Child( pSongScores, pSong )
{ {
if( pSong->m_sName != "Song" ) if( pSong->GetName() != "Song" )
continue; continue;
SongID songID; SongID songID;
@@ -1338,7 +1338,7 @@ void Profile::LoadSongScoresFromNode( const XNode* pSongScores )
FOREACH_CONST_Child( pSong, pSteps ) FOREACH_CONST_Child( pSong, pSteps )
{ {
if( pSteps->m_sName != "Steps" ) if( pSteps->GetName() != "Steps" )
continue; continue;
StepsID stepsID; StepsID stepsID;
@@ -1401,14 +1401,14 @@ void Profile::LoadCourseScoresFromNode( const XNode* pCourseScores )
{ {
CHECKPOINT; CHECKPOINT;
ASSERT( pCourseScores->m_sName == "CourseScores" ); ASSERT( pCourseScores->GetName() == "CourseScores" );
vector<Course*> vpAllCourses; vector<Course*> vpAllCourses;
SONGMAN->GetAllCourses( vpAllCourses, true ); SONGMAN->GetAllCourses( vpAllCourses, true );
FOREACH_CONST_Child( pCourseScores, pCourse ) FOREACH_CONST_Child( pCourseScores, pCourse )
{ {
if( pCourse->m_sName != "Course" ) if( pCourse->GetName() != "Course" )
continue; continue;
CourseID courseID; CourseID courseID;
@@ -1447,7 +1447,7 @@ void Profile::LoadCourseScoresFromNode( const XNode* pCourseScores )
FOREACH_CONST_Child( pCourse, pTrail ) FOREACH_CONST_Child( pCourse, pTrail )
{ {
if( pTrail->m_sName != "Trail" ) if( pTrail->GetName() != "Trail" )
continue; continue;
TrailID trailID; TrailID trailID;
@@ -1505,11 +1505,11 @@ void Profile::LoadCategoryScoresFromNode( const XNode* pCategoryScores )
{ {
CHECKPOINT; CHECKPOINT;
ASSERT( pCategoryScores->m_sName == "CategoryScores" ); ASSERT( pCategoryScores->GetName() == "CategoryScores" );
FOREACH_CONST_Child( pCategoryScores, pStepsType ) FOREACH_CONST_Child( pCategoryScores, pStepsType )
{ {
if( pStepsType->m_sName != "StepsType" ) if( pStepsType->GetName() != "StepsType" )
continue; continue;
RString str; RString str;
@@ -1521,7 +1521,7 @@ void Profile::LoadCategoryScoresFromNode( const XNode* pCategoryScores )
FOREACH_CONST_Child( pStepsType, pRadarCategory ) FOREACH_CONST_Child( pStepsType, pRadarCategory )
{ {
if( pRadarCategory->m_sName != "RankingCategory" ) if( pRadarCategory->GetName() != "RankingCategory" )
continue; continue;
if( !pRadarCategory->GetAttrValue( "Type", str ) ) if( !pRadarCategory->GetAttrValue( "Type", str ) )
@@ -1565,11 +1565,11 @@ void Profile::LoadScreenshotDataFromNode( const XNode* pScreenshotData )
{ {
CHECKPOINT; CHECKPOINT;
ASSERT( pScreenshotData->m_sName == "ScreenshotData" ); ASSERT( pScreenshotData->GetName() == "ScreenshotData" );
FOREACH_CONST_Child( pScreenshotData, pScreenshot ) FOREACH_CONST_Child( pScreenshotData, pScreenshot )
{ {
if( pScreenshot->m_sName != "Screenshot" ) if( pScreenshot->GetName() != "Screenshot" )
WARN_AND_CONTINUE_M( pScreenshot->m_sName ); WARN_AND_CONTINUE_M( pScreenshot->GetName() );
Screenshot ss; Screenshot ss;
ss.LoadFromNode( pScreenshot ); ss.LoadFromNode( pScreenshot );
@@ -1599,11 +1599,11 @@ void Profile::LoadCalorieDataFromNode( const XNode* pCalorieData )
{ {
CHECKPOINT; CHECKPOINT;
ASSERT( pCalorieData->m_sName == "CalorieData" ); ASSERT( pCalorieData->GetName() == "CalorieData" );
FOREACH_CONST_Child( pCalorieData, pCaloriesBurned ) FOREACH_CONST_Child( pCalorieData, pCaloriesBurned )
{ {
if( pCaloriesBurned->m_sName != "CaloriesBurned" ) if( pCaloriesBurned->GetName() != "CaloriesBurned" )
WARN_AND_CONTINUE_M( pCaloriesBurned->m_sName ); WARN_AND_CONTINUE_M( pCaloriesBurned->GetName() );
RString sDate; RString sDate;
if( !pCaloriesBurned->GetAttrValue("Date",sDate) ) if( !pCaloriesBurned->GetAttrValue("Date",sDate) )
@@ -1664,7 +1664,7 @@ void Profile::HighScoreForASongAndSteps::LoadFromNode( const XNode* pNode )
{ {
Unset(); Unset();
ASSERT( pNode->m_sName == "HighScoreForASongAndSteps" ); ASSERT( pNode->GetName() == "HighScoreForASongAndSteps" );
const XNode* p; const XNode* p;
if( (p = pNode->GetChild("Song")) ) if( (p = pNode->GetChild("Song")) )
songID.LoadFromNode( p ); songID.LoadFromNode( p );
@@ -1678,10 +1678,10 @@ void Profile::LoadRecentSongScoresFromNode( const XNode* pRecentSongScores )
{ {
CHECKPOINT; CHECKPOINT;
ASSERT( pRecentSongScores->m_sName == "RecentSongScores" ); ASSERT( pRecentSongScores->GetName() == "RecentSongScores" );
FOREACH_CONST_Child( pRecentSongScores, p ) FOREACH_CONST_Child( pRecentSongScores, p )
{ {
if( p->m_sName == "HighScoreForASongAndSteps" ) if( p->GetName() == "HighScoreForASongAndSteps" )
{ {
HighScoreForASongAndSteps h; HighScoreForASongAndSteps h;
h.LoadFromNode( p ); h.LoadFromNode( p );
@@ -1690,7 +1690,7 @@ void Profile::LoadRecentSongScoresFromNode( const XNode* pRecentSongScores )
} }
else else
{ {
WARN_AND_CONTINUE_M( p->m_sName ); WARN_AND_CONTINUE_M( p->GetName() );
} }
} }
} }
@@ -1744,7 +1744,7 @@ void Profile::HighScoreForACourseAndTrail::LoadFromNode( const XNode* pNode )
{ {
Unset(); Unset();
ASSERT( pNode->m_sName == "HighScoreForACourseAndTrail" ); ASSERT( pNode->GetName() == "HighScoreForACourseAndTrail" );
const XNode* p; const XNode* p;
if( (p = pNode->GetChild("Course")) ) if( (p = pNode->GetChild("Course")) )
courseID.LoadFromNode( p ); courseID.LoadFromNode( p );
@@ -1758,10 +1758,10 @@ void Profile::LoadRecentCourseScoresFromNode( const XNode* pRecentCourseScores )
{ {
CHECKPOINT; CHECKPOINT;
ASSERT( pRecentCourseScores->m_sName == "RecentCourseScores" ); ASSERT( pRecentCourseScores->GetName() == "RecentCourseScores" );
FOREACH_CONST_Child( pRecentCourseScores, p ) FOREACH_CONST_Child( pRecentCourseScores, p )
{ {
if( p->m_sName == "HighScoreForACourseAndTrail" ) if( p->GetName() == "HighScoreForACourseAndTrail" )
{ {
HighScoreForACourseAndTrail h; HighScoreForACourseAndTrail h;
h.LoadFromNode( p ); h.LoadFromNode( p );
@@ -1770,7 +1770,7 @@ void Profile::LoadRecentCourseScoresFromNode( const XNode* pRecentCourseScores )
} }
else else
{ {
WARN_AND_CONTINUE_M( p->m_sName ); WARN_AND_CONTINUE_M( p->GetName() );
} }
} }
} }
+1 -1
View File
@@ -49,7 +49,7 @@ XNode* RadarValues::CreateNode() const
void RadarValues::LoadFromNode( const XNode* pNode ) void RadarValues::LoadFromNode( const XNode* pNode )
{ {
ASSERT( pNode->m_sName == "RadarValues" ); ASSERT( pNode->GetName() == "RadarValues" );
Zero(); Zero();
+1 -1
View File
@@ -848,7 +848,7 @@ XNode* SongID::CreateNode() const
void SongID::LoadFromNode( const XNode* pNode ) void SongID::LoadFromNode( const XNode* pNode )
{ {
ASSERT( pNode->m_sName == "Song" ); ASSERT( pNode->GetName() == "Song" );
pNode->GetAttrValue("Dir", sDir); pNode->GetAttrValue("Dir", sDir);
} }
+1 -1
View File
@@ -281,7 +281,7 @@ void StepsID::ClearCache()
void StepsID::LoadFromNode( const XNode* pNode ) void StepsID::LoadFromNode( const XNode* pNode )
{ {
ASSERT( pNode->m_sName == "Steps" ); ASSERT( pNode->GetName() == "Steps" );
RString sTemp; RString sTemp;
+1 -1
View File
@@ -42,7 +42,7 @@ XNode* StyleID::CreateNode() const
void StyleID::LoadFromNode( const XNode* pNode ) void StyleID::LoadFromNode( const XNode* pNode )
{ {
Unset(); Unset();
ASSERT( pNode->m_sName == "Style" ); ASSERT( pNode->GetName() == "Style" );
sGame = ""; sGame = "";
pNode->GetAttrValue("Game", sGame); pNode->GetAttrValue("Game", sGame);
+3 -3
View File
@@ -157,7 +157,7 @@ bool Workout::LoadFromFile( RString sFile )
{ {
XNode xml; XNode xml;
XmlFileUtil::LoadFromFileShowErrors( xml, sFile ); XmlFileUtil::LoadFromFileShowErrors( xml, sFile );
if( xml.m_sName != "Workout" ) if( xml.GetName() != "Workout" )
return false; return false;
m_sFile = sFile; m_sFile = sFile;
@@ -187,8 +187,8 @@ bool Workout::LoadFromFile( RString sFile )
{ {
FOREACH_CONST_Child( songGenres, songGenre ) FOREACH_CONST_Child( songGenres, songGenre )
{ {
if( songGenre->m_sName == "SongGenre" ) if( songGenre->GetName() == "SongGenre" )
m_vsSongGenres.push_back( songGenre->m_sValue ); m_vsSongGenres.push_back( songGenre->GetValue() );
} }
} }
return true; return true;