diff options
| author | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
| commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
| tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /editor/editor_file_system.h | |
| parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
| download | godot-5dbf180.tar.gz godot-5dbf180.tar.zst godot-5dbf180.zip | |
A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Diffstat (limited to 'editor/editor_file_system.h')
| -rw-r--r-- | editor/editor_file_system.h | 73 |
1 files changed, 33 insertions, 40 deletions
diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index 10d9b919f..da78ba9cf 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -29,25 +29,24 @@ #ifndef EDITOR_FILE_SYSTEM_H #define EDITOR_FILE_SYSTEM_H -#include "scene/main/node.h" -#include "os/thread.h" #include "os/dir_access.h" -#include "set.h" +#include "os/thread.h" #include "os/thread_safe.h" +#include "scene/main/node.h" +#include "set.h" class FileAccess; struct EditorProgressBG; class EditorFileSystemDirectory : public Object { - GDCLASS( EditorFileSystemDirectory,Object ); + GDCLASS(EditorFileSystemDirectory, Object); String name; uint64_t modified_time; bool verified; //used for checking changes EditorFileSystemDirectory *parent; - Vector<EditorFileSystemDirectory*> subdirs; - + Vector<EditorFileSystemDirectory *> subdirs; struct FileInfo { String file; @@ -56,25 +55,23 @@ class EditorFileSystemDirectory : public Object { uint64_t import_modified_time; Vector<String> deps; bool verified; //used for checking changes - }; struct FileInfoSort { - bool operator()(const FileInfo *p_a,const FileInfo *p_b) const { - return p_a->file<p_b->file; + bool operator()(const FileInfo *p_a, const FileInfo *p_b) const { + return p_a->file < p_b->file; } }; void sort_files(); - Vector<FileInfo*> files; + Vector<FileInfo *> files; static void _bind_methods(); + friend class EditorFileSystem; -friend class EditorFileSystem; public: - String get_name(); String get_path() const; @@ -88,9 +85,8 @@ public: EditorFileSystemDirectory *get_parent(); - int find_file_index(const String& p_file) const; - int find_dir_index(const String& p_dir) const; - + int find_file_index(const String &p_file) const; + int find_dir_index(const String &p_dir) const; EditorFileSystemDirectory(); ~EditorFileSystemDirectory(); @@ -98,12 +94,10 @@ public: class EditorFileSystem : public Node { - GDCLASS( EditorFileSystem, Node ); + GDCLASS(EditorFileSystem, Node); _THREAD_SAFE_CLASS_ - - struct ItemAction { enum Action { @@ -121,8 +115,12 @@ class EditorFileSystem : public Node { EditorFileSystemDirectory *new_dir; EditorFileSystemDirectory::FileInfo *new_file; - ItemAction() { action=ACTION_NONE; dir=NULL; new_dir=NULL; new_file=NULL; } - + ItemAction() { + action = ACTION_NONE; + dir = NULL; + new_dir = NULL; + new_file = NULL; + } }; bool use_threads; @@ -136,7 +134,6 @@ class EditorFileSystem : public Node { bool importing; float scan_total; - void _scan_filesystem(); EditorFileSystemDirectory *filesystem; @@ -152,32 +149,30 @@ class EditorFileSystem : public Node { Vector<String> deps; }; - HashMap<String,FileCache> file_cache; + HashMap<String, FileCache> file_cache; struct ScanProgress { float low; float hi; mutable EditorProgressBG *progress; - void update(int p_current,int p_total) const; - ScanProgress get_sub(int p_current,int p_total) const; + void update(int p_current, int p_total) const; + ScanProgress get_sub(int p_current, int p_total) const; }; - void _save_filesystem_cache(); - void _save_filesystem_cache(EditorFileSystemDirectory *p_dir,FileAccess *p_file); + void _save_filesystem_cache(EditorFileSystemDirectory *p_dir, FileAccess *p_file); - bool _find_file(const String& p_file,EditorFileSystemDirectory ** r_d, int &r_file_pos) const; + bool _find_file(const String &p_file, EditorFileSystemDirectory **r_d, int &r_file_pos) const; void _scan_fs_changes(EditorFileSystemDirectory *p_dir, const ScanProgress &p_progress); - int md_count; Set<String> valid_extensions; Set<String> import_extensions; - void _scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess *da,const ScanProgress& p_progress); + void _scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess *da, const ScanProgress &p_progress); Thread *thread_sources; bool scanning_changes; @@ -190,24 +185,22 @@ class EditorFileSystem : public Node { bool _update_scan_actions(); - static void _resource_saved(const String& p_path); + static void _resource_saved(const String &p_path); void _update_extensions(); void _reimport_file(const String &p_file); - bool _check_missing_imported_files(const String& p_path); + bool _check_missing_imported_files(const String &p_path); bool reimport_on_missing_imported_files; protected: - void _notification(int p_what); static void _bind_methods(); -public: - - static EditorFileSystem* get_singleton() { return singleton; } +public: + static EditorFileSystem *get_singleton() { return singleton; } EditorFileSystemDirectory *get_filesystem(); bool is_scanning() const; @@ -216,13 +209,13 @@ public: void scan(); void scan_changes(); void get_changed_sources(List<String> *r_changed); - void update_file(const String& p_file); + void update_file(const String &p_file); - EditorFileSystemDirectory *get_filesystem_path(const String& p_path); - String get_file_type(const String& p_file) const; - EditorFileSystemDirectory* find_file(const String& p_file,int* r_index) const; + EditorFileSystemDirectory *get_filesystem_path(const String &p_path); + String get_file_type(const String &p_file) const; + EditorFileSystemDirectory *find_file(const String &p_file, int *r_index) const; - void reimport_files(const Vector<String>& p_files); + void reimport_files(const Vector<String> &p_files); EditorFileSystem(); ~EditorFileSystem(); |
