00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00020 #ifndef flc_pagedict_H
00021 #define flc_pagedict_H
00022
00023 #include <falcon/types.h>
00024 #include <falcon/itemdict.h>
00025 #include <falcon/item.h>
00026 #include <falcon/itemtraits.h>
00027 #include <falcon/genericmap.h>
00028 #include <stdlib.h>
00029
00030 #define flc_DICT_GROWTH 16
00031
00032 namespace Falcon
00033 {
00034
00035 class PageDict;
00036 class VMachine;
00037 class Iterator;
00038
00039
00040 class FALCON_DYN_CLASS PageDict: public ItemDict
00041 {
00042 ItemTraits m_itemTraits;
00043 Map m_map;
00044 uint32 m_mark;
00045
00046 static void PageDictIterDeletor( Iterator* iter );
00047 public:
00048
00049 PageDict();
00050 PageDict( uint32 pageSize );
00051 ~PageDict();
00052
00053 virtual uint32 length() const;
00054 virtual Item *find( const Item &key ) const;
00055 virtual bool findIterator( const Item &key, Iterator &iter );
00056 virtual void smartInsert( const Iterator &iter, const Item &key, const Item &value );
00057
00058 virtual const Item &front() const;
00059 virtual const Item &back() const;
00060 virtual void append( const Item& item );
00061 virtual void prepend( const Item& item );
00062
00063 virtual bool remove( const Item &key );
00064 virtual void put( const Item &key, const Item &value );
00065
00066 virtual FalconData *clone() const;
00067 virtual void merge( const ItemDict &dict );
00068 virtual void clear();
00069 virtual bool empty() const;
00070 void gcMark( uint32 gen );
00071
00072
00073
00074
00075 protected:
00076
00077 virtual void getIterator( Iterator& tgt, bool tail = false ) const;
00078 virtual void copyIterator( Iterator& tgt, const Iterator& source ) const;
00079
00080 virtual void insert( Iterator &iter, const Item &data );
00081 virtual void erase( Iterator &iter );
00082 virtual bool hasNext( const Iterator &iter ) const;
00083 virtual bool hasPrev( const Iterator &iter ) const;
00084 virtual bool hasCurrent( const Iterator &iter ) const;
00085 virtual bool next( Iterator &iter ) const;
00086 virtual bool prev( Iterator &iter ) const;
00087 virtual Item& getCurrent( const Iterator &iter );
00088 virtual Item& getCurrentKey( const Iterator &iter );
00089 virtual bool equalIterator( const Iterator &first, const Iterator &second ) const;
00090 };
00091
00092 }
00093
00094 #endif
00095
00096