Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
QGList Class Reference

The QGList class is an internal class for implementing Qt collection classes. More...

#include <qglist.h>

Inheritance diagram for QGList:
QCollection QInternalList< type > QInternalList< QCacheItem > QInternalList< QGDictIterator > QInternalList< QWaitConditionEvent > QList< type > QList< ActiveRowSpan > QList< AlphaIndexTableCell > QList< AlphaIndexTableRows > QList< Argument > QList< ArgumentList > QList< BaseClassDef > QList< BaseInfo > QList< CallContext::Ctx > QList< ChildNodeHandler > QList< ClassDef > QList< CodeLineHandler > QList< CompoundEntry > QList< ConfigOption > QList< Define > QList< DefineName > QList< Definition > QList< DiagramItem > QList< DiagramRow > QList< DirDef > QList< DirEntry > QList< DirRelation > QList< DocImpl > QList< DocNode > QList< DocPara > QList< DocSets::NodeDef > QList< DotConstString > QList< DotFilePatcher > QList< DotFilePatcher::Map > QList< DotGroupCollaboration::Edge > QList< DotGroupCollaboration::Link > QList< DotNode > QList< DotRunner > QList< DotRunner::CleanupItem > QList< DotWorkerThread > QList< EdgeInfo > QList< EdgeLabelHandler > QList< Entry > QList< EntryHandler > QList< EntryNav > QList< Example > QList< ExprAst > QList< FileDef > QList< FileList > QList< FileName > QList< FilePair > QList< FlowChart > QList< Formula > QList< FTVNode > QList< GenericsCollection > QList< GroupDef > QList< Grouping > QList< HtmlAttrib > QList< IncludeHandler > QList< IncludeInfo > QList< IndexField > QList< IndexIntf > QList< Input * > QList< LayoutDocEntry > QList< LayoutNavEntry > QList< LinkedTextImpl > QList< ListElem > QList< ListItemInfo > QList< MemberDef > QList< MemberGroup > QList< MemberHandler > QList< MemberInfo > QList< MemberList > QList< MemberName > QList< MemberNameInfo > QList< MemberReference > QList< NamespaceDef > QList< NavIndexEntry > QList< NodeHandler > QList< OutputGenerator > QList< PageDef > QList< ParameterHandler > QList< ParameterItemHandler > QList< ParamHandler > QList< PyCallContext::Ctx > QList< PyVariableContext::Scope > QList< QCString > QList< QDict< TemplateVariant > > QList< QString > QList< RefItem > QList< RelatedCompound > QList< RowHandler > QList< SearchDefinitionList > QList< SearchDocEntry > QList< SearchIndexList > QList< SectionHandler > QList< SectionInfo > QList< Statistics::stat > QList< T > QList< TagAnchorInfo > QList< TagClassInfo > QList< TagDirInfo > QList< TagEnumValueInfo > QList< TagFileInfo > QList< TagGroupInfo > QList< TagIncludeInfo > QList< TagMemberInfo > QList< TagNamespaceInfo > QList< TagPackageInfo > QList< TagPageInfo > QList< tcl_scan > QList< TemplateEngine::Private::IncludeEntry > QList< TemplateNode > QList< TemplateNodeIf::GuardedNodes > QList< TemplateNodeIndexEntry::Mapping > QList< TemplateNodeWith::Mapping > QList< TemplateToken > QList< TemplateVariant > QList< uint > QList< UseEntry > QList< VariableContext::Scope > QList< VariableListEntryHandler > QList< void > QQueue< type > QQueue< DotRunner > QStack< type > QStack< bool > QStack< DocNode > QStack< DocStyleChange > QStack< LatexDocVisitor::TableState > QStack< PerlModOutputStream > QStack< State >

Public Member Functions

uint count () const
 
QDataStreamread (QDataStream &)
 
QDataStreamwrite (QDataStream &) const
 
- Public Member Functions inherited from QCollection
bool autoDelete () const
 
void setAutoDelete (bool enable)
 

Protected Member Functions

 QGList ()
 
 QGList (const QGList &)
 
virtual ~QGList ()
 
QGListoperator= (const QGList &)
 
bool operator== (const QGList &) const
 
void inSort (QCollection::Item)
 
void append (QCollection::Item)
 
bool insertAt (uint index, QCollection::Item)
 
void relinkNode (QLNode *)
 
bool removeNode (QLNode *)
 
bool remove (QCollection::Item=0)
 
bool removeRef (QCollection::Item=0)
 
bool removeFirst ()
 
bool removeLast ()
 
bool removeAt (uint index)
 
QCollection::Item takeNode (QLNode *)
 
QCollection::Item take ()
 
QCollection::Item takeAt (uint index)
 
QCollection::Item takeFirst ()
 
QCollection::Item takeLast ()
 
void sort ()
 
void clear ()
 
int findRef (QCollection::Item, bool=TRUE)
 
int find (QCollection::Item, bool=TRUE)
 
uint containsRef (QCollection::Item) const
 
uint contains (QCollection::Item) const
 
QCollection::Item at (uint index)
 
int at () const
 
QLNodecurrentNode () const
 
QCollection::Item get () const
 
QCollection::Item cfirst () const
 
QCollection::Item clast () const
 
QCollection::Item first ()
 
QCollection::Item last ()
 
QCollection::Item next ()
 
QCollection::Item prev ()
 
void toVector (QGVector *) const
 
virtual int compareItems (QCollection::Item, QCollection::Item)
 
virtual QDataStreamread (QDataStream &, QCollection::Item &)
 
virtual QDataStreamwrite (QDataStream &, QCollection::Item) const
 
- Protected Member Functions inherited from QCollection
 QCollection ()
 
 QCollection (const QCollection &)
 
virtual ~QCollection ()
 
virtual Item newItem (Item)
 
virtual void deleteItem (Item)
 

Private Member Functions

void prepend (QCollection::Item)
 
void heapSortPushDown (QCollection::Item *heap, int first, int last)
 
QLNodelocate (uint)
 
QLNodeunlink ()
 

Private Attributes

QLNodefirstNode
 
QLNodelastNode
 
QLNodecurNode
 
int curIndex
 
uint numNodes
 
QGListiterators
 

Friends

class QGListIterator
 
class QGVector
 

Additional Inherited Members

- Public Types inherited from QCollection
typedef void * Item
 
- Protected Attributes inherited from QCollection
bool del_item
 

Detailed Description

The QGList class is an internal class for implementing Qt collection classes.

QGList is a strictly internal class that acts as a base class for several collection classes; QList, QQueue and QStack.

QGList has some virtual functions that can be reimplemented to customize the subclasses.

Normally, you do not have to reimplement any of these functions. If you still want to reimplement them, see the QStrList class (qstrlist.h), which is a good example.

Definition at line 68 of file qglist.h.

