InternedId Class Reference Data Types
#include <datatypelib.h>
InternedId represents an Id which has been interned into a pool of unique Id objects. I.e., there are no two different Id objects with an equal id string, so for equality comparison you can compare pointers instead of whole strings.
You can use MAXON_INTERNED_ID and MAXON_INTERNED_ID_LOCAL to define interned ids which will be initialized automatically at module initialization.
InternedId
uses reference counting, so where possible use
{const
InternedId
&} instead of
InternedId
to avoid unnecesssary reference counting.
静态公共成员函数 |
|
template<typename INPUTTYPE > | |
static Result < InternedId > | 创建 (INPUTTYPE &&inputId) |
static const InternedId & | NullValue () |
静态公共属性 |
|
static const InternedId | NULL_VALUE |
Static Private Member Functions |
|
static void | Free (const Id *ptr) |
Private Attributes |
|
const Id * | _id |
InternedId | ( | ) |
Constructs an empty InternedId . You have to initialize it afterwards using Init() .
InternedId | ( | InternedId && | src | ) |
InternedId | ( | const InternedId & | src | ) |
~ InternedId | ( | ) |
InternedId & operator= | ( | InternedId && | src | ) |
InternedId & operator= | ( | const InternedId & | src | ) |
|
static |
创建新的 InternedId for the given inputId. All types for which there is an InternedId::Init function are supported.
[in] | inputId | The id to intern. |
INPUTTYPE | The type of inputId. All types for which there is an InternedId::Init function are supported. |
Result <void> Init | ( | const Id & | i | ) |
Initializes an InternedId with a given Id .
[in] | i | The id to intern. |
Result <void> Init | ( | const CString & | str | ) |
Initializes an InternedId with a given CString .
[in] | str | The string to intern. |
Result <void> Init | ( | const String & | str | ) |
Initializes an InternedId with a given String .
[in] | str | The string to intern. |
Result <void> Init | ( | const Char * | str | ) |
Initializes an InternedId with a given C-style string.
[in] | str | The string to intern. |
Result <void> Init | ( | const Block < const Char > & | str | ) |
Initializes an InternedId with a given block of characters.
[in] | str | The string to intern, no null termination required. |
operator const Id & | ( | ) | const |
Returns the interned Id . The returned object is unique, i.e., there is no other interned Id with an equal string.
const Id & Get | ( | ) | const |
Returns the interned Id . The returned object is unique, i.e., there is no other interned Id with an equal string.
const Id * GetPointer | ( | ) | const |
Returns a pointer to the interned Id . The pointer is unique, i.e., there is no other pointer to an interned Id with an equal string. The Id uses a special reference-counting, so you must only use the returned pointer as long as the owning InternedId is valid.
Bool operator== | ( | const InternedId & | other | ) | const |
Bool operator!= | ( | const InternedId & | other | ) | const |
Bool operator< | ( | const InternedId & | other | ) | const |
MAXON_OPERATOR_INEQUALITY | ( | InternedId | ) |
Bool operator== | ( | const Id & | other | ) | const |
Bool operator!= | ( | const Id & | other | ) | const |
COMPARERESULT 比较 | ( | const InternedId & | other | ) | const |
Compares two InternedId objects using the lexicographic order.
[in] | other | 其它 InternedId 对象。 |
HashInt GetHashCode | ( | ) | const |
const Char * GetCString | ( | ) | const |
Int GetCStringLength | ( | ) | const |
Block <const Char > ToBlock | ( | ) | const |
|
static |
String ToString | ( | const FormatStatement * |
fmt
=
nullptr
|
) | const |
Bool IsPopulated | ( | ) | const |
Bool IsEmpty | ( | ) | const |
void Reset | ( | ) |
|
static private |
|
|
private |
Pointer to the interned id.