Namespace which offers helper functions. More...
Functions | |
bool | idAlreadyUsed (QList< KockpitUnitMap * > *klist, const QString &id) |
Check id usage. | |
KockpitGroup * | getPrimaryGroupByGid (const QList< KockpitUnitMap * > *kgmap, int gidNumber) |
Group selection. | |
KockpitGroup * | getKockpitGroupFromQListWidgetItem (QListWidgetItem *item) |
Group selection. | |
KockpitUser * | getKockpitUserFromQListWidgetItem (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. |
Namespace which offers helper functions.
All general helper functions are combined in this namespace
void KockpitHelpers::deleteListMaps | ( | QList< KockpitUnitMap * > & | list | ) |
Delete list maps.
This function only deletes the maps - not the related units.
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.
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.
subdir | Subdirectory. |
KockpitGroup * KockpitHelpers::getKockpitGroupFromQListWidgetItem | ( | QListWidgetItem * | item | ) |
Group selection.
This function takes a QListWidgetItem pointer and unveil the KockpitGroup object pointer from it.
item | A pointer to a QListWidgetItem |
KockpitUser * KockpitHelpers::getKockpitUserFromQListWidgetItem | ( | QListWidgetItem * | item | ) |
User selection.
This function takes a QListWidgetItem pointer and unveil the KockpitUser object pointer from it.
item | A pointer to a QListWidgetItem |
KockpitGroup * KockpitHelpers::getPrimaryGroupByGid | ( | const QList< KockpitUnitMap * > * | kgmap, | |
int | gidNumber | |||
) |
Group selection.
This function searches a group in a group list by its gidNumber.
kgmap | A pointer to a List of pointer, pointing to a KockpitUnitMap which encapsulate a KockpitGroup object. | |
gidNumber | Group id number. |
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.
klist | This could be a pointer to a list of pointers containing KockpitUnitMaps. | |
id | This could be a user or group id. |
void KockpitHelpers::secDel | ( | QObject * | p | ) |
Secure deletion.
This function free allocated space an set the pointer to NULL.
p | The pointer which will be set to NULL after the space it points to is released. |