Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

dbList Class Reference

class that will act as a container for database table More...

#include <dbList.h>

List of all members.

Public Member Functions

 dbList ()
 The default constructor.
 dbList (QList< DataClass * > *p_dcList)
QList< DataClass * > * list ()
QList< DataClass * > * allChildren (DataClass *parent, bool deep=false)
void insert (int posn, DataClass *data)
void append (DataClass *data)
DataClassremove (int posn)
template<typename LessThan>
void resort (LessThan lessThan)
int size ()
 Method that returns the size of the list.
DataClassat (int posn)
void dump ()
 Method to dump out some details about the current result set.


Detailed Description

class that will act as a container for database table

This is a simple container class that will hold the data from a single table. This data will be kept in sychronisation with the database.
It is the responsibility of the dbListManager class to maintain the synchronisation.

See also:
dbListManager

Definition at line 38 of file dbList.h.


Constructor & Destructor Documentation

dbList::dbList QList< DataClass * > *  p_dcList  ) 
 

A constructor that will use the list passed in.

Parameters:
p_dcList a list of DataClasses that will be used as the initial list

Definition at line 28 of file dbList.cpp.

00029 {
00030         pdcList = p_dcList;
00031 }


Member Function Documentation

QList< DataClass * > * dbList::allChildren DataClass parent,
bool  deep = false
 

Method that will return a list of all the rows that are children of the argument parent. if deep is true then the method allChildrenDeep will be called.
For Example Each institue class will contain faculty classes. This method can be called to return all the faculties that belong to a given institute.

Parameters:
parent The object which is to be considered as the containing parent
deep is it the immediate parent, or at any depth?

Definition at line 39 of file dbList.cpp.

References size().

Referenced by dbListManager::getDepartmentList(), dbListManager::getFacultyList(), dbListManager::getMLAllocList(), dbListManager::getModuleList(), dbListManager::getProgrammeList(), dbListManager::getRoomList(), dbListManager::getStaffList(), and dbListManager::getTimeSlotList().

00040 {
00041         if (deep)
00042                 return allChildrenDeep(parent);
00043                 
00044         QList<DataClass * > * pChildren = new QList<DataClass * >();
00045         for (int i = 0; i<size(); i++)
00046                 if (pdcList->at(i)->getParent() == parent)
00047                         pChildren->append(pdcList->at(i));
00048         return pChildren;
00049 }

void dbList::append DataClass data  )  [inline]
 

Method to add the object to the end of the list.

Parameters:
data The object that is to be appended

Definition at line 82 of file dbList.h.

00082 {pdcList->append(data);}

DataClass * dbList::at int  posn  ) 
 

Method that returns the object which is at the given position in the list

Parameters:
posn The postion from where the object should be taken
Returns:
The object at the given location

Definition at line 86 of file dbList.cpp.

Referenced by dbListManager::dump(), dbListManager::insert(), and dbListManager::remove().

00087 {
00088         if (posn < 0 || posn >= pdcList->size())
00089                 return 0;
00090         else
00091         {
00092                 return  pdcList->at(posn);
00093         }
00094 }

void dbList::insert int  posn,
DataClass data
[inline]
 

Method to insert an object into the list at the given position

Parameters:
posn The place where the object should be inserted
data The object that is to be inserted

Definition at line 78 of file dbList.h.

Referenced by dbListManager::insert().

00078 {pdcList->insert(posn,data);}

QList< DataClass * > * dbList::list  ) 
 

Method that will return all the rows that are held on the table

Definition at line 34 of file dbList.cpp.

Referenced by dbListManager::getDepartmentList(), dbListManager::getFacultyList(), dbListManager::getInstituteList(), dbListManager::getMLAllocList(), dbListManager::getModuleList(), dbListManager::getProgrammeList(), dbListManager::getRoomList(), dbListManager::getStaffList(), and dbListManager::getTimeSlotList().

00035 {
00036         return pdcList;
00037 }

DataClass * dbList::remove int  posn  ) 
 

Method to remove the object at the given position from the list. If posn is not valid then nothing is removes and 0 is returned.

Parameters:
posn The place where the object should be removed
Returns:
The object that is removed is returned

Definition at line 73 of file dbList.cpp.

Referenced by dbListManager::remove().

00074 {
00075         if (posn < 0 || posn >= pdcList->size())
00076                 return 0;
00077         else
00078         {
00079                 DataClass * dc = pdcList->at(posn);
00080                 pdcList->removeAt(posn);
00081                 return  dc;
00082         }
00083 }

template<typename LessThan>
void dbList::resort LessThan  lessThan  )  [inline]
 

Method to resort the list. This is necessary if the data for which the sort field is the key has changed.

Definition at line 94 of file dbList.h.

Referenced by dbListManager::update().

00094 {qSort(pdcList->begin(), pdcList->end(),lessThan);};


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 16:27:18 2006 for time-table by  doxygen 1.4.4