Symbian3/SDK/Source/GUID-386FD0B9-D502-577C-BED2-5F31D9CA67CC.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-386FD0B9-D502-577C-BED2-5F31D9CA67CC"><title>Using TSwizzle operators</title><prolog><metadata><keywords/></metadata></prolog><conbody><section id="GUID-BE588434-A777-5D14-9BF1-3FF80C4FC054"><title>Using the conversion to T* operator</title> <p>In the following code fragment, the compiler invokes the <codeph>T*()</codeph> operator (because a pointer is required) for the <codeph>TSwizzle&lt;CClassB&gt;</codeph> object <codeph>iB</codeph>, before calling <codeph>delete</codeph>.</p> <codeblock id="GUID-260F2210-D7A7-5314-9E60-9214940B3FB3" xml:space="preserve">CClassABC::~CClassABC()
       
    13     {
       
    14     ...
       
    15     if (iB.IsPtr())
       
    16         delete iB;
       
    17     }</codeblock> </section> <section id="GUID-B0ADBF8D-0FE1-5D8A-AC5D-129E6F900B0D"><title>Using the indirection operator</title> <p>In the following code fragment, the <codeph>*()</codeph> operator returns a reference to the <codeph>CClassB</codeph> object represented by the swizzle <codeph>TSwizzle&lt;CClassB&gt;</codeph> object, <codeph>iB</codeph>.</p> <codeblock id="GUID-0C7D82A7-2314-50FC-8111-7739BE4C0B5D" xml:space="preserve">TStreamId CClassABC::StoreL()
       
    18     {
       
    19     ...
       
    20     outstream  &lt;&lt; *iB;
       
    21     ...
       
    22     }</codeblock> </section> <section id="GUID-7F2959D4-5A4C-5D65-A422-30C234FC7879"><title>Using the indirect component selector</title> <p>In the following code fragment, the operator <codeph>-&gt;</codeph> gives access to the member <codeph>iFixBuf</codeph> of the <codeph>CClassB</codeph> object which is represented by the <codeph>TSwizzle&lt;CClassB&gt;</codeph> swizzle, <codeph>iB</codeph>.</p> <codeblock id="GUID-C625B510-90D8-5845-8727-6041746CA5ED" xml:space="preserve">void CClassABC::ConstructB(...,...,...,...)
       
    23     {
       
    24     iB-&gt;iFixBuf    = aData;
       
    25     ...
       
    26     }</codeblock> </section> </conbody></concept>