Shadowrun: Awakened 29 September 2011 - Build 871
StringTable.h
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #ifndef __STRING_TABLE_H
00010 #define __STRING_TABLE_H
00011 
00012 #include "DS_OrderedList.h"
00013 #include "Export.h"
00014 #include "RakMemoryOverride.h"
00015 
00017 namespace RakNet
00018 {
00019     class BitStream;
00020 };
00021 
00023 typedef unsigned char StringTableType;
00024 
00026 struct StrAndBool
00027 {
00028     char *str;
00029     bool b;
00030 };
00031 
00032 namespace RakNet
00033 {
00034     int RAK_DLL_EXPORT StrAndBoolComp( char *const &key, const StrAndBool &data );
00035 
00042     class RAK_DLL_EXPORT StringTable
00043     {
00044     public:
00045 
00046         // Destructor   
00047         ~StringTable();
00048 
00052         static StringTable* Instance(void);
00053 
00057         void AddString(const char *str, bool copyString);
00058 
00064         void EncodeString( const char *input, int maxCharsToWrite, RakNet::BitStream *output );
00065 
00071         bool DecodeString( char *output, int maxCharsToWrite, RakNet::BitStream *input );
00072 
00074         static void AddReference(void);
00075 
00077         static void RemoveReference(void);
00078 
00080         StringTable();
00081 
00082     protected:
00085         void LogStringNotFound(const char *strName);
00086 
00088         static StringTable *instance;
00089         static int referenceCount;
00090 
00091         DataStructures::OrderedList<char *, StrAndBool, StrAndBoolComp> orderedStringList;
00092     };
00093 }
00094 
00095 
00096 #endif

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net