Symbian3/SDK/Source/GUID-7CE86E8C-0187-5679-B87D-71ABDE479048.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-7CE86E8C-0187-5679-B87D-71ABDE479048"><title>Externalising and internalising descriptors</title><prolog><metadata><keywords/></metadata></prolog><conbody><section><title>Externalising</title> <p>Descriptors can be externalised in one of two ways:</p> <ul><li id="GUID-184B3A20-23C7-5F6C-80B0-B8902CC56DE8"><p>using the <codeph>WriteL()</codeph> member functions of the <codeph>RWriteStream</codeph> class.</p> </li> <li id="GUID-8593FABC-5C26-5155-8181-A9614126D678"><p>using the templated stream <codeph>operator&lt;&lt;</codeph> </p> </li> </ul> <p>The <codeph>WriteL()</codeph> member functions of <codeph>RWriteStream</codeph> write only the <i>content</i> of a descriptor to the stream; they do not write any length information.</p> <p>The <codeph>operator&lt;&lt;</codeph> is implemented by the Store framework to write <i>both</i> the length of the descriptor content and the content itself to the stream.</p> <p>Use of the <codeph>operator&lt;&lt;</codeph> is preferred because descriptors can then be internalised using either the corresponding <codeph>operator&gt;&gt;</codeph> or the variants of <codeph>HBufC::NewL()</codeph> or <codeph>HBufC::NewLC()</codeph> that take a read stream.</p> </section> <section><title>Internalising</title> <p>Descriptors can be internalised in one of three ways:</p> <ul><li id="GUID-62935D77-6E8A-572C-AD28-94F1287DBD59"><p>using the <codeph>ReadL()</codeph> member functions of the <codeph>RReadStream</codeph> class.</p> </li> <li id="GUID-4B78612E-1338-5205-95BC-757EB0CD0C00"><p>using the templated stream <codeph>operator&gt;&gt;</codeph> </p> </li> <li id="GUID-02D55084-3194-54E2-BCD7-5609819BCD91"><p>using the variants of <codeph>HBufC::NewL()</codeph> or <codeph>HBufC::NewLC()</codeph> that take a read stream.</p> </li> </ul> <p>The <codeph>ReadL()</codeph> member functions of <codeph>RReadStream</codeph> assume that the stream contains only the content of a descriptor.</p> <p>Note that the specific variant, <codeph>ReadL(TDes&amp; aDes)</codeph>, assumes that the length of data to be read from the stream is the same as the maximum length of the target descriptor.</p> <p>The templated stream <codeph>operator&gt;&gt;</codeph> is implemented by the Store framework to read both the length of the descriptor content and the content itself and assumes that the descriptor was originally externalised using the templated <codeph>operator&lt;&lt;</codeph>.</p> <p>The <codeph>NewLC()</codeph> and <codeph>NewL()</codeph> member functions of <codeph>HBufC</codeph> heap descriptors allocate the heap descriptor before internalising from the stream and also assume that the descriptor was originally externalised using the <codeph>operator&lt;&lt;</codeph>.</p> </section> </conbody></concept>