Lines Matching defs:string_view
1 //===-- Standalone implementation std::string_view --------------*- C++ -*-===//
20 // This is very simple alternate of the std::string_view class. There is no
25 class string_view {
46 LIBC_INLINE bool equals(string_view Other) const {
66 LIBC_INLINE constexpr string_view() : Data(nullptr), Len(0) {}
71 LIBC_INLINE constexpr string_view(const char *Str)
75 LIBC_INLINE constexpr string_view(const char *Str, size_t N)
80 // Returns the size of the string_view.
83 // Returns whether the string_view is empty.
102 LIBC_INLINE int compare(string_view Other) const {
112 LIBC_INLINE bool operator==(string_view Other) const { return equals(Other); }
113 LIBC_INLINE bool operator!=(string_view Other) const {
116 LIBC_INLINE bool operator<(string_view Other) const {
119 LIBC_INLINE bool operator<=(string_view Other) const {
122 LIBC_INLINE bool operator>(string_view Other) const {
125 LIBC_INLINE bool operator>=(string_view Other) const {
141 LIBC_INLINE bool starts_with(string_view Prefix) const {
157 LIBC_INLINE bool ends_with(string_view Suffix) const {
171 LIBC_INLINE string_view substr(size_t Start, size_t N = npos) const {
173 return string_view(Data + Start, min(N, Len - Start));