00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #if defined( Uses_TStringCollection ) && !defined( __TStringCollection )
00013 #define __TStringCollection
00014
00024 class TStringCollection : public TSortedCollection
00025 {
00026 public:
00030 TStringCollection( short aLimit, short aDelta );
00031 private:
00043 virtual int compare( void *key1, void *key2 );
00048 virtual void freeItem( void *item );
00052 virtual const char *streamableName() const
00053 { return name; }
00059 virtual void *readItem( ipstream& );
00067 virtual void writeItem( void *, opstream& );
00068 protected:
00075 TStringCollection( StreamableInit ) : TSortedCollection ( streamableInit ) {};
00076 public:
00080 static const char * const name;
00084 static TStreamable *build();
00085 };
00086
00090 inline ipstream& operator >> ( ipstream& is, TStringCollection& cl )
00091 { return is >> (TStreamable&)cl; }
00095 inline ipstream& operator >> ( ipstream& is, TStringCollection*& cl )
00096 { return is >> (void *&)cl; }
00097
00101 inline opstream& operator << ( opstream& os, TStringCollection& cl )
00102 { return os << (TStreamable&)cl; }
00106 inline opstream& operator << ( opstream& os, TStringCollection* cl )
00107 { return os << (TStreamable *)cl; }
00108
00109 #endif // Uses_TStringCollection
00110
00111 #if defined( Uses_TResourceItem ) && !defined( __TResourceItem )
00112 #define __TResourceItem
00113
00118 struct TResourceItem
00119 {
00123 long pos;
00127 long size;
00131 char *key;
00132 };
00133
00134 #endif // Uses_TResourceItem
00135
00136 #if defined( Uses_TResourceCollection ) && !defined( __TResourceCollection )
00137 #define __TResourceCollection
00138
00147 class TResourceCollection: public TStringCollection
00148 {
00149 public:
00156 TResourceCollection( StreamableInit) : TStringCollection( streamableInit )
00157 {};
00162 TResourceCollection( short aLimit, short aDelta );
00166 virtual void *keyOf( void *item );
00167 private:
00172 virtual void freeItem( void *item );
00176 virtual const char *streamableName() const
00177 { return name; }
00184 virtual void *readItem( ipstream& );
00191 virtual void writeItem( void *, opstream& );
00192 public:
00196 static const char * const name;
00200 static TStreamable *build();
00201 };
00202
00206 inline ipstream& operator >> ( ipstream& is, TResourceCollection& cl )
00207 { return is >> (TStreamable&)cl; }
00211 inline ipstream& operator >> ( ipstream& is, TResourceCollection*& cl )
00212 { return is >> (void *&)cl; }
00213
00217 inline opstream& operator << ( opstream& os, TResourceCollection& cl )
00218 { return os << (TStreamable&)cl; }
00222 inline opstream& operator << ( opstream& os, TResourceCollection* cl )
00223 { return os << (TStreamable *)cl; }
00224
00225 #endif // Uses_TResourceCollection
00226
00227 #if defined( Uses_TResourceFile ) && !defined( __TResourceFile )
00228 #define __TResourceFile
00229
00230 class TResourceCollection;
00231 class fpstream;
00232
00243 class TResourceFile: public TObject
00244 {
00245 public:
00256 TResourceFile( fpstream *aStream );
00261 ~TResourceFile();
00267 short count();
00272 void remove( const char *key );
00281 void flush();
00286 void *get( const char *key );
00296 const char *keyAt( short i );
00305 void put( TStreamable *item, const char *key );
00309 fpstream *switchTo( fpstream *aStream, Boolean pack );
00310 protected:
00314 fpstream *stream;
00319 Boolean modified;
00323 long basePos;
00327 long indexPos;
00331 TResourceCollection *index;
00332 };
00333
00334 #endif // Uses_TResourceFile
00335
00336 #if defined( Uses_TStrIndexRec ) && !defined( __TStrIndexRec )
00337 #define __TStrIndexRec
00338
00343 class TStrIndexRec
00344 {
00345 public:
00349 TStrIndexRec();
00353 ushort key;
00357 ushort count;
00361 ushort offset;
00362 };
00363
00364 #endif // Uses_TStrIndexRec
00365
00366 #if defined( Uses_TStringList ) && !defined( __TStringList )
00367 #define __TStringList
00368
00369 class TStrIndexRec;
00370
00386 class TStringList : public TObject, public TStreamable
00387 {
00388 public:
00392 ~TStringList();
00397 void get( char *dest, ushort key );
00398 private:
00399 ipstream *ip;
00400 long basePos;
00401 short indexSize;
00402 TStrIndexRec *index;
00403 virtual const char *streamableName() const
00404 { return name; }
00405 protected:
00412 TStringList( StreamableInit );
00416 virtual void write( opstream& ) {}
00420 virtual void *read( ipstream& is );
00421 public:
00425 static const char * const name;
00429 static TStreamable *build();
00430 };
00431
00435 inline ipstream& operator >> ( ipstream& is, TStringList& cl )
00436 { return is >> (TStreamable&)cl; }
00440 inline ipstream& operator >> ( ipstream& is, TStringList*& cl )
00441 { return is >> (void *&)cl; }
00442
00446 inline opstream& operator << ( opstream& os, TStringList& cl )
00447 { return os << (TStreamable&)cl; }
00451 inline opstream& operator << ( opstream& os, TStringList* cl )
00452 { return os << (TStreamable *)cl; }
00453
00454 #endif // Uses_TStringList
00455
00456
00457 #if defined( Uses_TStrListMaker ) && !defined( __TStrListMaker )
00458 #define __TStrListMaker
00459
00465 class TStrListMaker : public TObject, public TStreamable
00466 {
00467 public:
00484 TStrListMaker( ushort aStrSize, ushort aIndexSize );
00488 ~TStrListMaker();
00493 void put( ushort key, char *str );
00494 private:
00495 ushort strPos;
00496 ushort strSize;
00497 char *strings;
00498 ushort indexPos;
00499 ushort indexSize;
00500 TStrIndexRec *index;
00501 TStrIndexRec cur;
00502 void closeCurrent();
00503 virtual const char *streamableName() const
00504 { return TStringList::name; }
00505 protected:
00512 TStrListMaker( StreamableInit );
00516 virtual void write( opstream& os );
00517 virtual void *read( ipstream& ) { return 0; }
00518 public:
00522 static TStreamable *build();
00523 };
00524
00528 inline ipstream& operator >> ( ipstream& is, TStrListMaker& cl )
00529 { return is >> (TStreamable&)cl; }
00533 inline ipstream& operator >> ( ipstream& is, TStrListMaker*& cl )
00534 { return is >> (void *&)cl; }
00535
00539 inline opstream& operator << ( opstream& os, TStrListMaker& cl )
00540 { return os << (TStreamable&)cl; }
00544 inline opstream& operator << ( opstream& os, TStrListMaker* cl )
00545 { return os << (TStreamable *)cl; }
00546
00547
00548 #endif // Uses_TStrListMaker