style
This commit is contained in:
@@ -8,32 +8,32 @@ RageFileDriver::~RageFileDriver()
|
||||
delete FDB;
|
||||
}
|
||||
|
||||
int RageFileDriver::GetPathValue( const RString &path )
|
||||
int RageFileDriver::GetPathValue( const RString &sPath )
|
||||
{
|
||||
vector<RString> parts;
|
||||
split( path, "/", parts, true );
|
||||
vector<RString> asParts;
|
||||
split( sPath, "/", asParts, true );
|
||||
|
||||
RString PartialPath;
|
||||
RString sPartialPath;
|
||||
|
||||
for( unsigned i = 0; i < parts.size(); ++i )
|
||||
for( unsigned i = 0; i < asParts.size(); ++i )
|
||||
{
|
||||
PartialPath += parts[i];
|
||||
if( i+1 < parts.size() )
|
||||
PartialPath += "/";
|
||||
sPartialPath += asParts[i];
|
||||
if( i+1 < asParts.size() )
|
||||
sPartialPath += "/";
|
||||
|
||||
const RageFileManager::FileType Type = GetFileType( PartialPath );
|
||||
const RageFileManager::FileType Type = GetFileType( sPartialPath );
|
||||
switch( Type )
|
||||
{
|
||||
case RageFileManager::TYPE_NONE:
|
||||
return parts.size()-i;
|
||||
return asParts.size()-i;
|
||||
|
||||
/* If this is the last part (the whole path), it needs to be a file; otherwise a directory. */
|
||||
case RageFileManager::TYPE_FILE:
|
||||
if( i != parts.size()-1 )
|
||||
if( i != asParts.size()-1 )
|
||||
return -1;
|
||||
break;
|
||||
case RageFileManager::TYPE_DIR:
|
||||
if( i == parts.size()-1 )
|
||||
if( i == asParts.size()-1 )
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
@@ -42,9 +42,9 @@ int RageFileDriver::GetPathValue( const RString &path )
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RageFileDriver::GetDirListing( const RString &sPath, vector<RString> &AddTo, bool bOnlyDirs, bool bReturnPathToo )
|
||||
void RageFileDriver::GetDirListing( const RString &sPath, vector<RString> &asAddTo, bool bOnlyDirs, bool bReturnPathToo )
|
||||
{
|
||||
FDB->GetDirListing( sPath, AddTo, bOnlyDirs, bReturnPathToo );
|
||||
FDB->GetDirListing( sPath, asAddTo, bOnlyDirs, bReturnPathToo );
|
||||
}
|
||||
|
||||
RageFileManager::FileType RageFileDriver::GetFileType( const RString &sPath )
|
||||
@@ -68,25 +68,25 @@ void RageFileDriver::FlushDirCache( const RString &sPath )
|
||||
}
|
||||
|
||||
|
||||
const struct FileDriverEntry *g_FileDriverList = NULL;
|
||||
const struct FileDriverEntry *g_pFileDriverList = NULL;
|
||||
|
||||
FileDriverEntry::FileDriverEntry( RString Type )
|
||||
FileDriverEntry::FileDriverEntry( RString sType )
|
||||
{
|
||||
m_Link = g_FileDriverList;
|
||||
g_FileDriverList = this;
|
||||
m_Type = Type;
|
||||
m_pLink = g_pFileDriverList;
|
||||
g_pFileDriverList = this;
|
||||
m_sType = sType;
|
||||
}
|
||||
|
||||
FileDriverEntry::~FileDriverEntry()
|
||||
{
|
||||
g_FileDriverList = NULL; /* invalidate */
|
||||
g_pFileDriverList = NULL; /* invalidate */
|
||||
}
|
||||
|
||||
RageFileDriver *MakeFileDriver( RString Type, RString Root )
|
||||
RageFileDriver *MakeFileDriver( RString sType, RString sRoot )
|
||||
{
|
||||
for( const FileDriverEntry *p = g_FileDriverList; p; p = p->m_Link )
|
||||
if( !p->m_Type.CompareNoCase(Type) )
|
||||
return p->Create( Root );
|
||||
for( const FileDriverEntry *p = g_pFileDriverList; p; p = p->m_pLink )
|
||||
if( !p->m_sType.CompareNoCase(sType) )
|
||||
return p->Create( sRoot );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,14 +10,14 @@ class FilenameDB;
|
||||
class RageFileDriver
|
||||
{
|
||||
public:
|
||||
RageFileDriver( FilenameDB *db ) { FDB = db; }
|
||||
RageFileDriver( FilenameDB *pDB ) { FDB = pDB; }
|
||||
virtual ~RageFileDriver();
|
||||
virtual RageFileBasic *Open( const RString &path, int mode, int &err ) = 0;
|
||||
virtual void GetDirListing( const RString &sPath, vector<RString> &AddTo, bool bOnlyDirs, bool bReturnPathToo );
|
||||
virtual RageFileBasic *Open( const RString &sPath, int iMode, int &iError ) = 0;
|
||||
virtual void GetDirListing( const RString &sPath, vector<RString> &asAddTo, bool bOnlyDirs, bool bReturnPathToo );
|
||||
virtual RageFileManager::FileType GetFileType( const RString &sPath );
|
||||
virtual int GetFileSizeInBytes( const RString &sFilePath );
|
||||
virtual int GetFileHash( const RString &sPath );
|
||||
virtual int GetPathValue( const RString &path );
|
||||
virtual int GetPathValue( const RString &sPath );
|
||||
virtual void FlushDirCache( const RString &sPath );
|
||||
virtual bool Move( const RString &sOldPath, const RString &sNewPath ) { return false; }
|
||||
virtual bool Remove( const RString &sPath ) { return false; }
|
||||
@@ -34,12 +34,12 @@ public:
|
||||
/* This is used to register the driver, so RageFileManager can see it. */
|
||||
struct FileDriverEntry
|
||||
{
|
||||
FileDriverEntry( RString Type );
|
||||
FileDriverEntry( RString sType );
|
||||
virtual ~FileDriverEntry();
|
||||
virtual RageFileDriver *Create( RString Root ) const = 0;
|
||||
virtual RageFileDriver *Create( RString sRoot ) const = 0;
|
||||
|
||||
RString m_Type;
|
||||
const FileDriverEntry *m_Link;
|
||||
RString m_sType;
|
||||
const FileDriverEntry *m_pLink;
|
||||
};
|
||||
RageFileDriver *MakeFileDriver( RString Type, RString Root );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user