Add Dirk Luetjen's ssphys libraries and command-line tool
[vss2svn.git] / ssphys / SSPhysLib / SSObject.h
bloba3674eeb24dda3ae7644a0ad4290d8c9d1e47e8d
1 // SSObject.h: interface for the SSObject class.
2 //
3 //////////////////////////////////////////////////////////////////////
5 #if !defined(AFX_SSOBJECT_H__C8DBBC42_EE5F_4F9B_8935_5831008AB2BF__INCLUDED_)
6 #define AFX_SSOBJECT_H__C8DBBC42_EE5F_4F9B_8935_5831008AB2BF__INCLUDED_
8 #if _MSC_VER > 1000
9 #pragma once
10 #endif // _MSC_VER > 1000
12 #include "SSRecord.h"
13 #include "XML.h"
14 #include <list>
16 class SSObject;
17 class SSVersionObject;
18 class SSCheckOutObject;
19 class SSNameObject;
20 class SSCommentObject;
21 class SSProjectObject;
22 class SSParentFolderObject;
23 class SSBranchFileObject;
24 //class SSItemInfoObject;
25 class SSFileItem;
26 class SSProjectItem;
28 class ISSContext
30 public:
31 virtual ~ISSContext () {};
34 class ISSObjectVisitor
36 public:
37 virtual void Apply(const SSObject& object, const ISSContext* pCtx) = 0;
39 virtual void Apply(const SSVersionObject& object, const ISSContext* pCtx) = 0;
40 virtual void Apply(const SSCheckOutObject& object, const ISSContext* pCtx) = 0;
41 virtual void Apply(const SSNameObject& object, const ISSContext* pCtx) = 0;
42 virtual void Apply(const SSCommentObject& object, const ISSContext* pCtx) = 0;
43 virtual void Apply(const SSProjectObject& object, const ISSContext* pCtx) = 0;
44 virtual void Apply(const SSParentFolderObject& object, const ISSContext* pCtx) = 0;
45 virtual void Apply(const SSBranchFileObject& object, const ISSContext* pCtx) = 0;
47 // virtual void Apply(const SSItemInfoObject& object, const ISSContext* pCtx) = 0;
48 virtual void Apply(const SSFileItem& object, const ISSContext* pCtx) = 0;
49 virtual void Apply(const SSProjectItem& object, const ISSContext* pCtx) = 0;
54 class SSObject
56 protected:
57 SSObject (SSRecordPtr pRecord, eType type);
58 SSObject ();
60 public:
61 virtual ~SSObject ();
63 static SSObject* MakeObject (SSRecordPtr pRecord);
65 virtual void Accept (ISSObjectVisitor& rVisitor, const ISSContext* pCtx = NULL) const { rVisitor.Apply (*this, pCtx); };
66 virtual bool Validate () { return true; }
68 SSFileImpPtr GetFile () const { return m_pRecord->GetFileImp (); }
69 eType GetType () const { return m_pRecord->GetType (); }
70 long GetOffset () const { return m_pRecord->GetOffset(); }
72 const byte* GetData () const { return m_pRecord->GetBuffer (); }
74 SSRecordPtr GetRecord () const { return m_pRecord; }
76 operator bool () const { return m_pRecord; }
78 virtual std::string GetName () const;
79 virtual void ToXml (XMLNode* pParent) const;
80 virtual void Dump (std::ostream& os) const;
82 protected:
83 // const byte* GetDataPtr () const;
84 // byte* GetDataPtr ();
86 private:
88 SSRecordPtr m_pRecord;
92 #endif // !defined(AFX_SSOBJECT_H__C8DBBC42_EE5F_4F9B_8935_5831008AB2BF__INCLUDED_)