diff -r b23410e29e22 -r 8873e6835f7b contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpcodectemplate.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contentmgmt/referencedrmagent/RefTestAgent/localsdp/inc/sdpcodectemplate.inl Thu May 27 14:32:46 2010 +0300 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "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: +* +* Description: +* Name : SdpCodecTemplate.inl +* Part of : SDP Codec +* Interface : - +* Version : 1.0 +* +*/ + + + +#ifndef SDPCODECTEMPLATE_INL +#define SDPCODECTEMPLATE_INL + +// INCLUDES +#include +#include + +#include "_sdpdefs.h" +#include "e32std.h" + +class RReadStream; +class RWriteStream; + +// --------------------------------------------------------------------------- +// SdpCodecTemplate::ExternalizeL +// --------------------------------------------------------------------------- +// +template void SdpCodecTemplate::ExternalizeL(const T* aElement, + RWriteStream& aWriteStream) + { + if(aElement) + { + aWriteStream.WriteUint8L (1); + aElement->ExternalizeL(aWriteStream); + } + else + { + aWriteStream.WriteUint8L (0); + } + } + +// --------------------------------------------------------------------------- +// SdpCodecTemplate::ExternalizeArrayL +// --------------------------------------------------------------------------- +// +template void +SdpCodecTemplate::ExternalizeArrayL(RPointerArray aArray, + RWriteStream& aStream) + { + aStream.WriteUint32L (aArray.Count()); + for (TInt i = 0;i < aArray.Count();i++) + { + aArray[i]->ExternalizeL(aStream); + } + } + +// --------------------------------------------------------------------------- +// SdpCodecTemplate::EncodeArrayL +// --------------------------------------------------------------------------- +// +template void +SdpCodecTemplate::EncodeArrayL(RPointerArray aArray, RWriteStream& aStream) + { + for (TInt i = 0;i < aArray.Count();i++) + { + aArray[i]->EncodeL(aStream); + } + } + +// --------------------------------------------------------------------------- +// SdpCodecTemplate::EncodeL +// --------------------------------------------------------------------------- +// +template void SdpCodecTemplate::EncodeL(const T* aElement, + RWriteStream& aWriteStream) + { + if(aElement) + { + aElement->EncodeL(aWriteStream); + } + } + +// --------------------------------------------------------------------------- +// SdpCodecTemplate::InternalizeArrayL +// --------------------------------------------------------------------------- +// +template void +SdpCodecTemplate::InternalizeArrayL(RPointerArray& aArray, + RReadStream& aStream) + { + TInt count = aStream.ReadUint32L(); + for (TInt i = 0;i < count;i++) + { + T* obj = T::InternalizeL(aStream); + CleanupStack::PushL(obj); + User::LeaveIfError(aArray.Append(obj)); + CleanupStack::Pop();//obj + } + } + +// --------------------------------------------------------------------------- +// SdpCodecTemplate::CloneArrayL +// --------------------------------------------------------------------------- +// +template void +SdpCodecTemplate::CloneArrayL(RPointerArray& aArray, + RPointerArray aSourceArray) + { + for (TInt i=0; i < (aSourceArray).Count(); i++) + { + T* obj = aSourceArray[i]->CloneL(); + CleanupStack::PushL(obj); + User::LeaveIfError(aArray.Append(obj)); + CleanupStack::Pop();//obj + } + } + + +#endif