• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevplatform/vcs

  • KDevelop
  • VcsRevision
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
KDevelop::VcsRevision Class Reference

#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 typeQVariant type
GlobalNumberqlonglong/QString
FileNumberqlonglong/QString
DateQDateTime
SpecialKDevelop::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

setRevisionValue(QVariant::fromValue<KDevelop::VcsRevision::RevisionSpecialType>(val), KDevelop::VcsRevision::Special);

instead of

setRevisionValue(QVariant::fromValue(val), KDevelop::VcsRevision::Special);

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

enum KDevelop::VcsRevision::RevisionSpecialType
Enumerator
Head 

Latest revision in the repository.

Working 

The local copy (including any changes made).

Base 

The repository source of the local copy.

Previous 

The version prior the other one (only valid in functions that take two revisions).

Start 

The first commit in a repository.

UserSpecialType 

This should be used by subclasses as base for their own special types.

Definition at line 85 of file vcsrevision.h.

◆ RevisionType

enum KDevelop::VcsRevision::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.
Enumerator
Special 

One of the special versions in RevisionSpecialType.

GlobalNumber 

Global repository version when item was last changed.

FileNumber 

Item's independent version number.

Date 

The date of the revision to check out.

Invalid 

The type is not set, this is an invalid revision.

UserType 

This should be used by subclasses as base for their own types.

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

KDevelop::VcsRevision::~VcsRevision ( )
virtualdefault

◆ VcsRevision() [2/2]

KDevelop::VcsRevision::VcsRevision ( const VcsRevision &  rhs)

Definition at line 70 of file vcsrevision.cpp.

Member Function Documentation

◆ createSpecialRevision()

VcsRevision KDevelop::VcsRevision::createSpecialRevision ( KDevelop::VcsRevision::RevisionSpecialType  type)
static

Helper function to create a vcs revision for one of the special types.

Definition at line 49 of file vcsrevision.cpp.

◆ keys()

QStringList KDevelop::VcsRevision::keys ( ) const
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()

void KDevelop::VcsRevision::setSpecialType ( RevisionSpecialType  t)
protected

Definition at line 129 of file vcsrevision.cpp.

◆ setType()

void KDevelop::VcsRevision::setType ( RevisionType  t)
protected

write methods for subclasses to easily set the type and value

Definition at line 124 of file vcsrevision.cpp.

◆ setValue() [1/2]

void KDevelop::VcsRevision::setValue ( const QString &  key,
const QVariant &  value 
)
protected

change the value of the given internal data

Definition at line 119 of file vcsrevision.cpp.

◆ setValue() [2/2]

void KDevelop::VcsRevision::setValue ( const QVariant &  v)
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()

QVariant KDevelop::VcsRevision::value ( const QString &  key) const
protected

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:
  • vcsrevision.h
  • vcsrevision.cpp
QVariant::fromValue
QVariant fromValue(const T &value)
KDevelop::VcsRevision::setRevisionValue
void setRevisionValue(const QVariant &rev, RevisionType type)
Set the value of this revision.
Definition: vcsrevision.cpp:83
KDevelop::VcsRevision::Special
One of the special versions in RevisionSpecialType.
Definition: vcsrevision.h:78
This file is part of the KDE documentation.
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.

kdevplatform/vcs

Skip menu "kdevplatform/vcs"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  • kdevplatform
  •   debugger
  •   documentation
  •   interfaces
  •   language
  •     assistant
  •     backgroundparser
  •     checks
  •     classmodel
  •     codecompletion
  •     codegen
  •     duchain
  •     editor
  •     highlighting
  •     interfaces
  •     util
  •   outputview
  •   project
  •   serialization
  •   shell
  •   sublime
  •   tests
  •   util
  •   vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal