首 页 | 新 闻 | Symbian | Windows Mobile| J2ME | 下载中心 | 游戏策划 | 购书指南 | 移动开发视频教程
您现在的位置: 开发视界 >> Symbian英文资料 >> base >> 文章正文
Hashtable implementation for Symbian
作者:佚名    文章来源:newlc    更新时间:2007-1-5 14:47:20

Having been unable to find a hashtable implementation for Symbian environments, I ended up reinventing the wheel a bit and wrote my own. The API somewhat resembles that of java.util.Hashtable, and only implements the "mandatory" functions (put, get, remove, rehash). It is implemented as a set of templated classes. All of the code is attached, please find a summary of the API (with comments stripped) below:

   public: // Constructors and destructor
       static CHashTable* NewL( TInt aInitialTableSize = KDefaultTableSize,
                                TReal aRehashRatio = KDefaultRehashRatio );
       static CHashTable* NewLC( TInt aInitialTableSize = KDefaultTableSize,
                                 TReal aRehashRatio = KDefaultRehashRatio );
       virtual ~CHashTable();

   public: // New methods
       void PutL( const TDesC& aKey, T* aObj );
       const T* GetL( const TDesC& aKey ) const;
       TBool Remove( const TDesC& aKey );
       void ResetTable();
       void RehashL();
       CEntryIterator<T>* EntriesLC() const;
       TReal LoadFactor();
       TInt NumEntries() const;
相关文章:
Observer Pattern in Symbian application
Retrieving IMEI, IMSI, Network Info (Cell Id, Location Code) on 3rd Edition.
C++ Inheritance
Using Extended Notifiers
Using inline assembler within Symbian C++
Cleanup support for ResetAndDestroy()
Simplify Two Phase Constructor in Symbian
Guidelines for Code Optimisation