1 /** 2 A directory for the resource filesystem. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.editorfilesystemdirectory; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.classdb; 23 /** 24 A directory for the resource filesystem. 25 26 A more generalized, low-level variation of the directory concept. 27 */ 28 @GodotBaseClass struct EditorFileSystemDirectory 29 { 30 enum string _GODOT_internal_name = "EditorFileSystemDirectory"; 31 public: 32 @nogc nothrow: 33 union { godot_object _godot_object; GodotObject _GODOT_base; } 34 alias _GODOT_base this; 35 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 36 package(godot) __gshared bool _classBindingInitialized = false; 37 package(godot) static struct _classBinding 38 { 39 __gshared: 40 @GodotName("get_subdir_count") GodotMethod!(long) getSubdirCount; 41 @GodotName("get_subdir") GodotMethod!(EditorFileSystemDirectory, long) getSubdir; 42 @GodotName("get_file_count") GodotMethod!(long) getFileCount; 43 @GodotName("get_file") GodotMethod!(String, long) getFile; 44 @GodotName("get_file_path") GodotMethod!(String, long) getFilePath; 45 @GodotName("get_file_type") GodotMethod!(String, long) getFileType; 46 @GodotName("get_file_script_class_name") GodotMethod!(String, long) getFileScriptClassName; 47 @GodotName("get_file_script_class_extends") GodotMethod!(String, long) getFileScriptClassExtends; 48 @GodotName("get_file_import_is_valid") GodotMethod!(bool, long) getFileImportIsValid; 49 @GodotName("get_name") GodotMethod!(String) getName; 50 @GodotName("get_path") GodotMethod!(String) getPath; 51 @GodotName("get_parent") GodotMethod!(EditorFileSystemDirectory) getParent; 52 @GodotName("find_file_index") GodotMethod!(long, String) findFileIndex; 53 @GodotName("find_dir_index") GodotMethod!(long, String) findDirIndex; 54 } 55 bool opEquals(in EditorFileSystemDirectory other) const { return _godot_object.ptr is other._godot_object.ptr; } 56 EditorFileSystemDirectory opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 57 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 58 mixin baseCasts; 59 static EditorFileSystemDirectory _new() 60 { 61 static godot_class_constructor constructor; 62 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("EditorFileSystemDirectory"); 63 if(constructor is null) return typeof(this).init; 64 return cast(EditorFileSystemDirectory)(constructor()); 65 } 66 @disable new(size_t s); 67 /** 68 Returns the number of subdirectories in this directory. 69 */ 70 long getSubdirCount() const 71 { 72 checkClassBinding!(typeof(this))(); 73 return ptrcall!(long)(_classBinding.getSubdirCount, _godot_object); 74 } 75 /** 76 Returns the subdirectory at index `idx`. 77 */ 78 EditorFileSystemDirectory getSubdir(in long idx) 79 { 80 checkClassBinding!(typeof(this))(); 81 return ptrcall!(EditorFileSystemDirectory)(_classBinding.getSubdir, _godot_object, idx); 82 } 83 /** 84 Returns the number of files in this directory. 85 */ 86 long getFileCount() const 87 { 88 checkClassBinding!(typeof(this))(); 89 return ptrcall!(long)(_classBinding.getFileCount, _godot_object); 90 } 91 /** 92 Returns the name of the file at index `idx`. 93 */ 94 String getFile(in long idx) const 95 { 96 checkClassBinding!(typeof(this))(); 97 return ptrcall!(String)(_classBinding.getFile, _godot_object, idx); 98 } 99 /** 100 Returns the path to the file at index `idx`. 101 */ 102 String getFilePath(in long idx) const 103 { 104 checkClassBinding!(typeof(this))(); 105 return ptrcall!(String)(_classBinding.getFilePath, _godot_object, idx); 106 } 107 /** 108 Returns the file extension of the file at index `idx`. 109 */ 110 String getFileType(in long idx) const 111 { 112 checkClassBinding!(typeof(this))(); 113 return ptrcall!(String)(_classBinding.getFileType, _godot_object, idx); 114 } 115 /** 116 117 */ 118 String getFileScriptClassName(in long idx) const 119 { 120 checkClassBinding!(typeof(this))(); 121 return ptrcall!(String)(_classBinding.getFileScriptClassName, _godot_object, idx); 122 } 123 /** 124 125 */ 126 String getFileScriptClassExtends(in long idx) const 127 { 128 checkClassBinding!(typeof(this))(); 129 return ptrcall!(String)(_classBinding.getFileScriptClassExtends, _godot_object, idx); 130 } 131 /** 132 Returns `true` if the file at index `idx` imported properly. 133 */ 134 bool getFileImportIsValid(in long idx) const 135 { 136 checkClassBinding!(typeof(this))(); 137 return ptrcall!(bool)(_classBinding.getFileImportIsValid, _godot_object, idx); 138 } 139 /** 140 Returns the name of this directory. 141 */ 142 String getName() 143 { 144 checkClassBinding!(typeof(this))(); 145 return ptrcall!(String)(_classBinding.getName, _godot_object); 146 } 147 /** 148 Returns the path to this directory. 149 */ 150 String getPath() const 151 { 152 checkClassBinding!(typeof(this))(); 153 return ptrcall!(String)(_classBinding.getPath, _godot_object); 154 } 155 /** 156 Returns the parent directory for this directory or null if called on a directory at `res://` or `user://`. 157 */ 158 EditorFileSystemDirectory getParent() 159 { 160 checkClassBinding!(typeof(this))(); 161 return ptrcall!(EditorFileSystemDirectory)(_classBinding.getParent, _godot_object); 162 } 163 /** 164 Returns the index of the file with name `name` or `-1` if not found. 165 */ 166 long findFileIndex(StringArg0)(in StringArg0 name) const 167 { 168 checkClassBinding!(typeof(this))(); 169 return ptrcall!(long)(_classBinding.findFileIndex, _godot_object, name); 170 } 171 /** 172 Returns the index of the directory with name `name` or `-1` if not found. 173 */ 174 long findDirIndex(StringArg0)(in StringArg0 name) const 175 { 176 checkClassBinding!(typeof(this))(); 177 return ptrcall!(long)(_classBinding.findDirIndex, _godot_object, name); 178 } 179 }