Remove global "using namespace std;" declarations, use "std::" prefixes on all std elements

Fix whitespace changes
This commit is contained in:
Michael Sundqvist
2022-07-31 22:14:38 +02:00
committed by Martin Natano
parent f0680a29fc
commit 0cba3579de
534 changed files with 3456 additions and 3488 deletions
+68 -68
View File
@@ -190,7 +190,7 @@ void Song::AddBackgroundChange( BackgroundLayer iLayer, BackgroundChange seg )
{
// Delete old background change at this start beat, if any.
auto &changes = GetBackgroundChanges(iLayer);
for (vector<BackgroundChange>::iterator bgc = changes.begin(); bgc != changes.end(); ++bgc)
for (std::vector<BackgroundChange>::iterator bgc = changes.begin(); bgc != changes.end(); ++bgc)
{
if( bgc->m_fStartBeat == seg.m_fStartBeat )
{
@@ -271,7 +271,7 @@ const RString &Song::GetSongFilePath() const
/* Hack: This should be a parameter to TidyUpData, but I don't want to pull in
* <set> into Song.h, which is heavily used. */
static set<RString> BlacklistedImages;
static std::set<RString> BlacklistedImages;
/* If PREFSMAN->m_bFastLoad is true, always load from cache if possible.
* Don't read the contents of sDir if we can avoid it. That means we can't call
@@ -295,7 +295,7 @@ bool Song::LoadFromSongDir(RString sDir, bool load_autosave, ProfileSlot from_pr
// save group name
if(from_profile == ProfileSlot_Invalid)
{
vector<RString> sDirectoryParts;
std::vector<RString> sDirectoryParts;
split( m_sSongDir, "/", sDirectoryParts, false );
ASSERT( sDirectoryParts.size() >= 4 ); /* e.g. "/Songs/Slow/Taps/" */
m_sGroupName = sDirectoryParts[sDirectoryParts.size()-3]; // second from last item
@@ -356,7 +356,7 @@ bool Song::LoadFromSongDir(RString sDir, bool load_autosave, ProfileSlot from_pr
{
LOG->UserLog( "Song", sDir, "has no SSC, SM, SMA, DWI, BMS, or KSF files." );
vector<RString> audios;
std::vector<RString> audios;
FILEMAN->GetDirListingWithMultipleExtensions(sDir,
ActorUtil::GetTypeExtensionList(FT_Sound), audios);
bool has_music = !audios.empty();
@@ -367,7 +367,7 @@ bool Song::LoadFromSongDir(RString sDir, bool load_autosave, ProfileSlot from_pr
return false;
}
// Make sure we have a future filename figured out.
vector<RString> folders;
std::vector<RString> folders;
split(sDir, "/", folders);
RString songName = folders[2] + ".ssc";
this->m_sSongFileName = sDir + songName;
@@ -462,7 +462,7 @@ bool Song::ReloadFromSongDir( RString sDir )
FILEMAN->Remove(GetCacheFilePath());
RemoveAutoGenNotes();
vector<Steps*> vOldSteps = m_vpSteps;
std::vector<Steps*> vOldSteps = m_vpSteps;
Song copy;
if( !copy.LoadFromSongDir( sDir ) )
@@ -473,8 +473,8 @@ bool Song::ReloadFromSongDir( RString sDir )
/* Go through the steps, first setting their Song pointer to this song
* (instead of the copy used above), and constructing a map to let us
* easily find the new steps. */
map<StepsID, Steps*> mNewSteps;
for( vector<Steps*>::const_iterator it = m_vpSteps.begin(); it != m_vpSteps.end(); ++it )
std::map<StepsID, Steps*> mNewSteps;
for( std::vector<Steps*>::const_iterator it = m_vpSteps.begin(); it != m_vpSteps.end(); ++it )
{
(*it)->m_pSong = this;
@@ -495,11 +495,11 @@ bool Song::ReloadFromSongDir( RString sDir )
* We have to go through these hoops because many places assume the Steps
* pointers don't change - even though there are other ways they can change,
* such as deleting a Steps via the editor. */
for( vector<Steps*>::const_iterator itOld = vOldSteps.begin(); itOld != vOldSteps.end(); ++itOld )
for( std::vector<Steps*>::const_iterator itOld = vOldSteps.begin(); itOld != vOldSteps.end(); ++itOld )
{
StepsID id;
id.FromSteps( *itOld );
map<StepsID, Steps*>::iterator itNew = mNewSteps.find( id );
std::map<StepsID, Steps*>::iterator itNew = mNewSteps.find( id );
if( itNew == mNewSteps.end() )
{
// This stepchart didn't exist in the file we reverted from
@@ -514,7 +514,7 @@ bool Song::ReloadFromSongDir( RString sDir )
}
}
// The leftovers in the map are steps that didn't exist before we reverted
for( map<StepsID, Steps*>::const_iterator it = mNewSteps.begin(); it != mNewSteps.end(); ++it )
for( std::map<StepsID, Steps*>::const_iterator it = mNewSteps.begin(); it != mNewSteps.end(); ++it )
{
Steps *NewSteps = new Steps(this);
*NewSteps = *(it->second);
@@ -523,7 +523,7 @@ bool Song::ReloadFromSongDir( RString sDir )
AddAutoGenNotes();
// Reload any images associated with the song. -Kyz
vector<RString> to_reload;
std::vector<RString> to_reload;
to_reload.reserve(7);
to_reload.push_back(m_sBannerFile);
to_reload.push_back(m_sJacketFile);
@@ -532,7 +532,7 @@ bool Song::ReloadFromSongDir( RString sDir )
to_reload.push_back(m_sBackgroundFile);
to_reload.push_back(m_sCDTitleFile);
to_reload.push_back(m_sPreviewVidFile);
for(vector<RString>::iterator file= to_reload.begin(); file != to_reload.end(); ++file)
for(std::vector<RString>::iterator file= to_reload.begin(); file != to_reload.end(); ++file)
{
RageTextureID id(*file);
if(TEXTUREMAN->IsTextureRegistered(id))
@@ -551,7 +551,7 @@ void Song::LoadEditsFromSongDir(RString dir)
{
// Load any .edit files in the song folder.
// Doing this BEFORE setting up AutoGen just in case.
vector<RString> vs;
std::vector<RString> vs;
GetDirListing(dir + "*.edit", vs, false, false);
// XXX: I'm sure there's a StepMania way of doing this, but familiar with this codebase I am not.
for(unsigned int i = 0; i < vs.size(); ++i)
@@ -649,10 +649,10 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ )
if(!from_cache)
{
if (this->m_sArtist == "The Dancing Monkeys Project" && this->m_sMainTitle.find_first_of('-') != string::npos)
if (this->m_sArtist == "The Dancing Monkeys Project" && this->m_sMainTitle.find_first_of('-') != std::string::npos)
{
// Dancing Monkeys had a bug/feature where the artist was replaced. Restore it.
vector<RString> titleParts;
std::vector<RString> titleParts;
split(this->m_sMainTitle, "-", titleParts);
this->m_sArtist = titleParts.front();
Trim(this->m_sArtist);
@@ -692,17 +692,17 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ )
// particular extension or type of extension. So fetch a list of all
// files in the dir once, then split that list into the different things
// we need. -Kyz
vector<RString> song_dir_listing;
std::vector<RString> song_dir_listing;
FILEMAN->GetDirListing(m_sSongDir + "*", song_dir_listing, false, false);
vector<RString> music_list;
vector<RString> image_list;
vector<RString> movie_list;
vector<RString> lyric_list;
vector<RString> lyric_extensions(1, "lrc");
std::vector<RString> music_list;
std::vector<RString> image_list;
std::vector<RString> movie_list;
std::vector<RString> lyric_list;
std::vector<RString> lyric_extensions(1, "lrc");
// Using a pair didn't work, so these two vectors have to be kept in
// sync instead. -Kyz
vector<vector<RString>*> lists_to_fill;
vector<const vector<RString>*> fill_exts;
std::vector<std::vector<RString>*> lists_to_fill;
std::vector<const std::vector<RString>*> fill_exts;
lists_to_fill.reserve(4);
fill_exts.reserve(4);
lists_to_fill.push_back(&music_list);
@@ -718,7 +718,7 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ )
}
lists_to_fill.push_back(&lyric_list);
fill_exts.push_back(&lyric_extensions);
for(vector<RString>::iterator filename= song_dir_listing.begin();
for(std::vector<RString>::iterator filename= song_dir_listing.begin();
filename != song_dir_listing.end(); ++filename)
{
bool matched_something= false;
@@ -727,7 +727,7 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ )
{
for(size_t tf= 0; tf < lists_to_fill.size(); ++ tf)
{
for(vector<RString>::const_iterator ext= fill_exts[tf]->begin();
for(std::vector<RString>::const_iterator ext= fill_exts[tf]->begin();
ext != fill_exts[tf]->end(); ++ext)
{
if(file_ext == *ext)
@@ -878,7 +878,7 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ )
// which is the CDTitle.
// For blank args to FindFirstFilenameContaining. -Kyz
vector<RString> empty_list;
std::vector<RString> empty_list;
bool has_jacket= HasJacket();
bool has_cdimage= HasCDImage();
@@ -893,10 +893,10 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ )
//m_sBannerFile = "";
// find an image with "banner" in the file name
vector<RString> contains(1, "banner");
std::vector<RString> contains(1, "banner");
/* Some people do things differently for the sake of being different.
* Don't match eg. abnormal, numbness. */
vector<RString> ends_with(1, " bn");
std::vector<RString> ends_with(1, " bn");
m_bHasBanner= FindFirstFilenameContaining(image_list,
m_sBannerFile, empty_list, contains, ends_with);
}
@@ -906,8 +906,8 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ )
//m_sBackgroundFile = "";
// find an image with "bg" or "background" in the file name
vector<RString> contains(1, "background");
vector<RString> ends_with(1, "bg");
std::vector<RString> contains(1, "background");
std::vector<RString> ends_with(1, "bg");
m_bHasBackground= FindFirstFilenameContaining(image_list,
m_sBackgroundFile, empty_list, contains, ends_with);
}
@@ -915,8 +915,8 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ )
if(!has_jacket)
{
// find an image with "jacket" or "albumart" in the filename.
vector<RString> starts_with(1, "jk_");
vector<RString> contains;
std::vector<RString> starts_with(1, "jk_");
std::vector<RString> contains;
contains.reserve(2);
contains.push_back("jacket");
contains.push_back("albumart");
@@ -928,7 +928,7 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ )
{
// CD image, a la ddr 1st-3rd (not to be confused with CDTitles)
// find an image with "-cd" at the end of the filename.
vector<RString> ends_with(1, "-cd");
std::vector<RString> ends_with(1, "-cd");
has_cdimage= FindFirstFilenameContaining(image_list,
m_sCDFile, empty_list, empty_list, ends_with);
}
@@ -936,7 +936,7 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ )
if(!has_disc)
{
// a rectangular graphic, not to be confused with CDImage above.
vector<RString> ends_with;
std::vector<RString> ends_with;
ends_with.reserve(2);
ends_with.push_back(" disc");
ends_with.push_back(" title");
@@ -947,7 +947,7 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ )
if(!has_cdtitle)
{
// find an image with "cdtitle" in the file name
vector<RString> contains(1, "cdtitle");
std::vector<RString> contains(1, "cdtitle");
has_cdtitle= FindFirstFilenameContaining(image_list,
m_sCDTitleFile, empty_list, contains, empty_list);
}
@@ -1168,9 +1168,9 @@ void Song::ReCalculateRadarValuesAndLastSecond(bool fromCache, bool duringCache)
* don't force the first beat of the whole song to 0. */
if( tempNoteData.GetLastRow() != 0 )
{
localFirst = min(localFirst,
localFirst = std::min(localFirst,
pSteps->GetTimingData()->GetElapsedTimeFromBeat(tempNoteData.GetFirstBeat()));
localLast = max(localLast,
localLast = std::max(localLast,
pSteps->GetTimingData()->GetElapsedTimeFromBeat(tempNoteData.GetLastBeat()));
}
}
@@ -1232,7 +1232,7 @@ void Song::Save(bool autosave)
/* We've safely written our files and created backups. Rename non-SM and
* non-DWI files to avoid confusion. */
vector<RString> arrayOldFileNames;
std::vector<RString> arrayOldFileNames;
GetDirListing( m_sSongDir + "*.bms", arrayOldFileNames );
GetDirListing( m_sSongDir + "*.pms", arrayOldFileNames );
GetDirListing( m_sSongDir + "*.ksf", arrayOldFileNames );
@@ -1261,7 +1261,7 @@ bool Song::SaveToSMFile()
if( IsAFile(sPath) )
FileCopy( sPath, sPath + ".old" );
vector<Steps*> vpStepsToSave;
std::vector<Steps*> vpStepsToSave;
for (Steps *pSteps : m_vpSteps)
{
if( pSteps->IsAutogen() )
@@ -1298,7 +1298,7 @@ bool Song::SaveToSSCFile( RString sPath, bool bSavingCache, bool autosave )
if(!bSavingCache && !autosave && IsAFile(path))
FileCopy( path, path + ".old" );
vector<Steps*> vpStepsToSave;
std::vector<Steps*> vpStepsToSave;
for (Steps *pSteps : m_vpSteps)
{
if( pSteps->IsAutogen() )
@@ -1603,27 +1603,27 @@ bool Song::HasPreviewVid() const
return m_sPreviewVidFile != "" && IsAFile(GetPreviewVidPath());
}
const vector<BackgroundChange> &Song::GetBackgroundChanges( BackgroundLayer bl ) const
const std::vector<BackgroundChange> &Song::GetBackgroundChanges( BackgroundLayer bl ) const
{
return *(m_BackgroundChanges[bl]);
}
vector<BackgroundChange> &Song::GetBackgroundChanges( BackgroundLayer bl )
std::vector<BackgroundChange> &Song::GetBackgroundChanges( BackgroundLayer bl )
{
return *(m_BackgroundChanges[bl].Get());
}
const vector<BackgroundChange> &Song::GetForegroundChanges() const
const std::vector<BackgroundChange> &Song::GetForegroundChanges() const
{
return *m_ForegroundChanges;
}
vector<BackgroundChange> &Song::GetForegroundChanges()
std::vector<BackgroundChange> &Song::GetForegroundChanges()
{
return *m_ForegroundChanges.Get();
}
vector<RString> Song::GetChangesToVectorString(const vector<BackgroundChange> & changes) const
std::vector<RString> Song::GetChangesToVectorString(const std::vector<BackgroundChange> & changes) const
{
vector<RString> ret;
std::vector<RString> ret;
for (BackgroundChange const &bgc : changes)
{
ret.push_back(bgc.ToString());
@@ -1631,17 +1631,17 @@ vector<RString> Song::GetChangesToVectorString(const vector<BackgroundChange> &
return ret;
}
vector<RString> Song::GetBGChanges1ToVectorString() const
std::vector<RString> Song::GetBGChanges1ToVectorString() const
{
return this->GetChangesToVectorString(this->GetBackgroundChanges(BACKGROUND_LAYER_1));
}
vector<RString> Song::GetBGChanges2ToVectorString() const
std::vector<RString> Song::GetBGChanges2ToVectorString() const
{
return this->GetChangesToVectorString(this->GetBackgroundChanges(BACKGROUND_LAYER_2));
}
vector<RString> Song::GetFGChanges1ToVectorString() const
std::vector<RString> Song::GetFGChanges1ToVectorString() const
{
return this->GetChangesToVectorString(this->GetForegroundChanges());
}
@@ -1650,7 +1650,7 @@ vector<RString> Song::GetFGChanges1ToVectorString() const
RString Song::GetCacheFile(RString sType)
{
// We put the Predefined images into a map.
map< RString, RString > PreDefs;
std::map<RString, RString> PreDefs;
PreDefs["Banner"] = GetBannerPath();
PreDefs["Background"] = GetBackgroundPath();
PreDefs["CDTitle"] = GetCDTitlePath();
@@ -1663,10 +1663,10 @@ RString Song::GetCacheFile(RString sType)
return PreDefs[sType.c_str()];
// Get all image files and put them into a vector.
vector<RString> song_dir_listing;
std::vector<RString> song_dir_listing;
FILEMAN->GetDirListing(m_sSongDir + "*", song_dir_listing, false, false);
vector<RString> image_list;
vector<RString> fill_exts = ActorUtil::GetTypeExtensionList(FT_Bitmap);
std::vector<RString> image_list;
std::vector<RString> fill_exts = ActorUtil::GetTypeExtensionList(FT_Bitmap);
for( RString Image : song_dir_listing )
{
RString FileExt = GetExtension(Image);
@@ -1679,7 +1679,7 @@ RString Song::GetCacheFile(RString sType)
}
// Create a map that contains all the filenames to search for.
map<RString, map< int, RString > > PreSets;
std::map<RString, std::map<int, RString>> PreSets;
PreSets["Banner"][1] = "bn";
PreSets["Banner"][2] = "banner";
PreSets["Background"][1] = "bg";
@@ -1696,7 +1696,7 @@ RString Song::GetCacheFile(RString sType)
{
// We want to make it lower case.
transform(Image.begin(), Image.end(), Image.begin(),::tolower);
for( pair< const int, RString> PreSet : PreSets[sType.c_str()] )
for( std::pair<const int, RString> PreSet : PreSets[sType.c_str()] )
{
// Search for image using PreSets.
size_t Found = Image.find(PreSet.second.c_str());
@@ -1739,9 +1739,9 @@ RString Song::GetFileHash()
return m_sFileHash;
}
vector<RString> Song::GetInstrumentTracksToVectorString() const
std::vector<RString> Song::GetInstrumentTracksToVectorString() const
{
vector<RString> ret;
std::vector<RString> ret;
FOREACH_ENUM(InstrumentTrack, it)
{
if (this->HasInstrumentTrack(it))
@@ -1765,7 +1765,7 @@ RString Song::GetSongAssetPath( RString sPath, const RString &sSongPath )
/* If there's no path in the file, the file is in the same directory as the
* song. (This is the preferred configuration.) */
if( sPath.find('/') == string::npos )
if( sPath.find('/') == std::string::npos )
return sRelPath;
// The song contains a path; treat it as relative to the top SM directory.
@@ -1923,7 +1923,7 @@ void Song::DeleteSteps( const Steps* pSteps, bool bReAutoGen )
if( bReAutoGen )
RemoveAutoGenNotes();
vector<Steps*> &vpSteps = m_vpStepsByType[pSteps->m_StepsType];
std::vector<Steps*> &vpSteps = m_vpStepsByType[pSteps->m_StepsType];
for( int j=vpSteps.size()-1; j>=0; j-- )
{
if( vpSteps[j] == pSteps )
@@ -1955,7 +1955,7 @@ bool Song::Matches(RString sGroup, RString sSong) const
RString sDir = this->GetSongDir();
sDir.Replace("\\","/");
vector<RString> bits;
std::vector<RString> bits;
split( sDir, "/", bits );
ASSERT(bits.size() >= 2); // should always have at least two parts
const RString &sLastBit = bits[bits.size()-1];
@@ -1971,11 +1971,11 @@ bool Song::Matches(RString sGroup, RString sSong) const
/* If apInUse is set, it contains a list of steps which are in use elsewhere,
* and should not be deleted. */
void Song::FreeAllLoadedFromProfile( ProfileSlot slot, const set<Steps*> *setInUse )
void Song::FreeAllLoadedFromProfile( ProfileSlot slot, const std::set<Steps*> *setInUse )
{
/* DeleteSteps will remove and recreate autogen notes, which may reorder
* m_vpSteps, so be careful not to skip over entries. */
vector<Steps*> apToRemove;
std::vector<Steps*> apToRemove;
for( int s=m_vpSteps.size()-1; s>=0; s-- )
{
Steps* pSteps = m_vpSteps[s];
@@ -1992,7 +1992,7 @@ void Song::FreeAllLoadedFromProfile( ProfileSlot slot, const set<Steps*> *setInU
this->DeleteSteps( apToRemove[i] );
}
void Song::GetStepsLoadedFromProfile( ProfileSlot slot, vector<Steps*> &vpStepsOut ) const
void Song::GetStepsLoadedFromProfile( ProfileSlot slot, std::vector<Steps*> &vpStepsOut ) const
{
for( unsigned s=0; s<m_vpSteps.size(); s++ )
{
@@ -2141,14 +2141,14 @@ public:
}
static int GetAllSteps( T* p, lua_State *L )
{
const vector<Steps*> &v = p->GetAllSteps();
const std::vector<Steps*> &v = p->GetAllSteps();
LuaHelpers::CreateTableFromArray<Steps*>( v, L );
return 1;
}
static int GetStepsByStepsType( T* p, lua_State *L )
{
StepsType st = Enum::Check<StepsType>(L, 1);
const vector<Steps*> &v = p->GetStepsByStepsType( st );
const std::vector<Steps*> &v = p->GetStepsByStepsType( st );
LuaHelpers::CreateTableFromArray<Steps*>( v, L );
return 1;
}
@@ -2328,7 +2328,7 @@ public:
static int GetTimingData( T* p, lua_State *L ) { p->m_SongTiming.PushSelf(L); return 1; }
static int GetBGChanges(T* p, lua_State* L)
{
const vector<BackgroundChange>& changes= p->GetBackgroundChanges(BACKGROUND_LAYER_1);
const std::vector<BackgroundChange>& changes= p->GetBackgroundChanges(BACKGROUND_LAYER_1);
lua_createtable(L, changes.size(), 0);
for(size_t c= 0; c < changes.size(); ++c)
{
@@ -2428,7 +2428,7 @@ public:
p->GetDisplayBpms(temp);
float fMin = temp.GetMin();
float fMax = temp.GetMax();
vector<float> fBPMs;
std::vector<float> fBPMs;
fBPMs.push_back( fMin );
fBPMs.push_back( fMax );
LuaHelpers::CreateTableFromArray(fBPMs, L);