Plasma Engine  2.0
Loading...
Searching...
No Matches
plStringDeduplicationWriteContext Class Reference

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>

Inheritance diagram for plStringDeduplicationWriteContext:

Public Member Functions

 plStringDeduplicationWriteContext (plStreamWriter &ref_originalStream)
 Setup the write context to perform string deduplication.
 
plStreamWriterBegin ()
 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.
 
plStreamWriterGetOriginalStream ()
 Returns the original stream that was passed to the constructor.
 
- Public Member Functions inherited from plSerializationContext< plStringDeduplicationWriteContext >
void SetActive (bool bActive)
 Set the context as active which means it can be accessed via GetContext in serialization methods.
 

Protected Attributes

plStreamWriterm_OriginalStream
 
plDefaultMemoryStreamStorage m_TempStreamStorage
 
plMemoryStreamWriter m_TempStreamWriter
 
plMap< plHybridString< 64 >, plUInt32 > m_DeduplicatedStrings
 

Detailed Description

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.


The documentation for this class was generated from the following files: