summaryrefslogtreecommitdiff
path: root/core/string_db.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/string_db.h')
-rw-r--r--core/string_db.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/core/string_db.h b/core/string_db.h
index f6c6ecefec..43bcccc902 100644
--- a/core/string_db.h
+++ b/core/string_db.h
@@ -46,16 +46,16 @@ struct StaticCString {
class StringName {
-
+
enum {
-
+
STRING_TABLE_BITS=12,
STRING_TABLE_LEN=1<<STRING_TABLE_BITS,
STRING_TABLE_MASK=STRING_TABLE_LEN-1
};
-
- struct _Data {
+
+ struct _Data {
SafeRefCount refcount;
const char* cname;
String name;
@@ -67,32 +67,32 @@ class StringName {
_Data *next;
_Data() { cname=NULL; next=prev=NULL; hash=0; }
};
-
-
+
+
static _Data *_table[STRING_TABLE_LEN];
-
+
_Data *_data;
-
+
union _HashUnion {
-
+
_Data *ptr;
uint32_t hash;
};
-
+
void unref();
friend void register_core_types();
friend void unregister_core_types();
-
+
static void setup();
static void cleanup();
static bool configured;
-
+
StringName(_Data *p_data) { _data=p_data; }
public:
operator const void*() const { return (_data && (_data->cname || !_data->name.empty()))?(void*)1:0; }
-
+
bool operator==(const String& p_name) const;
bool operator==(const char* p_name) const;
bool operator!=(const String& p_name) const;
@@ -101,19 +101,19 @@ public:
return _data<p_name._data;
}
_FORCE_INLINE_ bool operator==(const StringName& p_name) const {
- // the real magic of all this mess happens here.
+ // the real magic of all this mess happens here.
// this is why path comparisons are very fast
return _data==p_name._data;
- }
+ }
_FORCE_INLINE_ uint32_t hash() const {
-
+
if (_data)
return _data->hash;
else
return 0;
}
bool operator!=(const StringName& p_name) const;
-
+
_FORCE_INLINE_ operator String() const {
if (_data) {
@@ -148,7 +148,7 @@ public:
};
struct StringNameHasher {
-
+
static _FORCE_INLINE_ uint32_t hash(const StringName &p_string) { return p_string.hash(); }
};