Added more helper methods to DirAccessRef and FileAccessRef. Also smaller cleanups.

This commit is contained in:
Relintai 2022-08-07 21:16:11 +02:00
parent 10e87baee9
commit e15630d7f2
2 changed files with 16 additions and 5 deletions

View File

@ -140,12 +140,18 @@ public:
};
struct DirAccessRef {
DirAccess *f;
_FORCE_INLINE_ bool is_null() const { return f == nullptr; }
_FORCE_INLINE_ bool is_valid() const { return f != nullptr; }
_FORCE_INLINE_ operator bool() const { return f != nullptr; }
_FORCE_INLINE_ operator DirAccess *() { return f; }
_FORCE_INLINE_ DirAccess *operator->() {
return f;
}
operator bool() const { return f != nullptr; }
DirAccess *f;
DirAccessRef(DirAccess *fa) { f = fa; }
DirAccessRef(DirAccessRef &&other) {
f = other.f;

View File

@ -177,13 +177,18 @@ public:
};
struct FileAccessRef {
FileAccess *f;
_FORCE_INLINE_ bool is_null() const { return f == nullptr; }
_FORCE_INLINE_ bool is_valid() const { return f != nullptr; }
_FORCE_INLINE_ operator bool() const { return f != nullptr; }
_FORCE_INLINE_ operator FileAccess *() { return f; }
_FORCE_INLINE_ FileAccess *operator->() {
return f;
}
operator bool() const { return f != nullptr; }
FileAccess *f;
operator FileAccess *() { return f; }
FileAccessRef(FileAccess *fa) { f = fa; }
FileAccessRef(FileAccessRef &&other) {
f = other.f;