A key-value binary stream writer/reader with support for serialization, deserialization, and deletion.
More...
#include <KeyValueStream.hpp>
|
| Represents metadata for a key-value entry in the file. More...
|
|
| KeyValueStream (FileHandle &file_handle) |
| Constructs a KeyValueStream with a reference to an existing file handle.
|
void | write (const KeyT &key, const ValueT &value) |
| Writes a key-value pair to the stream, replacing any existing value for the key.
|
bool | read (const KeyT &key, ValueT &out) |
| Reads a value by key.
|
bool | erase (const KeyT &key) |
| Removes a key-value pair from the stream.
|
template<typename KeyT, typename ValueT>
class dz::KeyValueStream< KeyT, ValueT >
A key-value binary stream writer/reader with support for serialization, deserialization, and deletion.
- Template Parameters
-
KeyT | Type of the key. |
ValueT | Type of the value. |
◆ KeyValueStream()
template<typename KeyT, typename ValueT>
Constructs a KeyValueStream with a reference to an existing file handle.
- Parameters
-
file_handle | The file handle to operate on. |
◆ erase()
template<typename KeyT, typename ValueT>
Removes a key-value pair from the stream.
- Parameters
-
- Returns
- True if erased successfully, false if the key did not exist.
◆ read()
template<typename KeyT, typename ValueT>
Reads a value by key.
- Parameters
-
key | The key to look up. |
out | Output parameter for the deserialized value. |
- Returns
- True if the value was found and read successfully, false otherwise.
◆ write()
template<typename KeyT, typename ValueT>
Writes a key-value pair to the stream, replacing any existing value for the key.
- Parameters
-
key | The key to write. |
value | The value to write. |
The documentation for this class was generated from the following file: