Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: s32std.h
Link against: estor.lib

Class TSwizzle

TSwizzle<class T>

Support

Supported from 5.0

Description

Maintains a dual representation for an object. The representation is:

The template class defines the type of object for which the swizzle is a representation. Full access to the represented object is available through the swizzle.

Maintaining a dual representation for an object allows the loading of objects into memory from a store to be deferred; this is particularly important in complex applications.

Derivation

TSwizzleMaintains a dual representation for an object
TSwizzleBaseImplementation class for swizzles
TSwizzleCBaseBase class for swizzles

Defined in TSwizzle:
AsPtr(), ExternalizeL(), TSwizzle(), operator T*(), operator*(), operator->(), operator=()

Inherited from TSwizzleCBase:
AsId(), InternalizeL(), IsId(), IsPtr(), operator!=(), operator==()


Construction and destruction


TSwizzle()

TSwizzle();

Description

Constructs an uninitialised swizzle. It is necessary because there are also non-default constructors in this class.


TSwizzle()

TSwizzle(T* aPtr);

Description

Constructs a swizzle for a class T type object, represented by a pointer.

Parameters

T* aPtr

A pointer to a class T type object.


TSwizzle()

TSwizzle(TStreamId anId);

Description

Constructs a swizzle for a class T type object, represented as a stream id.

Parameters

TStreamId anId

The id of a stream containing the external representation of a class T type object.

[Top]


Stream persistence


ExternalizeL()

void ExternalizeL(RWriteStream& aStream) const;

Description

Externalises the stream id of the stream associated with this swizzle.

This function presupposes that:

The presence of this function means that the standard templated operator<<() can be used.

Parameters

RWriteStream& aStream

Stream to which the stream id should be externalised.

See also:

[Top]


Get pointer to represented object


AsPtr()

T* AsPtr() const;

Description

Returns a pointer to the object which this swizzle represents.

Note that the indirect component selector operator->() can be used to access members of the represented object.

Return value

T*

A pointer to the class T type object represented by this swizzle.

[Top]


Operators


operator T*()

operator T*() const;

Description

Converts the swizzle to a T* type.

Typically, the compiler inserts a call to this operator when a TSwizzle<class T> type is passed as a parameter to a function or operation which requires a pointer as a formal argument type.

See also:


operator*()

T& operator*() const;

Description

Returns a reference to the type T object which this swizzle represents.

Return value

T&

A reference to the type T object represented by this swizzle.

See also:


operator->()

T* operator->() const;

Description

Gives access to members of the type T object which this swizzle represents.

Note, use the AsPtr() member function to return a pointer to the object itself.

Return value

T*

A pointer to the T type object; not explicitly accessible.

See also:


operator=()

TSwizzle<T>& operator=(T* aPtr);

Description

Sets this swizzle to represent the in-memory type T object, pointed to by the specified T* pointer.

Parameters

T* aPtr

A pointer to an object of type T which the swizzle is to represent.

Return value

TSwizzle<T>&

A reference to this swizzle representing the object of type T.