Date:2014-08-14 04:59:07 (9 years 7 months ago)
Author:Maarten ter Huurne
Commit:ba47744a528b312c8ce3ce97fade4d73e3138fd8
Message:Put trivial FileLister method implementations in header

This cuts a few hundred bytes off the stripped binary size.
Files: src/filelister.cpp (3 diffs)
src/filelister.h (1 diff)

Change Details

src/filelister.cpp
5151    }
5252}
5353
54void FileLister::setShowDirectories(bool showDirectories)
55{
56    this->showDirectories = showDirectories;
57}
58
59void FileLister::setShowUpdir(bool showUpdir)
60{
61    this->showUpdir = showUpdir;
62}
63
64void FileLister::setShowFiles(bool showFiles)
65{
66    this->showFiles = showFiles;
67}
68
6954static void moveNames(set<string, case_less>&& from, vector<string>& to)
7055{
7156    to.reserve(from.size());
...... 
179164    }
180165}
181166
182unsigned int FileLister::size()
183{
184    return files.size() + directories.size();
185}
186
187unsigned int FileLister::dirCount()
188{
189    return directories.size();
190}
191
192unsigned int FileLister::fileCount()
193{
194    return files.size();
195}
196
197167string FileLister::operator[](uint x)
198168{
199169    return at(x);
...... 
207177        return files[x-directories.size()];
208178}
209179
210bool FileLister::isFile(unsigned int x)
211{
212    return x >= directories.size() && x < size();
213}
214
215bool FileLister::isDirectory(unsigned int x)
216{
217    return x < directories.size();
218}
219
220180void FileLister::insertFile(const string &file) {
221181    files.insert(files.begin(), file);
222182}
src/filelister.h
3535    FileLister();
3636    void browse(const std::string& path, bool clean = true);
3737
38    unsigned int size();
39    unsigned int dirCount();
40    unsigned int fileCount();
38    unsigned int size() { return files.size() + directories.size(); }
39    unsigned int dirCount() { return directories.size(); }
40    unsigned int fileCount() { return files.size(); }
41
4142    std::string operator[](unsigned int);
4243    std::string at(unsigned int);
43    bool isFile(unsigned int);
44    bool isDirectory(unsigned int);
44    bool isFile(unsigned int x) { return x >= directories.size(); }
45    bool isDirectory(unsigned int x) { return x < directories.size(); }
4546
4647    void setFilter(const std::string &filter);
4748
48    void setShowDirectories(bool);
49    void setShowUpdir(bool);
50    void setShowFiles(bool);
49    void setShowDirectories(bool enabled) { showDirectories = enabled; }
50    void setShowUpdir(bool enabled) { showUpdir = enabled; }
51    void setShowFiles(bool enabled) { showFiles = enabled; }
5152
5253    const std::vector<std::string> &getDirectories() { return directories; }
5354    const std::vector<std::string> &getFiles() { return files; }

Archive Download the corresponding diff file



interactive