root/trunk/ssphys/SSPhysLib/SSFiles.h

Revision 157 (checked in by ldavis, 4 years ago)

added svn:eol-style to all files
added svn:mime-type to all files

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
Line 
1 // SSFiles.h: interface for the SSFiles class.
2 //
3 //////////////////////////////////////////////////////////////////////
4
5 #if !defined(AFX_SSFILES_H__A748503F_FA76_42CB_9EE0_A4FED9F1779B__INCLUDED_)
6 #define AFX_SSFILES_H__A748503F_FA76_42CB_9EE0_A4FED9F1779B__INCLUDED_
7
8 #if _MSC_VER > 1000
9 #pragma once
10 #endif // _MSC_VER > 1000
11
12 #include <boost/shared_ptr.hpp>
13
14 class SSItemInfoObject;
15 class SSVersionObject;
16 class SSRecord;
17 typedef boost::shared_ptr<SSRecord> SSRecordPtr;
18 class SSFileImp;
19 typedef boost::shared_ptr<SSFileImp> SSFileImpPtr;
20
21
22
23 class SSFileImp : public boost::enable_shared_from_this<SSFileImp>
24 {
25 public:
26   SSFileImp (const std::string& fileName);
27   SSFileImp (std::istream* pInput);
28   virtual ~SSFileImp ();
29
30   bool Seek (size_t offset, std::ios_base::seekdir way);
31   bool Read (long offset, void* ptr, size_t size);
32   bool Read (void* ptr, size_t size);
33 //  size_t Write (const void* ptr, size_t size, size_t count);
34   long Size ();
35
36   std::string GetFileName () const;
37
38   SSRecordPtr GetRecord (long offset);
39
40 protected:
41   SSRecord* ReadRecord (long offset);
42 //  friend SSRecord;
43 //  void ReleaseRecord (SSRecord* record);
44
45 //  std::map <long, SSRecordPtr > m_Records;
46   std::istream* m_pInput;
47   std::string m_FileName;
48 };
49
50
51
52 class SSFile
53 {
54 public:
55   SSFile (const std::string& fileName);
56   SSFile (std::istream* pInput);
57   virtual ~SSFile ();
58  
59   virtual bool Validate () { return true; }
60
61 protected:
62   SSFileImpPtr m_FileImpPtr;
63 };
64
65 class SSTextFile : public SSFile
66 {
67 public:
68   SSTextFile (const std::string& fileName);
69 };
70
71 class SSBinaryFile : public SSFile
72 {
73 public:
74   SSBinaryFile (const std::string& fileName);
75   SSBinaryFile (std::istream* pInput);
76 };
77
78 class SSRecordFile : public SSBinaryFile
79 {
80 public:
81   SSRecordFile (const std::string& fileName);
82   SSRecordFile (std::istream* pInput);
83   virtual ~SSRecordFile ();
84
85   static SSRecordFile* MakeFile (const std::string& fileName);
86  
87   virtual bool CheckHeader ()   { return true; }
88   virtual long GetHeaderLength () = 0;
89  
90   SSRecordPtr GetRecord (long offset);
91   SSRecordPtr GetFirstRecord ();
92   SSRecordPtr GetNextRecord (SSRecordPtr pRecord);
93   SSRecordPtr FindNextRecord (SSRecordPtr pRecord);
94
95   virtual void Dump (std::ostream& os);
96   virtual bool Validate ();
97 };
98
99
100 class SSHeaderFile : public SSRecordFile
101 {
102 public:
103   SSHeaderFile (const std::string& fileName);
104
105   virtual long GetHeaderLength ();
106
107   virtual void Dump (std::ostream& os);
108
109 protected:
110   char m_Header[52];
111 };
112
113 class SSPlainFile : public SSRecordFile
114 {
115 public:
116   SSPlainFile (const std::string& fileName);
117   SSPlainFile (std::istream* pInput);
118
119   virtual long GetHeaderLength ();
120
121   SSItemInfoObject* GetItemInfo ();
122   virtual void Dump (std::ostream& os);
123
124 protected:
125 };
126
127 class SSHistoryFile : public SSHeaderFile
128 {
129 public:
130   SSHistoryFile (const std::string& fileName);
131   ~SSHistoryFile ();
132
133   virtual bool CheckHeader ();
134
135   bool IsProject ();
136   bool IsFile ();
137   std::string GetLatestExt ();
138
139   SSVersionObject GetLastVersion ();
140   SSVersionObject GetPrevVersion (const SSVersionObject& version);
141
142   virtual void Dump (std::ostream& os);
143
144   std::auto_ptr<SSItemInfoObject> GetItemInfo ();
145
146 protected:
147   SSItemInfoObject* m_pItemInfo;
148 };
149
150 class SSNamesCacheFile : public SSPlainFile
151 {
152 public:
153   SSNamesCacheFile (const std::string& fileName);
154   virtual void Dump (std::ostream& os);
155 };
156
157 class SSProjectFile : public SSPlainFile
158 {
159 public:
160   SSProjectFile (const std::string& fileName);
161   SSProjectFile (std::istream* pInput);
162
163   virtual void Dump (std::ostream& os);
164 };
165
166 class SSUserFile : public SSHeaderFile
167 {
168 public:
169   SSUserFile (const std::string& fileName);
170
171   virtual bool CheckHeader ();
172
173   virtual void Dump (std::ostream& os);
174
175 private:
176 };
177
178 #endif // !defined(AFX_SSFILES_H__A748503F_FA76_42CB_9EE0_A4FED9F1779B__INCLUDED_)
Note: See TracBrowser for help on using the browser.

PumaCode.org recommends CVSDude for fast, professional Subversion and Trac hosting:

CVSDude.com

These ads are automatically generated by Google. Revenue from these ads helps to pay for hosting this site; however, these ads do not constitute an endorsement by PumaCode.org.