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

CategoryGroup Class Reference

Helper class that is used by Categories. More...

#include </home/clem/local/src/opie/library/backend/categories.h>

Collaboration diagram for CategoryGroup:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CategoryGroup ()
 CategoryGroup (const CategoryGroup &c)
void clear ()
int add (const QString &label)
bool add (int uid, const QString &label)
bool remove (const QString &label)
bool remove (int uid)
bool rename (int uid, const QString &newLabel)
bool rename (const QString &oldLabel, const QString &newLabel)
bool contains (int id) const
bool contains (const QString &label) const
const QStringlabel (int id) const
int id (const QString &label) const
QStringList labels () const
QStringList labels (const QArray< int > &catids) const
const QMap< int, QString > & idMap () const

Private Member Functions

void insert (int uid, const QString &label)

Static Private Member Functions

static Qtopia::UidGenuidGen ()

Private Attributes

QMap< int, QStringmIdLabelMap
QMap< QString, int > mLabelIdMap

Static Private Attributes

static Qtopia::UidGen sUidGen

Friends

class Categories

Detailed Description

Helper class that is used by Categories.

CategoryGroup is a group of categories that is associated with an application or global set. Mainly it defines a map of ids to category labels and category labels to ids. Lookups can be done with labels or unique idenifiers.

Warning:
Categories API will likely change between Qtopia 1.5 and Qtopia 3
See also:
Categories::appGroupMap(), Categories::globalGroup()

Definition at line 43 of file categories.h.


Constructor & Destructor Documentation

CategoryGroup::CategoryGroup  )  [inline]
 

For internal use only.

Definition at line 47 of file categories.h.

CategoryGroup::CategoryGroup const CategoryGroup c  )  [inline]
 

For internal use only.

Definition at line 48 of file categories.h.


Member Function Documentation

bool CategoryGroup::add int  uid,
const QString label
 

For internal use only.

Definition at line 80 of file categories.cpp.

References QMap< Key, T >::end(), FALSE, QMap< Key, T >::find(), insert(), mIdLabelMap, mLabelIdMap, tr, and TRUE.

int CategoryGroup::add const QString label  ) 
 

Add label and return the UID. If failure, then 0 is returned. Note that All and Unfiled are reserved labels.

For internal use only.

Definition at line 58 of file categories.cpp.

References QMap< Key, T >::end(), QMap< Key, T >::find(), insert(), mLabelIdMap, tr, and uidGen().

Referenced by Categories::addCategory(), Categories::addGlobalCategory(), and Categories::load().

CategoryGroup::clear  )  [inline]
 

For internal use only.

Definition at line 51 of file categories.h.

References QMap< Key, T >::clear(), mIdLabelMap, and mLabelIdMap.

Referenced by Categories::clear().

bool CategoryGroup::contains const QString label  )  const
 

Returns TRUE if label is stored in this group, FALSE if not.

Definition at line 157 of file categories.cpp.

References QMap< Key, T >::end(), QMap< Key, T >::find(), and mLabelIdMap.

bool CategoryGroup::contains int  uid  )  const
 

Returns TRUE if uid is stored in this group, FALSE if not.

Definition at line 151 of file categories.cpp.

References QMap< Key, T >::end(), QMap< Key, T >::find(), and mIdLabelMap.

Referenced by Categories::addCategory(), Categories::isGlobal(), Categories::label(), and Categories::setGlobal().

int CategoryGroup::id const QString label  )  const
 

Returns the uid associated with label or 0 if not found

Definition at line 174 of file categories.cpp.

References QMap< Key, T >::end(), QMap< Key, T >::find(), and mLabelIdMap.

Referenced by Categories::id(), Categories::removeCategory(), Categories::removeGlobalCategory(), Categories::renameCategory(), and Categories::renameGlobalCategory().

const QMap< int, QString > & CategoryGroup::idMap  )  const [inline]
 

Returns a const reference to the id to label QMap

Definition at line 77 of file categories.h.

References mIdLabelMap.

Referenced by Categories::save().

void CategoryGroup::insert int  uid,
const QString label
[private]
 

Definition at line 71 of file categories.cpp.

References mIdLabelMap, mLabelIdMap, and uidGen().

Referenced by add().

const QString & CategoryGroup::label int  id  )  const
 

Returns label associated with the uid or QString::null if not found

Definition at line 165 of file categories.cpp.

References QMap< Key, T >::end(), QMap< Key, T >::find(), mIdLabelMap, and QString::null.

Referenced by Categories::label().

QStringList CategoryGroup::labels const QArray< int > &  catids  )  const
 

Returns a list of all labels associated with the catids

Definition at line 195 of file categories.cpp.

References QMap< Key, T >::begin(), QMap< Key, T >::end(), labels(), and mIdLabelMap.

QStringList CategoryGroup::labels  )  const
 

Returns a sorted list of labels

Definition at line 183 of file categories.cpp.

References QMap< Key, T >::begin(), QMap< Key, T >::end(), and mIdLabelMap.

Referenced by Categories::dump(), Categories::labels(), and labels().

bool CategoryGroup::remove int  uid  ) 
 

Returns TRUE if uid was removed from the group, FALSE if not.

For internal use only.

Definition at line 113 of file categories.cpp.

References QMap< Key, T >::end(), FALSE, QMap< Key, T >::find(), mIdLabelMap, mLabelIdMap, QMap< Key, T >::remove(), and TRUE.

bool CategoryGroup::remove const QString label  ) 
 

Returns TRUE if label was removed from the group, FALSE if not.

For internal use only.

Definition at line 98 of file categories.cpp.

References QMap< Key, T >::end(), FALSE, QMap< Key, T >::find(), mIdLabelMap, mLabelIdMap, QMap< Key, T >::remove(), and TRUE.

Referenced by Categories::removeCategory(), Categories::removeGlobalCategory(), and Categories::setGlobal().

bool CategoryGroup::rename const QString oldLabel,
const QString newLabel
 

For internal use only.

Definition at line 145 of file categories.cpp.

References rename().

bool CategoryGroup::rename int  uid,
const QString newLabel
 

For internal use only.

Definition at line 127 of file categories.cpp.

References QMap< Key, T >::end(), FALSE, QMap< Key, T >::find(), mIdLabelMap, mLabelIdMap, QMap< Key, T >::remove(), tr, and TRUE.

Referenced by rename(), Categories::renameCategory(), and Categories::renameGlobalCategory().

static Qtopia::UidGen& CategoryGroup::uidGen  )  [inline, static, private]
 

Definition at line 84 of file categories.h.

References sUidGen.

Referenced by add(), and insert().


Friends And Related Function Documentation

friend class Categories [friend]
 

Definition at line 45 of file categories.h.


Member Data Documentation

QMap<int, QString> CategoryGroup::mIdLabelMap [private]
 

Definition at line 81 of file categories.h.

Referenced by add(), clear(), contains(), idMap(), insert(), label(), labels(), remove(), and rename().

QMap<QString, int> CategoryGroup::mLabelIdMap [private]
 

Definition at line 82 of file categories.h.

Referenced by add(), clear(), contains(), id(), insert(), remove(), and rename().

UidGen CategoryGroup::sUidGen [static, private]
 

Referenced by Contact::uidGen(), and uidGen().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 17:28:11 2005 for OPIE by  doxygen 1.4.2