diff options
Diffstat (limited to 'modules/regex')
-rw-r--r-- | modules/regex/regex.cpp | 8 | ||||
-rw-r--r-- | modules/regex/regex.h | 4 | ||||
-rw-r--r-- | modules/regex/register_types.cpp | 11 | ||||
-rw-r--r-- | modules/regex/register_types.h | 6 |
4 files changed, 19 insertions, 10 deletions
diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index ee1137b71f..bbe92139e0 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -52,9 +52,9 @@ int RegExMatch::_find(const Variant &p_name) const { return i; } else if (p_name.get_type() == Variant::STRING) { - const Map<String, int>::Element *found = names.find((String)p_name); + HashMap<String, int>::ConstIterator found = names.find((String)p_name); if (found) { - return found->value(); + return found->value; } } @@ -75,8 +75,8 @@ int RegExMatch::get_group_count() const { Dictionary RegExMatch::get_names() const { Dictionary result; - for (const Map<String, int>::Element *i = names.front(); i != nullptr; i = i->next()) { - result[i->key()] = i->value(); + for (const KeyValue<String, int> &E : names) { + result[E.key] = E.value; } return result; diff --git a/modules/regex/regex.h b/modules/regex/regex.h index e7221f4070..1455188670 100644 --- a/modules/regex/regex.h +++ b/modules/regex/regex.h @@ -33,7 +33,7 @@ #include "core/object/ref_counted.h" #include "core/string/ustring.h" -#include "core/templates/map.h" +#include "core/templates/rb_map.h" #include "core/templates/vector.h" #include "core/variant/array.h" #include "core/variant/dictionary.h" @@ -48,7 +48,7 @@ class RegExMatch : public RefCounted { String subject; Vector<Range> data; - Map<String, int> names; + HashMap<String, int> names; friend class RegEx; diff --git a/modules/regex/register_types.cpp b/modules/regex/register_types.cpp index 9289a724d8..2103c57f77 100644 --- a/modules/regex/register_types.cpp +++ b/modules/regex/register_types.cpp @@ -32,10 +32,17 @@ #include "core/object/class_db.h" #include "regex.h" -void register_regex_types() { +void initialize_regex_module(ModuleInitializationLevel p_level) { + if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { + return; + } + GDREGISTER_CLASS(RegExMatch); GDREGISTER_CLASS(RegEx); } -void unregister_regex_types() { +void uninitialize_regex_module(ModuleInitializationLevel p_level) { + if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { + return; + } } diff --git a/modules/regex/register_types.h b/modules/regex/register_types.h index b2d5009ef4..c3edf23562 100644 --- a/modules/regex/register_types.h +++ b/modules/regex/register_types.h @@ -31,7 +31,9 @@ #ifndef REGEX_REGISTER_TYPES_H #define REGEX_REGISTER_TYPES_H -void register_regex_types(); -void unregister_regex_types(); +#include "modules/register_module_types.h" + +void initialize_regex_module(ModuleInitializationLevel p_level); +void uninitialize_regex_module(ModuleInitializationLevel p_level); #endif // REGEX_REGISTER_TYPES_H |