C++ API Reference
|
A non-mutable string with O(1) comparison operators. More...
#include <MUniqueString.h>
Public Member Functions | |
MUniqueString () | |
The Class constructor. More... | |
MUniqueString (const MUniqueString &) | |
Copy constructor. More... | |
~MUniqueString () | |
Destructor. More... | |
MUniqueString (MUniqueString &&) | |
Move constructor. More... | |
MUniqueString & | operator= (MUniqueString &&) |
Move assignment. More... | |
const MString & | string () const |
Return a constant MString which is equal to the MString used to create this MUniqueString. More... | |
size_t | hash () const |
bool | operator== (const MUniqueString &other) const |
Two MUniqueString instance are equal if and only if their underlying string values are equal. More... | |
bool | operator!= (const MUniqueString &other) const |
Two MUniqueString instance are not equal if and only if their underlying string values are not equal. More... | |
bool | operator> (const MUniqueString &other) const |
This comparison operator does not compare the underlying string values of the MUniqueString instances. More... | |
bool | operator>= (const MUniqueString &other) const |
This comparison operator does not compare the underlying string values of the MUniqueString instances. More... | |
bool | operator< (const MUniqueString &other) const |
This comparison operator does not compare the underlying string values of the MUniqueString instances. More... | |
bool | operator<= (const MUniqueString &other) const |
This comparison operator does not compare the underlying string values of the MUniqueString instances. More... | |
bool | operator== (const MString &other) const |
This comparison operator compares the underlying string value of the MUniqueString instance and the MString. More... | |
bool | operator== (const char *other) const |
This comparison operator compares the underlying string value of the MUniqueString instance and the char*. More... | |
bool | operator!= (const MString &other) const |
This comparison operator compares the underlying string value of the MUniqueString instance and the MString. More... | |
bool | operator!= (const char *other) const |
This comparison operator compares the underlying string value of the MUniqueString instance and the char*. More... | |
Static Public Member Functions | |
static MUniqueString | intern (const MString &s) |
Create an MUniqueString from the given MString s. More... | |
A non-mutable string with O(1) comparison operators.
MUniqueString is a non-mutable string class which provides an O(1) equality operator, comparison operators and hash function.
Two MUniqueString instances are equal if and only if their underlying string values are equal.
operator>, operator>=, operator< and operator<= do not compare the underlying string values of the MUniqueStrings. The ordering produced by MUniqueString comparison methods does not necessarily match the ordering produced by typical string comparison operators.
MUniqueString is not order-preserving. MString A < MString B does not imply MUniqueString::intern(A) < MUniqueString::intern(B).
The hash value is not deterministically computed from the underlying string value. The hash value of all existing MUniqueString instances are guaranteed to match if the underlying string values of the instances are equal. It is not safe to store the hash value of an MUniqueString after it has been deleted. The hash value of of a deleted MUniqueString is not guaranteed to match a newly created MUniqueString with the same underlying string value as the original deleted MUniqueString instance.
OPENMAYA_MAJOR_NAMESPACE_OPEN MUniqueString | ( | ) |
The Class constructor.
Initializes the new MUniqueString instance to the empty string.
This function may perform global synchronization and is slow.
MUniqueString | ( | const MUniqueString & | other | ) |
Copy constructor.
Initialize the new MUniqueString instance be to equal to the existing MUniqueString.
This function may perform global synchronization and is slow.
[in] | other | MUniqueString instance copied to construct this MUniqueString. |
~MUniqueString | ( | ) |
Destructor.
This function may perform global synchronization and is slow.
MUniqueString | ( | MUniqueString && | other | ) |
Move constructor.
[in] | other | rvalue used to construct this MUniqueString. |
|
static |
Create an MUniqueString from the given MString s.
This function will access and possibly modify the global MUniqueString table so calls to this function are slow.
This function may perform global synchronization and is slow.
[in] | s | The string to be made unique. |
MUniqueString & operator= | ( | MUniqueString && | other | ) |
Move assignment.
[in] | other | rvalue assigned to this MUniqueString. |
const MString & string | ( | ) | const |
Return a constant MString which is equal to the MString used to create this MUniqueString.
Modifying the returned MString has undefined behavior.
size_t hash | ( | ) | const |
bool operator== | ( | const MUniqueString & | other | ) | const |
Two MUniqueString instance are equal if and only if their underlying string values are equal.
[in] | other | MUniqueString compared to this MUniqueString. |
bool operator!= | ( | const MUniqueString & | other | ) | const |
Two MUniqueString instance are not equal if and only if their underlying string values are not equal.
[in] | other | MUniqueString compared to this MUniqueString. |
bool operator> | ( | const MUniqueString & | other | ) | const |
This comparison operator does not compare the underlying string values of the MUniqueString instances.
[in] | other | MUniqueString compared to this MUniqueString. |
bool operator>= | ( | const MUniqueString & | other | ) | const |
This comparison operator does not compare the underlying string values of the MUniqueString instances.
[in] | other | MUniqueString compared to this MUniqueString. |
bool operator< | ( | const MUniqueString & | other | ) | const |
This comparison operator does not compare the underlying string values of the MUniqueString instances.
[in] | other | MUniqueString compared to this MUniqueString. |
bool operator<= | ( | const MUniqueString & | other | ) | const |
This comparison operator does not compare the underlying string values of the MUniqueString instances.
[in] | other | MUniqueString compared to this MUniqueString. |
bool operator== | ( | const MString & | other | ) | const |
This comparison operator compares the underlying string value of the MUniqueString instance and the MString.
This function is linear in the number of characters in other.
[in] | other | MString instance compared to this MUniqueString. |
bool operator== | ( | const char * | other | ) | const |
This comparison operator compares the underlying string value of the MUniqueString instance and the char*.
This function is linear in the number of characters in other.
[in] | other | char* value compared to this MUniqueString. |
bool operator!= | ( | const MString & | other | ) | const |
This comparison operator compares the underlying string value of the MUniqueString instance and the MString.
This function is linear in the number of characters in other.
[in] | other | MString instance compared to this MUniqueString. |
bool operator!= | ( | const char * | other | ) | const |
This comparison operator compares the underlying string value of the MUniqueString instance and the char*.
This function is linear in the number of characters in other.
[in] | other | char* value compared to this MUniqueString. |