S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CAddressBookContact Class Reference

#include <AddressBookContact.h>

List of all members.

Public Member Functions

const TPtrC8 FirstName ()
const TPtrC8 LastName ()
const TPtrC8 Street ()
const TPtrC8 PostCode ()
const TPtrC8 PhoneL ()
const TPtrC8 MobilePhoneL ()
const TPtrC8 Email ()
const TPtrC8 MiddleName ()
const TPtrC8 ExtraAddress ()
const TPtrC8 Locality ()
const TPtrC8 Region ()
const TPtrC8 Country ()
const TPtrC8 FaxL ()
const TPtrC8 Title ()
const TPtrC8 Organization ()
const TPtrC8 Unit ()

Static Public Member Functions

static CAddressBookContact * NewL ()

Private Member Functions

 CAddressBookContact ()
void ConstructL ()
const TPtrC8 ChildValue (const TDesC8 &aFirstElement, const TDesC8 &aSecondElement)
const TPtrC8 SelectedPhoneL (const TDesC8 &aType)


Detailed Description

CAddressBookContact class, responsible for work with personal card of an employee, who was found

Definition at line 58 of file AddressBookContact.h.


Constructor & Destructor Documentation

CAddressBookContact::CAddressBookContact (   )  [private]
 

C++ default constructor

Definition at line 28 of file AddressBookContact.cpp.

00029         {
00030         }


Member Function Documentation

CAddressBookContact * CAddressBookContact::NewL (   )  [static]
 

Two-phased constructor

Definition at line 37 of file AddressBookContact.cpp.

References CAddressBookContact(), and ConstructL().

00038         {
00039         CAddressBookContact* pNew = new (ELeave) CAddressBookContact();
00040         CleanupStack::PushL(pNew);
00041         pNew->ConstructL();
00042         CleanupStack::Pop(pNew);
00043         return pNew;
00044         }

const TPtrC8 CAddressBookContact::FirstName (   ) 
 

The function gets first name of the person who was found

Returns:
first name

Definition at line 60 of file AddressBookContact.cpp.

References ChildValue().

00061         {
00062         return ChildValue(KElementNameN, KElementNameGiven);
00063         }

const TPtrC8 CAddressBookContact::LastName (   ) 
 

The function gets last name of the person who was found

Returns:
last name

Definition at line 70 of file AddressBookContact.cpp.

References ChildValue().

00071         {
00072         return ChildValue(KElementNameN, KElementNameFamily);
00073         }

const TPtrC8 CAddressBookContact::Street (   ) 
 

The function gets street where the person who was found lives

Returns:
street

Definition at line 80 of file AddressBookContact.cpp.

References ChildValue().

00081         {
00082         return ChildValue(KElementNameAdr, KElementNameStreet);
00083         }

const TPtrC8 CAddressBookContact::PostCode (   ) 
 

The function gets post code where the person who was found lives

Returns:
post code

Definition at line 90 of file AddressBookContact.cpp.

References ChildValue().

00091         {
00092         return ChildValue(KElementNameAdr, KElementNamePCode);
00093         }

const TPtrC8 CAddressBookContact::PhoneL (   ) 
 

The function gets phone of the person who was found

Returns:
phone

Definition at line 100 of file AddressBookContact.cpp.

References SelectedPhoneL().

00101         {
00102         return SelectedPhoneL(KElementNamePref);
00103         }

const TPtrC8 CAddressBookContact::MobilePhoneL (   ) 
 

The function gets mobile phone of the person who was found

Returns:
mobile phone

Definition at line 110 of file AddressBookContact.cpp.

References SelectedPhoneL().

00111         {
00112         return SelectedPhoneL(KElementNameCell);
00113         }

const TPtrC8 CAddressBookContact::Email (   ) 
 

The function gets email of the person who was found

Returns:
email

Definition at line 120 of file AddressBookContact.cpp.

00121         {
00122         return ContentOf(KElementNameEmail);
00123         }

const TPtrC8 CAddressBookContact::MiddleName (   ) 
 

The function gets middle name of the person who was found

Returns:
middle name

Definition at line 130 of file AddressBookContact.cpp.

References ChildValue().

00131         {
00132         return ChildValue(KElementNameN, KElementNameMiddle);
00133         }

const TPtrC8 CAddressBookContact::ExtraAddress (   ) 
 

The function gets additional address where the person who was found lives

