#include <StringCompressor.h>
Public Member Functions | |
| ~StringCompressor () | |
| Destructor. | |
| void | GenerateTreeFromStrings (unsigned char *input, unsigned inputLength) |
| void | EncodeString (const char *input, int maxCharsToWrite, RakNet::BitStream *output) |
| bool | DecodeString (char *output, int maxCharsToWrite, RakNet::BitStream *input) |
| bool | DecodeAndAllocateString (char **output, int maxCharsToWrite, RakNet::BitStream *input) |
Static Public Member Functions | |
| static StringCompressor * | Instance (void) |
| static void | AddReference (void) |
| Used so I can allocate and deallocate this singleton at runtime. | |
| static void | RemoveReference (void) |
| Used so I can allocate and deallocate this singleton at runtime. | |
Private Member Functions | |
| void | GenerateHuffmanEncodingTree (void) |
| Create the Huffman encoding tree (obviously). | |
| StringCompressor () | |
| Private Constructor. | |
Private Attributes | |
| HuffmanEncodingTree * | huffmanEncodingTree |
| Pointer to the huffman encoding tree. | |
Static Private Attributes | |
| static StringCompressor * | instance = 0 |
| Singleton instance. | |
| static int | referenceCount = 0 |
Only works with ASCII strings. The default compression is for English. You can call GenerateTreeFromStrings to compress and decompress other languages efficiently as well.
|
||||||||||||||||
|
Writes input to output, uncompressed. Takes care of the null terminator for you.
|
|
||||||||||||||||
|
Writes input to output, uncompressed. Takes care of the null terminator for you.
|
|
||||||||||||||||
|
Writes input to output, compressed. Takes care of the null terminator for you.
|
|
||||||||||||
|
Given an array of strings, such as a chat log, generate the optimal encoding tree for it. This function is optional and if it is not called a default tree will be used instead.
|
|
|
static function because only static functions can access static members The RakPeer constructor adds a reference to this class, so don't call this until an instance of RakPeer exists, or unless you call AddReference yourself.
|
1.4.6-NO