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)
Id(const QLatin1String &)
bool alphabeticallyBefore(Core::Id other) const
bool isValid() const
QByteArray name() const
QString suffixAfter(Core::Id baseId) const
QVariant toSetting() const
QString toString() const
quintptr uniqueIdentifier() const
Core::Id withPrefix(const char *prefix) const
Core::Id withSuffix(int suffix) const
Core::Id withSuffix(const char *suffix) const
Core::Id withSuffix(const QString &suffix) const
bool operator!=(Core::Id id) const
bool operator!=(const char *name) const
bool operator<(Core::Id id) const
bool operator==(Core::Id id) const
bool operator==(const char *name) const
bool operator>(Core::Id id) const

Static Public Members

Core::Id fromSetting(const QVariant &variant)
QSet<Core::Id> fromStringList(const QStringList &list)
QStringList toStringList(const QSet<Core::Id> &ids)
Core::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.

Id::Id(const QLatin1String &)

Default constructs an instance of Id.

bool Id::alphabeticallyBefore(Core::Id other) const

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

Reconstructs an id from the persistent value variant.

See also toSetting().

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

bool Id::isValid() const

QByteArray Id::name() const

Returns an internal representation of the id.

QString Id::suffixAfter(Core::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<Core::Id> &ids)

quintptr Id::uniqueIdentifier() const

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

Core::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.

Core::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.

Core::Id Id::withSuffix(const char *suffix) const

This is an overloaded function.

Core::Id Id::withSuffix(const QString &suffix) const

This is an overloaded function.

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

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

bool Id::operator<(Core::Id id) const

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

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

bool Id::operator>(Core::Id id) const