Symbian3/SDK/Source/GUID-C1BCBA03-4E64-5188-8D33-25B4121C1582.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?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 xml:lang="en" id="GUID-C1BCBA03-4E64-5188-8D33-25B4121C1582"><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 OS 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>