| 1 |
// SSVersionObject.h: interface for the SSActions class. |
|---|
| 2 |
// |
|---|
| 3 |
////////////////////////////////////////////////////////////////////// |
|---|
| 4 |
|
|---|
| 5 |
#if !defined(AFX_SSHISTORYOBJECT_H__58F12C7C_FE74_43B1_9BF6_9E803182D8D7__INCLUDED_) |
|---|
| 6 |
#define AFX_SSHISTORYOBJECT_H__58F12C7C_FE74_43B1_9BF6_9E803182D8D7__INCLUDED_ |
|---|
| 7 |
|
|---|
| 8 |
#if _MSC_VER > 1000 |
|---|
| 9 |
#pragma once |
|---|
| 10 |
#endif // _MSC_VER > 1000 |
|---|
| 11 |
|
|---|
| 12 |
#include "SSObject.h" |
|---|
| 13 |
#include "SSCommentObject.h" |
|---|
| 14 |
#include "SSName.h" |
|---|
| 15 |
#include "SSTypes.h" |
|---|
| 16 |
//#include "SSItem.h" |
|---|
| 17 |
|
|---|
| 18 |
//class SSItemAction; |
|---|
| 19 |
class SSLabeledAction; // Labeled = 0, |
|---|
| 20 |
class SSCreatedProjectAction; // Created_Project = 1, |
|---|
| 21 |
class SSAddedProjectAction; // Added_Project = 2, |
|---|
| 22 |
class SSAddedFileAction; // Added_File = 3, |
|---|
| 23 |
class SSDestroyedProjectAction; // Destroyed_Project = 4, |
|---|
| 24 |
class SSDestroyedFileAction; // Destroyed_File = 5, |
|---|
| 25 |
class SSDeletedProjectAction; // Deleted_Project = 6, |
|---|
| 26 |
class SSDeletedFileAction; // Deleted_File = 7, |
|---|
| 27 |
class SSRecoveredProjectAction; // Recovered_Project = 8, |
|---|
| 28 |
class SSRecoveredFileAction; // Recovered_File = 9, |
|---|
| 29 |
class SSRenamedProjectAction; // Renamed_Project = 10, |
|---|
| 30 |
class SSRenamedFileAction; // Renamed_File = 11, |
|---|
| 31 |
//class SSAction12 // missing action 12, |
|---|
| 32 |
class SSMovedProjectAction; // Moved_Project = 13, |
|---|
| 33 |
class SSSharedAction; // Shared_File = 14, |
|---|
| 34 |
class SSBranchFileAction; // Branch_File = 15, |
|---|
| 35 |
class SSCreatedFileAction; // Created_File = 16, |
|---|
| 36 |
class SSCheckedInAction; // Checked_in = 17, |
|---|
| 37 |
//class SSAction18 // missing action 18 |
|---|
| 38 |
class SSRollbackAction; // RollBack = 19 |
|---|
| 39 |
class SSArchivedVersionsAction; // Archived Versions of File |
|---|
| 40 |
class SSArchiveFileAction; // ArchiveFile |
|---|
| 41 |
class SSArchiveProjectAction; // ArchiveProject |
|---|
| 42 |
class SSRestoreFileAction; // RestoreFile |
|---|
| 43 |
class SSRestoreProjectAction; // RestoreProject |
|---|
| 44 |
|
|---|
| 45 |
class ISSActionVisitor |
|---|
| 46 |
{ |
|---|
| 47 |
public: |
|---|
| 48 |
virtual bool Apply (const SSLabeledAction& rAction) = 0; |
|---|
| 49 |
virtual bool Apply (const SSCreatedProjectAction& rAction) = 0; |
|---|
| 50 |
virtual bool Apply (const SSCreatedFileAction& rAction) = 0; |
|---|
| 51 |
virtual bool Apply (const SSAddedProjectAction& rAction) = 0; |
|---|
| 52 |
virtual bool Apply (const SSAddedFileAction& rAction) = 0; |
|---|
| 53 |
virtual bool Apply (const SSDeletedProjectAction& rAction) = 0; |
|---|
| 54 |
virtual bool Apply (const SSDeletedFileAction& rAction) = 0; |
|---|
| 55 |
virtual bool Apply (const SSRecoveredProjectAction& rAction) = 0; |
|---|
| 56 |
virtual bool Apply (const SSRecoveredFileAction& rAction) = 0; |
|---|
| 57 |
virtual bool Apply (const SSBranchFileAction& rAction) = 0; |
|---|
| 58 |
virtual bool Apply (const SSRollbackAction& rAction) = 0; |
|---|
| 59 |
virtual bool Apply (const SSArchivedVersionsAction& rAction) = 0; |
|---|
| 60 |
virtual bool Apply (const SSArchiveFileAction& rAction) = 0; |
|---|
| 61 |
virtual bool Apply (const SSArchiveProjectAction& rAction) = 0; |
|---|
| 62 |
virtual bool Apply (const SSRestoreFileAction& rAction) = 0; |
|---|
| 63 |
virtual bool Apply (const SSRestoreProjectAction& rAction) = 0; |
|---|
| 64 |
|
|---|
| 65 |
virtual bool Apply (const SSDestroyedProjectAction& rAction) = 0; |
|---|
| 66 |
virtual bool Apply (const SSDestroyedFileAction& rAction) = 0; |
|---|
| 67 |
virtual bool Apply (const SSRenamedProjectAction& rAction) = 0; |
|---|
| 68 |
virtual bool Apply (const SSRenamedFileAction& rAction) = 0; |
|---|
| 69 |
virtual bool Apply (const SSCheckedInAction& rAction) = 0; |
|---|
| 70 |
virtual bool Apply (const SSSharedAction& rAction) = 0; |
|---|
| 71 |
virtual bool Apply (const SSMovedProjectAction& rAction) = 0; |
|---|
| 72 |
}; |
|---|
| 73 |
|
|---|
| 74 |
//--------------------------------------------------------------------------- |
|---|
| 75 |
class SSAction |
|---|
| 76 |
{ |
|---|
| 77 |
public: |
|---|
| 78 |
SSAction (SSRecordPtr pRecord); |
|---|
| 79 |
virtual ~SSAction (); |
|---|
| 80 |
|
|---|
| 81 |
static SSAction* MakeAction (SSRecordPtr pRecord); |
|---|
| 82 |
|
|---|
| 83 |
virtual eAction GetActionID () const { return m_ActionId; } |
|---|
| 84 |
|
|---|
| 85 |
virtual std::string FormatActionString () = 0; |
|---|
| 86 |
virtual bool Accept (ISSActionVisitor& rVisitor) = 0; |
|---|
| 87 |
|
|---|
| 88 |
virtual void ToXml (XMLNode* pParent) const = 0; |
|---|
| 89 |
virtual void Dump (std::ostream& os) const; |
|---|
| 90 |
|
|---|
| 91 |
protected: |
|---|
| 92 |
const VERSION_RECORD* GetHistoryRecordPtr (SSRecordPtr pRecord) const; |
|---|
| 93 |
eAction m_ActionId; |
|---|
| 94 |
}; |
|---|
| 95 |
|
|---|
| 96 |
//--------------------------------------------------------------------------- |
|---|
| 97 |
class SSVersionObject : public SSObject |
|---|
| 98 |
{ |
|---|
| 99 |
public: |
|---|
| 100 |
SSVersionObject (SSRecordPtr pRecord); |
|---|
| 101 |
virtual ~SSVersionObject (); |
|---|
| 102 |
|
|---|
| 103 |
// handle copy constructor und assigment |
|---|
| 104 |
SSVersionObject (SSVersionObject const & object); |
|---|
| 105 |
SSVersionObject& operator= (SSVersionObject const & object); |
|---|
| 106 |
|
|---|
| 107 |
// BOOST_PP_SEQ_FOR_EACH(DEFINE_ACCESSORS, GetData(), VERSION_RECORD_SEQ); |
|---|
| 108 |
ulong GetPrevious () const { return GetData ()->previous; } |
|---|
| 109 |
eAction GetActionID () const { return static_cast <eAction> (GetAction ()->GetActionID ()); } |
|---|
| 110 |
short GetVersionNumber () const { return GetData ()->versionNumber; } |
|---|
| 111 |
// note the implicit conversion here from Win32 __time32_t to portable time_t |
|---|
| 112 |
time_t GetDate () const { return GetData ()->date; } |
|---|
| 113 |
std::string GetUsername () const { return std::string (GetData ()->username /*, 32*/); } |
|---|
| 114 |
std::string GetLabel () const { return std::string (GetData ()->label /*, 32*/); } |
|---|
| 115 |
ulong GetOffsetToNextRecordOrComment () const { return GetData ()->offsetToNextRecordOrComment; } |
|---|
| 116 |
ulong GetOffsetToLabelComment () const { return GetData ()->offsetToLabelComment; } |
|---|
| 117 |
short GetLengthComment () const { return GetData ()->lengthComment; } |
|---|
| 118 |
short GetLengthLabelComment () const { return GetData ()->lengthLabelComment; } |
|---|
| 119 |
|
|---|
| 120 |
// std::string GetUsername () const { return GetData ()->user; } |
|---|
| 121 |
// int GetVersionNumber () const { return GetData ()->version; } |
|---|
| 122 |
// eAction GetActionId () const { return static_cast <eAction> (GetData ()->action); } |
|---|
| 123 |
std::string GetActionString () const { return m_pAction ? m_pAction->FormatActionString () : CAction::ActionToString (GetActionID()); } |
|---|
| 124 |
// __time32_t GetDate () const { return GetData ()->date; } |
|---|
| 125 |
std::string GetComment () const; |
|---|
| 126 |
|
|---|
| 127 |
// special Label Action functions |
|---|
| 128 |
// std::string GetLabel () const; |
|---|
| 129 |
std::string GetLabelComment () const; |
|---|
| 130 |
|
|---|
| 131 |
// reporting functions |
|---|
| 132 |
virtual void Accept (ISSObjectVisitor& rVisitor, const ISSContext* pCtx = NULL) const { rVisitor.Apply (*this, pCtx); } |
|---|
| 133 |
|
|---|
| 134 |
const VERSION_RECORD* GetData () const { return (const VERSION_RECORD*) SSObject::GetData (); } |
|---|
| 135 |
|
|---|
| 136 |
SSAction* GetAction () const { return m_pAction; } |
|---|
| 137 |
SSVersionObject GetPreviousObject () const; |
|---|
| 138 |
SSCommentObject GetCommentObject () const; |
|---|
| 139 |
|
|---|
| 140 |
virtual bool Validate (); |
|---|
| 141 |
|
|---|
| 142 |
virtual void ToXml (XMLNode* pParent) const; |
|---|
| 143 |
virtual void Dump (std::ostream& os) const; |
|---|
| 144 |
|
|---|
| 145 |
protected: |
|---|
| 146 |
|
|---|
| 147 |
SSAction* m_pAction; |
|---|
| 148 |
}; |
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 |
//--------------------------------------------------------------------------- |
|---|
| 152 |
template <class ACTION> |
|---|
| 153 |
class SSActionEx : public SSAction |
|---|
| 154 |
{ |
|---|
| 155 |
public: |
|---|
| 156 |
SSActionEx (SSRecordPtr pRecord) |
|---|
| 157 |
: SSAction (pRecord) |
|---|
| 158 |
{ |
|---|
| 159 |
} |
|---|
| 160 |
|
|---|
| 161 |
bool Accept (ISSActionVisitor& rVisitor) |
|---|
| 162 |
{ |
|---|
| 163 |
return rVisitor.Apply(*This()); |
|---|
| 164 |
} |
|---|
| 165 |
|
|---|
| 166 |
// return a pointer to the most derived class |
|---|
| 167 |
ACTION * This() |
|---|
| 168 |
{ |
|---|
| 169 |
return static_cast<ACTION *>(this); |
|---|
| 170 |
} |
|---|
| 171 |
}; |
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 |
//--------------------------------------------------------------------------- |
|---|
| 175 |
class SSLabeledAction : public SSActionEx<SSLabeledAction> |
|---|
| 176 |
{ |
|---|
| 177 |
public: |
|---|
| 178 |
SSLabeledAction (SSRecordPtr pRecord); |
|---|
| 179 |
virtual ~SSLabeledAction (); |
|---|
| 180 |
|
|---|
| 181 |
std::string GetLabel () const { return m_Label; } |
|---|
| 182 |
std::string GetLabelComment () const { return m_LabelComment; } |
|---|
| 183 |
|
|---|
| 184 |
virtual std::string FormatActionString (); |
|---|
| 185 |
|
|---|
| 186 |
virtual void ToXml (XMLNode* pParent) const; |
|---|
| 187 |
virtual void Dump (std::ostream& os) const; |
|---|
| 188 |
|
|---|
| 189 |
private: |
|---|
| 190 |
std::string m_Label; |
|---|
| 191 |
std::string m_LabelComment; |
|---|
| 192 |
}; |
|---|
| 193 |
|
|---|
| 194 |
//--------------------------------------------------------------------------- |
|---|
| 195 |
class ISSItemAction |
|---|
| 196 |
{ |
|---|
| 197 |
public: |
|---|
| 198 |
virtual std::string GetPhysical () const = 0; |
|---|
| 199 |
virtual SSName GetSSName () const = 0; |
|---|
| 200 |
}; |
|---|
| 201 |
|
|---|
| 202 |
//--------------------------------------------------------------------------- |
|---|
| 203 |
template <class ACTION, class STRUCT> |
|---|
| 204 |
class SSItemAction : public SSActionEx<ACTION>, public ISSItemAction |
|---|
| 205 |
{ |
|---|
| 206 |
public: |
|---|
| 207 |
SSItemAction (SSRecordPtr pRecord, std::string actionString); |
|---|
| 208 |
|
|---|
| 209 |
std::string GetPhysical () const { return std::string (m_Action.physical, std::min (strlen (m_Action.physical), (size_t)8)); } |
|---|
| 210 |
SSName GetSSName () const { return m_Action.name; } |
|---|
| 211 |
|
|---|
| 212 |
std::string GetName () const { SSName name (GetSSName ()); return name.GetFullName (); } |
|---|
| 213 |
|
|---|
| 214 |
virtual std::string FormatActionString (); |
|---|
| 215 |
|
|---|
| 216 |
virtual void ToXml (XMLNode* pParent) const; |
|---|
| 217 |
virtual void Dump (std::ostream& os) const; |
|---|
| 218 |
|
|---|
| 219 |
protected: |
|---|
| 220 |
STRUCT m_Action; |
|---|
| 221 |
std::string m_ActionString; |
|---|
| 222 |
}; |
|---|
| 223 |
|
|---|
| 224 |
class SSCreatedProjectAction : public SSItemAction<SSCreatedProjectAction, ITEM_ACTION> |
|---|
| 225 |
{ |
|---|
| 226 |
public: |
|---|
| 227 |
SSCreatedProjectAction (SSRecordPtr pRecord) |
|---|
| 228 |
: SSItemAction<SSCreatedProjectAction, ITEM_ACTION> (pRecord, "Created Project $") |
|---|
| 229 |
{ |
|---|
| 230 |
} |
|---|
| 231 |
}; |
|---|
| 232 |
|
|---|
| 233 |
class SSCreatedFileAction : public SSItemAction<SSCreatedFileAction, ITEM_ACTION> |
|---|
| 234 |
{ |
|---|
| 235 |
public: |
|---|
| 236 |
SSCreatedFileAction (SSRecordPtr pRecord) |
|---|
| 237 |
: SSItemAction<SSCreatedFileAction, ITEM_ACTION> (pRecord, "Created File ") |
|---|
| 238 |
{ |
|---|
| 239 |
} |
|---|
| 240 |
}; |
|---|
| 241 |
|
|---|
| 242 |
class SSAddedProjectAction : public SSItemAction<SSAddedProjectAction, ITEM_ACTION> |
|---|
| 243 |
{ |
|---|
| 244 |
public: |
|---|
| 245 |
SSAddedProjectAction (SSRecordPtr pRecord) |
|---|
| 246 |
: SSItemAction<SSAddedProjectAction, ITEM_ACTION> (pRecord, "Added Project $") |
|---|
| 247 |
{ |
|---|
| 248 |
} |
|---|
| 249 |
}; |
|---|
| 250 |
|
|---|
| 251 |
class SSAddedFileAction : public SSItemAction<SSAddedFileAction, ITEM_ACTION> |
|---|
| 252 |
{ |
|---|
| 253 |
public: |
|---|
| 254 |
SSAddedFileAction (SSRecordPtr pRecord) |
|---|
| 255 |
: SSItemAction<SSAddedFileAction, ITEM_ACTION> (pRecord, "Added File ") |
|---|
| 256 |
{ |
|---|
| 257 |
} |
|---|
| 258 |
}; |
|---|
| 259 |
|
|---|
| 260 |
class SSDeletedProjectAction : public SSItemAction<SSDeletedProjectAction, ITEM_ACTION> |
|---|
| 261 |
{ |
|---|
| 262 |
public: |
|---|
| 263 |
SSDeletedProjectAction (SSRecordPtr pRecord) |
|---|
| 264 |
: SSItemAction<SSDeletedProjectAction, ITEM_ACTION> (pRecord, "Deleted Project $") |
|---|
| 265 |
{ |
|---|
| 266 |
} |
|---|
| 267 |
}; |
|---|
| 268 |
|
|---|
| 269 |
class SSDeletedFileAction : public SSItemAction<SSDeletedFileAction, ITEM_ACTION> |
|---|
| 270 |
{ |
|---|
| 271 |
public: |
|---|
| 272 |
SSDeletedFileAction (SSRecordPtr pRecord) |
|---|
| 273 |
: SSItemAction<SSDeletedFileAction, ITEM_ACTION> (pRecord, "Deleted File ") |
|---|
| 274 |
{ |
|---|
| 275 |
} |
|---|
| 276 |
}; |
|---|
| 277 |
|
|---|
| 278 |
class SSRecoveredProjectAction : public SSItemAction<SSRecoveredProjectAction, ITEM_ACTION> |
|---|
| 279 |
{ |
|---|
| 280 |
public: |
|---|
| 281 |
SSRecoveredProjectAction (SSRecordPtr pRecord) |
|---|
| 282 |
: SSItemAction<SSRecoveredProjectAction, ITEM_ACTION> (pRecord, "Recovered Project ") |
|---|
| 283 |
{ |
|---|
| 284 |
} |
|---|
| 285 |
}; |
|---|
| 286 |
|
|---|
| 287 |
class SSRecoveredFileAction : public SSItemAction<SSRecoveredFileAction, ITEM_ACTION> |
|---|
| 288 |
{ |
|---|
| 289 |
public: |
|---|
| 290 |
SSRecoveredFileAction (SSRecordPtr pRecord) |
|---|
| 291 |
: SSItemAction<SSRecoveredFileAction, ITEM_ACTION> (pRecord, "Recovered File ") |
|---|
| 292 |
{ |
|---|
| 293 |
} |
|---|
| 294 |
}; |
|---|
| 295 |
|
|---|
| 296 |
//--------------------------------------------------------------------------- |
|---|
| 297 |
class SSBranchFileAction : public SSItemAction<SSBranchFileAction, BRANCH_FILE_ACTION> |
|---|
| 298 |
{ |
|---|
| 299 |
public: |
|---|
| 300 |
SSBranchFileAction (SSRecordPtr pRecord) |
|---|
| 301 |
: SSItemAction<SSBranchFileAction, BRANCH_FILE_ACTION> (pRecord, "Branched file ") |
|---|
| 302 |
{ |
|---|
| 303 |
} |
|---|
| 304 |
|
|---|
| 305 |
std::string GetParent () const { return std::string (m_Action.parent, 8); } |
|---|
| 306 |
|
|---|
| 307 |
virtual void ToXml (XMLNode* pParent) const; |
|---|
| 308 |
virtual void Dump (std::ostream& os) const; |
|---|
| 309 |
}; |
|---|
| 310 |
|
|---|
| 311 |
//--------------------------------------------------------------------------- |
|---|
| 312 |
class SSRollbackAction : public SSItemAction<SSRollbackAction, ROLLBACK_ACTION> |
|---|
| 313 |
{ |
|---|
| 314 |
public: |
|---|
| 315 |
SSRollbackAction (SSRecordPtr pRecord) |
|---|
| 316 |
: SSItemAction<SSRollbackAction, ROLLBACK_ACTION> (pRecord, "Rolled back ") |
|---|
| 317 |
{ |
|---|
| 318 |
} |
|---|
| 319 |
|
|---|
| 320 |
std::string GetParent () const { return std::string (m_Action.parent, 8); } |
|---|
| 321 |
|
|---|
| 322 |
virtual void ToXml (XMLNode* pParent) const; |
|---|
| 323 |
virtual void Dump (std::ostream& os) const; |
|---|
| 324 |
}; |
|---|
| 325 |
|
|---|
| 326 |
//--------------------------------------------------------------------------- |
|---|
| 327 |
class SSArchivedVersionsAction : public SSItemAction<SSArchivedVersionsAction, ARCHIVE_VERSIONS_ACTION> |
|---|
| 328 |
{ |
|---|
| 329 |
public: |
|---|
| 330 |
SSArchivedVersionsAction (SSRecordPtr pRecord) |
|---|
| 331 |
: SSItemAction<SSArchivedVersionsAction, ARCHIVE_VERSIONS_ACTION> (pRecord, "Archived versions of ") |
|---|
| 332 |
{ |
|---|
| 333 |
} |
|---|
| 334 |
|
|---|
| 335 |
std::string GetFileName () const { return std::string (m_Action.targetFile); } |
|---|
| 336 |
short GetArchiveVersion () const { return m_Action.archiveVersion; } |
|---|
| 337 |
|
|---|
| 338 |
virtual void ToXml (XMLNode* pParent) const; |
|---|
| 339 |
virtual void Dump (std::ostream& os) const; |
|---|
| 340 |
}; |
|---|
| 341 |
|
|---|
| 342 |
//--------------------------------------------------------------------------- |
|---|
| 343 |
template <class ACTION> |
|---|
| 344 |
class SSRestoreAction : public SSItemAction<ACTION, RESTORE_ACTION> |
|---|
| 345 |
{ |
|---|
| 346 |
public: |
|---|
| 347 |
SSRestoreAction (SSRecordPtr pRecord, std::string prefix) |
|---|
| 348 |
: SSItemAction<ACTION, RESTORE_ACTION> (pRecord, ""), |
|---|
| 349 |
m_Prefix (prefix) |
|---|
| 350 |
{ |
|---|
| 351 |
} |
|---|
| 352 |
|
|---|
| 353 |
virtual std::string FormatActionString () |
|---|
| 354 |
{ |
|---|
| 355 |
std::string action; |
|---|
| 356 |
action = "Restore " + m_Prefix + SSItemAction<ACTION, RESTORE_ACTION>::GetName (); |
|---|
| 357 |
return action; |
|---|
| 358 |
} |
|---|
| 359 |
|
|---|
| 360 |
std::string GetFileName () const { return std::string (SSItemAction<ACTION, RESTORE_ACTION>::m_Action.filename); } |
|---|
| 361 |
|
|---|
| 362 |
virtual void ToXml (XMLNode* pParent) const; |
|---|
| 363 |
virtual void Dump (std::ostream& os) const; |
|---|
| 364 |
|
|---|
| 365 |
private: |
|---|
| 366 |
std::string m_Prefix; |
|---|
| 367 |
}; |
|---|
| 368 |
|
|---|
| 369 |
class SSRestoreProjectAction : public SSRestoreAction<SSRestoreProjectAction> |
|---|
| 370 |
{ |
|---|
| 371 |
public: |
|---|
| 372 |
SSRestoreProjectAction (SSRecordPtr pRecord) |
|---|
| 373 |
: SSRestoreAction<SSRestoreProjectAction> (pRecord, "$") |
|---|
| 374 |
{} |
|---|
| 375 |
}; |
|---|
| 376 |
|
|---|
| 377 |
class SSRestoreFileAction : public SSRestoreAction<SSRestoreFileAction> |
|---|
| 378 |
{ |
|---|
| 379 |
public: |
|---|
| 380 |
SSRestoreFileAction (SSRecordPtr pRecord) |
|---|
| 381 |
: SSRestoreAction<SSRestoreFileAction> (pRecord, "") |
|---|
| 382 |
{} |
|---|
| 383 |
}; |
|---|
| 384 |
// class SSRestoreAction : public SSItemAction<SSRestoreAction, RESTORE_ACTION> |
|---|
| 385 |
// { |
|---|
| 386 |
// public: |
|---|
| 387 |
// SSRestoreAction (SSRecordPtr pRecord) |
|---|
| 388 |
// : SSItemAction<SSRestoreAction, RESTORE_ACTION> (pRecord, "Restore ") |
|---|
| 389 |
// { |
|---|
| 390 |
// } |
|---|
| 391 |
// |
|---|
| 392 |
// std::string GetFileName () const { return std::string (m_Action.filename); } |
|---|
| 393 |
// |
|---|
| 394 |
// virtual void ToXml (XMLNode* pParent) const; |
|---|
| 395 |
// virtual void Dump (std::ostream& os) const; |
|---|
| 396 |
// }; |
|---|
| 397 |
|
|---|
| 398 |
//--------------------------------------------------------------------------- |
|---|
| 399 |
template <class ACTION> |
|---|
| 400 |
class SSArchiveAction : public SSItemAction<ACTION, ARCHIVE_ACTION> |
|---|
| 401 |
{ |
|---|
| 402 |
public: |
|---|
| 403 |
SSArchiveAction (SSRecordPtr pRecord, std::string prefix) |
|---|
| 404 |
: SSItemAction<ACTION, ARCHIVE_ACTION> (pRecord, ""), |
|---|
| 405 |
m_Prefix (prefix) |
|---|
| 406 |
{ |
|---|
| 407 |
} |
|---|
| 408 |
|
|---|
| 409 |
virtual std::string FormatActionString () |
|---|
| 410 |
{ |
|---|
| 411 |
std::string action; |
|---|
| 412 |
action = "Archive " + m_Prefix + SSItemAction<ACTION, ARCHIVE_ACTION>::GetName (); |
|---|
| 413 |
return action; |
|---|
| 414 |
} |
|---|
| 415 |
|
|---|
| 416 |
std::string GetFileName () const { return std::string (SSItemAction<ACTION, ARCHIVE_ACTION>::m_Action.filename); } |
|---|
| 417 |
|
|---|
| 418 |
virtual void ToXml (XMLNode* pParent) const; |
|---|
| 419 |
virtual void Dump (std::ostream& os) const; |
|---|
| 420 |
|
|---|
| 421 |
private: |
|---|
| 422 |
std::string m_Prefix; |
|---|
| 423 |
}; |
|---|
| 424 |
|
|---|
| 425 |
class SSArchiveProjectAction : public SSArchiveAction<SSArchiveProjectAction> |
|---|
| 426 |
{ |
|---|
| 427 |
public: |
|---|
| 428 |
SSArchiveProjectAction (SSRecordPtr pRecord) |
|---|
| 429 |
: SSArchiveAction<SSArchiveProjectAction> (pRecord, "$") |
|---|
| 430 |
{} |
|---|
| 431 |
}; |
|---|
| 432 |
|
|---|
| 433 |
class SSArchiveFileAction : public SSArchiveAction<SSArchiveFileAction> |
|---|
| 434 |
{ |
|---|
| 435 |
public: |
|---|
| 436 |
SSArchiveFileAction (SSRecordPtr pRecord) |
|---|
| 437 |
: SSArchiveAction<SSArchiveFileAction> (pRecord, "") |
|---|
| 438 |
{} |
|---|
| 439 |
}; |
|---|
| 440 |
|
|---|
| 441 |
//--------------------------------------------------------------------------- |
|---|
| 442 |
template <class ACTION> |
|---|
| 443 |
class SSDestroyedAction : public SSItemAction<ACTION, DESTROYED_ACTION> |
|---|
| 444 |
{ |
|---|
| 445 |
public: |
|---|
| 446 |
SSDestroyedAction (SSRecordPtr pRecord, std::string prefix); |
|---|
| 447 |
|
|---|
| 448 |
virtual std::string FormatActionString (); |
|---|
| 449 |
|
|---|
| 450 |
private: |
|---|
| 451 |
std::string m_Prefix; |
|---|
| 452 |
}; |
|---|
| 453 |
|
|---|
| 454 |
class SSDestroyedProjectAction : public SSDestroyedAction<SSDestroyedProjectAction> |
|---|
| 455 |
{ |
|---|
| 456 |
public: |
|---|
| 457 |
SSDestroyedProjectAction (SSRecordPtr pRecord) |
|---|
| 458 |
: SSDestroyedAction<SSDestroyedProjectAction> (pRecord, "$") |
|---|
| 459 |
{} |
|---|
| 460 |
}; |
|---|
| 461 |
|
|---|
| 462 |
class SSDestroyedFileAction : public SSDestroyedAction<SSDestroyedFileAction> |
|---|
| 463 |
{ |
|---|
| 464 |
public: |
|---|
| 465 |
SSDestroyedFileAction (SSRecordPtr pRecord) |
|---|
| 466 |
: SSDestroyedAction<SSDestroyedFileAction> (pRecord, "") |
|---|
| 467 |
{} |
|---|
| 468 |
}; |
|---|
| 469 |
|
|---|
| 470 |
|
|---|
| 471 |
//--------------------------------------------------------------------------- |
|---|
| 472 |
|
|---|
| 473 |
template <class ACTION> |
|---|
| 474 |
class SSRenamedAction : public SSItemAction<ACTION, RENAMED_ACTION> |
|---|
| 475 |
{ |
|---|
| 476 |
public: |
|---|
| 477 |
SSRenamedAction (SSRecordPtr pRecord, std::string prefix); |
|---|
| 478 |
|
|---|
| 479 |
std::string GetNewName () const { SSName name (SSItemAction<ACTION,RENAMED_ACTION>::m_Action.newName); return name.GetFullName (); } |
|---|
| 480 |
SSName GetNewSSName () const { return SSItemAction<ACTION,RENAMED_ACTION>::m_Action.newName; } |
|---|
| 481 |
|
|---|
| 482 |
virtual std::string FormatActionString (); |
|---|
| 483 |
|
|---|
| 484 |
virtual void ToXml (XMLNode* pParent) const; |
|---|
| 485 |
virtual void Dump (std::ostream& os) const; |
|---|
| 486 |
|
|---|
| 487 |
private: |
|---|
| 488 |
std::string m_Prefix; |
|---|
| 489 |
}; |
|---|
| 490 |
|
|---|
| 491 |
class SSRenamedProjectAction : public SSRenamedAction<SSRenamedProjectAction> |
|---|
| 492 |
{ |
|---|
| 493 |
public: |
|---|
| 494 |
SSRenamedProjectAction (SSRecordPtr pRecord) |
|---|
| 495 |
: SSRenamedAction<SSRenamedProjectAction> (pRecord, "$") |
|---|
| 496 |
{} |
|---|
| 497 |
}; |
|---|
| 498 |
|
|---|
| 499 |
class SSRenamedFileAction : public SSRenamedAction<SSRenamedFileAction> |
|---|
| 500 |
{ |
|---|
| 501 |
public: |
|---|
| 502 |
SSRenamedFileAction (SSRecordPtr pRecord) |
|---|
| 503 |
: SSRenamedAction<SSRenamedFileAction> (pRecord, "") |
|---|
| 504 |
{} |
|---|
| 505 |
}; |
|---|
| 506 |
|
|---|
| 507 |
//--------------------------------------------------------------------------- |
|---|
| 508 |
|
|---|
| 509 |
class SSCheckedInAction : public SSActionEx<SSCheckedInAction> |
|---|
| 510 |
{ |
|---|
| 511 |
public: |
|---|
| 512 |
SSCheckedInAction ( SSRecordPtr pRecord); |
|---|
| 513 |
~SSCheckedInAction (); |
|---|
| 514 |
|
|---|
| 515 |
std::string GetFileSepc () const { return m_Action.checkInSpec; } |
|---|
| 516 |
long GetOffset () const { return m_Action.offsetFileDelta; } |
|---|
| 517 |
SSRecordPtr GetFileDelta () const; |
|---|
| 518 |
|
|---|
| 519 |
virtual std::string FormatActionString (); |
|---|
| 520 |
virtual bool Accept (ISSActionVisitor& rVisitor) { return rVisitor.Apply (*this); } |
|---|
| 521 |
|
|---|
| 522 |
virtual void ToXml (XMLNode* pParent) const; |
|---|
| 523 |
virtual void Dump (std::ostream& os) const; |
|---|
| 524 |
|
|---|
| 525 |
private: |
|---|
| 526 |
CHECKED_IN_ACTION m_Action; |
|---|
| 527 |
mutable SSRecordPtr m_pFileDelta; |
|---|
| 528 |
SSFileImpPtr m_FilePtr; |
|---|
| 529 |
}; |
|---|
| 530 |
|
|---|
| 531 |
|
|---|
| 532 |
//--------------------------------------------------------------------------- |
|---|
| 533 |
|
|---|
| 534 |
class SSSharedAction : public SSItemAction<SSSharedAction, SHARED_FILE_ACTION> |
|---|
| 535 |
{ |
|---|
| 536 |
public: |
|---|
| 537 |
SSSharedAction ( SSRecordPtr pRecord); |
|---|
| 538 |
~SSSharedAction (); |
|---|
| 539 |
|
|---|
| 540 |
std::string GetSrcPathSpec () const { return m_Action.srcPathSpec; } |
|---|
| 541 |
short GetPinnedToVersion () const { return m_Action.pinnedToVersion; } |
|---|
| 542 |
short GetSubActionAndVersion () const { return m_Action.subActionAndVersion; } |
|---|
| 543 |
|
|---|
| 544 |
short GetUnpinnedVersion () const { return m_Action.subActionAndVersion >= 0 ? m_Action.subActionAndVersion : 0; } |
|---|
| 545 |
|
|---|
| 546 |
virtual eAction GetActionID () const |
|---|
| 547 |
{ |
|---|
| 548 |
if (m_Action.subActionAndVersion < 0) |
|---|
| 549 |
return Shared_File; |
|---|
| 550 |
else if (m_Action.subActionAndVersion == 0) |
|---|
| 551 |
return Pinned_File; |
|---|
| 552 |
/* else if (m_Action.subActionAndVersion > 0) */ |
|---|
| 553 |
return Unpinned_File; |
|---|
| 554 |
} |
|---|
| 555 |
|
|---|
| 556 |
virtual std::string FormatActionString (); |
|---|
| 557 |
|
|---|
| 558 |
virtual void ToXml (XMLNode* pParent) const; |
|---|
| 559 |
virtual void Dump (std::ostream& os) const; |
|---|
| 560 |
}; |
|---|
| 561 |
|
|---|
| 562 |
|
|---|
| 563 |
//--------------------------------------------------------------------------- |
|---|
| 564 |
|
|---|
| 565 |
class SSMovedProjectAction : public SSItemAction<SSMovedProjectAction, MOVED_PROJECT_ACTION> |
|---|
| 566 |
{ |
|---|
| 567 |
public: |
|---|
| 568 |
SSMovedProjectAction ( SSRecordPtr pRecord); |
|---|
| 569 |
~SSMovedProjectAction (); |
|---|
| 570 |
|
|---|
| 571 |
std::string GetPathSpec () const { return m_Action.pathSpec; } |
|---|
| 572 |
|
|---|
| 573 |
// virtual eAction GetActionID () const |
|---|
| 574 |
// { |
|---|
| 575 |
// if (m_Action.subActionAndVersion < 0) |
|---|
| 576 |
// return Shared_File; |
|---|
| 577 |
// else if (m_Action.subActionAndVersion == 0) |
|---|
| 578 |
// return Pinned_File; |
|---|
| 579 |
// /* else if (m_Action.subActionAndVersion > 0) */ |
|---|
| 580 |
// return Unpinned_File; |
|---|
| 581 |
// } |
|---|
| 582 |
|
|---|
| 583 |
virtual std::string FormatActionString (); |
|---|
| 584 |
|
|---|
| 585 |
virtual void ToXml (XMLNode* pParent) const; |
|---|
| 586 |
virtual void Dump (std::ostream& os) const; |
|---|
| 587 |
}; |
|---|
| 588 |
#endif // !defined(AFX_SSHISTORYOBJECT_H__58F12C7C_FE74_43B1_9BF6_9E803182D8D7__INCLUDED_) |
|---|