SDict< T > Class Template Reference

#include <sortdict.h>

List of all members.

Public Member Functions

 SDict (int size)
virtual ~SDict ()
void append (const char *key, const T *d)
void prepend (const char *key, const T *d)
bool remove (const char *key)
T * take (const char *key)
void sort ()
void inSort (const char *key, const T *d)
void setAutoDelete (bool val)
T * find (const char *key)
T * find (const QCString &key)
T * find (const QString &key)
T * operator[] (const char *key) const
T * at (uint i)
virtual int compareItems (GCI item1, GCI item2)
void clear ()
int count () const

Friends

class Iterator
class IteratorDict

Classes

class  Iterator
class  IteratorDict


Detailed Description

template<class T>
class SDict< T >

Ordered dictionary of elements of type T. Internally uses a QList<T> and a QDict<T>.

Definition at line 98 of file sortdict.h.


Constructor & Destructor Documentation

template<class T>
SDict< T >::SDict ( int  size  )  [inline]

Create an ordered dictionary.

Parameters:
size The size of the dictionary. Should be a prime number for best distribution of elements.

Definition at line 110 of file sortdict.h.

template<class T>
virtual SDict< T >::~SDict (  )  [inline, virtual]

Destroys the dictionary

Definition at line 122 of file sortdict.h.


Member Function Documentation

template<class T>
void SDict< T >::append ( const char *  key,
const T *  d 
) [inline]

Appends an element to the dictionary. The element is owned by the dictionary.

Parameters:
key The unique key to use to quicky find the item later on.
d The compound to add.
See also:
find()

Definition at line 134 of file sortdict.h.

Referenced by GroupDef::addClass(), addDefine(), GroupDef::addExample(), DocSets::addIndexItem(), PageDef::addInnerCompound(), NamespaceDef::addInnerCompound(), ClassDef::addMembersToTemplateInstance(), GroupDef::addNamespace(), GroupDef::addPage(), addRelatedPage(), NamespaceDef::addUsingDeclaration(), FileDef::addUsingDeclaration(), NamespaceDef::addUsingDirective(), FileDef::addUsingDirective(), PyVariableContext::addVariable(), VariableContext::addVariable(), NamespaceDef::insertClass(), FileDef::insertClass(), GroupDef::insertMember(), NamespaceDef::insertNamespace(), FileDef::insertNamespace(), ClassDef::mergeCategory(), ClassDef::mergeMembers(), MemberDef::setSectionList(), unmarshalMemberLists(), writeDotDirDepGraph(), and VhdlDocGen::writePlainVHDLDeclarations().

template<class T>
void SDict< T >::prepend ( const char *  key,
const T *  d 
) [inline]

Prepends an element to the dictionary. The element is owned by the dictionary.

Parameters:
key The unique key to use to quicky find the item later on.
d The compound to add.
See also:
find()

Definition at line 152 of file sortdict.h.

Referenced by FileDef::addIncludedUsingDirectives().

template<class T>
bool SDict< T >::remove ( const char *  key  )  [inline]

Remove an item from the dictionary

Definition at line 165 of file sortdict.h.

Referenced by endUseScope(), and GroupDef::removeMember().

template<class T>
T* SDict< T >::take ( const char *  key  )  [inline]

Take an item out of the dictionary without deleting it

Definition at line 172 of file sortdict.h.

template<class T>
void SDict< T >::sort (  )  [inline]

