C++ Based OPC UA Client/Server SDK
1.6.1.391
|
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... | |
UaUniStringList & | operator= (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 UaUniString & | operator[] (unsigned int index) const |
Returns the UaUniString at index position index as a constant reference. More... | |
UaUniString & | operator[] (unsigned int index) |
Returns the UaUniString at index position index as a modifiable reference. More... | |
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.
UaUniStringList::UaUniStringList | ( | unsigned int | capacity = 10 | ) |
Default constructor.
Creates an empty UaUniStringList. Preallocates space for capacity strings
UaUniStringList::~UaUniStringList | ( | ) |
Destroys the string list.
void UaUniStringList::append | ( | const UaUniString & | newString | ) |
void UaUniStringList::append | ( | const UaUniStringList & | lstStrings | ) |
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.
void UaUniStringList::insert | ( | unsigned int | index, |
const UaUniString & | newString | ||
) |
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).
sSeparator |
bool UaUniStringList::operator!= | ( | const UaUniStringList & | other | ) | const |
Returns true if other is not equal to this.
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.
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 | ) |
void UaUniStringList::removeAt | ( | unsigned int | index | ) |
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.
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.
unsigned int UaUniStringList::size | ( | ) | const |
Returns the number of UaUniStrings in this list.
void UaUniStringList::sort | ( | bool | bAscending = true , |
bool | bCaseSensitive = false |
||
) |
Sorts the list in alphabetical order.
The list is sorted using the combsort algorithm.
bAscending | Flag indicating if the sort order is acending or descending. |
bCaseSensitive | Flag 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.
void UaUniStringList::swap | ( | unsigned int | indexA, |
unsigned int | indexB | ||
) |
Swaps 2 elements in the list.
indexA | index of first element to swap. |
indexB | index of other element to swap. |