Represents a string identifier, designed for accessing properties by name. More...
Public Member Functions | |
| Identifier () noexcept | |
| Creates a null identifier. | |
| Identifier (const char *name) | |
| Creates an identifier with a specified name. | |
| Identifier (const String &name) | |
| Creates an identifier with a specified name. | |
| Identifier (const Identifier &other) noexcept | |
| Creates a copy of another identifier. | |
| Identifier & | operator= (const Identifier &other) noexcept |
| Creates a copy of another identifier. | |
| ~Identifier () | |
| Destructor. | |
| bool | operator== (const Identifier &other) const noexcept |
| Compares two identifiers. | |
| bool | operator!= (const Identifier &other) const noexcept |
| Compares two identifiers. | |
| String | toString () const |
| Returns this identifier as a string. | |
| operator const String::CharPointerType () const noexcept | |
| Returns this identifier's raw string pointer. | |
| const String::CharPointerType | getCharPointer () const noexcept |
| Returns this identifier's raw string pointer. | |
Static Public Member Functions | |
| static bool | isValidIdentifier (const String &possibleIdentifier) noexcept |
| Checks a given string for characters that might not be valid in an Identifier. | |
Represents a string identifier, designed for accessing properties by name.
Identifier objects are very light and fast to copy, but slower to initialise from a string, so it's much faster to keep a static identifier object to refer to frequently-used names, rather than constructing them each time you need it.
Creates a null identifier.
| Identifier::Identifier | ( | const char * | name | ) |
Creates an identifier with a specified name.
Because this name may need to be used in contexts such as script variables or XML tags, it must only contain ascii letters and digits, or the underscore character.
| Identifier::Identifier | ( | const String & | name | ) |
Creates an identifier with a specified name.
Because this name may need to be used in contexts such as script variables or XML tags, it must only contain ascii letters and digits, or the underscore character.
| Identifier::Identifier | ( | const Identifier & | other | ) |
Creates a copy of another identifier.
Destructor.
| Identifier& Identifier::operator= | ( | const Identifier & | other | ) |
Creates a copy of another identifier.
| bool Identifier::operator== | ( | const Identifier & | other | ) | const |
Compares two identifiers.
This is a very fast operation.
| bool Identifier::operator!= | ( | const Identifier & | other | ) | const |
Compares two identifiers.
This is a very fast operation.
| String Identifier::toString | ( | ) | const |
Returns this identifier as a string.
| Identifier::operator const String::CharPointerType | ( | ) | const |
Returns this identifier's raw string pointer.
| const String::CharPointerType Identifier::getCharPointer | ( | ) | const |
Returns this identifier's raw string pointer.
| static bool Identifier::isValidIdentifier | ( | const String & | possibleIdentifier | ) | [static] |
Checks a given string for characters that might not be valid in an Identifier.
Since Identifiers are used as a script variables and XML attributes, they should only contain alphanumeric characters, underscores, or the '-' and ':' characters.