home *** CD-ROM | disk | FTP | other *** search
- #ifndef GenLib_Store_h
- #define GenLib_Store_h
-
- struct Subtype;
-
- class StoredObjectSet {
- public:
- class Object {
- char *storage;
- public:
- Object( const char *p_sourceFile,
- unsigned int p_commentStartLine,
- unsigned int p_declStartLine,
- const char *p_objectName,
- const Subtype &p_subtype,
- const char *p_superclass,
- const char *p_declaration,
- const char *p_comment,
- const char *p_body,
- char const **p_extras );
- ~Object();
-
- char *sourceFile;
- int commentStartLine;
- int declStartLine;
- char *objectName;
- const Subtype *subtype;
- char *superclass;
- char *declaration;
- char *comment;
- char *body;
- char **extras;
- };
-
- class Iterator {
- const StoredObjectSet *collection;
- struct {
- unsigned long block:24;
- unsigned long index:8;
- };
-
- private: friend class StoredObjectSet;
- Iterator( const StoredObjectSet *p_collection,
- unsigned int p_block, unsigned int p_index );
-
- public:
- Iterator( const StoredObjectSet &p_collection );
-
- Object *peek() const;
- void advance();
- bool anymore();
-
- inline Object *operator->() const { return peek(); }
- inline Object &operator*() const { return *peek(); }
- inline void operator++() { advance(); }
- inline void operator++(int) { advance(); }
- inline operator bool() const { return ((Iterator *)this)->anymore(); }
- };
- friend class Iterator;
-
- private:
- #define SOS_BLOCKSIZE 256
- struct Block {
- int numItems;
- Object *items[SOS_BLOCKSIZE];
- };
- unsigned int numBlocks;
- unsigned int maxBlocks;
- Block **blocks;
-
- public:
- StoredObjectSet();
- void Add( Object *o );
- Iterator GetIterator() const;
- void Destroy( const Iterator &i );
-
- void Pass( const Iterator &i, HookReportFunction f );
- void PassAll( HookReportFunction f );
-
- ~StoredObjectSet();
- };
-
- class ExtrasSet {
- char **settings;
- bool IOwnSettings;
- char *privateSpace;
- int usedSpace;
- int totalSpace;
-
- void Setup( char **extras );
- char *AddToPrivateSpace( const char *str );
- void GrabSettings();
-
- public:
- ExtrasSet();
- ExtrasSet( char const ** extras );
- ExtrasSet( char ** extras );
- ExtrasSet( const StoredObjectSet::Object &obj );
- ExtrasSet( const ExtrasSet © );
-
- void Set( const char *var, const char *val );
- void SetVolatileValue( const char *var, const char *val );
- const char *Get( const char *var ) const;
-
- operator char const **() const;
- ~ExtrasSet();
- };
-
- #endif
-