Constructor & Destructor Documentation

QGList::QGList ( )
protected

Definition at line 170 of file qglist.cpp.

171 {
172  firstNode = lastNode = curNode = 0; // initialize list
173  numNodes = 0;
174  curIndex = -1;
175  iterators = 0; // initialize iterator list
176 }
QLNode * curNode
Definition: qglist.h:140
QGList * iterators
Definition: qglist.h:143
QLNode * lastNode
Definition: qglist.h:139
uint numNodes
Definition: qglist.h:142
QLNode * firstNode
Definition: qglist.h:138
int curIndex
Definition: qglist.h:141
QGList::QGList ( const QGList list)
protected

Definition at line 183 of file qglist.cpp.

184  : QCollection( list )
185 {
186  firstNode = lastNode = curNode = 0; // initialize list
187  numNodes = 0;
188  curIndex = -1;
189  iterators = 0; // initialize iterator list
190  QLNode *n = list.firstNode;
191  while ( n ) { // copy all items from list
192  append( n->data );
193  n = n->next;
194  }
195 }
void append(QCollection::Item)
Definition: qglist.cpp:364
QLNode * curNode
Definition: qglist.h:140
QGList * iterators
Definition: qglist.h:143
std::void_t< T > n
QLNode * lastNode
Definition: qglist.h:139
uint numNodes
Definition: qglist.h:142
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
int curIndex
Definition: qglist.h:141
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
QGList::~QGList ( )
protectedvirtual

Definition at line 202 of file qglist.cpp.

203 {
204  clear();
205  if ( !iterators ) // no iterators for this list
206  return;
208  while ( i ) { // notify all iterators that
209  i->list = 0; // this list is deleted
210  i->curNode = 0;
211  i = (QGListIterator*)iterators->next();
212  }
213  delete iterators;
214 }
QGList * list
Definition: qglist.h:234
QCollection::Item first()
Definition: qglist.cpp:807
QGList * iterators
Definition: qglist.h:143
QLNode * curNode
Definition: qglist.h:237
QCollection::Item next()
Definition: qglist.cpp:835
void clear()
Definition: qglist.cpp:652
The QGListIterator class is an internal class for implementing QListIterator.
Definition: qglist.h:212

Member Function Documentation

void QGList::append ( QCollection::Item  d)
protected

Definition at line 364 of file qglist.cpp.

365 {
366  register QLNode *n = new QLNode( newItem(d) );
367  CHECK_PTR( n );
368  n->next = 0;
369  if ( (n->prev = lastNode) ) // list is not empty
370  lastNode->next = n;
371  else // initialize list
372  firstNode = n;
373  lastNode = curNode = n; // curNode affected
374  curIndex = numNodes;
375  numNodes++;
376 }
virtual Item newItem(Item)
QLNode * curNode
Definition: qglist.h:140
QLNode * prev
Definition: qglist.h:58
std::void_t< T > n
QLNode * lastNode
Definition: qglist.h:139
uint numNodes
Definition: qglist.h:142
QLNode * firstNode
Definition: qglist.h:138
#define CHECK_PTR(p)
Definition: qglobal.h:601
QLNode * next
Definition: qglist.h:59
int curIndex
Definition: qglist.h:141
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
QCollection::Item QGList::at ( uint  index)
inlineprotected

Definition at line 172 of file qglist.h.

173 {
174  QLNode *n = locate( index );
175  return n ? n->data : 0;
176 }
std::void_t< T > n
QLNode * locate(uint)
Definition: qglist.cpp:275
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
int QGList::at ( ) const
inlineprotected

Definition at line 167 of file qglist.h.

168 {
169  return curIndex;
170 }
int curIndex
Definition: qglist.h:141
QCollection::Item QGList::cfirst ( ) const
inlineprotected

Definition at line 188 of file qglist.h.

189 {
190  return firstNode ? firstNode->data : 0;
191 }
QLNode * firstNode
Definition: qglist.h:138
QCollection::Item data
Definition: qglist.h:57
QCollection::Item QGList::clast ( ) const
inlineprotected

Definition at line 193 of file qglist.h.

194 {
195  return lastNode ? lastNode->data : 0;
196 }
QLNode * lastNode
Definition: qglist.h:139
QCollection::Item data
Definition: qglist.h:57
void QGList::clear ( )
protectedvirtual

Removes all objects from the collection. The objects will be deleted if auto-delete has been enabled.

See also
setAutoDelete()

Implements QCollection.

Reimplemented in QList< type >, QList< PyVariableContext::Scope >, QList< PyCallContext::Ctx >, QList< MemberName >, QList< MemberNameInfo >, QList< PageDef >, QList< DocNode >, QList< TagFileInfo >, QList< Grouping >, QList< ListItemInfo >, QList< QCString >, QList< Definition >, QList< MemberDef >, QList< TagPackageInfo >, QList< SectionHandler >, QList< DirRelation >, QList< MemberReference >, QList< DotNode >, QList< HtmlAttrib >, QList< TagPageInfo >, QList< VariableContext::Scope >, QList< IndexIntf >, QList< Entry >, QList< MemberGroup >, QList< DiagramItem >, QList< DotGroupCollaboration::Link >, QList< TagDirInfo >, QList< EntryNav >, QList< IncludeInfo >, QList< QString >, QList< RelatedCompound >, QList< DotFilePatcher >, QList< tcl_scan >, QList< ParameterItemHandler >, QList< VariableListEntryHandler >, QList< TagNamespaceInfo >, QList< NodeHandler >, QList< EntryHandler >, QList< TemplateVariant >, QList< MemberInfo >, QList< TagGroupInfo >, QList< ChildNodeHandler >, QList< DotWorkerThread >, QList< ExprAst >, QList< TemplateNode >, QList< NamespaceDef >, QList< T >, QList< void >, QList< ParamHandler >, QList< OutputGenerator >, QList< QDict< TemplateVariant > >, QList< GroupDef >, QList< IndexField >, QList< ListElem >, QList< DocSets::NodeDef >, QList< CallContext::Ctx >, QList< DotConstString >, QList< RowHandler >, QList< TemplateEngine::Private::IncludeEntry >, QList< DotRunner::CleanupItem >, QList< Formula >, QList< TemplateToken >, QList< GenericsCollection >, QList< DotGroupCollaboration::Edge >, QList< Statistics::stat >, QList< TagIncludeInfo >, QList< ActiveRowSpan >, QList< FilePair >, QList< ClassDef >, QList< Define >, QList< BaseClassDef >, QList< EdgeInfo >, QList< IncludeHandler >, QList< TemplateNodeIf::GuardedNodes >, QList< TagMemberInfo >, QList< TemplateNodeWith::Mapping >, QList< DotRunner >, QList< RefItem >, QList< FileName >, QList< SearchDocEntry >, QList< FlowChart >, QList< SearchDefinitionList >, QList< SectionInfo >, QList< CodeLineHandler >, QList< TemplateNodeIndexEntry::Mapping >, QList< DocPara >, QList< Input * >, QList< EdgeLabelHandler >, QList< LayoutNavEntry >, QList< ConfigOption >, QList< uint >, QList< AlphaIndexTableCell >, QList< UseEntry >, QList< DefineName >, QList< DirEntry >, QList< ParameterHandler >, QList< MemberList >, QList< LayoutDocEntry >, QList< CompoundEntry >, QList< Argument >, QList< TagAnchorInfo >, QList< FileList >, QList< FileDef >, QList< TagClassInfo >, QList< MemberHandler >, QList< DotFilePatcher::Map >, QList< DocImpl >, QList< ArgumentList >, QList< FTVNode >, QList< BaseInfo >, QList< TagEnumValueInfo >, QList< LinkedTextImpl >, QList< SearchIndexList >, QList< DiagramRow >, QList< AlphaIndexTableRows >, QList< NavIndexEntry >, QList< Example >, QList< DirDef >, QInternalList< type >, QInternalList< QGDictIterator >, QInternalList< QWaitConditionEvent >, QInternalList< QCacheItem >, QQueue< type >, QStack< type >, QQueue< DotRunner >, QStack< DocNode >, QStack< PerlModOutputStream >, QStack< LatexDocVisitor::TableState >, QStack< bool >, QStack< DocStyleChange >, and QStack< State >.

