Symbian3/SDK/Source/GUID-82762D6D-7EF5-5061-9393-BBDCCC7212CD.dita
changeset 0 89d6a7a84779
equal deleted inserted replaced
-1:000000000000 0:89d6a7a84779
       
     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 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);
       
    13 ...
       
    14 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);
       
    15 ...
       
    16 TCardinality c;
       
    17 readStream &gt;&gt; c;
       
    18 myValue=c;</codeblock> </conbody></concept>