Sorts the members of the dictionary. First appending a number of members and then sorting them is faster (O(NlogN) than using inSort() for each member (O(N^2)).

Definition at line 187 of file sortdict.h.

Referenced by parseInput(), and writeGroupHierarchy().

template<class T>
void SDict< T >::inSort ( const char *  key,
const T *  d 
) [inline]

Inserts a compound into the dictionary in a sorted way.

Parameters:
key The unique key to use to quicky find the item later on.
d The compound to add.
See also:
find()

Definition at line 196 of file sortdict.h.

Referenced by GroupDef::addClass(), MemberDef::addExample(), ClassDef::addExample(), UsedDir::addFileDep(), ClassDef::addInnerCompound(), GroupDef::addNamespace(), Definition::addSourceReferencedBy(), Definition::addSourceReferences(), NamespaceDef::insertClass(), FileDef::insertClass(), NamespaceDef::insertNamespace(), FileDef::insertNamespace(), unmarshalExampleSDict(), and unmarshalMemberSDict().

template<class T>
void SDict< T >::setAutoDelete ( bool  val  )  [inline]

Indicates whether or not the dictionary owns its elements

Definition at line 209 of file sortdict.h.

Referenced by ClassDef::addExample(), ClassDef::mergeMembers(), parseInput(), and UsedDir::UsedDir().

template<class T>
T* SDict< T >::find ( const char *  key  )  [inline]

Looks up a compound given its key.

Parameters:
key The key to identify this element.
Returns:
The requested compound or zero if it cannot be found.
See also:
append()

Definition at line 219 of file sortdict.h.

Referenced by accessibleViaUsingNamespace(), GroupDef::addClass(), addClassToGroups(), addDefine(), addDirToGroups(), MemberDef::addExample(), ClassDef::addExample(), addExampleToGroups(), addGroupToGroups(), FileDef::addIncludedUsingDirectives(), DocSets::addIndexItem(), ClassDef::addMembersToTemplateInstance(), addMemberToGroups(), GroupDef::addNamespace(), addNamespaceToGroups(), Definition::addSourceReferencedBy(), Definition::addSourceReferences(), NamespaceDef::addUsingDeclaration(), FileDef::addUsingDeclaration(), NamespaceDef::addUsingDirective(), FileDef::addUsingDirective(), VariableContext::addVariable(), buildDirectories(), DotNode::deleteNode(), UsedDir::findFilePair(), NamespaceDef::findInnerCompound(), ClassDef::findInnerCompound(), PyVariableContext::findVariable(), VariableContext::findVariable(), VhdlDocGen::getClass(), getClass(), getDefs(), ClassDef::getMemberByName(), getResolvedNamespace(), MemberDef::getSectionList(), getTemplateArgumentsFromName(), NamespaceDef::insertClass(), NamespaceDef::insertNamespace(), FileDef::insertNamespace(), ClassDef::mergeCategory(), ClassDef::mergeMembers(), GroupDef::removeMember(), resolveRef(), resolveTypeDef(), and VhdlDocGen::writePlainVHDLDeclarations().

template<class T>
T* SDict< T >::find ( const QCString &  key  )  [inline]

Definition at line 223 of file sortdict.h.

template<class T>
T* SDict< T >::find ( const QString &  key  )  [inline]

Definition at line 227 of file sortdict.h.

template<class T>
T* SDict< T >::operator[] ( const char *  key  )  const [inline]

Equavalent to find().

Definition at line 233 of file sortdict.h.

template<class T>
T* SDict< T >::at ( uint  i  )  [inline]

Returns the item at position i in the sorted dictionary

Definition at line 239 of file sortdict.h.

Referenced by writeExample().

template<class T>
virtual int SDict< T >::compareItems ( GCI  item1,
GCI  item2 
) [inline, virtual]

Function that is used to compare two items when sorting. Overload this to properly sort items.

See also:
inSort()

Reimplemented in ClassSDict, FilePairDict, DirSDict, ExampleSDict, GroupSDict, MemberSDict, MemberNameSDict, MemberNameInfoSDict, NamespaceSDict, and PageSDict.

Definition at line 248 of file sortdict.h.

template<class T>
void SDict< T >::clear (  )  [inline]

Clears the dictionary. Will delete items if setAutoDelete() was set to TRUE.

See also:
setAutoDelete

Definition at line 257 of file sortdict.h.

Referenced by PyVariableContext::clear(), VariableContext::clear(), clearAll(), and VhdlDocGen::writePlainVHDLDeclarations().

template<class T>
int SDict< T >::count (  )  const [inline]

Returns the number of items stored in the dictionary

Definition at line 265 of file sortdict.h.

Referenced by DotGroupCollaboration::buildGraph(), NamespaceDef::countMembers(), GroupDef::countMembers(), getResolvedClassRec(), MemberDef::hasExamples(), ClassDef::hasExamples(), PageDef::hasSubPages(), marshalExampleSDict(), marshalMemberLists(), marshalMemberSDict(), GroupDef::writeDetailedDocumentation(), FileDef::writeDocumentation(), writeDotDirDepGraph(), writeExample(), and writeGroupTreeNode().


Friends And Related Function Documentation

template<class T>
friend class Iterator [friend]

Definition at line 270 of file sortdict.h.

template<class T>
friend class IteratorDict [friend]

Definition at line 334 of file sortdict.h.


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



Generated on Mon Mar 31 10:59:03 2008 by  doxygen 1.5.1