Remove global "using namespace std;" declarations, use "std::" prefixes on all std elements
Fix whitespace changes
This commit is contained in:
committed by
Martin Natano
parent
f0680a29fc
commit
0cba3579de
+24
-24
@@ -5,7 +5,7 @@
|
||||
#include "RageLog.h"
|
||||
|
||||
/* Search for "beginning*containing*ending". */
|
||||
void FileSet::GetFilesMatching( const RString &sBeginning_, const RString &sContaining_, const RString &sEnding_, vector<RString> &asOut, bool bOnlyDirs ) const
|
||||
void FileSet::GetFilesMatching( const RString &sBeginning_, const RString &sContaining_, const RString &sEnding_, std::vector<RString> &asOut, bool bOnlyDirs ) const
|
||||
{
|
||||
/* "files" is a case-insensitive mapping, by filename. Use lower_bound to figure
|
||||
* out where to start. */
|
||||
@@ -16,7 +16,7 @@ void FileSet::GetFilesMatching( const RString &sBeginning_, const RString &sCont
|
||||
RString sEnding = sEnding_;
|
||||
sEnding.MakeLower();
|
||||
|
||||
set<File>::const_iterator i = files.lower_bound( File(sBeginning) );
|
||||
std::set<File>::const_iterator i = files.lower_bound( File(sBeginning) );
|
||||
for( ; i != files.end(); ++i )
|
||||
{
|
||||
const File &f = *i;
|
||||
@@ -39,7 +39,7 @@ void FileSet::GetFilesMatching( const RString &sBeginning_, const RString &sCont
|
||||
/* Check end. */
|
||||
if( end_pos < 0 )
|
||||
continue; /* can't end with it */
|
||||
if( sPath.compare(end_pos, string::npos, sEnding) )
|
||||
if( sPath.compare(end_pos, std::string::npos, sEnding) )
|
||||
continue; /* doesn't end with it */
|
||||
|
||||
/* Check sContaining. Do this last, since it's the slowest (substring
|
||||
@@ -57,9 +57,9 @@ void FileSet::GetFilesMatching( const RString &sBeginning_, const RString &sCont
|
||||
}
|
||||
}
|
||||
|
||||
void FileSet::GetFilesEqualTo( const RString &sStr, vector<RString> &asOut, bool bOnlyDirs ) const
|
||||
void FileSet::GetFilesEqualTo( const RString &sStr, std::vector<RString> &asOut, bool bOnlyDirs ) const
|
||||
{
|
||||
set<File>::const_iterator i = files.find( File(sStr) );
|
||||
std::set<File>::const_iterator i = files.find( File(sStr) );
|
||||
if( i == files.end() )
|
||||
return;
|
||||
|
||||
@@ -71,7 +71,7 @@ void FileSet::GetFilesEqualTo( const RString &sStr, vector<RString> &asOut, bool
|
||||
|
||||
RageFileManager::FileType FileSet::GetFileType( const RString &sPath ) const
|
||||
{
|
||||
set<File>::const_iterator i = files.find( File(sPath) );
|
||||
std::set<File>::const_iterator i = files.find( File(sPath) );
|
||||
if( i == files.end() )
|
||||
return RageFileManager::TYPE_NONE;
|
||||
|
||||
@@ -80,7 +80,7 @@ RageFileManager::FileType FileSet::GetFileType( const RString &sPath ) const
|
||||
|
||||
int FileSet::GetFileSize( const RString &sPath ) const
|
||||
{
|
||||
set<File>::const_iterator i = files.find( File(sPath) );
|
||||
std::set<File>::const_iterator i = files.find( File(sPath) );
|
||||
if( i == files.end() )
|
||||
return -1;
|
||||
return i->size;
|
||||
@@ -88,7 +88,7 @@ int FileSet::GetFileSize( const RString &sPath ) const
|
||||
|
||||
int FileSet::GetFileHash( const RString &sPath ) const
|
||||
{
|
||||
set<File>::const_iterator i = files.find( File(sPath) );
|
||||
std::set<File>::const_iterator i = files.find( File(sPath) );
|
||||
if( i == files.end() )
|
||||
return -1;
|
||||
return i->hash + i->size;
|
||||
@@ -189,7 +189,7 @@ bool FilenameDB::ResolvePath( RString &sPath )
|
||||
RString p = sPath.substr( iBegin, iSize );
|
||||
ASSERT_M( p.size() != 1 || p[0] != '.', sPath ); // no .
|
||||
ASSERT_M( p.size() != 2 || p[0] != '.' || p[1] != '.', sPath ); // no ..
|
||||
set<File>::const_iterator it = fs->files.find( File(p) );
|
||||
std::set<File>::const_iterator it = fs->files.find( File(p) );
|
||||
|
||||
/* If there were no matches, the path isn't found. */
|
||||
if( it == fs->files.end() )
|
||||
@@ -212,7 +212,7 @@ bool FilenameDB::ResolvePath( RString &sPath )
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilenameDB::GetFilesMatching( const RString &sDir, const RString &sBeginning, const RString &sContaining, const RString &sEnding, vector<RString> &asOut, bool bOnlyDirs )
|
||||
void FilenameDB::GetFilesMatching( const RString &sDir, const RString &sBeginning, const RString &sContaining, const RString &sEnding, std::vector<RString> &asOut, bool bOnlyDirs )
|
||||
{
|
||||
ASSERT( !m_Mutex.IsLockedByThisThread() );
|
||||
|
||||
@@ -221,7 +221,7 @@ void FilenameDB::GetFilesMatching( const RString &sDir, const RString &sBeginnin
|
||||
m_Mutex.Unlock(); /* locked by GetFileSet */
|
||||
}
|
||||
|
||||
void FilenameDB::GetFilesEqualTo( const RString &sDir, const RString &sFile, vector<RString> &asOut, bool bOnlyDirs )
|
||||
void FilenameDB::GetFilesEqualTo( const RString &sDir, const RString &sFile, std::vector<RString> &asOut, bool bOnlyDirs )
|
||||
{
|
||||
ASSERT( !m_Mutex.IsLockedByThisThread() );
|
||||
|
||||
@@ -231,7 +231,7 @@ void FilenameDB::GetFilesEqualTo( const RString &sDir, const RString &sFile, vec
|
||||
}
|
||||
|
||||
|
||||
void FilenameDB::GetFilesSimpleMatch( const RString &sDir, const RString &sMask, vector<RString> &asOut, bool bOnlyDirs )
|
||||
void FilenameDB::GetFilesSimpleMatch( const RString &sDir, const RString &sMask, std::vector<RString> &asOut, bool bOnlyDirs )
|
||||
{
|
||||
/* Does this contain a wildcard? */
|
||||
size_t first_pos = sMask.find_first_of( '*' );
|
||||
@@ -287,7 +287,7 @@ FileSet *FilenameDB::GetFileSet( const RString &sDir_, bool bCreate )
|
||||
for(;;)
|
||||
{
|
||||
/* Look for the directory. */
|
||||
map<RString, FileSet *>::iterator i = dirs.find( sLower );
|
||||
std::map<RString, FileSet*>::iterator i = dirs.find( sLower );
|
||||
if( !bCreate )
|
||||
{
|
||||
if( i == dirs.end() )
|
||||
@@ -351,7 +351,7 @@ FileSet *FilenameDB::GetFileSet( const RString &sDir_, bool bCreate )
|
||||
FileSet *pParent = GetFileSet( sParent );
|
||||
if( pParent != nullptr )
|
||||
{
|
||||
set<File>::iterator it = pParent->files.find( File(Basename(sDir)) );
|
||||
std::set<File>::iterator it = pParent->files.find( File(Basename(sDir)) );
|
||||
if( it != pParent->files.end() )
|
||||
pParentDirp = const_cast<FileSet **>(&it->dirp);
|
||||
}
|
||||
@@ -387,11 +387,11 @@ void FilenameDB::AddFile( const RString &sPath_, int iSize, int iHash, void *pPr
|
||||
if( sPath[0] != '/' )
|
||||
sPath = "/" + sPath;
|
||||
|
||||
vector<RString> asParts;
|
||||
std::vector<RString> asParts;
|
||||
split( sPath, "/", asParts, false );
|
||||
|
||||
vector<RString>::const_iterator begin = asParts.begin();
|
||||
vector<RString>::const_iterator end = asParts.end();
|
||||
std::vector<RString>::const_iterator begin = asParts.begin();
|
||||
std::vector<RString>::const_iterator end = asParts.end();
|
||||
|
||||
bool IsDir = true;
|
||||
if( sPath[sPath.size()-1] != '/' )
|
||||
@@ -431,7 +431,7 @@ void FilenameDB::AddFile( const RString &sPath_, int iSize, int iHash, void *pPr
|
||||
/* Remove the given FileSet, and all dirp pointers to it. This means the cache has
|
||||
* expired, not that the directory is necessarily gone; don't actually delete the file
|
||||
* from the parent. */
|
||||
void FilenameDB::DelFileSet( map<RString, FileSet *>::iterator dir )
|
||||
void FilenameDB::DelFileSet( std::map<RString, FileSet*>::iterator dir )
|
||||
{
|
||||
/* If this isn't locked, dir may not be valid. */
|
||||
ASSERT( m_Mutex.IsLockedByThisThread() );
|
||||
@@ -442,10 +442,10 @@ void FilenameDB::DelFileSet( map<RString, FileSet *>::iterator dir )
|
||||
FileSet *fs = dir->second;
|
||||
|
||||
/* Remove any stale dirp pointers. */
|
||||
for( map<RString, FileSet *>::iterator it = dirs.begin(); it != dirs.end(); ++it )
|
||||
for( std::map<RString, FileSet*>::iterator it = dirs.begin(); it != dirs.end(); ++it )
|
||||
{
|
||||
FileSet *Clean = it->second;
|
||||
for( set<File>::iterator f = Clean->files.begin(); f != Clean->files.end(); ++f )
|
||||
for( std::set<File>::iterator f = Clean->files.begin(); f != Clean->files.end(); ++f )
|
||||
{
|
||||
File &ff = (File &) *f;
|
||||
if( ff.dirp == fs )
|
||||
@@ -463,7 +463,7 @@ void FilenameDB::DelFile( const RString &sPath )
|
||||
RString lower = sPath;
|
||||
lower.MakeLower();
|
||||
|
||||
map<RString, FileSet *>::iterator fsi = dirs.find( lower );
|
||||
std::map<RString, FileSet*>::iterator fsi = dirs.find( lower );
|
||||
DelFileSet( fsi );
|
||||
|
||||
/* Delete sPath from its parent. */
|
||||
@@ -522,7 +522,7 @@ void FilenameDB::FlushDirCache( const RString & /* sDir */ )
|
||||
if( it != dirs.end() )
|
||||
{
|
||||
FileSet *pParent = it->second;
|
||||
set<File>::iterator fileit = pParent->files.find( File(Basename(sDir)) );
|
||||
std::set<File>::iterator fileit = pParent->files.find( File(Basename(sDir)) );
|
||||
if( fileit != pParent->files.end() )
|
||||
fileit->dirp = nullptr;
|
||||
}
|
||||
@@ -545,7 +545,7 @@ const File *FilenameDB::GetFile( const RString &sPath )
|
||||
SplitPath(sPath, Dir, Name);
|
||||
FileSet *fs = GetFileSet( Dir );
|
||||
|
||||
set<File>::iterator it;
|
||||
std::set<File>::iterator it;
|
||||
it = fs->files.find( File(Name) );
|
||||
if( it == fs->files.end() )
|
||||
return nullptr;
|
||||
@@ -568,7 +568,7 @@ void *FilenameDB::GetFilePriv( const RString &path )
|
||||
|
||||
|
||||
|
||||
void FilenameDB::GetDirListing( const RString &sPath_, vector<RString> &asAddTo, bool bOnlyDirs, bool bReturnPathToo )
|
||||
void FilenameDB::GetDirListing( const RString &sPath_, std::vector<RString> &asAddTo, bool bOnlyDirs, bool bReturnPathToo )
|
||||
{
|
||||
RString sPath = sPath_;
|
||||
// LOG->Trace( "GetDirListing( %s )", sPath.c_str() );
|
||||
|
||||
Reference in New Issue
Block a user