Blink DB Documentation v1.0.0
Blink DB Documentation
Loading...
Searching...
No Matches
key_value.hpp
Go to the documentation of this file.
1
9#ifndef KEY_VALUE_HPP
10#define KEY_VALUE_HPP
11
12#include <string>
13
20private:
21 std::string key;
22 std::string value;
23
24public:
31 KeyValuePair(const std::string &key, const std::string &value)
32 : key(key), value(value) {}
33
34 KeyValuePair(const std::string &keyBytes)
35 : key(keyBytes) {}
37 : key(""), value("") {}
38
44 void setValue(const std::string &newValue) { value = newValue; }
45
51 const std::string &getKey() const { return key; }
52
58 const std::string &getValue() const { return value; }
59
66 size_t size() const {
67 return sizeof(std::string) * 2 +
68 key.capacity() +
69 value.capacity();
70 }
71};
72#endif
void setValue(const std::string &newValue)
Set the Value object.
Definition key_value.hpp:44
KeyValuePair(const std::string &key, const std::string &value)
Construct a new Key Value Pair object.
Definition key_value.hpp:31
const std::string & getValue() const
Get the Value object.
Definition key_value.hpp:58
size_t size() const
Get the Size of the Key Value Pair object.
Definition key_value.hpp:66
const std::string & getKey() const
Get the Key object.
Definition key_value.hpp:51