xdmprotocols/XcapProtocol/XcapHttpTransport/src/XcapHttpHeaderModel.cpp
branchRCL_3
changeset 35 fbd2e7cec7ef
parent 0 c8caa15ef882
equal deleted inserted replaced
34:2669f8761a99 35:fbd2e7cec7ef
       
     1 /*
       
     2 * Copyright (c) 2004 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:   CXcapHttpHeaderModel
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "XcapHttpTransport.h"
       
    23 #include "XcapHttpHeaderModel.h"
       
    24 
       
    25 // ================= MEMBER FUNCTIONS =======================
       
    26 //
       
    27 
       
    28 // ----------------------------------------------------------
       
    29 // CXcapHttpHeaderModel::CXcapHttpHeaderModel
       
    30 // 
       
    31 // ----------------------------------------------------------
       
    32 //
       
    33 CXcapHttpHeaderModel::CXcapHttpHeaderModel( CXcapHttpTransport& aTransportMain ) :
       
    34                                             iTransportMain( aTransportMain)
       
    35     {
       
    36     }
       
    37 
       
    38 // ----------------------------------------------------------
       
    39 // CXcapHttpHeaderModel::NewL
       
    40 // 
       
    41 // ----------------------------------------------------------
       
    42 //
       
    43 CXcapHttpHeaderModel* CXcapHttpHeaderModel::NewL( const TDesC8& aHeaderName,
       
    44                                                   const TDesC8& aHeaderValue,
       
    45                                                   CXcapHttpTransport& aTransportMain )
       
    46                                         
       
    47     {
       
    48     CXcapHttpHeaderModel* self = new ( ELeave ) CXcapHttpHeaderModel( aTransportMain );
       
    49     CleanupStack::PushL( self );
       
    50     self->ConstructL( aHeaderName, aHeaderValue );
       
    51     CleanupStack::Pop();  //self
       
    52     return self;
       
    53     }
       
    54 
       
    55 // ----------------------------------------------------------
       
    56 // CXcapHttpHeaderModel::HeaderValue
       
    57 // 
       
    58 // ----------------------------------------------------------
       
    59 //
       
    60 void CXcapHttpHeaderModel::ConstructL( const TDesC8& aHeaderName,
       
    61                                        const TDesC8& aHeaderValue )
       
    62     {
       
    63     delete iHeaderName;
       
    64     iHeaderName = NULL;
       
    65     iHeaderName = aHeaderName.AllocL();
       
    66     delete iHeaderValue;
       
    67     iHeaderValue = NULL;
       
    68     iHeaderValue = aHeaderValue.AllocL();
       
    69     
       
    70     }
       
    71 
       
    72 // ----------------------------------------------------------
       
    73 // CXcapHttpHeaderModel::HeaderValue
       
    74 // 
       
    75 // ----------------------------------------------------------
       
    76 //
       
    77 TPtrC8 CXcapHttpHeaderModel::HeaderValue() const
       
    78     {
       
    79     return iHeaderValue != NULL ? iHeaderValue->Des() : TPtrC8();
       
    80     }
       
    81 
       
    82 // ----------------------------------------------------------
       
    83 // CXcapHttpHeaderModel::HeaderValue
       
    84 // 
       
    85 // ----------------------------------------------------------
       
    86 //
       
    87 TPtrC8 CXcapHttpHeaderModel::HeaderName() const
       
    88     {
       
    89     return iHeaderName != NULL ? iHeaderName->Des() : TPtrC8();
       
    90     }
       
    91      
       
    92 // ----------------------------------------------------------
       
    93 // CXcapHttpHeaderModel::~CXcapHttpHeaderModel
       
    94 // 
       
    95 // ----------------------------------------------------------
       
    96 //
       
    97 CXcapHttpHeaderModel::~CXcapHttpHeaderModel()
       
    98     {
       
    99     #ifdef _DEBUG
       
   100         iTransportMain.WriteToLog( _L8( "CXcapHttpHeaderModel::~CXcapHttpHeaderModel()" ) );    
       
   101     #endif
       
   102     delete iHeaderName;
       
   103     delete iHeaderValue;
       
   104     }
       
   105