class StringBlock
Defined at line 36 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
StringBlock provides heap allocated, dynamically sized blocks (mini arenas)
for allocating std::string instances. StringBlocks are allocated through
the `New` function, and must be freed using the `Delete` function.
StringBlocks are automatically sized from 256B to 8KB depending on the
`next` instance provided in the `New` function to keep the average maximum
unused space limited to 25%, or up to 4KB.
Public Methods
void StringBlock ()
Defined at line 38 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
void StringBlock (const StringBlock & )
Defined at line 39 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
StringBlock & operator= (const StringBlock & )
Defined at line 40 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
size_t allocated_size ()
Returns the total allocation size of this instance.
Defined at line 74 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
bool heap_allocated ()
Returns true if this block is heap allocated, false if emplaced.
Defined at line 77 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
size_t NextSize (StringBlock * block)
Returns the size of the next string block based on the size information
stored in `block`. `block` may be null in which case the size of the
initial string block is returned.
Defined at line 119 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
StringBlock * New (StringBlock * next)
Allocates a new StringBlock pointing to `next`, which can be null.
The size of the returned block depends on the allocated size of `next`.
Defined at line 131 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
StringBlock * Emplace (void * p, size_t n, StringBlock * next)
Allocates a new string block `in place`. `n` must be the value returned
from a previous call to `StringBlock::NextSize(next)`
Defined at line 123 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
size_t Delete (StringBlock * block)
Deletes `block` if `block` is heap allocated. `block` must not be null.
Returns the allocated size of `block`, or 0 if the block was emplaced.
Defined at line 146 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
StringBlock * next ()
Defined at line 154 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
std::string * AtOffset (size_t offset)
Returns the string instance at offset `offset`.
`offset` must be a multiple of sizeof(std::string), and be less than or
equal to `effective_size()`. `AtOffset(effective_size())` returns the
end of the allocated string instances and must not be de-referenced.
Defined at line 160 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
std::string * begin ()
Returns a pointer to the first string instance in this block.
Defined at line 167 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
std::string * end ()
Returns a pointer directly beyond the last string instance in this block.
Defined at line 171 of file ../../third_party/protobuf/src/google/protobuf/string_block.h
size_t effective_size ()
Returns the effective size available for allocation string instances.
This value is guaranteed to be a multiple of sizeof(std::string), and
guaranteed to never be zero.
Defined at line 156 of file ../../third_party/protobuf/src/google/protobuf/string_block.h