UaUniStringList Class Reference

#include <uaunistringlist.h>

Collaboration diagram for UaUniStringList:

List of all members.


Public Member Functions

 UaUniStringList (unsigned int capacity=DEFAULT_ALLOC_CHUNK_SIZE)
 UaUniStringList (const UaUniStringList &other)
 ~UaUniStringList ()
UaUniStringListoperator= (const UaUniStringList &other)
unsigned int size () const
unsigned int capacity () const
void resize (unsigned int size)
void reserve (unsigned int capacity)
void squeeze ()
bool isEmpty () const
void append (const UaUniString &newString)
void prepend (const UaUniString &newString)
void insert (unsigned int index, const UaUniString &newString)
void swap (unsigned int indexA, unsigned int indexB)
void removeAt (unsigned int index)
void clear ()
void sort (bool bAscending=true, bool bCaseSensitive=false)
bool operator== (const UaUniStringList &other) const
bool operator!= (const UaUniStringList &other) const
const UaUniStringoperator[] (unsigned int index) const
UaUniStringoperator[] (unsigned int index)

Detailed Description

OPC UA string list class. This class encapsulates a list of UaUniStringPrivate This list behaves like a vector and allows fast index lookup. Inserting and deleting elements can be very slow.

Constructor & Destructor Documentation

UaUniStringList::UaUniStringList ( unsigned int  capacity = DEFAULT_ALLOC_CHUNK_SIZE  ) 

Default constructor. Creates an empty UaUniStringList. Preallocates space for capacity strings

UaUniStringList::UaUniStringList ( const UaUniStringList other  ) 

Creates a copy of another UaUniStringList.

UaUniStringList::~UaUniStringList (  ) 

Destroyes the stringlist.


Member Function Documentation

UaUniStringList & UaUniStringList::operator= ( const UaUniStringList other  ) 

Assigns other to this stringlist and returns a reference to this stringlist. This will be an exact copy of other i.e. content of the list , capacity, size, AllocChunkSize will be the same.

unsigned int UaUniStringList::size (  )  const

Returns the number of UaUniStrings in this list.

See also:
capacity()

unsigned int UaUniStringList::capacity (  )  const

Returns the number UaUniString this list can hold before allocating memory. Note that this is not actual number of UaUniStrings in this list.

See also:
size()

void UaUniStringList::resize ( unsigned int  size  ) 

Sets the size of the list to size elements. If size is greater than the current size, the list is extended to make it size elements long with the extra strings added to the end. The new string are empty. If size is less than the current size, UaUniStrings are removed from the end.

See also:
reserve()

size()

void UaUniStringList::reserve ( unsigned int  capacity  ) 

Allocates memory for at least capacity elements. If newSize is smaller than the current capacity this function does nothing. Only use this function if you know how large the list will be. Otherwise you'll probably not gain any performance. AllocChunkSize has no effect on how this function allocates memory.

See also:
capacity()

squeeze()

allocChunkSize()

void UaUniStringList::squeeze (  ) 

Releases any memory not required to store the strings in a list. This function will not change the size. After execution of this function capacity will be size. AllocChunkSize has no effect on how this function allocates memory.

See also:
capacity()

reserve()

allocChunkSize()

bool UaUniStringList::isEmpty (  )  const

Returns true if the string is empty.

void UaUniStringList::append ( const UaUniString newString  ) 

Inserts newString at the end of the list. The list will automatically expand and allocate memory if necessary. AllocChunkSize defines how much space is beeing allocated when expanding the list. Do not call resize() or reserve() in a loop.

See also:
prepend()

insert()

void UaUniStringList::prepend ( const UaUniString newString  ) 

Inserts newString at the beginning of the list. Do not use this function if you care about performance.

See also:
append()

insert()

void UaUniStringList::insert ( unsigned int  index,
const UaUniString newString 
)

Inserts value at index position into the list. If index is 0, this function does the same as prepend. If index is size(), this function does the same as append. Do not use this function if you care about performance.

See also:
append()

prepend()

void UaUniStringList::swap ( unsigned int  indexA,
unsigned int  indexB 
)

Swaps 2 elements in the list

Parameters:
indexA index of first element to swap.
indexB index of other element to swap.

void UaUniStringList::removeAt ( unsigned int  index  ) 

Removes the string at index position. Index must be a valid index position in the list (i.e., 0 <= i < size()). This will delete the element and cause all element behind to move up in the list by one Do not use this function if you care about performance.

See also:
clear()

void UaUniStringList::clear (  ) 

Releases all elements in the list, releases all memory, sets size and capacity to 0 and AllocChunkSize to DEFAULT_ALLOC_CHUNK_SIZE

void UaUniStringList::sort ( bool  bAscending = true,
bool  bCaseSensitive = false 
)

Sorts the list in alphabetical order. The list is sorted using the combsort algorithm.

Parameters:
bAscending Flag indicating if the sort order is acending or descending.
bCaseSensitive Flag indicating if the sort order is case sensitive or not.

bool UaUniStringList::operator== ( const UaUniStringList other  )  const

Returns true if other is equal to this.

See also:
operator!=

bool UaUniStringList::operator!= ( const UaUniStringList other  )  const

Returns true if other is not equal to this.

See also:
operator==

const UaUniString & UaUniStringList::operator[] ( unsigned int  index  )  const

Returns the UaUniString at index position index as a constant reference. i must be a valid index position in the list (i.e., 0 <= i < size()).

UaUniString & UaUniStringList::operator[] ( unsigned int  index  ) 

Returns the UaUniString at index position index as a modifiable reference. i must be a valid index position in the list (i.e., 0 <= i < size()).


The documentation for this class was generated from the following files:
  • src/uabase/uabasecpp/uaunistringlist.h
  • src/uabase/uabasecpp/uaunistringlist.cpp