C++ Based OPC UA Client/Server/PubSub SDK  1.7.6.537
UaUniStringList Class Reference

OPC UA string list class. More...

#include <uaunistringlist.h>

Public Member Functions

 UaUniStringList (unsigned int capacity=10)
 Default constructor. More...
 
 UaUniStringList (const UaUniStringList &other)
 Creates a copy of another UaUniStringList.
 
 ~UaUniStringList ()
 Destroys the string list. More...
 
UaUniStringListoperator= (const UaUniStringList &other)
 Assigns other to this string list and returns a reference to this string list. More...
 
unsigned int size () const
 Returns the number of UaUniStrings in this list. More...
 
unsigned int capacity () const
 Returns the number UaUniString this list can hold before allocating memory. More...
 
void resize (unsigned int size)
 Sets the size of the list to size elements. More...
 
void reserve (unsigned int capacity)
 Allocates memory for at least capacity elements. More...
 
void squeeze ()
 Releases any memory not required to store the strings in a list. More...
 
bool isEmpty () const
 Returns true if the string is empty. More...
 
void append (const UaUniString &newString)
 Inserts newString at the end of the list. More...
 
void append (const UaUniStringList &lstStrings)
 Append another list to this list. More...
 
void prepend (const UaUniString &newString)
 Inserts newString at the beginning of the list. More...
 
void insert (unsigned int index, const UaUniString &newString)
 Inserts value at index position into the list. More...
 
void swap (unsigned int indexA, unsigned int indexB)
 Swaps 2 elements in the list. More...
 
void removeAt (unsigned int index)
 Removes the string at index position. More...
 
void clear ()
 Releases all elements in the list, releases all memory, sets size and capacity to 0 and AllocChunkSize to DEFAULT_ALLOC_CHUNK_SIZE.
 
void sort (bool bAscending=true, bool bCaseSensitive=false)
 Sorts the list in alphabetical order. More...
 
UaUniString join (const UaUniString &sSeparator) const
 Joins all the string list's strings into a single string with each element separated by the given separator (which can be an empty string). More...
 
bool operator== (const UaUniStringList &other) const
 Returns true if other is equal to this. More...
 
bool operator!= (const UaUniStringList &other) const
 Returns true if other is not equal to this. More...
 
const UaUniStringoperator[] (unsigned int index) const
 Returns the UaUniString at index position index as a constant reference. More...
 
UaUniStringoperator[] (unsigned int index)
 Returns the UaUniString at index position index as a modifiable reference. More...
 

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 = 10)

Default constructor.

Creates an empty UaUniStringList. Preallocates space for capacity strings

UaUniStringList::~UaUniStringList ( )

Destroys the string list.

Member Function Documentation

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 being allocated when expanding the list. Do not call resize() or reserve() in a loop.

See also
prepend()
insert()
void UaUniStringList::append ( const UaUniStringList lstStrings)

Append another list to this list.

The list will automatically expand and allocate memory if necessary.

See also
prepend()
insert()
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::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()
bool UaUniStringList::isEmpty ( ) const

Returns true if the string is empty.

UaUniString UaUniStringList::join ( const UaUniString sSeparator) const

Joins all the string list's strings into a single string with each element separated by the given separator (which can be an empty string).

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

Returns true if other is not equal to this.

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

Assigns other to this string list and returns a reference to this string list.

This will be an exact copy of other i.e. content of the list , capacity, size, AllocChunkSize will be the same.

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

Returns true if other is 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()).

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::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::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::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()
unsigned int UaUniStringList::size ( ) const

Returns the number of UaUniStrings in this list.

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

Sorts the list in alphabetical order.

The list is sorted using the combsort algorithm.

Parameters
bAscendingFlag indicating if the sort order is acending or descending.
bCaseSensitiveFlag indicating if the sort order is case sensitive or not.
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()
void UaUniStringList::swap ( unsigned int  indexA,
unsigned int  indexB 
)

Swaps 2 elements in the list.

Parameters
indexAindex of first element to swap.
indexBindex of other element to swap.

The documentation for this class was generated from the following files: