Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Use of the Externalize class

The implementation of the family of operators operator<<() calls the internal Symbian OS function DoExternalizeL(). There are two variants of this function distinguished by the value of the third parameter as either Externalize::Member or Externalize::Function.

The family of operators operator<<() are implemented as follows:

template <class T>
inline RWriteStream& operator<<(RWriteStream& aStream,const T& anObject)
    {
    DoExternalizeL(anObject,aStream,Externalization(&anObject));
    return aStream;
    }

The two variants of DoExternalizeL() are defined and implemented as:

template <class T>
inline void DoExternalizeL(const T& anObject,RWriteStream& aStream,Externalize::Member)
    {anObject.ExternalizeL(aStream);}

template <class T>
inline void DoExternalizeL(const T& anObject,RWriteStream& aStream,Externalize::Function)
    {ExternalizeL(anObject,aStream);}

The variant called depends on the value returned from a call to the internal selector function, Externalization(). This selector function returns either Externalize::Function or Externalize::Member, depending on the type of anObject.

The internal selector function Externalization() is a convenience mechanism that allows the operator<<() to call either the ExternalizeL() member function of a templated class or an ExternalizeL() templated global function.

The store framework defines and implements a default selector function, prototyped as:

Externalize::Member Externalization(const TAny*)

By default, a call to Externalization() passing a parameter of general class type, is resolved at compile time into a call to this variant, and the return type is Externalize::Member. The store framework also defines and implements a number of other variants that take more specific argument types; for example, as part of its implementation of operator<<() for descriptors, the framework defines and implements:

Externalize::Function Externalization(const TDesC8*)