acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
string_range.h
1// Created by camilo on 2022-12-07 23:59 <3ThomasBorregaardSorensen!!
2#pragma once
3
4
5#include "const_string_range.h"
6
7
8template < typename ITERATOR_TYPE >
9class string_range :
10 //public ::comparable_range < ::comparable_eq_range < ::array_range < ::range < ITERATOR_TYPE > > > >
11 //public ::array_range < ::range < ITERATOR_TYPE > > >
12 public ::const_string_range < ITERATOR_TYPE >
13{
14public:
15
16
17 using BASE_RANGE = ::const_string_range < ITERATOR_TYPE >;
18 using RAW_CHARACTER_RANGE = typename BASE_RANGE::RAW_CHARACTER_RANGE;
19
20
21 //using BASE_RANGE = ::comparable_range < ::comparable_eq_range < ::array_range < ::range < ITERATOR_TYPE > > > >;
22
23 using THIS_RANGE = ::string_range < ITERATOR_TYPE >;
24
25 using STRING_RANGE = ::string_range < ITERATOR_TYPE >;
26
27 using STRING_BASE = ::string_base < ITERATOR_TYPE >;
28
29 using ITEM_POINTER = get_type_item_pointer<ITERATOR_TYPE>;
30 using ITEM = non_const<dereference<ITEM_POINTER> >;
31 using CHARACTER = ITEM;
32
33
34 using this_iterator = typename BASE_RANGE::this_iterator;
35 using iterator = typename BASE_RANGE::iterator;
36 using const_iterator = typename BASE_RANGE::const_iterator;
37
38
39 using THIS_RAW_RANGE = typename BASE_RANGE::THIS_RAW_RANGE;
40 using RAW_RANGE = typename BASE_RANGE::RAW_RANGE;
41 using CONST_RAW_RANGE = typename BASE_RANGE::CONST_RAW_RANGE;
42
43 //using ITEM_POINTER = typename get_type_item_pointer < this_iterator >::type;
44
45 //using ITEM = non_const < dereference < ITEM_POINTER > >;
46
47 using SCOPED_STRING = scoped_string_base<ITERATOR_TYPE>;
48
49
50 using ARG_ITEM = typename BASE_RANGE::ARG_ITEM;
51
52
53 template<::std::size_t count>
54 constexpr string_range(const ITEM(&array)[count]) : BASE_RANGE(array, array[count - 1] == 0 ? count - 1 : count) {}
55
56 template<prototype_integral INTEGRAL>
57 constexpr string_range(const_iterator begin, INTEGRAL count) : BASE_RANGE((this_iterator)begin,
58 (this_iterator)(begin + count)) {}
59
60 string_range(no_initialize_t) : BASE_RANGE(no_initialize_t{}) {}
61
62 string_range(nullptr_t) : BASE_RANGE(nullptr) {}
63
64 string_range() {}
65
66 template<typed_range<iterator> TYPED_RANGE>
67 constexpr string_range(const TYPED_RANGE& range)
68 requires(!::std::is_same_v < TYPED_RANGE, THIS_RANGE >) :
69 BASE_RANGE(range) { }
70
71 constexpr string_range(const string_range & range) :
72 BASE_RANGE(range) { }
73
74 constexpr string_range(string_range && range) :
75 BASE_RANGE(::transfer(range)) { }
76
77 string_range(this_iterator begin, this_iterator end) : BASE_RANGE(begin, end) {}
78 string_range(this_iterator begin, this_iterator end, enum_range erange) : BASE_RANGE(begin, end, erange) {}
79
80 //explicit string_range(const ::atom & atom);
81
82 template < character_count n >
83 string_range(const CHARACTER(&s)[n]) : BASE_RANGE(s) {}
84
85
86 template < typed_character_pointer < typename ::string_range<ITERATOR_TYPE>::CHARACTER > CHARACTER_POINTER >
87 string_range(CHARACTER_POINTER start, CHARACTER_POINTER end, e_range erange) :
88 BASE_RANGE(start, end, erange) { }
89
90
91 template < prototype_block BLOCK >
92 string_range(const BLOCK & block);
93
94
95 template < character_pointer CHARACTER_POINTER >
96 string_range(CHARACTER_POINTER start) : BASE_RANGE(start, start + string_safe_length(start)) {}
97
98 //explicit string_range(ITERATOR_TYPE psz) : string_range(scopedstr, 0, string_safe_length(scopedstr)) {}
99
100 string_range(ITERATOR_TYPE psz, character_count len) : string_range(psz, 0, len) {}
101
102 //string_range(const CHARACTER * start, const CHARACTER * end) : BASE_RANGE(start, end) {}
103
104 string_range(ITERATOR_TYPE psz, character_count start, character_count count) : string_range(
105 ::_start_count_string_range(psz, start, count)) {}
106
107
108 //auto this_range() const {return *this;}
109
110 //auto subrange(character_count start, character_count count) const { auto range = *this; ::_start_count_range(range, start, count); return range; }
111
112 using BASE_RANGE::last;
113 auto & last() { return ::get(this->end() - 1); }
114 // auto & last() const { return (const CHARACTER &) ::get(this->end() - 1); }
115
116
117 // THIS_RANGE operator()(character_count start, character_count count) const {
118 //
119 // return ::_start_count_range(*this, start, count);
120 //
121 // }
122 //
123 // THIS_RANGE operator()(character_count start, const_iterator end) const {
124 //
125 // return ::_start_end_range(*this, start, end);
126 //
127 // }
128 //
129 //
130 // THIS_RANGE operator()(const_iterator start) const {
131 //
132 // return THIS_RANGE(start, this->end());
133 //
134 // }
135 //
136 //
137 // template < prototype_integral START >
138 // THIS_RANGE operator()(START start) const {
139 //
140 // return THIS_RANGE(this->begin() + start, this->end());
141 //
142 // }
143 //
144 //
145 // THIS_RANGE operator()() const {
146 //
147 // return THIS_RANGE(*this);
148 //
149 // }
150 //
151 //
152 // bool has_character() const { return !this->is_empty(); }
153
154 // inline bool is_empty() const noexcept { return this->m_end <= this->m_begin || *this->m_begin == '\0'; }
155 // inline memsize length_in_bytes() const{return this->size() * sizeof(CHARACTER);}
156 //
157 // //inline bool has_character() const noexcept { return !this->is_empty(); }
158 // inline character_count get_upper_bound(character_count i = -1) const noexcept { return this->size() + i; }
159 //
160 // operator ::block() const { return {(::u8 *) c_str(), this->length_in_bytes()}; }
161 //
162 // inline CHARACTER character_at(character_count i) const { return this->data()[i]; }
163
164 using BASE_RANGE::data;
165
166 inline CHARACTER * data() { return (CHARACTER *)this->begin(); }
167
168
169 void clear()
170 {
171 this->m_begin = nullptr;
172 this->m_end = nullptr;
173 this->m_erange = e_range_none;
174 }
175 string_range& assign(const_iterator s, const_iterator e, enum_range erange)
176 {
177 this->m_begin = s;
178 this->m_end = e;
179 this->m_erange = erange;
180 return *this;
181 }
182
183 string_range& assign(const_iterator s, const_iterator e)
184 {
185 if (s != this->m_begin)
186 {
187
188 if (e != this->m_end)
189 {
190
191 this->m_erange = e_range_none;
192
193 }
194 // else
195 // {
196 //
197 // this->m_erange =(enum_range) ( this->m_erange & ~e_range_string);
198 //}
199
200 }
201 // else if(e != this->m_end)
202 // {
203 // this->m_erange = (enum_range)(this->m_erange & ~e_range_null_terminated);
204 //
205 // }
206 this->m_begin = s;
207 this->m_end = e;
208 return *this;
209 }
210 template < prototype_integral INTEGRAL >
211 string_range& assign(const_iterator s, INTEGRAL n)
212 {
213
214 return assign(s, s + n);
215
216 }
217 // inline const CHARACTER *data() const { return this->begin(); }
218 //
219 // inline const CHARACTER *c_str() const { return this->data(); }
220 //
221 // inline const CHARACTER *c_str_for_printf() const { return this->data(); }
222 //
223 // inline operator const CHARACTER *() const { return this->data(); }
224 // using BASE_RANGE::operator CHARACTER *;
225 inline operator CHARACTER * () { return this->data(); }
226
227 //using BASE_RANGE::ptr_at;
228 //inline const CHARACTER * ptr_at(::collection::index i) { return this->data() + i; }
229
230 // inline const CHARACTER *ptr_at(::collection::index i) const { return this->data() + i; }
231
232 //using BASE_RANGE::rear_ptr;
233 //inline const CHARACTER * rear_ptr(::collection::index i) { return this->data() + this->size() + i; }
234
235 // inline const CHARACTER *reverse_ptr(::collection::index i) const { return this->data() + this->size() + i; }
236 //
237 // inline const CHARACTER &operator[](::collection::index i) const { return this->data()[i]; }
238 //
239 // character_count offset_of(const CHARACTER *p) const { return ::offset_of(p, data()); }
240
241
242
243 string_range &operator =(const string_range & range)
244 {
245 BASE_RANGE::operator=(range);
246 return *this;
247 }
248
249 template < prototype_range SOME_RANGE >
250 string_range &operator=(SOME_RANGE && range) requires
251 (sizeof(typename SOME_RANGE::ITEM) == sizeof(ITEM))
252 {
253
254 auto pbasedataOld = this->m_pbasedata;
255
256 BASE_RANGE::operator=(range);
257
258 if (pbasedataOld)
259 {
260
261 ::base_data_defer_release(pbasedataOld);
262
263 }
264
265 // if (range.m_erange & e_range_string)
266 // {
267 //
268 // ((STRING_BASE*)&range)->__destroy();
269 //
270 // }
271
272 range.m_begin = nullptr;
273
274 range.m_end = nullptr;
275
276 range.m_erange = e_range_none;
277
278 range.m_pbasedata = nullptr;
279
280 return *this;
281
282 }
283
284
285 // string_range & operator=(const THIS_RANGE & range)
286 // {
287 // BASE_RANGE::operator=(range);
288 // return *this;
289 // }
290 //
291 // string_range & operator=(string_range && range) {
292 // BASE_RANGE::operator=(::transfer(range));
293 // return *this;
294 // }
295 //
296 // //string_range & operator=(const atom & atom);
297 //
298 // string_range & operator=(const block & block);
299
300
301
302 // //::std::strong_ordering order(const string_range &range) const noexcept;
303 // //using NATURAL_POINTER::order;
304 //
305 // //::std::strong_ordering order(const SCOPED_STRING &range) const noexcept;
306 // ::std::strong_ordering case_insensitive_order(const SCOPED_STRING &range) const noexcept;
307 //
308 // ::std::strong_ordering collate(const SCOPED_STRING &range) const noexcept;
309 //
310 // ::std::strong_ordering case_insensitive_collate(const SCOPED_STRING &range) const noexcept;
311 //
312 // //::std::strong_ordering order(const SCOPED_STRING &range, character_count n) const noexcept;
313 //
314 // //::std::strong_ordering case_insensitive_order(const SCOPED_STRING &range, character_count n) const noexcept;
315 //
316 // //::std::strong_ordering collate(const SCOPED_STRING &range, character_count n) const noexcept;
317 //
318 // //::std::strong_ordering case_insensitive_collate(const SCOPED_STRING &range, character_count n) const noexcept;
319 //
320 // //::std::strong_ordering order(character_count start, character_count count, const SCOPED_STRING &range) const noexcept;
321 //
322 // //::std::strong_ordering case_insensitive_order(character_count start, character_count count, const SCOPED_STRING &range) const noexcept;
323 //
324 // //::std::strong_ordering collate(character_count start, character_count count, const SCOPED_STRING &range) const noexcept;
325 //
326 // //::std::strong_ordering
327 // //case_insensitive_collate(character_count start, character_count count, const SCOPED_STRING &range) const noexcept;
328 //
329 // //::std::strong_ordering
330 // //order(character_count start, character_count count, const SCOPED_STRING &range, character_count iStart2, character_count iCount2) const noexcept;
331 //
332 // //::std::strong_ordering
333 // //case_insensitive_order(character_count start, character_count count, const SCOPED_STRING &range, character_count iStart2,
334 // // character_count iCount2) const noexcept;
335 //
336 // //::std::strong_ordering
337 // //collate(character_count start, character_count count, const SCOPED_STRING &range, character_count iStart2, character_count iCount2) const noexcept;
338 //
339 // //::std::strong_ordering
340 // //case_insensitive_collate(character_count start, character_count count, const SCOPED_STRING &range, character_count iStart2,
341 // // character_count iCount2) const noexcept;
342 //
343 // //inline ::i32 operator<=>(const string_range &range) const { return order(range); }
344 // //inline bool operator==(const string_range &range) const { return size() != range.size() ? false : !order(range); }
345 // //inline bool operator>(const string_range &range) const { return order(ansistr) > 0; }
346 // //inline bool operator<(const string_range &range) const { return order(ansistr) < 0; }
347 // //inline bool operator!=(const string_range &range) const { return !operator ==(ansistr); }
348 // //inline bool operator>=(const string_range &range) const { return !operator <(ansistr); }
349 // //inline bool operator<=(const string_range &range) const { return !operator >(ansistr); }
350 //
351 //
352 // //inline bool operator==(const string_range &range) const { return order(ansistr) == 0; }
353 // //inline bool operator>(const string_range &range) const { return order(ansistr) > 0; }
354 // //inline bool operator<(const string_range &range) const { return order(ansistr) < 0; }
355 // //inline bool operator!=(const string_range &range) const { return !operator ==(ansistr); }
356 // //inline bool operator>=(const string_range &range) const { return !operator <(ansistr); }
357 // //inline bool operator<=(const string_range &range) const { return !operator >(ansistr); }
358 //
359 // inline bool operator==(const THIS_RANGE &range) const { return this->equals(range); }
360 // //inline ::std::strong_ordering operator<=>(const SCOPED_STRING &range) const { return this->order(range); }
361 //
362 //
363 //
364 //
365 // using BASE_RANGE::_order;
366 //
367 // constexpr ::std::strong_ordering _order(const SCOPED_STRING &range) const {
368 //
369 // return _order(range, ::comparison::comparison<ITEM>());
370 //
371 // }
372 //
373 //
374 // using BASE_RANGE::order;
375 //
376 // constexpr ::std::strong_ordering order(const SCOPED_STRING &range) const noexcept;
377 //
378 //
379 // constexpr ::std::strong_ordering operator<=>(const SCOPED_STRING &range) const {
380 //
381 // return this->order(range);
382 //
383 // }
384 //
385 //
386 // using BASE_RANGE::_equals;
387 //
388 // constexpr bool _equals(const SCOPED_STRING &range) const {
389 //
390 // return this->_equals(range, ::comparison::comparison<ITEM>());
391 //
392 // }
393 //
394 //
395 // using BASE_RANGE::equals;
396 //
397 // constexpr bool equals(const SCOPED_STRING &range) const {
398 //
399 // return this->equals(range, ::comparison::comparison<ITEM>());
400 //
401 // }
402 //
403 // constexpr bool case_insensitive_equals(const SCOPED_STRING &range) const noexcept {
404 //
405 // return this->equals(range, ::comparison::case_insensitive<ITEM>());
406 //
407 // }
408 //
409 // //bool equals(const SCOPED_STRING &range, character_count n) const noexcept {
410 //
411 // // return this->equals_start_count(range, 0, n, ::comparison::comparison<ITEM>());
412 //
413 // //}
414 //
415 // //bool case_insensitive_equals(const SCOPED_STRING &range, character_count n) const noexcept {
416 //
417 // // return this->equals_start_count(range, 0, n, ::comparison::case_insensitive<ITEM>());
418 //
419 // //}
420 //
421 // //bool equals(character_count start, character_count count, const SCOPED_STRING &range) const noexcept {
422 //
423 // // return this->equals_start_count(range, start, count, ::comparison::comparison<ITEM>());
424 //
425 // //}
426 //
427 // //bool case_insensitive_equals(character_count start, character_count count, const SCOPED_STRING &range) const noexcept {
428 //
429 // // return this->equals_start_count(range, start, count, ::comparison::case_insensitive<ITEM>());
430 //
431 // //}
432 //
433 // //bool
434 // //equals(character_count start, character_count count, const SCOPED_STRING &range, character_count iStart2, character_count iCount2) const noexcept {
435 //
436 // // return this->equals_start_count(range.start_count(iStart2, iCount2), start, count,
437 // // ::comparison::comparison<ITEM>());
438 //
439 // //}
440 //
441 // //bool case_insensitive_equals(character_count start, character_count count, const SCOPED_STRING &range, character_count iStart2,
442 // // character_count iCount2) const noexcept {
443 //
444 // // return this->equals_start_count(range.start_count(iStart2, iCount2), start, count,
445 // // ::comparison::case_insensitive<ITEM>());
446 //
447 // //}
448 //
449 //
450 //
490 //
491 // using BASE_RANGE::_find;
492 //
493 // constexpr const_iterator _find(const SCOPED_STRING &range) const {
494 //
495 // return this->_find(range, ::comparison::comparison<ITEM>());
496 //
497 // }
498 //
499 //
500 // using BASE_RANGE::find;
501 //
502 // constexpr const_iterator find(const SCOPED_STRING &range) const {
503 //
504 // return this->find(range, ::comparison::comparison<ITEM>());
505 //
506 // }
507 // constexpr character_count find_index(const SCOPED_STRING & range, character_count start = 0) const {
508 //
509 // return this->offset_of(start <= 0 ? this->find(range) : (*this)(start).find(range));
510 //
511 // }
512 // constexpr character_count find_index(CHARACTER ch, character_count start = 0) const {
513 //
514 // return this->offset_of(start <= 0 ? this->find(ch) : (*this)(start).find(ch));
515 //
516 // }
517 //
518 //
557 //
558 //
559 // using BASE_RANGE::_rear_find;
560 //
561 // constexpr const_iterator _rear_find(const SCOPED_STRING &range, const_iterator end = nullptr) const
562 // {
563 //
564 // return (*this)(0, ::is_null(end) ? this->end() : end)._rear_find(range, ::comparison::comparison<ITEM>());
565 //
566 // }
567 //
568 //
569 // using BASE_RANGE::rear_find;
570 //
571 // constexpr const_iterator rear_find(const SCOPED_STRING &range, const_iterator end = nullptr) const
572 // {
573 //
574 // return (*this)(0, ::is_null(end) ? this->end() : end).rear_find(range, ::comparison::comparison<ITEM>());
575 //
576 // }
577 //
578 // constexpr character_count _rear_find_index(const SCOPED_STRING & range, character_count end = -1) const
579 // {
580 //
581 // return this->offset_of((*this)(0, end >= 0 ? end : this->size() + end + 1)._rear_find(range));
582 //
583 // }
584 //
585 //
586 // constexpr character_count rear_find_index(const SCOPED_STRING & range, character_count end = -1) const
587 // {
588 //
589 // return this->offset_of((*this)(0, end >= 0 ? end : this->size() + end + 1).rear_find(range));
590 //
591 // }
592 //
593 //
594 // constexpr const_iterator _rear_find(CHARACTER character, const_iterator end = nullptr) const
595 // {
596 //
597 // return (*this)(0, ::is_null(end) ? this->end() : end).rear_find(character, ::comparison::comparison<ITEM>());
598 //
599 // }
600 //
601 //
602 // constexpr const_iterator rear_find(CHARACTER character, const_iterator end = nullptr) const
603 // {
604 //
605 // return (*this)(0, ::is_null(end) ? this->end() : end).rear_find(character, ::comparison::comparison<ITEM>());
606 //
607 // }
608 //
609 //
610 // constexpr character_count _rear_find_index(CHARACTER character, character_count end = -1) const
611 // {
612 //
613 // return this->offset_of((*this)(0, end >= 0 ? end : this->size() + end + 1)._rear_find(character));
614 //
615 // }
616 //
617 //
618 // constexpr character_count rear_find_index(CHARACTER character, character_count end = -1) const
619 // {
620 //
621 // return this->offset_of((*this)(0, end >= 0 ? end : this->size() + end + 1).rear_find(character));
622 //
623 // }
624 //
625 //
626 // const_iterator case_insensitive_find(const SCOPED_STRING & scopedstr) const RELEASENOTHROW
627 // {
628 //
629 // return this->find(scopedstr, ::comparison::case_insensitive<ITEM>());
630 //
631 // }
632 //
633 //
634 // character_count case_insensitive_find_index(const SCOPED_STRING & scopedstr) const RELEASENOTHROW
635 // {
636 //
637 // return this->offset_of(case_insensitive_find(scopedstr));
638 //
639 // }
640 //
641 //
642 // character_count case_insensitive_find_index(const SCOPED_STRING & scopedstr, character_count start) const RELEASENOTHROW { return this->offset_of((*this)(start).case_insensitive_find(scopedstr)); }
643 //
644 //
645 // constexpr const_iterator _case_insensitive_rear_find(const SCOPED_STRING & scopedstr) const
646 // {
647 //
648 // return this->_rear_find(scopedstr, ::comparison::case_insensitive<ITEM>());
649 //
650 // }
651 //
652 //
653 // character_count _case_insensitive_rear_find_index(const SCOPED_STRING & scopedstr, character_count end = -1) const RELEASENOTHROW
654 // {
655 //
656 // return this->offset_of((*this)(0, end >= 0 ? end : this->size() + end + 1)._case_insensitive_rear_find(scopedstr));
657 //
658 // }
659 //
660 //
661 // constexpr const_iterator case_insensitive_rear_find(const SCOPED_STRING & scopedstr) const
662 // {
663 //
664 // return this->rear_find(scopedstr, ::comparison::case_insensitive<ITEM>());
665 //
666 // }
667 //
668 //
669 // character_count case_insensitive_rear_find_index(const SCOPED_STRING & scopedstr, character_count end = -1) const RELEASENOTHROW
670 // {
671 //
672 //
673 // return this->offset_of((*this)(0, end >= 0 ? end : this->size() + end + 1).case_insensitive_rear_find(scopedstr));
674 //
675 // }
676 //
677 //
716 //
717 //
718 // using BASE_RANGE::_find_first_character_in;
719 //
720 // constexpr const_iterator _find_first_character_in(const SCOPED_STRING &range) const {
721 //
722 // return this->_find_first_character_in(range, ::comparison::comparison<ITEM>());
723 //
724 // }
725 //
726 // constexpr character_count _find_first_character_in_index(const SCOPED_STRING & range) const {
727 // return this->offset_of(_find_first_character_in(range));
728 // }
729 //
730 // using BASE_RANGE::find_first_character_in;
731 //
732 // constexpr const_iterator find_first_character_in(const SCOPED_STRING &range) const {
733 //
734 // return this->find_first_character_in(range, ::comparison::comparison<ITEM>());
735 //
736 // }
737 // constexpr character_count find_first_character_in_index(const SCOPED_STRING & range, ::character_count start = 0) const {
738 // return this->offset_of((*this)(start).find_first_character_in(range));
739 // }
740 //
741 //
742 // // Convert the string_base < ITERATOR_TYPE > to lowercase
743 // //template < typename ITERATOR_TYPE >
744 // string_base < ITERATOR_TYPE > lowered() const;
745 //
746 //
785 //
786 //
787 //
788 // using BASE_RANGE::_skip_any_character_in;
789 //
790 // constexpr const_iterator skip_any_character_in(const SCOPED_STRING &range) const {
791 //
792 // return this->_skip_any_character_in(range, ::comparison::comparison<ITEM>());
793 //
794 // }
795 //
796 //
797 // constexpr character_count skip_any_character_in_index(const SCOPED_STRING & range, ::character_count start = 0) const {
798 // return this->offset_of((*this)(start).skip_any_character_in(range));
799 // }
800 //
801 //
802 // using BASE_RANGE::skip_any_character_in;
803 //
809 //
810 //
849 //
850 //
851 // using BASE_RANGE::_rear_skip_any_character_in;
852 //
853 // constexpr const_iterator _rear_skip_any_character_in(const SCOPED_STRING &range) const noexcept {
854 //
855 // return this->_rear_skip_any_character_in(range, ::comparison::comparison<ITEM>());
856 //
857 // }
858 //
859 //
860 // using BASE_RANGE::rear_skip_any_character_in;
861 //
862 // constexpr const_iterator rear_skip_any_character_in(const SCOPED_STRING &range) const noexcept {
863 //
864 // return this->rear_skip_any_character_in(range, ::comparison::comparison<ITEM>());
865 //
866 // }
867 //
868 //
897 //
898 // using BASE_RANGE::_skip;
899 //
900 // constexpr const_iterator _skip(CHARACTER item) const {
901 //
902 // return this->_skip(item, ::comparison::comparison<ITEM>());
903 //
904 // }
905 //
906 //
907 // using BASE_RANGE::skip;
908 //
909 // constexpr const_iterator skip(CHARACTER item) const {
910 //
911 // return this->skip(item, ::comparison::comparison<ITEM>());
912 //
913 // }
914 //
915 //
954 //
955 //
956 //
957 //
958 // //using BASE_RANGE::_rear_find;
959 //
960 // //constexpr const_iterator _rear_find(ARG_ITEM item) const {
961 //
962 // // return this->_rear_find(item, ::comparison::comparison<ITEM>());
963 //
964 // //}
965 //
966 //
967 // //using BASE_RANGE::rear_find;
968 //
969 // //constexpr const_iterator rear_find(ARG_ITEM item) const {
970 //
971 // // return this->rear_find(item, ::comparison::comparison<ITEM>());
972 //
973 // //}
974 //
975 // //constexpr character_count _rear_find_index(ARG_ITEM item) const {
976 //
977 // // return this->offset_of(this->_rear_find(item));
978 //
979 // //}
980 //
981 //
982 // //constexpr character_count rear_find_index(ARG_ITEM item) const {
983 //
984 // // return this->offset_of(this->rear_find(item));
985 //
986 // //}
987 //
988 //
1027 //
1028 //
1029 //
1030 // using BASE_RANGE::_rear_find_first_character_in;
1031 //
1032 // constexpr const_iterator _rear_find_first_character_in(const SCOPED_STRING &range) const noexcept {
1033 //
1034 // return this->_rear_find_first_character_in(range, ::comparison::comparison<ITEM>());
1035 //
1036 // }
1037 //
1038 //
1039 // using BASE_RANGE::rear_find_first_character_in;
1040 //
1041 // constexpr const_iterator rear_find_first_character_in(const SCOPED_STRING &range) const noexcept {
1042 //
1043 // return this->rear_find_first_character_in(range, ::comparison::comparison<ITEM>());
1044 //
1045 // }
1046 //
1047 //
1076 //
1077 //
1078 // using BASE_RANGE::_begins;
1079 //
1080 // constexpr bool _begins(const SCOPED_STRING &range) const {
1081 //
1082 // return this->_begins(range, ::comparison::comparison<ITEM>());
1083 //
1084 // }
1085 //
1086 //
1087 // using BASE_RANGE::begins;
1088 //
1089 // constexpr bool begins(const SCOPED_STRING &range) const {
1090 //
1091 // return this->begins(range, ::comparison::comparison<ITEM>());
1092 //
1093 // }
1094 //
1095 //
1096 // ::collection::count begins_count(bool(*character_is_function)(CHARACTER character))
1097 // {
1098 //
1099 // ::collection::count c = 0;
1100 //
1101 // while (character_is_function(this->begin()[c])) c++;
1102 //
1103 // return c;
1104 //
1105 // }
1106
1107
1108
1109
1110 // using BASE_RANGE::_begins_start;
1111 //
1112 // constexpr bool _begins_start(const SCOPED_STRING & range, memsize start) const
1113 // {
1114 //
1115 // return this->_begins_start(range, start, ::comparison::comparison < ITEM >());
1116 //
1117 // }
1118 //
1119 //
1120 // using BASE_RANGE::begins_start;
1121 //
1122 // constexpr bool begins_start(const SCOPED_STRING & range, memsize start) const
1123 // {
1124 //
1125 // return this->begins_start(range, start, ::comparison::comparison < ITEM >());
1126 //
1127 // }
1128 //
1129 //
1130 // using BASE_RANGE::_begins_start_count;
1131 //
1132 // constexpr bool _begins_start_count(const SCOPED_STRING & range, memsize start, memsize count) const
1133 // {
1134 //
1135 // return this->_begins_start_count(range, start, count, ::comparison::comparison < ITEM >());
1136 //
1137 // }
1138 //
1139 //
1140 // using BASE_RANGE::begins_start_count;
1141 //
1142 // constexpr bool begins_start_count(const SCOPED_STRING & range, memsize start, memsize count) const
1143 // {
1144 //
1145 // return this->begins_start_count(range, start, count, ::comparison::comparison < ITEM >());
1146 //
1147 // }
1148
1149
1150
1151 // using BASE_RANGE::_ends;
1152 //
1153 // constexpr bool _ends(const SCOPED_STRING &range) const {
1154 //
1155 // return this->_ends(range, ::comparison::comparison<ITEM>());
1156 //
1157 // }
1158 //
1159 //
1160 // using BASE_RANGE::ends;
1161 //
1162 // constexpr bool ends(const SCOPED_STRING &range) const {
1163 //
1164 // return this->ends(range, ::comparison::comparison<ITEM>());
1165 //
1166 // }
1167
1168
1169 // using BASE_RANGE::_ends_start;
1170 //
1171 // constexpr bool _ends_start(const SCOPED_STRING & range, memsize start) const
1172 // {
1173 //
1174 // return this->_ends_start(range, start, ::comparison::comparison < ITEM >());
1175 //
1176 // }
1177 //
1178 //
1179 // using BASE_RANGE::ends_start;
1180 //
1181 // constexpr bool ends_start(const SCOPED_STRING & range, memsize start) const
1182 // {
1183 //
1184 // return this->ends_start(range, start, ::comparison::comparison < ITEM >());
1185 //
1186 // }
1187 //
1188 //
1189 // using BASE_RANGE::_ends_start_count;
1190 //
1191 // constexpr bool _ends_start_count(const SCOPED_STRING & range, memsize start, memsize count) const
1192 // {
1193 //
1194 // return this->_ends_start_count(range, start, count, ::comparison::comparison < ITEM >());
1195 //
1196 // }
1197 //
1198 //
1199 // using BASE_RANGE::ends_start_count;
1200 //
1201 // constexpr bool ends_start_count(const SCOPED_STRING & range, memsize start, memsize count) const
1202 // {
1203 //
1204 // return this->ends_start_count(range, start, count, ::comparison::comparison < ITEM >());
1205 //
1206 // }
1207
1208
1209 //
1210 //
1211 // template<typename PRED>
1212 // bool is_every_char(PRED pred) {
1213 //
1214 // for (::collection::index i = 0; i < this->length(); i++) {
1215 //
1216 // if (!pred(this->operator[](i))) {
1217 //
1218 // return false;
1219 //
1220 // }
1221 //
1222 // }
1223 //
1224 // return true;
1225 //
1226 // }
1227 //
1228 //
1229 // template<typename NUMBER>
1230 // NUMBER &translate_index(NUMBER &number) {
1231 //
1232 // if (number < 0) {
1233 //
1234 // number += this->size() + 1;
1235 //
1236 // if (number < 0) {
1237 //
1238 // number = 0;
1239 //
1240 // }
1241 //
1242 // } else if (number > this->size()) {
1243 //
1244 // number = this->size();
1245 //
1246 // }
1247 //
1248 // return number;
1249 //
1250 // }
1251
1252 //
1253 // //inline bool contains(CHARACTER ch = 0) const;
1254 // inline bool contains(const SCOPED_STRING &scopedstr = 0) const;
1255 //
1256 // //inline bool contains(const string_base &str = 0) const;
1257 // inline bool contains(CHARACTER ch) const { return ::is_set(find(ch)); }
1258 //
1259 // inline bool
1260 // contains(const SCOPED_STRING &scopedstr, const CHARACTER **ppszBeg, const CHARACTER **ppszEnd = nullptr) const;
1261 // //inline bool contains(const string_base &str, const CHARACTER ** ppszBeg, const CHARACTER ** ppszEnd = nullptr) const;
1262 //
1263 // template<prototype_array STRING_ARRAY>
1264 // inline bool contains_any(const STRING_ARRAY &stra) const;
1265 //
1266 // template<prototype_array STRING_ARRAY>
1267 // inline bool contains_all(const STRING_ARRAY &stra) const;
1268 //
1269 // //inline bool case_insensitive_contains(CHARACTER ch = 0) const;
1270 // inline bool case_insensitive_contains(const SCOPED_STRING &scopedstr = 0) const;
1271 //
1272 // //inline bool case_insensitive_contains(const string_base &str = 0) const;
1273 // //inline bool case_insensitive_contains(CHARACTER ch, const CHARACTER ** ppszBeg) const;
1274 // inline bool
1275 // case_insensitive_contains(const SCOPED_STRING &scopedstr, const CHARACTER **ppszBeg, const CHARACTER **ppszEnd = nullptr) const;
1276 // //inline bool case_insensitive_contains(const string_base &str, const CHARACTER ** ppszBeg, const CHARACTER ** ppszEnd = nullptr) const;
1277 //
1278 // template<prototype_array STRING_ARRAY>
1279 // inline bool case_insensitive_contains_at_least_one_of(const STRING_ARRAY &stra) const;
1280 //
1281 // template<prototype_array STRING_ARRAY>
1282 // inline bool case_insensitive_contains_all(const STRING_ARRAY &stra) const;
1283 //
1284 //
1285 // //inline bool unicode_case_insensitive_contains(CHARACTER ch = 0) const;
1286 // inline bool unicode_case_insensitive_contains(const SCOPED_STRING &scopedstr = 0) const;
1287 //
1288 // //inline bool unicode_case_insensitive_contains(const string_base &str = 0) const;
1289 // //inline bool unicode_case_insensitive_contains(CHARACTER ch, const CONST_STRING_RANGE &* ppszBeg) const;
1290 // inline bool
1291 // unicode_case_insensitive_contains(const SCOPED_STRING &scopedstr, const CHARACTER **ppszBeg, const CHARACTER **ppszEnd = nullptr) const;
1292 // //inline bool unicode_case_insensitive_contains(const string_base &str, const CHARACTER ** ppszBeg, const CHARACTER ** ppszEnd = nullptr) const;
1293 //
1294 // template<prototype_array STRING_ARRAY>
1295 // inline bool unicode_case_insensitive_contains_at_least_one_of(const STRING_ARRAY &stra) const;
1296 //
1297 // template<prototype_array STRING_ARRAY>
1298 // inline bool unicode_case_insensitive_contains_all(const STRING_ARRAY &stra) const;
1299 //
1300 //
1301 // template<::comparison::equality<CHARACTER> EQUALITY>
1302 // ::collection::count _occurrence_count_of(const SCOPED_STRING &scopedstr, EQUALITY equality) {
1303 //
1304 // character_count nLen = scopedstr.size();
1305 //
1306 // character_count count = 0;
1307 //
1308 // auto range = (*this)();
1309 //
1310 // while ((range.begin(range.find(scopedstr, equality))) != nullptr) {
1311 //
1312 // count++;
1313 //
1314 // range.begin() += nLen;
1315 //
1316 // }
1317 //
1318 // return count;
1319 //
1320 // }
1321 //
1322 //
1323 // ::collection::count occurrence_count_of(const SCOPED_STRING &scopedstr = 0) {
1324 //
1325 // return _occurrence_count_of(scopedstr, ::comparison::comparison<CHARACTER>());
1326 //
1327 // }
1328 //
1329 //
1330 // ::collection::count case_insensitive_occurrence_count_of(const SCOPED_STRING &scopedstr = 0) {
1331 //
1332 // return _occurrence_count_of(scopedstr, ::comparison::case_insensitive<CHARACTER>());
1333 //
1334 // }
1335 //
1336
1337 //
1338 // // find routines
1339 //
1340 // // find the first occurrence of character 'ch', starting at index 'iStart'
1341 // const_iterator find(CHARACTER ch) const RELEASENOTHROW;
1342 //
1345 // const_iterator case_insensitive_find(CHARACTER ch) const RELEASENOTHROW;
1346 //
1347 // // find routines
1348 //
1350 // //character_count find_index(CHARACTER ch) const RELEASENOTHROW { return this->offset_of(this->find(ch)); }
1351 //
1352 // // character_count find(CHARACTER ch) const RELEASENOTHROW;
1353 // // character_count find(CHARACTER ch) const RELEASENOTHROW;
1354 // character_count case_insensitive_find_index(CHARACTER ch) const RELEASENOTHROW { return this->offset_of(case_insensitive_find(ch)); }
1355 // character_count case_insensitive_find_index(CHARACTER ch, character_count start) const RELEASENOTHROW { return this->offset_of((*this)(start).case_insensitive_find(ch)); }
1356 //
1357 // const_iterator find_skip_or_end(CHARACTER ch = 0) const RELEASENOTHROW
1358 // {
1359 //
1360 // auto p = this->begin();
1361 //
1362 // while (p < this->end()) {
1363 //
1364 // if (*p == ch) {
1365 //
1366 // p++;
1367 //
1368 // return p;
1369 //
1370 // }
1371 //
1372 // p++;
1373 //
1374 // }
1375 //
1376 // return p;
1377 //
1378 // }
1379 //
1380
1381
1382 //inline bool begins(const SCOPED_STRING & scopedstrPrefix) const;
1383 //inline bool ends(const SCOPED_STRING & scopedstrSuffix) const;
1384
1385 // inline bool case_insensitive_begins(const SCOPED_STRING &scopedstrPrefix) const;
1386 //
1387 // inline bool case_insensitive_ends(const SCOPED_STRING &scopedstrSuffix) const;
1388
1389
1390 // look for a specific sub-string_base
1391
1392 //bool _find_prefix(character_count & i, const string_base &str, character_count & start, character_count & blockLen, character_count & nEndPosition, const CHARACTER ** ppszTail) const RELEASENOTHROW;
1393
1394 // find the first occurrence of string_base 'block', starting at index 'iStart'
1395 //const_iterator find(const SCOPED_STRING &scopedstr) const RELEASENOTHROW;
1396
1397
1398
1399 // const_iterator unicode_find(const SCOPED_STRING &scopedstr) const RELEASENOTHROW;
1400 //
1401 // const_iterator unicode_case_insensitive_find(const SCOPED_STRING &scopedstr) const RELEASENOTHROW;
1402 // ::collection::index unicode_case_insensitive_find_index(const SCOPED_STRING & scopedstr, character_count start = 0) const RELEASENOTHROW
1403 // {
1404 //
1405 // return this->offset_of(this->operator()(start).unicode_case_insensitive_find(scopedstr));
1406 //
1407 // }
1408 //
1409 // // find the first occurrence of string_base 'block', starting at index 'iStart', if found returns the index of first character after the end of the found string_base
1410 // //const_iterator rear_find(const SCOPED_STRING &scopedstr) const RELEASENOTHROW;
1411 //
1412 // const_iterator unicode_rear_find(const SCOPED_STRING &scopedstr) const RELEASENOTHROW;
1413 //
1414 // const_iterator unicode_case_insensitive_rear_find(const SCOPED_STRING &scopedstr) const RELEASENOTHROW;
1415 //
1416 // // find the first occurrence of any of the characters in string_base 'pszCharSet'
1417 // //const_iterator find_first_character_in(const SCOPED_STRING &scopedstrCharacters) const RELEASENOTHROW;
1418 // //const_iterator find_first_character_in(const SCOPED_STRING & scopedstrCharacters) const RELEASENOTHROW;
1419 // //character_count find_first_character_in(const CHARACTER * blockCharacters, character_count iStart = 0) const RELEASENOTHROW;
1420 //
1421 // //const_iterator _find_first_character_in(const SCOPED_STRING &scopedstrCharacters) const RELEASENOTHROW;
1422 // //const_iterator _find_first_character_in(const SCOPED_STRING & scopedstrCharacters) const RELEASENOTHROW;
1423 // ///character_count _find_first_character_in(const CHARACTER * blockCharacters, character_count iStart = 0) const RELEASENOTHROW;
1424 //
1425 // const_iterator find_first(CHARACTER chSeparator) const RELEASENOTHROW;
1426 //
1427 // //character_count find_first_in(const string_base &str) const RELEASENOTHROW;
1428 // //character_count find_first_in(const string_base &str) const RELEASENOTHROW;
1429 // ////character_count find_first_in(const string_base &str) const RELEASENOTHROW;
1430 // //character_count find_first_in(CHARACTER ca) const RELEASENOTHROW;
1431 //
1432 // //const_iterator skip_any_character_in(const SCOPED_STRING &scopedstrCharacters) const RELEASENOTHROW;
1433 //
1434 // //const_iterator skip_any_character_in(const SCOPED_STRING &scopedstrCharacters) const RELEASENOTHROW;
1435 //
1436 // //character_count skip_any_character_in(const CHARACTER * pszCharacters) const RELEASENOTHROW;
1437 // // const_iterator skip(CHARACTER chSkip) const RELEASENOTHROW;
1438 //
1439 // //const_iterator
1440 // //_skip_any_character_in(const SCOPED_STRING &scopedstrCharacters) const RELEASENOTHROW;
1441 //
1442 // //const_iterator _skip_any_character_in(const SCOPED_STRING &scopedstrCharacters) const RELEASENOTHROW;
1443 //
1444 // //character_count _skip_any_character_in(const CHARACTER * pszCharacters) const RELEASENOTHROW;
1445 // //const_iterator _skip(CHARACTER chSkip) const RELEASENOTHROW;
1446 //
1447 //
1449 // //character_count find_last_not_in(const string_base &str) const RELEASENOTHROW;
1450 // ////character_count find_last_not_in(const string_base &str, character_count pos = -1) const RELEASENOTHROW;
1451 // //character_count find_last_not_in(CHARACTER ca, character_count pos = -1) const RELEASENOTHROW;
1452 //
1457 // //character_count rear_find_first_character_in(const CHARACTER * blockCharacters) const RELEASENOTHROW;
1458 //
1463 // //character_count _rear_find_first_character_in(const CHARACTER * blockCharacters) const RELEASENOTHROW;
1464 //
1465 // //character_count find_first_of(const string_base &str) const RELEASENOTHROW;
1466 // //character_count find_first_of(const string_base &str) const RELEASENOTHROW;
1467 // //character_count find_first_of(const CHARACTER * pszCharacters) const RELEASENOTHROW;
1468 // //character_count find_first_of(CHARACTER ca) const RELEASENOTHROW;
1469 // //character_count find_first_of(CHARACTER ca, character_count pos) const RELEASENOTHROW;
1470 //
1471 // //character_count find_first_not_of(const string_base &str) const RELEASENOTHROW;
1472 // //character_count find_first_not_of(const string_base &str) const RELEASENOTHROW;
1473 // //character_count find_first_not_of(const string_base &str) const RELEASENOTHROW;
1474 // //character_count find_first_not_of(CHARACTER ca) const RELEASENOTHROW;
1475 //
1476 // //const_iterator rear_skip_any_character_in(const SCOPED_STRING &scopedstr) const RELEASENOTHROW;
1477 // //const_iterator rear_skip_any_character_in(const SCOPED_STRING & scopedstr) const RELEASENOTHROW;
1478 // //character_count rear_skip_any_character_in(const CHARACTER * psz, character_count pos = -1) const RELEASENOTHROW;
1479 //
1480 // //const_iterator rear_skip(CHARACTER ca) const RELEASENOTHROW;
1481 // //const_iterator rear_skip(CHARACTER ca) const RELEASENOTHROW;
1482 //
1483 //
1484 // //const_iterator _rear_skip_any_character_in(const SCOPED_STRING &scopedstr) const RELEASENOTHROW;
1485 // //const_iterator _rear_skip_any_character_in(const SCOPED_STRING & scopedstr) const RELEASENOTHROW;
1486 //
1487 //
1488 // using BASE_RANGE::_rear_skip;
1489 //
1490 //
1491 // //const_iterator _rear_skip_any_character_in(CHARACTER ca) const RELEASENOTHROW;
1492 // const_iterator _rear_skip(CHARACTER ca) const RELEASENOTHROW
1493 // {
1494 //
1495 // return this->_rear_skip(ca, ::comparison::comparison < CHARACTER >());
1496 //
1497 // }
1498 //
1499 // using BASE_RANGE::rear_skip;
1500 //
1501 // //character_count _rear_skip_any_character_in(const CHARACTER * psz, character_count pos = -1) const RELEASENOTHROW;
1502 // const_iterator rear_skip(CHARACTER ca) const RELEASENOTHROW
1503 // {
1504 //
1505 // return this->rear_skip(ca, ::comparison::comparison < CHARACTER> ());
1506 //
1507 // }
1508 //
1509 // //character_count find_last_of(const string_base &str, character_count pos = -1) const RELEASENOTHROW;
1510 // //character_count find_last_of(const string_base &str) const RELEASENOTHROW;
1511 // ////character_count find_last_of(const string_base &str, character_count pos = -1) const RELEASENOTHROW;
1512 // //character_count find_last_of(CHARACTER ca, character_count pos = -1) const RELEASENOTHROW;
1513 //
1514 // // find the last occurrence of character 'ch'
1515 // //const_iterator rear_find(CHARACTER ch) const RELEASENOTHROW;
1516 //
1517 // // find the last occurrence of string_base 'sz'
1518 // //const_iterator rear_find(const SCOPED_STRING & scopedstr) const RELEASENOTHROW;
1519 //
1520 //
1521 //
1522 // CHARACTER last_char(character_count count = -1) const;
1523 //
1524 //
1525 // inline character_count unichar_count() const;
1526 //
1527 // inline const_iterator unichar_at(character_count iUnicharIndex) const;
1528 //
1529 //
1530 // //const_iterator __replace(const_iterator start, const_iterator end, const SCOPED_STRING & scopedstr)
1531 // //{
1532 //
1533 // // ::memory_transfer((void *)start, start + scopedstr.size(), this->end() - end);
1534 //
1535 // // string_count_copy(start, scopedstr.begin(), scopedstr.size());
1536 //
1537 // //}
1538 //
1539 //
1540 // //bool equals(const string_base &str) const;
1541 // //bool case_insensitive_equals(const string_base &str) const;
1542 // inline bool operator==(const ::ansi_string &str) const;
1543 //
1544 // inline bool operator==(const ::wd16_string &str) const;
1545 //
1546 // inline bool operator==(const ::wd32_string &str) const;
1547 //
1548 // //inline bool operator ==(const SCOPED_STRING & scopedstr) const { return this->equals(scopedstr); }
1549 // inline bool operator==(const_char_pointer psz) const { return this->equals(scopedstr); }
1550 //
1551 // inline bool operator==(const ::wd16_character *psz) const { return this->equals(scopedstr); }
1552 //
1553 // inline bool operator==(const ::wd32_character *psz) const { return this->equals(scopedstr); }
1554 //
1555 // inline bool operator==(const ::inline_number_string &inline_number_string) const {
1556 // return this->equals((const SCOPED_STRING &) inline_number_string);
1557 // }
1558 //
1559 // //inline ::std::strong_ordering operator<=>(const string_base & range) const { return this->order(range); }
1560 // //inline ::std::strong_ordering operator<=>(const SCOPED_STRING &scopedstr) const { return this->order(scopedstr); }
1561 // //inline ::std::strong_ordering operator<=>(const CHARACTER * psz) const { return *this <=> ((const SCOPED_STRING &)psz); }
1562 // //inline ::i32 operator<=>(CHARACTER ch) const;
1563 // //inline bool operator==(CHARACTER ch) const;
1564 // //inline bool operator==(CHARACTER ch) const;
1565 // //inline bool operator>(const string_base &str2) const;
1566 // //inline bool operator>(CHARACTER ch) const;
1567 // //inline bool operator<(const string_base &str2) const;
1568 // //inline bool operator<(CHARACTER ch) const;
1569 // //inline bool operator!=(const string_base &str) const { return !operator ==(scopedstr); }
1570 // //inline bool operator!=(CHARACTER ch) const { return !operator ==(ch); }
1571 // //inline bool operator>=(const string_base &str) const { return !operator <(scopedstr); }
1572 // //inline bool operator>=(CHARACTER ch) const { return !operator <(ch); }
1573 // //inline bool operator<=(const CHARACTER * psz) const { return !operator >(scopedstr); }
1574 // //inline bool operator<=(CHARACTER ch) const { return !operator >(ch); }
1575 //
1576 //
1577 //
1578 // //character_count rear_find(CHARACTER ch) const RELEASENOTHROW
1579 // //{
1580 // // return rear_find(ch, iStart);
1581 // //};
1582 // //character_count rear_find(const string_base &str) const RELEASENOTHROW
1583 // //{
1584 // // return rear_find(sz, iStart);
1585 // //};
1586 //
1587
1588
1589 //
1590 // const_iterator find_first_whitespace() const RELEASENOTHROW { return this->find_first_character_in("\t\r\n "); }
1591 //
1592 // const_iterator skip_whitespace() const RELEASENOTHROW { return this->skip_any_character_in("\t\r\n "); }
1593 //
1594 // ::character_count count_left(const SCOPED_STRING& range = "\t\r\n ") const RELEASENOTHROW { return this->skip_any_character_in(range) - this->begin(); }
1595
1596
1597 void shift_begin(::character_count size)
1598 {
1599
1600 if(size)
1601 {
1602
1603 this->m_begin += size;
1604
1605 //this->m_erange = (enum_range)(this->m_erange & ~e_range_string);
1606
1607 }
1608
1609 }
1610
1611
1612 void shift_end(::character_count size)
1613 {
1614
1615 if(size)
1616 {
1617
1618 this->m_end += size;
1619
1620 //this->m_erange = (enum_range)(this->m_erange & ~(e_range_string | e_range_null_terminated));
1621
1622 }
1623
1624 }
1625
1626
1627 void set_begin(ITERATOR_TYPE p)
1628 {
1629
1630 if(this->m_begin != p)
1631 {
1632
1633 this->m_begin = p;
1634
1635 //this->m_erange = (enum_range) (this->m_erange & ~e_range_string);
1636
1637 }
1638
1639 }
1640
1641
1642 void set_end(ITERATOR_TYPE p)
1643 {
1644
1645 if(this->m_end != p)
1646 {
1647
1648 this->m_end = p;
1649
1650 //this->m_erange = (enum_range)(this->m_erange & ~(e_range_string));
1651
1652 }
1653
1654 }
1655
1656
1657 string_range & trim_left(const SCOPED_STRING & range) RELEASENOTHROW { shift_begin(this->count_left(range));
1658 return *this; }
1659
1660 // const_iterator rear_find_first_whitespace() const RELEASENOTHROW { return this->rear_find_first_character_in("\t\r\n "); }
1661 //
1662 // const_iterator rear_skip_whitespace() const RELEASENOTHROW { return this->rear_skip_any_character_in("\t\r\n "); }
1663 //
1664 // ::character_count count_right(const SCOPED_STRING& range = "\t\r\n ") const RELEASENOTHROW { return this->m_end - this->rear_skip_any_character_in(range); }
1665
1666 string_range & trim_right(const SCOPED_STRING & range) RELEASENOTHROW { shift_end(-this->count_right(range)); return *this; }
1667
1668 // ::character_count count_left_and_right(const SCOPED_STRING& range = "\t\r\n ") const RELEASENOTHROW { ::character_count c; return ((c = count_left(range)) == this->size()) ? c : c + count_right(range); }
1669
1670 string_range & trim(const SCOPED_STRING & range) RELEASENOTHROW { trim_left(range); trim_right(range); return *this; }
1671
1672 bool paired_trim(CHARACTER character1, CHARACTER character2)
1673 {
1674
1675 if (this->size() < 2)
1676 {
1677
1678 return false;
1679
1680 }
1681
1682 if (this->first() != character1 || this->last() != character2)
1683 {
1684
1685 return false;
1686
1687 }
1688
1689 this->shift_begin(1);
1690
1691 this->shift_end(-1);
1692
1693 return true;
1694
1695 }
1696
1697
1698 string_range& pair_trim_quotes()
1699 {
1700
1701 while (paired_trim('\"', '\"') || paired_trim('\'', '\''));
1702
1703 return *this;
1704
1705 }
1706
1707
1708 bool begins_eat(CHARACTER character)
1709 {
1710
1711 if (this->size() <= 0)
1712 {
1713
1714 return false;
1715
1716 }
1717
1718 if (this->first() != character)
1719 {
1720
1721 return false;
1722
1723 }
1724
1725 this->begin()++;
1726
1727 return true;
1728
1729 }
1730
1731
1732 bool defer_consume_character(CHARACTER & character)
1733 {
1734
1735 if (this->size() <= 0)
1736 {
1737
1738 return false;
1739
1740 }
1741
1742 character = this->first();
1743
1744 this->begin()++;
1745
1746 return true;
1747
1748 }
1749
1750
1751 ::i32 defer_consume_digit(::i32 iBase)
1752 {
1753
1754 CHARACTER character;
1755
1756 if (!defer_consume_character(character))
1757 {
1758
1759 return -1;
1760
1761 }
1762
1763 if (character >= '0' && character <= ('0' + minimum(iBase - 1, 9)))
1764 {
1765
1766 return character - '0';
1767
1768 }
1769
1770 if (iBase <= 10)
1771 {
1772
1773 return -1;
1774
1775 }
1776
1777 if (character >= 'a' && character <= ('a' + minimum(iBase - 11, 'z')))
1778 {
1779
1780 return character - 'a';
1781
1782 }
1783 else if (character >= 'A' && character <= ('A' + minimum(iBase - 11, 'Z')))
1784 {
1785
1786 return character - 'A';
1787
1788 }
1789
1790 return -1;
1791
1792 }
1793
1794
1795 ::collection::count consume(bool(*character_is_function)(CHARACTER character), character_count minimum_count);
1796
1797
1798 ::collection::count consume_spaces(character_count minimum_count = 0)
1799 {
1800
1801 return consume(&character_isspace, minimum_count);
1802
1803 }
1804
1805
1806 bool consume_line(string_range & range)
1807 {
1808
1809 if (this->is_empty())
1810 {
1811
1812 return false;
1813
1814 }
1815
1816 auto p = this->find_first_character_in("\r\n");
1817
1818 range.m_begin = this->m_begin;
1819
1820 range.m_erange = e_range_none;
1821
1822 if (p)
1823 {
1824
1825 range.m_end = p;
1826
1827 if (*p == '\r' && *(p + 1) == '\n')
1828 {
1829
1830 p += 2;
1831
1832 }
1833 else
1834 {
1835
1836 p++;
1837
1838 }
1839
1840 this->m_begin = p;
1841
1842 }
1843 else
1844 {
1845
1846 range.m_end = this->m_end;
1847
1848 this->m_begin = this->m_end;
1849
1850 }
1851
1852 return range;
1853
1854 }
1855
1856
1857 string_range consume_line()
1858 {
1859
1860 string_range range(no_initialize_t{});
1861
1862 if (!consume_line(range))
1863 {
1864
1865 return {};
1866
1867 }
1868
1869 return range;
1870
1871 }
1872
1873
1874 string_base<ITERATOR_TYPE > consume_quoted_value();
1875
1876 bool defer_consume_quoted_value(string_base<ITERATOR_TYPE > & str);
1877
1878 bool defer_consume(const SCOPED_STRING & scopedstr)
1879 {
1880
1881 if (!this->begins(scopedstr))
1882 {
1883
1884 return false;
1885
1886 }
1887
1888 this->begin() += scopedstr.size();
1889
1890 return true;
1891
1892 }
1893
1894 string_range consume_word(const SCOPED_STRING & scopedstrCharacters = " ")
1895 {
1896
1897 return this->consume_token_until_any_character_in(scopedstrCharacters);
1898
1899 }
1900
1901 bool defer_consume_word(string_base<ITERATOR_TYPE >& str, const SCOPED_STRING& scopedstrCharacters = " ")
1902 {
1903
1904 if (this->is_empty())
1905 {
1906
1907 return false;
1908
1909 }
1910
1911 str = this->consume_token_until_any_character_in(scopedstrCharacters);
1912
1913 return true;
1914
1915 }
1916
1917
1918 bool begins_consume(const ::scoped_string & scopedstr);
1919 bool begins_consume(ansi_character ansich) { return (*this->m_begin == ansich) ? (static_cast<void>(this->m_begin++), true) : false; }
1920 bool begins_consume(::ansi_character & characterReturn, ansi_character ansich) { return (bool)(*this->m_begin == ansich) ? (static_cast<void>(characterReturn = ansich), static_cast<void>(this->m_begin++), true) : false; }
1921 bool begins_eat(const ::scoped_string & scopedstr);
1922 bool ends_eat(const ::scoped_string & scopedstr);
1923 bool case_insensitive_begins_eat(const ::scoped_string & scopedstr);
1924 bool case_insensitive_ends_eat(const ::scoped_string & scopedstr);
1925 void consume(const_char_pointer pszToConsume);
1926 //static void consume(::const_ansi_range & range, const_char_pointer psz);
1927 void consume(const ::scoped_string & scopedstr);
1928 //void consume_spaces(::collection::count iMinimumCount = 1);
1929 ::u64 consume_natural(::u64 uiMax = ((::u64)-1), ::u64 uiMin = 0);
1930 //::u64 consume_natural(string & str, ::u64 uiMax = ((::u64)-1), ::u64 uiMin = 0);
1931 string_range consume_hex();
1932 //void consume_spaces(::const_ansi_range & range, ::collection::count iMinimumCount);
1933 string_range consume_non_spaces();
1934 //::string_base < ITERATOR_TYPE > consume_non_spaces(::const_ansi_range & range);
1935 string_range consume_nc_name();
1936 // ::string_base < ITERATOR_TYPE > consume_quoted_value(const_char_pointer &pszParse);
1937 //static void no_escape_consume_quoted_value(::const_ansi_range & range, ::ansi_character ** ppsz, character_count & iBufferSize);
1938 string_base<ITERATOR_TYPE> no_escape_consume_quoted_value();
1939 void no_escape_skip_quoted_value();
1940
1941 //template < typename ITERATOR_TYPE >
1942 //static string_base < ITERATOR_TYPE > consume_quoted_value(::string_range<BASE_TYPE> & range);
1943
1944
1945 string_base<ITERATOR_TYPE> consume_quoted_value_ex();
1946 void skip_quoted_value_ex();
1947 //static ::string_base < ITERATOR_TYPE > consume_spaced_value(string & str);
1948 //::string_base < ITERATOR_TYPE > consume_spaced_value(const_char_pointer &pszParse);
1949 string_range consume_spaced_value();
1950 //static ::string_base < ITERATOR_TYPE > consume_command_line_argument(string & str);
1951 //::string_base < ITERATOR_TYPE > consume_command_line_argument(const_char_pointer &pszParse);
1952 string_base<ITERATOR_TYPE> consume_command_line_argument();
1953 void consume_until_any_character_in(const ::scoped_string & scopedstr);
1954 //static bool begins_consume(::const_ansi_range & range, const ::scoped_string & scopedstr);
1955
1956 string_range xml_consume_comment();
1957
1958 string_base < ITERATOR_TYPE > consume_c_quoted_value();
1959
1960 template < bool bWriteOutput >
1961 void _consume_quoted_value_ex(string_base<ITERATOR_TYPE>* pstrOut);
1962
1963 string_range consume_utf8_char();
1964
1965
1966
1967
1968
1973 //; Return :
1978
1979 void escape_skip_to_character(::i32 ch, ::i32 escape);
1980
1990 void escape_skip_to_first_character_in(const_char_pointer chset, ::i32 escape);
1991
1992
2002 void escape_case_insensitive_skip_to(const ::scoped_string & scopedstr, ::i32 escape);
2003
2004 THIS_RANGE& trim_left()
2005 {
2006
2007 return *this = this->trimmed_left();
2008
2009 }
2010
2011
2012 THIS_RANGE& trim_right()
2013 {
2014
2015 return *this = this->trimmed_right();
2016
2017 }
2018
2019
2020 THIS_RANGE& trim()
2021 {
2022
2023 return *this = this->trimmed_right().trimmed_left();
2024
2025 }
2026
2027
2028 inline ::collection::count _count_parts_from_beginning(::collection::count cPathMaxPartCount, CHARACTER chPartSeparator)
2029 {
2030
2031 this->m_begin = this->__count_parts_from_beginning(cPathMaxPartCount, chPartSeparator);
2032
2033 return cPathMaxPartCount;
2034
2035 }
2036
2037
2038 inline ::collection::count count_parts_from_beginning(::collection::count cPathPartCountToConsume, CHARACTER chSeparator)
2039 {
2040
2041 if (cPathPartCountToConsume <= 0)
2042 {
2043
2044 return cPathPartCountToConsume;
2045
2046 }
2047
2048 return this->_count_parts_from_beginning(cPathPartCountToConsume, chSeparator);
2049
2050 }
2051
2052
2053
2054 string_range consume_token_until_any_character_in(const SCOPED_STRING& scopedstrCharacters, bool bReturnSeparator = false, bool bSkipAnyCharactersIn = true);
2055
2056
2057};
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073using ansi_range = ::string_range< const_char_pointer >;
2077
2078
2079//using ansi_string_range = ::string_range<::ansi_string>;
2080//using wd16_string_range = ::string_range<::wd16_string>;
2081//using wd32_string_range = ::string_range<::wd32_string>;
2082//using wide_string_range = ::string_range<::wide_string>;
2083
2084
2085template < prototype_character CHARACTER, prototype_integral INTEGRAL >
2086::string_range < const CHARACTER* > as_string_range(const CHARACTER* p, INTEGRAL n)
2087{
2088
2089 return {
2090 p,
2091 p + n
2092 };
2093
2094}
2095
Definition aaa_character.h:10
Definition range.h:223
Definition scoped_string_base.h:13
Definition string_base.h:90
void escape_skip_to_character(::i32 ch, ::i32 escape)
Definition _impl.h:1764
void escape_case_insensitive_skip_to(const ::scoped_string &scopedstr, ::i32 escape)
Definition _impl.h:1843
void escape_skip_to_first_character_in(const_char_pointer chset, ::i32 escape)
Definition _impl.h:1800
Definition _tags.h:5