CXmppSettingsApi Class Reference

class CXmppSettingsApi : public CBase

This class handles dynamic name-value pair storing. Be warned, all actions are final.

This is how this component works: It has two tables. First one, the column table, contains only single row. This table is actually a header table for the record table. When you set an new attribute, we check that does it already exist in column table. If it does not, it is added as last entry. After that data of the attribute is set to the record table into same column as it is attribute name is in the column table. Row of the settings record is determined by given settingsrecordid.

The column table can hold 0xFFFE (65534) of different user attributes and you can add 0xFF (255) different settingsrecords.

Below is an picture of the tables. Only the ID column is mandatory. All other columns are defined by user.

------------------------------------------------------------ | COLUMNS TABLE | |----------------------------------------------------------- | 1 | 2 | 3 | 4 | 5... | | ------------------------------------------------------------ | ID | SERVER-ADDR | SERVER-PORT | USERNAME | etc...| | ------------------------------------------------------------

------------------------------------------------------------ | RECORDS TABLE | |----------------------------------------------------------- | 1 | 2 | 3 | 4 | 5... | | ------------------------------------------------------------ | 1 | www.gizmo.com | 5223 | Myerdin | etc...| | ------------------------------------------------------------ | 2 | | 5222 | Ballmer | etc...| | ------------------------------------------------------------ | 3 | login.com | | Apple | etc...| | ------------------------------------------------------------ | 4 | aaa.bbb.com | 1234 | user | etc...| | ------------------------------------------------------------

Usage examples:
  ---- Example 1 ----------------------------------------------
   Usage example:
   First Create settings record:

   TUint32 settingId(0);
   CXmppSettingsApi* sapi = CXmppSettingsApi::NewLC();
   sapi->CreateSettingsRecordL( settingId );
   CleanupStack::PopAndDestroy( sapi );

   The settingId contains now new id.

 ---- Example 2 ----------------------------------------------
   You can request default settings record (currently returns the first):

   TUint32 settingId(0);
   sapi->DefaultSettingsRecordL( settingId );

   The settingId contains now the id.

  ---- Example 3 ----------------------------------------------
   When you want to add new parameter to the settings record, do following:

   _LIT( KOurParam, "USERNAME");

   sapi->SetParamL( settingId,
                    KOurParam(),
                    aUsername );

   If this is the first time the parameter is added to the settings record,
   it creates new room for it.

  ---- Example 4 ----------------------------------------------
   When you want to get parameter from the settings record, do following:

   _LIT( KOurParam, "USERNAME");
   RBuf value;
   value.CreateL( KMaxParamLength );

   sapi->SetParamL( settingId,
                    KOurParam(),
                    value );

   Value now contains the value recordd in the settings record. If no value
   has been set for this settins records column, then it cannot be
   found ->leaves KErrNotFound.
jabbersettings.lib
Since
S60 5.0

Inherits from

Constructor & Destructor Documentation

CXmppSettingsApi()

CXmppSettingsApi()[private]

Default Contructor

~CXmppSettingsApi()

IMPORT_C~CXmppSettingsApi()[virtual]

Destructor

Member Functions Documentation

ConstructL()

voidConstructL()[private]

CreateSettingsRecordL(TUint32 &)

IMPORT_C voidCreateSettingsRecordL(TUint32 &aSettingsRecordId)

Creates new settings record.

Since
S60 5.0

Parameters

TUint32 & aSettingsRecordIdOn return contains the new setting id.

DefaultSettingsRecordL(TUint32 &)

IMPORT_C voidDefaultSettingsRecordL(TUint32 &aSettingsRecordId)

Returns default settings record id.

Since
S60 5.0

Parameters

TUint32 & aSettingsRecordIdOn return contains the setting id.

GetColumnKeyL(TUint32, const TDesC &, TBool, TUint32 &)

voidGetColumnKeyL(TUint32aSettingsRecordId,
const TDesC &aAttrName,
TBoolaCreateColumnIfNotExist,
TUint32 &aTheKey
)[private]

This method does checks before setting or getting values.

Since
S60 5.0

Parameters

