Symbian3/SDK/Source/GUID-8A2029C7-1258-5B12-B217-DE3EE4340B72.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
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 xml:lang="en" id="GUID-8A2029C7-1258-5B12-B217-DE3EE4340B72"><title>How to externalise and internalise</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>For a class TX defined as:</p> <codeblock id="GUID-8F730CDE-638B-5D07-B5A8-864DEE4BCB7E" xml:space="preserve">class TX
      {
public:
      ...
      void ExternalizeL(RWriteStream&amp; aStream) const;
      void InternalizeL(RReadStream&amp; aStream);
      ...
      };</codeblock> <p>an instance of <codeph>TX</codeph> can be externalised to the stream <codeph>outstream</codeph>, by calling the <codeph>ExternalizeL()</codeph> member function of <codeph>TX</codeph>:</p> <codeblock id="GUID-81A69F24-8A0E-5473-89A4-899DD96DDD65" xml:space="preserve">    ...
    TX object;
    ...
    object.ExternalizeL(outstream);
    ...</codeblock> <p>An alternative, and better way, is to use the templated stream <codeph>operator&lt;&lt;</codeph>. The Store framework implements this by calling <codeph>TX::ExternalizeL()</codeph>. The syntax is simply:</p> <codeblock id="GUID-8ABF4FD0-9F1E-5AB9-8D88-6A9EC3700C19" xml:space="preserve">    ...
    outstream &lt;&lt; object; // externalise object
    ...</codeblock> <p>Similarly, the <codeph>TX</codeph> object can be internalised from the stream <codeph>instream</codeph>, by calling the <codeph>InternalizeL()</codeph> member function of <codeph>TX</codeph>:</p> <codeblock id="GUID-6F2EE0E7-A9F2-5F87-AD16-AA6821C36313" xml:space="preserve">    TX object;
       ...
    object.InternalizeL(instream);
    ...</codeblock> <p>The templated stream <codeph>operator&gt;&gt;</codeph> can also be used. The Store framework implements this by calling <codeph>TX::InternalizeL()</codeph>. The syntax is simply:</p> <codeblock id="GUID-A4B294A0-0311-5D38-805D-76CD6939D85E" xml:space="preserve">instream &gt;&gt; object; // internalise object</codeblock> </conbody></concept>