File indexing completed on 2024-04-28 04:37:46
0001 /* 0002 SPDX-FileCopyrightText: 2007 Andreas Pakulat <apaku@gmx.de> 0003 SPDX-FileCopyrightText: 2007 Matthew Woehlke <mw_triad@users.sourceforge.net> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef KDEVPLATFORM_VCSEVENT_H 0009 #define KDEVPLATFORM_VCSEVENT_H 0010 0011 #include <QMetaType> 0012 #include <QSharedDataPointer> 0013 0014 #include "vcsexport.h" 0015 0016 class QString; 0017 class QDateTime; 0018 template <typename T> class QList; 0019 0020 namespace KDevelop 0021 { 0022 class VcsRevision; 0023 0024 /** 0025 * Small container class that contains information about a history event of a 0026 * single repository item. 0027 */ 0028 class KDEVPLATFORMVCS_EXPORT VcsItemEvent 0029 { 0030 public: 0031 /** 0032 * Class that tells you what happened to a given repository location in a 0033 * specific revision. 0034 * 0035 * Combinations of some of the flags are possible, for example Add|Modified, 0036 * Copy|Modified or Merge|Modified, or when returned from VcsEvent::actions(). 0037 */ 0038 enum Action 0039 { 0040 Added = 1<<0 /**< Item was added. */, 0041 Deleted = 1<<1 /**< Item was deleted. */, 0042 Modified = 1<<2 /**< Item was modified, for example by editing. */, 0043 Copied = 1<<3 /**< Item was copied. */, 0044 Merged = 1<<4 /**< Item had changes merged into it. */, 0045 ContentsModified = 1<<5 /**< Directory was not changed (only contents changed). */, 0046 Replaced = 1<<6 /**< Item was replaced. */ 0047 }; 0048 Q_DECLARE_FLAGS( Actions, Action ) 0049 0050 VcsItemEvent(); 0051 virtual ~VcsItemEvent(); 0052 VcsItemEvent(const VcsItemEvent& ); 0053 0054 QString repositoryLocation() const; 0055 QString repositoryCopySourceLocation() const; // may be empty 0056 VcsRevision repositoryCopySourceRevision() const; // may be invalid, even if rCSL is not 0057 Actions actions() const; 0058 0059 void setRepositoryLocation( const QString& ); 0060 void setRepositoryCopySourceLocation( const QString& ); 0061 void setRepositoryCopySourceRevision( const KDevelop::VcsRevision& ); 0062 void setActions( Actions ); 0063 0064 VcsItemEvent& operator=( const VcsItemEvent& rhs); 0065 0066 private: 0067 QSharedDataPointer<class VcsItemEventPrivate> d; 0068 }; 0069 0070 Q_DECLARE_OPERATORS_FOR_FLAGS(VcsItemEvent::Actions) 0071 0072 /** 0073 * Small container class that contains information about a single revision. 0074 * 0075 * @note log() only returns information about the specific item that was asked 0076 * about. When working with a VCS that supports atomic commits (i.e. where a 0077 * revision might affect more than one item), use change() to retrieve 0078 * information about all items affected by a particular revision. 0079 */ 0080 class KDEVPLATFORMVCS_EXPORT VcsEvent 0081 { 0082 public: 0083 VcsEvent(); 0084 virtual ~VcsEvent(); 0085 VcsEvent( const VcsEvent& ); 0086 0087 VcsRevision revision() const; 0088 QString author() const; 0089 QDateTime date() const; 0090 QString message() const; 0091 QList<VcsItemEvent> items() const; 0092 0093 void setRevision( const VcsRevision& ); 0094 void setAuthor( const QString& ); 0095 void setDate( const QDateTime& ); 0096 void setMessage(const QString& ); 0097 void setItems( const QList<VcsItemEvent>& ); 0098 void addItem(const VcsItemEvent& item); 0099 VcsEvent& operator=( const VcsEvent& rhs); 0100 0101 private: 0102 QSharedDataPointer<class VcsEventPrivate> d; 0103 }; 0104 0105 } 0106 0107 Q_DECLARE_METATYPE( KDevelop::VcsEvent ) 0108 Q_DECLARE_TYPEINFO( KDevelop::VcsEvent, Q_MOVABLE_TYPE ); 0109 Q_DECLARE_METATYPE( KDevelop::VcsItemEvent ) 0110 Q_DECLARE_TYPEINFO( KDevelop::VcsItemEvent, Q_MOVABLE_TYPE ); 0111 0112 #endif