TLiwVariant Class Reference
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.
Nested Classes and Structures
Constructor & Destructor Documentation
TLiwVariant()
Default constructor. Initializes this variant to be empty.
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 *)
Constructor from a value.
Parameters
|
const
MLiwInterface
* aValue
|
The value to set for this variant object.
|
TLiwVariant(const CLiwIterable *)
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 &)
Copy constructor. Does not take ownership of data.
Member Functions Documentation
AsBuffer()
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()
Returns the value held by this variant.
AsIterable()
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]
|
Destroy()
|
void
|
Destroy
|
(
|
)
|
[private]
|
Destroys any dynamic resource owned by this variant.
ExternalizeL(RWriteStream &)
|
void
|
ExternalizeL
|
(
|
RWriteStream
&
|
aStream
|
)
|
const [private]
|
Get(TInt32 &)
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 &)
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 &)
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 &)
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 &)
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 &)
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 &)
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 &)
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 &)
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 &)
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 &)
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 &)
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 &)
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 &)
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 &)
Streaming support for
TLiwGenericParam
. Internalizes this variant from a stream.
IsEmpty()
|
TBool
|
IsEmpty
|
(
|
)
|
const [inline]
|
Returns ETrue if this variant is empty (it does not hold any value).
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()
Deletes possibly set value and resets this variant to empty.
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 *)
Sets interface pointer to this variant.
Parameters
|
const
MLiwInterface
* aValue
|
Interface pointer for this variant object to hold. *this == aValue
|
Set(const CLiwIterable *)
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 *)
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 &)
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
__DbgTestInvariant()
|
void
|
__DbgTestInvariant
|
(
|
)
|
const [private]
|
operator TCleanupItem()
|
operator TCleanupItem
|
(
|
)
|
[private]
|
operator=(const TLiwVariant &)
Assignment operator. Does not take ownership of data.
operator=(const TTime &)
Assignment operator for the variant.
Parameters
|
const
TTime
& aValue
|
The source object.
|
operator=(const TUid &)
Assignment operator for the variant.
Parameters
|
const
TUid
& aValue
|
The source object.
|
operator=(TInt32)
Assignment operator for the variant.
Parameters
|
TInt32
aValue
|
The source object.
|
operator=(TInt64)
Assignment operator for the variant.
Parameters
|
TInt64
aValue
|
The source object.
|
operator=(TBool)
Assignment operator for the variant.
Parameters
|
TBool
aValue
|
The source object.
|
operator=(TUint)
Assignment operator for the variant.
Parameters
|
TUint
aValue
|
The source object.
|
operator=(const TDesC &)
Assignment operator for the variant.
Parameters
|
const
TDesC
& aValue
|
The source object.
|
operator=(const HBufC *)
Assignment operator for the variant.
Parameters
|
const
HBufC
* aValue
|
The source object.
|
operator=(const TDesC8 &)
Assignment operator for the variant.
Parameters
|
const
TDesC8
& aValue
|
The source object.
|
operator=(const RFile &)
Assignment operator for the variant.
Parameters
|
const
RFile
& aValue
|
The source object.
|
operator=(const CLiwList *)
Assignment operator for the variant.
operator=(const CLiwMap *)
Assignment operator for the variant.
operator=(const MLiwInterface *)
Assignment operator for the variant.
operator=(const CLiwIterable *)
Assignment operator for the variant.
operator=(TReal)
Assignment operator for the variant.
Parameters
|
TReal
aValue
|
The source object.
|
operator=(const CLiwBuffer *)
Assignment operator for the variant.
Member Data Documentation
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.