InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CContentIterator.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Steve Pellegrin
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 #if !defined(__CContentIterator__)
25 #define __CContentIterator__
26 
27 // ----- Interfaces -----
28 
29 #include "IContentIterator.h"
30 #include "IPMStream.h"
31 
32 #ifdef PUBLIC_BUILD
33 #endif
34 
35 
36 //----------------------------------------------------------------------------
37 // CContentIterator
38 //----------------------------------------------------------------------------
39 
45 {
46 public:
52 
54  virtual ~CContentIterator();
55 
61  virtual bool16 IsClassID() const = 0;
62 
67  virtual IPMStream *QueryContentStream() = 0;
68 
73  virtual ClassID GetClassID() const = 0;
74 
79  virtual ImplementationID GetImplementationID() const = 0;
80 
86  virtual uint32 GetLength() const = 0;
87 
93  virtual bool16 Next() = 0;
94 
101  virtual void ResetRead(IContentWriteIterator *out = nil) = 0;
102 
108  virtual void CreateClassID(ClassID id) = 0;
109 
117  virtual uint32 CloseClassID(ClassID id) = 0;
118 
119 
125  virtual void CreateImplementationID(ImplementationID id) = 0;
126 
127 
135  virtual uint32 CloseImplementationID(ImplementationID id) = 0;
136 
141  virtual void AbortID() = 0;
142 
147  virtual void ResetWrite() = 0;
148 
154  virtual void BeginList(IContentWriteIterator::ListType /*listType*/)
155  {}
156 
161  virtual void EndList()
162  {}
163 
168  bool16 EndOfList() const
169  {return fEOF;}
170 
175  virtual int32 GetOriginPosition() const
176  {return fOriginPosition;}
177 
178 protected: // For use by subclasses
184  {return fStream;}
185 
189  bool IsReadIterator() const
190  {return fIsRead;}
191 
198  int32 CurrentPosition(IPMStream *s) const
199  {return s->Seek(0, kSeekFromCurrent);}
200 
204  void SetEndOfList(bool16 atEnd)
205  {fEOF = atEnd;}
206 
207 private:
208  bool16 fEOF;
209  int32 fOriginPosition;
210  IPMStream * fStream;
211  bool fIsRead;
212 };
213 
214 #ifdef PUBLIC_BUILD
215 #endif
216 
217 
218 //----------------------------------------------------------------------------
219 // CContentReadIterator and CContentWriteIterator
220 // These classes are not exported because their implementations
221 // are included below.
222 //----------------------------------------------------------------------------
223 
234 {
235 public:
237  : fIterator(nil)
238  {}
240  : fIterator(&iterator)
241  {}
242 
243  void SetIterator(CContentIterator *iterator)
244  {fIterator = iterator;}
245 
246  bool16 IsClassID() const
247  {return fIterator->IsClassID();}
249  {return fIterator->GetClassID();}
251  {return fIterator->GetImplementationID();}
252  uint32 GetLength() const
253  {return fIterator->GetLength();}
254  bool16 Next()
255  {return fIterator->Next();}
256  bool16 EndOfList() const
257  {return fIterator->EndOfList();}
258  void Reset(IContentWriteIterator *out = nil)
259  {fIterator->ResetRead(out);}
261  {return fIterator->QueryContentStream();}
262  int32 GetOriginPosition() const
263  {return fIterator->GetOriginPosition();}
264 
265 private:
266  CContentIterator *fIterator;
267 };
268 
269 
280 {
281 public:
283  : fIterator(nil)
284  {}
286  : fIterator(&iterator)
287  {}
288 
289  void SetIterator(CContentIterator *iterator)
290  {fIterator = iterator;}
291 
292  void BeginList(ListType listType)
293  {fIterator->BeginList(listType);}
294  void EndList()
295  {fIterator->EndList();}
296 
298  {fIterator->CreateClassID(id);}
300  {return fIterator->CloseClassID(id);}
302  {fIterator->CreateImplementationID(id);}
304  {return fIterator->CloseImplementationID(id);}
305  void AbortID()
306  {fIterator->AbortID();}
307  void Reset()
308  {fIterator->ResetWrite();}
310  {return fIterator->QueryContentStream();}
311  int32 GetOriginPosition() const
312  {return fIterator->GetOriginPosition();}
313 
314 private:
315  CContentIterator *fIterator;
316 };
317 
318 #endif // __CContentIterator__