CIniData Class Reference

#include <iniparser.h>

Link against: iniparser.lib

class CIniData : public CBase

Inherits from

Public Member Functions
virtual ~CIniData()
IMPORT_C TIntAddValue(const TDesC &, const TDesC &, const TDesC &)
IMPORT_C TIntAddValue(const TDesC &, const TDesC &)
IMPORT_C TBoolFindVar(const TDesC &, TPtrC &)
IMPORT_C TBoolFindVar(const TDesC &, TInt &)
IMPORT_C TBoolFindVar(const TDesC &, const TDesC &, TPtrC &)
IMPORT_C TBoolFindVar(const TDesC &, const TDesC &, TInt &)
IMPORT_C TBoolFindVar(const TDesC &, const TDesC &, TInt64 &)
IMPORT_C CIniData *NewL(const TDesC &)
IMPORT_C CIniData *NewL(const TDesC &, const TDesC &)
IMPORT_C TIntSetValue(const TDesC &, const TDesC &)
IMPORT_C TIntSetValue(const TDesC &, const TDesC &, const TDesC &)
IMPORT_C voidWriteToFileL()
Protected Member Functions
CIniData()
CIniData(const TDesC &)
IMPORT_C voidConstructL(const TDesC &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()

Detailed Description

Test

Defines the interface to acess to ini data file

The basic functions, FindVar(), SetValue(), AddValue() and WriteToFileL() Compulsory to call WriteToFileL() after calling any SetValue() or AddValue()

Constructor & Destructor Documentation

CIniData ( )

IMPORT_CCIniData()[protected]

Constructor

CIniData ( const TDesC & )

IMPORT_CCIniData(const TDesC &aSysDrive)[protected]

Overloaded constructor Takes in the system drive letter to overwrite

~CIniData ( )

IMPORT_C~CIniData()[virtual]

Destructor Frees the resources located in second-phase constructor

Member Function Documentation

AddValue ( const TDesC &, const TDesC &, const TDesC & )

IMPORT_C TIntAddValue(const TDesC &aSection,
const TDesC &aKeyName,
const TDesC &aValue
)

Add key aKeyName to section aSectName

Parameters
aSectionSection
aKeyNameKey being added to section aSectName
aValueA text value added to the aKeyName
Return Value
KErrNone if sucessful, otherwise system error

AddValue ( const TDesC &, const TDesC & )

IMPORT_C TIntAddValue(const TDesC &aKeyName,
const TDesC &aValue
)

Add key aKeyName to end of ini data file

Parameters
aKeyNameaKeyName Key being added
aValueText value assigned to the aKeyName
Return Value
KErrNone if sucessful, otherwise system error

ConstructL ( const TDesC & )

IMPORT_C voidConstructL(const TDesC &aName)[protected]
Second-phase constructor. The function attempts to allocate a buffer and Read file's contents into iPtr
Parameters
aNamethe name of the file which contains the ini data
Leave Codes
Oneof the system-wide error codes

FindVar ( const TDesC &, TPtrC & )

IMPORT_C TBoolFindVar(const TDesC &aKeyName,
TPtrC &aResult
)

Find a text value from given aKeyName regardless the section in the ini data file

Parameters
aKeyNameKey being searched for
aResultOn return, contains the text result
Return Value
ETrue if found, otherwise EFalse

FindVar ( const TDesC &, TInt & )

IMPORT_C TBoolFindVar(const TDesC &aKeyName,
TInt &aResult
)

Find an integer value from given aKeyName regardless the section in the ini data file

Parameters
aKeyNameKey being searched for
aResultOn return, contains the TInt result
Return Value
ETrue if found, otherwise EFalse

FindVar ( const TDesC &, const TDesC &, TPtrC & )

IMPORT_C TBoolFindVar(const TDesC &aSection,
const TDesC &aKeyName,
TPtrC &aResult
)

Find a text value from given aKeyName and aSecName in the ini data file

Parameters
aSectionSection containing key
aKeyNameKey being searched for in aSectName
aResultOn return, contains the text result
Return Value
ETrue if found, otherwise EFalse

FindVar ( const TDesC &, const TDesC &, TInt & )

IMPORT_C TBoolFindVar(const TDesC &aSection,
const TDesC &aKeyName,
TInt &aResult
)

Find an integer value from given aKeyName and aSecName in the ini data file

Parameters
aKeyNameKey being searched for in aSectName
aResultOn return, contains TInt result
Return Value
ETrue if found, otherwise EFalse

FindVar ( const TDesC &, const TDesC &, TInt64 & )

IMPORT_C TBoolFindVar(const TDesC &aSection,
const TDesC &aKeyName,
TInt64 &aResult
)

Find an 64-bit integer value from given aKeyName and aSecName in the ini data file

Parameters
aKeyNameKey being searched for in aSectName
aResultOn return, contains TInt64 result
Return Value
ETrue if found, otherwise EFalse

NewL ( const TDesC & )

IMPORT_C CIniData *NewL(const TDesC &aName)[static]

Creates, and returns a pointer to CIniData object, leave on failure

Parameters
aName- Path and name of the ini file to be parsed
Return Value
A pointer to the CiniData object

NewL ( const TDesC &, const TDesC & )

IMPORT_C CIniData *NewL(const TDesC &aName,
const TDesC &aSysDrive
)[static]

Creates, and returns a pointer to CIniData object, leave on failure

Parameters
aName- Path and name of the ini file to be parsed
aSysDrive- Drive letter to overwrite the default system drive
Return Value
A pointer to the CiniData object

SetValue ( const TDesC &, const TDesC & )

IMPORT_C TIntSetValue(const TDesC &aKeyName,
const TDesC &aValue
)

Set a text value to given aKeyName regardless of the section in the ini data file

Parameters
aKeyNameKey being searched for
aValueA text value set for the aKeyName
Return Value
KErrNone if sucessful, otherwise system error

SetValue ( const TDesC &, const TDesC &, const TDesC & )

IMPORT_C TIntSetValue(const TDesC &aSection,
const TDesC &aKeyName,
const TDesC &aValue
)

Set a text value to given aKeyName and aSecName in the ini data file

Parameters
aKeyNameKey being set in aSectName
aValueA text value set for the aKeyName in section ASecName
Return Value
KErrNone if sucessful, otherwise system error

WriteToFileL ( )

IMPORT_C voidWriteToFileL()

A method used to flush the data in the buffer to the file given in second-phase constructor