xoreos
0.0.5
|
A list of files. More...
#include <filelist.h>
Public Types | |
typedef std::list< UString >::const_iterator | const_iterator |
Public Member Functions | |
FileList () | |
FileList (const FileList &list) | |
FileList (const UString &directory, int recurseDepth=0) | |
Construct a list with the contents of this directory. More... | |
~FileList () | |
FileList & | operator= (const FileList &list) |
FileList & | operator+= (const FileList &list) |
void | clear () |
Clear the list. More... | |
bool | empty () const |
Is the list empty? More... | |
size_t | size () const |
Return the number of files in the list. More... | |
void | sort (bool caseInsensitive) |
Sort this list alphabetically. More... | |
void | relativize (const Common::UString &basePath) |
Express all files in this archive as relative to the given base path. More... | |
const_iterator | begin () const |
Return a const_iterator pointing to the beginning of the list. More... | |
const_iterator | end () const |
Return a const_iterator pointing past the end of the list. More... | |
bool | addDirectory (const UString &directory, int recurseDepth=0) |
Add a directory to the list. More... | |
bool | addSubDirectories (const UString &directory) |
Add subdirectories of a directory to the list. More... | |
bool | getSubList (const UString &str, bool caseInsensitive, FileList &subList) const |
Add files ending with the given string into another FileList. More... | |
bool | getSubListGlob (const UString &glob, bool caseInsensitive, FileList &subList) const |
Add files matching the given regex into another FileList. More... | |
bool | contains (const UString &str, bool caseInsensitive) const |
Does the list contain at least one file ending with the given string? More... | |
bool | containsGlob (const UString &glob, bool caseInsensitive) const |
Does the list contain at least one file matching the given regex? More... | |
UString | findFirst (const UString &str, bool caseInsensitive) const |
Find the first file ending with the given string. More... | |
UString | findFirstGlob (const UString &glob, bool caseInsensitive) const |
Find the first file matching the given regex. More... | |
Private Types | |
typedef std::list< UString > | Files |
Private Attributes | |
Files | _files |
A list of files.
Definition at line 35 of file filelist.h.
typedef std::list<UString>::const_iterator Common::FileList::const_iterator |
Definition at line 37 of file filelist.h.
|
private |
Definition at line 141 of file filelist.h.
Common::FileList::FileList | ( | ) |
Definition at line 36 of file filelist.cpp.
Common::FileList::FileList | ( | const FileList & | list | ) |
Definition at line 43 of file filelist.cpp.
Common::FileList::FileList | ( | const UString & | directory, |
int | recurseDepth = 0 |
||
) |
Construct a list with the contents of this directory.
See addDirectory().
Definition at line 39 of file filelist.cpp.
References addDirectory().
Common::FileList::~FileList | ( | ) |
Definition at line 47 of file filelist.cpp.
bool Common::FileList::addDirectory | ( | const UString & | directory, |
int | recurseDepth = 0 |
||
) |
Add a directory to the list.
directory | The directory to add. |
recurseDepth | The number of levels to recurse into subdirectories. 0 for ignoring subdirectories, -1 for a limitless recursion. |
Definition at line 102 of file filelist.cpp.
References _files, Common::UString::c_str(), Common::FilePath::canonicalize(), and Common::FilePath::isDirectory().
Referenced by Engines::KotOR2::KotOR2Engine::detectLanguages(), Engines::KotOR::KotOREngine::detectLanguages(), Engines::NWN2::NWN2Engine::detectLanguages(), Engines::DragonAge2::DragonAge2Engine::detectLanguages(), Engines::NWN::NWNEngine::detectLanguages(), Engines::DragonAge::DragonAgeEngine::detectLanguages(), Engines::Witcher::WitcherEngine::detectLanguages(), FileList(), Engines::Jade::findTLKs(), Engines::NWN2::Game::getCharacters(), Engines::NWN::Game::getCharacters(), Engines::KotOR2::Game::getModules(), Engines::KotOR::Game::getModules(), Engines::NWN::Game::getModules(), Aurora::ResourceManager::indexResourceDir(), Engines::Witcher::EngineProbe::probe(), Engines::GameInstanceEngine::probe(), Engines::KotOR::Version::readFile(), Engines::NWN::Version::readFile(), and Engines::Witcher::Console::updateMusic().
bool Common::FileList::addSubDirectories | ( | const UString & | directory | ) |
Add subdirectories of a directory to the list.
directory | The directory to scan. |
Definition at line 131 of file filelist.cpp.
References _files, Common::UString::c_str(), Common::FilePath::canonicalize(), and Common::FilePath::isDirectory().
Referenced by Engines::KotOR::SaveLoadMenu::addSavedGameItems().
FileList::const_iterator Common::FileList::begin | ( | ) | const |
Return a const_iterator pointing to the beginning of the list.
Definition at line 94 of file filelist.cpp.
References _files.
Referenced by Aurora::ResourceManager::addResources(), Engines::KotOR::SaveLoadMenu::addSavedGameItems(), Engines::Jade::JadeEngine::detectLanguages(), Engines::NWN2::Game::getCampaigns(), Engines::NWN2::Game::getCharacters(), Engines::NWN::Game::getCharacters(), Engines::KotOR2::Game::getModules(), Engines::KotOR::Game::getModules(), Engines::NWN::Game::getModules(), Engines::NWN2::Game::getModules(), Engines::Jade::getTLKDirectory(), Engines::DragonAge::Game::loadResourceDir(), Engines::DragonAge2::Game::loadResourceDir(), Engines::DragonAge2::Game::loadResources(), Engines::KotOR::Console::updateMusic(), Engines::KotOR2::Console::updateMusic(), and Engines::Witcher::Console::updateMusic().
void Common::FileList::clear | ( | ) |
bool Common::FileList::contains | ( | const UString & | str, |
bool | caseInsensitive | ||
) | const |
Does the list contain at least one file ending with the given string?
str | A file ending to match file names against. |
caseInsensitive | Should the case of the file name be ignored? |
Definition at line 185 of file filelist.cpp.
References Common::UString::empty(), and findFirst().
Referenced by Engines::DragonAge::DragonAgeEngine::detectLanguages(), Engines::DragonAge2::DragonAge2Engine::detectLanguages(), Engines::Witcher::WitcherEngine::detectLanguages(), Engines::NWN2::EngineProbe::probe(), Engines::DragonAge::EngineProbeWindows::probe(), Engines::DragonAge2::EngineProbeWindowsRetail::probe(), Engines::Jade::EngineProbeWindows::probe(), Engines::KotOR::EngineProbeWindows::probe(), Engines::KotOR2::EngineProbeWindows::probe(), Engines::NWN::EngineProbeWindows::probe(), Engines::DragonAge::EngineProbeXbox360::probe(), Engines::KotOR2::EngineProbeLinux::probe(), Engines::Jade::EngineProbeXbox::probe(), Engines::NWN::EngineProbeLinux::probe(), Engines::Jade::EngineProbeAndroid::probe(), Engines::KotOR::EngineProbeXbox::probe(), Engines::KotOR2::EngineProbeMac::probe(), Engines::NWN::EngineProbeFallback::probe(), Engines::KotOR::EngineProbeAndroid::probe(), and Engines::KotOR2::EngineProbeXbox::probe().
bool Common::FileList::containsGlob | ( | const UString & | glob, |
bool | caseInsensitive | ||
) | const |
Does the list contain at least one file matching the given regex?
glob | A perl regular expression to match the file names against. |
caseInsensitive | Should the case of the file name be ignored? |
Definition at line 189 of file filelist.cpp.
References Common::UString::empty(), and findFirstGlob().
Referenced by Engines::Witcher::EngineProbe::probe().
bool Common::FileList::empty | ( | ) | const |
FileList::const_iterator Common::FileList::end | ( | ) | const |
Return a const_iterator pointing past the end of the list.
Definition at line 98 of file filelist.cpp.
References _files.
Referenced by Aurora::ResourceManager::addResources(), Engines::KotOR::SaveLoadMenu::addSavedGameItems(), Engines::Jade::JadeEngine::detectLanguages(), Engines::NWN2::Game::getCampaigns(), Engines::NWN2::Game::getCharacters(), Engines::NWN::Game::getCharacters(), Engines::KotOR2::Game::getModules(), Engines::KotOR::Game::getModules(), Engines::NWN::Game::getModules(), Engines::NWN2::Game::getModules(), Engines::Jade::getTLKDirectory(), Engines::DragonAge::Game::loadResourceDir(), Engines::DragonAge2::Game::loadResourceDir(), Engines::DragonAge2::Game::loadResources(), Engines::KotOR::Console::updateMusic(), Engines::KotOR2::Console::updateMusic(), and Engines::Witcher::Console::updateMusic().
Find the first file ending with the given string.
str | A file ending to match file names against. |
caseInsensitive | Should the case of the file name be ignored? |
Definition at line 193 of file filelist.cpp.
References _files, Common::UString::endsWith(), and Common::UString::toLower().
Referenced by contains(), Engines::KotOR2::KotOR2Engine::detectLanguages(), Engines::NWN2::NWN2Engine::detectLanguages(), Engines::KotOR::KotOREngine::detectLanguages(), Engines::NWN::NWNEngine::detectLanguages(), Engines::DragonAge::Campaigns::findCampaigns(), Engines::DragonAge2::Campaigns::findCampaigns(), Engines::NWN2::Campaign::getDescription(), Engines::NWN2::Campaign::getName(), Engines::KotOR::Version::readFile(), and Engines::NWN::Version::readFile().
Find the first file matching the given regex.
glob | A perl regular expression to match the file names against. |
caseInsensitive | Should the case of the file name be ignored? |
Definition at line 207 of file filelist.cpp.
References _files, and Common::UString::c_str().
Referenced by containsGlob(), Engines::DragonAge2::Campaigns::findCampaigns(), and Engines::DragonAge::Campaigns::findCampaigns().
bool Common::FileList::getSubList | ( | const UString & | str, |
bool | caseInsensitive, | ||
FileList & | subList | ||
) | const |
Add files ending with the given string into another FileList.
str | A file ending to match file names against. |
caseInsensitive | Should the case of the file name be ignored? |
subList | The FileList to where to add the matching files. |
Definition at line 149 of file filelist.cpp.
References _files, Common::UString::endsWith(), and Common::UString::toLower().
Referenced by Engines::Jade::findTLKs(), and Engines::Witcher::Console::updateMusic().
bool Common::FileList::getSubListGlob | ( | const UString & | glob, |
bool | caseInsensitive, | ||
FileList & | subList | ||
) | const |
Add files matching the given regex into another FileList.
glob | A perl regular expression to match the file names against. |
caseInsensitive | Should the case of the file name be ignored? |
subList | The FileList to where to add the matching files. |
Definition at line 167 of file filelist.cpp.
References _files, and Common::UString::c_str().
Referenced by Aurora::ResourceManager::indexResourceDir().
Definition at line 56 of file filelist.cpp.
References _files.
Definition at line 50 of file filelist.cpp.
References _files.
void Common::FileList::relativize | ( | const Common::UString & | basePath | ) |
Express all files in this archive as relative to the given base path.
Files that do not match the base path will be removed from the list. See also FilePath::relativize().
Definition at line 81 of file filelist.cpp.
References _files, and Common::FilePath::relativize().
Referenced by Engines::DragonAge::Game::loadResourceDir(), Engines::DragonAge2::Game::loadResourceDir(), and Engines::DragonAge2::Game::loadResources().
size_t Common::FileList::size | ( | ) | const |
Return the number of files in the list.
Definition at line 70 of file filelist.cpp.
References _files.
void Common::FileList::sort | ( | bool | caseInsensitive | ) |
Sort this list alphabetically.
Definition at line 74 of file filelist.cpp.
References _files.
Referenced by Engines::KotOR::SaveLoadMenu::addSavedGameItems(), Engines::DragonAge::Game::loadResourceDir(), and Engines::DragonAge2::Game::loadResourceDir().
|
private |
Definition at line 143 of file filelist.h.
Referenced by addDirectory(), addSubDirectories(), begin(), clear(), empty(), end(), findFirst(), findFirstGlob(), getSubList(), getSubListGlob(), operator+=(), operator=(), relativize(), size(), and sort().