TLiwVariant Class Reference

class TLiwVariant

Variant data class to hold a value of a TLiwGenericParam instance. The variant contains a data type and a value. This class is attached to TLiwGenericParam instance which holds the semantic type of the value.

ServiceHandler.lib
Since
Series 60 2.6
TLiwGenericParam

Nested Classes and Structures

Public Member Functions
TLiwVariant()
TLiwVariant(TInt32)
TLiwVariant(TInt64)
TLiwVariant(TUint)
TLiwVariant(TBool)
TLiwVariant(const TUid &)
TLiwVariant(const TTime &)
TLiwVariant(const TDesC &)
TLiwVariant(const HBufC *)
TLiwVariant(const TDesC8 &)
TLiwVariant(const RFile &)
TLiwVariant(const CLiwList *)
TLiwVariant(const CLiwMap *)
TLiwVariant(const MLiwInterface *)
TLiwVariant(const CLiwIterable *)
TLiwVariant(TReal)
TLiwVariant(const CLiwBuffer *)
TLiwVariant(const TLiwVariant &)
IMPORT_C CLiwBuffer *AsBuffer()
IMPORT_C TPtrC8AsData()
IMPORT_C TPtrCAsDes()
IMPORT_C RFileAsFileHandle()
IMPORT_C MLiwInterface *AsInterface()
IMPORT_C CLiwIterable *AsIterable()
IMPORT_C const CLiwList *AsList()
IMPORT_C const CLiwMap *AsMap()
IMPORT_C TBoolAsTBool()
IMPORT_C TInt32AsTInt32()
IMPORT_C TInt64AsTInt64()
IMPORT_C TRealAsTReal()
IMPORT_C TTimeAsTTime()
IMPORT_C TUidAsTUid()
IMPORT_C TBoolAsTUint()
IMPORT_C TBoolGet(TInt32 &)
IMPORT_C TBoolGet(TInt64 &)
IMPORT_C TBoolGet(TUid &)
IMPORT_C TBoolGet(TUint &)
IMPORT_C TBoolGet(TBool &)
IMPORT_C TBoolGet(TPtrC &)
IMPORT_C TBoolGet(TTime &)
IMPORT_C TBoolGet(TPtrC8 &)
IMPORT_C TBoolGet(RFile &)
IMPORT_C TBoolGet(CLiwList &)
IMPORT_C TBoolGet(CLiwMap &)
IMPORT_C TBoolGet(TDes &)
IMPORT_C TBoolGet(TDes8 &)
IMPORT_C TBoolGet(TReal &)
TBool IsEmpty()
IMPORT_C voidPushL()
IMPORT_C voidReset()
IMPORT_C voidSet(TInt32)
IMPORT_C voidSet(TInt64)
IMPORT_C voidSet(TBool)
IMPORT_C voidSet(TUint)
IMPORT_C voidSet(const TUid &)
IMPORT_C voidSet(const TTime &)
IMPORT_C voidSet(const TDesC &)
voidSet(const HBufC *)
IMPORT_C voidSet(const TDesC8 &)
IMPORT_C voidSet(const RFile &)
IMPORT_C voidSet(const CLiwList *)
IMPORT_C voidSet(const CLiwMap *)
IMPORT_C voidSet(const MLiwInterface *)
IMPORT_C voidSet(const CLiwIterable *)
IMPORT_C voidSet(TReal)
IMPORT_C voidSet(const CLiwBuffer *)
IMPORT_C voidSetL(const TLiwVariant &)
LIW::TVariantTypeId TypeId()
IMPORT_C voidVariantCleanup(TAny *)
IMPORT_C TLiwVariant &operator=(const TLiwVariant &)
TLiwVariant &operator=(const TTime &)
TLiwVariant &operator=(const TUid &)
TLiwVariant &operator=(TInt32)
TLiwVariant &operator=(TInt64)
TLiwVariant &operator=(TBool)
TLiwVariant &operator=(TUint)
TLiwVariant &operator=(const TDesC &)
TLiwVariant &operator=(const HBufC *)
TLiwVariant &operator=(const TDesC8 &)
TLiwVariant &operator=(const RFile &)
TLiwVariant &operator=(const CLiwList *)
TLiwVariant &operator=(const CLiwMap *)
TLiwVariant &operator=(const MLiwInterface *)
TLiwVariant &operator=(const CLiwIterable *)
TLiwVariant &operator=(TReal)
TLiwVariant &operator=(const CLiwBuffer *)
Private Member Functions
voidCleanupDestroy(TAny *)
voidDestroy()
voidExternalizeL(RWriteStream &)
voidInternalizeL(RReadStream &)
TInt Size()
void__DbgTestInvariant()
operator TCleanupItem()
Private Attributes
UData iData
TPtrC iPtrC
TPtrC8 iPtrC8
TUint8 iTypeId

Constructor & Destructor Documentation

TLiwVariant()

TLiwVariant()[inline]

Default constructor. Initializes this variant to be empty.

Post-condition
IsEmpty()

TLiwVariant(TInt32)

TLiwVariant(TInt32aValue)[inline]

Constructor from a value.

Parameters

TInt32 aValueThe value to set for this variant object.

TLiwVariant(TInt64)

TLiwVariant(TInt64aValue)[inline]

Constructor from a value.

Parameters

TInt64 aValueThe value to set for this variant object.

TLiwVariant(TUint)

TLiwVariant(TUintaValue)[inline]

Constructor from a value.

Parameters

TUint aValueThe value to set for this variant object.

TLiwVariant(TBool)

TLiwVariant(TBoolaValue)[inline]

Constructor from a value.

Parameters

TBool aValueThe value to set for this variant object.

TLiwVariant(const TUid &)

TLiwVariant(const TUid &aValue)[inline]

Constructor from a value.

Parameters

const TUid & aValueThe value to set for this variant object.

TLiwVariant(const TTime &)

TLiwVariant(const TTime &aValue)[inline]

Constructor from a value.

Parameters

const TTime & aValueThe value to set for this variant object.

TLiwVariant(const TDesC &)

TLiwVariant(const TDesC &aValue)[inline]

Constructor from a value.

Parameters

const TDesC & aValueThe value to set for this variant object.

TLiwVariant(const HBufC *)

TLiwVariant(const HBufC *aValue)[inline]

Constructor from a value.

Parameters

const HBufC * aValueThe value to set for this variant object.

TLiwVariant(const TDesC8 &)

TLiwVariant(const TDesC8 &aValue)[inline]

Constructor from a value.

Parameters

const TDesC8 & aValueThe value to set for this variant object.

TLiwVariant(const RFile &)

TLiwVariant(const RFile &aValue)[inline]

Constructor from a value.

Parameters

const RFile & aValueThe value to set for this variant object.

TLiwVariant(const CLiwList *)

TLiwVariant(const CLiwList *aValue)[inline]

Constructor from a value.

Parameters

const CLiwList * aValueThe value to set for this variant object.

TLiwVariant(const CLiwMap *)

TLiwVariant(const CLiwMap *aValue)[inline]

Constructor from a value.

Parameters

const CLiwMap * aValueThe value to set for this variant object.

TLiwVariant(const MLiwInterface *)

TLiwVariant(const MLiwInterface *aValue)[inline]

Constructor from a value.

Parameters

const MLiwInterface * aValueThe value to set for this variant object.

TLiwVariant(const CLiwIterable *)

TLiwVariant(const CLiwIterable *aValue)[inline]

Constructor from a value.

Parameters

const CLiwIterable * aValueThe value to set for this variant object.

TLiwVariant(TReal)

TLiwVariant(TRealaValue)[inline]

Constructor from a value.

Parameters

TReal aValueThe value to set for this variant object.

TLiwVariant(const CLiwBuffer *)

TLiwVariant(const CLiwBuffer *aValue)[inline]

Constructor from a value.

Parameters

const CLiwBuffer * aValueThe value to set for this variant object.

TLiwVariant(const TLiwVariant &)

IMPORT_CTLiwVariant(const TLiwVariant &aSrc)

Copy constructor. Does not take ownership of data.

Parameters

const TLiwVariant & aSrcThe source object.

Member Functions Documentation

AsBuffer()

IMPORT_C CLiwBuffer *AsBuffer()const

Returns the value held by this variant.

AsData()

IMPORT_C TPtrC8AsData()const

Returns the value held by this variant.

AsDes()

IMPORT_C TPtrCAsDes()const

Returns the value held by this variant.

AsFileHandle()

IMPORT_C RFileAsFileHandle()const

Returns the value held by this variant.

AsInterface()

IMPORT_C MLiwInterface *AsInterface()const

Returns the value held by this variant.

AsIterable()

IMPORT_C CLiwIterable *AsIterable()const

Returns the value held by this variant.

AsList()

IMPORT_C const CLiwList *AsList()const

Returns the value held by this variant.

AsMap()

IMPORT_C const CLiwMap *AsMap()const

Returns the value held by this variant.

AsTBool()

IMPORT_C TBoolAsTBool()const

Returns the value held by this variant.

AsTInt32()

IMPORT_C TInt32AsTInt32()const

Returns the value held by this variant.

AsTInt64()

IMPORT_C TInt64AsTInt64()const

Returns the value held by this variant.

AsTReal()

IMPORT_C TRealAsTReal()const

Returns the value held by this variant.

AsTTime()

IMPORT_C TTimeAsTTime()const

Returns the value held by this variant.

AsTUid()

IMPORT_C TUidAsTUid()const

Returns the value held by this variant.

AsTUint()

IMPORT_C TBoolAsTUint()const

Returns the value held by this variant.

CleanupDestroy(TAny *)

voidCleanupDestroy(TAny *aObj)[private, static]

Parameters

TAny * aObj

Destroy()

voidDestroy()[private]

Destroys any dynamic resource owned by this variant.

ExternalizeL(RWriteStream &)

voidExternalizeL(RWriteStream &aStream)const [private]

Streaming support for TLiwGenericParam. Externalizes this variant to a stream.

Parameters

RWriteStream & aStream

Get(TInt32 &)

IMPORT_C TBoolGet(TInt32 &aValue)const

Retrieves the value held by this variant.

Parameters

TInt32 & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

Get(TInt64 &)

IMPORT_C TBoolGet(TInt64 &aValue)const

Retrieves the value held by this variant.

Parameters

TInt64 & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

Get(TUid &)

IMPORT_C TBoolGet(TUid &aValue)const

Retrieves the value held by this variant.

Parameters

TUid & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

Get(TUint &)

IMPORT_C TBoolGet(TUint &aValue)const

Retrieves the boolean value held by this variant.

Parameters

TUint & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

Get(TBool &)

IMPORT_C TBoolGet(TBool &aValue)const

Retrieves the boolean value held by this variant.

Parameters

TBool & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

Get(TPtrC &)

IMPORT_C TBoolGet(TPtrC &aValue)const

Retrieves the value held by this variant.

Parameters

TPtrC & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

Get(TTime &)

IMPORT_C TBoolGet(TTime &aValue)const

Retrieves the value held by this variant.

Parameters

TTime & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

Get(TPtrC8 &)

IMPORT_C TBoolGet(TPtrC8 &aValue)const

Retrieves the value held by this variant.

Parameters

TPtrC8 & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

Get(RFile &)

IMPORT_C TBoolGet(RFile &aValue)const

Retrieves the value held by this variant.

Parameters

RFile & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

Get(CLiwList &)

IMPORT_C TBoolGet(CLiwList &aValue)const

Retrieves the value held by this variant.

Parameters

CLiwList & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

Get(CLiwMap &)

IMPORT_C TBoolGet(CLiwMap &aValue)const

Retrieves the value held by this variant.

Parameters

CLiwMap & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

Get(TDes &)

IMPORT_C TBoolGet(TDes &aValue)const

Retrieves the value held by this variant.

Parameters

TDes & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

Get(TDes8 &)

IMPORT_C TBoolGet(TDes8 &aValue)const

Sets the value held by this variant.

Parameters

TDes8 & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

Get(TReal &)

IMPORT_C TBoolGet(TReal &aValue)const

Retrieves the value held by this variant.

Parameters

TReal & aValueIf this variant's type does not match the parameter type, the parameter will not be modified.

InternalizeL(RReadStream &)

voidInternalizeL(RReadStream &aStream)[private]

Streaming support for TLiwGenericParam. Internalizes this variant from a stream.

Parameters

RReadStream & aStream

IsEmpty()

TBool IsEmpty()const [inline]

Returns ETrue if this variant is empty (it does not hold any value).

PushL()

IMPORT_C voidPushL()

A friendly and convenient method to push the TLiwVariant Object into the CleanupStack

!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!

This method informs the CleanupStack that VariantCleanup method should be called incase of any Leave

 	 TLiwVariant var;
    var.PushL();				//This pushes the variant object "var" into the CleanupStack using TCleanupItem and VariantCleanup.
    User::Leave(KErrGeneral);  //This calls the VariantCleanup method which cleans up TLiwVariant
    CleanupStack::Pop(&var);	//These statements are not executed
    var.Reset(); 		

This method is recommended than explicitly pushing the parameter object into the CleanupStack using TCleanupItem and VariantCleanup.

VariantCleanup() method

Reset()

IMPORT_C voidReset()

Deletes possibly set value and resets this variant to empty.

Post-condition
IsEmpty()

Set(TInt32)

IMPORT_C voidSet(TInt32aValue)

Sets integer value to this variant. The previous value is overwritten.

Post-condition
*this == aValue

Parameters

TInt32 aValueValue for this variant object to hold.

Set(TInt64)

IMPORT_C voidSet(TInt64aValue)

Sets integer value to this variant. The previous value is overwritten.

Post-condition
*this == aValue

Parameters

TInt64 aValueValue for this variant object to hold.

Set(TBool)

IMPORT_C voidSet(TBoolaValue)

Sets Boolean value to this variant. The previous value is overwritten.

Post-condition
*this == aValue

Parameters

TBool aValueValue for this variant object to hold.

Set(TUint)

IMPORT_C voidSet(TUintaValue)

Sets Boolean value to this variant. The previous value is overwritten.

Post-condition
*this == aValue

Parameters

TUint aValueValue for this variant object to hold.

Set(const TUid &)

IMPORT_C voidSet(const TUid &aValue)

Sets unique ID value to this variant. The previous value is overwritten.

Post-condition
*this == aValue

Parameters

const TUid & aValueValue for this variant object to hold.

Set(const TTime &)

IMPORT_C voidSet(const TTime &aValue)

Sets date and time value to this variant. The previous value is overwritten.

Post-condition
*this == aValue

Parameters

const TTime & aValueValue for this variant object to hold.

Set(const TDesC &)

IMPORT_C voidSet(const TDesC &aValue)

Sets constant text reference to this variant.

Post-condition
*this == aValue

Parameters

const TDesC & aValueText value for this variant object to hold.

Set(const HBufC *)

voidSet(const HBufC *aValue)[inline]

Sets constant text reference to this variant.

Parameters

const HBufC * aValueText value for this variant object to hold. Ownership is not taken.

Set(const TDesC8 &)

IMPORT_C voidSet(const TDesC8 &aValue)

Sets constant 8-bit text reference to this variant.

Post-condition
*this == aValue

Parameters

const TDesC8 & aValueText value for this variant object to hold.

Set(const RFile &)

IMPORT_C voidSet(const RFile &aValue)

Sets RFile file handle to this variant.

Post-condition
*this == aValue

Parameters

const RFile & aValueFile handle for this variant object to hold.

Set(const CLiwList *)

IMPORT_C voidSet(const CLiwList *aValue)

Sets list of variants to this variant.

Parameters

const CLiwList * aValueArray of variants for this variant object to hold. *this == aValue

Set(const CLiwMap *)

IMPORT_C voidSet(const CLiwMap *aValue)

Sets map of variants to this variant.

Parameters

const CLiwMap * aValueDictionary of variants for this variant object to hold. *this == aValue

Set(const MLiwInterface *)

IMPORT_C voidSet(const MLiwInterface *aValue)

Sets interface pointer to this variant.

Parameters

const MLiwInterface * aValueInterface pointer for this variant object to hold. *this == aValue

Set(const CLiwIterable *)

IMPORT_C voidSet(const CLiwIterable *aValue)

Sets list of variants to this variant.

Parameters

const CLiwIterable * aValueSequence of variants for this variant object to hold. *this == aValue

Set(TReal)

IMPORT_C voidSet(TRealaValue)

Sets integer value to this variant. The previous value is overwritten.

Post-condition
*this == aValue

Parameters

TReal aValueValue for this variant object to hold.

Set(const CLiwBuffer *)

IMPORT_C voidSet(const CLiwBuffer *aValue)

Sets integer value to this variant. The previous value is overwritten.

Post-condition
*this == aValue

Parameters

const CLiwBuffer * aValueValue for this variant object to hold.

SetL(const TLiwVariant &)

IMPORT_C voidSetL(const TLiwVariant &aValue)
Data copying support for TLiwGenericParam. Sets the copy of given variant value to this variant
Post-condition
*this == aValue

Parameters

const TLiwVariant & aValuevariant value for this variant object to hold.

Size()

TInt Size()const [private]

Streaming support for TLiwGenericParam. Returns the maximum externalized size of this variant in bytes.

TypeId()

LIW::TVariantTypeId TypeId()const [inline]

Returns the type id of data this variant object is holding.

VariantCleanup(TAny *)

IMPORT_C voidVariantCleanup(TAny *aObj)[static]

TLiwVariant cleanup method

!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Variants can be pushed into the CleanupStack using this method along with TCleanupItem

@ param aObj - TLiwVariant Object but of type TAny* for usage with TCleanupItem

