AWS IoT Device SDK C++ v2: crt/aws-crt-cpp/include/aws/crt/StringView.h Source File

AWS IoT Device SDK C++ v2 1.14.0 AWS IoT Device SDK C++ v2

StringView.h
Go to the documentation of this file.
1#pragma once
11#include <algorithm>
12#include <cassert>
13#include <iterator>
14#include <limits>
15#include <stddef.h>
16#include <type_traits>
17
18#if __cplusplus >= 201703L || (defined(_MSC_LANG) && _MSC_LANG >= 201703L)
19# include <string_view>
20#endif
21
22namespace Aws
23{
24 namespace Crt
25 {
31 template <typename CharT, typename Traits = std::char_traits<CharT>> class basic_string_view
32 {
33 public:
34 // types
35 using traits_type = Traits;
36 using value_type = CharT;
37 using pointer = value_type *;
38 using const_pointer = const value_type *;
39 using reference = value_type &;
40 using const_reference = const value_type &;
41 using const_iterator = const value_type *;
42 using iterator = const_iterator;
43 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
44 using reverse_iterator = const_reverse_iterator;
45 using size_type = size_t;
46 using difference_type = ptrdiff_t;
47 static constexpr size_type npos = static_cast<size_type>(-1);
48
49 // constructors and assignment
50
51 constexpr basic_string_view() noexcept : m_size{0}, m_data{nullptr} {}
52
53 constexpr basic_string_view(const basic_string_view &) noexcept = default;
54
55 constexpr basic_string_view(const CharT *s) noexcept : m_size{traits_type::length(s)}, m_data{s} {}
56
57 constexpr basic_string_view(const CharT *s, size_type length) noexcept : m_size{length}, m_data{s} {}
58
59 basic_string_view &operator=(const basic_string_view &) noexcept = default;
60
61#if __cplusplus >= 201703L || (defined(_MSC_LANG) && _MSC_LANG >= 201703L)
62 constexpr basic_string_view(const std::basic_string_view<CharT, Traits> &other) noexcept
63 : m_size(other.size()), m_data(other.data())
64 {
65 }
66
67 basic_string_view &operator=(const std::basic_string_view<CharT, Traits> &other) noexcept
68 {
69 m_data = other->data();
70 m_size = other->size();
71 return *this;
72 }
73#endif
74 // iterators
75
76 constexpr const_iterator begin() const noexcept { return this->m_data; }
77
78 constexpr const_iterator end() const noexcept { return this->m_data + this->m_size; }
79
80 constexpr const_iterator cbegin() const noexcept { return this->m_data; }
81
82 constexpr const_iterator cend() const noexcept { return this->m_data + this->m_size; }
83
84 constexpr const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(this->end()); }
85
86 constexpr const_reverse_iterator rend() const noexcept { return const_reverse_iterator(this->begin()); }
87
88 constexpr const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(this->end()); }
89
90 constexpr const_reverse_iterator crend() const noexcept { return const_reverse_iterator(this->begin()); }
91
92 constexpr size_type size() const noexcept { return this->m_size; }
93
94 constexpr size_type length() const noexcept { return m_size; }
95
96 constexpr size_type max_size() const noexcept { return (std::numeric_limits<size_type>::max)(); }
97
98 constexpr bool empty() const noexcept { return this->m_size == 0; }
99
100 // element accessors
101
102 const_reference operator[](size_type pos) const noexcept
103 {
104 assert(pos < m_size);
105 return *(this->m_data + pos);
106 }
107
108 const_reference at(size_type pos) const
109 {
110 assert(pos < m_size);
111 return *(this->m_data + pos);
112 }
113
114 const_reference front() const noexcept
115 {
116 assert(m_size > 0);
117 return *this->m_data;
118 }
119
120 const_reference back() const noexcept
121 {
122 assert(m_size > 0);
123 return *(this->m_data + this->m_size - 1);
124 }
125
126 constexpr const_pointer data() const noexcept { return this->m_data; }
127
128 // modifiers
129 void remove_prefix(size_type n) noexcept
130 {
131 assert(this->m_size >= n);
132 this->m_data += n;
133 this->m_size -= n;
134 }
135
136 void remove_suffix(size_type n) noexcept { this->m_size -= n; }
137
138 void swap(basic_string_view &other) noexcept
139 {
140 auto tmp = *this;
141 *this = other;
142 other = tmp;
143 }
144
145 // string operations
146 size_type copy(CharT *s, size_type n, size_type pos = 0) const
147 {
148 assert(pos <= size());
149 const size_type copyLen = (std::min)(n, m_size - pos);
150 traits_type::copy(s, data() + pos, copyLen);
151 return copyLen;
152 }
153
154 basic_string_view substr(size_type pos = 0, size_type n = npos) const noexcept(false)
155 {
156 assert(pos <= size());
157 const size_type copyLen = (std::min)(n, m_size - pos);
158 return basic_string_view{m_data + pos, copyLen};
159 }
160
161 int compare(const basic_string_view &s) const noexcept
162 {
163 const size_type compareLen = (std::min)(this->m_size, s.m_size);
164 int ret = traits_type::compare(this->m_data, s.m_data, compareLen);
165 if (ret == 0)
166 {
167 ret = _s_compare(this->m_size, s.m_size);
168 }
169 return ret;
170 }
171
172 constexpr int compare(size_type pos1, size_type n1, const basic_string_view &s) const
173 {
174 return this->substr(pos1, n1).compare(s);
175 }
176
177 constexpr int compare(
178 size_type pos1,
179 size_type n1,
180 const basic_string_view &s,
181 size_type pos2,
182 size_type n2) const
183 {
184 return this->substr(pos1, n1).compare(s.substr(pos2, n2));
185 }
186
187 constexpr int compare(const CharT *s) const noexcept { return this->compare(basic_string_view{s}); }
188
189 constexpr int compare(size_type pos1, size_type n1, const CharT *s) const
190 {
191 return this->substr(pos1, n1).compare(basic_string_view{s});
192 }
193
194 constexpr int compare(size_type pos1, size_type n1, const CharT *s, size_type n2) const noexcept(false)
195 {
196 return this->substr(pos1, n1).compare(basic_string_view(s, n2));
197 }
198
199 constexpr bool starts_with(const basic_string_view &other) const noexcept
200 {
201 return this->substr(0, other.size()) == other;
202 }
203
204 constexpr bool starts_with(CharT c) const noexcept
205 {
206 return !this->empty() && traits_type::eq(this->front(), c);
207 }
208
209 constexpr bool starts_with(const CharT *s) const noexcept
210 {
211 return this->starts_with(basic_string_view(s));
212 }
213
214 constexpr bool ends_with(const basic_string_view &other) const noexcept
215 {
216 return this->m_size >= other.m_size && this->compare(this->m_size - other.m_size, npos, other) == 0;
217 }
218
219 constexpr bool ends_with(CharT c) const noexcept
220 {
221 return !this->empty() && traits_type::eq(this->back(), c);
222 }
223
224 constexpr bool ends_with(const CharT *s) const noexcept { return this->ends_with(basic_string_view(s)); }
225
226 // find utilities
227 constexpr size_type find(const basic_string_view &s, size_type pos = 0) const noexcept
228 {
229 return this->find(s.m_data, pos, s.m_size);
230 }
231
232 size_type find(CharT c, size_type pos = 0) const noexcept
233 {
234 if (pos >= m_size)
235 {
236 return npos;
237 }
238 const CharT *r = Traits::find(m_data + pos, m_size - pos, c);
239 if (r == nullptr)
240 {
241 return npos;
242 }
243 return static_cast<size_type>(r - m_data);
244 }
245
246 size_type find(const CharT *s, size_type pos, size_type n) const noexcept
247 {
248 if (n && !s)
249 {
250 return npos;
251 }
252
253 if (pos > m_size)
254 {
255 return npos;
256 }
257
258 if (n == 0)
259 {
260 return pos;
261 }
262
263 const CharT *r = _s_search_substr(m_data + pos, m_data + m_size, s, s + n);
264
265 if (r == m_data + m_size)
266 {
267 return npos;
268 }
269 return static_cast<size_type>(r - m_data);
270 }
271
272 constexpr size_type find(const CharT *s, size_type pos = 0) const noexcept
273 {
274 return this->find(s, pos, traits_type::length(s));
275 }
276
277 size_type rfind(basic_string_view s, size_type pos = npos) const noexcept
278 {
279 if (s.m_size && !s.m_data)
280 {
281 return npos;
282 }
283 return this->rfind(s.m_data, pos, s.m_size);
284 }
285
286 size_type rfind(CharT c, size_type pos = npos) const noexcept
287 {
288 if (m_size <= 0)
289 {
290 return npos;
291 }
292
293 if (pos < m_size)
294 {
295 ++pos;
296 }
297 else
298 {
299 pos = m_size;
300 }
301
302 for (const CharT *ptr = m_data + pos; ptr != m_data;)
303 {
304 if (Traits::eq(*--ptr, c))
305 {
306 return static_cast<size_type>(ptr - m_data);
307 }
308 }
309 return npos;
310 }
311
312 size_type rfind(const CharT *s, size_type pos, size_type n) const noexcept
313 {
314 if (n && !s)
315 {
316 return npos;
317 }
318
319 pos = (std::min)(pos, m_size);
320 if (n < m_size - pos)
321 {
322 pos += n;
323 }
324 else
325 {
326 pos = m_size;
327 }
328 const CharT *r = _s_find_end(m_data, m_data + pos, s, s + n);
329 if (n > 0 && r == m_data + pos)
330 {
331 return npos;
332 }
333 return static_cast<size_type>(r - m_data);
334 }
335
336 constexpr size_type rfind(const CharT *s, size_type pos = npos) const noexcept
337 {
338 return this->rfind(s, pos, traits_type::length(s));
339 }
340
341 constexpr size_type find_first_of(basic_string_view s, size_type pos = 0) const noexcept
342 {
343 return this->find_first_of(s.m_data, pos, s.m_size);
344 }
345
346 constexpr size_type find_first_of(CharT c, size_type pos = 0) const noexcept { return this->find(c, pos); }
347
348 size_type find_first_of(const CharT *s, size_type pos, size_type n) const noexcept
349 {
350 if (pos >= m_size || !n || !s)
351 {
352 return npos;
353 }
354
355 const CharT *r = _s_find_first_of_ce(m_data + pos, m_data + m_size, s, s + n);
356
357 if (r == m_data + m_size)
358 {
359 return npos;
360 }
361
362 return static_cast<size_type>(r - m_data);
363 }
364
365 constexpr size_type find_first_of(const CharT *s, size_type pos = 0) const noexcept
366 {
367 return this->find_first_of(s, pos, traits_type::length(s));
368 }
369
370 constexpr size_type find_last_of(basic_string_view s, size_type pos = npos) const noexcept
371 {
372 return this->find_last_of(s.m_data, pos, s.m_size);
373 }
374
375 constexpr size_type find_last_of(CharT c, size_type pos = npos) const noexcept
376 {
377 return this->rfind(c, pos);
378 }
379
380 size_type find_last_of(const CharT *s, size_type pos, size_type n) const noexcept
381 {
382 if (!n || s == nullptr)
383 {
384 return npos;
385 }
386
387 if (pos < m_size)
388 {
389 ++pos;
390 }
391 else
392 {
393 pos = m_size;
394 }
395
396 for (const CharT *ptr = m_data + pos; ptr != m_data;)
397 {
398 const CharT *r = Traits::find(s, n, *--ptr);
399 if (r)
400 {
401 return static_cast<size_type>(ptr - m_data);
402 }
403 }
404
405 return npos;
406 }
407
408 constexpr size_type find_last_of(const CharT *s, size_type pos = npos) const noexcept
409 {
410 return this->find_last_of(s, pos, traits_type::length(s));
411 }
412
413 size_type find_first_not_of(basic_string_view s, size_type pos = 0) const noexcept
414 {
415 if (s.m_size && !s.m_data)
416 {
417 return npos;
418 }
419 return this->find_first_not_of(s.m_data, pos, s.m_size);
420 }
421
422 size_type find_first_not_of(CharT c, size_type pos = 0) const noexcept
423 {
424 if (!m_data || pos >= m_size)
425 {
426 return npos;
427 }
428
429 const CharT *pend = m_data + m_size;
430 for (const CharT *ptr = m_data + pos; ptr != pend; ++ptr)
431 {
432 if (!Traits::eq(*ptr, c))
433 {
434 return static_cast<size_type>(ptr - m_data);
435 }
436 }
437
438 return npos;
439 }
440
441 size_type find_first_not_of(const CharT *s, size_type pos, size_type n) const noexcept
442 {
443 if (n && s == nullptr)
444 {
445 return npos;
446 }
447
448 if (m_data == nullptr || pos >= m_size)
449 {
450 return npos;
451 }
452
453 const CharT *pend = m_data + m_size;
454 for (const CharT *ptr = m_data + pos; ptr != pend; ++ptr)
455 {
456 if (Traits::find(s, n, *ptr) == 0)
457 {
458 return static_cast<size_type>(ptr - m_data);
459 }
460 }
461
462 return npos;
463 }
464
465 constexpr size_type find_first_not_of(const CharT *s, size_type pos = 0) const noexcept
466 {
467 return this->find_first_not_of(s, pos, traits_type::length(s));
468 }
469
470 size_type find_last_not_of(basic_string_view s, size_type pos = npos) const noexcept
471 {
472 if (s.m_size && !s.m_data)
473 {
474 return npos;
475 }
476 return this->find_last_not_of(s.m_data, pos, s.m_size);
477 }
478
479 size_type find_last_not_of(CharT c, size_type pos = npos) const noexcept
480 {
481 if (pos < m_size)
482 {
483 ++pos;
484 }
485 else
486 {
487 pos = m_size;
488 }
489
490 for (const CharT *ptr = m_data + pos; ptr != m_data;)
491 {
492 if (!Traits::eq(*--ptr, c))
493 {
494 return static_cast<size_type>(ptr - m_data);
495 }
496 }
497 return npos;
498 }
499
500 size_type find_last_not_of(const CharT *s, size_type pos, size_type n) const noexcept
501 {
502 if (n && !s)
503 {
504 return npos;
505 }
506
507 if (pos < m_size)
508 {
509 ++pos;
510 }
511 else
512 {
513 pos = m_size;
514 }
515
516 for (const CharT *ptr = m_data + pos; ptr != m_data;)
517 {
518 if (Traits::find(s, n, *--ptr) == 0)
519 {
520 return static_cast<size_type>(ptr - m_data);
521 }
522 }
523 return npos;
524 }
525
526 constexpr size_type find_last_not_of(const CharT *s, size_type pos = npos) const noexcept
527 {
528 return this->find_last_not_of(s, pos, traits_type::length(s));
529 }
530
531 private:
532 static int _s_compare(size_type n1, size_type n2) noexcept
533 {
534 const difference_type diff = n1 - n2;
535
536 if (diff > (std::numeric_limits<int>::max)())
537 {
538 return (std::numeric_limits<int>::max)();
539 }
540
541 if (diff < (std::numeric_limits<int>::min)())
542 {
543 return (std::numeric_limits<int>::min)();
544 }
545
546 return static_cast<int>(diff);
547 }
548
549 static const CharT *_s_search_substr(
550 const CharT *first1,
551 const CharT *last1,
552 const CharT *first2,
553 const CharT *last2)
554 {
555 const ptrdiff_t length2 = last2 - first2;
556 if (length2 == 0)
557 {
558 return first1;
559 }
560
561 ptrdiff_t length1 = last1 - first1;
562 if (length1 < length2)
563 {
564 return last1;
565 }
566
567 while (true)
568 {
569 length1 = last1 - first1;
570 if (length1 < length2)
571 {
572 return last1;
573 }
574
575 first1 = Traits::find(first1, length1 - length2 + 1, *first2);
576 if (first1 == 0)
577 {
578 return last1;
579 }
580
581 if (Traits::compare(first1, first2, length2) == 0)
582 {
583 return first1;
584 }
585
586 ++first1;
587 }
588 }
589
590 static const CharT *_s_find_end(
591 const CharT *first1,
592 const CharT *last1,
593 const CharT *first2,
594 const CharT *last2)
595 {
596 const CharT *r = last1;
597 if (first2 == last2)
598 {
599 return r;
600 }
601
602 while (true)
603 {
604 while (true)
605 {
606 if (first1 == last1)
607 {
608 return r;
609 }
610 if (Traits::eq(*first1, *first2))
611 {
612 break;
613 }
614 ++first1;
615 }
616
617 const CharT *m1 = first1;
618 const CharT *m2 = first2;
619 while (true)
620 {
621 if (++m2 == last2)
622 {
623 r = first1;
624 ++first1;
625 break;
626 }
627 if (++m1 == last1)
628 {
629 return r;
630 }
631 if (!Traits::eq(*m1, *m2))
632 {
633 ++first1;
634 break;
635 }
636 }
637 }
638 }
639
640 static const CharT *_s_find_first_of_ce(
641 const CharT *first1,
642 const CharT *last1,
643 const CharT *first2,
644 const CharT *last2)
645 {
646 for (; first1 != last1; ++first1)
647 {
648 for (const CharT *ptr = first2; ptr != last2; ++ptr)
649 {
650 if (Traits::eq(*first1, *ptr))
651 {
652 return first1;
653 }
654 }
655 }
656 return last1;
657 }
658
659 size_type m_size;
660 const CharT *m_data;
661 };
662
663 // operator ==
664 template <class CharT, class Traits>
665 bool operator==(
666 const basic_string_view<CharT, Traits> &lhs,
667 const basic_string_view<CharT, Traits> &rhs) noexcept
668 {
669 return (lhs.size() != rhs.size()) ? false : lhs.compare(rhs) == 0;
670 }
671
672 template <class CharT, class Traits>
673 bool operator==(
674 const basic_string_view<CharT, Traits> &lhs,
675 typename std::common_type<basic_string_view<CharT, Traits>>::type &rhs) noexcept
676 {
677 return (lhs.size() != rhs.size()) ? false : lhs.compare(rhs) == 0;
678 }
679
680 template <class CharT, class Traits>
681 bool operator==(
682 typename std::common_type<basic_string_view<CharT, Traits>>::type &lhs,
683 const basic_string_view<CharT, Traits> &rhs) noexcept
684 {
685 return (lhs.size() != rhs.size()) ? false : lhs.compare(rhs) == 0;
686 }
687
688 // operator !=
689 template <class CharT, class Traits>
690 bool operator!=(
691 const basic_string_view<CharT, Traits> &lhs,
692 const basic_string_view<CharT, Traits> &rhs) noexcept
693 {
694 return (lhs.size() != rhs.size()) ? true : lhs.compare(rhs) != 0;
695 }
696
697 template <class CharT, class Traits>
698 bool operator!=(
699 const basic_string_view<CharT, Traits> &lhs,
700 typename std::common_type<basic_string_view<CharT, Traits>>::type &rhs) noexcept
701 {
702 return (lhs.size() != rhs.size()) ? true : lhs.compare(rhs) != 0;
703 }
704
705 template <class CharT, class Traits>
706 bool operator!=(
707 typename std::common_type<basic_string_view<CharT, Traits>>::type &lhs,
708 const basic_string_view<CharT, Traits> &rhs) noexcept
709 {
710 return (lhs.size() != rhs.size()) ? true : lhs.compare(rhs) != 0;
711 }
712
713 // operator <
714 template <class CharT, class Traits>
715 bool operator<(
716 const basic_string_view<CharT, Traits> &lhs,
717 const basic_string_view<CharT, Traits> &rhs) noexcept
718 {
719 return lhs.compare(rhs) < 0;
720 }
721
722 template <class CharT, class Traits>
723 constexpr bool operator<(
724 const basic_string_view<CharT, Traits> &lhs,
725 typename std::common_type<basic_string_view<CharT, Traits>>::type &rhs) noexcept
726 {
727 return lhs.compare(rhs) < 0;
728 }
729
730 template <class CharT, class Traits>
731 constexpr bool operator<(
732 typename std::common_type<basic_string_view<CharT, Traits>>::type &lhs,
733 const basic_string_view<CharT, Traits> &rhs) noexcept
734 {
735 return lhs.compare(rhs) < 0;
736 }
737
738 // operator >
739 template <class CharT, class Traits>
740 constexpr bool operator>(
741 const basic_string_view<CharT, Traits> &lhs,
742 const basic_string_view<CharT, Traits> &rhs) noexcept
743 {
744 return lhs.compare(rhs) > 0;
745 }
746
747 template <class CharT, class Traits>
748 constexpr bool operator>(
749 const basic_string_view<CharT, Traits> &lhs,
750 typename std::common_type<basic_string_view<CharT, Traits>>::type &rhs) noexcept
751 {
752 return lhs.compare(rhs) > 0;
753 }
754
755 template <class CharT, class Traits>
756 constexpr bool operator>(
757 typename std::common_type<basic_string_view<CharT, Traits>>::type &lhs,
758 const basic_string_view<CharT, Traits> &rhs) noexcept
759 {
760 return lhs.compare(rhs) > 0;
761 }
762
763 // operator <=
764 template <class CharT, class Traits>
765 constexpr bool operator<=(
766 const basic_string_view<CharT, Traits> &lhs,
767 const basic_string_view<CharT, Traits> &rhs) noexcept
768 {
769 return lhs.compare(rhs) <= 0;
770 }
771
772 template <class CharT, class Traits>
773 constexpr bool operator<=(
774 const basic_string_view<CharT, Traits> &lhs,
775 typename std::common_type<basic_string_view<CharT, Traits>>::type &rhs) noexcept
776 {
777 return lhs.compare(rhs) <= 0;
778 }
779
780 template <class CharT, class Traits>
781 constexpr bool operator<=(
782 typename std::common_type<basic_string_view<CharT, Traits>>::type &lhs,
783 const basic_string_view<CharT, Traits> &rhs) noexcept
784 {
785 return lhs.compare(rhs) <= 0;
786 }
787
788 // operator >=
789 template <class CharT, class Traits>
790 constexpr bool operator>=(
791 const basic_string_view<CharT, Traits> &lhs,
792 const basic_string_view<CharT, Traits> &rhs) noexcept
793 {
794 return lhs.compare(rhs) >= 0;
795 }
796
797 template <class CharT, class Traits>
798 constexpr bool operator>=(
799 const basic_string_view<CharT, Traits> &lhs,
800 typename std::common_type<basic_string_view<CharT, Traits>>::type &rhs) noexcept
801 {
802 return lhs.compare(rhs) >= 0;
803 }
804
805 template <class CharT, class Traits>
806 constexpr bool operator>=(
807 typename std::common_type<basic_string_view<CharT, Traits>>::type &lhs,
808 const basic_string_view<CharT, Traits> &rhs) noexcept
809 {
810 return lhs.compare(rhs) >= 0;
811 }
812
813 typedef basic_string_view<char> string_view;
814 typedef basic_string_view<char16_t> u16string_view;
815 typedef basic_string_view<char32_t> u32string_view;
816 typedef basic_string_view<wchar_t> wstring_view;
817
818 inline namespace literals
819 {
820 inline namespace string_view_literals
821 {
822 inline basic_string_view<char> operator"" _sv(const char *s, size_t length) noexcept
823 {
824 return basic_string_view<char>(s, length);
825 }
826
827 inline basic_string_view<wchar_t> operator"" _sv(const wchar_t *s, size_t length) noexcept
828 {
829 return basic_string_view<wchar_t>(s, length);
830 }
831
832 inline basic_string_view<char16_t> operator"" _sv(const char16_t *s, size_t length) noexcept
833 {
834 return basic_string_view<char16_t>(s, length);
835 }
836
837 inline basic_string_view<char32_t> operator"" _sv(const char32_t *s, size_t length) noexcept
838 {
839 return basic_string_view<char32_t>(s, length);
840 }
841 } // namespace string_view_literals
842
843 } // namespace literals
844
845 using StringView = string_view;
846 } // namespace Crt
847} // namespace Aws
848
849// hash
850 namespace std
851{
852 template <class CharT, class Traits> struct hash<Aws::Crt::basic_string_view<CharT, Traits>>
853 {
854 size_t operator()(const Aws::Crt::basic_string_view<CharT, Traits> &val) const noexcept;
855 };
856
857 template <class CharT, class Traits>
858 size_t hash<Aws::Crt::basic_string_view<CharT, Traits>>::operator()(
859 const Aws::Crt::basic_string_view<CharT, Traits> &val) const noexcept
860 {
861 auto str = std::basic_string<CharT, Traits>(val.data(), val.size());
862 return std::hash<std::basic_string<CharT, Traits>>()(str);
863 }
864} // namespace std
Aws::Crt::basic_string_view
Definition: StringView.h:32
Aws::Crt::basic_string_view::begin
constexpr const_iterator begin() const noexcept
Definition: StringView.h:76
Aws::Crt::basic_string_view::find
constexpr size_type find(const CharT *s, size_type pos=0) const noexcept
Definition: StringView.h:272
Aws::Crt::basic_string_view::rfind
constexpr size_type rfind(const CharT *s, size_type pos=npos) const noexcept
Definition: StringView.h:336
Aws::Crt::basic_string_view::find
size_type find(CharT c, size_type pos=0) const noexcept
Definition: StringView.h:232
Aws::Crt::basic_string_view::find_first_not_of
size_type find_first_not_of(CharT c, size_type pos=0) const noexcept
Definition: StringView.h:422
Aws::Crt::basic_string_view::compare
constexpr int compare(size_type pos1, size_type n1, const CharT *s) const
Definition: StringView.h:189
Aws::Crt::basic_string_view::basic_string_view
constexpr basic_string_view(const basic_string_view &) noexcept=default
Aws::Crt::basic_string_view::compare
constexpr int compare(size_type pos1, size_type n1, const basic_string_view &s) const
Definition: StringView.h:172
Aws::Crt::basic_string_view::compare
constexpr int compare(size_type pos1, size_type n1, const CharT *s, size_type n2) const noexcept(false)
Definition: StringView.h:194
Aws::Crt::basic_string_view::end
constexpr const_iterator end() const noexcept
Definition: StringView.h:78
Aws::Crt::basic_string_view::pointer
value_type * pointer
Definition: StringView.h:37
Aws::Crt::basic_string_view::traits_type
Traits traits_type
Definition: StringView.h:35
Aws::Crt::basic_string_view::basic_string_view
constexpr basic_string_view(const CharT *s, size_type length) noexcept
Definition: StringView.h:57
Aws::Crt::basic_string_view::remove_suffix
void remove_suffix(size_type n) noexcept
Definition: StringView.h:136
Aws::Crt::basic_string_view::find
constexpr size_type find(const basic_string_view &s, size_type pos=0) const noexcept
Definition: StringView.h:227
Aws::Crt::basic_string_view::find_first_of
constexpr size_type find_first_of(basic_string_view s, size_type pos=0) const noexcept
Definition: StringView.h:341
Aws::Crt::basic_string_view::cbegin
constexpr const_iterator cbegin() const noexcept
Definition: StringView.h:80
Aws::Crt::basic_string_view::front
const_reference front() const noexcept
Definition: StringView.h:114
Aws::Crt::basic_string_view::copy
size_type copy(CharT *s, size_type n, size_type pos=0) const
Definition: StringView.h:146
Aws::Crt::basic_string_view::rend
constexpr const_reverse_iterator rend() const noexcept
Definition: StringView.h:86
Aws::Crt::basic_string_view::find_last_of
size_type find_last_of(const CharT *s, size_type pos, size_type n) const noexcept
Definition: StringView.h:380
Aws::Crt::basic_string_view::operator[]
const_reference operator[](size_type pos) const noexcept
Definition: StringView.h:102
Aws::Crt::basic_string_view::find_last_of
constexpr size_type find_last_of(basic_string_view s, size_type pos=npos) const noexcept
Definition: StringView.h:370
Aws::Crt::basic_string_view::crbegin
constexpr const_reverse_iterator crbegin() const noexcept
Definition: StringView.h:88
Aws::Crt::basic_string_view::difference_type
ptrdiff_t difference_type
Definition: StringView.h:46
Aws::Crt::basic_string_view::size_type
size_t size_type
Definition: StringView.h:45
Aws::Crt::basic_string_view::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: StringView.h:43
Aws::Crt::basic_string_view::crend
constexpr const_reverse_iterator crend() const noexcept
Definition: StringView.h:90
Aws::Crt::basic_string_view::ends_with
constexpr bool ends_with(const CharT *s) const noexcept
Definition: StringView.h:224
Aws::Crt::basic_string_view::reference
value_type & reference
Definition: StringView.h:39
Aws::Crt::basic_string_view::find_first_not_of
size_type find_first_not_of(const CharT *s, size_type pos, size_type n) const noexcept
Definition: StringView.h:441
Aws::Crt::basic_string_view::rfind
size_type rfind(const CharT *s, size_type pos, size_type n) const noexcept
Definition: StringView.h:312
Aws::Crt::basic_string_view::find_first_not_of
constexpr size_type find_first_not_of(const CharT *s, size_type pos=0) const noexcept
Definition: StringView.h:465
Aws::Crt::basic_string_view::cend
constexpr const_iterator cend() const noexcept
Definition: StringView.h:82
Aws::Crt::basic_string_view::at
const_reference at(size_type pos) const
Definition: StringView.h:108
Aws::Crt::basic_string_view::npos
static constexpr size_type npos
Definition: StringView.h:47
Aws::Crt::basic_string_view::empty
constexpr bool empty() const noexcept
Definition: StringView.h:98
Aws::Crt::basic_string_view::size
constexpr size_type size() const noexcept
Definition: StringView.h:92
Aws::Crt::basic_string_view::basic_string_view
constexpr basic_string_view(const CharT *s) noexcept
Definition: StringView.h:55
Aws::Crt::basic_string_view::reverse_iterator
const_reverse_iterator reverse_iterator
Definition: StringView.h:44
Aws::Crt::basic_string_view::find_last_not_of
size_type find_last_not_of(CharT c, size_type pos=npos) const noexcept
Definition: StringView.h:479
Aws::Crt::basic_string_view::operator=
basic_string_view & operator=(const basic_string_view &) noexcept=default
Aws::Crt::basic_string_view::ends_with
constexpr bool ends_with(const basic_string_view &other) const noexcept
Definition: StringView.h:214
Aws::Crt::basic_string_view::starts_with
constexpr bool starts_with(const CharT *s) const noexcept
Definition: StringView.h:209
Aws::Crt::basic_string_view::find
size_type find(const CharT *s, size_type pos, size_type n) const noexcept
Definition: StringView.h:246
Aws::Crt::basic_string_view::find_last_not_of
size_type find_last_not_of(const CharT *s, size_type pos, size_type n) const noexcept
Definition: StringView.h:500
Aws::Crt::basic_string_view::remove_prefix
void remove_prefix(size_type n) noexcept
Definition: StringView.h:129
Aws::Crt::basic_string_view::find_last_not_of
size_type find_last_not_of(basic_string_view s, size_type pos=npos) const noexcept
Definition: StringView.h:470
Aws::Crt::basic_string_view::find_first_not_of
size_type find_first_not_of(basic_string_view s, size_type pos=0) const noexcept
Definition: StringView.h:413
Aws::Crt::basic_string_view::substr
basic_string_view substr(size_type pos=0, size_type n=npos) const noexcept(false)
Definition: StringView.h:154
Aws::Crt::basic_string_view::rfind
size_type rfind(basic_string_view s, size_type pos=npos) const noexcept
Definition: StringView.h:277
Aws::Crt::basic_string_view::compare
int compare(const basic_string_view &s) const noexcept
Definition: StringView.h:161
Aws::Crt::basic_string_view::ends_with
constexpr bool ends_with(CharT c) const noexcept
Definition: StringView.h:219
Aws::Crt::basic_string_view::compare
constexpr int compare(size_type pos1, size_type n1, const basic_string_view &s, size_type pos2, size_type n2) const
Definition: StringView.h:177
Aws::Crt::basic_string_view::iterator
const_iterator iterator
Definition: StringView.h:42
Aws::Crt::basic_string_view::find_last_of
constexpr size_type find_last_of(const CharT *s, size_type pos=npos) const noexcept
Definition: StringView.h:408
Aws::Crt::basic_string_view::rbegin
constexpr const_reverse_iterator rbegin() const noexcept
Definition: StringView.h:84
Aws::Crt::basic_string_view::max_size
constexpr size_type max_size() const noexcept
Definition: StringView.h:96
Aws::Crt::basic_string_view::find_last_of
constexpr size_type find_last_of(CharT c, size_type pos=npos) const noexcept
Definition: StringView.h:375
Aws::Crt::basic_string_view::find_first_of
constexpr size_type find_first_of(const CharT *s, size_type pos=0) const noexcept
Definition: StringView.h:365
Aws::Crt::basic_string_view::rfind
size_type rfind(CharT c, size_type pos=npos) const noexcept
Definition: StringView.h:286
Aws::Crt::basic_string_view::const_reference
const value_type & const_reference
Definition: StringView.h:40
Aws::Crt::basic_string_view::starts_with
constexpr bool starts_with(CharT c) const noexcept
Definition: StringView.h:204
Aws::Crt::basic_string_view::const_pointer
const value_type * const_pointer
Definition: StringView.h:38
Aws::Crt::basic_string_view::find_last_not_of
constexpr size_type find_last_not_of(const CharT *s, size_type pos=npos) const noexcept
Definition: StringView.h:526
Aws::Crt::basic_string_view::const_iterator
const value_type * const_iterator
Definition: StringView.h:41
Aws::Crt::basic_string_view::basic_string_view
constexpr basic_string_view() noexcept
Definition: StringView.h:51
Aws::Crt::basic_string_view::value_type
CharT value_type
Definition: StringView.h:36
Aws::Crt::basic_string_view::find_first_of
constexpr size_type find_first_of(CharT c, size_type pos=0) const noexcept
Definition: StringView.h:346
Aws::Crt::basic_string_view::back
const_reference back() const noexcept
Definition: StringView.h:120
Aws::Crt::basic_string_view::data
constexpr const_pointer data() const noexcept
Definition: StringView.h:126
Aws::Crt::basic_string_view::length
constexpr size_type length() const noexcept
Definition: StringView.h:94
Aws::Crt::basic_string_view::compare
constexpr int compare(const CharT *s) const noexcept
Definition: StringView.h:187
Aws::Crt::basic_string_view::swap
void swap(basic_string_view &other) noexcept
Definition: StringView.h:138
Aws::Crt::basic_string_view::starts_with
constexpr bool starts_with(const basic_string_view &other) const noexcept
Definition: StringView.h:199
Aws::Crt::basic_string_view::find_first_of
size_type find_first_of(const CharT *s, size_type pos, size_type n) const noexcept
Definition: StringView.h:348
Aws::Crt::u32string_view
basic_string_view< char32_t > u32string_view
Definition: StringView.h:815
Aws::Crt::string_view
basic_string_view< char > string_view
Definition: StringView.h:813
Aws::Crt::operator<=
constexpr bool operator<=(const basic_string_view< CharT, Traits > &lhs, const basic_string_view< CharT, Traits > &rhs) noexcept
Definition: StringView.h:765
Aws::Crt::operator<
bool operator<(const basic_string_view< CharT, Traits > &lhs, const basic_string_view< CharT, Traits > &rhs) noexcept
Definition: StringView.h:715
Aws::Crt::operator>=
constexpr bool operator>=(const basic_string_view< CharT, Traits > &lhs, const basic_string_view< CharT, Traits > &rhs) noexcept
Definition: StringView.h:790
Aws::Crt::operator>
constexpr bool operator>(const basic_string_view< CharT, Traits > &lhs, const basic_string_view< CharT, Traits > &rhs) noexcept
Definition: StringView.h:740
Aws::Crt::wstring_view
basic_string_view< wchar_t > wstring_view
Definition: StringView.h:816
Aws::Crt::u16string_view
basic_string_view< char16_t > u16string_view
Definition: StringView.h:814
Aws::Crt::operator==
bool operator==(const basic_string_view< CharT, Traits > &lhs, const basic_string_view< CharT, Traits > &rhs) noexcept
Definition: StringView.h:665
Aws::Crt::operator!=
bool operator!=(const basic_string_view< CharT, Traits > &lhs, const basic_string_view< CharT, Traits > &rhs) noexcept
Definition: StringView.h:690
Aws
Definition: Api.h:17
Aws::type
newitem type
Definition: cJSON.cpp:2724
Aws::length
char const int length
Definition: cJSON.h:181
Aws::n
cJSON * n
Definition: cJSON.cpp:2560
Aws::copy
copy
Definition: cJSON.cpp:432
Aws::true
return true
Definition: cJSON.cpp:2306
std
Definition: StringView.h:851