InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
VOSObject.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: EricM
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __VOSOBJECT__
25 #define __VOSOBJECT__
26 
27 #include "IVOSDiskPage.h"
28 #include "PersistUtils.h"
29 #include "SnapshotInfo.h"
30 
31 class scoped_snapshotdataref;
32 class VOS_Cursor;
33 class VOS_SavedData;
34 class ISnapshotCache;
35 template <typename ItemIDType, typename ItemDataType> class ISaLRICache;
36 
37 
38 
52 {
53  protected:
54  VOS_Object(const VOS_Object& copy);
55  public:
56  VOS_Object();
57  VOS_Object& operator=(const VOS_Object& rhs) = delete;
58  virtual ~VOS_Object();
59 
60  //-------------------------------------------------------------------------------
64 
65  SnapshotID GetSnapshotID() const;
66  void SetSnapshot(scoped_snapshotdataref& snapshot);
67  bool16 IsSnapshotUptodate() const;
68  void SetSnapshotNotuptodate();
69 
70 
72 
73 
78  virtual int32 VirtualLength() const = 0;
79 
83  virtual VOS_Object* Duplicate() const = 0;
84 
89  virtual VOS_Object* Divide(int32 atOffset) = 0;
90 
96  virtual bool16 JoinWith(VOS_Object* next) = 0;
97 
102  virtual void ReadWrite(IPMStream *s, ImplementationID prop) = 0;
103 
106  virtual void Release();
107 
110  virtual void AddRef();
111 
115  virtual void SetDiskPage(IVOSDiskPage *block);
116 
121  { return fDiskPage; }
122 
127  { return fDiskPage ? ::GetDataBase(fDiskPage) : nil; }
128 
129 #ifdef DEBUG
130 
133  virtual void InsertObj(VOS_Object *newone);
137  virtual void AppendObj(VOS_Object *newone);
138 #else
139 
142  void InsertObj(VOS_Object *newone)
143  { if (fDiskPage != nil) fDiskPage->InsertObj(newone, this); }
144 
148  void AppendObj(VOS_Object *newone)
149  { if (fDiskPage != nil) fDiskPage->AppendObj(newone, this); }
150 #endif
151 
152 
157  void AdjustObjectLength(int32 delta)
158  { if (fDiskPage != nil) fDiskPage->AdjustLength(delta); }
159 
160 
163  void PreDirty( bool8 dbModified = kTrue);
164 
168  bool16 IsDirty() const;
169 
170 
174  int32 VirtualKey() const
175  { return fDiskPage ? fDiskPage->LocateObjectStart(this) : 0; }
176 
177 
182  static void InsertSavedData(VOS_Cursor& cursor, VOS_SavedData *datalist);
183 
184  private:
185  IVOSDiskPage *fDiskPage;
186  mutable int32 fDiskPageRefCount;
187  SnapshotID fSnapshotID;
188  ISnapshotCache* fSnapshotCache;
189  bool8 fSnapshotIsUptodate;
190 #ifdef INTERFACEPROXIES_SUPPORTED
191  IVOSDiskPage *fDiskPageProxy;
192 #endif
193 };
194 
195 
196 #endif // __VOSOBJECT__