Add Dirk Luetjen's ssphys libraries and command-line tool
[vss2svn.git] / ssphys / SSLib / SSItem.h
blob63df99019dfc740d569869740fe21a58c3bba50f
1 // SSItem.h: interface for the SSItem class.
2 //
3 //////////////////////////////////////////////////////////////////////
5 #if !defined(AFX_SSITEM_H__CB9B12A5_D0F5_4015_BB9A_18DEC6265E3A__INCLUDED_)
6 #define AFX_SSITEM_H__CB9B12A5_D0F5_4015_BB9A_18DEC6265E3A__INCLUDED_
8 #if _MSC_VER > 1000
9 #pragma once
10 #endif // _MSC_VER > 1000
12 #include <SSPhysLib\SSFiles.h>
13 #include <SSPhysLib\SSProjectObject.h>
14 #include <SSPhysLib\SSVersionObject.h>
15 #include <vector>
16 #include <boost\enable_shared_from_this.hpp>
18 // forward declaration
19 // #include "SSDatabase.h"
20 class SSDatabase;
21 class SSItems;
22 class SSVersions;
24 class SSItem;
25 typedef boost::shared_ptr <SSItem> SSItemPtr;
27 class SSItem : public boost::enable_shared_from_this<SSItem>
29 public:
30 // SSItem();
31 // SSItem(SSHistoryFile& rFile, int nVersion);
32 // SSItem(SSDatabase* pDb);
33 SSItem(SSDatabase* pDb, SSItemPtr pParent, SSProjectObject project, int version);
34 SSItem(SSDatabase* pDb, SSItemPtr pParent, SSProjectObject project);
35 virtual ~SSItem();
37 // _bstr_t GetSpec ( );
38 std::string GetSpec ();
40 // VARIANT_BOOL GetBinary ( );
41 // void PutBinary (
42 // VARIANT_BOOL pbBinary );
43 bool GetBinary ();
45 // VARIANT_BOOL GetDeleted ( );
46 // void PutDeleted (
47 // VARIANT_BOOL pbDeleted );
48 bool GetDeleted ();
50 // int GetType ( );
51 int GetType ( );
53 // _bstr_t GetLocalSpec ( );
54 // void PutLocalSpec (
55 // _bstr_t pLocal );
56 std::string GetLocalSpec ();
58 // _bstr_t GetName ( );
59 // void PutName (
60 // _bstr_t pName );
61 std::string GetName ();
63 // IVSSItemPtr GetParent ( );
64 SSItemPtr GetParent ();
66 // long GetVersionNumber ( );
67 long GetVersionNumber ( );
69 // IVSSItemsPtr GetItems (
70 // VARIANT_BOOL IncludeDeleted );
71 SSItems* GetItems (bool includeDeleted);
73 // HRESULT Get (
74 // BSTR * Local,
75 // long iFlags );
77 // HRESULT Checkout (
78 // _bstr_t Comment,
79 // _bstr_t Local,
80 // long iFlags );
82 // HRESULT Checkin (
83 // _bstr_t Comment,
84 // _bstr_t Local,
85 // long iFlags );
87 // HRESULT UndoCheckout (
88 // _bstr_t Local,
89 // long iFlags );
91 long GetIsCheckedOut ( );
93 // IVSSCheckoutsPtr GetCheckouts ( );
95 // VARIANT_BOOL GetIsDifferent (
96 // _bstr_t Local );
98 // IVSSItemPtr Add (
99 // _bstr_t Local,
100 // _bstr_t Comment,
101 // long iFlags );
103 // IVSSItemPtr NewSubproject (
104 // _bstr_t Name,
105 // _bstr_t Comment );
107 // HRESULT Share (
108 // struct IVSSItem * pIItem,
109 // _bstr_t Comment,
110 // long iFlags );
112 // HRESULT Destroy ( );
114 // HRESULT Move (
115 // struct IVSSItem * pINewParent );
117 // HRESULT Label (
118 // _bstr_t Label,
119 // _bstr_t Comment );
121 // IVSSVersionsPtr GetVersions (
122 // long iFlags );
123 SSVersions* GetVersions ( long iFlags );
125 // IVSSItemPtr GetVersion (
126 // const _variant_t & Version = vtMissing );
127 SSItemPtr GetVersion (std::string v);
129 SSDatabase* GetDatabase () { return m_pDatabase; }
131 std::string GetPhysical ();
133 void Delete ();
134 void Recover ();
135 void Rename (SSNAME oldName, SSNAME newName);
137 protected:
139 SSProjectObject m_ItemDescr;
140 SSItemPtr m_pParent;
141 // long m_nVersionNumber;
142 SSDatabase* m_pDatabase;
146 class SSItems : public ISSActionVisitor
148 public:
149 SSItems (SSItemPtr pParent, SSProjectFile& rFile, bool bIncludeDeleted);
150 ~SSItems ();
152 long GetCount () { return m_Items.size (); }
153 SSItemPtr GetItem (long i);
154 SSItemPtr GetPhysicalItem (std::string physical);
156 // ISSActionVisitor Interface for Undo
157 virtual bool Apply (const SSLabeledAction& rAction);
158 virtual bool Apply (const SSCreatedProjectAction& rAction);
159 virtual bool Apply (const SSCreatedFileAction& rAction);
160 virtual bool Apply (const SSDestroyedFileAction& rAction);
161 virtual bool Apply (const SSDestroyedProjectAction& rAction);
162 virtual bool Apply (const SSAddedFileAction& rAction);
163 virtual bool Apply (const SSAddedProjectAction& rAction);
164 virtual bool Apply (const SSDeletedFileAction& rAction);
165 virtual bool Apply (const SSDeletedProjectAction& rAction);
166 virtual bool Apply (const SSRenamedProjectAction& rAction); //, SSNAME oldName, SSNAME newName);
167 virtual bool Apply (const SSRenamedFileAction& rAction); //, SSNAME oldName, SSNAME newName);
168 virtual bool Apply (const SSCheckedInAction& rAction);
170 // bool DeleteFile (SSAction& rAction);
171 // bool DeleteProject (SSAction& rAction);
174 void Dump (std::ostream& os) const;
175 private:
176 void BuildList (SSItemPtr rParent, SSProjectFile& rFile, bool bIncludeDeleted);
178 SSItemPtr m_pParent;
179 std::vector<SSItemPtr> m_Items;
182 #endif // !defined(AFX_SSITEM_H__CB9B12A5_D0F5_4015_BB9A_18DEC6265E3A__INCLUDED_)