Symbian3/SDK/Source/GUID-3B0BF8FF-88AB-5BF4-9F04-5F82A3998699.dita
changeset 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-3B0BF8FF-88AB-5BF4-9F04-5F82A3998699.dita	Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,51 @@
+<?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-3B0BF8FF-88AB-5BF4-9F04-5F82A3998699" xml:lang="en"><title>How
+to store and restore a non-compound object</title><prolog><metadata><keywords/></metadata></prolog><conbody>
+<section><title> Storing</title> <p>The basic protocol for storing is the <codeph>StoreL()</codeph> function
+and should be prototyped as:</p> <codeblock id="GUID-112220CB-F74B-59FA-8EF7-BA9D1C616860" xml:space="preserve">TStreamId StoreL(CStreamStore&amp; aStore) const;</codeblock> <p>The function takes a reference to the store in which the stream is to
+be stored and returns the stream ID through which the object can be restored. </p> <p>In
+some cases, the design of a class may be such that it maintains a pointer
+or reference to the store. In this event, the <codeph>CStreamStore</codeph> argument
+would be redundant.</p> <p>To store an object that does not contain any other
+objects:</p> <ol id="GUID-1C25EAB3-DFBB-5486-B58D-45B4939A04FC">
+<li id="GUID-18320343-D11D-59F4-A875-A7306E190864"><p>construct a write stream
+object, i.e. an instance of <codeph>RStoreWriteStream</codeph> </p> </li>
+<li id="GUID-DA4E34C4-CBC3-5C57-A329-CAA63053BC2D"><p>externalise the object</p> </li>
+<li id="GUID-C6137D35-5525-56FF-8906-C5B3E8AD28CE"><p>return the ID of the
+stream</p> </li>
+</ol> <p>The following code fragment shows the canonical form for some general
+class <codeph>CClassA</codeph>:</p> <codeblock id="GUID-3AA0A33A-940C-5315-813E-BC774D7F30A2" xml:space="preserve">TStreamId CClassA::StoreL(CStreamStore&amp; aStore) const
+    {
+    RStoreWriteStream stream;
+    TStreamId id=stream.CreateLC(aStore);
+    ExternalizeL(stream);
+    stream.CommitL();
+    CleanupStack::PopAndDestroy();
+    return id;
+    }</codeblock> </section>
+<section><title>Restoring</title><p>The basic protocol for restoring is the
+&lt;code&gt;RestoreL()&lt;/code&gt;  function and should be prototyped as:
+</p><codeblock xml:space="preserve">void RestoreL(CStreamStore&amp; aStore,TStreamId anId);</codeblock><p>The
+function takes a reference to the store in which the stream is stored and
+the ID that identifies that stream is stored.</p><p>To restore an object that
+does not contain any other objects:</p><ul>
+<li><p>construct a read stream object, i.e. an instance of</p><codeph>RStoreReadStream</codeph></li>
+<li><p>internalise the object.</p></li>
+</ul><p>The following code fragment shows an example for some general class</p><codeph>CClassA</codeph><codeblock xml:space="preserve">     void CClassA::RestoreL(CStreamStore&amp; aStore, TStreamId anId)
+     {
+          RStoreReadStream stream;
+          stream.OpenLC(aStore,anId);
+          InternalizeL(stream);
+          CleanupStack::PopAndDestroy();
+     }</codeblock><p/> </section>
+</conbody></concept>
\ No newline at end of file