mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-17 21:10:39 +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:
parent
ba47744a52
commit
85b072ca43
@ -200,7 +200,7 @@ void BrowseDialog::directoryEnter()
|
|||||||
path += "/";
|
path += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
setPath(path + fl.at(selected));
|
setPath(path + fl[selected]);
|
||||||
|
|
||||||
selected = 0;
|
selected = 0;
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
@ -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(); }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user