Symbian3/SDK/Source/GUID-7830BAAB-40DD-5E55-84B5-8DCA888E68E7.dita
changeset 7 51a74ef9ed63
parent 0 89d6a7a84779
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     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-7830BAAB-40DD-5E55-84B5-8DCA888E68E7" xml:lang="en"><title>Using
       
    13 TDesC</title><shortdesc>Use TDesC for interfaces which take narrow or wide (Unicode) text,
       
    14 depending on the build variant, but does not change the data.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    15 <section id="GUID-235E272D-6F5A-5740-8150-9698C8C8D55D"><title>Usage in a
       
    16 function interface</title> <p>An interface which needs access to either narrow
       
    17 text or wide (Unicode) text, depending on the build variant, but which does
       
    18 not need to change that data in any way, can use a <xref href="GUID-52D07F46-2162-380C-A775-C3BB335C42F5.dita"><apiname>TDesC</apiname></xref> as
       
    19 the argument type. All build independent concrete descriptors are derived
       
    20 from <codeph>TDesC</codeph> which means that the interface can accept any
       
    21 build independent descriptor.</p> <p>The following code fragment shows the
       
    22 most common function prototype pattern.</p> <codeblock id="GUID-1FAB92F0-D8D1-51C9-B993-9F0FF93659B3" xml:space="preserve">void ClassX::foo(const TDesC&amp; anArg);</codeblock> <p>The use of <codeph>TDesC</codeph> ensures that the data cannot be modified
       
    23 through the descriptor; <codeph>const</codeph> is an extra guarantee that
       
    24 the data cannot be changed.</p> <p>If the interface is to handle explicit
       
    25 8 bit or explicit 16 bit data, regardless of the build variant, then use <codeph>TDesC8</codeph> or <codeph>TDesC16</codeph> instead.</p> </section>
       
    26 </conbody></concept>