multimediacommsengine/mmcesrv/mmceserver/src/mcesipdefaultdata.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2002-2003 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    Default data (headers) for a certain SIP request.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "mcesipdefaultdata.h"
       
    23 #include "mcesip.h"
       
    24 
       
    25 // ================= MEMBER FUNCTIONS =======================
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // C++ default constructor can NOT contain any code, that
       
    29 // might leave.
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CMceSipDefaultData::CMceSipDefaultData()
       
    33     {
       
    34     }
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // Symbian 2nd phase constructor can leave.
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 void CMceSipDefaultData::ConstructL( 
       
    41                  const TDesC8& aMethod, 
       
    42                  CDesC8Array* aHeaders,
       
    43                  RPointerArray< CMceSipDefaultData >& aDataArray )
       
    44     {
       
    45     User::LeaveIfError ( iMethodIndex = MceSip::SIPStringIndex( aMethod ) );
       
    46     aDataArray.AppendL( this );
       
    47     iHeaders = aHeaders;
       
    48     
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // Two-phased constructor.
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 CMceSipDefaultData* CMceSipDefaultData::NewL( 
       
    56                   const TDesC8& aMethod,
       
    57                   CDesC8Array* aHeaders,
       
    58                   RPointerArray< CMceSipDefaultData >& aDataArray )
       
    59     {
       
    60     __ASSERT_ALWAYS( aHeaders, User::Leave( KErrArgument ) );
       
    61     __ASSERT_ALWAYS( aHeaders->MdcaCount() > 0, User::Leave( KErrArgument ) );
       
    62     
       
    63     CMceSipDefaultData* self = new ( ELeave ) CMceSipDefaultData();
       
    64     CleanupStack::PushL( self );
       
    65     self->ConstructL( aMethod, aHeaders, aDataArray );
       
    66     CleanupStack::Pop( self ); 
       
    67     return self;
       
    68     }
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // Destructor
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 CMceSipDefaultData::~CMceSipDefaultData()
       
    75     {
       
    76     delete iHeaders;
       
    77     }
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // CMceSipDefaultData::Match
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 TBool CMceSipDefaultData::Match( const TDesC8& aMethod )
       
    84     {
       
    85     return iMethodIndex == MceSip::SIPStringIndex( aMethod );
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CMceSipDefaultData::Match
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 TBool CMceSipDefaultData::Match( TInt aMethodInd )
       
    93     {
       
    94     return iMethodIndex == aMethodInd;
       
    95     }
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CMceSipDefaultData::SetHeaders
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 void CMceSipDefaultData::SetHeaders( CDesC8Array* aHeaders )
       
   102     {
       
   103     delete iHeaders;
       
   104     iHeaders = aHeaders;  
       
   105     __TEST_INVARIANT;
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------------------------
       
   109 // CMceSipDefaultData::DefaultHeaders
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 CDesC8Array& CMceSipDefaultData::DefaultHeaders()
       
   113     {
       
   114     return *iHeaders;
       
   115     }
       
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // CMceSipDefaultData::__DbgTestInvariant
       
   119 // Test invariant
       
   120 // -----------------------------------------------------------------------------
       
   121 //	
       
   122 void CMceSipDefaultData::__DbgTestInvariant() const
       
   123 	{
       
   124 	if ( !( iHeaders && iHeaders->MdcaCount() > 0 ) )
       
   125 	    {
       
   126 	    User::Invariant();
       
   127 	    }
       
   128 	}
       
   129 
       
   130 
       
   131 //  End of File
       
   132