14 static constexpr uint64_t PREFIX_LENGTH = 4;
15 static constexpr uint64_t INLINED_SUFFIX_LENGTH = 8;
16 static constexpr uint64_t SHORT_STR_LENGTH = PREFIX_LENGTH + INLINED_SUFFIX_LENGTH;
19 uint8_t prefix[PREFIX_LENGTH];
21 uint8_t data[INLINED_SUFFIX_LENGTH];
28 static bool isShortString(uint32_t len) {
return len <= SHORT_STR_LENGTH; }
31 return isShortString(len) ? prefix :
reinterpret_cast<uint8_t*
>(overflowPtr);
35 return isShortString(len) ? prefix :
reinterpret_cast<uint8_t*
>(overflowPtr);
40 void set(
const std::string& value);
41 void set(
const char* value, uint64_t length);
45 memcpy(prefix, value, length);
49 memcpy(prefix, value, PREFIX_LENGTH);
50 memcpy(
reinterpret_cast<char*
>(overflowPtr), value, length);
53 this->len = value.
len;
57 this->len = value.
len;
58 memcpy(prefix, value.
prefix, PREFIX_LENGTH);
59 memcpy(
reinterpret_cast<char*
>(overflowPtr),
reinterpret_cast<char*
>(value.
overflowPtr),
65 if (isShortString(length)) {
66 setShortString(value, length);
68 memcpy(prefix, value, PREFIX_LENGTH);
69 overflowPtr =
reinterpret_cast<uint64_t
>(value);
#define KUZU_API
Definition api.h:25
Definition alter_type.h:5
Definition ku_string.h:12
uint64_t overflowPtr
Definition ku_string.h:22
bool operator<(const ku_string_t &rhs) const
Definition ku_string.h:85
void setShortString(const char *value, uint64_t length)
Definition ku_string.h:43
uint32_t len
Definition ku_string.h:18
const uint8_t * getData() const
Definition ku_string.h:30
uint8_t * getDataUnsafe()
Definition ku_string.h:34
std::string getAsShortString() const
void setLongString(const char *value, uint64_t length)
Definition ku_string.h:47
void set(const std::string &value)
void set(const char *value, uint64_t length)
ku_string_t()
Definition ku_string.h:25
std::string getAsString() const
bool operator>(const ku_string_t &rhs) const
bool operator>=(const ku_string_t &rhs) const
Definition ku_string.h:83
void setFromRawStr(const char *value, uint64_t length)
Definition ku_string.h:63
static bool isShortString(uint32_t len)
Definition ku_string.h:28
void set(const ku_string_t &value)
void setShortString(const ku_string_t &value)
Definition ku_string.h:52
std::string_view getAsStringView() const
ku_string_t(const char *value, uint64_t length)
void setLongString(const ku_string_t &value)
Definition ku_string.h:56
bool operator!=(const ku_string_t &rhs) const
Definition ku_string.h:79
bool operator==(const ku_string_t &rhs) const
bool operator<=(const ku_string_t &rhs) const
Definition ku_string.h:87
uint8_t prefix[PREFIX_LENGTH]
Definition ku_string.h:19