Definition at line 652 of file qglist.cpp.

653 {
654  register QLNode *n = firstNode;
655 
656  firstNode = lastNode = curNode = 0; // initialize list
657  numNodes = 0;
658  curIndex = -1;
659 
660  if ( iterators && iterators->count() ) {
662  while ( i ) { // notify all iterators that
663  i->curNode = 0; // this list is empty
664  i = (QGListIterator*)iterators->next();
665  }
666  }
667 
668  QLNode *prevNode;
669  while ( n ) { // for all nodes ...
670  deleteItem( n->data ); // deallocate data
671  prevNode = n;
672  n = n->next;
673  delete prevNode; // deallocate node
674  }
675 }
QLNode * curNode
Definition: qglist.h:140
QCollection::Item first()
Definition: qglist.cpp:807
QGList * iterators
Definition: qglist.h:143
uint count() const
Definition: qglist.h:150
std::void_t< T > n
QLNode * lastNode
Definition: qglist.h:139
uint numNodes
Definition: qglist.h:142
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
QLNode * curNode
Definition: qglist.h:237
QCollection::Item next()
Definition: qglist.cpp:835
virtual void deleteItem(Item)
int curIndex
Definition: qglist.h:141
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
The QGListIterator class is an internal class for implementing QListIterator.
Definition: qglist.h:212
int QGList::compareItems ( QCollection::Item  item1,
QCollection::Item  item2 
)
protectedvirtual

This virtual function compares two list items.

Returns:

  • 0 if item1 == item2
  • non-zero if item1 != item2

This function returns int rather than bool so that reimplementations can return three values and use it to sort by:

  • 0 if item1 == item2
  • > 0 (positive integer) if item1 > item2
  • < 0 (negative integer) if item1 < item2

The QList::inSort() function requires that compareItems() is implemented as described here.

This function should not modify the list because some const functions call compareItems().

The default implementation compares the pointers:

Reimplemented in QList< type >, QList< PyVariableContext::Scope >, QList< PyCallContext::Ctx >, QList< MemberName >, QList< MemberNameInfo >, QList< PageDef >, QList< DocNode >, QList< TagFileInfo >, QList< Grouping >, QList< ListItemInfo >, QList< QCString >, QList< Definition >, QList< MemberDef >, QList< TagPackageInfo >, QList< SectionHandler >, QList< DirRelation >, QList< MemberReference >, QList< DotNode >, QList< HtmlAttrib >, QList< TagPageInfo >, QList< VariableContext::Scope >, QList< IndexIntf >, QList< Entry >, QList< MemberGroup >, QList< DiagramItem >, QList< DotGroupCollaboration::Link >, QList< TagDirInfo >, QList< EntryNav >, QList< IncludeInfo >, QList< QString >, QList< RelatedCompound >, QList< DotFilePatcher >, QList< tcl_scan >, QList< ParameterItemHandler >, QList< VariableListEntryHandler >, QList< TagNamespaceInfo >, QList< NodeHandler >, QList< EntryHandler >, QList< TemplateVariant >, QList< MemberInfo >, QList< TagGroupInfo >, QList< ChildNodeHandler >, QList< DotWorkerThread >, QList< ExprAst >, QList< TemplateNode >, QList< NamespaceDef >, QList< T >, QList< void >, QList< ParamHandler >, QList< OutputGenerator >, QList< QDict< TemplateVariant > >, QList< GroupDef >, QList< IndexField >, QList< ListElem >, QList< DocSets::NodeDef >, QList< CallContext::Ctx >, QList< DotConstString >, QList< RowHandler >, QList< TemplateEngine::Private::IncludeEntry >, QList< DotRunner::CleanupItem >, QList< Formula >, QList< TemplateToken >, QList< GenericsCollection >, QList< DotGroupCollaboration::Edge >, QList< Statistics::stat >, QList< TagIncludeInfo >, QList< ActiveRowSpan >, QList< FilePair >, QList< ClassDef >, QList< Define >, QList< BaseClassDef >, QList< EdgeInfo >, QList< IncludeHandler >, QList< TemplateNodeIf::GuardedNodes >, QList< TagMemberInfo >, QList< TemplateNodeWith::Mapping >, QList< DotRunner >, QList< RefItem >, QList< FileName >, QList< SearchDocEntry >, QList< FlowChart >, QList< SearchDefinitionList >, QList< SectionInfo >, QList< CodeLineHandler >, QList< TemplateNodeIndexEntry::Mapping >, QList< DocPara >, QList< Input * >, QList< EdgeLabelHandler >, QList< LayoutNavEntry >, QList< ConfigOption >, QList< uint >, QList< AlphaIndexTableCell >, QList< UseEntry >, QList< DefineName >, QList< DirEntry >, QList< ParameterHandler >, QList< MemberList >, QList< LayoutDocEntry >, QList< CompoundEntry >, QList< Argument >, QList< TagAnchorInfo >, QList< FileList >, QList< FileDef >, QList< TagClassInfo >, QList< MemberHandler >, QList< DotFilePatcher::Map >, QList< DocImpl >, QList< ArgumentList >, QList< FTVNode >, QList< BaseInfo >, QList< TagEnumValueInfo >, QList< LinkedTextImpl >, QList< SearchIndexList >, QList< DiagramRow >, QList< AlphaIndexTableRows >, QList< NavIndexEntry >, QList< Example >, QList< DirDef >, QStrIList, QStrList, and QSortedList< type >.

Definition at line 125 of file qglist.cpp.

126 {
127  return item1 != item2; // compare pointers
128 }
uint QGList::contains ( QCollection::Item  d) const
protected

Definition at line 751 of file qglist.cpp.

752 {
753  register QLNode *n = firstNode;
754  uint count = 0;
755  QGList *that = (QGList*)this; // mutable for compareItems()
756  while ( n ) { // for all nodes...
757  if ( !that->compareItems(n->data,d) ) // count # equal matches
758  count++;
759  n = n->next;
760  }
761  return count;
762 }
virtual int compareItems(QCollection::Item, QCollection::Item)
Definition: qglist.cpp:125
uint count() const
Definition: qglist.h:150
std::void_t< T > n
The QGList class is an internal class for implementing Qt collection classes.
Definition: qglist.h:68
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
QCollection::Item data
Definition: qglist.h:57
unsigned uint
Definition: qglobal.h:351
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
uint QGList::containsRef ( QCollection::Item  d) const
protected

Definition at line 734 of file qglist.cpp.

735 {
736  register QLNode *n = firstNode;
737  uint count = 0;
738  while ( n ) { // for all nodes...
739  if ( n->data == d ) // count # exact matches
740  count++;
741  n = n->next;
742  }
743  return count;
744 }
uint count() const
Definition: qglist.h:150
std::void_t< T > n
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
QCollection::Item data
Definition: qglist.h:57
unsigned uint
Definition: qglobal.h:351
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
uint QGList::count ( ) const
inlinevirtual

Returns the number of objects in the collection.

Implements QCollection.

Reimplemented in QList< type >, QList< PyVariableContext::Scope >, QList< PyCallContext::Ctx >, QList< MemberName >, QList< MemberNameInfo >, QList< PageDef >, QList< DocNode >, QList< TagFileInfo >, QList< Grouping >, QList< ListItemInfo >, QList< QCString >, QList< Definition >, QList< MemberDef >, QList< TagPackageInfo >, QList< SectionHandler >, QList< DirRelation >, QList< MemberReference >, QList< DotNode >, QList< HtmlAttrib >, QList< TagPageInfo >, QList< VariableContext::Scope >, QList< IndexIntf >, QList< Entry >, QList< MemberGroup >, QList< DiagramItem >, QList< DotGroupCollaboration::Link >, QList< TagDirInfo >, QList< EntryNav >, QList< IncludeInfo >, QList< QString >, QList< RelatedCompound >, QList< DotFilePatcher >, QList< tcl_scan >, QList< ParameterItemHandler >, QList< VariableListEntryHandler >, QList< TagNamespaceInfo >, QList< NodeHandler >, QList< EntryHandler >, QList< TemplateVariant >, QList< MemberInfo >, QList< TagGroupInfo >, QList< ChildNodeHandler >, QList< DotWorkerThread >, QList< ExprAst >, QList< TemplateNode >, QList< NamespaceDef >, QList< T >, QList< void >, QList< ParamHandler >, QList< OutputGenerator >, QList< QDict< TemplateVariant > >, QList< GroupDef >, QList< IndexField >, QList< ListElem >, QList< DocSets::NodeDef >, QList< CallContext::Ctx >, QList< DotConstString >, QList< RowHandler >, QList< TemplateEngine::Private::IncludeEntry >, QList< DotRunner::CleanupItem >, QList< Formula >, QList< TemplateToken >, QList< GenericsCollection >, QList< DotGroupCollaboration::Edge >, QList< Statistics::stat >, QList< TagIncludeInfo >, QList< ActiveRowSpan >, QList< FilePair >, QList< ClassDef >, QList< Define >, QList< BaseClassDef >, QList< EdgeInfo >, QList< IncludeHandler >, QList< TemplateNodeIf::GuardedNodes >, QList< TagMemberInfo >, QList< TemplateNodeWith::Mapping >, QList< DotRunner >, QList< RefItem >, QList< FileName >, QList< SearchDocEntry >, QList< FlowChart >, QList< SearchDefinitionList >, QList< SectionInfo >, QList< CodeLineHandler >, QList< TemplateNodeIndexEntry::Mapping >, QList< DocPara >, QList< Input * >, QList< EdgeLabelHandler >, QList< LayoutNavEntry >, QList< ConfigOption >, QList< uint >, QList< AlphaIndexTableCell >, QList< UseEntry >, QList< DefineName >, QList< DirEntry >, QList< ParameterHandler >, QList< MemberList >, QList< LayoutDocEntry >, QList< CompoundEntry >, QList< Argument >, QList< TagAnchorInfo >, QList< FileList >, QList< FileDef >, QList< TagClassInfo >, QList< MemberHandler >, QList< DotFilePatcher::Map >, QList< DocImpl >, QList< ArgumentList >, QList< FTVNode >, QList< BaseInfo >, QList< TagEnumValueInfo >, QList< LinkedTextImpl >, QList< SearchIndexList >, QList< DiagramRow >, QList< AlphaIndexTableRows >, QList< NavIndexEntry >, QList< Example >, QList< DirDef >, QInternalList< type >, QQueue< type >, QStack< type >, QInternalList< QGDictIterator >, QInternalList< QWaitConditionEvent >, QInternalList< QCacheItem >, QQueue< DotRunner >, QStack< DocNode >, QStack< PerlModOutputStream >, QStack< LatexDocVisitor::TableState >, QStack< bool >, QStack< DocStyleChange >, and QStack< State >.

Definition at line 150 of file qglist.h.

151 {
152  return numNodes;
153 }
uint numNodes
Definition: qglist.h:142
QLNode * QGList::currentNode ( ) const
inlineprotected

Definition at line 178 of file qglist.h.

179 {
180  return curNode;
181 }
QLNode * curNode
Definition: qglist.h:140
int QGList::find ( QCollection::Item  d,
bool  fromStart = TRUE 
)
protected

Definition at line 708 of file qglist.cpp.

709 {
710  register QLNode *n;
711  int index;
712  if ( fromStart ) { // start from first node
713  n = firstNode;
714  index = 0;
715  } else { // start from current node
716  n = curNode;
717  index = curIndex;
718  }
719  while ( n && compareItems(n->data,d) ){ // find equal match
720  n = n->next;
721  index++;
722  }
723  curNode = n;
724  curIndex = n ? index : -1;
725  return curIndex; // return position of item
726 }
virtual int compareItems(QCollection::Item, QCollection::Item)
Definition: qglist.cpp:125
QLNode * curNode
Definition: qglist.h:140
std::void_t< T > n
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
int curIndex
Definition: qglist.h:141
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
int QGList::findRef ( QCollection::Item  d,
bool  fromStart = TRUE 
)
protected

Definition at line 683 of file qglist.cpp.

684 {
685  register QLNode *n;
686  int index;
687  if ( fromStart ) { // start from first node
688  n = firstNode;
689  index = 0;
690  } else { // start from current node
691  n = curNode;
692  index = curIndex;
693  }
694  while ( n && n->data != d ) { // find exact match
695  n = n->next;
696  index++;
697  }
698  curNode = n;
699  curIndex = n ? index : -1;
700  return curIndex; // return position of item
701 }
QLNode * curNode
Definition: qglist.h:140
std::void_t< T > n
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
int curIndex
Definition: qglist.h:141
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
QCollection::Item QGList::first ( )
protected

Definition at line 807 of file qglist.cpp.

808 {
809  if ( firstNode ) {
810  curIndex = 0;
811  return (curNode=firstNode)->data;
812  }
813  return 0;
814 }
QLNode * curNode
Definition: qglist.h:140
QLNode * firstNode
Definition: qglist.h:138
int curIndex
Definition: qglist.h:141
QCollection::Item QGList::get ( ) const
inlineprotected

Definition at line 183 of file qglist.h.

184 {
185  return curNode ? curNode->data : 0;
186 }
QLNode * curNode
Definition: qglist.h:140
QCollection::Item data
Definition: qglist.h:57
void QGList::heapSortPushDown ( QCollection::Item heap,
int  first,
int  last 
)
private

Definition at line 888 of file qglist.cpp.

889 {
890  int r = first;
891  while( r <= last/2 ) {
892  // Node r has only one child ?
893  if ( last == 2*r ) {
894  // Need for swapping ?
895  if ( compareItems( heap[r], heap[ 2*r ] ) > 0 ) {
896  QCollection::Item tmp = heap[r];
897  heap[ r ] = heap[ 2*r ];
898  heap[ 2*r ] = tmp;
899  }
900  // That's it ...
901  r = last;
902  } else {
903  // Node has two children
904  if ( compareItems( heap[r], heap[ 2*r ] ) > 0 &&
905  compareItems( heap[ 2*r ], heap[ 2*r+1 ] ) <= 0 ) {
906  // Swap with left child
907  QCollection::Item tmp = heap[r];
908  heap[ r ] = heap[ 2*r ];
909  heap[ 2*r ] = tmp;
910  r *= 2;
911  } else if ( compareItems( heap[r], heap[ 2*r+1 ] ) > 0 &&
912  compareItems( heap[ 2*r+1 ], heap[ 2*r ] ) < 0 ) {
913  // Swap with right child
914  QCollection::Item tmp = heap[r];
915  heap[ r ] = heap[ 2*r+1 ];
916  heap[ 2*r+1 ] = tmp;
917  r = 2*r+1;
918  } else {
919  // We are done
920  r = last;
921  }
922  }
923  }
924 }
virtual int compareItems(QCollection::Item, QCollection::Item)
Definition: qglist.cpp:125
QCollection::Item first()
Definition: qglist.cpp:807
string tmp
Definition: languages.py:63
QCollection::Item last()
Definition: qglist.cpp:821
void * Item
Definition: qcollection.h:60
bool QGList::insertAt ( uint  index,
QCollection::Item  d 
)
protected

Definition at line 384 of file qglist.cpp.

385 {
386  if ( index == 0 ) { // insert at head of list
387  prepend( d );
388  return TRUE;
389  } else if ( index == numNodes ) { // append at tail of list
390  append( d );
391  return TRUE;
392  }
393  QLNode *nextNode = locate( index );
394  if ( !nextNode ) // illegal position
395  return FALSE;
396  QLNode *prevNode = nextNode->prev;
397  register QLNode *n = new QLNode( newItem(d) );
398  CHECK_PTR( n );
399  nextNode->prev = n;
400  prevNode->next = n;
401  n->prev = prevNode; // link new node into list
402  n->next = nextNode;
403  curNode = n; // curIndex set by locate()
404  numNodes++;
405  return TRUE;
406 }
virtual Item newItem(Item)
void append(QCollection::Item)
Definition: qglist.cpp:364
void prepend(QCollection::Item)
Definition: qglist.cpp:344
const bool FALSE
Definition: qglobal.h:370
QLNode * curNode
Definition: qglist.h:140
QLNode * prev
Definition: qglist.h:58
std::void_t< T > n
uint numNodes
Definition: qglist.h:142
QLNode * locate(uint)
Definition: qglist.cpp:275
#define CHECK_PTR(p)
Definition: qglobal.h:601
QLNode * next
Definition: qglist.h:59
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
const bool TRUE
Definition: qglobal.h:371
void QGList::inSort ( QCollection::Item  d)
protected

Definition at line 327 of file qglist.cpp.

328 {
329  int index = 0;
330  register QLNode *n = firstNode;
331  while ( n && compareItems(n->data,d) < 0 ){ // find position in list
332  n = n->next;
333  index++;
334  }
335  insertAt( index, d );
336 }
virtual int compareItems(QCollection::Item, QCollection::Item)
Definition: qglist.cpp:125
std::void_t< T > n
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
bool insertAt(uint index, QCollection::Item)
Definition: qglist.cpp:384
QCollection::Item QGList::last ( )
protected

Definition at line 821 of file qglist.cpp.

822 {
823  if ( lastNode ) {
824  curIndex = numNodes-1;
825  return (curNode=lastNode)->data;
826  }
827  return 0;
828 }
QLNode * curNode
Definition: qglist.h:140
QLNode * lastNode
Definition: qglist.h:139
uint numNodes
Definition: qglist.h:142
int curIndex
Definition: qglist.h:141
QLNode * QGList::locate ( uint  index)
private

Definition at line 275 of file qglist.cpp.

276 {
277  if ( index == (uint)curIndex ) // current node ?
278  return curNode;
279  if ( !curNode && firstNode ) { // set current node
280  curNode = firstNode;
281  curIndex = 0;
282  }
283  register QLNode *node;
284  int distance = index - curIndex; // node distance to cur node
285  bool forward; // direction to traverse
286 
287  if ( index >= numNodes ) {
288 #if defined(CHECK_RANGE)
289  qWarning( "QGList::locate: Index %d out of range", index );
290 #endif
291  return 0;
292  }
293 
294  if ( distance < 0 )
295  distance = -distance;
296  if ( (uint)distance < index && (uint)distance < numNodes - index ) {
297  node = curNode; // start from current node
298  forward = index > (uint)curIndex;
299  } else if ( index < numNodes - index ) { // start from first node
300  node = firstNode;
301  distance = index;
302  forward = TRUE;
303  } else { // start from last node
304  node = lastNode;
305  distance = numNodes - index - 1;
306  if ( distance < 0 )
307  distance = 0;
308  forward = FALSE;
309  }
310  if ( forward ) { // now run through nodes
311  while ( distance-- )
312  node = node->next;
313  } else {
314  while ( distance-- )
315  node = node->prev;
316  }
317  curIndex = index; // must update index
318  return curNode = node;
319 }
const bool FALSE
Definition: qglobal.h:370
QLNode * curNode
Definition: qglist.h:140
void qWarning(const char *msg,...)
Definition: qglobal.cpp:409
QLNode * prev
Definition: qglist.h:58
QLNode * lastNode
Definition: qglist.h:139
uint numNodes
Definition: qglist.h:142
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
int curIndex
Definition: qglist.h:141
unsigned uint
Definition: qglobal.h:351
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
const bool TRUE
Definition: qglobal.h:371
QCollection::Item QGList::next ( )
protected

