Loading...
Searching...
No Matches
Identifier Class Referencefinal

Represents a string identifier, designed for accessing properties by name. More...

#include <juce_Identifier.h>

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 (String::CharPointerType nameStart, String::CharPointerType nameEnd)
 Creates an identifier with a specified name.
 
 Identifier (const Identifier &other) noexcept
 Creates a copy of another identifier.
 
Identifieroperator= (const Identifier &other) noexcept
 Creates a copy of another identifier.
 
 Identifier (Identifier &&other) noexcept
 Creates a copy of another identifier.
 
Identifieroperator= (Identifier &&other) noexcept
 Creates a copy of another identifier.
 
 ~Identifier () noexcept
 Destructor.
 
bool operator== (const Identifier &other) const noexcept
 Compares two identifiers.
 
bool operator!= (const Identifier &other) const noexcept
 Compares two identifiers.
 
bool operator== (StringRef other) const noexcept
 Compares the identifier with a string.
 
bool operator!= (StringRef other) const noexcept
 Compares the identifier with a string.
 
bool operator< (StringRef other) const noexcept
 Compares the identifier with a string.
 
bool operator<= (StringRef other) const noexcept
 Compares the identifier with a string.
 
bool operator> (StringRef other) const noexcept
 Compares the identifier with a string.
 
bool operator>= (StringRef other) const noexcept
 Compares the identifier with a string.
 
const StringtoString () const noexcept
 Returns this identifier as a string.
 
 operator String::CharPointerType () const noexcept
 Returns this identifier's raw string pointer.
 
String::CharPointerType getCharPointer () const noexcept
 Returns this identifier's raw string pointer.
 
 operator StringRef () const noexcept
 Returns this identifier as a StringRef.
 
bool isValid () const noexcept
 Returns true if this Identifier is not null.
 
bool isNull () const noexcept
 Returns true if this Identifier is null.
 

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.
 

Static Public Attributes

static Identifier null
 A null identifier.
 

Detailed Description

Represents a string identifier, designed for accessing properties by name.

Comparing two Identifier objects is very fast (an O(1) operation), but creating them can be slower than just using a String directly, so the optimal way to use them is to keep some static Identifier objects for the things you use often.

See also
NamedValueSet, ValueTree

Constructor & Destructor Documentation

◆ Identifier() [1/6]

Identifier::Identifier ( )
noexcept

Creates a null identifier.

◆ Identifier() [2/6]

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() [3/6]

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() [4/6]

Identifier::Identifier ( String::CharPointerType nameStart,
String::CharPointerType nameEnd )

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() [5/6]

Identifier::Identifier ( const Identifier & other)
noexcept

Creates a copy of another identifier.

◆ Identifier() [6/6]

Identifier::Identifier ( Identifier && other)
noexcept

Creates a copy of another identifier.

◆ ~Identifier()

Identifier::~Identifier ( )
noexcept

Destructor.

Member Function Documentation

◆ operator=() [1/2]

Identifier & Identifier::operator= ( const Identifier & other)
noexcept

Creates a copy of another identifier.

◆ operator=() [2/2]

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

Creates a copy of another identifier.

◆ operator==() [1/2]

bool Identifier::operator== ( const Identifier & other) const
noexcept

Compares two identifiers.

This is a very fast operation.

References getCharPointer(), and name.

◆ operator!=() [1/2]

bool Identifier::operator!= ( const Identifier & other) const
noexcept

Compares two identifiers.

This is a very fast operation.

References name.

◆ operator==() [2/2]

bool Identifier::operator== ( StringRef other) const
noexcept

Compares the identifier with a string.

References name.

◆ operator!=() [2/2]

bool Identifier::operator!= ( StringRef other) const
noexcept

Compares the identifier with a string.

References name.

◆ operator<()

bool Identifier::operator< ( StringRef other) const
noexcept

Compares the identifier with a string.

References name.

◆ operator<=()

bool Identifier::operator<= ( StringRef other) const
noexcept

Compares the identifier with a string.

References name.

◆ operator>()

bool Identifier::operator> ( StringRef other) const
noexcept

Compares the identifier with a string.

References name.

◆ operator>=()

bool Identifier::operator>= ( StringRef other) const
noexcept

Compares the identifier with a string.

References name.

◆ toString()

const String & Identifier::toString ( ) const
noexcept

Returns this identifier as a string.

References name.

◆ operator String::CharPointerType()

Identifier::operator String::CharPointerType ( ) const
noexcept

Returns this identifier's raw string pointer.

References name.

◆ getCharPointer()

String::CharPointerType Identifier::getCharPointer ( ) const
noexcept

Returns this identifier's raw string pointer.

References name.

Referenced by operator==().

◆ operator StringRef()

Identifier::operator StringRef ( ) const
noexcept

Returns this identifier as a StringRef.

References name.

◆ isValid()

bool Identifier::isValid ( ) const
noexcept

Returns true if this Identifier is not null.

References name.

◆ isNull()

bool Identifier::isNull ( ) const
noexcept

Returns true if this Identifier is null.

References name.

◆ isValidIdentifier()

static bool Identifier::isValidIdentifier ( const String & possibleIdentifier)
staticnoexcept

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.

Member Data Documentation

◆ null

Identifier Identifier::null
static

A null identifier.


The documentation for this class was generated from the following file:
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram