![]() |
Plasma Engine
2.0
|
This class allows for automatic deduplication of strings written to a stream. To use, create an object of this type on the stack, call Begin() and use the returned plStreamWriter for subsequent serialization operations. Call End() once you want to finish writing deduplicated strings. For a sample see StreamOperationsTest.cpp. More...
#include <StringDeduplicationContext.h>
Public Member Functions | |
plStringDeduplicationWriteContext (plStreamWriter &ref_originalStream) | |
Setup the write context to perform string deduplication. | |
plStreamWriter & | Begin () |
Call this method to begin string deduplicaton. You need to use the returned stream writer for subsequent serialization operations until End() is called. | |
plResult | End () |
Ends the string deduplication and writes the string table to the original stream. | |
void | SerializeString (const plStringView &sString, plStreamWriter &ref_writer) |
Internal method to serialize a string. | |
plUInt32 | GetUniqueStringCount () const |
Returns the number of unique strings which were serialized with this instance. | |
plStreamWriter & | GetOriginalStream () |
Returns the original stream that was passed to the constructor. | |
![]() | |
void | SetActive (bool bActive) |
Set the context as active which means it can be accessed via GetContext in serialization methods. | |
Protected Attributes | |
plStreamWriter & | m_OriginalStream |
plDefaultMemoryStreamStorage | m_TempStreamStorage |
plMemoryStreamWriter | m_TempStreamWriter |
plMap< plHybridString< 64 >, plUInt32 > | m_DeduplicatedStrings |
This class allows for automatic deduplication of strings written to a stream. To use, create an object of this type on the stack, call Begin() and use the returned plStreamWriter for subsequent serialization operations. Call End() once you want to finish writing deduplicated strings. For a sample see StreamOperationsTest.cpp.