acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_impl_string_array.h
1//
2// Created by camilo on 23/12/2022 01:38 <3ThomasBorregaardSorensen!!
3//
4#pragma once
5
6
7#include "acme/prototype/string/c/ancient/_c.h"
8
9
10template < typename Type, typename RawType, ::enum_type t_etypeContainer >
11template < typename PRED >
12Type string_base_array < Type, RawType, t_etypeContainer > ::predicate_implode(PRED pred, const SCOPED_STRING& strSeparator, ::collection::index i, ::collection::count inCountLastOut) const
13{
14
15 Type str;
16
17 if (!this->prepare_first_in_count_last_out(i, inCountLastOut))
18 {
19
20 return str;
21
22 }
23
24 str = pred(this->first());
25
26 if (i == inCountLastOut)
27 {
28
29 return str;
30
31 }
32
33 while (i < inCountLastOut)
34 {
35
36 i++;
37
38 str += strSeparator;
39
40 str += pred(this->element_at(i));
41
42 }
43
44 return str;
45
46}
47
48
49
50
51
52static inline void ConstructElement(string* pNewData)
53{
54 ((string*)pNewData)->default_construct();
55}
56
57static inline void DestructElement(string* pOldData)
58{
59 pOldData->~string();
60}
61
62
63static inline void ConstructElement(wstring* pNewData)
64{
65 ((wstring*)pNewData)->default_construct();
66}
67
68static inline void DestructElement(wstring* pOldData)
69{
70 pOldData->~wstring();
71}
72
73
74template < typename Type, typename RawType, ::enum_type t_etypeContainer >
75inline Type& string_base_array < Type, RawType, t_etypeContainer >::last(::collection::index i)
76{
77 return this->element_at(get_upper_bound(i));
78}
79
80template < typename Type, typename RawType, ::enum_type t_etypeContainer >
81inline Type string_base_array < Type, RawType, t_etypeContainer >::last(::collection::index i) const
82{
83 return this->element_at(get_upper_bound(i));
84}
85
86template < typename Type, typename RawType, ::enum_type t_etypeContainer >
87inline Type& string_base_array < Type, RawType, t_etypeContainer >::first(::collection::index i)
88{
89 return this->element_at(get_lower_bound(i));
90}
91
92
93template < typename Type, typename RawType, ::enum_type t_etypeContainer >
94inline Type string_base_array < Type, RawType, t_etypeContainer >::first(::collection::index i) const
95{
96
97 return this->element_at(get_lower_bound(i));
98
99}
100
101
102template < typename Type, typename RawType, ::enum_type t_etypeContainer >
103inline ::collection::count string_base_array < Type, RawType, t_etypeContainer >::get_size() const
104{
105
106 return this->size();
107
108}
109
110
111template < typename Type, typename RawType, ::enum_type t_etypeContainer >
112inline ::collection::count string_base_array < Type, RawType, t_etypeContainer >::get_count() const
113{
114
115 return this->size();
116
117}
118
119template < typename Type, typename RawType, ::enum_type t_etypeContainer >
120inline ::collection::index string_base_array < Type, RawType, t_etypeContainer >::get_lower_bound(::collection::index i) const
121{
122 return i;
123}
124
125
126template < typename Type, typename RawType, ::enum_type t_etypeContainer >
127inline ::collection::index string_base_array < Type, RawType, t_etypeContainer >::get_upper_bound(::collection::index i) const
128{
129
130 return this->size() + i;
131
132}
133
134
135template < typename Type, typename RawType, ::enum_type t_etypeContainer >
136inline ::collection::index string_base_array < Type, RawType, t_etypeContainer >::get_middle_index(::collection::index i) const
137{
138
139 return get_upper_bound() / 2 + i;
140
141}
142
143
144
145
146
147
148
149template < typename Type, typename RawType, ::enum_type t_etypeContainer >
150string_base_array < Type, RawType, t_etypeContainer >::~string_base_array()
151{
152
153 // // ASSERT_OK(this);
154
155}
156
157
158
159
160//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
161//::collection::count string_base_array < Type, RawType, t_etypeContainer >::add(const string_base_array < Type, RawType, t_etypeContainer >& src)
162//{
163//
164// if(this == &src)
165// {
166//
167// string_base_array < Type, RawType, t_etypeContainer > thisCopy(src);
168//
169// return add(thisCopy);
170//
171// }
172//
173// // ASSERT_OK(this);
174// ASSERT(this != &src); // cannot append to itself
175//
176// ::collection::count nOldSize = this->size();
177//
178// ::collection::count nAddSize = src.size();
179//
180// this->set_size(nOldSize + nAddSize);
181//
182// CopyElements(&this->m_begin[nOldSize],src.m_begin, nAddSize);
183//
184// return nOldSize;
185//
186//}
187
188
189template < typename Type, typename RawType, ::enum_type t_etypeContainer >
190string_base_array < Type, RawType, t_etypeContainer >&
191string_base_array < Type, RawType, t_etypeContainer >::c_stra(string_base_array < Type, RawType, t_etypeContainer >& stra) const
192{
193
194 for (auto& str : *this)
195 {
196
197 stra.add(str.c_str());
198
199 }
200
201 return stra;
202
203}
204
205template < typename Type, typename RawType, ::enum_type t_etypeContainer >
206string_base_array < Type, RawType, t_etypeContainer >
207string_base_array < Type, RawType, t_etypeContainer >::c_stra() const
208{
209
210 string_base_array < Type, RawType, t_etypeContainer > stra;
211
212 return c_stra(stra);
213
214}
215
216
217template < typename Type, typename RawType, ::enum_type t_etypeContainer >
218void string_base_array < Type, RawType, t_etypeContainer >::copy(const string_base_array < Type, RawType, t_etypeContainer >& src)
219{
220
221 if (this == &src)
222 return;
223
224 // // ASSERT_OK(this);
225
226 auto nSrcSize = src.size();
227
228 this->set_size(nSrcSize);
229
230 CopyElements(this->m_begin, src.m_begin, nSrcSize);
231
232}
233
234
235template < typename Type, typename RawType, ::enum_type t_etypeContainer >
236template < prototype_array ARRAY >
237void string_base_array < Type, RawType, t_etypeContainer >::copy(const ARRAY& src)
238{
239
240 this->set_size((::collection::count)src.size());
241
242 for (::collection::index i = 0; i < this->size(); i++)
243 {
244
245 *get_data()[i] = as_string(src[i]);
246
247 }
248
249}
250
251
252template < typename Type, typename RawType, ::enum_type t_etypeContainer >
253Type& string_base_array < Type, RawType, t_etypeContainer >::set_at_grow(::collection::index nIndex, const Type& newElement)
254{
255 // // ASSERT_OK(this);
256 ASSERT(nIndex >= 0);
257
258 if (nIndex >= this->size())
259 this->set_size(nIndex + 1);
260
261 return get_data()[nIndex] = newElement;
262
263}
264
265
266template < typename Type, typename RawType, ::enum_type t_etypeContainer >
267::collection::index string_base_array < Type, RawType, t_etypeContainer >::_007FindLine(const SCOPED_STRING& strKey, ::collection::index iStart) const
268{
269
270 for (::collection::index i = iStart; i < get_count(); i++)
271 {
272
273 if (element_at(i).trimmed().case_insensitive_begins("[") && i > 0)
274 {
275
276 return -1;
277
278 }
279
280 if (element_at(i).case_insensitive_begins(strKey + "="))
281 {
282
283 return i;
284
285 }
286
287 }
288
289 return -1;
290
291}
292
293
294template < typename Type, typename RawType, ::enum_type t_etypeContainer >
295void string_base_array < Type, RawType, t_etypeContainer >::_007SetLine(const SCOPED_STRING& strKey, const SCOPED_STRING& strValue, ::collection::index iStart)
296{
297
298 ::collection::index iKeyIndex = _007FindLine(strKey, iStart);
299
300 Type strNewLine = strKey + "=" + strValue;
301
302 if (iKeyIndex >= 0)
303 {
304
305 this->element_at(iKeyIndex) = strNewLine;
306
307 }
308 else
309 {
310
311 this->add(strNewLine);
312
313 }
314
315}
316
317
318template < typename Type, typename RawType, ::enum_type t_etypeContainer >
319::collection::index string_base_array < Type, RawType, t_etypeContainer >::_007GetLine(RawType& strValue, const SCOPED_STRING& strKey, ::collection::index iStart) const
320{
321
322 ::collection::index iKeyIndex = _007FindLine(strKey, iStart);
323
324 if (iKeyIndex < 0)
325 {
326
327 return -1;
328
329 }
330
331 strValue = this->element_at(iKeyIndex).substr(strKey.size() + 1);
332
333 return iKeyIndex;
334
335}
336
337
338template < typename Type, typename RawType, ::enum_type t_etypeContainer >
339RawType string_base_array < Type, RawType, t_etypeContainer >::_007GetLine(const SCOPED_STRING& strKey, ::collection::index iStart) const
340{
341
342 RawType strValue;
343
344 if (_007GetLine(strValue, strKey, iStart) < 0)
345 {
346
347 return "";
348
349 }
350
351 return strValue;
352
353}
354
355
356template < typename Type, typename RawType, ::enum_type t_etypeContainer >
357::collection::index string_base_array < Type, RawType, t_etypeContainer >::_007FindSection(const SCOPED_STRING& strSection) const
358{
359
360 ::collection::index iSectionIndex = this->case_insensitive_find_first_begins(strSection);
361
362 return iSectionIndex;
363
364}
365
366
367template < typename Type, typename RawType, ::enum_type t_etypeContainer >
368::collection::index string_base_array < Type, RawType, t_etypeContainer >::_007FindLine(const SCOPED_STRING& strSection, const SCOPED_STRING& strKey) const
369{
370
371 ::collection::index iSectionIndex = this->_007FindSection(strSection);
372
373 if (iSectionIndex < 0)
374 {
375
376 return -1;
377
378 }
379
380 return this->_007FindLine(strKey, iSectionIndex + 1);
381
382}
383
384
385template < typename Type, typename RawType, ::enum_type t_etypeContainer >
386::collection::index string_base_array < Type, RawType, t_etypeContainer >::_007OpenSection(const SCOPED_STRING& strSection)
387{
388
389 ::collection::index iSectionIndex = this->_007FindSection(strSection);
390
391 if (iSectionIndex < 0)
392 {
393
394 this->add("");
395
396 iSectionIndex = this->add(strSection);
397
398 }
399
400 return iSectionIndex;
401
402}
403
404
405template < typename Type, typename RawType, ::enum_type t_etypeContainer >
406void string_base_array < Type, RawType, t_etypeContainer >::_007SetLine(const SCOPED_STRING& strSection, const SCOPED_STRING& strKey, const SCOPED_STRING& strValue)
407{
408
409 ::collection::index iSectionIndex = this->_007OpenSection(strSection);
410
411 if (iSectionIndex < 0)
412 {
413
414 this->add("");
415
416 iSectionIndex = this->add(strSection);
417
418 }
419
420 this->_007SetLine(strKey, strValue, iSectionIndex + 1);
421
422}
423
424
425template < typename Type, typename RawType, ::enum_type t_etypeContainer >
426::collection::index string_base_array < Type, RawType, t_etypeContainer >::_007GetLine(RawType& strValue, const SCOPED_STRING& strSection, const SCOPED_STRING& strKey) const
427{
428
429 ::collection::index iSectionIndex = this->_007FindSection(strSection);
430
431 if (iSectionIndex < 0)
432 {
433
434 return -1;
435
436 }
437
438 return _007GetLine(strValue, strKey, iSectionIndex + 1);
439
440}
441
442template < typename Type, typename RawType, ::enum_type t_etypeContainer >
443RawType string_base_array < Type, RawType, t_etypeContainer >::_007GetLine(const SCOPED_STRING& strSection, const SCOPED_STRING& strKey) const
444{
445
446 RawType strValue;
447
448 if (_007GetLine(strValue, strSection, strKey) < 0)
449 {
450
451 return "";
452
453 }
454
455 return strValue;
456
457}
458
459
460
461
462
463
464
465template < typename Type, typename RawType, ::enum_type t_etypeContainer >
466void string_base_array < Type, RawType, t_etypeContainer >::insert_empty(::collection::index nIndex, ::collection::count nCount)
467{
468 // // ASSERT_OK(this);
469 ASSERT(nIndex >= 0); // will expand to meet need
470 ASSERT(nCount > 0); // zero or negative i32_size not allowed
471
472 if (nIndex >= this->size())
473 {
474 // adding after the end of the array
475 this->set_size(nIndex + nCount); // grow so nIndex is valid
476 }
477 else
478 {
479 // inserting in the middle of the array
480 ::collection::count nOldSize = (::collection::count)this->size();
481 this->set_size((::collection::count)(this->size() + nCount)); // grow it to ___new i32_size
482 // shift old data up to fill gap
483 memory_transfer(&get_data()[nIndex + nCount], &get_data()[nIndex], (nOldSize - nIndex) * sizeof(Type));
484
485 // re-init slots we copied from
486 for (::collection::index i = nIndex; i < nIndex + nCount; i++)
487 {
488
489 get_data()[i].default_construct();
490
491 }
492
493 }
494
495 // insert ___new value in the gap
496 ASSERT(nIndex + nCount <= this->size());
497}
498
499template < typename Type, typename RawType, ::enum_type t_etypeContainer >
500Type& string_base_array < Type, RawType, t_etypeContainer >::insert_empty(::collection::index nIndex)
501{
502
503 // // ASSERT_OK(this);
504
505 ASSERT(nIndex >= 0); // will expand to meet need
506
507 if (nIndex >= this->size())
508 {
509
510 this->set_size(nIndex + 1);
511
512 }
513 else
514 {
515
516 auto nOldSize = this->size();
517
518 this->set_size(nOldSize + 1);
519
520 memory_transfer(this->ptr_at(nIndex + 1), this->ptr_at(nIndex), (nOldSize - nIndex) * sizeof(Type));
521
522 for (::collection::index i = nIndex; i < nIndex + 1; i++)
523 {
524
525 øraw_new (this->ptr_at(nIndex)) RawType();
526
527 }
528
529 }
530
531 ASSERT(nIndex + 1 <= this->size());
532
533 return get_data()[nIndex];
534
535}
536
537
538
539template < typename Type, typename RawType, ::enum_type t_etypeContainer >
540Type& string_base_array < Type, RawType, t_etypeContainer >::insert_at(::collection::index nIndex, const Type& strElement)
541{
542
543 return insert_empty(nIndex) = strElement;
544
545}
546
547
548template < typename Type, typename RawType, ::enum_type t_etypeContainer >
549void string_base_array < Type, RawType, t_etypeContainer >::insert_at(::collection::index nIndex, const Type& strElement, ::collection::count nCount)
550{
551
552 // make room for ___new elements
553 insert_empty(nIndex, nCount);
554
555
556
557 // copy elements into the is_empty space
558 //Type temp = newElement;
559 while (nCount--)
560 get_data()[nIndex++] = strElement;
561
562}
563
564
565
566template < typename Type, typename RawType, ::enum_type t_etypeContainer >
567template < prototype_container CONTAINER >
568void string_base_array < Type, RawType, t_etypeContainer >::insert_at(::collection::index nStartIndex, const CONTAINER & container)
569{
570 // // ASSERT_OK(this);
571 ASSERT(&container != nullptr);
572 // ASSERT_KINDOF(string_base_array < Type, RawType, t_etypeContainer >, &NewArray);
573 // ASSERT_OK(&NewArray);
574 ASSERT(nStartIndex >= 0);
575
576 if (container.size() > 0)
577 {
578 ::collection::index i = 0;
579 for (auto& item : container)
580 {
581
582 if (i == 0)
583 {
584 this->insert_at(nStartIndex, item, container.size());
585 }
586 else
587 {
588 set_at(nStartIndex + i, item);
589 }
590 i++;
591 }
592 }
593}
594
595
596//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
597//void string_base_array < Type, RawType, t_etypeContainer >::dump(dump_context & dumpcontext) const
598//{
599// //matter::dump(dumpcontext);
600//
601// dumpcontext << "with " << this->size() << " elements";
602// if(dumpcontext.GetDepth() > 0)
603// {
604// for(::collection::index i = 0; i < this->size(); i++)
605// dumpcontext << "\n\t[" << i << "] = " << get_data()[i].c_str();
606// }
607//
608// dumpcontext << "\n";
609//}
610//
611//
612//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
613//void string_base_array < Type, RawType, t_etypeContainer >::assert_ok() const
614//{
615//
616// matter::assert_ok();
617//
618// if(this->m_begin == nullptr)
619// {
620//
621// ASSERT(this->size() == 0);
622// ASSERT(this->m_nMaxSize == 0);
623//
624// }
625// else
626// {
627//
628// ASSERT(this->size() >= 0);
629// ASSERT(this->m_nMaxSize >= 0);
630// ASSERT(this->size() <= this->m_nMaxSize);
631// ASSERT(is_memory_segment_ok(this->m_begin, (memsize_cast) (this->m_nMaxSize * sizeof(Type))));
632//
633// }
634//
635//}
636
637
638
639
640template < typename Type, typename RawType, ::enum_type t_etypeContainer >
641string_base_array < Type, RawType, t_etypeContainer > string_base_array < Type, RawType, t_etypeContainer >::slice(::collection::index i, ::collection::count inCountLastOut) const
642{
643
645
646 if (this->prepare_first_in_count_last_out(i, inCountLastOut))
647 {
648
649 for (; i <= inCountLastOut; i++)
650 {
651
652 stra.add(this->element_at(i));
653
654 }
655
656 }
657
658 return stra;
659
660}
661//
662//
663// template < typename Type, typename RawType, ::enum_type t_etypeContainer >
664// string_base_array < Type, RawType, t_etypeContainer >& string_base_array < Type, RawType, t_etypeContainer >::operator =(const string_base_array < Type, RawType, t_etypeContainer >& tokena)
665// {
666//
667// copy(tokena);
668//
669// return *this;
670//
671// }
672
673
674//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
675//inline Type & string_base_array < Type, RawType, t_etypeContainer >::add_new()
676//{
677//
678// this->allocate(this->size() + 1);
679//
680// return this->last();
681//
682//}
683//
684//
685//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
686//::collection::index string_base_array < Type, RawType, t_etypeContainer >::add_new(::collection::count c)
687//{
688//
689// if(i == -1)
690// {
691//
692// return add(Type(scopedstr));
693//
694// }
695// else
696// {
697//
698// insert_at(i,Type(scopedstr));
699//
700// return get_upper_bound();
701//
702// }
703//
704//}
705
706
707//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
708//Type & string_base_array < Type, RawType, t_etypeContainer >::new_element(::collection::count c)
709//{
710//
711// add_new(nullptr,c);
712//
713// if(i == -1)
714// {
715//
716// return last();
717//
718// }
719// else
720// {
721//
722// return this->element_at(i);
723//
724// }
725//
726//}
727
728
729template < typename Type, typename RawType, ::enum_type t_etypeContainer >
730Type& string_base_array < Type, RawType, t_etypeContainer >::add_get(const Type& newElement)
731{
732
733 ::collection::index nIndex = this->size();
734
735 return set_at_grow(nIndex, newElement);
736
737}
738
739
740template < typename Type, typename RawType, ::enum_type t_etypeContainer >
741void string_base_array < Type, RawType, t_etypeContainer >::erase_duplicates()
742{
743
744 for (::collection::index i = 1; i < this->get_size();)
745 {
746
747 if (find_first(this->element_at(i), 0, i - 1) >= 1)
748 {
749
750 this->erase_at(i);
751
752 }
753 else
754 {
755
756 i++;
757
758 }
759
760 }
761
762}
763
764
765template < typename Type, typename RawType, ::enum_type t_etypeContainer >
766void string_base_array < Type, RawType, t_etypeContainer >::case_insensitive_erase_duplicates()
767{
768
769 for (::collection::index i = 1; i < this->get_size();)
770 {
771
772 if (case_insensitive_find_first(this->element_at(i), 0, i - 1) >= 1)
773 {
774
775 this->erase_at(i);
776
777 }
778 else
779 {
780
781 i++;
782
783 }
784
785 }
786
787}
788
789
790template < typename Type, typename RawType, ::enum_type t_etypeContainer >
791const Type* string_base_array < Type, RawType, t_etypeContainer >::get_data() const
792{
793 return (const Type*)this->m_begin;
794}
795
796
797template < typename Type, typename RawType, ::enum_type t_etypeContainer >
798Type* string_base_array < Type, RawType, t_etypeContainer >::get_data()
799{
800 return (Type*)this->m_begin;
801}
802
803
804
805// template < typename Type, typename RawType, ::enum_type t_etypeContainer >
806// string_base_array < Type, RawType, t_etypeContainer > ::string_base_array(const string_base_array < Type, RawType, t_etypeContainer >& array) :
807// BASE_ARRAY((const BASE_ARRAY&)array)
808// {
809// }
810//
811//
812// template < typename Type, typename RawType, ::enum_type t_etypeContainer >
813// string_base_array < Type, RawType, t_etypeContainer > ::string_base_array(string_base_array < Type, RawType, t_etypeContainer >&& array) :
814// BASE_ARRAY(::transfer(array))
815// {
816// }
817
818
819template < typename Type, typename RawType, ::enum_type t_etypeContainer >
820string_base_array < Type, RawType, t_etypeContainer > ::string_base_array(CHARACTER* const* ppsz, ::collection::count c)
821{
822
823 this->set_size(c);
824
825 for (::collection::index i = 0; i < c; i++)
826 {
827
828 this->element_at(i) = ppsz[i];
829
830 }
831
832}
833
834
835//#ifdef UNIVERSAL_WINDOWS
836//
837//
838//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
839//string_base_array < Type, RawType, t_etypeContainer > ::string_base_array(Platform::Array < Platform::String ^ > ^ refstra)
840//{
841//
842// for (::u32 u = 0; u < refstra->Length; u++)
843// {
844//
845// Type str;
846//
847// str = refstra[u]->Begin();
848//
849// add(str);
850//
851// }
852//
853//}
854//
855//
856//#endif
857
858
859#include "acme/prototype/string/tokenizer.h"
860
861
862template < typename Type, typename RawType, ::enum_type t_etypeContainer >
863void string_base_array < Type, RawType, t_etypeContainer > ::add_tokens(const SCOPED_STRING& scopedstr, const SCOPED_STRING& strSeparator, bool bAddEmpty)
864{
865
866 ::string str(scopedstr);
867
868 ::tokenizer strTokenizer(str);
869
870 ::string strToken;
871
872 if (bAddEmpty)
873 {
874
875 while (strTokenizer.get_next_token(strToken, strSeparator, false))
876 {
877
878 string_base_array::add(strToken);
879
880 }
881
882 }
883 else
884 {
885
886 while (strTokenizer.get_next_token(strToken, strSeparator, false))
887 {
888
889 if (!strToken.is_empty())
890 {
891
892 string_base_array::add(strToken);
893
894 }
895
896 }
897
898 }
899
900}
901
902
903
904template < typename Type, typename RawType, ::enum_type t_etypeContainer >
905void string_base_array < Type, RawType, t_etypeContainer > ::_001AddTokens(const SCOPED_STRING& str)
906
907{
908
909 ::tokenizer strTokenizer(str);
910
911
912 Type strToken;
913
914 while (strTokenizer._001GetNextToken(strToken))
915 {
916
917 string_base_array::add(strToken);
918
919 }
920
921}
922
923
924template < typename Type, typename RawType, ::enum_type t_etypeContainer >
925void string_base_array < Type, RawType, t_etypeContainer > ::add_smallest_tokens(const SCOPED_STRING& str, const BASE_RAW_STRING_ARRAY & straSeparator, bool bAddEmpty, bool bWithSeparator)
926{
927
928 ::tokenizer strTokenizer(str);
929
930 Type strToken;
931
932 if (bAddEmpty)
933 {
934
935 while (strTokenizer.get_next_smallest_token(strToken, straSeparator, bWithSeparator))
936 {
937
938 string_base_array::add(strToken);
939
940 }
941
942 }
943 else
944 {
945
946 while (strTokenizer.get_next_smallest_token(strToken, straSeparator, bWithSeparator))
947 {
948
949 if (!strToken.is_empty())
950 {
951
952 string_base_array::add(strToken);
953
954 }
955
956 }
957
958 }
959
960}
961
962
963template < typename Type, typename RawType, ::enum_type t_etypeContainer >
964void string_base_array < Type, RawType, t_etypeContainer > ::add_words(const SCOPED_STRING& str)
965{
966
967 ::tokenizer strTokenizer(str);
968
969 Type strWord;
970
971 while (strTokenizer.get_word(strWord))
972 {
973
974 string_base_array::add(strWord);
975
976 }
977
978}
979
980
981template < typename Type, typename RawType, ::enum_type t_etypeContainer >
982template < bool bAddEmpty >
983typename Type::const_iterator string_base_array < Type, RawType, t_etypeContainer > ::_____add_lines_rn(const SCOPED_STRING& scopedstr, bool bWithEOL)
984{
985
986 auto range = scopedstr();
987
988 while (true)
989 {
990
991 auto p = range.find_first_character_in("\n\r");
992
993 if (::is_null(p))
994 {
995
996 return range.begin();
997
998 }
999
1000 auto pNext = p;
1001
1002 if (*pNext == '\r')
1003 {
1004
1005 pNext++;
1006
1007 //if (pNext >= range.end())
1008 //{
1009
1010 // return pNext;
1011
1012 //}
1013 if (*pNext == '\n')
1014 {
1015
1016 pNext++;
1017
1018 }
1019
1020 }
1021 else // if(*p == 'n')
1022 {
1023
1024 pNext++;
1025
1026 }
1027
1028 __add_lines_suffix<bAddEmpty>(range.begin(), bWithEOL ? pNext : p);
1029
1030 range.begin(pNext);
1031
1032 };
1033
1034}
1035
1036
1037
1038
1039
1040template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1041template < bool bAddEmpty >
1042void string_base_array < Type, RawType, t_etypeContainer > ::_add_lines(const SCOPED_STRING& strParam, bool bWithEOL)
1043{
1044
1045 auto pN = strParam.find_first('\n');
1046
1047 auto pR = strParam.find_first('\r');
1048
1049 typename Type::const_iterator p;
1050
1051 if (pN)
1052 {
1053
1054 if (pR)
1055 {
1056
1057 p = _____add_lines_rn<bAddEmpty>(strParam, bWithEOL);
1058
1059 }
1060 else
1061 {
1062
1063 p = _____add_lines<'\n', bAddEmpty>(strParam, bWithEOL);
1064
1065 }
1066
1067 }
1068 else if (pR)
1069 {
1070
1071 p = _____add_lines<'\r', bAddEmpty>(strParam, bWithEOL);
1072
1073 }
1074 else
1075 {
1076
1077 p = strParam.begin();
1078
1079 }
1080
1081 __add_lines_suffix<bAddEmpty>(p, strParam.end());
1082
1083}
1084
1085
1086template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1087void string_base_array < Type, RawType, t_etypeContainer > ::get_format_string(Type& str, const SCOPED_STRING& strSeparator) const
1088
1089{
1090 str.empty();
1091 if (this->size() > 0)
1092 {
1093 str = get_at(0);
1094 }
1095 for (::collection::index i = 1; i < this->size(); i++)
1096 {
1097 str += strSeparator + get_at(i);
1098
1099 }
1100}
1101
1102
1103template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1104::collection::index string_base_array < Type, RawType, t_etypeContainer > ::add_unique(const Type& newElement)
1105{
1106
1107 auto iFind = find_first(newElement);
1108
1109 if (iFind >= 0)
1110 {
1111
1112 return -1;
1113
1114 }
1115
1116 return string_base_array::add(newElement);
1117
1118}
1119
1120
1121template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1122::collection::count string_base_array < Type, RawType, t_etypeContainer > ::append_unique(const string_base_array& newElements)
1123{
1124
1125 ::collection::count count = 0;
1126
1127 for (auto& newElement : newElements)
1128 {
1129
1130 if (add_unique(newElement) >= 0)
1131 {
1132
1133 count++;
1134
1135 }
1136
1137 }
1138
1139 return count;
1140
1141}
1142
1143
1144template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1145::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_add_unique(const Type& newElement)
1146
1147{
1148
1149 ::collection::index iFind = case_insensitive_find_first(newElement);
1150
1151 if (iFind >= 0)
1152 {
1153
1154 return -1;
1155
1156 }
1157
1158 string_base_array::add(newElement);
1159
1160 return get_upper_bound();
1161
1162}
1163
1164
1165template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1166::collection::count string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_append_unique(const string_base_array& straNewElements)
1167{
1168
1169 ::collection::count count = 0;
1170
1171 for (auto& newElement : straNewElements)
1172 {
1173
1174 if (case_insensitive_add_unique(newElement) >= 0)
1175 {
1176
1177 count++;
1178
1179 }
1180
1181 }
1182
1183 return count;
1184
1185}
1186
1187
1188template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1189::collection::index string_base_array < Type, RawType, t_etypeContainer > ::find_first(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast) const
1190{
1191
1192 if (this->prepare_first_last(iFind, iLast))
1193 {
1194
1195 for (; iFind <= iLast; iFind++)
1196 {
1197
1198 if (this->element_at(iFind).order(str) == 0)
1199 {
1200
1201 return iFind;
1202
1203 }
1204
1205 }
1206
1207 }
1208
1209 return -1;
1210
1211}
1212
1213
1214template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1215::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_find_first(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast) const
1216{
1217
1218 if (this->prepare_first_last(iFind, iLast))
1219 {
1220
1221 for (; iFind <= iLast; iFind++)
1222 {
1223
1224 if (this->element_at(iFind).case_insensitive_order(str) == 0)
1225 {
1226
1227 return iFind;
1228
1229 }
1230
1231 }
1232
1233 }
1234
1235 return -1;
1236
1237}
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1259::collection::index string_base_array < Type, RawType, t_etypeContainer > ::rear_find(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast) const
1260{
1261
1262 if (this->prepare_first_last(iFind, iLast))
1263 {
1264
1265 for (; iLast >= iFind; iLast--)
1266 {
1267
1268 if (this->element_at(iLast).order(str) == 0)
1269 {
1270
1271 return iLast;
1272
1273 }
1274
1275 }
1276
1277 }
1278
1279 return -1;
1280
1281}
1282
1283template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1284::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_reverse_find(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast) const
1285{
1286
1287 if (this->prepare_first_last(iFind, iLast))
1288 {
1289
1290 for (; iLast >= iFind; iLast--)
1291 {
1292
1293 if (this->element_at(iLast).case_insensitive_order(str) == 0)
1294 {
1295
1296 return iLast;
1297
1298 }
1299
1300 }
1301
1302 }
1303
1304 return -1;
1305
1306}
1307
1308
1309
1310
1311
1312
1313template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1314::collection::count string_base_array < Type, RawType, t_etypeContainer > ::count(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast) const
1315{
1316
1317 ::collection::count count = 0;
1318
1319 if (this->prepare_first_last(iFind, iLast))
1320 {
1321
1322 for (; iFind <= iLast; iFind++)
1323 {
1324
1325 if (this->element_at(iFind).order(str) == 0)
1326 {
1327
1328 count++;
1329
1330 }
1331
1332 }
1333
1334 }
1335
1336 return count;
1337
1338}
1339
1340
1341template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1342::collection::count string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_count(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast) const
1343{
1344
1345 ::collection::count count = 0;
1346
1347 if (this->prepare_first_last(iFind, iLast))
1348 {
1349
1350 for (; iFind <= iLast; iFind++)
1351 {
1352
1353 if (this->element_at(iFind).case_insensitive_order(str) == 0)
1354 {
1355
1356 count++;
1357
1358 }
1359
1360 }
1361
1362 }
1363
1364 return count;
1365
1366}
1367
1368
1369
1370
1371template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1372::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_find_last(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast) const
1373{
1374
1375 return case_insensitive_reverse_find(str, iFind, iLast);
1376
1377}
1378
1379
1380template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1381::collection::index string_base_array < Type, RawType, t_etypeContainer > ::find_last(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast) const
1382{
1383
1384 return rear_find(str, iFind, iLast);
1385
1386}
1387
1388
1389template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1390::collection::index string_base_array < Type, RawType, t_etypeContainer > ::_066Find(const SCOPED_STRING& strParam) const
1391{
1392
1393 BASE_RAW_STRING str(strParam);
1394
1395 ::collection::index iSel = this->find_first(str);
1396
1397 if (iSel < 0)
1398 {
1399
1400 iSel = this->case_insensitive_find_first(str);
1401
1402 if (iSel < 0)
1403 {
1404
1405 ::collection::index iHalfLen = (::collection::index)(str.length() / 2);
1406
1407 for (::collection::index iTruncate = (::collection::index)str.length(); iTruncate >= iHalfLen; iTruncate--)
1408 {
1409
1410 str.truncate(iTruncate);
1411
1412 iSel = this->find_first(str);
1413
1414 if (iSel >= 0)
1415 {
1416
1417 break;
1418
1419 }
1420
1421 iSel = this->case_insensitive_find_first(str);
1422
1423 if (iSel >= 0)
1424 {
1425
1426 break;
1427
1428 }
1429
1430 }
1431
1432 }
1433
1434 }
1435
1436 return iSel;
1437
1438}
1439
1440
1441template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1442::collection::index string_base_array < Type, RawType, t_etypeContainer > ::find_first_contains(const SCOPED_STRING& strSubstring, ::collection::index iFind, ::collection::index iLast, const CHARACTER** ppszBeg, const CHARACTER** ppszEnd) const
1443{
1444
1445 if (this->prepare_first_last(iFind, iLast))
1446 {
1447
1448 return _find_first_contains(strSubstring, iFind, iLast, ppszBeg, ppszEnd);
1449
1450 }
1451
1452 return -1;
1453
1454}
1455
1456
1457template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1458::collection::index string_base_array < Type, RawType, t_etypeContainer > ::_find_first_contains(const SCOPED_STRING& strSubstring, ::collection::index iFind, ::collection::index iLast, const CHARACTER** ppszBeg, const CHARACTER** ppszEnd) const
1459{
1460
1461 for (; iFind <= iLast; iFind++)
1462 {
1463
1464 if (this->element_at(iFind).contains(strSubstring, ppszBeg, ppszEnd))
1465 {
1466
1467 return iFind;
1468
1469 }
1470
1471 }
1472
1473 return -1;
1474
1475}
1476
1477
1478
1479
1480template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1481::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_find_first_contains(const SCOPED_STRING& strSubstring, ::collection::index iFind, ::collection::index iLast, const CHARACTER** ppszBeg, const CHARACTER** ppszEnd) const
1482{
1483
1484 if (this->prepare_first_last(iFind, iLast))
1485 {
1486
1487 return _case_insensitive_find_first_contains(strSubstring, iFind, iLast, ppszBeg, ppszEnd);
1488
1489 }
1490
1491 return -1;
1492
1493}
1494
1495
1496template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1497::collection::index string_base_array < Type, RawType, t_etypeContainer > ::_case_insensitive_find_first_contains(const SCOPED_STRING& strSubstring, ::collection::index iFind, ::collection::index iLast, const CHARACTER** ppszBeg, const CHARACTER** ppszEnd) const
1498{
1499
1500 for (; iFind <= iLast; iFind++)
1501 {
1502
1503 if (this->element_at(iFind).case_insensitive_contains(strSubstring, ppszBeg, ppszEnd))
1504 {
1505
1506 return iFind;
1507
1508 }
1509
1510 }
1511
1512 return -1;
1513
1514}
1515
1516
1517template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1518::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_prefix_find_first(const SCOPED_STRING& strTopic, ::collection::index iFind, ::collection::index iLast) const
1519{
1520
1521 if (this->prepare_first_last(iFind, iLast))
1522 {
1523
1524 for (; iFind <= iLast; iFind++)
1525 {
1526
1527 if (strTopic.case_insensitive_begins(this->element_at(iFind)))
1528 {
1529
1530 return iFind;
1531
1532 }
1533
1534 }
1535
1536 }
1537
1538 return -1;
1539
1540}
1541
1542
1543template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1544::collection::index string_base_array < Type, RawType, t_etypeContainer > ::prefix_find_first(const SCOPED_STRING& strTopic, ::collection::index iFind, ::collection::index iLast) const
1545{
1546
1547 if (this->prepare_first_last(iFind, iLast))
1548 {
1549
1550 for (; iFind <= iLast; iFind++)
1551 {
1552
1553 if (strTopic.begins(this->element_at(iFind)))
1554 {
1555
1556 return iFind;
1557
1558 }
1559
1560 }
1561
1562 }
1563
1564 return -1;
1565
1566}
1567
1568
1569
1570
1571template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1572::collection::index string_base_array < Type, RawType, t_etypeContainer > ::substring_find_first(const SCOPED_STRING& strTopic, ::collection::index iFind, ::collection::index iLast, const CHARACTER** ppszBeg, const CHARACTER** ppszEnd) const
1573{
1574
1575 if (this->prepare_first_last(iFind, iLast))
1576 {
1577
1578 for (; iFind <= iLast; iFind++)
1579 {
1580
1581 auto pBeg = strTopic.find(this->element_at(iFind));
1582
1583 if (::is_set(pBeg))
1584 {
1585
1586 if (ppszBeg)
1587 {
1588
1589 *ppszBeg = pBeg;
1590
1591 }
1592
1593 if (ppszEnd)
1594 {
1595
1596 *ppszEnd = pBeg + this->element_at(iFind).size();
1597
1598 }
1599
1600 return iFind;
1601
1602 }
1603
1604 }
1605
1606 }
1607
1608 return -1;
1609
1610}
1611
1612
1613template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1614::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_substring_find_first(const SCOPED_STRING& strTopic, ::collection::index iFind, ::collection::index iLast, const CHARACTER** ppszBeg, const CHARACTER** ppszEnd) const
1615{
1616
1617 if (this->prepare_first_last(iFind, iLast))
1618 {
1619
1620 for (; iFind <= iLast; iFind++)
1621 {
1622
1623 auto pBeg = strTopic.find(this->element_at(iFind));
1624
1625 if (::is_set(pBeg))
1626 {
1627
1628 if (ppszBeg)
1629 {
1630
1631 *ppszBeg = pBeg;
1632
1633 }
1634
1635 if (ppszEnd)
1636 {
1637
1638 *ppszEnd = pBeg + this->element_at(iFind).size();
1639
1640 }
1641
1642 return iFind;
1643
1644 }
1645
1646 }
1647
1648 }
1649
1650 return -1;
1651
1652}
1653
1654
1655
1656
1657template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1658::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_find_first_suffixed(const SCOPED_STRING& strSuffix, ::collection::index iFind, ::collection::index iLast) const
1659{
1660
1661 if (this->prepare_first_last(iFind, iLast))
1662 {
1663
1664 return _case_insensitive_find_first_suffixed(strSuffix, iFind, iLast);
1665
1666 }
1667
1668 return -1;
1669
1670}
1671
1672
1673template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1674::collection::index string_base_array < Type, RawType, t_etypeContainer > ::find_first_suffixed(const SCOPED_STRING& strSuffix, ::collection::index iFind, ::collection::index iLast) const
1675{
1676
1677 if (this->prepare_first_last(iFind, iLast))
1678 {
1679
1680 return _find_first_suffixed(strSuffix, iFind, iLast);
1681
1682 }
1683
1684 return -1;
1685
1686}
1687
1688
1689template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1690::collection::index string_base_array < Type, RawType, t_etypeContainer > ::find_first_begins_eat(Type& strFoundAndEaten, const SCOPED_STRING& strSuffix, ::collection::index iFind, ::collection::index iLast) const
1691{
1692
1693 iFind = find_first_begins(strSuffix, iFind, iLast);
1694
1695 if (iFind < 0)
1696 {
1697
1698 return iFind;
1699
1700 }
1701
1702 strFoundAndEaten = element_at(iFind).substr(strSuffix.size());
1703
1704 return iFind;
1705
1706}
1707
1708
1709template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1710::collection::index string_base_array < Type, RawType, t_etypeContainer > ::find_first_with_starting_word_eat(Type& strFoundAndEaten, const SCOPED_STRING& strStartingWord, ::collection::index iFind, ::collection::index iLast) const
1711{
1712
1713 iFind = find_first_with_starting_word(strStartingWord, iFind, iLast);
1714
1715 if (iFind < 0)
1716 {
1717
1718 return iFind;
1719
1720 }
1721
1722 strFoundAndEaten = element_at(iFind).substr(strStartingWord.size());
1723
1724 return iFind;
1725
1726}
1727
1728
1729template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1730::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_find_first_begins_eat(Type& strFoundAndEaten, const SCOPED_STRING& strPrefix, ::collection::index iFind, ::collection::index iLast) const
1731{
1732
1733 iFind = case_insensitive_find_first_begins(strPrefix, iFind, iLast);
1734
1735 if (iFind < 0)
1736 {
1737
1738 return iFind;
1739
1740 }
1741
1742 strFoundAndEaten = element_at(iFind).substr(strPrefix.size());
1743
1744 return iFind;
1745
1746}
1747
1748
1749
1750
1751template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1752::collection::index string_base_array < Type, RawType, t_etypeContainer > ::find_first_ends_eat(Type& strFoundAndEaten, const SCOPED_STRING& strSuffix, ::collection::index iFind, ::collection::index iLast) const
1753{
1754
1755 iFind = find_first_ends(strSuffix, iFind, iLast);
1756
1757 if (iFind < 0)
1758 {
1759
1760 return iFind;
1761
1762 }
1763
1764 strFoundAndEaten = element_at(iFind).right(strSuffix.size());
1765
1766 return iFind;
1767
1768}
1769
1770
1771template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1772::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_find_first_ends_eat(Type& strFoundAndEaten, const SCOPED_STRING& strSuffix, ::collection::index iFind, ::collection::index iLast) const
1773{
1774
1775 iFind = case_insensitive_find_first_ends(strSuffix, iFind, iLast);
1776
1777 if (iFind < 0)
1778 {
1779
1780 return iFind;
1781
1782 }
1783
1784 strFoundAndEaten = element_at(iFind).right(strSuffix.size());
1785
1786 return iFind;
1787
1788}
1789
1790
1791
1792template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1793::collection::index string_base_array < Type, RawType, t_etypeContainer > ::find_first_contains_eat(Type& strFoundAndEaten, const SCOPED_STRING& strSubstring, ::collection::index iFind, ::collection::index iLast) const
1794{
1795
1796 const CHARACTER* pszBeg = nullptr;
1797
1798 const CHARACTER* pszEnd = nullptr;
1799
1800 iFind = find_first_contains(strSubstring, iFind, iLast, &pszBeg, &pszEnd);
1801
1802 if (iFind < 0)
1803 {
1804
1805 return iFind;
1806
1807 }
1808
1809 const CHARACTER* pszFind = element_at(iFind);
1810
1811 strFoundAndEaten = RawType(pszFind, pszBeg - pszFind) + RawType(pszEnd);
1812
1813 return iFind;
1814
1815}
1816
1817
1818template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1819::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_find_first_contains_eat(Type& strFoundAndEaten, const SCOPED_STRING& strTopic, ::collection::index iFind, ::collection::index iLast) const
1820{
1821
1822 const CHARACTER* pszBeg = nullptr;
1823
1824 const CHARACTER* pszEnd = nullptr;
1825
1826 iFind = case_insensitive_find_first_contains(strTopic, iFind, iLast, &pszBeg, &pszEnd);
1827
1828 if (iFind < 0)
1829 {
1830
1831 return iFind;
1832
1833 }
1834
1835 const CHARACTER* pszFind = element_at(iFind);
1836
1837 strFoundAndEaten = RawType(pszFind, pszBeg - pszFind) + RawType(pszEnd);
1838
1839 return iFind;
1840
1841}
1842
1843
1844template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1845::collection::index string_base_array < Type, RawType, t_etypeContainer > ::find_first_prefixed(const SCOPED_STRING& strPrefix, ::collection::index iFind, ::collection::index iLast) const
1846{
1847
1848 if (this->prepare_first_last(iFind, iLast))
1849 {
1850
1851 return _find_first_prefixed(strPrefix, iFind, iLast);
1852
1853 }
1854
1855 return -1;
1856
1857}
1858
1859
1860template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1861::collection::index string_base_array < Type, RawType, t_etypeContainer > ::find_first_with_starting_word(const SCOPED_STRING& strPrefix, ::collection::index iFind, ::collection::index iLast) const
1862{
1863
1864 if (this->prepare_first_last(iFind, iLast))
1865 {
1866
1867 return _find_first_with_starting_word(strPrefix, iFind, iLast);
1868
1869 }
1870
1871 return -1;
1872
1873}
1874
1875
1876template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1877::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_find_first_prefixed(const SCOPED_STRING& strPrefix, ::collection::index iFind, ::collection::index iLast) const
1878{
1879
1880 if (this->prepare_first_last(iFind, iLast))
1881 {
1882
1883 return _case_insensitive_find_first_prefixed(strPrefix, iFind, iLast);
1884
1885 }
1886
1887 return -1;
1888
1889}
1890
1891
1892template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1893::collection::index string_base_array < Type, RawType, t_etypeContainer > ::_find_first_prefixed(const SCOPED_STRING& strPrefix, ::collection::index iFind, ::collection::index iLast) const
1894{
1895
1896 for (; iFind <= iLast; iFind++)
1897 {
1898
1899 if (this->element_at(iFind).begins(strPrefix))
1900 {
1901
1902 return iFind;
1903
1904 }
1905
1906 }
1907
1908 return -1;
1909
1910}
1911
1912
1913template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1914::collection::index string_base_array < Type, RawType, t_etypeContainer > ::_find_first_with_starting_word(const SCOPED_STRING& strStartingWord, ::collection::index iFind, ::collection::index iLast) const
1915{
1916
1917 for (; iFind <= iLast; iFind++)
1918 {
1919
1920 if (this->element_at(iFind).starts_with_word(strStartingWord))
1921 {
1922
1923 return iFind;
1924
1925 }
1926
1927 }
1928
1929 return -1;
1930
1931}
1932
1933
1934template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1935::collection::index string_base_array < Type, RawType, t_etypeContainer > ::_case_insensitive_find_first_prefixed(const SCOPED_STRING& strPrefix, ::collection::index iFind, ::collection::index iLast) const
1936{
1937
1938 for (; iFind <= iLast; iFind++)
1939 {
1940
1941 if (this->element_at(iFind).case_insensitive_begins(strPrefix))
1942 {
1943
1944 return iFind;
1945
1946 }
1947
1948 }
1949
1950 return -1;
1951
1952}
1953
1954template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1955bool string_base_array < Type, RawType, t_etypeContainer > ::_067CaseInsensitiveContains(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast, ::collection::count countMin, ::collection::count countMax) const
1956{
1957
1958 ::collection::count count = 0;
1959
1960 while ((count < countMin || (countMax >= 0 && count <= countMax)) && (iFind = case_insensitive_find_first(str, iFind, iLast)) >= 0)
1961 {
1962 count++;
1963
1964 }
1965
1966 return count >= countMin && conditional(countMax >= 0, count <= countMax);
1967
1968}
1969
1970
1971template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1972bool string_base_array < Type, RawType, t_etypeContainer > ::_067Contains(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast, ::collection::count countMin, ::collection::count countMax) const
1973{
1974
1975 ::collection::count count = 0;
1976
1977 while ((count < countMin || (countMax >= 0 && count <= countMax)) && (iFind = find_first(str, iFind, iLast)) >= 0)
1978 {
1979
1980 count++;
1981
1982 }
1983
1984 return count >= countMin && conditional(countMax >= 0, count <= countMax);
1985
1986}
1987
1988
1989template < typename Type, typename RawType, ::enum_type t_etypeContainer >
1990bool string_base_array < Type, RawType, t_etypeContainer > ::_067CaseInsensitiveContainsSubstring(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast, ::collection::count countMin, ::collection::count countMax) const
1991{
1992
1993 ::collection::count count = 0;
1994
1995 while ((count < countMin || (countMax >= 0 && count <= countMax)) && (iFind = case_insensitive_find_first_contains(str, iFind, iLast)) >= 0)
1996 {
1997
1998 count++;
1999
2000 }
2001
2002 return count >= countMin && conditional(countMax >= 0, count <= countMax);
2003
2004}
2005
2006
2007template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2008bool string_base_array < Type, RawType, t_etypeContainer > ::_067ContainsSubstring(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast, ::collection::count countMin, ::collection::count countMax) const
2009{
2010
2011 ::collection::count count = 0;
2012
2013 while ((count < countMin || (countMax >= 0 && count <= countMax)) && (iFind = find_first_contains(str, iFind, iLast)) >= 0)
2014 {
2015
2016 count++;
2017
2018 }
2019
2020 return count >= countMin && conditional(countMax >= 0, count <= countMax);
2021
2022}
2023
2024
2025template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2026::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_erase_first(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast)
2027{
2028
2029 if ((iFind = case_insensitive_find_first(str, iFind, iLast)) >= 0)
2030 {
2031
2032 this->erase_at(iFind);
2033
2034 }
2035
2036 return iFind;
2037
2038}
2039
2040
2041template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2042::collection::index string_base_array < Type, RawType, t_etypeContainer > ::erase_first(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast)
2043{
2044
2045 if ((iFind = find_first(str, iFind, iLast)) >= 0)
2046 {
2047
2048 this->erase_at(iFind);
2049
2050 }
2051
2052 return iFind;
2053
2054}
2055
2056
2057template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2058::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_erase_last(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast)
2059{
2060
2061 if ((iFind = case_insensitive_find_last(str, iFind, iLast)) >= 0)
2062 {
2063
2064 this->erase_at(iFind);
2065
2066 }
2067
2068 return iFind;
2069
2070}
2071
2072
2073template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2074::collection::index string_base_array < Type, RawType, t_etypeContainer > ::erase_last(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast)
2075{
2076
2077 if ((iFind = find_last(str, iFind, iLast)) >= 0)
2078 {
2079
2080 this->erase_at(iFind);
2081
2082
2083 }
2084
2085 return iFind;
2086
2087}
2088
2089
2090template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2091::collection::count string_base_array < Type, RawType, t_etypeContainer > ::_067CaseInsensitiveRemove(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast, ::collection::count countMin, ::collection::count countMax)
2092{
2093
2094 ::collection::count count = 0;
2095
2096 if (_067CaseInsensitiveContains(str, iFind, iLast, countMin, countMax))
2097 {
2098
2099 while (conditional(countMax >= 0, count < countMax) && (iFind = case_insensitive_erase_first(str, iFind, iLast)) >= 0)
2100 {
2101
2102 count++;
2103
2104 }
2105
2106 }
2107
2108 return count;
2109
2110}
2111
2112
2113template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2114::collection::count string_base_array < Type, RawType, t_etypeContainer > ::_067Remove(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast, ::collection::count countMin, ::collection::count countMax)
2115{
2116
2117 ::collection::count count = 0;
2118
2119 if (_067Contains(str, iFind, iLast, countMin, countMax))
2120 {
2121
2122 while (conditional(countMax >= 0, count < countMax) && (iFind = erase_first(str, iFind, iLast)) >= 0)
2123 {
2124 count++;
2125
2126 }
2127
2128 }
2129
2130 return count;
2131
2132}
2133
2134
2135template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2136::collection::count string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_erase(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast)
2137{
2138
2139 ::collection::count count = 0;
2140
2141 while ((iFind = case_insensitive_erase_first(str, iFind, iLast)) >= 0)
2142 {
2143
2144 count++;
2145
2146 }
2147
2148 return count;
2149
2150}
2151
2152
2153template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2154::collection::count string_base_array < Type, RawType, t_etypeContainer > ::erase(const SCOPED_STRING& str, ::collection::index iFind, ::collection::index iLast)
2155{
2156
2157 ::collection::count count = 0;
2158
2159 while ((iFind = erase_first(str, iFind, iLast)) >= 0)
2160 {
2161
2162 count++;
2163
2164 }
2165
2166 return count;
2167
2168}
2169
2170
2171
2172template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2173template < prototype_container CONTAINER >
2174::collection::count string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_erase(const CONTAINER & container)
2175{
2176
2177 ::collection::count count = 0;
2178
2179 for (auto & item : container)
2180 {
2181
2182 count += this->case_insensitive_erase(item);
2183
2184 }
2185
2186 return count;
2187
2188}
2189
2190
2191template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2192template < prototype_container CONTAINER >
2193::collection::count string_base_array < Type, RawType, t_etypeContainer > ::erase(const CONTAINER & container)
2194{
2195
2196 ::collection::count count = 0;
2197
2198 for (auto& item : container)
2199 {
2200
2201 count += this->erase(item);
2202
2203 }
2204
2205 return count;
2206
2207}
2208
2209
2210template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2211void string_base_array < Type, RawType, t_etypeContainer > ::trim_left(const SCOPED_STRING& strChars)
2212{
2213 for (::collection::index i = 0; i < this->size(); i++)
2214 {
2215 this->element_at(i).trim_left(strChars);
2216 }
2217}
2218
2219
2220template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2221void string_base_array < Type, RawType, t_etypeContainer > ::trim_right(const SCOPED_STRING& strChars)
2222{
2223 for (::collection::index i = 0; i < this->size(); i++)
2224 {
2225 this->element_at(i).trim_right(strChars);
2226 }
2227}
2228
2229
2230template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2231void string_base_array < Type, RawType, t_etypeContainer > ::trim(const SCOPED_STRING& strChars)
2232{
2233 for (::collection::index i = 0; i < this->size(); i++)
2234 {
2235 this->element_at(i).trim(strChars);
2236 }
2237}
2238
2239
2240
2241template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2242void string_base_array < Type, RawType, t_etypeContainer > ::trim_left()
2243{
2244 for (::collection::index i = 0; i < this->size(); i++)
2245 {
2246 this->element_at(i).trim_left();
2247 }
2248}
2249
2250
2251template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2252void string_base_array < Type, RawType, t_etypeContainer > ::trim_right()
2253{
2254 for (::collection::index i = 0; i < this->size(); i++)
2255 {
2256 this->element_at(i).trim_right();
2257 }
2258}
2259
2260
2261template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2262void string_base_array < Type, RawType, t_etypeContainer > ::trim()
2263{
2264 for (::collection::index i = 0; i < this->size(); i++)
2265 {
2266 this->element_at(i).trim();
2267 }
2268}
2269
2270
2271template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2272::collection::index string_base_array < Type, RawType, t_etypeContainer > ::add_normal(const Type& newElement)
2273
2274{
2275 return string_base_array::add(newElement);
2276
2277}
2278
2279
2280template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2281::collection::count string_base_array < Type, RawType, t_etypeContainer > ::truncate_on_find_character(CHARACTER ch)
2282{
2283
2284 ::collection::count count = 0;
2285
2286 for (::collection::index i = 0; i < this->get_size(); i++)
2287 {
2288
2289 auto pTruncate = this->element_at(i).truncate_on_find_character(ch);
2290
2291 if (::is_set(pTruncate))
2292 {
2293
2294 count++;
2295
2296 }
2297
2298 }
2299
2300 return count;
2301
2302}
2303
2304
2305
2306template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2307::collection::count string_base_array < Type, RawType, t_etypeContainer > ::erase_prefixed(const ::scoped_string & scopedstrPrefix)
2308{
2309
2310
2311 ::collection::count count = 0;
2312
2313 for (::collection::index i = 0; i < this->get_size();)
2314 {
2315
2316 if (this->element_at(i).begins(scopedstrPrefix))
2317 {
2318
2319 this->erase_at(i);
2320
2321 count++;
2322
2323 }
2324 else
2325 {
2326
2327 i++;
2328
2329 }
2330
2331 }
2332
2333 return count;
2334
2335}
2336
2337
2338template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2339::collection::count string_base_array < Type, RawType, t_etypeContainer > ::erase_empty()
2340{
2341
2342 ::collection::count count = 0;
2343
2344 for (::collection::index i = 0; i < this->get_size();)
2345 {
2346
2347 if (this->element_at(i).is_empty())
2348 {
2349
2350 this->erase_at(i);
2351
2352 count++;
2353
2354 }
2355 else
2356 {
2357
2358 i++;
2359
2360 }
2361
2362 }
2363
2364 return count;
2365
2366}
2367
2368
2369template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2370::collection::count string_base_array < Type, RawType, t_etypeContainer > ::erase_empty_begin()
2371{
2372
2373 ::collection::count count = 0;
2374
2375 for (::collection::index i = 0; i < this->get_size();)
2376 {
2377 if (this->element_at(i).is_empty())
2378 {
2379 this->erase_at(i);
2380 count++;
2381 }
2382 else
2383 {
2384 break;
2385 }
2386 }
2387 return count;
2388}
2389
2390template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2391::collection::count string_base_array < Type, RawType, t_etypeContainer > ::erase_empty_end()
2392{
2393
2394 ::collection::count count = 0;
2395 ::collection::index i;
2396 while ((i = this->get_upper_bound()) >= 0)
2397 {
2398 if (this->element_at(i).is_empty())
2399 {
2400 this->erase_at(i);
2401 count++;
2402 }
2403 else
2404 {
2405 break;
2406 }
2407 }
2408 return count;
2409}
2410
2411
2412template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2413::collection::count string_base_array < Type, RawType, t_etypeContainer > ::erase_empty_trimmed_begin()
2414{
2415 ::collection::count count = 0;
2416 for (::collection::index i = 0; i < this->get_size();)
2417 {
2418 if (this->element_at(i).trimmed().is_empty())
2419 {
2420 this->erase_at(i);
2421 count++;
2422 }
2423 else
2424 {
2425 break;
2426 }
2427 }
2428 return count;
2429}
2430
2431template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2432::collection::count string_base_array < Type, RawType, t_etypeContainer > ::erase_empty_trimmed_end()
2433{
2434 ::collection::count count = 0;
2435 ::collection::index i;
2436 while ((i = this->get_upper_bound()) >= 0)
2437 {
2438 if (this->element_at(i).trimmed().is_empty())
2439 {
2440 this->erase_at(i);
2441 count++;
2442 }
2443 else
2444 {
2445 break;
2446 }
2447 }
2448 return count;
2449}
2450
2451
2452//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2453//string_base_array < Type, RawType, t_etypeContainer > & string_base_array < Type, RawType, t_etypeContainer > ::operator =(const i64_array_base & ia)
2454//{
2455//
2456// this->_001CopyContainer(ia);
2457//
2458// return *this;
2459//
2460//}
2461
2462
2463/*::collection::index string_base_array < Type, RawType, t_etypeContainer > ::CountPrefixNoCase(const SCOPED_STRING &strPrefix)
2464
2465{
2466Type str;
2467if(strPrefix != nullptr)
2468
2469str = strPrefix;
2470
2471if(str.is_empty())
2472{
2473return this->get_size();
2474}
2475else
2476{
2477::collection::index iCount = 0;
2478::collection::index iLen = str.length();
2479for(::collection::index i = 0; i < this->get_size(); i++)
2480{
2481Type & strLeft = this->element_at(i).left(iLen);
2482if(strLeft.length() == iLen)
2483{
2484if(case_insensitive_order(strLeft, str) == 0)
2485{
2486iCount++;
2487}
2488}
2489}
2490return iCount;
2491}
2492}*/
2493
2494/*void string_base_array < Type, RawType, t_etypeContainer > ::ExtractPrefixNoSortNoCase(
2495string_base_array < Type, RawType, t_etypeContainer > &stra,
2496const SCOPED_STRING &str,
2497
2498::collection::index iLength,
2499::collection::index iMinLength)
2500{
2501ASSERT(iLength >= iMinLength);
2502erase_all();
2503Type str;
2504if(str != nullptr)
2505
2506str = str;
2507
2508if(str.is_empty())
2509{
2510for(::collection::index i = 0; i < stra.get_size(); i++)
2511{
2512Type & strMid = stra[i].left(iLength);
2513if(strMid.length() >= iMinLength)
2514{
2515if(FindFirstNoSortNoCase(strMid) < 0)
2516{
2517add(strMid);
2518}
2519}
2520}
2521}
2522else
2523{
2524::collection::index iLen = maximum(str.length(), iMinLength);
2525for(::collection::index i = 0; i < stra.get_size(); i++)
2526{
2527Type & strMid = stra[i].left(iLength);
2528if(strMid.length() >= iLen)
2529{
2530if(case_insensitive_order(strMid.left(iLen), str) == 0)
2531{
2532if(FindFirstNoSortNoCase(strMid) < 0)
2533{
2534add(strMid);
2535}
2536}
2537}
2538}
2539}
2540
2541}
2542
2543::collection::index string_base_array < Type, RawType, t_etypeContainer > ::FindFirstNoSortNoCase(const SCOPED_STRING &str)
2544
2545{
2546for(::collection::index i = 0; i < this->get_size(); i++)
2547{
2548if(case_insensitive_order(str, this->element_at(i)) == 0)
2549
2550{
2551return i;
2552}
2553}
2554return -1;
2555}
2556*/
2557
2558
2559
2560//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2561//inline stream & operator << (stream & ostream, string_base_array < Type, RawType, t_etypeContainer > & a)
2562//{
2563//
2564// return ostream.stream_array(a);
2565//
2566//}
2567
2568
2569//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2570//inline stream & operator >> (stream & istream, string_base_array < Type, RawType, t_etypeContainer > & a)
2571//{
2572//
2573// return istream.stream_array(a);
2574//
2575//}
2576
2577
2578
2579
2580
2581
2582template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2583Type string_base_array < Type, RawType, t_etypeContainer > ::implode(const SCOPED_STRING& strSeparator, ::collection::index i, ::collection::count inCountLastOut) const
2584{
2585
2586 Type str;
2587
2588 if (!this->prepare_first_in_count_last_out(i, inCountLastOut))
2589 {
2590
2591 return ::transfer(str);
2592
2593 }
2594
2595 str = this->element_at(i);
2596
2597 if (i == inCountLastOut)
2598 {
2599
2600 return str;
2601
2602 }
2603
2604 while (i < inCountLastOut)
2605 {
2606
2607 i++;
2608
2609 str += strSeparator;
2610
2611 str += this->element_at(i);
2612
2613 }
2614
2615 return ::transfer(str);
2616
2617}
2618
2619
2620template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2621Type string_base_array < Type, RawType, t_etypeContainer > ::postfix_implode(const SCOPED_STRING& strSuffix, ::collection::index i, ::collection::count inCountLastOut) const
2622{
2623
2624 Type str;
2625
2626 if (!this->prepare_first_in_count_last_out(i, inCountLastOut))
2627 {
2628
2629 return ::transfer(str);
2630
2631 }
2632
2633 while (i < inCountLastOut)
2634 {
2635
2636 str += this->element_at(i);
2637
2638 str += strSuffix;
2639
2640 i++;
2641
2642 }
2643
2644 return ::transfer(str);
2645
2646}
2647
2648
2649
2650template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2651Type string_base_array < Type, RawType, t_etypeContainer > ::reverse_implode(const SCOPED_STRING& strSeparator, ::collection::index i, ::collection::count inCountLastOut) const
2652{
2653
2654 Type str;
2655
2656 if (!this->prepare_first_in_count_last_out(i, inCountLastOut))
2657 {
2658
2659 return str;
2660
2661 }
2662
2663 str = this->element_at(inCountLastOut);
2664
2665 if (i == inCountLastOut)
2666 {
2667
2668 return str;
2669
2670 }
2671
2672 while (i < inCountLastOut)
2673 {
2674
2675 inCountLastOut--;
2676
2677 str += strSeparator;
2678
2679 str += this->element_at(inCountLastOut);
2680
2681 }
2682
2683 return str;
2684
2685}
2686
2687
2688template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2689string_base_array < Type, RawType, t_etypeContainer >& string_base_array < Type, RawType, t_etypeContainer > ::explode(const SCOPED_STRING& strSeparator, const SCOPED_STRING& str, bool bAddEmpty)
2690{
2691
2692 this->erase_all();
2693
2694 add_tokens(str, strSeparator, bAddEmpty);
2695
2696 return *this;
2697
2698}
2699
2700
2701template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2702string_base_array < Type, RawType, t_etypeContainer >& string_base_array < Type, RawType, t_etypeContainer > ::_001Explode(const SCOPED_STRING& str)
2703{
2704
2705 this->erase_all();
2706
2707 _001AddTokens(str);
2708
2709 return *this;
2710
2711}
2712
2713
2714template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2715bool string_base_array < Type, RawType, t_etypeContainer > ::operator == (const typename string_base_array < Type, RawType, t_etypeContainer >::BASE_RAW_STRING_ARRAY & a) const
2716{
2717
2718 if (a.get_size() != get_size())
2719 {
2720
2721 return false;
2722
2723 }
2724
2725 for (::collection::index i = 0; i < get_size(); i++)
2726 {
2727
2728 if (a[i] != element_at(i))
2729 {
2730
2731 return false;
2732
2733 }
2734
2735 }
2736
2737 return true;
2738
2739}
2740
2741
2742template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2743bool string_base_array < Type, RawType, t_etypeContainer > ::operator != (const typename string_base_array < Type, RawType, t_etypeContainer >::BASE_RAW_STRING_ARRAY & a) const
2744{
2745
2746 return !operator == (a);
2747
2748}
2749
2750
2751template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2752void string_base_array < Type, RawType, t_etypeContainer > ::replace_with(const SCOPED_STRING& strNew, const SCOPED_STRING& strOld)
2753{
2754
2755 for (::collection::index i = 0; i < this->get_size(); i++)
2756 {
2757
2758 this->element_at(i).replace_with(strNew, strOld);
2759
2760 }
2761
2762}
2763
2764
2765
2766
2767
2768template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2769void string_base_array < Type, RawType, t_etypeContainer > ::surround(const SCOPED_STRING& strPrefix, const SCOPED_STRING& strSuffix, ::collection::index iStart, ::collection::count inCountLastOut)
2770{
2771
2772 if (!this->prepare_first_in_count_last_out(iStart, inCountLastOut))
2773 {
2774
2775 return;
2776
2777 }
2778
2779 //Type strPrefix(strPrefix);
2780
2781 //Type strSuffix(strSuffix);
2782
2783 for (::collection::index i = iStart; i <= inCountLastOut; i++)
2784 {
2785
2786 this->element_at(i) = strPrefix + this->element_at(i) + strSuffix;
2787
2788 }
2789
2790}
2791
2792
2793template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2794Type string_base_array < Type, RawType, t_etypeContainer > ::surround_and_implode(const SCOPED_STRING& scopedstrSeparator, const SCOPED_STRING& scopedstrPrefix, const SCOPED_STRING& scopedstrSuffix, ::collection::index iStart, ::collection::count inCountLastOut)
2795{
2796
2797 Type str;
2798
2799 if (this->prepare_first_in_count_last_out(iStart, inCountLastOut))
2800 {
2801
2802 Type strSeparator(scopedstrSeparator);
2803 Type strPrefix(scopedstrPrefix);
2804 Type strSuffix(scopedstrSuffix);
2805
2806 str = strPrefix + this->element_at(iStart) + strSuffix;
2807
2808 iStart++;
2809
2810 for (::collection::index i = iStart; i <= inCountLastOut; i++)
2811 {
2812
2813 str += strSeparator + strPrefix + this->element_at(i) + strSuffix;
2814
2815 }
2816
2817 }
2818
2819 return str;
2820
2821}
2822
2823
2824//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2825//string_base_array < Type, RawType, t_etypeContainer > & string_base_array < Type, RawType, t_etypeContainer > ::operator -=(const string_base_array & stra)
2826//{
2827//
2828// erase(stra);
2829//
2830// return *this;
2831//
2832//}
2833
2834
2835//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2836//string_base_array < Type, RawType, t_etypeContainer > & string_base_array < Type, RawType, t_etypeContainer > ::operator +=(const string_base_array & stra)
2837//{
2838//
2839// add(stra);
2840//
2841// return *this;
2842//
2843//}
2844
2845
2846//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2847//string_base_array < Type, RawType, t_etypeContainer > string_base_array < Type, RawType, t_etypeContainer > ::operator -(const string_base_array & straParam) const
2848//{
2849// string_base_array < Type, RawType, t_etypeContainer > stra(*this);
2850// stra -= straParam;
2851// return stra;
2852//}
2853
2854
2855//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2856//string_base_array < Type, RawType, t_etypeContainer > string_base_array < Type, RawType, t_etypeContainer > ::operator +(const string_base_array & straParam) const
2857//{
2858// string_base_array < Type, RawType, t_etypeContainer > stra(*this);
2859// stra += straParam;
2860// return stra;
2861//}
2862
2863
2864
2865
2866
2867
2868template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2869bool string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_move(const SCOPED_STRING& str, ::collection::index iIndex)
2870
2871{
2872 ::collection::index i = case_insensitive_find_first(str);
2873
2874 if (i < 0)
2875 return false;
2876 this->erase_at(i);
2877 insert_at(iIndex, str);
2878
2879 return true;
2880}
2881
2882
2883template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2884bool string_base_array < Type, RawType, t_etypeContainer > ::preferred(const SCOPED_STRING& str)
2885
2886{
2887 return case_insensitive_move(str, 0);
2888
2889}
2890
2891
2892template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2893::collection::count string_base_array < Type, RawType, t_etypeContainer > ::preferred(string_base_array < Type, RawType, t_etypeContainer >& stra)
2894{
2895 ::collection::count count = 0;
2896 for (::collection::index i = stra.get_upper_bound(); i >= 0; i--)
2897 {
2898 if (preferred(stra[i]))
2899 count++;
2900 }
2901 return count;
2902}
2903
2904
2905
2906template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2907Type string_base_array < Type, RawType, t_etypeContainer > ::pop(::collection::index i)
2908{
2909 i = get_upper_bound(i);
2910 Type strRet = this->element_at(i);
2911 this->erase_at(i);
2912 return strRet;
2913}
2914
2915
2916template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2917void string_base_array < Type, RawType, t_etypeContainer > ::slice(string_base_array < Type, RawType, t_etypeContainer >& stra, ::collection::index iOffset, ::collection::count count)
2918{
2919
2920 ::collection::index iEnd;
2921
2922 if (count < 0)
2923 iEnd = get_upper_bound(count);
2924 else
2925 iEnd = iOffset + count - 1;
2926
2927 for (::collection::index i = iOffset; i <= iEnd; i++)
2928 {
2929 stra.add(this->element_at(i));
2930 }
2931
2932}
2933
2934
2935template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2936void string_base_array < Type, RawType, t_etypeContainer > ::erase(::collection::index iOffset, ::collection::count count)
2937{
2938
2939 for (::collection::index i = iOffset + count - 1; i >= iOffset; i--)
2940 {
2941
2942 this->erase_at(i);
2943
2944 }
2945}
2946
2947
2948
2949template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2950void string_base_array < Type, RawType, t_etypeContainer > ::splice(const string_base_array < Type, RawType, t_etypeContainer >& stra, ::collection::index iOffset, ::collection::count count)
2951{
2952
2953 erase(iOffset, count);
2954
2955 insert_at(iOffset, stra);
2956
2957}
2958
2959
2960
2961template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2962void string_base_array < Type, RawType, t_etypeContainer > ::splice(const string_base_array < Type, RawType, t_etypeContainer >& stra, ::collection::index iOffset, string_base_array < Type, RawType, t_etypeContainer >& straRemoved, ::collection::count count)
2963{
2964
2965 slice(straRemoved, iOffset, count);
2966
2967 erase(iOffset, count);
2968
2969 insert_at(iOffset, stra);
2970
2971}
2972
2973
2974
2975template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2976bool string_base_array < Type, RawType, t_etypeContainer > ::is_empty(::collection::count countMinimum) const
2977{
2978
2979 return this->get_size() < countMinimum;
2980
2981}
2982
2983
2984template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2985bool string_base_array < Type, RawType, t_etypeContainer > ::has_elements(::collection::count countMinimum) const
2986{
2987
2988
2989 return this->get_count() >= countMinimum;
2990}
2991
2992
2993//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
2994//::collection::count string_base_array < Type, RawType, t_etypeContainer > ::begins(string_base_array < Type, RawType, t_etypeContainer > & straPrefixed, const SCOPED_STRING &strPrefix, ::collection::index iFirst, ::collection::index iLast)
2995//{
2996//
2997// ::collection::count count = 0;
2998//
2999// if (this->prepare_first_last(iFirst, iLast))
3000// {
3001//
3002// while (true)
3003// {
3004//
3005// iFirst = _find_first_prefixed(strPrefix, iFirst, iLast);
3006//
3007// if (iFirst < 0)
3008// {
3009//
3010// return count;
3011//
3012// }
3013//
3014// straPrefixed.add(this->element_at(iFirst));
3015//
3016// iFirst++;
3017//
3018// count++;
3019//
3020// }
3021//
3022// }
3023//
3024// return count;
3025//
3026//}
3027//
3028//
3029//
3030//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3031//::collection::count string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_begins(string_base_array < Type, RawType, t_etypeContainer > & straPrefixed,const SCOPED_STRING &strPrefix,::collection::index iFirst,::collection::index iLast)
3032//{
3033//
3034// ::collection::count count = 0;
3035//
3036// if (this->prepare_first_last(iFirst, iLast))
3037// {
3038//
3039// while(true)
3040// {
3041//
3042// iFirst = case_insensitive_find_first_begins(strPrefix,iFirst,iLast);
3043//
3044// if (iFirst < 0)
3045// {
3046//
3047// return count;
3048//
3049// }
3050//
3051// straPrefixed.add(this->element_at(iFirst));
3052//
3053// iFirst++;
3054//
3055// count++;
3056//
3057// }
3058//
3059// }
3060//
3061// return count;
3062//
3063//}
3064//
3065//
3066//
3067
3068
3069template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3070template < prototype_array INDEX_ARRAY >
3071::collection::count string_base_array < Type, RawType, t_etypeContainer > ::begins(INDEX_ARRAY& iaPrefixed, const SCOPED_STRING& strPrefix, ::collection::index iFirst, ::collection::index iLast)
3072{
3073
3074 ::collection::count count = 0;
3075
3076 if (this->prepare_first_last(iFirst, iLast))
3077 {
3078
3079 while (true)
3080 {
3081
3082 iFirst = _find_first_prefixed(strPrefix, iFirst, iLast);
3083
3084 if (iFirst < 0)
3085 {
3086
3087 return count;
3088
3089 }
3090
3091 iaPrefixed.add(this->element_at(iFirst));
3092
3093 iFirst++;
3094
3095 count++;
3096
3097 }
3098
3099 }
3100
3101 return count;
3102
3103}
3104
3105
3106
3107template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3108template < prototype_array INDEX_ARRAY >
3109::collection::count string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_begins(INDEX_ARRAY& iaPrefixed, const SCOPED_STRING& strPrefix, ::collection::index iFirst, ::collection::index iLast)
3110{
3111
3112 ::collection::count count = 0;
3113
3114 if (this->prepare_first_last(iFirst, iLast))
3115 {
3116
3117 while (true)
3118 {
3119
3120 iFirst = _case_insensitive_find_first_prefixed(strPrefix, iFirst, iLast);
3121
3122 if (iFirst < 0)
3123 {
3124
3125 return count;
3126
3127 }
3128
3129 iaPrefixed.add(iFirst);
3130
3131 iFirst++;
3132
3133 count++;
3134
3135 }
3136
3137 }
3138
3139 return count;
3140
3141}
3142
3143
3144
3145//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3146//::collection::count string_base_array < Type, RawType, t_etypeContainer > ::ends(string_base_array < Type, RawType, t_etypeContainer >& straSuffixed, const SCOPED_STRING &strSuffix, ::collection::index iFirst, ::collection::index iLast)
3147//{
3148//
3149// ::collection::count count = 0;
3150//
3151// if (this->prepare_first_last(iFirst, iLast))
3152// {
3153//
3154// while (true)
3155// {
3156//
3157// iFirst = find_first_ends(strSuffix, iFirst, iLast);
3158//
3159// if (iFirst < 0)
3160// {
3161//
3162// return count;
3163//
3164// }
3165//
3166// straSuffixed.add(this->element_at(iFirst));
3167//
3168// iFirst++;
3169//
3170// count++;
3171//
3172// }
3173//
3174// }
3175//
3176// return count;
3177//
3178//}
3179
3180
3181template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3182template < prototype_array STRING_ARRAY >
3183::collection::count string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_ends(STRING_ARRAY& straSuffixed, const SCOPED_STRING& strSuffix, ::collection::index iFirst, ::collection::index iLast)
3184{
3185
3186 ::collection::count count = 0;
3187
3188 if (this->prepare_first_last(iFirst, iLast))
3189 {
3190
3191 while (true)
3192 {
3193
3194 iFirst = _case_insensitive_find_first_suffixed(strSuffix, iFirst, iLast);
3195
3196 if (iFirst < 0)
3197 {
3198
3199 return count;
3200
3201 }
3202
3203 straSuffixed.add(this->element_at(iFirst));
3204
3205 iFirst++;
3206
3207 count++;
3208
3209 }
3210
3211 }
3212
3213 return count;
3214
3215}
3216
3217
3218
3219
3220template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3221template < prototype_array STRING_ARRAY >
3222::collection::count string_base_array < Type, RawType, t_etypeContainer > ::ends(STRING_ARRAY& iaSuffixed, const SCOPED_STRING& strSuffix, ::collection::index iFirst, ::collection::index iLast)
3223{
3224
3225 ::collection::count count = 0;
3226
3227 if (this->prepare_first_last(iFirst, iLast))
3228 {
3229
3230 while (true)
3231 {
3232
3233 iFirst = _find_first_suffixed(strSuffix, iFirst, iLast);
3234
3235 if (iFirst < 0)
3236 {
3237
3238 return count;
3239
3240 }
3241
3242 iaSuffixed.add(this->element_at(iFirst));
3243
3244 iFirst++;
3245
3246 count++;
3247
3248 }
3249
3250 }
3251
3252 return count;
3253
3254}
3255
3256
3257
3258//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3259//::collection::count string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_ends(index_array & iaSuffixed, const SCOPED_STRING &strSuffix, ::collection::index iFirst, ::collection::index iLast)
3260//{
3261//
3262// ::collection::count count = 0;
3263//
3264// if (this->prepare_first_last(iFirst, iLast))
3265// {
3266//
3267// while (true)
3268// {
3269//
3270// iFirst = _case_insensitive_find_first_suffixed(strSuffix, iFirst, iLast);
3271//
3272// if (iFirst < 0)
3273// {
3274//
3275// return count;
3276//
3277// }
3278//
3279// iaSuffixed.add(iFirst);
3280//
3281// iFirst++;
3282//
3283// count++;
3284//
3285// }
3286//
3287// }
3288//
3289// return count;
3290//
3291//}
3292//
3293//
3294//
3295//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3296//::collection::count string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_search(string_base_array < Type, RawType, t_etypeContainer > & stra, const SCOPED_STRING &str, ::collection::index iFirst, ::collection::index iLast)
3297//{
3298//
3299// ::collection::count count = 0;
3300//
3301// if (this->prepare_first_last(iFirst, iLast))
3302// {
3303//
3304// while (true)
3305// {
3306//
3307// iFirst = _case_insensitive_find_first_contains(str, iFirst, iLast);
3308//
3309// if (iFirst < 0)
3310// {
3311//
3312// return count;
3313//
3314// }
3315//
3316// stra.add(this->element_at(iFirst));
3317//
3318// iFirst++;
3319//
3320// count++;
3321//
3322// }
3323//
3324// }
3325//
3326// return count;
3327//
3328//}
3329//
3330//
3331//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3332//::collection::count string_base_array < Type, RawType, t_etypeContainer > ::search(string_base_array < Type, RawType, t_etypeContainer > & stra, const SCOPED_STRING &str, ::collection::index iFirst, ::collection::index iLast)
3333//{
3334//
3335// ::collection::count count = 0;
3336//
3337// if (this->prepare_first_last(iFirst, iLast))
3338// {
3339//
3340// while (true)
3341// {
3342//
3343// iFirst = _find_first_contains(str, iFirst, iLast);
3344//
3345// if (iFirst < 0)
3346// {
3347//
3348// return count;
3349//
3350// }
3351//
3352// stra.add(this->element_at(iFirst));
3353//
3354// iFirst++;
3355//
3356// count++;
3357//
3358// }
3359//
3360// }
3361//
3362// return count;
3363//
3364//}
3365
3366template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3367template < prototype_array STRING_ARRAY >
3368::collection::count string_base_array < Type, RawType, t_etypeContainer > ::search(STRING_ARRAY& iaResult, const SCOPED_STRING& strTopic, ::collection::index iFirst, ::collection::index iLast)
3369{
3370
3371 ::collection::count count = 0;
3372
3373 if (this->prepare_first_last(iFirst, iLast))
3374 {
3375
3376 while (true)
3377 {
3378
3379 iFirst = _find_first_contains(strTopic, iFirst, iLast);
3380
3381 if (iFirst < 0)
3382 {
3383
3384 return count;
3385
3386 }
3387
3388 iaResult.add(iFirst);
3389
3390 iFirst++;
3391
3392 count++;
3393
3394 }
3395
3396 }
3397
3398 return count;
3399
3400}
3401
3402
3403
3404template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3405template < prototype_array STRING_ARRAY >
3406::collection::count string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_search(STRING_ARRAY& ia, const SCOPED_STRING& strTopic, ::collection::index iFirst, ::collection::index iLast)
3407{
3408
3409 ::collection::count count = 0;
3410
3411 if (this->prepare_first_last(iFirst, iLast))
3412 {
3413
3414 while (true)
3415 {
3416
3417 iFirst = _case_insensitive_find_first_contains(strTopic, iFirst, iLast);
3418
3419 if (iFirst < 0)
3420 {
3421
3422 return count;
3423
3424 }
3425
3426 ia.add(iFirst);
3427
3428 iFirst++;
3429
3430 count++;
3431
3432 }
3433
3434 }
3435
3436 return count;
3437
3438}
3439
3440
3441
3442template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3443::collection::count string_base_array < Type, RawType, t_etypeContainer > ::filter_begins(const SCOPED_STRING& str, ::collection::index iFirst, ::collection::index iLast)
3444{
3445
3446 ::collection::count count = 0;
3447
3448 if (this->prepare_first_last(iFirst, iLast))
3449 {
3450
3451 ::collection::index i = iFirst;
3452
3453 ::collection::index iFind;
3454
3455 while (true)
3456 {
3457
3458 iFind = find_first_begins(str, i, iLast);
3459
3460 if (iFind < 0)
3461 {
3462
3463 this->erase_at(i, iLast - i + 1);
3464
3465 return count;
3466
3467 }
3468
3469 this->erase_at(i, iFind - i);
3470
3471 iLast -= iFind - i;
3472
3473 i++;
3474
3475 count++;
3476
3477 }
3478
3479 }
3480
3481 return count;
3482
3483}
3484
3485
3486template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3487::collection::count string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_filter_begins(const SCOPED_STRING& str, ::collection::index iFirst, ::collection::index iLast)
3488{
3489
3490 ::collection::count count = 0;
3491
3492 if (this->prepare_first_last(iFirst, iLast))
3493 {
3494
3495 ::collection::index i = iFirst;
3496
3497 ::collection::index iFind;
3498
3499 while (true)
3500 {
3501
3502 iFind = case_insensitive_find_first_begins(str, i, iLast);
3503
3504 if (iFind < 0)
3505 {
3506
3507 this->erase_at(i, iLast - i + 1);
3508
3509 return count;
3510
3511 }
3512
3513 this->erase_at(i, iFind - i);
3514
3515 iLast -= iFind - i;
3516
3517 i++;
3518
3519 count++;
3520
3521 }
3522
3523 }
3524
3525 return count;
3526
3527}
3528
3529
3530template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3531template < typename Pred >
3532::collection::count string_base_array < Type, RawType, t_etypeContainer > ::filter(Pred pred, ::collection::index iFirst, ::collection::index iLast)
3533{
3534
3535 ::collection::count count = 0;
3536
3537 if (this->prepare_first_last(iFirst, iLast))
3538 {
3539
3540 for (::collection::index i = iFirst; i <= iLast;)
3541 {
3542
3543 if (pred(element_at(i)))
3544 {
3545
3546 i++;
3547
3548 }
3549 else
3550 {
3551
3552 this->erase_at(i);
3553
3554 count++;
3555
3556 iLast--;
3557
3558 }
3559
3560 }
3561
3562 }
3563
3564 return count;
3565
3566}
3567
3568
3569template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3570template < typename Pred >
3571::collection::count string_base_array < Type, RawType, t_etypeContainer > ::filter_out(Pred pred, ::collection::index iFirst, ::collection::index iLast)
3572{
3573
3574 ::collection::count count = 0;
3575
3576 if (this->prepare_first_last(iFirst, iLast))
3577 {
3578
3579 for (::collection::index i = iFirst; i <= iLast;)
3580 {
3581
3582 if (!pred(element_at(i)))
3583 {
3584
3585 i++;
3586
3587 }
3588 else
3589 {
3590
3591 this->erase_at(i);
3592
3593 count++;
3594
3595 iLast--;
3596
3597 }
3598
3599 }
3600
3601 }
3602
3603 return count;
3604
3605}
3606
3607
3608template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3609template < typename Pred, typename ArrayOut >
3610::collection::count string_base_array < Type, RawType, t_etypeContainer > ::filter_out(Pred pred, ArrayOut& a, ::collection::index iFirst, ::collection::index iLast)
3611{
3612
3613 ::collection::count count = 0;
3614
3615 if (this->prepare_first_last(iFirst, iLast))
3616 {
3617
3618 for (::collection::index i = iFirst; i <= iLast;)
3619 {
3620
3621 if (!pred(element_at(i)))
3622 {
3623
3624 i++;
3625
3626 }
3627 else
3628 {
3629
3630 a.add(this->element_at(i));
3631
3632 this->erase_at(i);
3633
3634 count++;
3635
3636 iLast--;
3637
3638 }
3639
3640 }
3641
3642 }
3643
3644 return count;
3645
3646}
3647
3648
3649template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3650::collection::index string_base_array < Type, RawType, t_etypeContainer > ::get_random_index() const
3651{
3652
3653 if (this->is_empty())
3654 {
3655
3656 return -1;
3657
3658 }
3659
3660 return (::collection::index)(rand() % get_size());
3661
3662}
3663
3664
3665template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3666Type& string_base_array < Type, RawType, t_etypeContainer > ::random_element()
3667{
3668
3669 if (this->is_empty())
3670 {
3671
3672 throw_exception(error_wrong_state, "invalid call");
3673
3674 }
3675
3676 return this->element_at(get_random_index());
3677
3678}
3679
3680
3681template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3682const Type& string_base_array < Type, RawType, t_etypeContainer > ::random_element() const
3683{
3684
3685 if (this->is_empty())
3686 {
3687
3688 throw_exception(error_wrong_state, "invalid call");
3689
3690 }
3691
3692 return this->element_at(get_random_index());
3693
3694}
3695
3696
3697template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3698Type string_base_array < Type, RawType, t_etypeContainer > ::pop_random_element()
3699{
3700
3701 if (this->is_empty())
3702 {
3703
3704 throw_exception(error_wrong_state, "invalid call");
3705
3706 }
3707
3708 ::collection::index i = get_random_index();
3709
3710 Type str = this->element_at(i);
3711
3712 this->erase_at(i);
3713
3714 return str;
3715
3716}
3717
3718
3719template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3720void string_base_array < Type, RawType, t_etypeContainer > ::make_lower()
3721{
3722
3723 for (::collection::index i = 0; i < this->get_count(); i++)
3724 {
3725
3726 this->element_at(i).make_lower();
3727
3728 }
3729
3730}
3731
3732
3733template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3734void string_base_array < Type, RawType, t_etypeContainer > ::make_upper()
3735{
3736
3737 for (::collection::index i = 0; i < this->get_count(); i++)
3738 {
3739
3740 this->element_at(i).make_upper();
3741
3742 }
3743
3744}
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3755Type string_base_array < Type, RawType, t_etypeContainer > ::encode_v16()
3756{
3757 //Type strEncode;
3758 //for(::collection::index u = 0; u < this->get_count(); u++)
3759 //{
3760 // Type & str = this->element_at(u);
3761 // strEncode += hex::lower_from((const_char_pointer )str,str.length());
3762 // strEncode += "00";
3763 // /* for(::collection::index uj = 0; uj < str.size(); uj++)
3764 // {
3765 // ::i8 sz[32];
3766 // ansi_from_i64(sz, str[uj], 16);
3767 // if(ansi_length(sz) == 0)
3768 // {
3769 // strEncode += "00";
3770 // }
3771 // else if(ansi_length(sz) == 1)
3772 // {
3773 // strEncode += "0";
3774 // strEncode += sz;
3775 // }
3776 // else if(ansi_length(sz) == 2)
3777 // {
3778 // strEncode += sz;
3779 // }
3780 // }*/
3781
3782 //}
3783 //return strEncode;
3784
3785 return Type();
3786
3787}
3788
3789
3790
3791
3792template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3793void string_base_array < Type, RawType, t_etypeContainer > ::decode_v16(const SCOPED_STRING& str)
3794{
3795 //::collection::index iSize = 1024;
3796 //char_pointer str = nullptr;
3797 //if(scopedstr == nullptr)
3798 // return;
3799 //while(*psz != '\0')
3800 //{
3801 // psz++;
3802 // if(*psz == '\0')
3803 // break;
3804 // ::i8 sz[3];
3805 // sz[0] = psz[-1];
3806 // sz[1] = psz[0];
3807 // sz[2] = '\0';
3808 // const SCOPED_STRING &strEnd;
3809 // ::collection::index iConversion = ::ansi_to_int(sz,&pszEnd,16);
3810 // ::i8 ch = static_cast <::i8> (iConversion);
3811 // if(ch == '\0')
3812 // {
3813 // add(str);
3814 // str = nullptr;
3815 // iSize = 1024;
3816 // }
3817 // else
3818 // {
3819 // if(str == nullptr)
3820 // {
3821 // str = (char_pointer )::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->allocate(iSize);
3822 // }
3823 // else if(iSize < (ansi_length(str) + 1))
3824 // {
3825 // char_pointer strOld = str;
3826 // iSize += 1024;
3827 // char_pointer strNew = (char_pointer )::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->allocate(iSize);
3828 // ansi_copy(strNew,strOld);
3829 // str = strNew;
3830 // }
3831 // sz[0] = ch;
3832 // sz[1] = '\0';
3833 // ansi_copy(str,sz);
3834 // }
3835 // psz++;
3836 //}
3837
3838}
3839
3840
3841
3842
3843template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3844inline ::collection::count string_base_array < Type, RawType, t_etypeContainer >::count_except(const SCOPED_STRING& str)
3845{
3846
3847 ::collection::count c = get_count();
3848
3849 for (::collection::index i = 0; i < get_count(); i++)
3850 {
3851
3852 if (this->element_at(i).order(str) == 0)
3853 {
3854
3855 c--;
3856
3857 }
3858
3859 }
3860
3861 return c;
3862
3863}
3864
3865template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3866inline ::collection::count string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_count_except(const SCOPED_STRING& str)
3867{
3868
3869 ::collection::count c = get_count();
3870
3871 for (::collection::index i = 0; i < get_count(); i++)
3872 {
3873
3874 if (this->element_at(i).case_insensitive_order(str) == 0)
3875 {
3876
3877 c--;
3878
3879 }
3880
3881 }
3882
3883 return c;
3884
3885}
3886
3887
3888
3889template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3890::collection::count string_base_array < Type, RawType, t_etypeContainer > ::count_except(const string_base_array < Type, RawType, t_etypeContainer >& stra)
3891{
3892
3893 ::collection::count c = get_count();
3894
3895 for (::collection::index i = 0; i < get_count(); i++)
3896 {
3897
3898 if (stra.contains(element_at(i)))
3899 {
3900
3901 c--;
3902
3903 }
3904
3905 }
3906
3907 return c;
3908
3909}
3910
3911
3912
3913
3914template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3915::collection::count string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_count_except(const string_base_array < Type, RawType, t_etypeContainer >& stra)
3916{
3917
3918 ::collection::count c = get_count();
3919
3920 for (::collection::index i = 0; i < get_count(); i++)
3921 {
3922
3923 if (stra.case_insensitive_contains(element_at(i)))
3924 {
3925
3926 c--;
3927
3928 }
3929
3930 }
3931
3932 return c;
3933
3934}
3935
3936
3937
3938template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3939Type& string_base_array < Type, RawType, t_etypeContainer > ::get_network_payload(Type& str, bool bNewLine) const
3940{
3941
3942 str += "[";
3943
3944 if (get_count() > 0)
3945 {
3946
3947 str += "\"";
3948
3949 str += element_at(0);
3950
3951 str += "\"";
3952
3953 }
3954
3955 for (::collection::index i = 1; i < get_count(); i++)
3956 {
3957
3958 if (bNewLine)
3959 {
3960
3961 str += ", \r\n";
3962
3963 }
3964 else
3965 {
3966
3967 str += ", ";
3968
3969 }
3970
3971 str += "\"";
3972
3973 str += element_at(i);
3974
3975 str += "\"";
3976
3977 }
3978
3979 if (bNewLine)
3980 {
3981
3982 str += "\r\n";
3983
3984 }
3985
3986 str += "]";
3987
3988 return str;
3989
3990}
3991
3992
3993
3994
3995
3996template < typename Type, typename RawType, ::enum_type t_etypeContainer >
3997Type string_base_array < Type, RawType, t_etypeContainer > ::_008Implode(const SCOPED_STRING& strSeparator, const SCOPED_STRING& strLastSeparator, ::collection::index iStart, ::collection::count inCountLastOut) const
3998{
3999
4000 Type str;
4001
4002 if (!this->prepare_first_in_count_last_out(iStart, inCountLastOut))
4003 {
4004
4005 return str;
4006
4007 }
4008
4009 for (::collection::index i = iStart; i <= inCountLastOut; i++)
4010 {
4011
4012 if (i > iStart)
4013 {
4014
4015 if (i == inCountLastOut)
4016 {
4017
4018 str += strLastSeparator;
4019
4020 }
4021 else
4022 {
4023
4024 str += strSeparator;
4025
4026 }
4027
4028 }
4029
4030 str += this->element_at(i);
4031
4032 }
4033
4034 return str;
4035
4036}
4037
4038
4039
4040template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4041Type string_base_array < Type, RawType, t_etypeContainer > ::_008IfImplode(const SCOPED_STRING& strIfHasElementPrefix, const SCOPED_STRING& strSeparator, const SCOPED_STRING& strLastSeparator, bool bUseLast, ::collection::index iStart, ::collection::count inCountLastOut) const
4042{
4043
4044 Type str;
4045
4046 if (!this->prepare_first_in_count_last_out(iStart, inCountLastOut))
4047 {
4048
4049 return str;
4050
4051 }
4052
4053 if (inCountLastOut >= iStart)
4054 {
4055
4056 str += strIfHasElementPrefix;
4057
4058 }
4059
4060 for (::collection::index i = iStart; i <= inCountLastOut; i++)
4061 {
4062
4063 if (i > iStart)
4064 {
4065
4066 if (i == inCountLastOut && bUseLast)
4067 {
4068
4069 str += strLastSeparator;
4070
4071 }
4072 else
4073 {
4074
4075 str += strSeparator;
4076
4077 }
4078
4079 }
4080
4081 str += this->element_at(i);
4082
4083 }
4084
4085 return str;
4086
4087}
4088
4089
4090//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4091//Type string_base_array < Type, RawType, t_etypeContainer > ::_008IfImplode(const SCOPED_STRING &strIfHasElementPrefix, const SCOPED_STRING &strSeparator, const SCOPED_STRING &strLastSeparator, bool bUseLast, ::collection::index iStart, ::collection::index iEnd) const
4092//{
4093//
4094// Type str;
4095//
4096// _008IfImplode(str, strIfHasElementPrefix, strSeparator, strLastSeparator, bUseLast, iStart, iEnd);
4097//
4098// return str;
4099//
4100//}
4101
4102
4103
4104
4105template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4106::array_base < const ::ansi_character* > string_base_array < Type, RawType, t_etypeContainer > ::c_ansi_get(bool bMemoryAlloc) const
4107{
4108
4109 ::array_base < const ::ansi_character* > psza;
4110
4111 for (::collection::index i = 0; i < get_size(); i++)
4112 {
4113
4114 char_pointer psz = nullptr;
4115
4116 if (bMemoryAlloc)
4117 {
4118
4119 psz = ansi_duplicate(element_at(i));
4120
4121 }
4122 else
4123 {
4124
4125 psz = libc_strdup(element_at(i));
4126
4127 }
4128
4129 psza.add(psz);
4130
4131 }
4132
4133 return psza;
4134
4135}
4136
4137
4138//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4139//::array < const ::wide_character * > string_base_array < Type, RawType, t_etypeContainer > ::c_wide_get(bool bMemoryAlloc) const
4140//{
4141//
4142// ::array < const ::wide_character * > psza;
4143//
4144// for (::collection::index i = 0; i < get_size(); i++)
4145// {
4146//
4147// ::wide_character * pwsz = nullptr;
4148//
4149// if(bMemoryAlloc)
4150// {
4151//
4152// pwsz = wide_duplicate(wstring(element_at(i)));
4153//
4154// }
4155// else
4156// {
4157//
4158// pwsz = wcsdup(wstring(element_at(i)));
4159//
4160//
4161// }
4162//
4163// psza.add(pwsz);
4164//
4165// }
4166//
4167// return psza;
4168//
4169//}
4170
4171
4173template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4174void string_base_array < Type, RawType, t_etypeContainer > ::c_add(char_pointer * ppsz, ::collection::count c, bool bMemoryAlloc)
4175{
4176
4177 for (::collection::index i = 0; i < c; i++)
4178 {
4179
4180 auto psz = ppsz[i];
4181
4182 auto str = Type(psz);
4183
4184 this->add(str);
4185
4186 if (bMemoryAlloc)
4187 {
4188
4189 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(psz);
4190
4191 }
4192 else
4193 {
4194
4195 free(psz);
4196
4197 }
4198
4199 }
4200
4201 if (ppsz != nullptr)
4202 {
4203
4204 if (bMemoryAlloc)
4205 {
4206
4207 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(ppsz);
4208
4209 }
4210 else
4211 {
4212
4213 free(ppsz);
4214
4215 }
4216
4217 }
4218
4219}
4220
4221
4222
4223
4225template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4226void string_base_array < Type, RawType, t_etypeContainer > ::c_add(char_pointer * ppszParam, bool bMemoryAlloc)
4227{
4228
4229 auto ppsz = ppszParam;
4230
4231 while (ppsz != nullptr)
4232 {
4233
4234 auto psz = *ppsz;
4235
4236 auto str = Type(psz);
4237
4238 this->add(str);
4239
4240 if (bMemoryAlloc)
4241 {
4242
4243 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_array)->free(psz);
4244
4245 }
4246 else
4247 {
4248
4249 free(psz);
4250
4251 }
4252 ppsz++;
4253
4254 }
4255
4256 if (bMemoryAlloc)
4257 {
4258
4259 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(ppszParam);
4260
4261 }
4262 else
4263 {
4264
4265 free(ppszParam);
4266
4267 }
4268
4269}
4270
4272template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4273void string_base_array < Type, RawType, t_etypeContainer > ::c_add(wchar_t** ppwsz, ::collection::count c, bool bMemoryAlloc)
4274{
4275
4276 for (::collection::index i = 0; i < c; i++)
4277 {
4278
4279 auto pwsz = ppwsz[i];
4280
4281 auto str = Type(pwsz);
4282
4283 this->add(str);
4284
4285 if (bMemoryAlloc)
4286 {
4287
4288 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(pwsz);
4289
4290 }
4291 else
4292 {
4293
4294 free(pwsz);
4295
4296 }
4297 }
4298
4299 if (ppwsz != nullptr)
4300 {
4301
4302 if (bMemoryAlloc)
4303 {
4304
4305 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(ppwsz);
4306
4307 }
4308 else
4309 {
4310
4311 free(ppwsz);
4312
4313 }
4314 }
4315
4316}
4317
4318
4320template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4321void string_base_array < Type, RawType, t_etypeContainer > ::c_add(wchar_t** ppwszParam, bool bMemoryAlloc)
4322{
4323
4324 auto ppwsz = ppwszParam;
4325
4326 while (ppwsz != nullptr)
4327 {
4328
4329 auto pwsz = *ppwsz;
4330
4331 Type str(pwsz);
4332
4333 this->add(str);
4334
4335 if (bMemoryAlloc)
4336 {
4337
4338 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(pwsz);
4339
4340 }
4341 else
4342 {
4343
4344 free(pwsz);
4345
4346 }
4347
4348 ppwsz++;
4349
4350 }
4351
4352 if (ppwszParam != nullptr)
4353 {
4354
4355 if (bMemoryAlloc)
4356 {
4357
4358 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(ppwsz);
4359
4360 }
4361 else
4362 {
4363
4364 free(ppwsz);
4365
4366 }
4367 }
4368
4369}
4370
4371
4372template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4373void string_base_array < Type, RawType, t_etypeContainer > ::order()
4374{
4375
4376 this->predicate_sort([](Type& a, Type& b)
4377 {
4378
4379 return a.order(b) < 0;
4380
4381 });
4382
4383}
4384
4385
4386template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4387void string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_order()
4388{
4389
4390 this->predicate_sort([](Type& a, Type& b)
4391 {
4392 return a.case_insensitive_order(b) < 0;
4393 });
4394
4395}
4396
4397
4398template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4399void string_base_array < Type, RawType, t_etypeContainer > ::collate_order()
4400{
4401
4402 this->predicate_sort([](Type& a, Type& b)
4403 {
4404 return a.collate(b) < 0;
4405 });
4406
4407}
4408
4409
4410template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4411void string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_collate_sort()
4412{
4413
4414 this->predicate_sort([](Type& a, Type& b)
4415 {
4416 return a.case_insensitive_collate(b) < 0;
4417 });
4418
4419}
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4434Type string_base_array < Type, RawType, t_etypeContainer >::safe_at(::collection::index nIndex, Type tDefault) const
4435{
4436
4437 if (nIndex < 0 || nIndex >= this->get_size())
4438 {
4439
4440 return tDefault;
4441
4442 }
4443
4444 return this->element_at(nIndex);
4445
4446}
4447
4448template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4449Type string_base_array < Type, RawType, t_etypeContainer >::safe_at(::collection::index nIndex, Type tDefault)
4450{
4451 if (nIndex < 0 || nIndex >= this->get_size())
4452 return tDefault;
4453
4454 return this->element_at(nIndex);
4455
4456}
4457
4458
4459template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4460Type string_base_array < Type, RawType, t_etypeContainer >::get_at(::collection::index nIndex) const
4461{
4462 if (nIndex < 0 || nIndex >= this->size())
4463 throw_exception(error_index_out_of_bounds);
4464 return get_data()[nIndex];
4465}
4466
4467//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4468//void string_base_array < Type, RawType, t_etypeContainer >::set_at(::collection::index nIndex, const_char_pointer newElement)
4469//{
4470// if (nIndex < 0 || nIndex >= this->size())
4471// throw_exception(error_index_out_of_bounds);
4472// get_data()[nIndex] = newElement;
4473//}
4474//
4475
4476template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4477void string_base_array < Type, RawType, t_etypeContainer >::set_at(::collection::index nIndex, const Type& newElement)
4478{
4479 if (nIndex < 0 || nIndex >= this->size())
4480 throw_exception(error_index_out_of_bounds);
4481 get_data()[nIndex] = newElement;
4482}
4483
4484
4485template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4486Type& string_base_array < Type, RawType, t_etypeContainer >::element_at(::collection::index nIndex)
4487{
4488 if (nIndex < 0 || nIndex >= this->size())
4489 throw_exception(error_index_out_of_bounds);
4490 return get_data()[nIndex];
4491}
4492
4493
4494template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4495const Type& string_base_array < Type, RawType, t_etypeContainer >::element_at(::collection::index nIndex) const
4496{
4497 if (nIndex < 0 || nIndex >= this->size())
4498 throw_exception(error_index_out_of_bounds);
4499 return get_data()[nIndex];
4500}
4501
4502
4503
4504//
4505//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4506//::collection::index string_base_array < Type, RawType, t_etypeContainer >::add(const property & prop)
4507//{
4508//
4509// return add(prop.get_value());
4510//
4511//}
4512
4514
4515//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4516//string_base_array < Type, RawType, t_etypeContainer > & string_base_array < Type, RawType, t_etypeContainer > ::operator = (const ::payload & payload)
4517//{
4518//
4519// this->erase_all();
4520//
4521// if (payload.get_type() == ::e_type_string_array)
4522// {
4523//
4524// payload.get_array(*this);
4525//
4526// }
4527// else
4528// {
4529//
4530// if (payload.get_count() == 1)
4531// {
4532//
4533// add((Type)payload.string());
4534//
4535// }
4536// else if (payload.get_count() > 1)
4537// {
4538//
4539// payload.get_array(*this);
4540//
4541// }
4542//
4543// }
4544//
4545// return *this;
4546//
4547//}
4548
4549
4550//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4551//memory string_base_array < Type, RawType, t_etypeContainer > ::GetFormatV004()
4552//{
4553//
4554// character_count iTotalLength = 0;
4555//
4556// ::collection::index i;
4557//
4558// for (i = 0; i < this->size(); i++)
4559// {
4560// iTotalLength += this->element_at(i).get_length();
4561// iTotalLength++;
4562// }
4563//
4564// if (iTotalLength == 0)
4565// {
4566// iTotalLength = 2;
4567// }
4568// else
4569// {
4570// iTotalLength++;
4571// }
4572//
4573// memory mem;
4574//
4575// mem.set_size(iTotalLength * sizeof(::i8));
4576//
4577// char_pointer lpsz = (char_pointer )mem.get_data();
4578//
4579// memory_set(lpsz, 0x00, iTotalLength * sizeof(::i8));
4580//
4581// char_pointer lpszN = lpsz;
4582//
4583// character_count iLength;
4584//
4585// for (i = 0; i < this->size(); i++)
4586// {
4587//
4588// Type * pstr = &this->element_at(i);
4589//
4590// iLength = pstr->get_length();
4591//
4592//#ifdef WINDOWS
4593// strcat_s(lpszN, (size_t) iLength, *pstr);
4594//#else
4595// ansi_concatenate(lpszN, *pstr);
4596//#endif
4597//
4598//#ifdef WINDOWS_DESKTOP
4599// iLength = strlen(lpszN);
4600//#elif defined(_UWPDOW)
4601// iLength = wcsnbcnt(lpszN, iLength);
4602//#else
4603// iLength = strlen(lpszN);
4604//#endif
4605//
4606// lpszN = (char_pointer )((::u8 *)lpszN) + iLength + sizeof(::i8);
4607//
4608// }
4609//
4610// if (iTotalLength == 2)
4611// {
4612// memory_set(lpsz, 0x00, iTotalLength * sizeof(::i8));
4613// }
4614// else
4615// {
4616// memory_set(lpszN, 0x00, sizeof(::i8));
4617// }
4618//
4619// return mem;
4620//
4621//}
4622
4623
4624//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4625//template < typename TYPE >
4626//inline ::collection::index string_base_array < Type, RawType, t_etypeContainer > ::add(const TYPE & type)
4627//{
4628//
4629// return ::acme::array::add(*this, type);
4630//
4631//}
4632
4633//
4634//template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4635//template < prototype_array INDEX_ARRAY >
4636//void string_base_array < Type, RawType, t_etypeContainer >::case_insensitive_get_quick_sort(INDEX_ARRAY & ia)
4637//{
4638//
4639// INDEX_ARRAY stackLowerBound;
4640// INDEX_ARRAY stackUpperBound;
4641// ::collection::index iLowerBound;
4642// ::collection::index iUpperBound;
4643// ::collection::index iLPos,iUPos,iMPos;
4644// Type t;
4645// ia.erase_all();
4646// ::acme::array::append_sequence(ia,(::collection::index)0,(::collection::index)get_upper_bound());
4647// if(this->get_size() >= 2)
4648// {
4649// stackLowerBound.push(0);
4650// stackUpperBound.push(this->get_size() - 1);
4651// while(true)
4652// {
4653// iLowerBound = stackLowerBound.pop();
4654// iUpperBound = stackUpperBound.pop();
4655// iLPos = iLowerBound;
4656// iMPos = iLowerBound;
4657// iUPos = iUpperBound;
4658// while(true)
4659// {
4660// while(true)
4661// {
4662// if(iMPos == iUPos)
4663// break;
4664// if(this->element_at(ia[iMPos]).case_insensitive_order(this->element_at(ia[iUPos])) <= 0)
4665// iUPos--;
4666// else
4667// {
4668// ::collection::index i = ia[iMPos];
4669// ia[iMPos] = ia[iUPos];
4670// ia[iUPos] = i;
4671// break;
4672// }
4673// }
4674// if(iMPos == iUPos)
4675// break;
4676// iMPos = iUPos;
4677// while(true)
4678// {
4679// if(iMPos == iLPos)
4680// break;
4681//
4682// if(this->element_at(ia[iLPos]).case_insensitive_order(this->element_at(ia[iMPos])) <= 0)
4683// iLPos++;
4684// else
4685// {
4686// ::collection::index i = ia[iLPos];
4687// ia[iLPos] = ia[iMPos];
4688// ia[iMPos] = i;
4689// break;
4690// }
4691// }
4692// if(iMPos == iLPos)
4693// break;
4694// iMPos = iLPos;
4695// }
4696// if(iLowerBound < iMPos - 1)
4697// {
4698// stackLowerBound.push(iLowerBound);
4699// stackUpperBound.push(iMPos - 1);
4700// }
4701// if(iMPos + 1 < iUpperBound)
4702// {
4703// stackLowerBound.push(iMPos + 1);
4704// stackUpperBound.push(iUpperBound);
4705// }
4706// if(stackLowerBound.get_size() == 0)
4707// break;
4708// }
4709// }
4710//
4711//}
4712//
4713
4714
4715template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4716inline void debug_output(::particle* pparticle, string_base_array < Type, RawType, t_etypeContainer >& stra, ::collection::index iStart, ::collection::count inCountLastOut)
4717{
4718
4719 pparticle->informationf(stra.implode(STR_NEWLINE, iStart, inCountLastOut));
4720
4721}
4722
4723
4724template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4725::collection::index string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_suffix_find_first(const SCOPED_STRING& strTopic, ::collection::index iFind, ::collection::index iLast) const
4726{
4727
4728 if (this->prepare_first_last(iFind, iLast))
4729 {
4730
4731 for (; iFind <= iLast; iFind++)
4732 {
4733
4734 if (strTopic.case_insensitive_ends(this->element_at(iFind)))
4735 {
4736
4737 return iFind;
4738
4739 }
4740
4741 }
4742
4743 }
4744
4745 return -1;
4746
4747}
4748
4749
4750template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4751::collection::index string_base_array < Type, RawType, t_etypeContainer > ::suffix_find_first(const SCOPED_STRING& strTopic, ::collection::index iFind, ::collection::index iLast) const
4752{
4753
4754 if (this->prepare_first_last(iFind, iLast))
4755 {
4756
4757 for (; iFind <= iLast; iFind++)
4758 {
4759
4760 if (strTopic.ends(this->element_at(iFind)))
4761 {
4762
4763 return iFind;
4764
4765 }
4766
4767 }
4768
4769 }
4770
4771 return -1;
4772
4773}
4774
4775
4776template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4777::collection::index string_base_array < Type, RawType, t_etypeContainer > ::_find_first_suffixed(const SCOPED_STRING& strSuffix, ::collection::index iFind, ::collection::index iLast) const
4778{
4779
4780 for (; iFind < iLast; iFind++)
4781 {
4782
4783 if (this->element_at(iFind).ends(strSuffix))
4784 {
4785
4786 return iFind;
4787
4788 }
4789
4790 }
4791
4792 return -1;
4793
4794}
4795
4796
4797template < typename Type, typename RawType, ::enum_type t_etypeContainer >
4798::collection::index string_base_array < Type, RawType, t_etypeContainer > ::_case_insensitive_find_first_suffixed(const SCOPED_STRING& strSuffix, ::collection::index iFind, ::collection::index iLast) const
4799{
4800
4801 for (; iFind < iLast; iFind++)
4802 {
4803
4804 if (this->element_at(iFind).case_insensitive_ends(strSuffix))
4805 {
4806
4807 return iFind;
4808
4809 }
4810
4811 }
4812
4813 return -1;
4814
4815}
4816
4817
Definition item.h:93
Definition particle.h:95
Definition range.h:223
Definition string_array.h:47
void c_add(char_pointer *ppsz, ::collection::count iCount, bool bMemoryAlloc=false)
expect strings allocated with malloc (sic, not acme::get()->m_pheapmanagement->memory(::heap::e_memor...
Definition _impl_string_array.h:4174
void __add_lines_suffix(typename Type::const_iterator start, typename Type::const_iterator end)
Add Last Line when adding lines in a string.
Definition string_array.h:544
Type reverse_implode(const SCOPED_STRING &strSeparator=nullptr, ::collection::index iStart=0, ::collection::count iCount=-1) const
void reverse_implode(Type & rwstr,const SCOPED_STRING &strSeparator = nullptr,collection::index iStar...
Definition _impl_string_array.h:2651
Type::const_iterator _____add_lines_rn(const SCOPED_STRING &scopedstr, bool bWithEOL)
Add Lines in a string that contains at least one '\r' character and one ' ' character.
Definition _impl_string_array.h:983
Definition tokenizer.h:6
Definition aaa_want_to_remove_str_wstring.h:94