Definition at line 835 of file qglist.cpp.

836 {
837  if ( curNode ) {
838  if ( curNode->next ) {
839  curIndex++;
840  curNode = curNode->next;
841  return curNode->data;
842  }
843  curIndex = -1;
844  curNode = 0;
845  }
846  return 0;
847 }
QLNode * curNode
Definition: qglist.h:140
QLNode * next
Definition: qglist.h:59
int curIndex
Definition: qglist.h:141
QCollection::Item data
Definition: qglist.h:57
QGList & QGList::operator= ( const QGList list)
protected

Definition at line 222 of file qglist.cpp.

223 {
224  clear();
225  if ( list.count() > 0 ) {
226  QLNode *n = list.firstNode;
227  while ( n ) { // copy all items from list
228  append( n->data );
229  n = n->next;
230  }
231  curNode = firstNode;
232  curIndex = 0;
233  }
234  return *this;
235 }
void append(QCollection::Item)
Definition: qglist.cpp:364
QLNode * curNode
Definition: qglist.h:140
uint count() const
Definition: qglist.h:150
std::void_t< T > n
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
int curIndex
Definition: qglist.h:141
QCollection::Item data
Definition: qglist.h:57
void clear()
Definition: qglist.cpp:652
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
bool QGList::operator== ( const QGList list) const
protected

Compares this list with list. Retruns TRUE if the lists contain the same data, else FALSE.

Definition at line 242 of file qglist.cpp.

243 {
244  if ( count() != list.count() )
245  return FALSE;
246 
247  if ( count() == 0 )
248  return TRUE;
249 
250  QLNode *n1 = firstNode;
251  QLNode *n2 = list.firstNode;
252  while ( n1 && n2 ) {
253  // should be mutable
254  if ( ( (QGList*)this )->compareItems( n1->data, n2->data ) != 0 )
255  return FALSE;
256  n1 = n1->next;
257  n2 = n2->next;
258  }
259 
260  return TRUE;
261 }
const bool FALSE
Definition: qglobal.h:370
uint count() const
Definition: qglist.h:150
The QGList class is an internal class for implementing Qt collection classes.
Definition: qglist.h:68
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
const bool TRUE
Definition: qglobal.h:371
void QGList::prepend ( QCollection::Item  d)
private

Definition at line 344 of file qglist.cpp.

345 {
346  register QLNode *n = new QLNode( newItem(d) );
347  CHECK_PTR( n );
348  n->prev = 0;
349  if ( (n->next = firstNode) ) // list is not empty
350  firstNode->prev = n;
351  else // initialize list
352  lastNode = n;
353  firstNode = curNode = n; // curNode affected
354  numNodes++;
355  curIndex = 0;
356 }
virtual Item newItem(Item)
QLNode * curNode
Definition: qglist.h:140
QLNode * prev
Definition: qglist.h:58
std::void_t< T > n
QLNode * lastNode
Definition: qglist.h:139
uint numNodes
Definition: qglist.h:142
QLNode * firstNode
Definition: qglist.h:138
#define CHECK_PTR(p)
Definition: qglobal.h:601
QLNode * next
Definition: qglist.h:59
int curIndex
Definition: qglist.h:141
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
QCollection::Item QGList::prev ( )
protected

Definition at line 854 of file qglist.cpp.

855 {
856  if ( curNode ) {
857  if ( curNode->prev ) {
858  curIndex--;
859  curNode = curNode->prev;
860  return curNode->data;
861  }
862  curIndex = -1;
863  curNode = 0;
864  }
865  return 0;
866 }
QLNode * curNode
Definition: qglist.h:140
QLNode * prev
Definition: qglist.h:58
int curIndex
Definition: qglist.h:141
QCollection::Item data
Definition: qglist.h:57
QDataStream & QGList::read ( QDataStream s)

Definition at line 992 of file qglist.cpp.

993 {
994  uint num;
995  s >> num; // read number of items
996  clear(); // clear list
997  while ( num-- ) { // read all items
998  Item d;
999  read( s, d );
1000  CHECK_PTR( d );
1001  if ( !d ) // no memory
1002  break;
1003  QLNode *n = new QLNode( d );
1004  CHECK_PTR( n );
1005  if ( !n ) // no memory
1006  break;
1007  n->next = 0;
1008  if ( (n->prev = lastNode) ) // list is not empty
1009  lastNode->next = n;
1010  else // initialize list
1011  firstNode = n;
1012  lastNode = n;
1013  numNodes++;
1014  }
1015  curNode = firstNode;
1016  curIndex = curNode ? 0 : -1;
1017  return s;
1018 }
QDataStream & read(QDataStream &)
Definition: qglist.cpp:992
QLNode * curNode
Definition: qglist.h:140
QLNode * prev
Definition: qglist.h:58
std::void_t< T > n
QLNode * lastNode
Definition: qglist.h:139
uint numNodes
Definition: qglist.h:142
QLNode * firstNode
Definition: qglist.h:138
#define CHECK_PTR(p)
Definition: qglobal.h:601
QLNode * next
Definition: qglist.h:59
int curIndex
Definition: qglist.h:141
void clear()
Definition: qglist.cpp:652
unsigned uint
Definition: qglobal.h:351
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
static QCString * s
Definition: config.cpp:1042
void * Item
Definition: qcollection.h:60
QDataStream & QGList::read ( QDataStream s,
QCollection::Item item 
)
protectedvirtual

Reads a collection/list item from the stream s and returns a reference to the stream.

The default implementation sets item to 0.

See also
write()

Reimplemented in QStrList.

Definition at line 140 of file qglist.cpp.

141 {
142  item = 0;
143  return s;
144 }
static QCString * s
Definition: config.cpp:1042
void QGList::relinkNode ( QLNode n)
protected

Definition at line 414 of file qglist.cpp.

