diff -r 000000000000 -r 1bce908db942 multimediacommsengine/mmcesrv/mmceserver/src/mcesipdefaultdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/multimediacommsengine/mmcesrv/mmceserver/src/mcesipdefaultdata.cpp Tue Feb 02 01:04:58 2010 +0200 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2002-2003 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: Default data (headers) for a certain SIP request. +* +*/ + + + + +// INCLUDE FILES +#include "mcesipdefaultdata.h" +#include "mcesip.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CMceSipDefaultData::CMceSipDefaultData() + { + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------------------------- +// +void CMceSipDefaultData::ConstructL( + const TDesC8& aMethod, + CDesC8Array* aHeaders, + RPointerArray< CMceSipDefaultData >& aDataArray ) + { + User::LeaveIfError ( iMethodIndex = MceSip::SIPStringIndex( aMethod ) ); + aDataArray.AppendL( this ); + iHeaders = aHeaders; + + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +CMceSipDefaultData* CMceSipDefaultData::NewL( + const TDesC8& aMethod, + CDesC8Array* aHeaders, + RPointerArray< CMceSipDefaultData >& aDataArray ) + { + __ASSERT_ALWAYS( aHeaders, User::Leave( KErrArgument ) ); + __ASSERT_ALWAYS( aHeaders->MdcaCount() > 0, User::Leave( KErrArgument ) ); + + CMceSipDefaultData* self = new ( ELeave ) CMceSipDefaultData(); + CleanupStack::PushL( self ); + self->ConstructL( aMethod, aHeaders, aDataArray ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CMceSipDefaultData::~CMceSipDefaultData() + { + delete iHeaders; + } + +// --------------------------------------------------------------------------- +// CMceSipDefaultData::Match +// --------------------------------------------------------------------------- +// +TBool CMceSipDefaultData::Match( const TDesC8& aMethod ) + { + return iMethodIndex == MceSip::SIPStringIndex( aMethod ); + } + +// --------------------------------------------------------------------------- +// CMceSipDefaultData::Match +// --------------------------------------------------------------------------- +// +TBool CMceSipDefaultData::Match( TInt aMethodInd ) + { + return iMethodIndex == aMethodInd; + } + +// --------------------------------------------------------------------------- +// CMceSipDefaultData::SetHeaders +// --------------------------------------------------------------------------- +// +void CMceSipDefaultData::SetHeaders( CDesC8Array* aHeaders ) + { + delete iHeaders; + iHeaders = aHeaders; + __TEST_INVARIANT; + } + +// --------------------------------------------------------------------------- +// CMceSipDefaultData::DefaultHeaders +// --------------------------------------------------------------------------- +// +CDesC8Array& CMceSipDefaultData::DefaultHeaders() + { + return *iHeaders; + } + +// ----------------------------------------------------------------------------- +// CMceSipDefaultData::__DbgTestInvariant +// Test invariant +// ----------------------------------------------------------------------------- +// +void CMceSipDefaultData::__DbgTestInvariant() const + { + if ( !( iHeaders && iHeaders->MdcaCount() > 0 ) ) + { + User::Invariant(); + } + } + + +// End of File +