Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/vcs/vcsevent.cpp
Show All 17 Lines | |||||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * | 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * | ||
19 | ***************************************************************************/ | 19 | ***************************************************************************/ | ||
20 | 20 | | |||
21 | #include "vcsevent.h" | 21 | #include "vcsevent.h" | ||
22 | #include <QString> | 22 | #include <QString> | ||
23 | #include <QList> | 23 | #include <QList> | ||
24 | #include <QDateTime> | 24 | #include <QDateTime> | ||
25 | #include <QVariant> | 25 | #include <QVariant> | ||
26 | #include <QSharedData> | ||||
26 | 27 | | |||
27 | #include "vcsrevision.h" | 28 | #include "vcsrevision.h" | ||
28 | namespace KDevelop | 29 | namespace KDevelop | ||
29 | { | 30 | { | ||
30 | 31 | | |||
31 | class VcsItemEventPrivate | 32 | class VcsItemEventPrivate : public QSharedData | ||
32 | { | 33 | { | ||
33 | public: | 34 | public: | ||
34 | QString location; | 35 | QString location; | ||
35 | QString sourceLocation; | 36 | QString sourceLocation; | ||
36 | VcsRevision sourceRevision; | 37 | VcsRevision sourceRevision; | ||
37 | VcsItemEvent::Actions actions; | 38 | VcsItemEvent::Actions actions; | ||
38 | }; | 39 | }; | ||
39 | 40 | | |||
40 | VcsItemEvent::VcsItemEvent() | 41 | VcsItemEvent::VcsItemEvent() | ||
41 | : d(new VcsItemEventPrivate) | 42 | : d(new VcsItemEventPrivate) | ||
42 | { | 43 | { | ||
43 | } | 44 | } | ||
44 | 45 | | |||
45 | VcsItemEvent::~VcsItemEvent() = default; | 46 | VcsItemEvent::~VcsItemEvent() = default; | ||
46 | 47 | | |||
47 | VcsItemEvent::VcsItemEvent(const VcsItemEvent& rhs ) | 48 | VcsItemEvent::VcsItemEvent(const VcsItemEvent& rhs ) | ||
48 | : d(new VcsItemEventPrivate) | 49 | : d(rhs.d) | ||
49 | { | 50 | { | ||
50 | d->actions = rhs.d->actions; | | |||
51 | d->sourceRevision = rhs.d->sourceRevision; | | |||
52 | d->sourceLocation = rhs.d->sourceLocation; | | |||
53 | d->location = rhs.d->location; | | |||
54 | } | 51 | } | ||
55 | 52 | | |||
56 | QString VcsItemEvent::repositoryLocation() const | 53 | QString VcsItemEvent::repositoryLocation() const | ||
57 | { | 54 | { | ||
58 | return d->location; | 55 | return d->location; | ||
59 | } | 56 | } | ||
60 | 57 | | |||
61 | QString VcsItemEvent::repositoryCopySourceLocation() const | 58 | QString VcsItemEvent::repositoryCopySourceLocation() const | ||
Show All 28 Lines | |||||
90 | 87 | | |||
91 | void VcsItemEvent::setActions( VcsItemEvent::Actions a ) | 88 | void VcsItemEvent::setActions( VcsItemEvent::Actions a ) | ||
92 | { | 89 | { | ||
93 | d->actions = a; | 90 | d->actions = a; | ||
94 | } | 91 | } | ||
95 | 92 | | |||
96 | VcsItemEvent& VcsItemEvent::operator=( const VcsItemEvent& rhs) | 93 | VcsItemEvent& VcsItemEvent::operator=( const VcsItemEvent& rhs) | ||
97 | { | 94 | { | ||
98 | if(this == &rhs) | 95 | d = rhs.d; | ||
99 | return *this; | | |||
100 | d->actions = rhs.d->actions; | | |||
101 | d->sourceRevision = rhs.d->sourceRevision; | | |||
102 | d->sourceLocation = rhs.d->sourceLocation; | | |||
103 | d->location = rhs.d->location; | | |||
104 | return *this; | 96 | return *this; | ||
105 | } | 97 | } | ||
106 | 98 | | |||
107 | class VcsEventPrivate | 99 | class VcsEventPrivate : public QSharedData | ||
108 | { | 100 | { | ||
109 | public: | 101 | public: | ||
110 | VcsRevision revision; | 102 | VcsRevision revision; | ||
111 | QString author; | 103 | QString author; | ||
112 | QString message; | 104 | QString message; | ||
113 | QDateTime date; | 105 | QDateTime date; | ||
114 | QList<VcsItemEvent> items; | 106 | QList<VcsItemEvent> items; | ||
115 | }; | 107 | }; | ||
116 | 108 | | |||
117 | VcsEvent::VcsEvent() | 109 | VcsEvent::VcsEvent() | ||
118 | : d(new VcsEventPrivate) | 110 | : d(new VcsEventPrivate) | ||
119 | { | 111 | { | ||
120 | } | 112 | } | ||
121 | 113 | | |||
122 | VcsEvent::~VcsEvent() = default; | 114 | VcsEvent::~VcsEvent() = default; | ||
123 | 115 | | |||
124 | VcsEvent::VcsEvent( const VcsEvent& rhs ) | 116 | VcsEvent::VcsEvent( const VcsEvent& rhs ) | ||
125 | : d(new VcsEventPrivate) | 117 | : d(rhs.d) | ||
126 | { | 118 | { | ||
127 | d->revision = rhs.d->revision; | | |||
128 | d->author = rhs.d->author; | | |||
129 | d->message = rhs.d->message; | | |||
130 | d->date = rhs.d->date; | | |||
131 | d->items = rhs.d->items; | | |||
132 | } | 119 | } | ||
133 | 120 | | |||
134 | VcsRevision VcsEvent::revision() const | 121 | VcsRevision VcsEvent::revision() const | ||
135 | { | 122 | { | ||
136 | return d->revision; | 123 | return d->revision; | ||
137 | } | 124 | } | ||
138 | 125 | | |||
139 | QString VcsEvent::author() const | 126 | QString VcsEvent::author() const | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
183 | 170 | | |||
184 | void VcsEvent::addItem(const VcsItemEvent& item) | 171 | void VcsEvent::addItem(const VcsItemEvent& item) | ||
185 | { | 172 | { | ||
186 | d->items.append(item); | 173 | d->items.append(item); | ||
187 | } | 174 | } | ||
188 | 175 | | |||
189 | VcsEvent& VcsEvent::operator=( const VcsEvent& rhs) | 176 | VcsEvent& VcsEvent::operator=( const VcsEvent& rhs) | ||
190 | { | 177 | { | ||
191 | if(this == &rhs) | 178 | d = rhs.d; | ||
192 | return *this; | | |||
193 | d->revision = rhs.d->revision; | | |||
194 | d->message = rhs.d->message; | | |||
195 | d->items = rhs.d->items; | | |||
196 | d->date = rhs.d->date; | | |||
197 | d->author = rhs.d->author; | | |||
198 | return *this; | 179 | return *this; | ||
199 | } | 180 | } | ||
200 | 181 | | |||
201 | 182 | | |||
202 | } | 183 | } | ||
203 | 184 | |