Returns:
extra address

Definition at line 140 of file AddressBookContact.cpp.

References ChildValue().

00141         {
00142         return ChildValue(KElementNameAdr, KElementNameExtAdr);
00143         }

const TPtrC8 CAddressBookContact::Locality (   ) 
 

The function gets locality where the person who was found lives

Returns:
locality

Definition at line 150 of file AddressBookContact.cpp.

References ChildValue().

00151         {
00152         return ChildValue(KElementNameAdr, KElementNameLocality);
00153         }

const TPtrC8 CAddressBookContact::Region (   ) 
 

The function gets region where the person who was found lives

Returns:
region

Definition at line 160 of file AddressBookContact.cpp.

References ChildValue().

00161         {
00162         return ChildValue(KElementNameAdr, KElementNameRegion);
00163         }

const TPtrC8 CAddressBookContact::Country (   ) 
 

The function gets country where the person who was found lives

Returns:
country

Definition at line 170 of file AddressBookContact.cpp.

References ChildValue().

00171         {
00172         return ChildValue(KElementNameAdr, KElementNameCountry);
00173         }

const TPtrC8 CAddressBookContact::FaxL (   ) 
 

The function gets fax of the person who was found

Returns:
fax

Definition at line 180 of file AddressBookContact.cpp.

References SelectedPhoneL().

00181         {
00182         return SelectedPhoneL(KElementNameFax);
00183         }

const TPtrC8 CAddressBookContact::Title (   ) 
 

The function gets title of the person who was found

Returns:
title

Definition at line 190 of file AddressBookContact.cpp.

00191         {
00192         return ContentOf(KElementNameTitle);
00193         }

const TPtrC8 CAddressBookContact::Organization (   ) 
 

The function gets organization where the person who was found works

Returns:
organization

Definition at line 200 of file AddressBookContact.cpp.

References ChildValue().

00201         {
00202         return ChildValue(KElementNameOrg, KElementNameOrgName);
00203         }

const TPtrC8 CAddressBookContact::Unit (   ) 
 

The function gets unit where the person who was found works

Returns:
unit

Definition at line 210 of file AddressBookContact.cpp.

References ChildValue().

00211         {
00212         return ChildValue(KElementNameOrg, KElementNameOrgUnit);
00213         }

void CAddressBookContact::ConstructL (   )  [private]
 

By default Symbian 2nd phase constructor is private.

Definition at line 50 of file AddressBookContact.cpp.

00051         {
00052         CSenDomFragment::BaseConstructL(KNsUri, KElementNameCard, KQualifiedNameCard);
00053         }

const TPtrC8 CAddressBookContact::ChildValue (  const TDesC8 &  aFirstElement,
const TDesC8 &  aSecondElement
)  [private]
 

The function binds two elements

Parameters:
aFirstElement 
aSecondElement 
Returns:
content of two elements

Definition at line 221 of file AddressBookContact.cpp.

00223         {
00224         CSenElement* pElement = AsElement().Element(aFirstElement);
00225         if (pElement)
00226                 {
00227                 pElement = pElement->Element(aSecondElement);
00228                 if (pElement)
00229                         {
00230                         return pElement->Content();
00231                         }
00232                 }
00233         return KNullDesC8();
00234         }

const TPtrC8 CAddressBookContact::SelectedPhoneL (  const TDesC8 &  aType  )  [private]
 

The function check a type of phone

Parameters:
aType - mobile, general, fax
Returns:
phone content

Definition at line 241 of file AddressBookContact.cpp.

00242         {
00243         RPointerArray<CSenElement> elements = AsElement().ElementsL();
00244         CSenElement* pElement = NULL;
00245         for (TInt i=0; i<elements.Count(); i++)
00246                 {
00247                 pElement = elements[i];
00248                 if (pElement->LocalName() == KElementNameTel)
00249                         {
00250                         const TDesC8* value = pElement->AttrValue(KAttrNameTypeUpperCase);
00251                         if (!value)
00252                                 {
00253                                 // lower case type check just in case
00254                                 value = pElement->AttrValue(KAttrNameTypeLowerCase); 
00255                                 }
00256                         if (value && *value == aType)
00257                                 {
00258                                 return pElement->Content();
00259                                 }
00260                         }
00261                 }
00262         return KNullDesC8();    
00263         }


© Nokia 2006

Back to top