KockpitHelpers Namespace Reference

Namespace which offers helper functions. More...

Functions

bool idAlreadyUsed (QList< KockpitUnitMap * > *klist, const QString &id)
 Check id usage.
KockpitGroupgetPrimaryGroupByGid (const QList< KockpitUnitMap * > *kgmap, int gidNumber)
 Group selection.
KockpitGroupgetKockpitGroupFromQListWidgetItem (QListWidgetItem *item)
 Group selection.
KockpitUsergetKockpitUserFromQListWidgetItem (QListWidgetItem *item)
 User selection.
void secDel (QObject *p)
 Secure deletion.
void deleteListObjects (QList< KockpitUnitMap * > &list)
 Delete list objects.
void deleteListMaps (QList< KockpitUnitMap * > &list)
 Delete list maps.
QDir directoryOf (const QString &subdir)
 Return relative QDir Object.

Detailed Description

Namespace which offers helper functions.

All general helper functions are combined in this namespace


Function Documentation

void KockpitHelpers::deleteListMaps ( QList< KockpitUnitMap * > &  list  ) 

Delete list maps.

This function only deletes the maps - not the related units.

Parameters:
list Reference to list of pointers to KockpitUnitMap objects.
void KockpitHelpers::deleteListObjects ( QList< KockpitUnitMap * > &  list  ) 

Delete list objects.

This function deletes user objects before creating new ones. This function is needed to prevent memory leaks.

Parameters:
list Reference to list of pointers to KockpitUnitMap objects.
QDir KockpitHelpers::directoryOf ( const QString &  subdir  ) 

Return relative QDir Object.

This function is taken from C++ GUI Programmierung with Qt 4 (page 507) and returns a QDir object which represents the relative path from the application dir to te subdir which is given by the parameter.

Parameters:
subdir Subdirectory.
Returns:
QDir Relative path from the application dir to the subdir.
KockpitGroup * KockpitHelpers::getKockpitGroupFromQListWidgetItem ( QListWidgetItem *  item  ) 

Group selection.

This function takes a QListWidgetItem pointer and unveil the KockpitGroup object pointer from it.

Parameters:
item A pointer to a QListWidgetItem
Returns:
KockpitGroup* The KockpitGroup Object which was encapsulated by item->data
NULL Something went wrong
KockpitUser * KockpitHelpers::getKockpitUserFromQListWidgetItem ( QListWidgetItem *  item  ) 

User selection.

This function takes a QListWidgetItem pointer and unveil the KockpitUser object pointer from it.

Parameters:
item A pointer to a QListWidgetItem
Returns:
KockpitUser* The KockpitGroup Object which was encapsulated by item->data
NULL Something went wrong
KockpitGroup * KockpitHelpers::getPrimaryGroupByGid ( const QList< KockpitUnitMap * > *  kgmap,
int  gidNumber 
)

Group selection.

This function searches a group in a group list by its gidNumber.

Parameters:
kgmap A pointer to a List of pointer, pointing to a KockpitUnitMap which encapsulate a KockpitGroup object.
gidNumber Group id number.
Returns:
KockpitGroup* A KockpitGroup object suitable to the gidNumber.
NULL Something went wrong
bool KockpitHelpers::idAlreadyUsed ( QList< KockpitUnitMap * > *  klist,
const QString &  id 
)

Check id usage.

This function checks if an user id or a group id is already used. Therfore it takes the id and iterates over klist to check if id is already used in one KockpitUniMap object.

Parameters:
klist This could be a pointer to a list of pointers containing KockpitUnitMaps.
id This could be a user or group id.
Returns:
true Id is already used.
false Id does not exist yet.
void KockpitHelpers::secDel ( QObject *  p  ) 

Secure deletion.

This function free allocated space an set the pointer to NULL.

Parameters:
p The pointer which will be set to NULL after the space it points to is released.
Generated on Wed Mar 24 09:58:14 2010 for kockpit by  doxygen 1.6.3