18 #ifndef GRN_DAT_KEY_HPP_
19 #define GRN_DAT_KEY_HPP_
38 return String(ptr(), length());
41 const void *
ptr()
const {
45 return (length_high_ << 4) | (id_and_length_low_ & 0x0F);
48 return id_and_length_low_ >> 4;
52 if (length != this->length()) {
55 for ( ; offset < length; ++offset) {
56 if ((*
this)[offset] != static_cast<const UInt8 *>(ptr)[offset]) {
66 const void *key_ptr,
UInt32 key_length) {
72 *buf = (key_id << 4) | (key_length & 0x0F);
73 UInt8 *ptr =
reinterpret_cast<UInt8 *
>(buf + 1);
74 *ptr++ = key_length >> 4;
76 ptr[
i] =
static_cast<const UInt8 *
>(key_ptr)[
i];
78 return *
reinterpret_cast<const Key *
>(buf);
84 return 2 + (length /
sizeof(
UInt32));
89 static const Key invalid_key;
106 Key &operator=(
const Key &);
112 #endif // GRN_DAT_KEY_HPP_