MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / StringName

Class StringName

core/string/string_name.h:48–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46class Main;
47
48class [[nodiscard]] StringName {
49 struct Table;
50
51 struct _Data {
52 SafeRefCount refcount;
53 SafeNumeric<uint32_t> static_count;
54 String name;
55#ifdef DEBUG_ENABLED
56 uint32_t debug_references = 0;
57#endif
58
59 uint32_t hash = 0;
60 _Data *prev = nullptr;
61 _Data *next = nullptr;
62 _Data() {}
63 };
64
65 _Data *_data = nullptr;
66
67 void unref();
68 friend void register_core_types();
69 friend void unregister_core_types();
70 friend class Main;
71 static void setup();
72 static void cleanup();
73 static uint32_t get_empty_hash();
74 static inline bool configured = false;
75#ifdef DEBUG_ENABLED
76 struct DebugSortReferences {
77 bool operator()(const _Data *p_left, const _Data *p_right) const {
78 return p_left->debug_references > p_right->debug_references;
79 }
80 };
81
82 static inline bool debug_stringname = false;
83#endif
84
85 StringName(_Data *p_data) { _data = p_data; }
86
87public:
88 _FORCE_INLINE_ explicit operator bool() const { return _data; }
89
90 bool operator==(const String &p_name) const;
91 bool operator==(const char *p_name) const;
92 bool operator!=(const String &p_name) const;
93 bool operator!=(const char *p_name) const;
94
95 const char32_t *get_data() const { return _data ? _data->name.ptr() : U""; }
96 char32_t operator[](int p_index) const;
97 int length() const;
98 _FORCE_INLINE_ bool is_empty() const { return !_data; }
99
100 _FORCE_INLINE_ bool is_node_unique_name() const {
101 if (!_data) {
102 return false;
103 }
104 return (char32_t)_data->name[0] == (char32_t)UNIQUE_NODE_PREFIX[0];
105 }

Callers 15

get_nameMethod · 0.70
get_subnameMethod · 0.70
get_messageMethod · 0.70
get_messageMethod · 0.70
get_plural_messageMethod · 0.70
get_message_listMethod · 0.70
get_messageMethod · 0.70
erase_messageMethod · 0.70
_bind_methodsMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected