| 1 |
// SSRecord.h: interface for the SSRecord class. |
|---|
| 2 |
// |
|---|
| 3 |
////////////////////////////////////////////////////////////////////// |
|---|
| 4 |
|
|---|
| 5 |
#if !defined(AFX_SSRECORD_H__2A40F202_FFA7_401B_87D7_FDA36EF531B9__INCLUDED_) |
|---|
| 6 |
#define AFX_SSRECORD_H__2A40F202_FFA7_401B_87D7_FDA36EF531B9__INCLUDED_ |
|---|
| 7 |
|
|---|
| 8 |
#if _MSC_VER > 1000 |
|---|
| 9 |
#pragma once |
|---|
| 10 |
#endif // _MSC_VER > 1000 |
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
#include "SSTypes.h" |
|---|
| 14 |
#include "SSFiles.h" |
|---|
| 15 |
|
|---|
| 16 |
//--------------------------------------------------------------------------- |
|---|
| 17 |
enum eType { |
|---|
| 18 |
eNone, |
|---|
| 19 |
eItemRecord, // DH, DH_PROJECT, DH_FILE |
|---|
| 20 |
eHistoryRecord, // EL |
|---|
| 21 |
eCommentRecord, // MC |
|---|
| 22 |
eCheckOutRecord, // CF |
|---|
| 23 |
eParentFolder, // PF |
|---|
| 24 |
eFileDelta, // FD |
|---|
| 25 |
eNamesCache, // HN |
|---|
| 26 |
eNameCacheEntry, // SN |
|---|
| 27 |
eProjectEntry, // JP |
|---|
| 28 |
eUsersHeader, // HU |
|---|
| 29 |
eUser, // UU |
|---|
| 30 |
eBranchFile, // BF |
|---|
| 31 |
eUnknown |
|---|
| 32 |
}; |
|---|
| 33 |
|
|---|
| 34 |
class SSRecord |
|---|
| 35 |
{ |
|---|
| 36 |
friend class SSFileImp; |
|---|
| 37 |
SSRecord (SSFileImpPtr filePtr, long offset); |
|---|
| 38 |
public: |
|---|
| 39 |
SSRecord (eType type, const void* buffer, int len); |
|---|
| 40 |
~SSRecord (); |
|---|
| 41 |
|
|---|
| 42 |
static eType StringToType (const char type[2]); |
|---|
| 43 |
static std::string TypeToString (eType type); |
|---|
| 44 |
|
|---|
| 45 |
bool IsValid () const; |
|---|
| 46 |
|
|---|
| 47 |
const byte* GetBuffer () const { return m_pBuffer; } |
|---|
| 48 |
byte* GetBuffer () { return m_pBuffer; } |
|---|
| 49 |
int GetLen () const { return m_Len; } |
|---|
| 50 |
long GetOffset () const { return m_Offset; } |
|---|
| 51 |
long GetNextOffset () const { return m_Offset + m_Len + sizeof(m_Header); } |
|---|
| 52 |
std::string GetRecordType () const { return std::string (m_Header.type, 2); } |
|---|
| 53 |
eType GetType () const; |
|---|
| 54 |
|
|---|
| 55 |
SSFileImpPtr GetFileImp () const { return m_FileImpPtr; } |
|---|
| 56 |
|
|---|
| 57 |
void Dump (std::ostream& os) const; |
|---|
| 58 |
|
|---|
| 59 |
private: |
|---|
| 60 |
RECORD_HEADER m_Header; |
|---|
| 61 |
byte* m_pBuffer; |
|---|
| 62 |
int m_Len; |
|---|
| 63 |
long m_Offset; |
|---|
| 64 |
SSFileImpPtr m_FileImpPtr; |
|---|
| 65 |
}; |
|---|
| 66 |
|
|---|
| 67 |
typedef boost::shared_ptr<SSRecord> SSRecordPtr; |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
#endif // !defined(AFX_SSRECORD_H__2A40F202_FFA7_401B_87D7_FDA36EF531B9__INCLUDED_) |
|---|