kpilot

PhoneSlot Class Reference

This class exists only to clear up the type mess that is the field-numbers-and-indexes for phone numbers in the handheld records. More...

#include <pilotAddress.h>

List of all members.


Public Member Functions

bool isValid () const
 operator QString () const
const PhoneSlotoperator++ ()
bool operator== (const PhoneSlot &v) const
 PhoneSlot ()

Static Public Member Functions

static const PhoneSlot begin ()
static const PhoneSlot end ()

Static Public Attributes

static const int invalid = -1

Protected Member Functions

const PhoneSlotoperator= (const int &v)
 PhoneSlot (const int v)
unsigned int toField () const
unsigned int toOffset () const

Detailed Description

This class exists only to clear up the type mess that is the field-numbers-and-indexes for phone numbers in the handheld records.

The standard address record has 19 fields, five of which are phone fields. Those are fields 3..7 and they are referred to as fields Phone1 .. Phone5. Sometimes we need to act as if the phone field numbers are indeed the field numbers (3..7) and sometimes we need to use those same field numbers to index into a C array (0 based!) so then we map field number 3 (Phone1) to a 0 index.

Also handles iteration nicely.

A phone slot value may be invalid. If so, operations on it will fail (yielding invalid again) and isValid() will return false.

Definition at line 62 of file pilotAddress.h.


Constructor & Destructor Documentation

PhoneSlot::PhoneSlot ( const int  v  )  [explicit, protected]

Constructor.

Use the specified value for the phone slot. v is a field number (3..8).

Definition at line 106 of file pilotAddress.cc.

PhoneSlot::PhoneSlot (  )  [inline]

Constructor.

The slot is invalid.

Definition at line 90 of file pilotAddress.h.


Member Function Documentation

const PhoneSlot PhoneSlot::begin (  )  [static]

Begin value of an iteration through the phone slots.

Definition at line 138 of file pilotAddress.cc.

const PhoneSlot PhoneSlot::end (  )  [static]

When the slot range runs out (past entryPhone5) it is invalid, so the end compares with that.

Definition at line 143 of file pilotAddress.cc.

bool PhoneSlot::isValid (  )  const [inline]

Valid slots are entryPhone1 (3) through entryPhone5 (7).

Returns:
true if the slot is valid.

Definition at line 117 of file pilotAddress.h.

PhoneSlot::operator QString (  )  const

Definition at line 172 of file pilotAddress.cc.

const PhoneSlot & PhoneSlot::operator++ (  ) 

Iterator operation.

Go to the next slot (or invalid when the range runs out).

Definition at line 125 of file pilotAddress.cc.

const PhoneSlot & PhoneSlot::operator= ( const int &  v  )  [protected]

Assignment operator.

Set the value of the slot to the specified value v . This may yield an invalid phone slot.

Definition at line 112 of file pilotAddress.cc.

bool PhoneSlot::operator== ( const PhoneSlot v  )  const [inline]

Comparison operator.

Definition at line 96 of file pilotAddress.h.

unsigned int PhoneSlot::toField (  )  const [protected]

Map the slot to a field number.

Definition at line 160 of file pilotAddress.cc.

unsigned int PhoneSlot::toOffset (  )  const [protected]

Map the slot to an offset (for use in finding the phone type for a given slot).

Returns:
Offset of this slot within the phone fields.

Definition at line 148 of file pilotAddress.cc.


Member Data Documentation

const int PhoneSlot::invalid = -1 [static]

Value for invalid slots. */.

Definition at line 87 of file pilotAddress.h.


The documentation for this class was generated from the following files: