MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / StringName

Class StringName

modules/gui/gui/src/backend/text_server/string_name.h:50–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48};
49
50class StringName
51{
52 enum
53 {
54 STRING_TABLE_BITS = 16,
55 STRING_TABLE_LEN = 1 << STRING_TABLE_BITS,
56 STRING_TABLE_MASK = STRING_TABLE_LEN - 1
57 };
58
59 struct _Data {
60 SafeRefCount refcount;
61 SafeNumeric<uint32_t> static_count;
62 const char* cname = nullptr;
63 String name;
64#ifdef DEBUG_ENABLED
65 uint32_t debug_references = 0;
66#endif
67 String get_name() const
68 {
69 return cname ? String(cname) : name;
70 }
71 int idx = 0;
72 uint32_t hash = 0;
73 _Data* prev = nullptr;
74 _Data* next = nullptr;
75 _Data() {}
76 };
77
78 static _Data* _table[STRING_TABLE_LEN];
79
80 _Data* _data = nullptr;
81
82 union _HashUnion
83 {
84 _Data* ptr = nullptr;
85 uint32_t hash;
86 };
87
88 void unref();
89 friend void register_core_types();
90 friend void unregister_core_types();
91 friend class Main;
92 static Mutex mutex;
93 static void setup();
94 static void cleanup();
95 static bool configured;
96#ifdef DEBUG_ENABLED
97 struct DebugSortReferences {
98 bool operator()(const _Data* p_left, const _Data* p_right) const
99 {
100 return p_left->debug_references > p_right->debug_references;
101 }
102 };
103
104 static bool debug_stringname;
105#endif
106
107 StringName(_Data* p_data)

Callers 3

_scs_createFunction · 0.85
searchMethod · 0.85

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected