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 TPtrC8 AsData ()
IMPORT_C TPtrC AsDes ()
IMPORT_C RFile AsFileHandle ()
IMPORT_C MLiwInterface * AsInterface ()
IMPORT_C CLiwIterable * AsIterable ()
IMPORT_C const CLiwList * AsList ()
IMPORT_C const CLiwMap * AsMap ()
IMPORT_C TBool AsTBool ()
IMPORT_C TInt32 AsTInt32 ()
IMPORT_C TInt64 AsTInt64 ()
IMPORT_C TReal AsTReal ()
IMPORT_C TTime AsTTime ()
IMPORT_C TUid AsTUid ()
IMPORT_C TBool AsTUint ()
IMPORT_C TBool Get ( TInt32 &)
IMPORT_C TBool Get ( TInt64 &)
IMPORT_C TBool Get ( TUid &)
IMPORT_C TBool Get ( TUint &)
IMPORT_C TBool Get ( TBool &)
IMPORT_C TBool Get ( TPtrC &)
IMPORT_C TBool Get ( TTime &)
IMPORT_C TBool Get ( TPtrC8 &)
IMPORT_C TBool Get ( RFile &)
IMPORT_C TBool Get ( CLiwList &)
IMPORT_C TBool Get ( CLiwMap &)
IMPORT_C TBool Get ( TDes &)
IMPORT_C TBool Get ( TDes8 &)
IMPORT_C TBool Get ( TReal &)
TBool IsEmpty ()
IMPORT_C void PushL ()
IMPORT_C void Reset ()
IMPORT_C void Set ( TInt32 )
IMPORT_C void Set ( TInt64 )
IMPORT_C void Set ( TBool )
IMPORT_C void Set ( TUint )
IMPORT_C void Set (const TUid &)
IMPORT_C void Set (const TTime &)
IMPORT_C void Set (const TDesC &)
void Set (const HBufC *)
IMPORT_C void Set (const TDesC8 &)
IMPORT_C void Set (const RFile &)
IMPORT_C void Set (const CLiwList *)
IMPORT_C void Set (const CLiwMap *)
IMPORT_C void Set (const MLiwInterface *)
IMPORT_C void Set (const CLiwIterable *)
IMPORT_C void Set ( TReal )
IMPORT_C void Set (const CLiwBuffer *)
IMPORT_C void SetL (const TLiwVariant &)
LIW::TVariantTypeId TypeId ()
IMPORT_C void VariantCleanup ( 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
void CleanupDestroy ( TAny *)
void Destroy ()
void ExternalizeL ( RWriteStream &)
void InternalizeL ( 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 ( TInt32 aValue ) [inline]

Constructor from a value.

Parameters

TInt32 aValue The value to set for this variant object.

TLiwVariant(TInt64)

TLiwVariant ( TInt64 aValue ) [inline]

Constructor from a value.

Parameters

TInt64 aValue The value to set for this variant object.

TLiwVariant(TUint)

TLiwVariant ( TUint aValue ) [inline]

Constructor from a value.

Parameters

TUint aValue The value to set for this variant object.

TLiwVariant(TBool)

TLiwVariant ( TBool aValue ) [inline]

Constructor from a value.

Parameters

TBool aValue The value to set for this variant object.

TLiwVariant(const TUid &)

TLiwVariant ( const TUid & aValue ) [inline]

Constructor from a value.

Parameters

const TUid & aValue The value to set for this variant object.

TLiwVariant(const TTime &)

TLiwVariant ( const TTime & aValue ) [inline]

Constructor from a value.

Parameters

const TTime & aValue The value to set for this variant object.

TLiwVariant(const TDesC &)

TLiwVariant ( const TDesC & aValue ) [inline]

Constructor from a value.

Parameters

const TDesC & aValue The value to set for this variant object.

TLiwVariant(const HBufC *)

TLiwVariant ( const HBufC * aValue ) [inline]

Constructor from a value.

Parameters

const HBufC * aValue The value to set for this variant object.

TLiwVariant(const TDesC8 &)

TLiwVariant ( const TDesC8 & aValue ) [inline]

Constructor from a value.

Parameters

const TDesC8 & aValue The value to set for this variant object.

TLiwVariant(const RFile &)

TLiwVariant ( const RFile & aValue ) [inline]

Constructor from a value.

Parameters

const RFile & aValue The value to set for this variant object.

TLiwVariant(const CLiwList *)

TLiwVariant ( const CLiwList * aValue ) [inline]

Constructor from a value.

Parameters

const CLiwList * aValue The value to set for this variant object.

TLiwVariant(const CLiwMap *)

TLiwVariant ( const CLiwMap * aValue ) [inline]

Constructor from a value.

Parameters

const CLiwMap * aValue The value to set for this variant object.

TLiwVariant(const MLiwInterface *)

TLiwVariant ( const MLiwInterface * aValue ) [inline]

Constructor from a value.

Parameters

const MLiwInterface * aValue The value to set for this variant object.

TLiwVariant(const CLiwIterable *)

TLiwVariant ( const CLiwIterable * aValue ) [inline]

Constructor from a value.

Parameters

const CLiwIterable * aValue The value to set for this variant object.

TLiwVariant(TReal)

TLiwVariant ( TReal aValue ) [inline]

Constructor from a value.

Parameters

TReal aValue The value to set for this variant object.

TLiwVariant(const CLiwBuffer *)

TLiwVariant ( const CLiwBuffer * aValue ) [inline]

Constructor from a value.

Parameters

const CLiwBuffer * aValue The value to set for this variant object.

TLiwVariant(const TLiwVariant &)

IMPORT_C TLiwVariant ( const TLiwVariant & aSrc )

Copy constructor. Does not take ownership of data.

Parameters

const TLiwVariant & aSrc The source object.

Member Functions Documentation

AsBuffer()

IMPORT_C CLiwBuffer * AsBuffer ( ) const

Returns the value held by this variant.

AsData()

IMPORT_C TPtrC8 AsData ( ) const

Returns the value held by this variant.

AsDes()

IMPORT_C TPtrC AsDes ( ) const

Returns the value held by this variant.

AsFileHandle()

IMPORT_C RFile AsFileHandle ( ) 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 TBool AsTBool ( ) const

Returns the value held by this variant.

AsTInt32()

IMPORT_C TInt32 AsTInt32 ( ) const

Returns the value held by this variant.

AsTInt64()

IMPORT_C TInt64 AsTInt64 ( ) const

Returns the value held by this variant.

AsTReal()

IMPORT_C TReal AsTReal ( ) const

Returns the value held by this variant.

AsTTime()

IMPORT_C TTime AsTTime ( ) const

Returns the value held by this variant.

AsTUid()

IMPORT_C TUid AsTUid ( ) const

Returns the value held by this variant.

AsTUint()

IMPORT_C TBool AsTUint ( ) const

Returns the value held by this variant.

CleanupDestroy(TAny *)

void CleanupDestroy ( TAny * aObj ) [private, static]

Parameters

TAny * aObj

Destroy()

void Destroy ( ) [private]

Destroys any dynamic resource owned by this variant.

ExternalizeL(RWriteStream &)

void ExternalizeL ( RWriteStream & aStream ) const [private]

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

Parameters

RWriteStream & aStream

Get(TInt32 &)

IMPORT_C TBool Get ( TInt32 & aValue ) const

Retrieves the value held by this variant.

Parameters

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

Get(TInt64 &)

IMPORT_C TBool Get ( TInt64 & aValue ) const

Retrieves the value held by this variant.

Parameters

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

Get(TUid &)

IMPORT_C TBool Get ( TUid & aValue ) const

Retrieves the value held by this variant.

Parameters

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

Get(TUint &)

IMPORT_C TBool Get ( TUint & aValue ) const

Retrieves the boolean value held by this variant.

Parameters

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

Get(TBool &)

IMPORT_C TBool Get ( TBool & aValue ) const

Retrieves the boolean value held by this variant.

Parameters

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

Get(TPtrC &)

IMPORT_C TBool Get ( TPtrC & aValue ) const

Retrieves the value held by this variant.

Parameters

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

Get(TTime &)

IMPORT_C TBool Get ( TTime & aValue ) const

Retrieves the value held by this variant.

Parameters

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

Get(TPtrC8 &)

IMPORT_C TBool Get ( TPtrC8 & aValue ) const

Retrieves the value held by this variant.

Parameters

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

Get(RFile &)

IMPORT_C TBool Get ( RFile & aValue ) const

Retrieves the value held by this variant.

Parameters

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

Get(CLiwList &)

IMPORT_C TBool Get ( CLiwList & aValue ) const

Retrieves the value held by this variant.

Parameters

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

Get(CLiwMap &)

IMPORT_C TBool Get ( CLiwMap & aValue ) const

Retrieves the value held by this variant.

Parameters

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

Get(TDes &)

IMPORT_C TBool Get ( TDes & aValue ) const

Retrieves the value held by this variant.

Parameters

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

Get(TDes8 &)

IMPORT_C TBool Get ( TDes8 & aValue ) const

Sets the value held by this variant.

Parameters

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

Get(TReal &)

IMPORT_C TBool Get ( TReal & aValue ) const

Retrieves the value held by this variant.

Parameters

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

InternalizeL(RReadStream &)

void InternalizeL ( 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 void PushL ( )

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 void Reset ( )

Deletes possibly set value and resets this variant to empty.

Post-condition
IsEmpty()

Set(TInt32)

IMPORT_C void Set ( TInt32 aValue )

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

Post-condition
*this == aValue

Parameters

TInt32 aValue Value for this variant object to hold.

Set(TInt64)

IMPORT_C void Set ( TInt64 aValue )

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

Post-condition
*this == aValue

Parameters

TInt64 aValue Value for this variant object to hold.

Set(TBool)

IMPORT_C void Set ( TBool aValue )

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

Post-condition
*this == aValue

Parameters

TBool aValue Value for this variant object to hold.

Set(TUint)

IMPORT_C void Set ( TUint aValue )

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

Post-condition
*this == aValue

Parameters

TUint aValue Value for this variant object to hold.

Set(const TUid &)

IMPORT_C void Set ( const TUid & aValue )

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

Post-condition
*this == aValue

Parameters

const TUid & aValue Value for this variant object to hold.

Set(const TTime &)

IMPORT_C void Set ( const TTime & aValue )

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

Post-condition
*this == aValue

Parameters

const TTime & aValue Value for this variant object to hold.

Set(const TDesC &)

IMPORT_C void Set ( const TDesC & aValue )

Sets constant text reference to this variant.

Post-condition
*this == aValue

Parameters

const TDesC & aValue Text value for this variant object to hold.

Set(const HBufC *)

void Set ( const HBufC * aValue ) [inline]

Sets constant text reference to this variant.

Parameters

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

Set(const TDesC8 &)

IMPORT_C void Set ( const TDesC8 & aValue )

Sets constant 8-bit text reference to this variant.

Post-condition
*this == aValue

Parameters

const TDesC8 & aValue Text value for this variant object to hold.

Set(const RFile &)

IMPORT_C void Set ( const RFile & aValue )

Sets RFile file handle to this variant.

Post-condition
*this == aValue

Parameters

const RFile & aValue File handle for this variant object to hold.

Set(const CLiwList *)

IMPORT_C void Set ( const CLiwList * aValue )

Sets list of variants to this variant.

Parameters

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

Set(const CLiwMap *)

IMPORT_C void Set ( const CLiwMap * aValue )

Sets map of variants to this variant.

Parameters

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

Set(const MLiwInterface *)

IMPORT_C void Set ( const MLiwInterface * aValue )

Sets interface pointer to this variant.

Parameters

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

Set(const CLiwIterable *)

IMPORT_C void Set ( const CLiwIterable * aValue )

Sets list of variants to this variant.

Parameters

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

Set(TReal)

IMPORT_C void Set ( TReal aValue )

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

Post-condition
*this == aValue

Parameters

TReal aValue Value for this variant object to hold.

Set(const CLiwBuffer *)

IMPORT_C void Set ( const CLiwBuffer * aValue )

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

Post-condition
*this == aValue

Parameters

const CLiwBuffer * aValue Value for this variant object to hold.

SetL(const TLiwVariant &)

IMPORT_C void SetL ( 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 & aValue variant 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 void VariantCleanup ( 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 & aValue The source object.

operator=(const TTime &)

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

Assignment operator for the variant.

Parameters

const TTime & aValue The source object.

operator=(const TUid &)

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

Assignment operator for the variant.

Parameters

const TUid & aValue The source object.

operator=(TInt32)

TLiwVariant & operator= ( TInt32 aValue ) [inline]

Assignment operator for the variant.

Parameters

TInt32 aValue The source object.

operator=(TInt64)

TLiwVariant & operator= ( TInt64 aValue ) [inline]

Assignment operator for the variant.

Parameters

TInt64 aValue The source object.

operator=(TBool)

TLiwVariant & operator= ( TBool aValue ) [inline]

Assignment operator for the variant.

Parameters

TBool aValue The source object.

operator=(TUint)

TLiwVariant & operator= ( TUint aValue ) [inline]

Assignment operator for the variant.

Parameters

TUint aValue The source object.

operator=(const TDesC &)

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

Assignment operator for the variant.

Parameters

const TDesC & aValue The source object.

operator=(const HBufC *)

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

Assignment operator for the variant.

Parameters

const HBufC * aValue The source object.

operator=(const TDesC8 &)

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

Assignment operator for the variant.

Parameters

const TDesC8 & aValue The source object.

operator=(const RFile &)

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

Assignment operator for the variant.

Parameters

const RFile & aValue The source object.

operator=(const CLiwList *)

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

Assignment operator for the variant.

Parameters

const CLiwList * aValue The source.

operator=(const CLiwMap *)

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

Assignment operator for the variant.

Parameters

const CLiwMap * aValue The source.

operator=(const MLiwInterface *)

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

Assignment operator for the variant.

Parameters

const MLiwInterface * aValue The source.

operator=(const CLiwIterable *)

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

Assignment operator for the variant.

Parameters

const CLiwIterable * aValue The source.

operator=(TReal)

TLiwVariant & operator= ( TReal aValue ) [inline]

Assignment operator for the variant.

Parameters

TReal aValue The source object.

operator=(const CLiwBuffer *)

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

Assignment operator for the variant.

Parameters

const CLiwBuffer * aValue The 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]