TUint32 aSettingsRecordIdSetting id to be changed.
const TDesC & aAttrNameParameters name.
TBool aCreateColumnIfNotExistShould new column be created if it is not founded (by aAttrName).
TUint32 & aTheKeyOn return contains key to be created/changed.

GetParamL(TUint32, const TDesC &, TDes &)

IMPORT_C voidGetParamL(TUint32aSettingsRecordId,
const TDesC &aAttrName,
TDes &aAttrValue
)
Gets value of the param.
  • KErrNotFound if setting collection or Param is not found.

Since
S60 5.0

Parameters

TUint32 aSettingsRecordIdSetting id of interest.
const TDesC & aAttrNameParameters name.
TDes & aAttrValueOn return, contains the param value.

GetParamL(TUint32, const TDesC &, TInt &)

IMPORT_C voidGetParamL(TUint32aSettingsRecordId,
const TDesC &aAttrName,
TInt &aAttrValue
)
Gets value of the param.
  • KErrNotFound if setting collection or Param is not found.

Since
S60 5.0

Parameters

TUint32 aSettingsRecordIdSetting id of interest.
const TDesC & aAttrNameParameters name.
TInt & aAttrValueOn return, contains the param value.

GetRepositoryKeyL(TUint32, const TDesC &, TBool, TUint32 &)

IMPORT_C voidGetRepositoryKeyL(TUint32aSettingsRecordId,
const TDesC &aAttrName,
TBoolaCreateColumnIfNotExist,
TUint32 &aTheKey
)

This method does checks before setting or getting values.

Since
S60 5.0

Parameters

TUint32 aSettingsRecordIdSetting id to be changed.
const TDesC & aAttrNameParameters name.
TBool aCreateColumnIfNotExistShould new column be created if it is not founded (by aAttrName).
TUint32 & aTheKeyOn return contains key to be created/changed.

GetSettingsRecordIdArrayL(RArray< TUint32 > &)

IMPORT_C voidGetSettingsRecordIdArrayL(RArray< TUint32 > &aArray)

Fills the array with settings ids. If there is none, array is zero length.

Since
S60 5.0

Parameters

RArray< TUint32 > & aArrayArray is filled with setting ids.

NewL()

IMPORT_C CXmppSettingsApi *NewL()[static]

Two-phased constructor.

NewLC()

IMPORT_C CXmppSettingsApi *NewLC()[static]

RemoveParamL(TUint32, const TDesC &)

IMPORT_C voidRemoveParamL(TUint32aSettingsRecordId,
const TDesC &aAttrName
)
Removes this param from this Settings record.
  • KErrNotFound If Settings record or param is not found.

Since
S60 5.0

Parameters

TUint32 aSettingsRecordIdSetting id.
const TDesC & aAttrNameParameters name.

RemoveSettingsRecordL(TUint32)

IMPORT_C voidRemoveSettingsRecordL(TUint32aSettingsRecordId)

Removes Settings record using given settings record id.

Since
S60 5.0

Parameters

TUint32 aSettingsRecordIdSetting id to be removed.

SetParamL(TUint32, const TDesC &, const TDesC &)

IMPORT_C voidSetParamL(TUint32aSettingsRecordId,
const TDesC &aAttrName,
const TDesC &aAttrValue
)

Sets value of the param. If ParamName is not found, it creates new.

Since
S60 5.0

Parameters

TUint32 aSettingsRecordIdSetting id of interest.
const TDesC & aAttrNameParameters name.
const TDesC & aAttrValueParameters value.

SetParamL(TUint32, const TDesC &, TInt)

IMPORT_C voidSetParamL(TUint32aSettingsRecordId,
const TDesC &aAttrName,
TIntaAttrValue
)

Sets value of the param. If ParamName is not found, it creates new.

Since
S60 5.0

Parameters

TUint32 aSettingsRecordIdSetting id of interest.
const TDesC & aAttrNameParameters name.
TInt aAttrValueParameters value.

Member Data Documentation

CXmppSettingsColumn * iColumns

CXmppSettingsColumn *iColumns[private]

Class for column table handling. Own.

CXmppSettingsRecord * iRecords

CXmppSettingsRecord *iRecords[private]

Class for settings records handling. Own.

CRepository * iRepository

CRepository *iRepository[private]

Central Repository. Own.