feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef STRING_NAME_H
#define STRING_NAME_H
#pragma once
#include "core/os/mutex.h"
#include "core/string/ustring.h"
@ -167,24 +166,49 @@ public:
static StringName search(const String &p_name);
struct AlphCompare {
_FORCE_INLINE_ bool operator()(const StringName &l, const StringName &r) const {
template <typename LT, typename RT>
_FORCE_INLINE_ bool operator()(const LT &l, const RT &r) const {
return compare(l, r);
}
_FORCE_INLINE_ static bool compare(const StringName &l, const StringName &r) {
const char *l_cname = l._data ? l._data->cname : "";
const char *r_cname = r._data ? r._data->cname : "";
if (l_cname) {
if (r_cname) {
return is_str_less(l_cname, r_cname);
return str_compare(l_cname, r_cname) < 0;
} else {
return is_str_less(l_cname, r._data->name.ptr());
return str_compare(l_cname, r._data->name.ptr()) < 0;
}
} else {
if (r_cname) {
return is_str_less(l._data->name.ptr(), r_cname);
return str_compare(l._data->name.ptr(), r_cname) < 0;
} else {
return is_str_less(l._data->name.ptr(), r._data->name.ptr());
return str_compare(l._data->name.ptr(), r._data->name.ptr()) < 0;
}
}
}
_FORCE_INLINE_ static bool compare(const String &l, const StringName &r) {
const char *r_cname = r._data ? r._data->cname : "";
if (r_cname) {
return str_compare(l.get_data(), r_cname) < 0;
} else {
return str_compare(l.get_data(), r._data->name.ptr()) < 0;
}
}
_FORCE_INLINE_ static bool compare(const StringName &l, const String &r) {
const char *l_cname = l._data ? l._data->cname : "";
if (l_cname) {
return str_compare(l_cname, r.get_data()) < 0;
} else {
return str_compare(l._data->name.ptr(), r.get_data()) < 0;
}
}
_FORCE_INLINE_ static bool compare(const String &l, const String &r) {
return str_compare(l.get_data(), r.get_data()) < 0;
}
};
StringName &operator=(const StringName &p_name);
@ -209,7 +233,13 @@ public:
StringName() {}
static void assign_static_unique_class_name(StringName *ptr, const char *p_name);
_FORCE_INLINE_ ~StringName() {
#ifdef SIZE_EXTRA
_NO_INLINE_
#else
_FORCE_INLINE_
#endif
~StringName() {
if (likely(configured) && _data) { //only free if configured
unref();
}
@ -220,6 +250,10 @@ public:
#endif
};
// Zero-constructing StringName initializes _data to nullptr (and thus empty).
template <>
struct is_zero_constructible<StringName> : std::true_type {};
bool operator==(const String &p_name, const StringName &p_string_name);
bool operator!=(const String &p_name, const StringName &p_string_name);
bool operator==(const char *p_name, const StringName &p_string_name);
@ -240,5 +274,3 @@ StringName _scs_create(const char *p_chr, bool p_static = false);
*/
#define SNAME(m_arg) ([]() -> const StringName & { static StringName sname = _scs_create(m_arg, true); return sname; })()
#endif // STRING_NAME_H