7 Nokia Corporation - initial contribution. |
7 Nokia Corporation - initial contribution. |
8 Contributors: |
8 Contributors: |
9 --> |
9 --> |
10 <!DOCTYPE concept |
10 <!DOCTYPE concept |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
12 <concept xml:lang="en" id="GUID-EB6A14CF-05DA-5EAD-AB68-F6511907DF05"><title>Use of the Externalize class</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>The implementation of the family of operators <xref href="GUID-50F3A8F9-DA0A-3377-A75C-282F1E920E2D.dita"><apiname>operator<<()</apiname></xref> calls the internal Symbian OS function <codeph>DoExternalizeL()</codeph>. There are two variants of this function distinguished by the value of the third parameter as either <xref href="GUID-43ED0606-199C-3C1A-B7E1-5EDB1DED469B.dita#GUID-43ED0606-199C-3C1A-B7E1-5EDB1DED469B/GUID-9D890F4B-3F84-3261-8C4C-275031651229"><apiname>Externalize::Member</apiname></xref> or <xref href="GUID-43ED0606-199C-3C1A-B7E1-5EDB1DED469B.dita#GUID-43ED0606-199C-3C1A-B7E1-5EDB1DED469B/GUID-886A0861-06AA-3346-B458-C97F332DDD21"><apiname>Externalize::Function</apiname></xref>.</p> <p>The family of operators <xref href="GUID-50F3A8F9-DA0A-3377-A75C-282F1E920E2D.dita"><apiname>operator<<()</apiname></xref> are implemented as follows:</p> <codeblock id="GUID-472120FA-4058-5316-96D4-9A594D39A359" xml:space="preserve">template <class T> |
12 <concept id="GUID-EB6A14CF-05DA-5EAD-AB68-F6511907DF05" xml:lang="en"><title>Use |
|
13 of the Externalize class</title><shortdesc>Describes how to use the Externalize class.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>The implementation of the family of operators <xref href="GUID-50F3A8F9-DA0A-3377-A75C-282F1E920E2D.dita"><apiname>operator<<()</apiname></xref> calls |
|
15 the internal Symbian platform function <codeph>DoExternalizeL()</codeph>. |
|
16 There are two variants of this function distinguished by the value of the |
|
17 third parameter as either <xref href="GUID-43ED0606-199C-3C1A-B7E1-5EDB1DED469B.dita#GUID-43ED0606-199C-3C1A-B7E1-5EDB1DED469B/GUID-9D890F4B-3F84-3261-8C4C-275031651229"><apiname>Externalize::Member</apiname></xref> or <xref href="GUID-43ED0606-199C-3C1A-B7E1-5EDB1DED469B.dita#GUID-43ED0606-199C-3C1A-B7E1-5EDB1DED469B/GUID-886A0861-06AA-3346-B458-C97F332DDD21"><apiname>Externalize::Function</apiname></xref>.</p> |
|
18 <p>The family of operators <xref href="GUID-50F3A8F9-DA0A-3377-A75C-282F1E920E2D.dita"><apiname>operator<<()</apiname></xref> are implemented |
|
19 as follows:</p> |
|
20 <codeblock id="GUID-472120FA-4058-5316-96D4-9A594D39A359" xml:space="preserve">template <class T> |
13 inline RWriteStream& operator<<(RWriteStream& aStream,const T& anObject) |
21 inline RWriteStream& operator<<(RWriteStream& aStream,const T& anObject) |
14 { |
22 { |
15 DoExternalizeL(anObject,aStream,Externalization(&anObject)); |
23 DoExternalizeL(anObject,aStream,Externalization(&anObject)); |
16 return aStream; |
24 return aStream; |
17 }</codeblock> <p>The two variants of <codeph>DoExternalizeL()</codeph> are defined and implemented as:</p> <codeblock id="GUID-7FE54FB6-BDE8-5BD2-85BD-802BFB7430A8" xml:space="preserve">template <class T> |
25 }</codeblock> |
|
26 <p>The two variants of <codeph>DoExternalizeL()</codeph> are defined and implemented |
|
27 as:</p> |
|
28 <codeblock id="GUID-7FE54FB6-BDE8-5BD2-85BD-802BFB7430A8" xml:space="preserve">template <class T> |
18 inline void DoExternalizeL(const T& anObject,RWriteStream& aStream,Externalize::Member) |
29 inline void DoExternalizeL(const T& anObject,RWriteStream& aStream,Externalize::Member) |
19 {anObject.ExternalizeL(aStream);}</codeblock> <codeblock id="GUID-FDD7942E-EBAD-5AF0-A731-FF210B44E91B" xml:space="preserve">template <class T> |
30 {anObject.ExternalizeL(aStream);}</codeblock> |
|
31 <codeblock id="GUID-FDD7942E-EBAD-5AF0-A731-FF210B44E91B" xml:space="preserve">template <class T> |
20 inline void DoExternalizeL(const T& anObject,RWriteStream& aStream,Externalize::Function) |
32 inline void DoExternalizeL(const T& anObject,RWriteStream& aStream,Externalize::Function) |
21 {ExternalizeL(anObject,aStream);}</codeblock> <p>The variant called depends on the value returned from a call to the internal selector function, <codeph>Externalization()</codeph>. This selector function returns either <codeph>Externalize::Function</codeph> or <codeph>Externalize::Member</codeph>, depending on the type of <codeph>anObject</codeph>.</p> <p>The internal selector function <codeph>Externalization()</codeph> is a convenience mechanism that allows the <xref href="GUID-50F3A8F9-DA0A-3377-A75C-282F1E920E2D.dita"><apiname>operator<<()</apiname></xref> to call either the <codeph>ExternalizeL()</codeph> member function of a templated class or an <codeph>ExternalizeL()</codeph> templated global function.</p> <p>The store framework defines and implements a default selector function, prototyped as:</p> <codeblock id="GUID-E233C9ED-7ABC-554C-BB83-D6A00F4BE485" xml:space="preserve">Externalize::Member Externalization(const TAny*)</codeblock> <p>By default, a call to <codeph>Externalization()</codeph> passing a parameter of general class type, is resolved at compile time into a call to this variant, and the return type is <xref href="GUID-43ED0606-199C-3C1A-B7E1-5EDB1DED469B.dita#GUID-43ED0606-199C-3C1A-B7E1-5EDB1DED469B/GUID-9D890F4B-3F84-3261-8C4C-275031651229"><apiname>Externalize::Member</apiname></xref>. 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 <xref href="GUID-50F3A8F9-DA0A-3377-A75C-282F1E920E2D.dita"><apiname>operator<<()</apiname></xref> for descriptors, the framework defines and implements:</p> <codeblock id="GUID-BE0D631B-7CC6-5D9D-A49C-A18B209295C6" xml:space="preserve">Externalize::Function Externalization(const TDesC8*)</codeblock> </conbody></concept> |
33 {ExternalizeL(anObject,aStream);}</codeblock> |
|
34 <p>The variant called depends on the value returned from a call to the internal |
|
35 selector function, <codeph>Externalization()</codeph>. This selector function |
|
36 returns either <codeph>Externalize::Function</codeph> or <codeph>Externalize::Member</codeph>, |
|
37 depending on the type of <codeph>anObject</codeph>.</p> |
|
38 <p>The internal selector function <codeph>Externalization()</codeph> is a |
|
39 convenience mechanism that allows the <xref href="GUID-50F3A8F9-DA0A-3377-A75C-282F1E920E2D.dita"><apiname>operator<<()</apiname></xref> to |
|
40 call either the <codeph>ExternalizeL()</codeph> member function of a templated |
|
41 class or an <codeph>ExternalizeL()</codeph> templated global function.</p> |
|
42 <p>The store framework defines and implements a default selector function, |
|
43 prototyped as:</p> |
|
44 <codeblock id="GUID-E233C9ED-7ABC-554C-BB83-D6A00F4BE485" xml:space="preserve">Externalize::Member Externalization(const TAny*)</codeblock> |
|
45 <p>By default, a call to <codeph>Externalization()</codeph> passing a parameter |
|
46 of general class type, is resolved at compile time into a call to this variant, |
|
47 and the return type is <xref href="GUID-43ED0606-199C-3C1A-B7E1-5EDB1DED469B.dita#GUID-43ED0606-199C-3C1A-B7E1-5EDB1DED469B/GUID-9D890F4B-3F84-3261-8C4C-275031651229"><apiname>Externalize::Member</apiname></xref>. The store framework |
|
48 also defines and implements a number of other variants that take more specific |
|
49 argument types; for example, as part of its implementation of <xref href="GUID-50F3A8F9-DA0A-3377-A75C-282F1E920E2D.dita"><apiname>operator<<()</apiname></xref> for |
|
50 descriptors, the framework defines and implements:</p> |
|
51 <codeblock id="GUID-BE0D631B-7CC6-5D9D-A49C-A18B209295C6" xml:space="preserve">Externalize::Function Externalization(const TDesC8*)</codeblock> |
|
52 </conbody></concept> |