1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-25 17:08:26 +02:00

Put trivial FileLister method implementations in header

This cuts a few hundred bytes off the stripped binary size.
This commit is contained in:
Maarten ter Huurne 2014-08-14 04:59:07 +02:00
parent eb3def19ea
commit ba47744a52
2 changed files with 9 additions and 48 deletions

View File

@ -51,21 +51,6 @@ void FileLister::setFilter(const string &filter)
}
}
void FileLister::setShowDirectories(bool showDirectories)
{
this->showDirectories = showDirectories;
}
void FileLister::setShowUpdir(bool showUpdir)
{
this->showUpdir = showUpdir;
}
void FileLister::setShowFiles(bool showFiles)
{
this->showFiles = showFiles;
}
static void moveNames(set<string, case_less>&& from, vector<string>& to)
{
to.reserve(from.size());
@ -179,21 +164,6 @@ void FileLister::browse(const string& path, bool clean)
}
}
unsigned int FileLister::size()
{
return files.size() + directories.size();
}
unsigned int FileLister::dirCount()
{
return directories.size();
}
unsigned int FileLister::fileCount()
{
return files.size();
}
string FileLister::operator[](uint x)
{
return at(x);
@ -207,16 +177,6 @@ string FileLister::at(uint x)
return files[x-directories.size()];
}
bool FileLister::isFile(unsigned int x)
{
return x >= directories.size() && x < size();
}
bool FileLister::isDirectory(unsigned int x)
{
return x < directories.size();
}
void FileLister::insertFile(const string &file) {
files.insert(files.begin(), file);
}

View File

@ -35,19 +35,20 @@ public:
FileLister();
void browse(const std::string& path, bool clean = true);
unsigned int size();
unsigned int dirCount();
unsigned int fileCount();
unsigned int size() { return files.size() + directories.size(); }
unsigned int dirCount() { return directories.size(); }
unsigned int fileCount() { return files.size(); }
std::string operator[](unsigned int);
std::string at(unsigned int);
bool isFile(unsigned int);
bool isDirectory(unsigned int);
bool isFile(unsigned int x) { return x >= directories.size(); }
bool isDirectory(unsigned int x) { return x < directories.size(); }
void setFilter(const std::string &filter);
void setShowDirectories(bool);
void setShowUpdir(bool);
void setShowFiles(bool);
void setShowDirectories(bool enabled) { showDirectories = enabled; }
void setShowUpdir(bool enabled) { showUpdir = enabled; }
void setShowFiles(bool enabled) { showFiles = enabled; }
const std::vector<std::string> &getDirectories() { return directories; }
const std::vector<std::string> &getFiles() { return files; }