415 {
416  if ( n == firstNode ) // already first
417  return;
418  curNode = n;
419  unlink();
420  n->prev = 0;
421  if ( (n->next = firstNode) ) // list is not empty
422  firstNode->prev = n;
423  else // initialize list
424  lastNode = n;
425  firstNode = curNode = n; // curNode affected
426  numNodes++;
427  curIndex = 0;
428 }
QLNode * curNode
Definition: qglist.h:140
QLNode * prev
Definition: qglist.h:58
std::void_t< T > n
QLNode * lastNode
Definition: qglist.h:139
uint numNodes
Definition: qglist.h:142
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
int curIndex
Definition: qglist.h:141
QLNode * unlink()
Definition: qglist.cpp:436
bool QGList::remove ( QCollection::Item  d = 0)
protected

Definition at line 504 of file qglist.cpp.

505 {
506  if ( d ) { // find the item
507  if ( find(d) == -1 )
508  return FALSE;
509  }
510  QLNode *n = unlink(); // unlink node
511  if ( !n )
512  return FALSE;
513  deleteItem( n->data ); // deallocate this node
514  delete n;
515  return TRUE;
516 }
const bool FALSE
Definition: qglobal.h:370
std::void_t< T > n
virtual void deleteItem(Item)
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
const bool TRUE
Definition: qglobal.h:371
QLNode * unlink()
Definition: qglist.cpp:436
int find(QCollection::Item, bool=TRUE)
Definition: qglist.cpp:708
bool QGList::removeAt ( uint  index)
protected

Definition at line 554 of file qglist.cpp.

555 {
556  if ( !locate(index) )
557  return FALSE;
558  QLNode *n = unlink(); // unlink node
559  if ( !n )
560  return FALSE;
561  deleteItem( n->data ); // deallocate this node
562  delete n;
563  return TRUE;
564 }
const bool FALSE
Definition: qglobal.h:370
std::void_t< T > n
QLNode * locate(uint)
Definition: qglist.cpp:275
virtual void deleteItem(Item)
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
const bool TRUE
Definition: qglobal.h:371
QLNode * unlink()
Definition: qglist.cpp:436
bool QGList::removeFirst ( )
inlineprotected

Definition at line 155 of file qglist.h.

156 {
157  first();
158  return remove();
159 }
QCollection::Item first()
Definition: qglist.cpp:807
bool QGList::removeLast ( )
inlineprotected

Definition at line 161 of file qglist.h.

162 {
163  last();
164  return remove();
165 }
QCollection::Item last()
Definition: qglist.cpp:821
bool QGList::removeNode ( QLNode n)
protected

Definition at line 481 of file qglist.cpp.

482 {
483 #if defined(CHECK_NULL)
484  if ( n == 0 || (n->prev && n->prev->next != n) ||
485  (n->next && n->next->prev != n) ) {
486  qWarning( "QGList::removeNode: Corrupted node" );
487  return FALSE;
488  }
489 #endif
490  curNode = n;
491  unlink(); // unlink node
492  deleteItem( n->data ); // deallocate this node
493  delete n;
494  curNode = firstNode;
495  curIndex = curNode ? 0 : -1;
496  return TRUE;
497 }
const bool FALSE
Definition: qglobal.h:370
QLNode * curNode
Definition: qglist.h:140
void qWarning(const char *msg,...)
Definition: qglobal.cpp:409
QLNode * prev
Definition: qglist.h:58
std::void_t< T > n
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
virtual void deleteItem(Item)
int curIndex
Definition: qglist.h:141
QCollection::Item data
Definition: qglist.h:57
const bool TRUE
Definition: qglobal.h:371
QLNode * unlink()
Definition: qglist.cpp:436
bool QGList::removeRef ( QCollection::Item  d = 0)
protected

Definition at line 523 of file qglist.cpp.

524 {
525  if ( d ) { // find the item
526  if ( findRef(d) == -1 )
527  return FALSE;
528  }
529  QLNode *n = unlink(); // unlink node
530  if ( !n )
531  return FALSE;
532  deleteItem( n->data ); // deallocate this node
533  delete n;
534  return TRUE;
535 }
const bool FALSE
Definition: qglobal.h:370
std::void_t< T > n
int findRef(QCollection::Item, bool=TRUE)
Definition: qglist.cpp:683
virtual void deleteItem(Item)
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
const bool TRUE
Definition: qglobal.h:371
QLNode * unlink()
Definition: qglist.cpp:436
void QGList::sort ( )
protected

Sorts the list by the result of the virtual compareItems() function.

The Heap-Sort algorithm is used for sorting. It sorts n items with O(n*log n) compares. This is the asymptotic optimal solution of the sorting problem.

Definition at line 934 of file qglist.cpp.

935 {
936  uint n = count();
937  if ( n < 2 )
938  return;
939 
940  // Create the heap
941  QCollection::Item* realheap = new QCollection::Item[ n ];
942  // Wow, what a fake. But I want the heap to be indexed as 1...n
943  QCollection::Item* heap = realheap - 1;
944  int size = 0;
945  QLNode* insert = firstNode;
946  for( ; insert != 0; insert = insert->next ) {
947  heap[++size] = insert->data;
948  int i = size;
949  while( i > 1 && compareItems( heap[i], heap[ i / 2 ] ) < 0 ) {
950  QCollection::Item tmp = heap[ i ];
951  heap[ i ] = heap[ i/2 ];
952  heap[ i/2 ] = tmp;
953  i /= 2;
954  }
955  }
956 
957  insert = firstNode;
958  // Now do the sorting
959  for ( int i = n; i > 0; i-- ) {
960  insert->data = heap[1];
961  insert = insert->next;
962  if ( i > 1 ) {
963  heap[1] = heap[i];
964  heapSortPushDown( heap, 1, i - 1 );
965  }
966  }
967 
968  delete [] realheap;
969 }
void heapSortPushDown(QCollection::Item *heap, int first, int last)
Definition: qglist.cpp:888
virtual int compareItems(QCollection::Item, QCollection::Item)
Definition: qglist.cpp:125
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
uint count() const
Definition: qglist.h:150
std::void_t< T > n
string tmp
Definition: languages.py:63
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
QCollection::Item data
Definition: qglist.h:57
unsigned uint
Definition: qglobal.h:351
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
void * Item
Definition: qcollection.h:60
QCollection::Item QGList::take ( )
protected

Definition at line 595 of file qglist.cpp.

596 {
597  QLNode *n = unlink(); // unlink node
598  Item d = n ? n->data : 0;
599  delete n; // delete node, keep contents
600  return d;
601 }
std::void_t< T > n
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
QLNode * unlink()
Definition: qglist.cpp:436
void * Item
Definition: qcollection.h:60
QCollection::Item QGList::takeAt ( uint  index)
protected

Definition at line 608 of file qglist.cpp.

