DCL 4.0
Loading...
Searching...
No Matches
List< ELEMENT > Class Template Reference

#include <__ListT-GCC.h>

Inheritance diagram for List< ELEMENT >:
Object Object

Public Member Functions

virtual ~List ()
 List ()
 List (const List< ELEMENT > &_src)
const List< ELEMENT > & operator= (const List< ELEMENT > &_src)
ConstIterator begin () const
ConstIterator end () const
Iterator begin ()
Iterator end ()
ReverseConstIterator rbegin () const
ReverseConstIterator rend () const
ReverseIterator rbegin ()
ReverseIterator rend ()
Iterator insert (Iterator _pos, const ELEMENT &_element)
void insert (Iterator _pos, ConstIterator _first, ConstIterator _last)
Iterator erase (Iterator _pos)
void splice (Iterator _pos, List< ELEMENT > &_other, Iterator _otherFirst, Iterator _otherLast)
List< ELEMENT > & addHead (const ELEMENT &_element)
List< ELEMENT > & addTail (const ELEMENT &_element)
List< ELEMENT > & add (const ELEMENT &_element)
ELEMENT removeHead ()
ELEMENT removeTail ()
void clear ()
bool isEmpty () const
size_t size () const
virtual ~List ()
 List ()
 List (const List< ELEMENT > &_src)
const List< ELEMENT > & operator= (const List< ELEMENT > &_src)
ConstIterator begin () const
ConstIterator end () const
Iterator begin ()
Iterator end ()
ReverseConstIterator rbegin () const
ReverseConstIterator rend () const
ReverseIterator rbegin ()
ReverseIterator rend ()
Iterator insert (Iterator _pos, const ELEMENT &_element)
void insert (Iterator _pos, ConstIterator _first, ConstIterator _last)
Iterator erase (Iterator _pos)
void splice (Iterator _pos, List< ELEMENT > &_other, Iterator _otherFirst, Iterator _otherLast)
List< ELEMENT > & addHead (const ELEMENT &_element)
List< ELEMENT > & addTail (const ELEMENT &_element)
List< ELEMENT > & add (const ELEMENT &_element)
ELEMENT removeHead ()
ELEMENT removeTail ()
void clear ()
bool isEmpty () const
size_t size () const
Public Member Functions inherited from Object
virtual String toString () const
virtual void destroy ()
String className () const
bool isInstanceOf (const std::type_info &typeinfo) const
virtual const std::type_info & typeInfo () const

Protected Member Functions

size_t size (ConstIterator _first, ConstIterator _last) const
void move (Iterator posTo, Iterator _first, Iterator _last)
ListNode * createNode (const ELEMENT &_element)
void destroyNode (ListNode *_pNode)
size_t size (ConstIterator _first, ConstIterator _last) const
void move (Iterator posTo, Iterator _first, Iterator _last)
ListNode * createNode (const ELEMENT &_element)
void destroyNode (ListNode *_pNode)
Protected Member Functions inherited from Object
virtual ~Object ()
 Object ()

Protected Attributes

NodeBase__pMasterNode
size_t __size

Detailed Description

template<typename ELEMENT>
class List< ELEMENT >

Definition at line 14 of file __ListT-GCC.h.

Constructor & Destructor Documentation

◆ ~List() [1/2]

template<typename ELEMENT>
List< ELEMENT >::~List ( )
virtual

Definition at line 634 of file __ListT-GCC.h.

635{
636 if (!isEmpty())
637 clear();
639}
void CharsetConvertException *__fields clear()
NodeBase * __pMasterNode
bool isEmpty() const

◆ List() [1/4]

template<typename ELEMENT>
List< ELEMENT >::List ( )

Definition at line 642 of file __ListT-GCC.h.

643{
645 // FIXME!
646 // if (pNode == NULL)
647 // throw new BadAllocException(sizeof(HashNode), __THIS_FILE__, __LINE__);
649
652 __size = 0;
653}
#define __DCL_ASSERT(expr)
Definition Object.h:371
size_t __size

◆ List() [2/4]

template<typename ELEMENT>
List< ELEMENT >::List ( const List< ELEMENT > & _src)

Definition at line 656 of file __ListT-GCC.h.

657{
659 // FIXME!
660 // if (pNode == NULL)
661 // throw new BadAllocException(sizeof(HashNode), __THIS_FILE__, __LINE__);
663
666 __size = 0;
667
668 insert(end(), _src.begin(), _src.end());
669}
ConstIterator end() const
Iterator insert(Iterator _pos, const ELEMENT &_element)
ConstIterator begin() const

