Root/
| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2006 by Massimiliano Torromeo * |
| 3 | * massimiliano.torromeo@gmail.com * |
| 4 | * * |
| 5 | * This program is free software; you can redistribute it and/or modify * |
| 6 | * it under the terms of the GNU General Public License as published by * |
| 7 | * the Free Software Foundation; either version 2 of the License, or * |
| 8 | * (at your option) any later version. * |
| 9 | * * |
| 10 | * This program is distributed in the hope that it will be useful, * |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 13 | * GNU General Public License for more details. * |
| 14 | * * |
| 15 | * You should have received a copy of the GNU General Public License * |
| 16 | * along with this program; if not, write to the * |
| 17 | * Free Software Foundation, Inc., * |
| 18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 19 | ***************************************************************************/ |
| 20 | |
| 21 | #ifndef FILELISTER_H_ |
| 22 | #define FILELISTER_H_ |
| 23 | |
| 24 | #include <string> |
| 25 | #include <vector> |
| 26 | |
| 27 | using std::string; |
| 28 | using std::vector; |
| 29 | |
| 30 | class FileLister { |
| 31 | private: |
| 32 | string path, filter; |
| 33 | bool showDirectories, showFiles; |
| 34 | |
| 35 | vector<string> directories, files, excludes; |
| 36 | |
| 37 | public: |
| 38 | FileLister(const string &startPath = "/boot/local", bool showDirectories = true, bool showFiles = true); |
| 39 | void browse(bool clean = true); |
| 40 | |
| 41 | unsigned int size(); |
| 42 | unsigned int dirCount(); |
| 43 | unsigned int fileCount(); |
| 44 | string operator[](unsigned int); |
| 45 | string at(unsigned int); |
| 46 | bool isFile(unsigned int); |
| 47 | bool isDirectory(unsigned int); |
| 48 | |
| 49 | const string &getPath(); |
| 50 | void setPath(const string &path, bool doBrowse=true); |
| 51 | const string &getFilter(); |
| 52 | void setFilter(const string &filter); |
| 53 | |
| 54 | const vector<string> &getDirectories() { return directories; } |
| 55 | const vector<string> &getFiles() { return files; } |
| 56 | void insertFile(const string &file); |
| 57 | void addExclude(const string &exclude); |
| 58 | }; |
| 59 | |
| 60 | #endif /*FILELISTER_H_*/ |
| 61 |
Branches:
install_locations
master
opkrun
packages
