susumu.yata
null+****@clear*****
Thu Feb 7 15:29:20 JST 2013
susumu.yata 2013-02-07 15:29:20 +0900 (Thu, 07 Feb 2013) New Revision: 5f7572cc78ac83c7c2e15cd5a4c4bff0affd2e10 https://github.com/groonga/grnxx/commit/5f7572cc78ac83c7c2e15cd5a4c4bff0affd2e10 Log: Remove an unused class DoubleArrayString. Modified files: lib/alpha/double_array.hpp Modified: lib/alpha/double_array.hpp (+0 -90) =================================================================== --- lib/alpha/double_array.hpp 2013-02-07 14:58:01 +0900 (7ead298) +++ lib/alpha/double_array.hpp 2013-02-07 15:29:20 +0900 (724be76) @@ -61,96 +61,6 @@ constexpr uint64_t DOUBLE_ARRAY_INVALID_LEADER = 0x7FFFFFFF; constexpr uint64_t DOUBLE_ARRAY_KEYS_PAGE_SIZE = VECTOR_DEFAULT_PAGE_SIZE; -class DoubleArrayString { - public: - DoubleArrayString() : ptr_(nullptr), length_(0) {} - DoubleArrayString(const void *ptr, uint64_t length) - : ptr_(static_cast<const uint8_t *>(ptr)), length_(length) {} - - const uint8_t &operator[](uint64_t i) const { - return ptr_[i]; - } - - const void *ptr() const { - return ptr_; - } - uint64_t length() const { - return length_; - } - - void assign(const void *ptr, uint64_t length) { - ptr_ = static_cast<const uint8_t *>(ptr); - length_ = length; - } - - DoubleArrayString substr(uint64_t offset = 0) const { - return DoubleArrayString(ptr_ + offset, length_ - offset); - } - DoubleArrayString substr(uint64_t offset, uint64_t length) const { - return DoubleArrayString(ptr_ + offset, length); - } - - // This function returns an integer as follows: - // - a negative value if *this < rhs, - // - zero if *this == rhs, - // - a positive value if *this > rhs. - // Note that the result is undefined if the offset is too large. - int compare(const DoubleArrayString &rhs, uint64_t offset = 0) const { - for (uint64_t i = offset; i < length(); ++i) { - if (i >= rhs.length()) { - return 1; - } else if ((*this)[i] != rhs[i]) { - return (*this)[i] - rhs[i]; - } - } - return (length() == rhs.length()) ? 0 : -1; - } - - private: - const uint8_t *ptr_; - uint64_t length_; -}; - -inline bool operator==(const DoubleArrayString &lhs, - const DoubleArrayString &rhs) { - if (lhs.length() != rhs.length()) { - return false; - } else if (lhs.ptr() == rhs.ptr()) { - return true; - } - for (uint64_t i = 0; i < lhs.length(); ++i) { - if (lhs[i] != rhs[i]) { - return false; - } - } - return true; -} - -inline bool operator!=(const DoubleArrayString &lhs, - const DoubleArrayString &rhs) { - return !(lhs == rhs); -} - -inline bool operator<(const DoubleArrayString &lhs, - const DoubleArrayString &rhs) { - return lhs.compare(rhs) < 0; -} - -inline bool operator>(const DoubleArrayString &lhs, - const DoubleArrayString &rhs) { - return rhs < lhs; -} - -inline bool operator<=(const DoubleArrayString &lhs, - const DoubleArrayString &rhs) { - return !(lhs > rhs); -} - -inline bool operator>=(const DoubleArrayString &lhs, - const DoubleArrayString &rhs) { - return !(lhs < rhs); -} - class DoubleArrayHeader { public: DoubleArrayHeader(); -------------- next part -------------- HTML����������������������������...Download