Skip to content

Commit

Permalink
Rename p_extensions of get_recognized_extensions to r_extensions
Browse files Browse the repository at this point in the history
Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
  • Loading branch information
dustdfg committed Nov 22, 2024
1 parent f952bfe commit 7c00927
Show file tree
Hide file tree
Showing 93 changed files with 234 additions and 234 deletions.
16 changes: 8 additions & 8 deletions core/crypto/crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ Ref<Resource> ResourceFormatLoaderCrypto::load(const String &p_path, const Strin
return nullptr;
}

void ResourceFormatLoaderCrypto::get_recognized_extensions(List<String> *p_extensions) const {
p_extensions->push_back("crt");
p_extensions->push_back("key");
p_extensions->push_back("pub");
void ResourceFormatLoaderCrypto::get_recognized_extensions(List<String> *r_extensions) const {
r_extensions->push_back("crt");
r_extensions->push_back("key");
r_extensions->push_back("pub");
}

bool ResourceFormatLoaderCrypto::handles_type(const String &p_type) const {
Expand Down Expand Up @@ -244,17 +244,17 @@ Error ResourceFormatSaverCrypto::save(const Ref<Resource> &p_resource, const Str
return OK;
}

void ResourceFormatSaverCrypto::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const {
void ResourceFormatSaverCrypto::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *r_extensions) const {
const X509Certificate *cert = Object::cast_to<X509Certificate>(*p_resource);
const CryptoKey *key = Object::cast_to<CryptoKey>(*p_resource);
if (cert) {
p_extensions->push_back("crt");
r_extensions->push_back("crt");
}
if (key) {
if (!key->is_public_only()) {
p_extensions->push_back("key");
r_extensions->push_back("key");
}
p_extensions->push_back("pub");
r_extensions->push_back("pub");
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/crypto/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ class Crypto : public RefCounted {
class ResourceFormatLoaderCrypto : public ResourceFormatLoader {
public:
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
virtual void get_recognized_extensions(List<String> *p_extensions) const override;
virtual void get_recognized_extensions(List<String> *r_extensions) const override;
virtual bool handles_type(const String &p_type) const override;
virtual String get_resource_type(const String &p_path) const override;
};

class ResourceFormatSaverCrypto : public ResourceFormatSaver {
public:
virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *r_extensions) const override;
virtual bool recognize(const Ref<Resource> &p_resource) const override;
};

Expand Down
4 changes: 2 additions & 2 deletions core/extension/gdextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -821,8 +821,8 @@ Ref<Resource> GDExtensionResourceLoader::load(const String &p_path, const String
return lib;
}

void GDExtensionResourceLoader::get_recognized_extensions(List<String> *p_extensions) const {
p_extensions->push_back("gdextension");
void GDExtensionResourceLoader::get_recognized_extensions(List<String> *r_extensions) const {
r_extensions->push_back("gdextension");
}

bool GDExtensionResourceLoader::handles_type(const String &p_type) const {
Expand Down
2 changes: 1 addition & 1 deletion core/extension/gdextension.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class GDExtensionResourceLoader : public ResourceFormatLoader {
static Error load_gdextension_resource(const String &p_path, Ref<GDExtension> &p_extension);

virtual Ref<Resource> load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
virtual void get_recognized_extensions(List<String> *p_extensions) const override;
virtual void get_recognized_extensions(List<String> *r_extensions) const override;
virtual bool handles_type(const String &p_type) const override;
virtual String get_resource_type(const String &p_path) const override;
};
Expand Down
8 changes: 4 additions & 4 deletions core/io/image_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ Error ImageLoader::load_image(const String &p_file, Ref<Image> p_image, Ref<File
return ERR_FILE_UNRECOGNIZED;
}

void ImageLoader::get_recognized_extensions(List<String> *p_extensions) {
void ImageLoader::get_recognized_extensions(List<String> *r_extensions) {
for (int i = 0; i < loader.size(); i++) {
loader[i]->get_recognized_extensions(p_extensions);
loader[i]->get_recognized_extensions(r_extensions);
}
}

Expand Down Expand Up @@ -201,8 +201,8 @@ Ref<Resource> ResourceFormatLoaderImage::load(const String &p_path, const String
return image;
}

void ResourceFormatLoaderImage::get_recognized_extensions(List<String> *p_extensions) const {
p_extensions->push_back("image");
void ResourceFormatLoaderImage::get_recognized_extensions(List<String> *r_extensions) const {
r_extensions->push_back("image");
}

bool ResourceFormatLoaderImage::handles_type(const String &p_type) const {
Expand Down
8 changes: 4 additions & 4 deletions core/io/image_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ImageFormatLoader : public RefCounted {
static void _bind_methods();

virtual Error load_image(Ref<Image> p_image, Ref<FileAccess> p_fileaccess, BitField<ImageFormatLoader::LoaderFlags> p_flags = FLAG_NONE, float p_scale = 1.0) = 0;
virtual void get_recognized_extensions(List<String> *p_extensions) const = 0;
virtual void get_recognized_extensions(List<String> *r_extensions) const = 0;
bool recognize(const String &p_extension) const;

public:
Expand All @@ -76,7 +76,7 @@ class ImageFormatLoaderExtension : public ImageFormatLoader {

public:
virtual Error load_image(Ref<Image> p_image, Ref<FileAccess> p_fileaccess, BitField<ImageFormatLoader::LoaderFlags> p_flags = FLAG_NONE, float p_scale = 1.0) override;
virtual void get_recognized_extensions(List<String> *p_extensions) const override;
virtual void get_recognized_extensions(List<String> *r_extensions) const override;

void add_format_loader();
void remove_format_loader();
Expand All @@ -92,7 +92,7 @@ class ImageLoader {
protected:
public:
static Error load_image(const String &p_file, Ref<Image> p_image, Ref<FileAccess> p_custom = Ref<FileAccess>(), BitField<ImageFormatLoader::LoaderFlags> p_flags = ImageFormatLoader::FLAG_NONE, float p_scale = 1.0);
static void get_recognized_extensions(List<String> *p_extensions);
static void get_recognized_extensions(List<String> *r_extensions);
static Ref<ImageFormatLoader> recognize(const String &p_extension);

static void add_image_format_loader(Ref<ImageFormatLoader> p_loader);
Expand All @@ -104,7 +104,7 @@ class ImageLoader {
class ResourceFormatLoaderImage : public ResourceFormatLoader {
public:
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
virtual void get_recognized_extensions(List<String> *p_extensions) const override;
virtual void get_recognized_extensions(List<String> *r_extensions) const override;
virtual bool handles_type(const String &p_type) const override;
virtual String get_resource_type(const String &p_path) const override;
};
Expand Down
8 changes: 4 additions & 4 deletions core/io/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,8 +1377,8 @@ Ref<Resource> ResourceFormatLoaderJSON::load(const String &p_path, const String
return json;
}

void ResourceFormatLoaderJSON::get_recognized_extensions(List<String> *p_extensions) const {
p_extensions->push_back("json");
void ResourceFormatLoaderJSON::get_recognized_extensions(List<String> *r_extensions) const {
r_extensions->push_back("json");
}

bool ResourceFormatLoaderJSON::handles_type(const String &p_type) const {
Expand Down Expand Up @@ -1412,10 +1412,10 @@ Error ResourceFormatSaverJSON::save(const Ref<Resource> &p_resource, const Strin
return OK;
}

void ResourceFormatSaverJSON::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const {
void ResourceFormatSaverJSON::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *r_extensions) const {
Ref<JSON> json = p_resource;
if (json.is_valid()) {
p_extensions->push_back("json");
r_extensions->push_back("json");
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/io/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ class JSON : public Resource {
class ResourceFormatLoaderJSON : public ResourceFormatLoader {
public:
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
virtual void get_recognized_extensions(List<String> *p_extensions) const override;
virtual void get_recognized_extensions(List<String> *r_extensions) const override;
virtual bool handles_type(const String &p_type) const override;
virtual String get_resource_type(const String &p_path) const override;
};

class ResourceFormatSaverJSON : public ResourceFormatSaver {
public:
virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *r_extensions) const override;
virtual bool recognize(const Ref<Resource> &p_resource) const override;
};

Expand Down
16 changes: 8 additions & 8 deletions core/io/resource_format_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1262,9 +1262,9 @@ Ref<Resource> ResourceFormatLoaderBinary::load(const String &p_path, const Strin
return loader.resource;
}

void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const {
void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String &p_type, List<String> *r_extensions) const {
if (p_type.is_empty()) {
get_recognized_extensions(p_extensions);
get_recognized_extensions(r_extensions);
return;
}

Expand All @@ -1280,18 +1280,18 @@ void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String

for (const String &E : extensions) {
String ext = E.to_lower();
p_extensions->push_back(ext);
r_extensions->push_back(ext);
}
}

void ResourceFormatLoaderBinary::get_recognized_extensions(List<String> *p_extensions) const {
void ResourceFormatLoaderBinary::get_recognized_extensions(List<String> *r_extensions) const {
List<String> extensions;
ClassDB::get_resource_base_extensions(&extensions);
extensions.sort();

for (const String &E : extensions) {
String ext = E.to_lower();
p_extensions->push_back(ext);
r_extensions->push_back(ext);
}
}

Expand Down Expand Up @@ -2518,11 +2518,11 @@ bool ResourceFormatSaverBinary::recognize(const Ref<Resource> &p_resource) const
return true; //all recognized
}

void ResourceFormatSaverBinary::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const {
void ResourceFormatSaverBinary::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *r_extensions) const {
String base = p_resource->get_base_extension().to_lower();
p_extensions->push_back(base);
r_extensions->push_back(base);
if (base != "res") {
p_extensions->push_back("res");
r_extensions->push_back("res");
}
}

Expand Down
6 changes: 3 additions & 3 deletions core/io/resource_format_binary.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ class ResourceLoaderBinary {
class ResourceFormatLoaderBinary : public ResourceFormatLoader {
public:
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const override;
virtual void get_recognized_extensions(List<String> *p_extensions) const override;
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *r_extensions) const override;
virtual void get_recognized_extensions(List<String> *r_extensions) const override;
virtual bool handles_type(const String &p_type) const override;
virtual String get_resource_type(const String &p_path) const override;
virtual String get_resource_script_class(const String &p_path) const override;
Expand Down Expand Up @@ -185,7 +185,7 @@ class ResourceFormatSaverBinary : public ResourceFormatSaver {
virtual Error save(const Ref<Resource> &p_resource, const String &p_path, uint32_t p_flags = 0) override;
virtual Error set_uid(const String &p_path, ResourceUID::ID p_uid) override;
virtual bool recognize(const Ref<Resource> &p_resource) const override;
virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *r_extensions) const override;

ResourceFormatSaverBinary();
};
Expand Down
10 changes: 5 additions & 5 deletions core/io/resource_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,24 +183,24 @@ Ref<Resource> ResourceFormatImporter::load_internal(const String &p_path, Error
return res;
}

void ResourceFormatImporter::get_recognized_extensions(List<String> *p_extensions) const {
void ResourceFormatImporter::get_recognized_extensions(List<String> *r_extensions) const {
HashSet<String> found;

for (int i = 0; i < importers.size(); i++) {
List<String> local_exts;
importers[i]->get_recognized_extensions(&local_exts);
for (const String &F : local_exts) {
if (!found.has(F)) {
p_extensions->push_back(F);
r_extensions->push_back(F);
found.insert(F);
}
}
}
}

void ResourceFormatImporter::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const {
void ResourceFormatImporter::get_recognized_extensions_for_type(const String &p_type, List<String> *r_extensions) const {
if (p_type.is_empty()) {
get_recognized_extensions(p_extensions);
get_recognized_extensions(r_extensions);
return;
}

Expand All @@ -220,7 +220,7 @@ void ResourceFormatImporter::get_recognized_extensions_for_type(const String &p_
importers[i]->get_recognized_extensions(&local_exts);
for (const String &F : local_exts) {
if (!found.has(F)) {
p_extensions->push_back(F);
r_extensions->push_back(F);
found.insert(F);
}
}
Expand Down
6 changes: 3 additions & 3 deletions core/io/resource_importer.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class ResourceFormatImporter : public ResourceFormatLoader {
static ResourceFormatImporter *get_singleton() { return singleton; }
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE) override;
Ref<Resource> load_internal(const String &p_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode, bool p_silence_errors);
virtual void get_recognized_extensions(List<String> *p_extensions) const override;
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const override;
virtual void get_recognized_extensions(List<String> *r_extensions) const override;
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *r_extensions) const override;
virtual bool recognize_path(const String &p_path, const String &p_for_type = String()) const override;
virtual bool handles_type(const String &p_type) const override;
virtual String get_resource_type(const String &p_path) const override;
Expand Down Expand Up @@ -114,7 +114,7 @@ class ResourceImporter : public RefCounted {

virtual String get_importer_name() const = 0;
virtual String get_visible_name() const = 0;
virtual void get_recognized_extensions(List<String> *p_extensions) const = 0;
virtual void get_recognized_extensions(List<String> *r_extensions) const = 0;
virtual String get_save_extension() const = 0;
virtual String get_resource_type() const = 0;
virtual float get_priority() const { return 1.0; }
Expand Down
12 changes: 6 additions & 6 deletions core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ bool ResourceFormatLoader::has_custom_uid_support() const {
return GDVIRTUAL_IS_OVERRIDDEN(_get_resource_uid);
}

void ResourceFormatLoader::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const {
void ResourceFormatLoader::get_recognized_extensions_for_type(const String &p_type, List<String> *r_extensions) const {
if (p_type.is_empty() || handles_type(p_type)) {
get_recognized_extensions(p_extensions);
get_recognized_extensions(r_extensions);
}
}

void ResourceLoader::get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) {
void ResourceLoader::get_recognized_extensions_for_type(const String &p_type, List<String> *r_extensions) {
for (int i = 0; i < loader_count; i++) {
loader[i]->get_recognized_extensions_for_type(p_type, p_extensions);
loader[i]->get_recognized_extensions_for_type(p_type, r_extensions);
}
}

Expand All @@ -149,12 +149,12 @@ bool ResourceFormatLoader::exists(const String &p_path) const {
return FileAccess::exists(p_path); // By default just check file.
}

void ResourceFormatLoader::get_recognized_extensions(List<String> *p_extensions) const {
void ResourceFormatLoader::get_recognized_extensions(List<String> *r_extensions) const {
PackedStringArray exts;
if (GDVIRTUAL_CALL(_get_recognized_extensions, exts)) {
const String *r = exts.ptr();
for (int i = 0; i < exts.size(); ++i) {
p_extensions->push_back(r[i]);
r_extensions->push_back(r[i]);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions core/io/resource_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class ResourceFormatLoader : public RefCounted {
public:
virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE);
virtual bool exists(const String &p_path) const;
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
virtual void get_recognized_extensions(List<String> *r_extensions) const;
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *r_extensions) const;
virtual bool recognize_path(const String &p_path, const String &p_for_type = String()) const;
virtual bool handles_type(const String &p_type) const;
virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes);
Expand Down Expand Up @@ -232,7 +232,7 @@ class ResourceLoader {
static Ref<Resource> load(const String &p_path, const String &p_type_hint = "", ResourceFormatLoader::CacheMode p_cache_mode = ResourceFormatLoader::CACHE_MODE_REUSE, Error *r_error = nullptr);
static bool exists(const String &p_path, const String &p_type_hint = "");

static void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions);
static void get_recognized_extensions_for_type(const String &p_type, List<String> *r_extensions);
static void add_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader, bool p_at_front = false);
static void remove_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader);
static void get_classes_used(const String &p_path, HashSet<StringName> *r_classes);
Expand Down
8 changes: 4 additions & 4 deletions core/io/resource_saver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ bool ResourceFormatSaver::recognize(const Ref<Resource> &p_resource) const {
return success;
}

void ResourceFormatSaver::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const {
void ResourceFormatSaver::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *r_extensions) const {
PackedStringArray exts;
if (GDVIRTUAL_CALL(_get_recognized_extensions, p_resource, exts)) {
const String *r = exts.ptr();
for (int i = 0; i < exts.size(); ++i) {
p_extensions->push_back(r[i]);
r_extensions->push_back(r[i]);
}
}
}
Expand Down Expand Up @@ -174,10 +174,10 @@ void ResourceSaver::set_save_callback(ResourceSavedCallback p_callback) {
save_callback = p_callback;
}

void ResourceSaver::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) {
void ResourceSaver::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *r_extensions) {
ERR_FAIL_COND_MSG(p_resource.is_null(), "It's not a reference to a valid Resource object.");
for (int i = 0; i < saver_count; i++) {
saver[i]->get_recognized_extensions(p_resource, p_extensions);
saver[i]->get_recognized_extensions(p_resource, r_extensions);
}
}

Expand Down
Loading

0 comments on commit 7c00927

Please sign in to comment.