Example 1: Here the client explicitly pushes the variant into the CleanupStack using TCleanupItem

 	 TLiwVariant var;
    
    //The below statement pushes the variant object "var" into the CleanupStack using TCleanupItem and VariantCleanup.
    CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &var ) ); 
 	  
    User::Leave(KErrGeneral);  //This calls the VariantCleanup method which cleans up TLiwVariant
    CleanupStack::Pop(&var);	//These statements are not executed due to "Leave"
    var.Reset(); 

Example 2: Here the client calls the PushL method of TLiwVariant which pushes the object into the CleanupStack using TCleanupItem

    TLiwVariant var;
    var.PushL();				//This pushes the variant object "var" into the CleanupStack using TCleanupItem and VariantCleanup.
    User::Leave(KErrGeneral);  //This calls the VariantCleanup method which cleans up TLiwVariant
    CleanupStack::Pop(&var);	//These statements are not executed due to "Leave"
    var.Reset(); 

The clients can use the convenient PushL method which is recommended (as shown in e.g 2) rather than explicitly pushing the variant object into the CleanupStack using TCleanupItem and VariantCleanup.

@ see PushL() method

Parameters

TAny * aObj

__DbgTestInvariant()

void__DbgTestInvariant()const [private]

operator TCleanupItem()

operator TCleanupItem()[private]

operator=(const TLiwVariant &)

IMPORT_C TLiwVariant &operator=(const TLiwVariant &aValue)

Assignment operator. Does not take ownership of data.

Parameters

const TLiwVariant & aValueThe source object.

operator=(const TTime &)

TLiwVariant &operator=(const TTime &aValue)[inline]

Assignment operator for the variant.

Parameters

const TTime & aValueThe source object.

operator=(const TUid &)

TLiwVariant &operator=(const TUid &aValue)[inline]

Assignment operator for the variant.

Parameters

const TUid & aValueThe source object.

operator=(TInt32)

TLiwVariant &operator=(TInt32aValue)[inline]

Assignment operator for the variant.

Parameters

TInt32 aValueThe source object.

operator=(TInt64)

TLiwVariant &operator=(TInt64aValue)[inline]

Assignment operator for the variant.

Parameters

TInt64 aValueThe source object.

operator=(TBool)

TLiwVariant &operator=(TBoolaValue)[inline]

Assignment operator for the variant.

Parameters

TBool aValueThe source object.

operator=(TUint)

TLiwVariant &operator=(TUintaValue)[inline]

Assignment operator for the variant.

Parameters

TUint aValueThe source object.

operator=(const TDesC &)

TLiwVariant &operator=(const TDesC &aValue)[inline]

Assignment operator for the variant.

Parameters

const TDesC & aValueThe source object.

operator=(const HBufC *)

TLiwVariant &operator=(const HBufC *aValue)[inline]

Assignment operator for the variant.

Parameters

const HBufC * aValueThe source object.

operator=(const TDesC8 &)

TLiwVariant &operator=(const TDesC8 &aValue)[inline]

Assignment operator for the variant.

Parameters

const TDesC8 & aValueThe source object.

operator=(const RFile &)

TLiwVariant &operator=(const RFile &aValue)[inline]

Assignment operator for the variant.

Parameters

const RFile & aValueThe source object.

operator=(const CLiwList *)

TLiwVariant &operator=(const CLiwList *aValue)[inline]

Assignment operator for the variant.

Parameters

const CLiwList * aValueThe source.

operator=(const CLiwMap *)

TLiwVariant &operator=(const CLiwMap *aValue)[inline]

Assignment operator for the variant.

Parameters

const CLiwMap * aValueThe source.

operator=(const MLiwInterface *)

TLiwVariant &operator=(const MLiwInterface *aValue)[inline]

Assignment operator for the variant.

Parameters

const MLiwInterface * aValueThe source.

operator=(const CLiwIterable *)

TLiwVariant &operator=(const CLiwIterable *aValue)[inline]

Assignment operator for the variant.

Parameters

const CLiwIterable * aValueThe source.

operator=(TReal)

TLiwVariant &operator=(TRealaValue)[inline]

Assignment operator for the variant.

Parameters

TReal aValueThe source object.

operator=(const CLiwBuffer *)

TLiwVariant &operator=(const CLiwBuffer *aValue)[inline]

Assignment operator for the variant.

Parameters

const CLiwBuffer * aValueThe source object.

Member Data Documentation

UData iData

UData iData[private]

TPtrC iPtrC

TPtrC iPtrC[private]

TPtrC8 iPtrC8

TPtrC8 iPtrC8[private]

TUint8 iTypeId

TUint8 iTypeId[private]