26 template<
class C,
class STDS>
67 :
_str{
string.data() },
_size{
string.size() }
80 _size =
string.size();
141 return other._size ==
_size 142 && traits_type::compare(
_str, other._str,
_size ) == 0;
147 return other._size !=
_size 148 || traits_type::compare(
_str, other._str,
_size ) != 0;
165 const auto pattern_size = pattern.
size();
166 if( pattern_size == 0 )
169 if( pattern_size <=
_size )
171 for( ; pos <=
_size - pattern_size; ++ pos )
173 if( traits_type::eq(
_str[ pos ], pattern.
_str[0] )
174 && traits_type::compare(
_str + pos + 1,
175 pattern.
_str + 1, pattern_size -1 ) == 0 )
190 for( ++__size; __size-- > 0; )
191 if( traits_type::eq(
_str[ __size ], c ) )
205 pos = std::min(
size_type(__size - __n), pos);
209 if( traits_type::compare( __data + pos, __s, __n ) == 0 )
220 throw std::out_of_range(
"StringViewBase::substr");
222 return STDS(
_str + pos, len );
227 std::vector< STDS > splitted;
229 const auto separator_size = separator.
size();
230 while( (pos =
find( separator, pos ) ) !=
npos )
232 if( prev_pos != pos )
233 splitted.emplace_back(
substr( prev_pos, pos - prev_pos ) );
234 pos += separator_size;
237 if( prev_pos !=
_size )
238 splitted.emplace_back(
substr( prev_pos ) );
244 return _str[ position ];
247 operator STDS()
const 257 template<
class C,
class STDS>
262 size_t result =
static_cast<size_t>(0xc70f6907UL);
263 for(
const auto& c : str )
265 hash_combine( result, c );
271 template<
class C,
class STDS>
279 template<
class C,
class STDS>
287 template<
class C,
class STDS>
291 return sv.size() == s.size()
295 template<
class C,
class STDS>
299 return sv.size() == s.size()
303 template<
class C,
class STDS>
311 template<
class C,
class STDS>
319 template<
class C,
class STDS>
323 return sv.size() != s.size()
327 template<
class C,
class STDS>
331 return sv.size() != s.size()
335 template<
class C,
class STDS>
340 a.data(), b.data(), std::min( a.size(), b.size() ) );
342 return a.size() < b.size();
346 template<
class _CharT,
class _Traits,
class C,
class STDS>
347 std::basic_ostream<_CharT, _Traits>&
350 for(
const auto& c : sv )
355 template<
class C,
class STDS>
const C * pointer
Definition: StringView.h:31
const value_type * _str
Definition: StringView.h:253
size_type find(const StringViewBase &pattern, size_type pos=0) const noexcept
Definition: StringView.h:163
bool operator()(const StringViewBase< C, STDS > &a, const StringViewBase< C, STDS > &b) const
Definition: StringView.h:361
StringViewBase(const C *str, size_t size_) noexcept
Warning, size_ MUST be strlen(str).
Definition: StringView.h:71
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: StringView.h:37
StringViewBase & operator=(const std::basic_string< C > &string) noexcept
Definition: StringView.h:77
const_pointer c_str() const noexcept
Definition: StringView.h:124
Definition: StringView.h:27
const_iterator cend() const noexcept
Definition: StringView.h:99
StringViewBase(const std::basic_string< C > &string) noexcept
Definition: StringView.h:66
size_type length() const noexcept
Definition: StringView.h:109
const C & reference
Definition: StringView.h:33
const_pointer data() const noexcept
Definition: StringView.h:114
iterator begin() const noexcept
Definition: StringView.h:84
bool empty() const noexcept
Definition: StringView.h:134
size_type rfind(value_type c, size_type pos=npos) const noexcept
Definition: StringView.h:183
static const size_type npos
Definition: StringView.h:41
StringViewBase(StringViewBase &&other) noexcept
Definition: StringView.h:49
const C * const_pointer
Definition: StringView.h:32
size_t operator()(const StringViewBase< C, STDS > &str) const noexcept
Definition: StringView.h:260
bool operator==(const StringViewBase &other) const noexcept
Definition: StringView.h:139
This version of the SDK is unstable, i-e, it may change with no warning.
Definition: AddCurveAction.h:20
StringViewBase< char, std::string > StringView
Definition: StringView.h:375
pointer c_str() noexcept
Definition: StringView.h:129
StringViewHasherBase< char, std::string > StringViewHasher
Definition: StringView.h:376
ptrdiff_t difference_type
Definition: StringView.h:40
StringViewBase() noexcept
Definition: StringView.h:43
iterator end() const noexcept
Definition: StringView.h:89
StringViewBase< wchar_t, std::wstring > WStringView
Definition: StringView.h:378
size_type _size
Definition: StringView.h:254
StringViewHasherBase< wchar_t, std::wstring > WStringViewHasher
Definition: StringView.h:379
std::char_traits< C > traits_type
Definition: StringView.h:29
bool operator!=(const C *str, const StringViewBase< C, STDS > &sv) noexcept
Definition: StringView.h:305
bool operator!=(const StringViewBase &other) const noexcept
Definition: StringView.h:145
bool operator==(const C *str, const StringViewBase< C, STDS > &sv) noexcept
Definition: StringView.h:273
const_pointer const_iterator
Definition: StringView.h:35
size_t size_type
Definition: StringView.h:39
Definition: StringView.h:356
value_type operator[](size_type position) const
Definition: StringView.h:242
Definition: StringView.h:258
const_iterator iterator
Definition: StringView.h:36
const_iterator cbegin() const noexcept
Definition: StringView.h:94
void is_transparent
Definition: StringView.h:358
const C & const_reference
Definition: StringView.h:34
pointer data() noexcept
Definition: StringView.h:119
const_reverse_iterator reverse_iterator
Definition: StringView.h:38
STDS substr(size_type pos=0, size_type n=npos) const
Definition: StringView.h:217
size_type find(value_type c, size_type pos=0) const noexcept
Definition: StringView.h:151
StringViewBase & operator=(const StringViewBase &other) noexcept=default
size_type rfind(const StringViewBase &pattern, size_type pos=npos) const noexcept
Definition: StringView.h:198
StringViewBase(const C *str) noexcept
Definition: StringView.h:62
C value_type
Definition: StringView.h:30
StringViewBase & operator=(StringViewBase &&other) noexcept
Definition: StringView.h:55
size_type size() const noexcept
Definition: StringView.h:104
std::vector< STDS > split(StringViewBase separator) const
Definition: StringView.h:225