Public Types | |
typedef const iterator | const_iterator |
Const iterator for NList objects. | |
Public Member Functions | |
NList (void) | |
Constructs an empty NList object. | |
NList (const T &val) | |
Constructs a NList class with item val as its first item. | |
NList (const NList< T > &other) | |
Copy constructor. | |
virtual | ~NList (void) |
Destroys a NList object freeing the resources allocataded by this class. | |
nuint64 | count (void) const |
Gets the count of itens in the list. | |
nuint64 | count (const T &obj) const |
Gets the count of itens in the list that are equal to a given object. | |
nuint64 | size (void) const |
Gets the current number of itens in the class. | |
bool | isEmpty (void) const |
Checks if the list is empty. | |
NList< T > & | append (const T &val) |
Inserts an item at the end of the list. | |
NList< T > & | insert (const T &val, nuint64 pos) |
Inserts an item at a given position in the list. | |
NList< T > & | removeAt (nuint64 pos) |
Removes item at a given position. | |
const T & | at (nuint64 pos) const |
Returns the item at a given position in the list. | |
T | value (nuint64 pos) const |
Returns the value at a given position. | |
T & | first (void) |
Returns the first item on the list. | |
T & | last (void) |
Returns the last item on the list. | |
T | takeFirst (void) |
Removes the first item on the list and returns it. | |
T | takeLast (void) |
Removes the last item on the list and returns it. | |
T | takeAt (nuint64 pos) |
Removes the a item with a given position on the list and returns it. | |
void | clear (void) |
Removes all the items on the list. | |
NList< T > & | copy (const NList< T > &other) |
Copies one list to another. | |
bool | hasNext (void) const |
Returns whether there is a next item in the list. | |
bool | hasPrevious (void) const |
Returns whether there is a previous item in the list. | |
bool | contains (const T &val) const |
Returns whether there is an item equal to val. | |
NList< T > & | operator= (const NList< T > &rhs) |
Copies other list to this list. | |
iterator | begin (void) |
Returns an iterator pointing to the first item in the list. | |
const_iterator | constBegin (void) const |
Returns a const_iterator pointing to the first item in the list. | |
iterator | end (void) |
Returns an iterator pointing to the last item in the list. | |
const_iterator | constEnd (void) const |
Returns a const_iterator pointing to the last item in the list. | |
Protected Member Functions | |
void | gotoFirst () const |
Goes to the first node. | |
void | gotoPos (nuint64 pos) const |
Goes to a position on the list. | |
Protected Attributes | |
NListNode< T > * | m_first |
NListNode< T > * | m_node |
nuint64 | m_count |
Classes | |
class | iterator |
NList::iterator iterates through a NList object. More... |
ex_ndir.cpp, ex_ngetopt.cpp, ex_nlist.cpp, ex_nmap.cpp, ex_nregex.cpp, and ex_nsortedlist.cpp.
Definition at line 36 of file nlist.hpp.
nuint64 count | ( | void | ) | const [inline] |
Gets the count of itens in the list.
Definition at line 303 of file nlist.hpp.
References m_count.
Referenced by removeAt(), and size().
nuint64 count | ( | const T & | obj | ) | const [inline] |
Gets the count of itens in the list that are equal to a given object.
obj | An object to count against |
Definition at line 308 of file nlist.hpp.
References at(), gotoFirst(), and size().
nuint64 size | ( | void | ) | const [inline] |
Gets the current number of itens in the class.
Definition at line 323 of file nlist.hpp.
References count().
Referenced by clear(), contains(), copy(), count(), NMySql::getFirst(), NMySql::getNext(), gotoPos(), last(), and takeLast().
bool isEmpty | ( | void | ) | const [inline] |
NList< T > & append | ( | const T & | val | ) | [inline] |
Inserts an item at the end of the list.
val | The item to be inserted |
Definition at line 329 of file nlist.hpp.
References NListNode::data, isEmpty(), m_count, m_first, m_node, and NListNode::previous.
Referenced by NGetOpt::add(), NHostAddress::addresses(), NOpt::addValue(), NHostAddress::aliases(), copy(), NMap::keys(), NList(), NGetOpt::proccess(), NString::split(), and NMap::values().
Inserts an item at a given position in the list.
val | The item to be inserted | |
pos | Position where to insert the item |
Definition at line 370 of file nlist.hpp.
References NListNode::data, gotoPos(), isEmpty(), m_count, m_node, NListNode::next, and NListNode::previous.
Removes item at a given position.
pos | Position of the item to be removed |
Definition at line 396 of file nlist.hpp.
References count(), gotoPos(), m_count, m_first, m_node, NListNode::next, and NListNode::previous.
const T & at | ( | nuint64 | pos | ) | const [inline] |
Returns the item at a given position in the list.
pos | Position of the item to be removed |
Definition at line 433 of file nlist.hpp.
References gotoPos(), and m_node.
Referenced by contains(), count(), NMySql::getFirst(), NMySql::getNext(), and NMySql::getPrevious().
T value | ( | nuint64 | pos | ) | const [inline] |
T & first | ( | void | ) | [inline] |
T & last | ( | void | ) | [inline] |
T takeFirst | ( | void | ) | [inline] |
T takeLast | ( | void | ) | [inline] |
T takeAt | ( | nuint64 | pos | ) | [inline] |
Removes the a item with a given position on the list and returns it.
Definition at line 518 of file nlist.hpp.
References removeAt(), and value().
Referenced by takeFirst(), and takeLast().
Copies one list to another.
other | A NList object with items to be coppied |
Definition at line 475 of file nlist.hpp.
References append(), clear(), size(), and value().
Referenced by NOpt::addValues(), NList(), NSortedList::NSortedList(), and operator=().
bool hasNext | ( | void | ) | const [inline] |
bool hasPrevious | ( | void | ) | const [inline] |
bool contains | ( | const T & | val | ) | const [inline] |
Returns whether there is an item equal to val.
Definition at line 534 of file nlist.hpp.
Referenced by NGetOpt::add(), and NSortedList::insert().
NLISTITERATOR_CONST constBegin | ( | void | ) | const [inline] |
Returns an iterator pointing to the last item in the list.
Definition at line 726 of file nlist.hpp.
Referenced by NGetOpt::proccess().
NLISTITERATOR_CONST constEnd | ( | void | ) | const [inline] |
void gotoPos | ( | nuint64 | pos | ) | const [inline, protected] |
The first node of the list
Definition at line 239 of file nlist.hpp.
Referenced by append(), begin(), constBegin(), gotoFirst(), and removeAt().
The current node
Definition at line 240 of file nlist.hpp.
Referenced by append(), at(), first(), gotoFirst(), gotoPos(), hasNext(), hasPrevious(), insert(), NList::iterator::iterator(), last(), NList::iterator::operator *(), NList::iterator::operator!=(), NList::iterator::operator++(), NList::iterator::operator->(), NList::iterator::operator=(), NList::iterator::operator==(), removeAt(), and value().