27 #ifndef Common_StringCompressorPrefix_h
28 #define Common_StringCompressorPrefix_h
89 virtual void write(uint8_t *buf)
const {
106 for (ii = 0; ii < len; ++ii)
128 #endif // Common_StringCompressorPrefix_h
std::string String
A String is simply a typedef to std::string.
size_t m_compressed_len
Length of the compressed string.
Po::typed_value< String > * str(String *v=0)
virtual size_t length_uncompressed() const
Retrieves the length of the uncompressed string.
uint8_t * ptr
Pointer to the end of the used part of the buffer.
A dynamic, resizable and reference counted memory buffer.
virtual void reset()
Clears the internal state.
int encoded_length_vi32(uint32_t val)
Length of a variable length encoded 32-bit integer (up to 5 bytes)
A dynamic, resizable memory buffer.
Functions to serialize/deserialize primitives to/from a memory buffer.
size_t m_uncompressed_len
Length of the uncompressed string.
void encode_vi32(uint8_t **bufp, uint32_t val)
Encode a integer (up to 32-bit) in variable length encoding.
String m_last_string
The previously added (uncompressed) string.
void clear()
Clears the buffer.
virtual void write(uint8_t *buf) const
Writes the compressed string to a buffer.
virtual size_t length() const
Retrieves the length of the compressed string.
uint8_t * base
Pointer to the allocated memory buffer.
virtual void add(const char *str)
Adds (and compresses) a string.
virtual void write_uncompressed(uint8_t *buf) const
Writes the uncompressed string to a buffer.
A String class based on std::string.
DynamicBuffer m_compressed_string
Dynamic array holding the compressed string.
size_t get_prefix_length(const char *str, size_t len) const
Helper function returning the prefix length of a new string.
A class to prefix-compress strings.
void reserve(size_t len, bool nocopy=false)
Reserve space for additional data Will grow the space to exactly what's needed.