Symbian3/SDK/Source/GUID-82762D6D-7EF5-5061-9393-BBDCCC7212CD.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Wed, 31 Mar 2010 11:11:55 +0100
changeset 7 51a74ef9ed63
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 12 contribution of API Specs and fix SDK submission

<?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-82762D6D-7EF5-5061-9393-BBDCCC7212CD"><title>Using TCardinality</title><prolog><metadata><keywords/></metadata></prolog><conbody><p><codeph>TCardinality</codeph>'s use is best explained by an example:</p> <p>If an integral value that needs externalising is known to be non-negative and cannot exceed 2^29 (e.g. the length of a descriptor) - instead of storing a 32-bit value in the stream, you can use <codeph>TCardinality</codeph> to compress the external format. So instead of</p> <codeblock id="GUID-7B78C47F-C8A2-5C64-9551-BDA725407B34" xml:space="preserve">writeStream.WriteUint32L(myValue);
...
myValue=readStream.ReadUint32L();</codeblock> <p>you would use</p> <codeblock id="GUID-5C11D583-E2E5-5891-BC0D-2BD74193889D" xml:space="preserve">writeStream &lt;&lt; TCardinality(myValue);
...
TCardinality c;
readStream &gt;&gt; c;
myValue=c;</codeblock> </conbody></concept>