ADTF  v2.14.3
cStringList Class Reference

String list class. More...

Public Member Functions

 cStringList ()
 Constructor that initializes an empty cStringList object.
 
 cStringList (const cStringList &List)
 Constructor that duplicates an existing string list. More...
 
 cStringList (const cString &strList)
 Constructor that creates string list from comma or semicolon-delimited string. More...
 
virtual ~cStringList ()
 Destructor. More...
 
tBool Copy (const cStringList &List)
 This function copies the content of an existing string list to this cStringList object. More...
 
void Clear ()
 This function cleans up the list and frees all allocated memory blocks.
 
tBool Append (const cString &strString)
 This function appends one string to the list. More...
 
tResult Append (const cStringList &lstString)
 This function appends the given list of strings to the list. More...
 
tResult Add (const cString &strString)
 This function appends one string to the list only if the strString is not yet part of the list. More...
 
tResult Add (const cStringList &lstString)
 This function appends strings of the given list to the list only if the string is not yet part of the list. More...
 
tBool Insert (tInt32 nIdx, const cString &strString)
 This function inserts a string to the list at a specified position. More...
 
tBool Delete (tInt32 nIdx)
 This function removes one item from the list. More...
 
tVoid Sort (tBool bIgnoreCase=tFalse)
 This function arranges the list elements. More...
 
tInt32 GetItemCount () const
 This function returns the number of items the list contains. More...
 
cString Get (tInt32 nIdx, const cString &strDefault="") const
 This function retrieves a string value from the list. More...
 
tBool Set (tInt32 nIdx, const cString &strValue)
 This function stores a string value into the list. More...
 
tInt32 Find (const cString strString) const
 This function returns the position of a string inside the list. More...
 
tInt32 Match (const cString strPattern) const
 Returns the index of the string matching a pattern. More...
 
tInt32 FindNoCase (const cString strString) const
 This function returns the position of a string inside the list. More...
 
cString Join (const cString &strSeparator) const
 This function concatenates all list elements to one single cString object. More...
 
tBool IsEmpty () const
 This function checks if the string object is empty. More...
 
tBool GetFirstString (cStringListIterator &oIterator) const
 
tBool GetNextString (cStringListIterator &oIterator) const
 
tBool GetLastString (cStringListReverseIterator &oIterator) const
 
tBool GetPreviousString (cStringListReverseIterator &oIterator) const
 
tBool GetString (cStringListIterator &oIterator, tInt32 nIndex) const
 
cStringListoperator= (const cStringList &List)
 The cStringList assignment (=) operator reinitializes existing string lists with an existing object. More...
 
cStringoperator[] (tInt32 nIdx)
 This function retrieves a string value from the list. More...
 

Protected Member Functions

void Initialize ()
 Initializes the cStringList object. More...
 
cStringGetRef (tInt32 nIdx)
 Use this function to find elements in the list. More...
 

Protected Attributes

tStringList m_List
 Internally used string list.
 

Detailed Description

String list class.

Definition at line 31 of file stringlist.h.

Constructor & Destructor Documentation

cStringList ( const cStringList List)

Constructor that duplicates an existing string list.

Parameters
List[in] List object to be copied.
cStringList ( const cString strList)

Constructor that creates string list from comma or semicolon-delimited string.

Both delimiters can be used at the same time.

Parameters
strList[in] Comma or semicolon-delimited string.
virtual ~cStringList ( )
virtual

Destructor.

Member Function Documentation

tResult Add ( const cString strString)

This function appends one string to the list only if the strString is not yet part of the list.

Parameters
strString[in] String to be added if strString is not already Part of the List
Return values
ERR_NOERRORthe string was added.
ERR_FAILEDthe string is not added, already part of the list
tResult Add ( const cStringList lstString)

This function appends strings of the given list to the list only if the string is not yet part of the list.

Parameters
lstString[in] String to be added if strString is not already Part of the List
Return values
ERR_NOERRORat least one string was added.
ERR_FAILEDno string of the list was added, every string is already part of the list
tBool Append ( const cString strString)

This function appends one string to the list.

  • Parameters
    strString[in] String to be appended
    Returns
    True, if everything was ok, otherwise false.
tResult Append ( const cStringList lstString)

This function appends the given list of strings to the list.

  • Parameters
    lstString[in] Stringlist to append
    Returns
    ERR_NOERROR if everything was ok.
tBool Copy ( const cStringList List)

This function copies the content of an existing string list to this cStringList object.

Parameters
List[in] List object to be copied.
Returns
True, if everything was ok, otherwise false.
tBool Delete ( tInt32  nIdx)

This function removes one item from the list.

Parameters
nIdx[in] Position where the string should be removed. The element currently at this position as well as all following elements are moved one position further back ( Position n -> Position n-1 )
Returns
Returns true, if the item specified by nIdx was found and removed, otherwise false.
tInt32 Find ( const cString  strString) const

