sl@0: /* sl@0: * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: template sl@0: inline void DoExternalizeL(const T& anObject,RWriteStream& aStream,Externalize::Member) sl@0: {anObject.ExternalizeL(aStream);} sl@0: template sl@0: inline void DoInternalizeL(T& anObject,RReadStream& aStream,Internalize::Member) sl@0: {anObject.InternalizeL(aStream);} sl@0: sl@0: template sl@0: inline void DoExternalizeL(const T& anObject,RWriteStream& aStream,Externalize::Function) sl@0: {ExternalizeL(anObject,aStream);} sl@0: template sl@0: inline void DoInternalizeL(T& anObject,RReadStream& aStream,Internalize::Function) sl@0: {InternalizeL(anObject,aStream);} sl@0: sl@0: // Externalization and internalization selectors sl@0: inline Externalize::Member Externalization(const TAny*) sl@0: {return Externalize::Member();} sl@0: inline Internalize::Member Internalization(TAny*) sl@0: {return Internalize::Member();} sl@0: sl@0: inline Externalize::Function Externalization(const TDesC8*) sl@0: {return Externalize::Function();} sl@0: inline Externalize::Function Externalization(const TDesC16*) sl@0: {return Externalize::Function();} sl@0: inline Internalize::Function Internalization(TDes8*) sl@0: {return Internalize::Function();} sl@0: inline Internalize::Function Internalization(TDes16*) sl@0: {return Internalize::Function();} sl@0: sl@0: #if 0 sl@0: inline Externalize::Function Externalization(const CBufBase*) sl@0: {return Externalize::Function();} sl@0: inline Externalize::Function Externalization(const CArrayFixBase*) sl@0: {return Externalize::Function();} sl@0: inline Internalize::Function Internalization(CBufBase*) sl@0: {return Internalize::Function();} sl@0: inline Internalize::Function Internalization(CArrayFixBase*) sl@0: {return Internalize::Function();} sl@0: #endif sl@0: sl@0: template sl@0: inline Externalize::Function Externalization(T*const*) sl@0: {return Externalize::Function();} sl@0: sl@0: // Externalization and internalization functions sl@0: IMPORT_C void ExternalizeL(TInt64 anInt64,RWriteStream& aStream); sl@0: IMPORT_C void InternalizeL(TInt64& anInt64,RReadStream& aStream); sl@0: sl@0: IMPORT_C void ExternalizeL(const TDesC8& aDes8,RWriteStream& aStream); sl@0: IMPORT_C void ExternalizeL(const TDesC16& aDes16,RWriteStream& aStream); sl@0: IMPORT_C void InternalizeL(TDes8& aDes8,RReadStream& aStream); sl@0: IMPORT_C void InternalizeL(TDes16& aDes16,RReadStream& aStream); sl@0: sl@0: IMPORT_C void ExternalizeL(const TCheckedUid& aUid,RWriteStream& aStream); sl@0: IMPORT_C void InternalizeL(TCheckedUid& aUid,RReadStream& aStream); sl@0: sl@0: //IMPORT_C void ExternalizeL(TPoint aPoint,RWriteStream& aStream); sl@0: IMPORT_C void ExternalizeL(TSize aSize,RWriteStream& aStream); sl@0: //IMPORT_C void ExternalizeL(const TRect& aRect,RWriteStream& aStream); sl@0: //IMPORT_C void InternalizeL(TPoint& aPoint,RReadStream& aStream); sl@0: IMPORT_C void InternalizeL(TSize& aSize,RReadStream& aStream); sl@0: //IMPORT_C void InternalizeL(TRect& aRect,RReadStream& aStream); sl@0: sl@0: //IMPORT_C void ExternalizeL(const CBufBase& aBuf,RWriteStream& aStream); sl@0: //IMPORT_C void InternalizeL(CBufBase& aBuf,RReadStream& aStream); sl@0: sl@0: IMPORT_C void ArrayExternalizeCountL(TInt aCount,RWriteStream& aStream); sl@0: //IMPORT_C void DoExternalizeAllL(const CArrayFixBase& anArray,RWriteStream& aStream,TExternalizer anExter); sl@0: IMPORT_C TInt ArrayInternalizeCountL(RReadStream& aStream); sl@0: //IMPORT_C void DoInternalizeAllL(CArrayFixBase& anArray,RReadStream& aStream,TInternalizer anInter); sl@0: sl@0: // Input and output operators sl@0: template sl@0: inline RWriteStream& operator<<(RWriteStream& aStream,const T& anObject) sl@0: {DoExternalizeL(anObject,aStream,Externalization(&anObject));return aStream;} sl@0: template sl@0: inline RReadStream& operator>>(RReadStream& aStream,T& anObject) sl@0: {DoInternalizeL(anObject,aStream,Internalization(&anObject));return aStream;} sl@0: sl@0: inline RWriteStream& operator<<(RWriteStream& aStream,const TInt8& anInt8) sl@0: {aStream.WriteInt8L(anInt8);return aStream;} sl@0: inline RWriteStream& operator<<(RWriteStream& aStream,const TInt16& anInt16) sl@0: {aStream.WriteInt16L(anInt16);return aStream;} sl@0: inline RWriteStream& operator<<(RWriteStream& aStream,const TInt32& anInt32) sl@0: {aStream.WriteInt32L(anInt32);return aStream;} sl@0: inline RWriteStream& operator<<(RWriteStream& aStream,const TUint8& aUint8) sl@0: {aStream.WriteUint8L(aUint8);return aStream;} sl@0: inline RWriteStream& operator<<(RWriteStream& aStream,const TUint16& aUint16) sl@0: {aStream.WriteUint16L(aUint16);return aStream;} sl@0: inline RWriteStream& operator<<(RWriteStream& aStream,const TUint32& aUint32) sl@0: {aStream.WriteUint32L(aUint32);return aStream;} sl@0: //inline RWriteStream& operator<<(RWriteStream& aStream,const TReal32& aReal32) sl@0: // {aStream.WriteReal32L(aReal32);return aStream;} sl@0: //inline RWriteStream& operator<<(RWriteStream& aStream,const TReal64& aReal64) sl@0: // {aStream.WriteReal64L(aReal64);return aStream;} sl@0: sl@0: inline RReadStream& operator>>(RReadStream& aStream,TInt8& anInt8) sl@0: {anInt8=aStream.ReadInt8L();return aStream;} sl@0: inline RReadStream& operator>>(RReadStream& aStream,TInt16& anInt16) sl@0: {anInt16=aStream.ReadInt16L();return aStream;} sl@0: inline RReadStream& operator>>(RReadStream& aStream,TInt32& anInt32) sl@0: {anInt32=aStream.ReadInt32L();return aStream;} sl@0: inline RReadStream& operator>>(RReadStream& aStream,TUint8& aUint8) sl@0: {aUint8=aStream.ReadUint8L();return aStream;} sl@0: inline RReadStream& operator>>(RReadStream& aStream,TUint16& aUint16) sl@0: {aUint16=aStream.ReadUint16L();return aStream;} sl@0: inline RReadStream& operator>>(RReadStream& aStream,TUint32& aUint32) sl@0: {aUint32=aStream.ReadUint32L();return aStream;} sl@0: //inline RReadStream& operator>>(RReadStream& aStream,TReal32& aReal32) sl@0: // {aReal32=aStream.ReadReal32L();return aStream;} sl@0: //inline RReadStream& operator>>(RReadStream& aStream,TReal64& aReal64) sl@0: // {aReal64=aStream.ReadReal64L();return aStream;} sl@0: sl@0: sl@0: //inline RWriteStream& operator<<(RWriteStream& aStream,const TInt64& anInt64) sl@0: // {ExternalizeL(anInt64,aStream);return aStream;} sl@0: //inline RReadStream& operator>>(RReadStream& aStream,TInt64& anInt64) sl@0: // {InternalizeL(anInt64,aStream);return aStream;} sl@0: sl@0: inline RWriteStream& operator<<(RWriteStream& aStream,const TUid& aUid) sl@0: {return aStream<>(RReadStream& aStream,TUid& aUid) sl@0: {return aStream>>aUid.iUid;} sl@0: inline RReadStream& operator>>(RReadStream& aStream,TCheckedUid& aUid) sl@0: {InternalizeL(aUid,aStream);return aStream;} sl@0: sl@0: //inline RWriteStream& operator<<(RWriteStream& aStream,const TPoint& aPoint) sl@0: // {ExternalizeL(aPoint,aStream);return aStream;} sl@0: //inline RWriteStream& operator<<(RWriteStream& aStream,const TSize& aSize) sl@0: // {ExternalizeL(aSize,aStream);return aStream;} sl@0: //inline RWriteStream& operator<<(RWriteStream& aStream,const TRect& aRect) sl@0: // {ExternalizeL(aRect,aStream);return aStream;} sl@0: //inline RReadStream& operator>>(RReadStream& aStream,TPoint& aPoint) sl@0: // {InternalizeL(aPoint,aStream);return aStream;} sl@0: //inline RReadStream& operator>>(RReadStream& aStream,TSize& aSize) sl@0: // {InternalizeL(aSize,aStream);return aStream;} sl@0: //inline RReadStream& operator>>(RReadStream& aStream,TRect& aRect) sl@0: // {InternalizeL(aRect,aStream);return aStream;} sl@0: sl@0: //inline RWriteStream& operator<<(RWriteStream& aStream,const TStreamRef& aRef) sl@0: // {aRef.ExternalizeL(aStream);return aStream;} sl@0: sl@0: // Class TCardinality sl@0: inline TCardinality::TCardinality(TInt aCount) sl@0: :iCount(aCount) sl@0: /** Constructs the object with the specified value. sl@0: sl@0: @param aCount The value for this object. */ sl@0: { sl@0: #if defined (_DEBUG) sl@0: __DbgChkRange(aCount); sl@0: #endif sl@0: } sl@0: inline TCardinality::operator TInt() const sl@0: { sl@0: #if defined (_DEBUG) sl@0: __DbgChkRange(iCount); sl@0: #endif sl@0: return iCount; sl@0: } sl@0: // Class TDesInternalizer sl@0: inline const TDesHeader& TDesInternalizer::Header() const sl@0: {return iHeader;} sl@0: inline TDesHeader& TDesInternalizer::Header() sl@0: {return iHeader;}