17template<
class storageT>
30 typedef typename tStringList::iterator
iterator;
143 nStartPos = nPos + 1;
144 nPosComma = strList.Find(
",", nStartPos);
145 nPosSemicolon = strList.Find(
";", nStartPos);
149 nPosComma < nPosSemicolon ? nPos = nPosComma : nPos = nPosSemicolon;
153 nPos = nPosSemicolon;
164 lstList.
m_lstList.emplace_back(strList.Mid(nStartPos, nPos - nStartPos));
168 lstList.
m_lstList.emplace_back(storageT(
""));
170 nPos += nTokenLen - 1;
174 if (nStartPos < strList.GetLength())
176 lstList.
m_lstList.emplace_back(strList.Mid(nStartPos));
178 else if (strList.EndsWith(
",") || strList.EndsWith(
";"))
180 lstList.
m_lstList.emplace_back(storageT(
""));
191 for (
const auto& itElem : lstStrings)
293 auto oIt = lstString.
cbegin();
295 oIt != lstString.
cend();
339 tInt nAddedCount = 0;
340 for (
auto it = lstString.
begin();
341 it != lstString.
end();
420 if (0 > strFirst.CompareNoCase(strSecond))
473 const storageT&
Get(
tSize nIdx,
const storageT& strDefault =
"")
const
477 const storageT& strRet =
m_lstList[nIdx];
498 return ERR_INVALID_ARG;
525 return std::distance(
cbegin(), it);
541 tSize nMatchType = 0;
543 tSize nLen = strPattern.GetLength();
545 if (!strPattern.IsEmpty())
547 const tChar* ptr = strPattern.GetPtr();
555 if (*(ptr + strPattern.GetLength() - 1) ==
'*')
564 return Find(strPattern);
567 storageT strSubStr = strPattern.Mid(nStart, nLen);
571 typename tStringList::const_iterator l_poI;
577 strItem = (*l_poI).Right(nLen);
578 if (strItem.IsEqual(strSubStr))
583 else if (nMatchType == 2)
586 strItem = (*l_poI).Left(nLen);
587 if (strItem.IsEqual(strSubStr))
592 else if (nMatchType == 3)
595 strItem = (*l_poI).Mid(nStart, nLen);
622 typename tStringList::const_iterator l_poI;
625 if (strString.CompareNoCase(*l_poI) == 0)
645 storageT
Join(
const storageT& strSeparator)
const
647 storageT l_strString;
650 typename tStringList::const_iterator l_poI;
655 l_strString.Append(strSeparator);
662 l_strString.Append(*l_poI);
710 if (*itRHS != *itLHS)
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
void tVoid
The tVoid is always the definition for the void (non-type).
int tInt
type definition for signed integer value (platform and compiler dependent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
size_t tSize
type definition for a array size values, map size values etc.
constexpr tSize g_npos
npos size declaration
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
#define IS_OK(s)
Check if result is OK.
static const tSize InvalidPos
string_list_base(const _myType &lstList)
Constructor that duplicates an existing string list.
tSize Match(const storageT &strPattern) const
Returns the index of the string matching a pattern.
tResult Append(const _myType &lstString)
This function appends the given list of strings to the list.
static const tSize InvalidPos
tSize Find(const storageT &strString) const
This function returns the position of a string inside the list.
const storageT & Get(tSize nIdx, const storageT &strDefault="") const
This function retrieves a string value from the list.
const_iterator begin() const
Return const_iterator to beginning.
tResult Append(const storageT &strString)
This function appends one string to the list.
const_iterator cbegin() const
Return iterator to beginning.
tVoid Copy(const _myType &lstList)
This function copies the content of an existing string list to this cStringList object.
tVoid Sort(tBool bIgnoreCase=tFalse)
This function arranges the list elements.
tSize FindNoCase(const storageT &strString) const
This function returns the position of a string inside the list.
string_list_base & operator=(_myType &&lstList)
The cStringList assignment (=) operator reinitializes existing string lists with an existing object.
tResult Delete(tSize nIdx)
This function removes one item from the list.
tStringList::const_iterator const_iterator
short typedefinition for cString lists iterators
string_list_base(const storageT &strList)
Constructor that creates string list from comma or semicolon-delimited string.
tResult Insert(tSize nIdx, const storageT &strString)
This function inserts a string to the list at a specified position.
storageT Join(const storageT &strSeparator) const
This function concatenates all list elements to one single cString object.
reverse_iterator rend()
Return reverse iterator to reverse end.
std::vector< storageT > tStringList
list of containing cStrings
tResult Add(const storageT &strString)
This function appends one string to the list only if the strString is not yet part of the list.
tStringList::reverse_iterator reverse_iterator
short typedefinition for cString lists reverse iterators
const_reverse_iterator crbegin() const
Return reverse const_iterator to reverse beginning.
tStringList::iterator iterator
short typedefinition for cString lists iterators
const_iterator cend() const
Return iterator to end.
tResult Set(tSize nIdx, const storageT &strValue)
This function stores a string value into the list.
string_list_base(_myType &&lstList)
Constructor that duplicates an existing string list.
tVoid Clear()
This function cleans up the list and frees all allocated memory blocks.
static tBool fnSortLexically(const storageT &strFirst, const storageT &strSecond)
Checks if two strings are sorted lexically.
tSize GetItemCount() const
This function returns the number of items the list contains.
string_list_base()
Constructor that initializes an empty cStringList object.
tBool IsEmpty() const
This function checks if the string object is empty.
const_reverse_iterator crend() const
Return reverse const_iterator to reverse end.
virtual ~string_list_base()
Destructor.
tStringList::const_reverse_iterator const_reverse_iterator
short typedefinition for cString lists reverse iterators
iterator end()
Return iterator to end.
const_iterator end() const
Return const_iterator to end.
reverse_iterator rbegin()
Return reverse iterator to reverse beginning.
string_list_base & operator=(const _myType &lstList)
The cStringList assignment (=) operator reinitializes existing string lists with an existing object.
iterator begin()
Return iterator to beginning.
storageT & operator[](tSize nIdx)
This function retrieves a string value from the list.
tResult Add(const _myType &lstString)
This function appends strings of the given list to the list only if the string is not yet part of the...
const storageT & operator[](tSize nIdx) const
This function retrieves a string value from the list.
string_list_base< storageT > _myType
definition of my type
#define tFalse
Value for tBool.
#define tTrue
Value for tBool.
ADTF A_UTIL Namespace - Within adtf this is used as util or adtf_util.
tBool operator==(const cMultiArrayIndex &o_A, const cMultiArrayIndex &o_B)
Comparison operator.