◆ ~List() [2/2]

template<typename ELEMENT>
virtual List< ELEMENT >::~List ( )
virtual

◆ List() [3/4]

template<typename ELEMENT>
List< ELEMENT >::List ( )

◆ List() [4/4]

template<typename ELEMENT>
List< ELEMENT >::List ( const List< ELEMENT > & _src)

Member Function Documentation

◆ add() [1/2]

template<typename ELEMENT>
List< ELEMENT > & List< ELEMENT >::add ( const ELEMENT & _element)
inline

Definition at line 602 of file __ListT-GCC.h.

603{
604 insert(end(), _element);
605 return *this;
606}

◆ add() [2/2]

template<typename ELEMENT>
List< ELEMENT > & List< ELEMENT >::add ( const ELEMENT & _element)

◆ addHead() [1/2]

template<typename ELEMENT>
List< ELEMENT > & List< ELEMENT >::addHead ( const ELEMENT & _element)
inline

Definition at line 584 of file __ListT-GCC.h.

585{
587 return *this;
588}

◆ addHead() [2/2]

template<typename ELEMENT>
List< ELEMENT > & List< ELEMENT >::addHead ( const ELEMENT & _element)

◆ addTail() [1/2]

template<typename ELEMENT>
List< ELEMENT > & List< ELEMENT >::addTail ( const ELEMENT & _element)
inline

Definition at line 593 of file __ListT-GCC.h.

594{
595 insert(end(), _element);
596 return *this;
597}

◆ addTail() [2/2]

template<typename ELEMENT>
List< ELEMENT > & List< ELEMENT >::addTail ( const ELEMENT & _element)

◆ begin() [1/4]

template<typename ELEMENT>
List< ELEMENT >::Iterator List< ELEMENT >::begin ( )
inline

Definition at line 520 of file __ListT-GCC.h.

521{
522 return __pMasterNode->pNext;
523}

◆ begin() [2/4]

template<typename ELEMENT>
Iterator List< ELEMENT >::begin ( )

◆ begin() [3/4]

template<typename ELEMENT>
List< ELEMENT >::ConstIterator List< ELEMENT >::begin ( ) const
inline

Definition at line 504 of file __ListT-GCC.h.

505{
506 return __pMasterNode->pNext;
507}

◆ begin() [4/4]

template<typename ELEMENT>
ConstIterator List< ELEMENT >::begin ( ) const

◆ clear() [1/2]

template<typename ELEMENT>
void List< ELEMENT >::clear ( )

Definition at line 742 of file __ListT-GCC.h.

743{
745 NodeBase* pNode = __pMasterNode->pNext;
746 while(pNode != __pMasterNode)
747 {
749 pNode = pNode->pNext;
751 }
754 __size = 0;
755}
void destroyNode(ListNode *_pNode)

◆ clear() [2/2]

template<typename ELEMENT>
void List< ELEMENT >::clear ( )

◆ createNode() [1/2]

template<typename ELEMENT>
List< ELEMENT >::ListNode * List< ELEMENT >::createNode ( const ELEMENT & _element)
protected

Definition at line 686 of file __ListT-GCC.h.

687{
688 ListNode* pNode = (ListNode*) malloc(sizeof(ListNode));
689 // FIXME!
690 // if (pNode == NULL)
691 // throw new BadAllocException(sizeof(HashNode), __THIS_FILE__, __LINE__);
692
693#if __DCL_HAVE_ALLOC_DEBUG
694#undef new
695#endif
696
697 new(&(pNode->data)) ELEMENT;
698
699#if __DCL_HAVE_ALLOC_DEBUG
700#define new __DCL_DEBUG_NEW
701#endif
702
703 pNode->data = _element;
704 return pNode;
705}

◆ createNode() [2/2]

template<typename ELEMENT>
ListNode * List< ELEMENT >::createNode ( const ELEMENT & _element)
protected

◆ destroyNode() [1/2]

template<typename ELEMENT>
void List< ELEMENT >::destroyNode ( ListNode * _pNode)
protected

Definition at line 709 of file __ListT-GCC.h.

710{
711 _pNode->data.~ELEMENT();
712 free(_pNode);
713}

◆ destroyNode() [2/2]

template<typename ELEMENT>
void List< ELEMENT >::destroyNode ( ListNode * _pNode)
protected

◆ end() [1/4]