This function returns the position of a string inside the list.

Parameters
strString[in] String to find inside the list.
Returns
Returns the zero-based position index of a string inside the list. If the string doesn't exist in the list, -1 is returned.
This method is real-time safe.
See The ADTF Real-Time Extension.
tInt32 FindNoCase ( const cString  strString) const

This function returns the position of a string inside the list.

Parameters
strString[in] String to find inside the list.
Returns
Returns the zero-based position index of a string inside the list. If the string doesn't exist in the list, -1 is returned.
This method is real-time safe.
See The ADTF Real-Time Extension.
cString Get ( tInt32  nIdx,
const cString strDefault = "" 
) const

This function retrieves a string value from the list.

Parameters
nIdx[in] Zero-based list index of the element to be fetched.
strDefault[in] Default value that is returned if the element was not found (default is an empty string) or nIdx was negative.
Returns
The function creates a cString object that is initialized with the contents of the referenced list item.
tBool GetFirstString ( cStringListIterator oIterator) const
Parameters
oIterator[in] Reference to iterator object
Returns
tBool returns tTrue if a string is found.
This method is real-time safe.
See The ADTF Real-Time Extension.
tInt32 GetItemCount ( ) const

This function returns the number of items the list contains.

Returns
Returns the number of list items.
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool GetLastString ( cStringListReverseIterator oIterator) const
Parameters
oIterator[in] Reference to iterator object
Returns
tBool returns tTrue, if a next string is found.
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool GetNextString ( cStringListIterator oIterator) const
Parameters
oIterator[in] Reference to iterator object
Returns
tBool returns tTrue if next string is found.
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool GetPreviousString ( cStringListReverseIterator oIterator) const
Parameters
oIterator[in] Reference to iterator object
Returns
tBool returns tTrue, if a previous string is found.
This method is real-time safe.
See The ADTF Real-Time Extension.
cString& GetRef ( tInt32  nIdx)
protected

Use this function to find elements in the list.

Parameters
nIdx[in] Zero-based list index of the element to be fetched.
Returns
Reference to string list element.
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool GetString ( cStringListIterator oIterator,
tInt32  nIndex 
) const
Parameters
oIterator[in] Reference to iterator object
nIndex[in] Index of list element
Returns
tBool returns tTrue, if the string is available.
This method is real-time safe.
See The ADTF Real-Time Extension.
void Initialize ( )
protected

Initializes the cStringList object.

tBool Insert ( tInt32  nIdx,
const cString strString 
)

This function inserts a string to the list at a specified position.

  • Parameters
    nIdx[in] Position where the string should be inserted to. If this is zero or below zero, the element is appended at the front of the list. If the value is greater than the number of elements in the list, the element is appended at the end.
    strString[in] String to be inserted
    Returns
    True, if everything was ok, otherwise false.
tBool IsEmpty ( ) const

This function checks if the string object is empty.

Returns
tBool value that is true, if the string list object has no elements.
This method is real-time safe.
See The ADTF Real-Time Extension.
cString Join ( const cString strSeparator) const

This function concatenates all list elements to one single cString object.

The strings are separated by a separator string.

Parameters
strSeparator[in] Separator string.
Returns
The function creates a cString object that is initialized with the concatenated list content.
tInt32 Match ( const cString  strPattern) const

Returns the index of the string matching a pattern.

Parameters
strPattern[in] The pattern to match (can contain the '*' wildcard at the beginning and at the end).
Returns
The index of the string matching the pattern.
cStringList& operator= ( const cStringList List)

The cStringList assignment (=) operator reinitializes existing string lists with an existing object.

Parameters
List[in] List object to be copied.
Returns
Reference to cStringList object.
cString& operator[] ( tInt32  nIdx)

This function retrieves a string value from the list.

Parameters
nIdx[in] Zero-based list index of the element to be fetched.
Returns
The function creates a cString object that is initialized with the contents of the referenced list item.
This method is real-time safe.
See The ADTF Real-Time Extension.
tBool Set ( tInt32  nIdx,
const cString strValue 
)

This function stores a string value into the list.

Parameters
nIdx[in] Zero-based list index of the element to be written to. If the provided index is bigger than the last existing index n, the element is appended at position n+1. If the value is negative, the operation fails.
strValue[in] Value that is written to the list.
Returns
The function returns true if the operation succeeded, and false otherwise.
tVoid Sort ( tBool  bIgnoreCase = tFalse)

This function arranges the list elements.

Parameters
bIgnoreCase[in] If false, a strict character code comparison is performed. Otherwise the comparison is made case insensitive. The character code comparison is the default behavior.
Returns
tVoid
This method is real-time safe.
See The ADTF Real-Time Extension.

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Fri Mar 22 2019 by doxygen 1.8.10)