mirror of https://gitee.com/bigwinds/arangodb
Add set method for Slice in velocypack.
This commit is contained in:
parent
4d9c132a0a
commit
7c890dce03
|
@ -95,6 +95,9 @@ class Slice {
|
||||||
// pointer to the head byte
|
// pointer to the head byte
|
||||||
uint8_t const* start() const { return _start; }
|
uint8_t const* start() const { return _start; }
|
||||||
|
|
||||||
|
// Set new memory position
|
||||||
|
void set(uint8_t const* s) { _start = s; }
|
||||||
|
|
||||||
// pointer to the head byte
|
// pointer to the head byte
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const* startAs() const {
|
T const* startAs() const {
|
||||||
|
@ -660,6 +663,7 @@ class Slice {
|
||||||
|
|
||||||
// check if two Slices are equal on the binary level
|
// check if two Slices are equal on the binary level
|
||||||
bool equals(Slice const& other) const;
|
bool equals(Slice const& other) const;
|
||||||
|
bool operator==(Slice const& other) const { return equals(other); }
|
||||||
|
|
||||||
static bool equals(uint8_t const* left, uint8_t const* right) {
|
static bool equals(uint8_t const* left, uint8_t const* right) {
|
||||||
return Slice(left).equals(Slice(right));
|
return Slice(left).equals(Slice(right));
|
||||||
|
@ -775,14 +779,6 @@ struct hash<arangodb::velocypack::Slice> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// implementation of std::equal_to for two Slice objects
|
|
||||||
template <>
|
|
||||||
struct equal_to<arangodb::velocypack::Slice> {
|
|
||||||
bool operator()(arangodb::velocypack::Slice const& left,
|
|
||||||
arangodb::velocypack::Slice const& right) const {
|
|
||||||
return left.equals(right);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream&, arangodb::velocypack::Slice const*);
|
std::ostream& operator<<(std::ostream&, arangodb::velocypack::Slice const*);
|
||||||
|
|
Loading…
Reference in New Issue