7#include "acme/prototype/string/c/ancient/_c.h"
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
17 if (!this->prepare_first_in_count_last_out(i, inCountLastOut))
24 str = pred(this->first());
26 if (i == inCountLastOut)
33 while (i < inCountLastOut)
40 str += pred(this->element_at(i));
52static inline void ConstructElement(
string* pNewData)
54 ((
string*)pNewData)->default_construct();
57static inline void DestructElement(
string* pOldData)
63static inline void ConstructElement(
wstring* pNewData)
65 ((
wstring*)pNewData)->default_construct();
68static inline void DestructElement(
wstring* pOldData)
74template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
75inline Type& string_base_array < Type, RawType, t_etypeContainer >::last(::collection::index i)
77 return this->element_at(get_upper_bound(i));
80template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
81inline Type string_base_array < Type, RawType, t_etypeContainer >::last(::collection::index i)
const
83 return this->element_at(get_upper_bound(i));
86template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
87inline Type& string_base_array < Type, RawType, t_etypeContainer >::first(::collection::index i)
89 return this->element_at(get_lower_bound(i));
93template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
94inline Type string_base_array < Type, RawType, t_etypeContainer >::first(::collection::index i)
const
97 return this->element_at(get_lower_bound(i));
102template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
103inline ::collection::count string_base_array < Type, RawType, t_etypeContainer >::get_size()
const
111template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
112inline ::collection::count string_base_array < Type, RawType, t_etypeContainer >::get_count()
const
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
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
130 return this->size() + i;
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
139 return get_upper_bound() / 2 + i;
149template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
150string_base_array < Type, RawType, t_etypeContainer >::~string_base_array()
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
194 for (
auto& str : *
this)
197 stra.add(str.c_str());
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
210 string_base_array < Type, RawType, t_etypeContainer > stra;
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)
226 auto nSrcSize = src.size();
228 this->set_size(nSrcSize);
230 CopyElements(this->m_begin, src.m_begin, nSrcSize);
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)
240 this->set_size((::collection::count)src.size());
242 for (::collection::index i = 0; i < this->size(); i++)
245 *get_data()[i] = as_string(src[i]);
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)
258 if (nIndex >= this->size())
259 this->set_size(nIndex + 1);
261 return get_data()[nIndex] = newElement;
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
270 for (::collection::index i = iStart; i < get_count(); i++)
273 if (element_at(i).trimmed().case_insensitive_begins(
"[") && i > 0)
280 if (element_at(i).case_insensitive_begins(strKey +
"="))
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)
298 ::collection::index iKeyIndex = _007FindLine(strKey, iStart);
300 Type strNewLine = strKey +
"=" + strValue;
305 this->element_at(iKeyIndex) = strNewLine;
311 this->add(strNewLine);
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
322 ::collection::index iKeyIndex = _007FindLine(strKey, iStart);
331 strValue = this->element_at(iKeyIndex).substr(strKey.size() + 1);
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
344 if (_007GetLine(strValue, strKey, iStart) < 0)
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
360 ::collection::index iSectionIndex = this->case_insensitive_find_first_begins(strSection);
362 return iSectionIndex;
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
371 ::collection::index iSectionIndex = this->_007FindSection(strSection);
373 if (iSectionIndex < 0)
380 return this->_007FindLine(strKey, iSectionIndex + 1);
385template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
386::collection::index string_base_array < Type, RawType, t_etypeContainer >::_007OpenSection(
const SCOPED_STRING& strSection)
389 ::collection::index iSectionIndex = this->_007FindSection(strSection);
391 if (iSectionIndex < 0)
396 iSectionIndex = this->add(strSection);
400 return iSectionIndex;
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)
409 ::collection::index iSectionIndex = this->_007OpenSection(strSection);
411 if (iSectionIndex < 0)
416 iSectionIndex = this->add(strSection);
420 this->_007SetLine(strKey, strValue, iSectionIndex + 1);
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
429 ::collection::index iSectionIndex = this->_007FindSection(strSection);
431 if (iSectionIndex < 0)
438 return _007GetLine(strValue, strKey, iSectionIndex + 1);
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
448 if (_007GetLine(strValue, strSection, strKey) < 0)
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)
472 if (nIndex >= this->size())
475 this->set_size(nIndex + nCount);
480 ::collection::count nOldSize = (::collection::count)this->size();
481 this->set_size((::collection::count)(this->size() + nCount));
483 memory_transfer(&get_data()[nIndex + nCount], &get_data()[nIndex], (nOldSize - nIndex) *
sizeof(Type));
486 for (::collection::index i = nIndex; i < nIndex + nCount; i++)
489 get_data()[i].default_construct();
496 ASSERT(nIndex + nCount <= this->size());
499template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
500Type& string_base_array < Type, RawType, t_etypeContainer >::insert_empty(::collection::index nIndex)
507 if (nIndex >= this->size())
510 this->set_size(nIndex + 1);
516 auto nOldSize = this->size();
518 this->set_size(nOldSize + 1);
520 memory_transfer(this->ptr_at(nIndex + 1), this->ptr_at(nIndex), (nOldSize - nIndex) *
sizeof(Type));
522 for (::collection::index i = nIndex; i < nIndex + 1; i++)
525 øraw_new (this->ptr_at(nIndex)) RawType();
531 ASSERT(nIndex + 1 <= this->size());
533 return get_data()[nIndex];
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)
543 return insert_empty(nIndex) = strElement;
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)
553 insert_empty(nIndex, nCount);
560 get_data()[nIndex++] = strElement;
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)
571 ASSERT(&container !=
nullptr);
574 ASSERT(nStartIndex >= 0);
576 if (container.size() > 0)
578 ::collection::index i = 0;
579 for (
auto&
item : container)
584 this->insert_at(nStartIndex,
item, container.size());
588 set_at(nStartIndex + i,
item);
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
646 if (this->prepare_first_in_count_last_out(i, inCountLastOut))
649 for (; i <= inCountLastOut; i++)
652 stra.add(this->element_at(i));
729template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
730Type& string_base_array < Type, RawType, t_etypeContainer >::add_get(
const Type& newElement)
733 ::collection::index nIndex = this->size();
735 return set_at_grow(nIndex, newElement);
740template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
741void string_base_array < Type, RawType, t_etypeContainer >::erase_duplicates()
744 for (::collection::index i = 1; i < this->get_size();)
747 if (find_first(this->element_at(i), 0, i - 1) >= 1)
765template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
766void string_base_array < Type, RawType, t_etypeContainer >::case_insensitive_erase_duplicates()
769 for (::collection::index i = 1; i < this->get_size();)
772 if (case_insensitive_find_first(this->element_at(i), 0, i - 1) >= 1)
790template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
791const Type* string_base_array < Type, RawType, t_etypeContainer >::get_data()
const
793 return (
const Type*)this->m_begin;
797template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
798Type* string_base_array < Type, RawType, t_etypeContainer >::get_data()
800 return (Type*)this->m_begin;
819template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
825 for (::collection::index i = 0; i < c; i++)
828 this->element_at(i) = ppsz[i];
859#include "acme/prototype/string/tokenizer.h"
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)
866 ::string str(scopedstr);
875 while (strTokenizer.get_next_token(strToken, strSeparator,
false))
878 string_base_array::add(strToken);
886 while (strTokenizer.get_next_token(strToken, strSeparator,
false))
889 if (!strToken.is_empty())
892 string_base_array::add(strToken);
904template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
905void string_base_array < Type, RawType, t_etypeContainer > ::_001AddTokens(
const SCOPED_STRING& str)
914 while (strTokenizer._001GetNextToken(strToken))
917 string_base_array::add(strToken);
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)
935 while (strTokenizer.get_next_smallest_token(strToken, straSeparator, bWithSeparator))
938 string_base_array::add(strToken);
946 while (strTokenizer.get_next_smallest_token(strToken, straSeparator, bWithSeparator))
949 if (!strToken.is_empty())
952 string_base_array::add(strToken);
963template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
964void string_base_array < Type, RawType, t_etypeContainer > ::add_words(
const SCOPED_STRING& str)
971 while (strTokenizer.get_word(strWord))
974 string_base_array::add(strWord);
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)
986 auto range = scopedstr();
991 auto p =
range.find_first_character_in(
"\n\r");
996 return range.begin();
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)
1045 auto pN = strParam.find_first(
'\n');
1047 auto pR = strParam.find_first(
'\r');
1049 typename Type::const_iterator p;
1057 p = _____add_lines_rn<bAddEmpty>(strParam, bWithEOL);
1063 p = _____add_lines<'\n', bAddEmpty>(strParam, bWithEOL);
1071 p = _____add_lines<'\r', bAddEmpty>(strParam, bWithEOL);
1077 p = strParam.begin();
1081 __add_lines_suffix<bAddEmpty>(p, strParam.end());
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
1091 if (this->size() > 0)
1095 for (::collection::index i = 1; i < this->size(); i++)
1097 str += strSeparator + get_at(i);
1103template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
1104::collection::index string_base_array < Type, RawType, t_etypeContainer > ::add_unique(
const Type& newElement)
1107 auto iFind = find_first(newElement);
1116 return string_base_array::add(newElement);
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)
1125 ::collection::count count = 0;
1127 for (
auto& newElement : newElements)
1130 if (add_unique(newElement) >= 0)
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)
1149 ::collection::index iFind = case_insensitive_find_first(newElement);
1158 string_base_array::add(newElement);
1160 return get_upper_bound();
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)
1169 ::collection::count count = 0;
1171 for (
auto& newElement : straNewElements)
1174 if (case_insensitive_add_unique(newElement) >= 0)
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
1192 if (this->prepare_first_last(iFind, iLast))
1195 for (; iFind <= iLast; iFind++)
1198 if (this->element_at(iFind).order(str) == 0)
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
1218 if (this->prepare_first_last(iFind, iLast))
1221 for (; iFind <= iLast; iFind++)
1224 if (this->element_at(iFind).case_insensitive_order(str) == 0)
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
1262 if (this->prepare_first_last(iFind, iLast))
1265 for (; iLast >= iFind; iLast--)
1268 if (this->element_at(iLast).order(str) == 0)
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
1287 if (this->prepare_first_last(iFind, iLast))
1290 for (; iLast >= iFind; iLast--)
1293 if (this->element_at(iLast).case_insensitive_order(str) == 0)
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
1317 ::collection::count count = 0;
1319 if (this->prepare_first_last(iFind, iLast))
1322 for (; iFind <= iLast; iFind++)
1325 if (this->element_at(iFind).order(str) == 0)
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
1345 ::collection::count count = 0;
1347 if (this->prepare_first_last(iFind, iLast))
1350 for (; iFind <= iLast; iFind++)
1353 if (this->element_at(iFind).case_insensitive_order(str) == 0)
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
1375 return case_insensitive_reverse_find(str, iFind, iLast);
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
1384 return rear_find(str, iFind, iLast);
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
1393 BASE_RAW_STRING str(strParam);
1395 ::collection::index iSel = this->find_first(str);
1400 iSel = this->case_insensitive_find_first(str);
1405 ::collection::index iHalfLen = (::collection::index)(str.length() / 2);
1407 for (::collection::index iTruncate = (::collection::index)str.length(); iTruncate >= iHalfLen; iTruncate--)
1410 str.truncate(iTruncate);
1412 iSel = this->find_first(str);
1421 iSel = this->case_insensitive_find_first(str);
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
1445 if (this->prepare_first_last(iFind, iLast))
1448 return _find_first_contains(strSubstring, iFind, iLast, ppszBeg, ppszEnd);
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
1461 for (; iFind <= iLast; iFind++)
1464 if (this->element_at(iFind).contains(strSubstring, ppszBeg, ppszEnd))
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
1484 if (this->prepare_first_last(iFind, iLast))
1487 return _case_insensitive_find_first_contains(strSubstring, iFind, iLast, ppszBeg, ppszEnd);
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
1500 for (; iFind <= iLast; iFind++)
1503 if (this->element_at(iFind).case_insensitive_contains(strSubstring, ppszBeg, ppszEnd))
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
1521 if (this->prepare_first_last(iFind, iLast))
1524 for (; iFind <= iLast; iFind++)
1527 if (strTopic.case_insensitive_begins(this->element_at(iFind)))
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
1547 if (this->prepare_first_last(iFind, iLast))
1550 for (; iFind <= iLast; iFind++)
1553 if (strTopic.begins(this->element_at(iFind)))
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
1575 if (this->prepare_first_last(iFind, iLast))
1578 for (; iFind <= iLast; iFind++)
1581 auto pBeg = strTopic.find(this->element_at(iFind));
1596 *ppszEnd = pBeg + this->element_at(iFind).size();
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
1617 if (this->prepare_first_last(iFind, iLast))
1620 for (; iFind <= iLast; iFind++)
1623 auto pBeg = strTopic.find(this->element_at(iFind));
1638 *ppszEnd = pBeg + this->element_at(iFind).size();
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
1661 if (this->prepare_first_last(iFind, iLast))
1664 return _case_insensitive_find_first_suffixed(strSuffix, iFind, iLast);
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
1677 if (this->prepare_first_last(iFind, iLast))
1680 return _find_first_suffixed(strSuffix, iFind, iLast);
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
1693 iFind = find_first_begins(strSuffix, iFind, iLast);
1702 strFoundAndEaten = element_at(iFind).substr(strSuffix.size());
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
1713 iFind = find_first_with_starting_word(strStartingWord, iFind, iLast);
1722 strFoundAndEaten = element_at(iFind).substr(strStartingWord.size());
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
1733 iFind = case_insensitive_find_first_begins(strPrefix, iFind, iLast);
1742 strFoundAndEaten = element_at(iFind).substr(strPrefix.size());
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
1755 iFind = find_first_ends(strSuffix, iFind, iLast);
1764 strFoundAndEaten = element_at(iFind).right(strSuffix.size());
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
1775 iFind = case_insensitive_find_first_ends(strSuffix, iFind, iLast);
1784 strFoundAndEaten = element_at(iFind).right(strSuffix.size());
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
1800 iFind = find_first_contains(strSubstring, iFind, iLast, &pszBeg, &pszEnd);
1809 const CHARACTER* pszFind = element_at(iFind);
1811 strFoundAndEaten = RawType(pszFind, pszBeg - pszFind) + RawType(pszEnd);
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
1826 iFind = case_insensitive_find_first_contains(strTopic, iFind, iLast, &pszBeg, &pszEnd);
1835 const CHARACTER* pszFind = element_at(iFind);
1837 strFoundAndEaten = RawType(pszFind, pszBeg - pszFind) + RawType(pszEnd);
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
1848 if (this->prepare_first_last(iFind, iLast))
1851 return _find_first_prefixed(strPrefix, iFind, iLast);
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
1864 if (this->prepare_first_last(iFind, iLast))
1867 return _find_first_with_starting_word(strPrefix, iFind, iLast);
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
1880 if (this->prepare_first_last(iFind, iLast))
1883 return _case_insensitive_find_first_prefixed(strPrefix, iFind, iLast);
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
1896 for (; iFind <= iLast; iFind++)
1899 if (this->element_at(iFind).begins(strPrefix))
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
1917 for (; iFind <= iLast; iFind++)
1920 if (this->element_at(iFind).starts_with_word(strStartingWord))
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
1938 for (; iFind <= iLast; iFind++)
1941 if (this->element_at(iFind).case_insensitive_begins(strPrefix))
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
1958 ::collection::count count = 0;
1960 while ((count < countMin || (countMax >= 0 && count <= countMax)) && (iFind = case_insensitive_find_first(str, iFind, iLast)) >= 0)
1966 return count >= countMin && conditional(countMax >= 0, count <= countMax);
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
1975 ::collection::count count = 0;
1977 while ((count < countMin || (countMax >= 0 && count <= countMax)) && (iFind = find_first(str, iFind, iLast)) >= 0)
1984 return count >= countMin && conditional(countMax >= 0, count <= countMax);
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
1993 ::collection::count count = 0;
1995 while ((count < countMin || (countMax >= 0 && count <= countMax)) && (iFind = case_insensitive_find_first_contains(str, iFind, iLast)) >= 0)
2002 return count >= countMin && conditional(countMax >= 0, count <= countMax);
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
2011 ::collection::count count = 0;
2013 while ((count < countMin || (countMax >= 0 && count <= countMax)) && (iFind = find_first_contains(str, iFind, iLast)) >= 0)
2020 return count >= countMin && conditional(countMax >= 0, count <= countMax);
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)
2029 if ((iFind = case_insensitive_find_first(str, iFind, iLast)) >= 0)
2032 this->erase_at(iFind);
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)
2045 if ((iFind = find_first(str, iFind, iLast)) >= 0)
2048 this->erase_at(iFind);
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)
2061 if ((iFind = case_insensitive_find_last(str, iFind, iLast)) >= 0)
2064 this->erase_at(iFind);
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)
2077 if ((iFind = find_last(str, iFind, iLast)) >= 0)
2080 this->erase_at(iFind);
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)
2094 ::collection::count count = 0;
2096 if (_067CaseInsensitiveContains(str, iFind, iLast, countMin, countMax))
2099 while (conditional(countMax >= 0, count < countMax) && (iFind = case_insensitive_erase_first(str, iFind, iLast)) >= 0)
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)
2117 ::collection::count count = 0;
2119 if (_067Contains(str, iFind, iLast, countMin, countMax))
2122 while (conditional(countMax >= 0, count < countMax) && (iFind = erase_first(str, iFind, iLast)) >= 0)
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)
2139 ::collection::count count = 0;
2141 while ((iFind = case_insensitive_erase_first(str, iFind, iLast)) >= 0)
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)
2157 ::collection::count count = 0;
2159 while ((iFind = erase_first(str, iFind, iLast)) >= 0)
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)
2177 ::collection::count count = 0;
2179 for (
auto &
item : container)
2182 count += this->case_insensitive_erase(
item);
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)
2196 ::collection::count count = 0;
2198 for (
auto&
item : container)
2201 count += this->erase(
item);
2210template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2211void string_base_array < Type, RawType, t_etypeContainer > ::trim_left(
const SCOPED_STRING& strChars)
2213 for (::collection::index i = 0; i < this->size(); i++)
2215 this->element_at(i).trim_left(strChars);
2220template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2221void string_base_array < Type, RawType, t_etypeContainer > ::trim_right(
const SCOPED_STRING& strChars)
2223 for (::collection::index i = 0; i < this->size(); i++)
2225 this->element_at(i).trim_right(strChars);
2230template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2231void string_base_array < Type, RawType, t_etypeContainer > ::trim(
const SCOPED_STRING& strChars)
2233 for (::collection::index i = 0; i < this->size(); i++)
2235 this->element_at(i).trim(strChars);
2241template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2242void string_base_array < Type, RawType, t_etypeContainer > ::trim_left()
2244 for (::collection::index i = 0; i < this->size(); i++)
2246 this->element_at(i).trim_left();
2251template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2252void string_base_array < Type, RawType, t_etypeContainer > ::trim_right()
2254 for (::collection::index i = 0; i < this->size(); i++)
2256 this->element_at(i).trim_right();
2261template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2262void string_base_array < Type, RawType, t_etypeContainer > ::trim()
2264 for (::collection::index i = 0; i < this->size(); i++)
2266 this->element_at(i).trim();
2271template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2272::collection::index string_base_array < Type, RawType, t_etypeContainer > ::add_normal(
const Type& newElement)
2275 return string_base_array::add(newElement);
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)
2284 ::collection::count count = 0;
2286 for (::collection::index i = 0; i < this->get_size(); i++)
2289 auto pTruncate = this->element_at(i).truncate_on_find_character(ch);
2291 if (::is_set(pTruncate))
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)
2311 ::collection::count count = 0;
2313 for (::collection::index i = 0; i < this->get_size();)
2316 if (this->element_at(i).begins(scopedstrPrefix))
2338template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2339::collection::count string_base_array < Type, RawType, t_etypeContainer > ::erase_empty()
2342 ::collection::count count = 0;
2344 for (::collection::index i = 0; i < this->get_size();)
2347 if (this->element_at(i).is_empty())
2369template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2370::collection::count string_base_array < Type, RawType, t_etypeContainer > ::erase_empty_begin()
2373 ::collection::count count = 0;
2375 for (::collection::index i = 0; i < this->get_size();)
2377 if (this->element_at(i).is_empty())
2390template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2391::collection::count string_base_array < Type, RawType, t_etypeContainer > ::erase_empty_end()
2394 ::collection::count count = 0;
2395 ::collection::index i;
2396 while ((i = this->get_upper_bound()) >= 0)
2398 if (this->element_at(i).is_empty())
2412template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2413::collection::count string_base_array < Type, RawType, t_etypeContainer > ::erase_empty_trimmed_begin()
2415 ::collection::count count = 0;
2416 for (::collection::index i = 0; i < this->get_size();)
2418 if (this->element_at(i).trimmed().is_empty())
2431template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2432::collection::count string_base_array < Type, RawType, t_etypeContainer > ::erase_empty_trimmed_end()
2434 ::collection::count count = 0;
2435 ::collection::index i;
2436 while ((i = this->get_upper_bound()) >= 0)
2438 if (this->element_at(i).trimmed().is_empty())
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
2588 if (!this->prepare_first_in_count_last_out(i, inCountLastOut))
2591 return ::transfer(str);
2595 str = this->element_at(i);
2597 if (i == inCountLastOut)
2604 while (i < inCountLastOut)
2609 str += strSeparator;
2611 str += this->element_at(i);
2615 return ::transfer(str);
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
2626 if (!this->prepare_first_in_count_last_out(i, inCountLastOut))
2629 return ::transfer(str);
2633 while (i < inCountLastOut)
2636 str += this->element_at(i);
2644 return ::transfer(str);
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
2656 if (!this->prepare_first_in_count_last_out(i, inCountLastOut))
2663 str = this->element_at(inCountLastOut);
2665 if (i == inCountLastOut)
2672 while (i < inCountLastOut)
2677 str += strSeparator;
2679 str += this->element_at(inCountLastOut);
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)
2694 add_tokens(str, strSeparator, bAddEmpty);
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)
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
2718 if (a.get_size() != get_size())
2725 for (::collection::index i = 0; i < get_size(); i++)
2728 if (a[i] != element_at(i))
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
2746 return !operator == (a);
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)
2755 for (::collection::index i = 0; i < this->get_size(); i++)
2758 this->element_at(i).replace_with(strNew, strOld);
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)
2772 if (!this->prepare_first_in_count_last_out(iStart, inCountLastOut))
2783 for (::collection::index i = iStart; i <= inCountLastOut; i++)
2786 this->element_at(i) = strPrefix + this->element_at(i) + strSuffix;
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)
2799 if (this->prepare_first_in_count_last_out(iStart, inCountLastOut))
2802 Type strSeparator(scopedstrSeparator);
2803 Type strPrefix(scopedstrPrefix);
2804 Type strSuffix(scopedstrSuffix);
2806 str = strPrefix + this->element_at(iStart) + strSuffix;
2810 for (::collection::index i = iStart; i <= inCountLastOut; i++)
2813 str += strSeparator + strPrefix + this->element_at(i) + strSuffix;
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)
2872 ::collection::index i = case_insensitive_find_first(str);
2877 insert_at(iIndex, str);
2883template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2884bool string_base_array < Type, RawType, t_etypeContainer > ::preferred(
const SCOPED_STRING& str)
2887 return case_insensitive_move(str, 0);
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)
2895 ::collection::count count = 0;
2896 for (::collection::index i = stra.get_upper_bound(); i >= 0; i--)
2898 if (preferred(stra[i]))
2906template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2907Type string_base_array < Type, RawType, t_etypeContainer > ::pop(::collection::index i)
2909 i = get_upper_bound(i);
2910 Type strRet = this->element_at(i);
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)
2920 ::collection::index iEnd;
2923 iEnd = get_upper_bound(count);
2925 iEnd = iOffset + count - 1;
2927 for (::collection::index i = iOffset; i <= iEnd; i++)
2929 stra.add(this->element_at(i));
2935template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2936void string_base_array < Type, RawType, t_etypeContainer > ::erase(::collection::index iOffset, ::collection::count count)
2939 for (::collection::index i = iOffset + count - 1; i >= iOffset; i--)
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)
2953 erase(iOffset, count);
2955 insert_at(iOffset, stra);
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)
2965 slice(straRemoved, iOffset, count);
2967 erase(iOffset, count);
2969 insert_at(iOffset, stra);
2975template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2976bool string_base_array < Type, RawType, t_etypeContainer > ::is_empty(::collection::count countMinimum)
const
2979 return this->get_size() < countMinimum;
2984template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
2985bool string_base_array < Type, RawType, t_etypeContainer > ::has_elements(::collection::count countMinimum)
const
2989 return this->get_count() >= countMinimum;
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)
3074 ::collection::count count = 0;
3076 if (this->prepare_first_last(iFirst, iLast))
3082 iFirst = _find_first_prefixed(strPrefix, iFirst, iLast);
3091 iaPrefixed.add(this->element_at(iFirst));
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)
3112 ::collection::count count = 0;
3114 if (this->prepare_first_last(iFirst, iLast))
3120 iFirst = _case_insensitive_find_first_prefixed(strPrefix, iFirst, iLast);
3129 iaPrefixed.add(iFirst);
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)
3186 ::collection::count count = 0;
3188 if (this->prepare_first_last(iFirst, iLast))
3194 iFirst = _case_insensitive_find_first_suffixed(strSuffix, iFirst, iLast);
3203 straSuffixed.add(this->element_at(iFirst));
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)
3225 ::collection::count count = 0;
3227 if (this->prepare_first_last(iFirst, iLast))
3233 iFirst = _find_first_suffixed(strSuffix, iFirst, iLast);
3242 iaSuffixed.add(this->element_at(iFirst));
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)
3371 ::collection::count count = 0;
3373 if (this->prepare_first_last(iFirst, iLast))
3379 iFirst = _find_first_contains(strTopic, iFirst, iLast);
3388 iaResult.add(iFirst);
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)
3409 ::collection::count count = 0;
3411 if (this->prepare_first_last(iFirst, iLast))
3417 iFirst = _case_insensitive_find_first_contains(strTopic, iFirst, iLast);
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)
3446 ::collection::count count = 0;
3448 if (this->prepare_first_last(iFirst, iLast))
3451 ::collection::index i = iFirst;
3453 ::collection::index iFind;
3458 iFind = find_first_begins(str, i, iLast);
3463 this->erase_at(i, iLast - i + 1);
3469 this->erase_at(i, iFind - i);
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)
3490 ::collection::count count = 0;
3492 if (this->prepare_first_last(iFirst, iLast))
3495 ::collection::index i = iFirst;
3497 ::collection::index iFind;
3502 iFind = case_insensitive_find_first_begins(str, i, iLast);
3507 this->erase_at(i, iLast - i + 1);
3513 this->erase_at(i, iFind - i);
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)
3535 ::collection::count count = 0;
3537 if (this->prepare_first_last(iFirst, iLast))
3540 for (::collection::index i = iFirst; i <= iLast;)
3543 if (pred(element_at(i)))
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)
3574 ::collection::count count = 0;
3576 if (this->prepare_first_last(iFirst, iLast))
3579 for (::collection::index i = iFirst; i <= iLast;)
3582 if (!pred(element_at(i)))
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)
3613 ::collection::count count = 0;
3615 if (this->prepare_first_last(iFirst, iLast))
3618 for (::collection::index i = iFirst; i <= iLast;)
3621 if (!pred(element_at(i)))
3630 a.add(this->element_at(i));
3649template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
3650::collection::index string_base_array < Type, RawType, t_etypeContainer > ::get_random_index()
const
3653 if (this->is_empty())
3660 return (::collection::index)(rand() % get_size());
3665template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
3666Type& string_base_array < Type, RawType, t_etypeContainer > ::random_element()
3669 if (this->is_empty())
3672 throw_exception(error_wrong_state,
"invalid call");
3676 return this->element_at(get_random_index());
3681template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
3682const Type& string_base_array < Type, RawType, t_etypeContainer > ::random_element()
const
3685 if (this->is_empty())
3688 throw_exception(error_wrong_state,
"invalid call");
3692 return this->element_at(get_random_index());
3697template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
3698Type string_base_array < Type, RawType, t_etypeContainer > ::pop_random_element()
3701 if (this->is_empty())
3704 throw_exception(error_wrong_state,
"invalid call");
3708 ::collection::index i = get_random_index();
3710 Type str = this->element_at(i);
3719template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
3720void string_base_array < Type, RawType, t_etypeContainer > ::make_lower()
3723 for (::collection::index i = 0; i < this->get_count(); i++)
3726 this->element_at(i).make_lower();
3733template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
3734void string_base_array < Type, RawType, t_etypeContainer > ::make_upper()
3737 for (::collection::index i = 0; i < this->get_count(); i++)
3740 this->element_at(i).make_upper();
3754template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
3755Type string_base_array < Type, RawType, t_etypeContainer > ::encode_v16()
3792template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
3793void string_base_array < Type, RawType, t_etypeContainer > ::decode_v16(
const SCOPED_STRING& str)
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)
3847 ::collection::count c = get_count();
3849 for (::collection::index i = 0; i < get_count(); i++)
3852 if (this->element_at(i).order(str) == 0)
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)
3869 ::collection::count c = get_count();
3871 for (::collection::index i = 0; i < get_count(); i++)
3874 if (this->element_at(i).case_insensitive_order(str) == 0)
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)
3893 ::collection::count c = get_count();
3895 for (::collection::index i = 0; i < get_count(); i++)
3898 if (stra.contains(element_at(i)))
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)
3918 ::collection::count c = get_count();
3920 for (::collection::index i = 0; i < get_count(); i++)
3923 if (stra.case_insensitive_contains(element_at(i)))
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
3944 if (get_count() > 0)
3949 str += element_at(0);
3955 for (::collection::index i = 1; i < get_count(); i++)
3973 str += element_at(i);
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
4002 if (!this->prepare_first_in_count_last_out(iStart, inCountLastOut))
4009 for (::collection::index i = iStart; i <= inCountLastOut; i++)
4015 if (i == inCountLastOut)
4018 str += strLastSeparator;
4024 str += strSeparator;
4030 str += this->element_at(i);
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
4046 if (!this->prepare_first_in_count_last_out(iStart, inCountLastOut))
4053 if (inCountLastOut >= iStart)
4056 str += strIfHasElementPrefix;
4060 for (::collection::index i = iStart; i <= inCountLastOut; i++)
4066 if (i == inCountLastOut && bUseLast)
4069 str += strLastSeparator;
4075 str += strSeparator;
4081 str += this->element_at(i);
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
4109 ::array_base < const ::ansi_character* > psza;
4111 for (::collection::index i = 0; i < get_size(); i++)
4114 char_pointer psz =
nullptr;
4119 psz = ansi_duplicate(element_at(i));
4125 psz = libc_strdup(element_at(i));
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)
4177 for (::collection::index i = 0; i < c; i++)
4182 auto str = Type(psz);
4189 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(psz);
4201 if (ppsz !=
nullptr)
4207 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(ppsz);
4225template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
4226void string_base_array < Type, RawType, t_etypeContainer >
::c_add(char_pointer * ppszParam,
bool bMemoryAlloc)
4229 auto ppsz = ppszParam;
4231 while (ppsz !=
nullptr)
4236 auto str = Type(psz);
4243 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_array)->free(psz);
4259 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(ppszParam);
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)
4276 for (::collection::index i = 0; i < c; i++)
4279 auto pwsz = ppwsz[i];
4281 auto str = Type(pwsz);
4288 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(pwsz);
4299 if (ppwsz !=
nullptr)
4305 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(ppwsz);
4320template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
4321void string_base_array < Type, RawType, t_etypeContainer >
::c_add(
wchar_t** ppwszParam,
bool bMemoryAlloc)
4324 auto ppwsz = ppwszParam;
4326 while (ppwsz !=
nullptr)
4338 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(pwsz);
4352 if (ppwszParam !=
nullptr)
4358 ::acme::get()->m_pheapmanagement->memory(::heap::e_memory_main)->free(ppwsz);
4372template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
4373void string_base_array < Type, RawType, t_etypeContainer > ::order()
4376 this->predicate_sort([](Type& a, Type& b)
4379 return a.order(b) < 0;
4386template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
4387void string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_order()
4390 this->predicate_sort([](Type& a, Type& b)
4392 return a.case_insensitive_order(b) < 0;
4398template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
4399void string_base_array < Type, RawType, t_etypeContainer > ::collate_order()
4402 this->predicate_sort([](Type& a, Type& b)
4404 return a.collate(b) < 0;
4410template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
4411void string_base_array < Type, RawType, t_etypeContainer > ::case_insensitive_collate_sort()
4414 this->predicate_sort([](Type& a, Type& b)
4416 return a.case_insensitive_collate(b) < 0;
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
4437 if (nIndex < 0 || nIndex >= this->get_size())
4444 return this->element_at(nIndex);
4448template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
4449Type string_base_array < Type, RawType, t_etypeContainer >::safe_at(::collection::index nIndex, Type tDefault)
4451 if (nIndex < 0 || nIndex >= this->get_size())
4454 return this->element_at(nIndex);
4459template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
4460Type string_base_array < Type, RawType, t_etypeContainer >::get_at(::collection::index nIndex)
const
4462 if (nIndex < 0 || nIndex >= this->size())
4463 throw_exception(error_index_out_of_bounds);
4464 return get_data()[nIndex];
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)
4479 if (nIndex < 0 || nIndex >= this->size())
4480 throw_exception(error_index_out_of_bounds);
4481 get_data()[nIndex] = newElement;
4485template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
4486Type& string_base_array < Type, RawType, t_etypeContainer >::element_at(::collection::index nIndex)
4488 if (nIndex < 0 || nIndex >= this->size())
4489 throw_exception(error_index_out_of_bounds);
4490 return get_data()[nIndex];
4494template <
typename Type,
typename RawType, ::enum_type t_etypeContainer >
4495const Type& string_base_array < Type, RawType, t_etypeContainer >::element_at(::collection::index nIndex)
const
4497 if (nIndex < 0 || nIndex >= this->size())
4498 throw_exception(error_index_out_of_bounds);
4499 return get_data()[nIndex];
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)
4719 pparticle->informationf(stra.implode(STR_NEWLINE, iStart, inCountLastOut));
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
4728 if (this->prepare_first_last(iFind, iLast))
4731 for (; iFind <= iLast; iFind++)
4734 if (strTopic.case_insensitive_ends(this->element_at(iFind)))
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
4754 if (this->prepare_first_last(iFind, iLast))
4757 for (; iFind <= iLast; iFind++)
4760 if (strTopic.ends(this->element_at(iFind)))
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
4780 for (; iFind < iLast; iFind++)
4783 if (this->element_at(iFind).ends(strSuffix))
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
4801 for (; iFind < iLast; iFind++)
4804 if (this->element_at(iFind).case_insensitive_ends(strSuffix))
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 aaa_want_to_remove_str_wstring.h:94