template<typename ELEMENT>
List< ELEMENT >::Iterator List< ELEMENT >::end ( )
inline

Definition at line 528 of file __ListT-GCC.h.

529{
530 return __pMasterNode;
531}

◆ end() [2/4]

template<typename ELEMENT>
Iterator List< ELEMENT >::end ( )

◆ end() [3/4]

template<typename ELEMENT>
List< ELEMENT >::ConstIterator List< ELEMENT >::end ( ) const
inline

Definition at line 512 of file __ListT-GCC.h.

513{
514 return __pMasterNode;
515}

◆ end() [4/4]

template<typename ELEMENT>
ConstIterator List< ELEMENT >::end ( ) const

◆ erase() [1/2]

template<typename ELEMENT>
List< ELEMENT >::Iterator List< ELEMENT >::erase ( Iterator _pos)

Definition at line 759 of file __ListT-GCC.h.

760{
761 __DCL_ASSERT(_pos != end());
762 ListNode* pNodeTemp = (ListNode*)_pos.__pNode;
763 NodeBase* pNext = pNodeTemp->pNext;
764 pNodeTemp->pPrev->pNext = pNodeTemp->pNext;
765 pNodeTemp->pNext->pPrev = pNodeTemp->pPrev;
767 __size--;
768 return (ListNode*)pNext;
769}

◆ erase() [2/2]

template<typename ELEMENT>
Iterator List< ELEMENT >::erase ( Iterator _pos)

◆ insert() [1/4]

template<typename ELEMENT>
List< ELEMENT >::Iterator List< ELEMENT >::insert ( Iterator _pos,
const ELEMENT & _element )

Definition at line 717 of file __ListT-GCC.h.

718{
720 pNewNode->pPrev = _pos.__pNode->pPrev;
721 pNewNode->pNext = _pos.__pNode;
722 _pos.__pNode->pPrev->pNext = pNewNode;
723 _pos.__pNode->pPrev = pNewNode;
724
725 __size++;
726
727 return (ListNode*)pNewNode;
728}
ListNode * createNode(const ELEMENT &_element)

◆ insert() [2/4]

template<typename ELEMENT>
Iterator List< ELEMENT >::insert ( Iterator _pos,
const ELEMENT & _element )

◆ insert() [3/4]

template<typename ELEMENT>
void List< ELEMENT >::insert ( Iterator _pos,
ConstIterator _first,
ConstIterator _last )

Definition at line 732 of file __ListT-GCC.h.

733{
734 for(; _first != _last; _first++)
735 {
736 insert(_pos, *_first);
737 }
738}

◆ insert() [4/4]

template<typename ELEMENT>
void List< ELEMENT >::insert ( Iterator _pos,
ConstIterator _first,
ConstIterator _last )

◆ isEmpty() [1/2]

template<typename ELEMENT>
bool List< ELEMENT >::isEmpty ( ) const
inline

Definition at line 568 of file __ListT-GCC.h.

569{
570 return __pMasterNode->pNext == __pMasterNode;
571}

◆ isEmpty() [2/2]

template<typename ELEMENT>
bool List< ELEMENT >::isEmpty ( ) const

◆ move() [1/2]

template<typename ELEMENT>
void List< ELEMENT >::move ( Iterator posTo,
Iterator _first,
Iterator _last )
protected

Definition at line 794 of file __ListT-GCC.h.

795{
796 if (_pos != _last)
797 {
798 _last.__pNode->pPrev->pNext = _pos.__pNode;
799 _first.__pNode->pPrev->pNext = _last.__pNode;
800 _pos.__pNode->pPrev->pNext = _first.__pNode;
801
802 NodeBase* pTemp = _pos.__pNode->pPrev;
803 _pos.__pNode->pPrev = _last.__pNode->pPrev;
804 _last.__pNode->pPrev = _first.__pNode->pPrev;
805 _first.__pNode->pPrev = pTemp;
806 }
807}

◆ move() [2/2]

template<typename ELEMENT>
void List< ELEMENT >::move ( Iterator posTo,
Iterator _first,
Iterator _last )
protected

◆ operator=() [1/2]

template<typename ELEMENT>
const List< ELEMENT > & List< ELEMENT >::operator= ( const List< ELEMENT > & _src)

Definition at line 673 of file __ListT-GCC.h.

674{
675 if (&_src != this)
676 {
677 if (!isEmpty())
678 clear();
679 insert(end(), _src.begin(), _src.end());
680 }
681 return *this;
682}

◆ operator=() [2/2]

