Symbian3/SDK/Source/GUID-C1BCBA03-4E64-5188-8D33-25B4121C1582.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 7 51a74ef9ed63
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-C1BCBA03-4E64-5188-8D33-25B4121C1582" xml:lang="en"><title>Use
of the Internalize class</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>The implementation of the family of operators <xref href="GUID-81749C6F-A341-37A6-9F17-C6028F975764.dita"><apiname>operator&gt;&gt;()</apiname></xref> calls
the internal Symbian platform function <codeph>DoInternalizeL()</codeph>.
There are two variants of this function distinguished by the value of the
third parameter as either <xref href="GUID-0A518426-B517-33C3-B2E3-874CAF36E963.dita#GUID-0A518426-B517-33C3-B2E3-874CAF36E963/GUID-1B393431-A301-3B49-858A-8915017E8CC9"><apiname>Internalize::Member</apiname></xref> or <xref href="GUID-0A518426-B517-33C3-B2E3-874CAF36E963.dita#GUID-0A518426-B517-33C3-B2E3-874CAF36E963/GUID-0F3DF32C-128B-36A0-A4F7-8B7574CE4621"><apiname>Internalize::Function</apiname></xref>.</p>
<p>The family of operators <xref href="GUID-81749C6F-A341-37A6-9F17-C6028F975764.dita"><apiname>operator&gt;&gt;()</apiname></xref> are implemented
as follows:</p>
<codeblock id="GUID-5DCCDC49-ADD3-59F1-9243-BA91C521DFFD" xml:space="preserve">template &lt;class T&gt;
inline RWriteStream&amp; operator&gt;&gt;(RReadStream&amp; aStream,T&amp; anObject)
    {
    DoInternalizeL(anObject,aStream,Internalization(&amp;anObject));
    return aStream;
    }</codeblock>
<p>The two variants of <codeph>DoInternalizeL()</codeph> are defined and implemented
as:</p>
<codeblock id="GUID-0BFB5C93-B2E4-5050-936A-465A077728FB" xml:space="preserve">template &lt;class T&gt;
inline void DoInternalizeL(T&amp; anObject,RReadStream&amp; aStream,Internalize::Member)
    {anObject.InternalizeL(aStream);}</codeblock>
<codeblock id="GUID-916AE079-80BB-5039-8F96-771F81CC1077" xml:space="preserve">template &lt;class T&gt;
inline void DoInternalizeL(T&amp; anObject,RReadStream&amp; aStream,Internalize::Function)
    {InternalizeL(anObject,aStream);}</codeblock>
<p>The variant called depends on the value returned from a call to the internal
selector function, <codeph>Internalization()</codeph>. This selector function
returns either <codeph>Internalize::Function</codeph> or <codeph>Internalize::Member</codeph>,
depending on the type of <codeph>anObject</codeph>.</p>
<p>The internal selector function <codeph>Internalization()</codeph> is a
convenience mechanism that allows the <xref href="GUID-81749C6F-A341-37A6-9F17-C6028F975764.dita"><apiname>operator&gt;&gt;()</apiname></xref> to call
either the <codeph>InternalizeL()</codeph> member function of a templated
class or an <codeph>InternalizeL()</codeph> templated global function.</p>
<p>The store framework defines and implements a default selector function,
prototyped as:</p>
<codeblock id="GUID-28AEEF03-52AC-522B-BFEF-730031BCCFC2" xml:space="preserve">Internalize::Member Internalization(const TAny*)</codeblock>
<p>By default, a call to <codeph>Internalization()</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-0A518426-B517-33C3-B2E3-874CAF36E963.dita#GUID-0A518426-B517-33C3-B2E3-874CAF36E963/GUID-1B393431-A301-3B49-858A-8915017E8CC9"><apiname>Internalize::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-81749C6F-A341-37A6-9F17-C6028F975764.dita"><apiname>operator&gt;&gt;()</apiname></xref> for
descriptors, the framework defines and implements:</p>
<codeblock id="GUID-442D9DD2-6643-5F3F-ACD4-3D4D42B65639" xml:space="preserve">Internalize::Function Internalization(const TDesC8*)</codeblock>
</conbody></concept>