1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-17 23:28:27 +02:00

Removed FileLister::at

In the STL, 'at' will perform range checking while operator[] will not.
Since GMenu2X doesn't use exceptions, range checking is not possible,
so 'at' and operator[] were identical.
This commit is contained in:
Maarten ter Huurne 2014-08-14 05:02:24 +02:00
parent ba47744a52
commit 85b072ca43
3 changed files with 3 additions and 11 deletions

View File

@ -200,7 +200,7 @@ void BrowseDialog::directoryEnter()
path += "/"; path += "/";
} }
setPath(path + fl.at(selected)); setPath(path + fl[selected]);
selected = 0; selected = 0;
} }

View File

@ -166,15 +166,8 @@ void FileLister::browse(const string& path, bool clean)
string FileLister::operator[](uint x) string FileLister::operator[](uint x)
{ {
return at(x); const auto dirCount = directories.size();
} return x < dirCount ? directories[x] : files[x - dirCount];
string FileLister::at(uint x)
{
if (x < directories.size())
return directories[x];
else
return files[x-directories.size()];
} }
void FileLister::insertFile(const string &file) { void FileLister::insertFile(const string &file) {

View File

@ -40,7 +40,6 @@ public:
unsigned int fileCount() { return files.size(); } unsigned int fileCount() { return files.size(); }
std::string operator[](unsigned int); std::string operator[](unsigned int);
std::string at(unsigned int);
bool isFile(unsigned int x) { return x >= directories.size(); } bool isFile(unsigned int x) { return x >= directories.size(); }
bool isDirectory(unsigned int x) { return x < directories.size(); } bool isDirectory(unsigned int x) { return x < directories.size(); }