template<typename ELEMENT>
const List< ELEMENT > & List< ELEMENT >::operator= ( const List< ELEMENT > & _src)

◆ rbegin() [1/4]

template<typename ELEMENT>
List< ELEMENT >::ReverseIterator List< ELEMENT >::rbegin ( )
inline

Definition at line 552 of file __ListT-GCC.h.

553{
554 return __pMasterNode->pPrev;
555}

◆ rbegin() [2/4]

template<typename ELEMENT>
ReverseIterator List< ELEMENT >::rbegin ( )

◆ rbegin() [3/4]

template<typename ELEMENT>
List< ELEMENT >::ReverseConstIterator List< ELEMENT >::rbegin ( ) const
inline

Definition at line 536 of file __ListT-GCC.h.

537{
538 return __pMasterNode->pPrev;
539}

◆ rbegin() [4/4]

template<typename ELEMENT>
ReverseConstIterator List< ELEMENT >::rbegin ( ) const

◆ removeHead() [1/2]

template<typename ELEMENT>
ELEMENT List< ELEMENT >::removeHead ( )

Definition at line 773 of file __ListT-GCC.h.

774{
776 ELEMENT result = *begin();
777 erase(begin());
778 return result;
779}
Iterator erase(Iterator _pos)

◆ removeHead() [2/2]

template<typename ELEMENT>
ELEMENT List< ELEMENT >::removeHead ( )

◆ removeTail() [1/2]

template<typename ELEMENT>
ELEMENT List< ELEMENT >::removeTail ( )

Definition at line 783 of file __ListT-GCC.h.

784{
786 Iterator it = end();
787 ELEMENT result = *(--it);
788 erase(it);
789 return result;
790}

◆ removeTail() [2/2]

template<typename ELEMENT>
ELEMENT List< ELEMENT >::removeTail ( )

◆ rend() [1/4]

template<typename ELEMENT>
List< ELEMENT >::ReverseIterator List< ELEMENT >::rend ( )
inline

Definition at line 560 of file __ListT-GCC.h.

561{
562 return __pMasterNode;
563}

◆ rend() [2/4]

template<typename ELEMENT>
ReverseIterator List< ELEMENT >::rend ( )

◆ rend() [3/4]

template<typename ELEMENT>
List< ELEMENT >::ReverseConstIterator List< ELEMENT >::rend ( ) const
inline

Definition at line 544 of file __ListT-GCC.h.

545{
546 return __pMasterNode;
547}

◆ rend() [4/4]

template<typename ELEMENT>
ReverseConstIterator List< ELEMENT >::rend ( ) const

◆ size() [1/4]

template<typename ELEMENT>
size_t List< ELEMENT >::size ( ) const
inline

Definition at line 576 of file __ListT-GCC.h.

577{
578 return __size;
579}

◆ size() [2/4]

template<typename ELEMENT>
size_t List< ELEMENT >::size ( ) const

◆ size() [3/4]

template<typename ELEMENT>
size_t List< ELEMENT >::size ( ConstIterator _first,
ConstIterator _last ) const
protected

Definition at line 824 of file __ListT-GCC.h.

825{
826 size_t nCount = 0;
827 for(; _first != _last; _first++)
828 nCount++;
829 return nCount;
830}

◆ size() [4/4]

template<typename ELEMENT>
size_t List< ELEMENT >::size ( ConstIterator _first,
ConstIterator _last ) const
protected

◆ splice() [1/2]

template<typename ELEMENT>
void List< ELEMENT >::splice ( Iterator _pos,
List< ELEMENT > & _other,
Iterator _otherFirst,
Iterator _otherLast )

Definition at line 811 of file __ListT-GCC.h.

813{
814 size_t nMoveCount = size((ListNode*)(_otherFirst.__pNode),
815 (ListNode*)(_otherLast.__pNode));
818
820}
void move(Iterator posTo, Iterator _first, Iterator _last)
size_t size() const

◆ splice() [2/2]

template<typename ELEMENT>
void List< ELEMENT >::splice ( Iterator _pos,
List< ELEMENT > & _other,
Iterator _otherFirst,
Iterator _otherLast )

Member Data Documentation

◆ __pMasterNode

template<typename ELEMENT>
NodeBase * List< ELEMENT >::__pMasterNode
protected

Definition at line 128 of file __ListT-GCC.h.

◆ __size

template<typename ELEMENT>
size_t List< ELEMENT >::__size
protected

Definition at line 129 of file __ListT-GCC.h.


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