Symbian3/SDK/Source/GUID-F3090A98-267F-5310-83F4-93FD5CB760D6.dita
changeset 7 51a74ef9ed63
parent 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-F3090A98-267F-5310-83F4-93FD5CB760D6.dita	Wed Mar 31 11:11:55 2010 +0100
@@ -0,0 +1,37 @@
+<?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-F3090A98-267F-5310-83F4-93FD5CB760D6" xml:lang="en"><title>Using
+CCirBuf</title><shortdesc>This document describes how to use CCirBuf.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
+<section id="GUID-92DAE8AD-1D5A-40CA-AA36-C1E0A3648D77"><title>Before adding/removing objects</title> <p>The buffer itself
+is not allocated until <xref href="GUID-FA17C8AD-BF8C-3FD4-98AE-43AF55A9D318.dita#GUID-FA17C8AD-BF8C-3FD4-98AE-43AF55A9D318/GUID-4658AA47-E3E6-3325-A4DF-FACADFA5BBB2"><apiname>CCirBufBase::SetLengthL()</apiname></xref> is called.
+Therefore, the first steps must always be to construct the <xref href="GUID-1D73835F-4361-3216-8EFC-669364E3F5E7.dita"><apiname>CCirBuf</apiname></xref> object
+and then call its <codeph>CCirBufBase::SetLengthL()</codeph> member function.</p> <p>Also
+note that <codeph>SetLengthL()</codeph> can leave so it's useful to call it
+under a trap harness.</p> <codeblock id="GUID-FED3E087-48D8-53EC-911D-12475D2B8905" xml:space="preserve">class Test
+ {
+public:
+ Test(){a=b=0;}
+ Test(TInt anInt){a=b=anInt;}
+private
+ TInt a;
+ TInt b;
+ };</codeblock> <codeblock id="GUID-3AAF1D67-BB67-5019-9D11-AB17E18254A3" xml:space="preserve">
+CCirBuf&lt;Test&gt;* cbInt=new CCirBuf&lt;Test&gt;;
+TRAPD(ret,cbInt-&gt;SetLengthL(3));            // max capacity is 3
+                                            // and allocates buffer
+Test one(1);
+Test two(2);
+...
+cbInt-&gt;Add(&amp;one);     // Can now start adding/removing objects
+...
+delete cbInt;</codeblock> </section>
+</conbody></concept>
\ No newline at end of file