Symbian3/SDK/Source/GUID-386FD0B9-D502-577C-BED2-5F31D9CA67CC.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?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-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()
    {
    ...
    if (iB.IsPtr())
        delete iB;
    }</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()
    {
    ...
    outstream  &lt;&lt; *iB;
    ...
    }</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(...,...,...,...)
    {
    iB-&gt;iFixBuf    = aData;
    ...
    }</codeblock> </section> </conbody></concept>