![]() |
Public API Reference |
00001 /* 00002 Copyright (C) 2002 by Jorrit Tyberghein 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_STRHASH_H__ 00020 #define __CS_STRHASH_H__ 00021 00022 #include "csutil/hashmap.h" 00023 00032 typedef uint32 csStringID; 00034 csStringID const csInvalidStringID = (csStringID) ~0; 00035 00036 class csStringHash; 00037 00043 class csStringHashIterator 00044 { 00045 friend class csStringHash; 00046 00047 private: 00048 csGlobalHashIterator* hashIt; 00049 00050 public: 00051 00057 csStringHashIterator (csStringHash* hash); 00058 00060 bool HasNext (); 00062 csStringID Next (); 00063 }; 00064 00069 class csStringHash 00070 { 00071 private: 00072 friend class csStringHashIterator; 00073 00074 csHashMap Registry; 00075 00076 public: 00078 csStringHash (uint32 size = 211); 00080 ~csStringHash (); 00081 00086 const char* Register (const char *s, csStringID id); 00087 00092 csStringID Request (const char *s); 00093 00098 const char* Request (csStringID id); 00099 00103 void Clear (); 00104 }; 00105 00106 #endif // __CS_STRHASH_H__