equal
deleted
inserted
replaced
|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-37D7019C-E3EF-5841-8691-5A865A2B5FD2" xml:lang="en"><title>Using |
|
13 CCirBuffer</title><shortdesc>This document describes how to use CCirBuffer. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <section id="GUID-4C65D06D-9E80-4C52-8106-954E087AEC47"><title>Before adding/removing objects</title> <p>The buffer itself |
|
15 is not allocated until the <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> member |
|
16 function is called. Therefore, the first steps must always be to construct |
|
17 the <xref href="GUID-620EC30F-933F-3073-9E5F-CAC9F2BA4623.dita"><apiname>CCirBuffer</apiname></xref> object and then call its <codeph>SetLengthL()</codeph> member |
|
18 function.</p> <p>Also note that <codeph>SetLengthL()</codeph> can leave so |
|
19 it's useful to call it under a trap harness.</p> <codeblock id="GUID-3B0EF9D8-0616-5894-92E0-D4CC80CCC876" xml:space="preserve">... |
|
20 CCirBuffer* cbInt=new CCirBuffer; |
|
21 TRAPD(ret,cbInt->SetLengthL(3)); // max capacity is 3 |
|
22 // and allocates buffer |
|
23 cbInt->Put(123); // Can now start adding/removing integer objects |
|
24 cbInt->Put(12); |
|
25 cbInt->Put(1); |
|
26 ... |
|
27 delete cbInt;</codeblock> </section> |
|
28 </conbody></concept> |