22 #ifndef XAPIAN_INCLUDED_PREFIX_COMPRESSED_STRINGS_H 23 #define XAPIAN_INCLUDED_PREFIX_COMPRESSED_STRINGS_H 34 #define MAGIC_XOR_VALUE 96 37 const unsigned char *
p;
42 const std::string ¤t_)
43 : p(p_), left(left_), current(current_) { }
46 : p(o.p), left(o.left), current(
std::move(o.current)) {}
50 : p(reinterpret_cast<const unsigned char *>(s.data())),
64 const unsigned char * old_p =
p;
65 size_t old_left =
left;
66 std::string old_current =
current;
75 if (!current.empty()) {
82 current.append(reinterpret_cast<const char *>(p + 1), add);
104 if (!current.empty()) {
105 size_t len = std::min(current.size(), word.size());
107 for (i = 0; i < len; ++i) {
108 if (current[i] != word[i])
break;
111 out += char((word.size() - i) ^ MAGIC_XOR_VALUE);
112 out.append(word.data() + i, word.size() - i);
129 #endif // XAPIAN_INCLUDED_PREFIX_COMPRESSED_STRINGS_H PrefixCompressedStringItor operator++(int)
PrefixCompressedStringItor(const std::string &s)
bool operator()(const PrefixCompressedStringItor *a, const PrefixCompressedStringItor *b) const
Return true if and only if a's string is strictly greater than b's.
PrefixCompressedStringItor(PrefixCompressedStringItor &&o)
Hierarchy of classes which Xapian can throw as exceptions.
PrefixCompressedStringItor(const unsigned char *p_, size_t left_, const std::string ¤t_)
DatabaseCorruptError indicates database corruption was detected.
PrefixCompressedStringItor & operator++()
const std::string & operator*() const
void append(const std::string &word)
PrefixCompressedStringWriter(std::string &out_)