summaryrefslogtreecommitdiff
path: root/plugingui/directory.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-10-03 17:11:32 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2015-10-03 17:11:32 +0200
commitf8740b3195bdff33d11d4cd23cdd791aec175c5c (patch)
treea0bc34dc84d539d45f3c92372a33252af678c95a /plugingui/directory.h
parent13226c21a99d70dacd26aee69f3982ee72ff431a (diff)
Refactored Directory.
Diffstat (limited to 'plugingui/directory.h')
-rw-r--r--plugingui/directory.h102
1 files changed, 51 insertions, 51 deletions
diff --git a/plugingui/directory.h b/plugingui/directory.h
index 04ed3e7..a3f0059 100644
--- a/plugingui/directory.h
+++ b/plugingui/directory.h
@@ -24,8 +24,7 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef __DRUMGIZMO_DIRECTORY_H__
-#define __DRUMGIZMO_DIRECTORY_H__
+#pragma once
#include <string>
#include <list>
@@ -38,56 +37,57 @@
#define DIRECTORY_HIDDEN 1
+namespace GUI {
+
class Directory {
+public:
+ typedef struct drive {
+ int number;
+ std::string name;
+ } drive_t;
+
+ typedef std::list<std::string> EntryList;
+ typedef std::list<drive> DriveList;
+
+ Directory(std::string path);
+ ~Directory();
+
+ std::string seperator();
+
+ size_t count();
+ void refresh();
+ std::string path();
+ bool cdUp();
+ bool cd(std::string dir);
+ bool isDir();
+ void setPath(std::string path);
+ bool fileExists(std::string file);
+
+ // Add filter, ie. directories or files only
+ EntryList entryList();
+
+ //void setSorting();
+
+ static std::string cwd();
+ static std::string root();
+ static std::string root(std::string path);
+ static std::string cleanPath(std::string path);
+ static Directory::EntryList listFiles(std::string path, unsigned char filter = 0);
+ static bool isRoot(std::string path);
+ static Directory::DriveList drives();
+ static bool isDir(std::string path);
+ static bool isHidden(std::string entry);
+ static bool exists(std::string path);
+ static std::string pathDirectory(std::string filepath);
+
+private:
+ std::string _path;
+ EntryList _files;
+ DriveList _drives;
- public:
- typedef struct drive {
- int number;
- std::string name;
- } drive_t;
-
- typedef std::list<std::string> EntryList;
- typedef std::list<drive> DriveList;
-
- Directory(std::string path);
- ~Directory();
-
- std::string seperator();
-
- size_t count();
- void refresh();
- std::string path();
- bool cdUp();
- bool cd(std::string dir);
- bool isDir();
- void setPath(std::string path);
- bool fileExists(std::string file);
-
- // Add filter, ie. directories or files only
- EntryList entryList();
-
- //void setSorting();
-
- static std::string cwd();
- static std::string root();
- static std::string root(std::string path);
- static std::string cleanPath(std::string path);
- static Directory::EntryList listFiles(std::string path, unsigned char filter = 0);
- static bool isRoot(std::string path);
- static Directory::DriveList drives();
- static bool isDir(std::string path);
- static bool isHidden(std::string entry);
- static bool exists(std::string path);
- static std::string pathDirectory(std::string filepath);
-
- private:
- std::string _path;
- EntryList _files;
- DriveList _drives;
-
- typedef std::list<std::string> Path;
- static Path parsePath(std::string path);
- static std::string pathToStr(Path &path);
+ typedef std::list<std::string> Path;
+ static Path parsePath(std::string path);
+ static std::string pathToStr(Path &path);
};
-#endif/*__DRUMGIZMO_DIRECTORY_H__*/
+} // GUI::