#include <apibaseid.h>

LiteralId is used as base class of Id. It may only be used for strings such as string literals which have a longer lifetime than the LiteralId object itself. The benefit is that LiteralId is a literal type and has a trivial destructor.
Public Member Functions | |
| constexpr | LiteralId () |
| LiteralId (const LiteralId &)=default | |
| MAXON_IMPLICIT | LiteralId (const Id &)=delete |
| LiteralId & | operator= (const LiteralId &)=default |
| LiteralId & | operator= (const Id &)=delete |
| template<UInt N> | |
| constexpr | LiteralId (const Char(&str)[N]) |
| Bool | operator== (const LiteralId &other) const |
| Bool | operator< (const LiteralId &other) const |
| MAXON_OPERATOR_COMPARISON (LiteralId) | |
| COMPARERESULT | Compare (const LiteralId &other) const |
| constexpr HashInt | GetHashCode () const |
| Bool | IsEmpty () const |
| Bool | IsPopulated () const |
| const Char * | GetCString () const |
| Int | GetCStringLength () const |
| String | ToString (const FormatStatement *formatStatement=nullptr) const |
| CString | ToCString () const |
| Block< const Char > | ToBlock () const |
| const Id & | Get () const |
| operator const Id & () const | |
| Bool | UsesRefCountedCString () const |
| template<UInt N> | |
| constexpr | LiteralId (bool dummy, const Char(&str)[N]) |
| constexpr | LiteralId (bool dummy, const LiteralId &src) |
| template<typename T , typename = typename T::DeclarationHelper> | |
| constexpr | LiteralId (bool dummy, const T &decl) |
Static Public Member Functions | |
| static constexpr HashInt | GetHashCode (const Char *str) |
Static Public Attributes | |
| static const Int | MAX_LENGTH_EXPONENT |
| static const UInt | LOW_HASH_MASK |
| static const Int | MAX_LENGTH |
Protected Member Functions | |
| constexpr | LiteralId (const Char *value, UInt hash) |
| LiteralId (ENUM_DONT_INITIALIZE) | |
Protected Attributes | |
| const Char * | _value |
| UInt | _hash |
Static Protected Attributes | |
| static const Int | RC_STRING_BIT |
| static const UInt | RC_STRING_MASK |
| static const UInt | HASH_MASK |
Friends | |
| class | EntityBase |
|
constexpr |
|
delete |
|
constexpr |
|
explicitprotected |
| MAXON_OPERATOR_COMPARISON | ( | LiteralId | ) |
| COMPARERESULT Compare | ( | const LiteralId & | other | ) | const |
|
constexpr |
| Bool IsEmpty | ( | ) | const |
| Bool IsPopulated | ( | ) | const |
Checks if this Id contains anything.
| const Char* GetCString | ( | ) | const |
Returns the internal c-string. No copy is made.
| Int GetCStringLength | ( | ) | const |
Returns the length of the internal c-string. This function doesn't have to scan the string, because the length is directly available in the Id.
| String ToString | ( | const FormatStatement * | formatStatement = nullptr | ) | const |
Returns a readable string of the content.
| [in] | formatStatement | Nullptr or additional formatting instruction. Currently no additional formatting instructions are supported. |
| CString ToCString | ( | ) | const |
| const Id& Get | ( | ) | const |
| operator const Id & | ( | ) | const |
| Bool UsesRefCountedCString | ( | ) | const |
Returns true if this Id uses a RefCountedCString. Otherwise, the Id uses a global c-string which is assumed to persist at least as long as the Id.
|
friend |
|
static |
|
static |
Mask for the lower bits of the hash (the part which corresponds to the hash code of the string).
|
staticprotected |
Bit position in _hash of the bit which is set when the Id uses a RefCountedCString.
|
staticprotected |
Mask to get the RC_STRING_BIT from _hash.
|
staticprotected |
Mask to get the hash code from _hash.
|
static |
|
protected |
C-string identifier. If the RC_STRING_BIT is set in _hash, this actually points to the _string part of a RefCountedCString.
|
protected |
Combination of hash code (lower bits), then a bit at RC_STRING_BIT and finally the string length (MAX_LENGTH_EXPONENT bits). Use HASH_MASK to mask out the RC_STRING_BIT.