Id Class

(Core::Id)

The Id class encapsulates an identifier that is unique within a specific running Qt Creator process. More...

Header: #include <Id>

Public Functions

Id()
Id(const char *name)
bool alphabeticallyBefore(Id other) const
bool isValid() const
QByteArray name() const
QString suffixAfter(Id baseId) const
QVariant toSetting() const
QString toString() const
quintptr uniqueIdentifier() const
Id withPrefix(const char *prefix) const
Id withSuffix(int suffix) const
Id withSuffix(const char *suffix) const
Id withSuffix(const QString &suffix) const
bool operator!=(Id id) const
bool operator!=(const char *name) const
bool operator<(Id id) const
bool operator==(Id id) const
bool operator==(const char *name) const
bool operator>(Id id) const

Static Public Members

Id fromSetting(const QVariant &variant)
QSet<Id> fromStringList(const QStringList &list)
QStringList toStringList(const QSet<Id> &ids)
Id versionedId(const QByteArray &prefix, int major, int minor = -1)

Detailed Description

The Id class encapsulates an identifier that is unique within a specific running Qt Creator process.

Core::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()

Default constructs an instance of Id.

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.

bool Id::alphabeticallyBefore(Id other) const

[static] Id Id::fromSetting(const QVariant &variant)

Reconstructs an id from a persistent value.

See also toSetting().

[static] QSet<Id> Id::fromStringList(const QStringList &list)

bool Id::isValid() const

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().

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().

[static] QStringList Id::toStringList(const QSet<Id> &ids)

quintptr Id::uniqueIdentifier() const

[static] Id Id::versionedId(const QByteArray &prefix, int major, int minor = -1)

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.

See also stringSuffix().

bool Id::operator!=(Id id) const

bool Id::operator!=(const char *name) const

bool Id::operator<(Id id) const

bool Id::operator==(Id id) const

bool Id::operator==(const char *name) const

bool Id::operator>(Id id) const