00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __CSIBCStringTable_H__
00016 #define __CSIBCStringTable_H__
00017
00018 #ifdef _DEBUG
00019 #include <assert.h>
00020 #define _SI_ASSERT(x) assert(x)
00021 #else
00022 #define _SI_ASSERT(exp)
00023 #endif
00024
00025 #include "SIBCUtil.h"
00026 #include "SIBCArray.h"
00027 #include "SIBCString.h"
00028 #include <string.h>
00029
00030
00031 #if defined(_WIN32) || defined(_WIN32_WCE) || defined( _XBOX )
00032 #pragma warning( disable : 4786 )
00033 #endif
00034
00035 struct SKeyStringPair
00036 {
00037 SI_UInt key;
00038 CSIBCString value;
00039 };
00040
00041 struct SKeyStringArray : public CSIBCArray<SKeyStringPair>
00042 {
00043 inline SKeyStringArray() : CSIBCArray<SKeyStringPair>(1)
00044 {
00045 }
00046 };
00047
00048 struct SKeyStringTable : public CSIBCArray<SKeyStringArray>
00049 {
00050 inline SKeyStringTable(SI_Int size) : CSIBCArray<SKeyStringArray>(size)
00051 {
00052 }
00053 };
00054
00055 class XSICOREEXPORT CSIBCStringTable
00056 {
00057 public:
00058
00059
00060 inline CSIBCStringTable(SI_Int size = 256) : m_table(size)
00061 {
00062 }
00063
00064 virtual ~CSIBCStringTable();
00065 SI_UInt Insert( const SI_Char* value );
00066 SI_UInt GetKey( const SI_Char* value );
00067 const char* Get( SI_UInt key );
00068
00069 private :
00070 SKeyStringTable m_table;
00071
00072 SI_UInt Index(SI_UInt key);
00073 SI_UInt Key(const char* csBlock);
00074
00075 };
00076
00077 #endif // ALREADY_INCLUDED_CSIBCStringTable