Add a new HashSet template
* Intended to replace RBSet in most cases. * Optimized for iteration speed
This commit is contained in:
parent
410893ad0f
commit
45af29da80
243 changed files with 1400 additions and 662 deletions
|
|
@ -1390,7 +1390,7 @@ void ClassDB::get_extensions_for_type(const StringName &p_class, List<String> *p
|
|||
}
|
||||
|
||||
HashMap<StringName, HashMap<StringName, Variant>> ClassDB::default_values;
|
||||
RBSet<StringName> ClassDB::default_values_cached;
|
||||
HashSet<StringName> ClassDB::default_values_cached;
|
||||
|
||||
Variant ClassDB::class_get_default_property_value(const StringName &p_class, const StringName &p_property, bool *r_valid) {
|
||||
if (!default_values_cached.has(p_class)) {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
// Makes callable_mp readily available in all classes connecting signals.
|
||||
// Needs to come after method_bind and object have been included.
|
||||
#include "core/object/callable_method_pointer.h"
|
||||
#include "core/templates/hash_set.h"
|
||||
|
||||
#define DEFVAL(m_defval) (m_defval)
|
||||
|
||||
|
|
@ -110,7 +111,7 @@ public:
|
|||
#ifdef DEBUG_METHODS_ENABLED
|
||||
List<StringName> constant_order;
|
||||
List<StringName> method_order;
|
||||
RBSet<StringName> methods_in_properties;
|
||||
HashSet<StringName> methods_in_properties;
|
||||
List<MethodInfo> virtual_methods;
|
||||
HashMap<StringName, MethodInfo> virtual_methods_map;
|
||||
HashMap<StringName, Vector<Error>> method_error_values;
|
||||
|
|
@ -149,7 +150,7 @@ public:
|
|||
static void _add_class2(const StringName &p_class, const StringName &p_inherits);
|
||||
|
||||
static HashMap<StringName, HashMap<StringName, Variant>> default_values;
|
||||
static RBSet<StringName> default_values_cached;
|
||||
static HashSet<StringName> default_values_cached;
|
||||
|
||||
// Native structs, used by binder
|
||||
struct NativeStruct {
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@
|
|||
#include "core/os/rw_lock.h"
|
||||
#include "core/os/spin_lock.h"
|
||||
#include "core/templates/hash_map.h"
|
||||
#include "core/templates/hash_set.h"
|
||||
#include "core/templates/list.h"
|
||||
#include "core/templates/rb_map.h"
|
||||
#include "core/templates/rb_set.h"
|
||||
#include "core/templates/safe_refcount.h"
|
||||
#include "core/templates/vmap.h"
|
||||
#include "core/variant/callable_bind.h"
|
||||
|
|
@ -510,7 +510,7 @@ private:
|
|||
#ifdef TOOLS_ENABLED
|
||||
bool _edited = false;
|
||||
uint32_t _edited_version = 0;
|
||||
RBSet<String> editor_section_folding;
|
||||
HashSet<String> editor_section_folding;
|
||||
#endif
|
||||
ScriptInstance *script_instance = nullptr;
|
||||
Variant script; // Reference does not exist yet, store it in a Variant.
|
||||
|
|
@ -815,7 +815,7 @@ public:
|
|||
#ifdef TOOLS_ENABLED
|
||||
void editor_set_section_unfold(const String &p_section, bool p_unfolded);
|
||||
bool editor_is_section_unfolded(const String &p_section);
|
||||
const RBSet<String> &editor_get_section_folding() const { return editor_section_folding; }
|
||||
const HashSet<String> &editor_get_section_folding() const { return editor_section_folding; }
|
||||
void editor_clear_section_folding() { editor_section_folding.clear(); }
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ bool PlaceHolderScriptInstance::has_method(const StringName &p_method) const {
|
|||
}
|
||||
|
||||
void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, const HashMap<StringName, Variant> &p_values) {
|
||||
RBSet<StringName> new_values;
|
||||
HashSet<StringName> new_values;
|
||||
for (const PropertyInfo &E : p_properties) {
|
||||
StringName n = E.name;
|
||||
new_values.insert(n);
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ public:
|
|||
virtual int get_member_line(const StringName &p_member) const { return -1; }
|
||||
|
||||
virtual void get_constants(HashMap<StringName, Variant> *p_constants) {}
|
||||
virtual void get_members(RBSet<StringName> *p_constants) {}
|
||||
virtual void get_members(HashSet<StringName> *p_constants) {}
|
||||
|
||||
virtual bool is_placeholder_fallback_enabled() const { return false; }
|
||||
|
||||
|
|
@ -283,7 +283,7 @@ public:
|
|||
virtual Ref<Script> make_template(const String &p_template, const String &p_class_name, const String &p_base_class_name) const { return Ref<Script>(); }
|
||||
virtual Vector<ScriptTemplate> get_built_in_templates(StringName p_object) { return Vector<ScriptTemplate>(); }
|
||||
virtual bool is_using_templates() { return false; }
|
||||
virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptError> *r_errors = nullptr, List<Warning> *r_warnings = nullptr, RBSet<int> *r_safe_lines = nullptr) const = 0;
|
||||
virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptError> *r_errors = nullptr, List<Warning> *r_warnings = nullptr, HashSet<int> *r_safe_lines = nullptr) const = 0;
|
||||
virtual String validate_path(const String &p_path) const { return ""; }
|
||||
virtual Script *create_script() const = 0;
|
||||
virtual bool has_named_classes() const = 0;
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ public:
|
|||
}
|
||||
}
|
||||
GDVIRTUAL0RC(TypedArray<StringName>, _get_members)
|
||||
virtual void get_members(RBSet<StringName> *p_members) override {
|
||||
virtual void get_members(HashSet<StringName> *p_members) override {
|
||||
TypedArray<StringName> members;
|
||||
GDVIRTUAL_REQUIRED_CALL(_get_members, members);
|
||||
for (int i = 0; i < members.size(); i++) {
|
||||
|
|
@ -282,7 +282,7 @@ public:
|
|||
EXBIND0R(bool, is_using_templates)
|
||||
|
||||
GDVIRTUAL6RC(Dictionary, _validate, const String &, const String &, bool, bool, bool, bool)
|
||||
virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptError> *r_errors = nullptr, List<Warning> *r_warnings = nullptr, RBSet<int> *r_safe_lines = nullptr) const override {
|
||||
virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptError> *r_errors = nullptr, List<Warning> *r_warnings = nullptr, HashSet<int> *r_safe_lines = nullptr) const override {
|
||||
Dictionary ret;
|
||||
GDVIRTUAL_REQUIRED_CALL(_validate, p_script, p_path, r_functions != nullptr, r_errors != nullptr, r_warnings != nullptr, r_safe_lines != nullptr, ret);
|
||||
if (!ret.has("valid")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue