Id Class
class Utils::IdThe Id class encapsulates an identifier that is unique within a specific running Qt Creator process. More...
Header: | #include <utils/id.h> |
Public Functions
Id(const char *name) | |
QByteArray | name() const |
QString | suffixAfter(Id baseId) const |
Key | toKey() const |
QVariant | toSetting() const |
QString | toString() const |
Id | withPrefix(const char *prefix) const |
Id | withSuffix(int suffix) const |
Id | withSuffix(const char *suffix) const |
Id | withSuffix(const QString &suffix) const |
Static Public Members
Id | fromName(const QByteArray &name) |
Id | fromSetting(const QVariant &variant) |
Id | fromString(const QString &name) |
Detailed Description
\inmodule
QtCreator
Utils::Id
is used as facility to identify objects of interest in a more typesafe and faster manner than a plain QString or QByteArray would provide.
An id is associated with a plain 7-bit-clean ASCII name used for display and persistency.
Member Function Documentation
Id::Id(const char *name)
Constructs an id given its associated name. The internal representation will be unspecified, but consistent within a Qt Creator process.
[static]
Id Id::fromName(const QByteArray &name)
Creates an id from a string representation.
This should not be used to handle a persistent version of the Id, use fromSetting()
instead.
\deprecated
See also toString() and fromSetting().
[static]
Id Id::fromSetting(const QVariant &variant)
Reconstructs an id from the persistent value variant.
See also toSetting().
[static]
Id Id::fromString(const QString &name)
Creates an id from a string representation.
This should not be used to handle a persistent version of the Id, use fromSetting()
instead.
\deprecated
See also toString() and fromSetting().
QByteArray Id::name() const
Returns an internal representation of the id.
QString Id::suffixAfter(Id baseId) const
Extracts a part of the id string representation. This function can be used to split off the base part specified by baseId used when generating an id with withSuffix()
.
See also withSuffix().
Key Id::toKey() const
\internal
QVariant Id::toSetting() const
Returns a persistent value representing the id which is suitable to be stored in QSettings.
See also fromSetting().
QString Id::toString() const
Returns a string representation of the id suitable for UI display.
This should not be used to create a persistent version of the Id, use toSetting()
instead.
See also fromString() and toSetting().
Id Id::withPrefix(const char *prefix) const
Constructs a derived id.
This can be used to construct groups of ids logically belonging together. The associated internal name will be generated by prepending prefix.
Id Id::withSuffix(int suffix) const
Constructs a derived id.
This can be used to construct groups of ids logically belonging together. The associated internal name will be generated by appending suffix.
Id Id::withSuffix(const char *suffix) const
This is an overloaded function.
Id Id::withSuffix(const QString &suffix) const
This is an overloaded function.