Go to the documentation of this file.
5 #ifndef RE2_STRINGPIECE_H_
6 #define RE2_STRINGPIECE_H_
24 #define __has_include(x) 0
33 #if __has_include(<string_view>) && __cplusplus >= 201703L
34 #include <string_view>
60 #if __has_include(<string_view>) && __cplusplus >= 201703L
107 template <
typename A>
108 explicit operator std::basic_string<char, traits_type, A>()
const {
109 if (!
data_)
return {};
110 return std::basic_string<char, traits_type, A>(
data_,
size_);
140 int r = memcmp(
data(),
x.data(), min_size);
141 if (
r < 0)
return -1;
144 if (
size() <
x.size())
return -1;
145 if (
size() >
x.size())
return 1;
152 (
size() >=
x.size() && memcmp(
data(),
x.data(),
x.size()) == 0);
158 (
size() >=
x.size() &&
159 memcmp(
data() + (
size() -
x.size()),
x.data(),
x.size()) == 0);
178 if (
len !=
y.size())
return false;
179 return x.data() ==
y.data() ||
len == 0 ||
180 memcmp(
x.data(),
y.data(),
len) == 0;
189 int r = min_size == 0 ? 0 : memcmp(
x.data(),
y.data(), min_size);
190 return (
r < 0) || (
r == 0 &&
x.size() <
y.size());
206 std::ostream&
operator<<(std::ostream& o,
const StringPiece& p);
210 #endif // RE2_STRINGPIECE_H_
bool starts_with(const StringPiece &x) const
void remove_prefix(size_type n)
std::ostream & operator<<(std::ostream &o, const StringPiece &p)
std::char_traits< char > traits_type
void remove_suffix(size_type n)
const_iterator end() const
static const size_type npos
bool operator>=(const StringPiece &x, const StringPiece &y)
std::reverse_iterator< const_iterator > const_reverse_iterator
StringPiece(const std::string &str)
bool operator!=(const StringPiece &x, const StringPiece &y)
StringPiece(const char *str)
bool ends_with(const StringPiece &x) const
int compare(const StringPiece &x) const
size_type find(const StringPiece &s, size_type pos=0) const
std::string ToString() const
const typedef char * const_iterator
ptrdiff_t difference_type
const_pointer data() const
bool contains(const StringPiece &s) const
bool operator==(const StringPiece &x, const StringPiece &y)
bool operator<=(const StringPiece &x, const StringPiece &y)
void set(const char *str)
bool operator>(const StringPiece &x, const StringPiece &y)
void set(const char *str, size_type len)
absl::string_view string_view
const_iterator begin() const
const_reference operator[](size_type i) const
const_reverse_iterator rbegin() const
std::string as_string() const
void AppendToString(std::string *target) const
StringPiece substr(size_type pos=0, size_type n=npos) const
size_type rfind(const StringPiece &s, size_type pos=npos) const
StringPiece(const char *str, size_type len)
void CopyToString(std::string *target) const
const_reverse_iterator reverse_iterator
size_type copy(char *buf, size_type n, size_type pos=0) const
bool operator<(const StringPiece &x, const StringPiece &y)
const typedef char * const_pointer
const typedef char & const_reference
const_reverse_iterator rend() const
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:22