AddressBook Class Reference

[kab Index] [kab Hierarchy] [Headers]


#include <addressbook.h>

Inherits: ConfigDB

Public Members

Protected Members


static const int NoOfFields[public]

The number of elements in Fields.

bool currentEntry(Section**) [public]

This methods retrieve the current entry.

bool setCurrent(int index) [public]

This method sets current to the element in entries at the given index.

bool setCurrent(const string& key) [public]

This method sets the current key to the one with the given key in the ENTRIES-section. This is reverse to the method before!

bool getEntry(const string& key, Entry& entry) [public]

This method returns the entry that has the key given in the reference. It returns false if there is no entry with this key.

bool getEntry(const string& key, Section*& entry) [public]

This method returns the entries section directly. Be careful, it is the pointer to the ORIGINAL section that is returned! The method returns false if the entry cannot be found.

bool getEntries(list<AddressBook::Entry>& entries) [public]

Using getEntries(..), the caller will get a copy of all entries in the database. This might seem unneeded, but the address database can be used by multiple instances of the kab API at the same time, so that, if the programmer wants, for example, print a letter header for all persons, the database might change during the operation. That is why she can retrieve the whole database in one operation. It is required that the referenced list is empty. @params entries Reference to a list of entries.

Returns:
False on error or true.

string currentEntry() [public]

Returns the key of the current entry. The string is empty ifthere are no entries.

unsigned int noOfEntries() [public]

Returns the number of entries in the database.

bool first() [public]

The following methods are used to navigate through the entries.They all change the current-iterator.

bool change(const Entry&) [public]

Change the current entry.

bool change(const string& key, const Entry&) [public]

Change the entry with the given key.

bool remove() [public]

Remove the current entry.

bool remove(const string& key) [public]

Remove the entry with the given key. Returns false if there is no entry with this key.

bool nameOfField(const string& field, string& name) [public]

This method is intended for printing and exporting purposes.It returns the localized literal name of a data field (for example, "name" (en) or "Name" (de) for the field "name") in the second reference. It returns false if the field descriptor (param 0) is unknown.

bool literalName(const string& key, string& text, bool reverse=false, bool initials=false) [public]

This method returns the literal name for the entry, containing either the formatted name (if given) or a combination of the first, additional and last name. The name is returned in text. If reverse is false, the text looks like firstname (add. name) last name, if it is true, + last name, first name (add. name). If initials is true, the text contains only initials: f. a. name [with reverse==false] or name, f. a. [with reverse==true]. If there is no entry with this key, the method returns false.

bool description(const string& key, string& text, bool reverse=false, bool initials=false) [public]

This method returns the same as literalName, except thatit fills the returned text with an email or talk address or any other useful information, so the text can be used to identify an entry even if its name fields are all empty.

bool birthDay(const string& key, QDate& date) [public]

This method returns the birthday for this entry in date or false if the entry does not have a birthday value.

bool invariant() [protected]

This method will be called by all REQUIRE and ENSURE statements. Itreturns {\tt true} if no inconsistencies regarding the internal data structures can be found. You need to be careful not to create endless looping here! (See the Nana documentation, "eiffel.h", for details.)

typedef map<string, string, less<string> > StringStringMap [protected]

The DB uses another map to access the entries in different orders.This map has always the same number of entries as there are subsections in the entry-section. The map contains strings describing the order of the entries (which can be reordered) and according to each string the {\em subsection name} of the entry in the entry-section. The {\tt current}-iterator is used to have one entry that is currently displayed.

void updateEntriesMap(string key="") [protected]

This method creates the mirror map by inserting an entry for each (DB) entry in it. It sets current to the entry with the key .

Section* configSection() [protected]

Convenience methods to retrieve frequently needed pointers and numbers.

static const char* ConfigSection[protected]

See the implementation file addressbook.cc for the contents of the constants.

bool makeEntryFromSection(Section&, Entry&) [protected]

This converts a subsection of the entry-section to an object of the {\em Entry}-class. It erases alll fields in the referenced entry even if they are empty in the section.

string getName(const string& key) [protected]

Get a verbose name (human readable) for an entry:

string nextAvailEntryKey() [protected]

internal!


Documentation generated by tasin@cd1 on Die Nov 30 17:32:39 CET 1999
Kdoc