A class to prefix-compress strings. More...
#include <StringCompressorPrefix.h>
Public Member Functions | |
virtual void | reset () |
Clears the internal state. More... | |
virtual void | add (const char *str) |
Adds (and compresses) a string. More... | |
virtual size_t | length () const |
Retrieves the length of the compressed string. More... | |
virtual size_t | length_uncompressed () const |
Retrieves the length of the uncompressed string. More... | |
virtual void | write (uint8_t *buf) const |
Writes the compressed string to a buffer. More... | |
virtual void | write_uncompressed (uint8_t *buf) const |
Writes the uncompressed string to a buffer. More... | |
Private Member Functions | |
size_t | get_prefix_length (const char *str, size_t len) const |
Helper function returning the prefix length of a new string. More... | |
Private Attributes | |
size_t | m_compressed_len |
Length of the compressed string. More... | |
size_t | m_uncompressed_len |
Length of the uncompressed string. More... | |
String | m_last_string |
The previously added (uncompressed) string. More... | |
DynamicBuffer | m_compressed_string |
Dynamic array holding the compressed string. More... | |
A class to prefix-compress strings.
Definition at line 43 of file StringCompressorPrefix.h.
|
inlinevirtual |
Adds (and compresses) a string.
Keeps a copy of the uncompressed string for the next invocation of this function. The compressed string can be retrieved with write.
str | A null-terminated string to compress |
Definition at line 57 of file StringCompressorPrefix.h.
|
inlineprivate |
Helper function returning the prefix length of a new string.
Definition at line 102 of file StringCompressorPrefix.h.
|
inlinevirtual |
Retrieves the length of the compressed string.
Definition at line 79 of file StringCompressorPrefix.h.
|
inlinevirtual |
Retrieves the length of the uncompressed string.
Definition at line 84 of file StringCompressorPrefix.h.
|
inlinevirtual |
Clears the internal state.
Definition at line 46 of file StringCompressorPrefix.h.
|
inlinevirtual |
Writes the compressed string to a buffer.
Definition at line 89 of file StringCompressorPrefix.h.
|
inlinevirtual |
Writes the uncompressed string to a buffer.
Definition at line 94 of file StringCompressorPrefix.h.
|
private |
Length of the compressed string.
Definition at line 113 of file StringCompressorPrefix.h.
|
private |
Dynamic array holding the compressed string.
Definition at line 122 of file StringCompressorPrefix.h.
|
private |
The previously added (uncompressed) string.
Definition at line 119 of file StringCompressorPrefix.h.
|
private |
Length of the uncompressed string.
Definition at line 116 of file StringCompressorPrefix.h.