609 {
610  if ( !locate(index) )
611  return 0;
612  QLNode *n = unlink(); // unlink node
613  Item d = n ? n->data : 0;
614  delete n; // delete node, keep contents
615  return d;
616 }
std::void_t< T > n
QLNode * locate(uint)
Definition: qglist.cpp:275
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
QLNode * unlink()
Definition: qglist.cpp:436
void * Item
Definition: qcollection.h:60
QCollection::Item QGList::takeFirst ( )
protected

Definition at line 623 of file qglist.cpp.

624 {
625  first();
626  QLNode *n = unlink(); // unlink node
627  Item d = n ? n->data : 0;
628  delete n;
629  return d;
630 }
QCollection::Item first()
Definition: qglist.cpp:807
std::void_t< T > n
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
QLNode * unlink()
Definition: qglist.cpp:436
void * Item
Definition: qcollection.h:60
QCollection::Item QGList::takeLast ( )
protected

Definition at line 637 of file qglist.cpp.

638 {
639  last();
640  QLNode *n = unlink(); // unlink node
641  Item d = n ? n->data : 0;
642  delete n;
643  return d;
644 }
std::void_t< T > n
QCollection::Item data
Definition: qglist.h:57
QCollection::Item last()
Definition: qglist.cpp:821
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
QLNode * unlink()
Definition: qglist.cpp:436
void * Item
Definition: qcollection.h:60
QCollection::Item QGList::takeNode ( QLNode n)
protected

Definition at line 572 of file qglist.cpp.

573 {
574 #if defined(CHECK_NULL)
575  if ( n == 0 || (n->prev && n->prev->next != n) ||
576  (n->next && n->next->prev != n) ) {
577  qWarning( "QGList::takeNode: Corrupted node" );
578  return 0;
579  }
580 #endif
581  curNode = n;
582  unlink(); // unlink node
583  Item d = n->data;
584  delete n; // delete the node, not data
585  curNode = firstNode;
586  curIndex = curNode ? 0 : -1;
587  return d;
588 }
QLNode * curNode
Definition: qglist.h:140
void qWarning(const char *msg,...)
Definition: qglobal.cpp:409
QLNode * prev
Definition: qglist.h:58
std::void_t< T > n
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
int curIndex
Definition: qglist.h:141
QCollection::Item data
Definition: qglist.h:57
QLNode * unlink()
Definition: qglist.cpp:436
void * Item
Definition: qcollection.h:60
void QGList::toVector ( QGVector vector) const
protected

Definition at line 874 of file qglist.cpp.

875 {
876  vector->clear();
877  if ( !vector->resize( count() ) )
878  return;
879  register QLNode *n = firstNode;
880  uint i = 0;
881  while ( n ) {
882  vector->insert( i, n->data );
883  n = n->next;
884  i++;
885  }
886 }
bool insert(uint index, Item)
Definition: qgvector.cpp:246
bool resize(uint newsize)
Definition: qgvector.cpp:330
uint count() const
Definition: qglist.h:150
std::void_t< T > n
QLNode * firstNode
Definition: qglist.h:138
void clear()
Definition: qgvector.cpp:313
QLNode * next
Definition: qglist.h:59
QCollection::Item data
Definition: qglist.h:57
unsigned uint
Definition: qglobal.h:351
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
QLNode * QGList::unlink ( )
private

Definition at line 436 of file qglist.cpp.

437 {
438  if ( curNode == 0 ) // null current node
439  return 0;
440  register QLNode *n = curNode; // unlink this node
441  if ( n == firstNode ) { // removing first node ?
442  if ( (firstNode = n->next) ) {
443  firstNode->prev = 0;
444  } else {
445  lastNode = curNode = 0; // list becomes empty
446  curIndex = -1;
447  }
448  } else {
449  if ( n == lastNode ) { // removing last node ?
450  lastNode = n->prev;
451  lastNode->next = 0;
452  } else { // neither last nor first node
453  n->prev->next = n->next;
454  n->next->prev = n->prev;
455  }
456  }
457  if ( n->next ) { // change current node
458  curNode = n->next;
459  } else if ( n->prev ) {
460  curNode = n->prev;
461  curIndex--;
462  }
463  if ( iterators && iterators->count() ) { // update iterators
465  while ( i ) { // fix all iterators that
466  if ( i->curNode == n ) // refers to pending node
467  i->curNode = curNode;
468  i = (QGListIterator*)iterators->next();
469  }
470  }
471  numNodes--;
472  return n;
473 }
QLNode * curNode
Definition: qglist.h:140
QCollection::Item first()
Definition: qglist.cpp:807
QGList * iterators
Definition: qglist.h:143
QLNode * prev
Definition: qglist.h:58
uint count() const
Definition: qglist.h:150
std::void_t< T > n
QLNode * lastNode
Definition: qglist.h:139
uint numNodes
Definition: qglist.h:142
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
QLNode * curNode
Definition: qglist.h:237
QCollection::Item next()
Definition: qglist.cpp:835
int curIndex
Definition: qglist.h:141
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
The QGListIterator class is an internal class for implementing QListIterator.
Definition: qglist.h:212
QDataStream & QGList::write ( QDataStream s) const

Definition at line 1025 of file qglist.cpp.

1026 {
1027  s << count(); // write number of items
1028  QLNode *n = firstNode;
1029  while ( n ) { // write all items
1030  write( s, n->data );
1031  n = n->next;
1032  }
1033  return s;
1034 }
uint count() const
Definition: qglist.h:150
std::void_t< T > n
QDataStream & write(QDataStream &) const
Definition: qglist.cpp:1025
QLNode * firstNode
Definition: qglist.h:138
QLNode * next
Definition: qglist.h:59
QCollection::Item data
Definition: qglist.h:57
The QLNode class is an internal class for the QList template collection.
Definition: qglist.h:50
static QCString * s
Definition: config.cpp:1042
QDataStream & QGList::write ( QDataStream s,
QCollection::Item   
) const
protectedvirtual

Writes a collection/list item to the stream s and returns a reference to the stream.

The default implementation does nothing.

See also
read()

Reimplemented in QStrList.

Definition at line 155 of file qglist.cpp.

156 {
157  return s;
158 }
static QCString * s
Definition: config.cpp:1042

Friends And Related Function Documentation

friend class QGListIterator
friend

Definition at line 70 of file qglist.h.

friend class QGVector
friend

Definition at line 71 of file qglist.h.

Member Data Documentation

int QGList::curIndex
private

Definition at line 141 of file qglist.h.

QLNode* QGList::curNode
private

Definition at line 140 of file qglist.h.

QLNode* QGList::firstNode
private

Definition at line 138 of file qglist.h.

QGList* QGList::iterators
private

Definition at line 143 of file qglist.h.

QLNode* QGList::lastNode
private

Definition at line 139 of file qglist.h.

uint QGList::numNodes
private

Definition at line 142 of file qglist.h.


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