--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-DA4160B0-7B63-5C84-B3C6-190100530EDE.dita Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,40 @@
+<?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-DA4160B0-7B63-5C84-B3C6-190100530EDE"><title>How to use templated stream operators</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>Templated stream operators are straight forward to use. For example, given the class <codeph>TSimple</codeph> defined as:</p> <codeblock id="GUID-E705AC6E-6671-552D-90A3-6BEF66E30A0C" xml:space="preserve"> class TSimple
+ {
+ public :
+ void InternalizeL(RReadStream& aStream);
+ void ExternalizeL(RWriteStream& aStream) const;
+ ...
+ TInt8 iInt8Value;
+ TInt64 iInt64Value;
+ TRect iRectangle;
+ TUid iUid;
+ CBufSeg* iSegBuffer;
+ }</codeblock> <p><codeph>ExternalizeL()</codeph> and <codeph>InternalizeL()</codeph> might be implemented as:</p> <codeblock id="GUID-F89A6EEB-FA20-5A2B-A3DB-33630212DD70" xml:space="preserve">void TSimple::ExternalizeL(RWriteStream& aStream) const
+ {
+ aStream << iInt8Value;
+ aStream << iInt64Value;
+ aStream << iRectangle
+ aStream << iUid;
+ aStream << *iSegBuffer;
+ }</codeblock> <codeblock id="GUID-DABABB0C-435F-594C-9424-F27EBDC00F17" xml:space="preserve">void TSimple::InternalizeL(RReadStream& aStream)
+ {
+ aStream >> iInt8Value;
+ aStream >> iInt64Value;
+ aStream >> iRectangle
+ aStream >> iUid;
+ aStream >> *iSegBuffer;
+ }</codeblock> <p>The templated operators can also be used on an object of type <codeph>TSimple</codeph>. For example:</p> <codeblock id="GUID-326FFA1F-3614-5257-A3F9-1908F25E5DC8" xml:space="preserve">TSimple simple;
+...
+aStream << simple;
+...</codeblock> <p>The <codeph>operator<<</codeph> results in call to <codeph>TSimple::ExternalizeL()</codeph> function and this, in turn, calls <codeph>operator<<</codeph> on <codeph>TSimple</codeph>'s data members.</p> </conbody></concept>
\ No newline at end of file