Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

hashstring.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                  hashstring.h  -  Hashed version of std::string
00003                              -------------------
00004     begin                : Wed Oct 16 2002
00005     copyright            : (C) 2002 by Reality Rift Studios
00006     email                : mattias@realityrift.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, hashstring.h
00020 
00021  The Initial Developer of the Original Code is Mattias Jansson.
00022  Portions created by Mattias Jansson are Copyright (C) 2002
00023  Reality Rift Studios. All Rights Reserved.
00024 
00025  ***************************************************************************/
00026 
00027 #ifndef __NEHASHSTRING_H
00028 #define __NEHASHSTRING_H
00029 
00030 
00037 #include "base.h"
00038 #include "hash.h"
00039 
00040 #include <string>
00041 
00042 
00043 namespace NeoEngine
00044 {
00045 
00046 
00057 class NEOENGINE_API HashString
00058 {
00059     protected:
00060 
00062         unsigned int                                  m_uiHash;
00063 
00064 
00065     public:
00066 
00068         std::string                                   m_strData;
00069 
00070 
00074         inline                                        HashString();
00075 
00080         inline                                        HashString( const HashString &rstrRef );
00081 
00086         inline                                        HashString( const std::string &rstrRef );
00087 
00093         inline                                        HashString( const char *pcRef, int iNum );
00094 
00099         inline                                        HashString( const char *pszRef );
00100 
00106         inline                                        HashString( int iNum, const char cData );
00107 
00113         inline bool                                   Compare( const HashString &rstrRef ) const;
00114 
00120         inline bool                                   Compare( unsigned int uiHash ) const;
00121 
00125         inline unsigned int                           GetHash() const;
00126 
00131         inline HashString                            &HashMe();
00132 
00136         inline size_t                                 length() const;
00137 
00141         inline const char                            *c_str() const;
00142 
00148         inline bool                                   operator == ( const HashString &rstrRef ) const;
00149 
00155         inline bool                                   operator == ( unsigned int uiHash ) const;
00156 
00162         inline bool                                   operator == ( const std::string &rstrRef ) const;
00163 
00169         inline bool                                   operator == ( const char *pszRef ) const;
00170 
00176         inline bool                                   operator != ( const HashString &rstrRef ) const;
00177 
00183         inline bool                                   operator != ( unsigned int uiHash ) const;
00184 
00190         inline bool                                   operator != ( const std::string &rstrRef ) const;
00191 
00197         inline bool                                   operator != ( const char *pszRef ) const;
00198 
00204         inline HashString                            &operator = ( const HashString &rstrRef );
00205 
00211         inline HashString                            &operator = ( const std::string &rstrRef );
00212 
00218         inline HashString                            &operator = ( const char *pszRef );
00219 
00225         inline HashString                            &operator += ( const HashString &rstrRef );
00226 
00232         inline HashString                            &operator += ( const std::string &rstrRef );
00233 
00239         inline HashString                            &operator += ( const char *pszRef );
00240 
00244         inline                                        operator std::string &();
00245 
00249         inline                                        operator const std::string &() const;
00250 
00256         inline bool                                   operator < ( const HashString &rstrString ) const;
00257 };
00258 
00259 
00266 NEOENGINE_API std::ostream                   &operator << ( std::ostream &rkStream, const HashString &rkString );
00267 
00268 
00275 inline HashString                             operator + ( const HashString &rstrOne, const HashString &rstrTwo );
00276 
00277 
00284 inline HashString                             operator + ( const HashString &rstrOne, const std::string &rstrTwo );
00285 
00286 
00293 inline HashString                             operator + ( const HashString &rstrOne, const char *pszTwo );
00294 
00295 
00302 inline HashString                             operator + ( const std::string &rstrOne, const HashString &rstrTwo );
00303 
00304 
00311 inline HashString                             operator + ( const char *pszOne, const HashString &rstrTwo );
00312 
00313 
00314 #include "hashstring_inl.h"
00315 
00316 
00317 };
00318 
00319 
00320 #endif

Generated on Wed Jan 21 14:21:06 2004 for NeoEngine by doxygen 1.3.5