summaryrefslogtreecommitdiff
path: root/core/os/dir_access.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/os/dir_access.h')
-rw-r--r--core/os/dir_access.h70
1 files changed, 32 insertions, 38 deletions
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index 7c173fc780..1ac2d0e03a 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -29,7 +29,6 @@
#ifndef DIR_ACCESS_H
#define DIR_ACCESS_H
-
#include "typedefs.h"
#include "ustring.h"
@@ -40,7 +39,6 @@
//@ TOOD, excellent candidate for THREAD_SAFE MACRO, should go through all these and add THREAD_SAFE where it applies
class DirAccess {
public:
-
enum AccessType {
ACCESS_RESOURCES,
ACCESS_USERDATA,
@@ -48,13 +46,9 @@ public:
ACCESS_MAX
};
-
-
- typedef DirAccess*(*CreateFunc)();
+ typedef DirAccess *(*CreateFunc)();
private:
-
-
AccessType _access_type;
static CreateFunc create_func[ACCESS_MAX]; ///< set this to instance a filesystem object
protected:
@@ -64,45 +58,44 @@ protected:
String fix_path(String p_path) const;
bool next_is_dir;
- template<class T>
- static DirAccess* _create_builtin() {
+ template <class T>
+ static DirAccess *_create_builtin() {
- return memnew( T );
+ return memnew(T);
}
public:
+ virtual Error list_dir_begin() = 0; ///< This starts dir listing
+ virtual String get_next(bool *p_is_dir); // compatibility
+ virtual String get_next() = 0;
+ virtual bool current_is_dir() const = 0;
+ virtual bool current_is_hidden() const = 0;
- virtual Error list_dir_begin()=0; ///< This starts dir listing
- virtual String get_next(bool* p_is_dir); // compatibility
- virtual String get_next()=0;
- virtual bool current_is_dir() const=0;
- virtual bool current_is_hidden() const=0;
-
- virtual void list_dir_end()=0; ///<
+ virtual void list_dir_end() = 0; ///<
- virtual int get_drive_count()=0;
- virtual String get_drive(int p_drive)=0;
+ virtual int get_drive_count() = 0;
+ virtual String get_drive(int p_drive) = 0;
virtual int get_current_drive();
- virtual Error change_dir(String p_dir)=0; ///< can be relative or absolute, return false on success
- virtual String get_current_dir()=0; ///< return current dir location
- virtual Error make_dir(String p_dir)=0;
+ virtual Error change_dir(String p_dir) = 0; ///< can be relative or absolute, return false on success
+ virtual String get_current_dir() = 0; ///< return current dir location
+ virtual Error make_dir(String p_dir) = 0;
virtual Error make_dir_recursive(String p_dir);
virtual Error erase_contents_recursive(); //super dangerous, use with care!
- virtual bool file_exists(String p_file)=0;
- virtual bool dir_exists(String p_dir)=0;
+ virtual bool file_exists(String p_file) = 0;
+ virtual bool dir_exists(String p_dir) = 0;
static bool exists(String p_dir);
- virtual size_t get_space_left()=0;
+ virtual size_t get_space_left() = 0;
- virtual Error copy(String p_from,String p_to);
- virtual Error rename(String p_from, String p_to)=0;
- virtual Error remove(String p_name)=0;
+ virtual Error copy(String p_from, String p_to);
+ virtual Error rename(String p_from, String p_to) = 0;
+ virtual Error remove(String p_name) = 0;
- static String get_full_path(const String& p_path,AccessType p_access);
- static DirAccess *create_for_path(const String& p_path);
+ static String get_full_path(const String &p_path, AccessType p_access);
+ static DirAccess *create_for_path(const String &p_path);
-/*
+ /*
enum DirType {
FILE_TYPE_INVALID,
@@ -114,30 +107,31 @@ public:
*/
static DirAccess *create(AccessType p_access);
- template<class T>
+ template <class T>
static void make_default(AccessType p_access) {
- create_func[p_access]=_create_builtin<T>;
+ create_func[p_access] = _create_builtin<T>;
}
- static DirAccess *open(const String& p_path,Error *r_error=NULL);
+ static DirAccess *open(const String &p_path, Error *r_error = NULL);
DirAccess();
virtual ~DirAccess();
-
};
struct DirAccessRef {
- _FORCE_INLINE_ DirAccess* operator->() {
+ _FORCE_INLINE_ DirAccess *operator->() {
return f;
}
- operator bool() const { return f!=NULL; }
+ operator bool() const { return f != NULL; }
DirAccess *f;
DirAccessRef(DirAccess *fa) { f = fa; }
- ~DirAccessRef() { if (f) memdelete(f); }
+ ~DirAccessRef() {
+ if (f) memdelete(f);
+ }
};
#endif