Berserk
Classes | Public Member Functions | List of all members
StringName Class Reference

Cached shared utf-8 string id. More...

#include <StringName.hpp>

Public Member Functions

BRK_API StringName (const String &str=String())
 
 StringName (const StringName &other)
 
 StringName (StringName &&other) noexcept
 
BRK_API ~StringName ()
 
BRK_API StringNameoperator= (const StringName &other)
 
BRK_API StringNameoperator= (StringName &&other) noexcept
 
BRK_API bool operator== (const StringName &other) const
 
BRK_API bool operator!= (const StringName &other) const
 
BRK_API const StringGetStr () const
 
BRK_API size_t GetHash () const
 

Detailed Description

Cached shared utf-8 string id.

Immutable reference counted shared utf-8 encoded string object. Must be used for string named objects, handlers and ids.

This string object must be used in case, when you need lots of references to the single immutable string identifier.

Supports fast O(1) string equality/inequality checks.

Constructor & Destructor Documentation

◆ StringName() [1/3]

BRK_NS_BEGIN StringName::StringName ( const String str = String())
explicit

Construct string id from utf-8 string

◆ StringName() [2/3]

StringName::StringName ( const StringName other)

Copy

◆ StringName() [3/3]

StringName::StringName ( StringName &&  other)
noexcept

Move

◆ ~StringName()

StringName::~StringName ( )

Safe release id. If it is last id reference, erase it from the cache.

Member Function Documentation

◆ GetHash()

size_t StringName::GetHash ( ) const
Returns
Hash value of this string name

◆ GetStr()

const String & StringName::GetStr ( ) const
Returns
String of this string name

◆ operator!=()

bool StringName::operator!= ( const StringName other) const
Returns
True if this ids not equal

◆ operator=() [1/2]

StringName & StringName::operator= ( const StringName other)

Copy

◆ operator=() [2/2]

StringName & StringName::operator= ( StringName &&  other)
noexcept

Move

◆ operator==()

bool StringName::operator== ( const StringName other) const
Returns
True if this ids equal

The documentation for this class was generated from the following files: