kdevplatform/vcs
#include <vcsrevision.h>
Public Types | |
enum | RevisionSpecialType { Head = 0, Working = 1, Base = 2, Previous = 3, Start = 4, UserSpecialType = 1000 } |
enum | RevisionType { Special = 0, GlobalNumber = 1, FileNumber = 2, Date = 3, Invalid = 4, UserType = 1000 } |
Public Member Functions | |
VcsRevision () | |
VcsRevision (const VcsRevision &) | |
virtual | ~VcsRevision () |
VcsRevision & | operator= (const VcsRevision &) |
bool | operator== (const KDevelop::VcsRevision &) const |
QString | prettyValue () const |
RevisionType | revisionType () const |
QVariant | revisionValue () const |
void | setRevisionValue (const QVariant &rev, RevisionType type) |
RevisionSpecialType | specialType () const |
Static Public Member Functions | |
static VcsRevision | createSpecialRevision (KDevelop::VcsRevision::RevisionSpecialType type) |
Protected Member Functions | |
QStringList | keys () const |
void | setSpecialType (RevisionSpecialType t) |
void | setType (RevisionType t) |
void | setValue (const QString &key, const QVariant &value) |
void | setValue (const QVariant &) |
QVariant | value (const QString &key) const |
Detailed Description
Encapsulates a vcs revision number, date or range of revisions.
The type of the QVariant value depends on the type of the revision, the following table lists the standard types and the according datatype in the QVariant:
Revision type | QVariant type |
---|---|
GlobalNumber | qlonglong/QString |
FileNumber | qlonglong/QString |
Date | QDateTime |
Special | KDevelop::VcsRevision::RevisionSpecialType or int, see explanation below |
The vcs plugins need to register the Revision and RevisionSpecialType with qRegisterMetaType.
Also Users of this class should set RevisionSpecialType QVariant values via
instead of
If the latter method is used the QVariant will be an Integer, which might not be handled by the vcs plugin and is possibly ambiguous with the qlonglong parameters.
Definition at line 66 of file vcsrevision.h.
Member Enumeration Documentation
◆ RevisionSpecialType
Definition at line 85 of file vcsrevision.h.
◆ RevisionType
- Note
- Not all VCS's support both FileNumber and GlobalNumber. For those that don't, asking for one may give you the other, therefore you should check which is returned. For example, CVS does not support GlobalNumber, and Subversion does not support FileNumber, while Perforce supports both.
Definition at line 76 of file vcsrevision.h.
Constructor & Destructor Documentation
◆ VcsRevision() [1/2]
KDevelop::VcsRevision::VcsRevision | ( | ) |
Creates an invalid revision.
Definition at line 64 of file vcsrevision.cpp.
◆ ~VcsRevision()
|
virtualdefault |
◆ VcsRevision() [2/2]
KDevelop::VcsRevision::VcsRevision | ( | const VcsRevision & | rhs | ) |
Definition at line 70 of file vcsrevision.cpp.
Member Function Documentation
◆ createSpecialRevision()
|
static |
Helper function to create a vcs revision for one of the special types.
Definition at line 49 of file vcsrevision.cpp.
◆ keys()
|
protected |
Get the keys that make up the internal data of this revision instance.
Definition at line 105 of file vcsrevision.cpp.
◆ operator=()
VcsRevision & KDevelop::VcsRevision::operator= | ( | const VcsRevision & | rhs | ) |
Definition at line 77 of file vcsrevision.cpp.
◆ operator==()
bool KDevelop::VcsRevision::operator== | ( | const KDevelop::VcsRevision & | rhs | ) | const |
Definition at line 139 of file vcsrevision.cpp.
◆ prettyValue()
QString KDevelop::VcsRevision::prettyValue | ( | ) | const |
This returns the value of the revision, suitable for displaying to the user.
For numbers it just returns the number converted to a string, for the special types it returns the literal value of the special type and for a datetime value it returns a localized string of the datetime value.
Definition at line 144 of file vcsrevision.cpp.
◆ revisionType()
VcsRevision::RevisionType KDevelop::VcsRevision::revisionType | ( | ) | const |
returns the type of the revision
Definition at line 89 of file vcsrevision.cpp.
◆ revisionValue()
QVariant KDevelop::VcsRevision::revisionValue | ( | ) | const |
Return the value of this revision.
See the class documentation for the different QVariant types
Definition at line 100 of file vcsrevision.cpp.
◆ setRevisionValue()
void KDevelop::VcsRevision::setRevisionValue | ( | const QVariant & | rev, |
VcsRevision::RevisionType | type | ||
) |
Set the value of this revision.
Definition at line 83 of file vcsrevision.cpp.
◆ setSpecialType()
|
protected |
Definition at line 129 of file vcsrevision.cpp.
◆ setType()
|
protected |
write methods for subclasses to easily set the type and value
Definition at line 124 of file vcsrevision.cpp.
◆ setValue() [1/2]
change the value of the given internal data
Definition at line 119 of file vcsrevision.cpp.
◆ setValue() [2/2]
|
protected |
Definition at line 134 of file vcsrevision.cpp.
◆ specialType()
VcsRevision::RevisionSpecialType KDevelop::VcsRevision::specialType | ( | ) | const |
Definition at line 94 of file vcsrevision.cpp.
◆ value()
get the value for a given key, this retrieves internal data and is meant to be used by subclasses
Definition at line 110 of file vcsrevision.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Mar 3 2021 00:38:30 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.