ncdengine/provider/protocol/src/ncd_cp_clientconfigurationimpl.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ncd_cp_clientconfigurationimpl.h"
       
    20 #include "ncdprotocolutils.h"
       
    21 #include "catalogsdebug.h"
       
    22 #include "ncd_cp_cookie.h"
       
    23 #include "ncd_cp_detailimpl.h"
       
    24 
       
    25 CNcdConfigurationProtocolClientConfigurationImpl* CNcdConfigurationProtocolClientConfigurationImpl::NewL()
       
    26     {
       
    27     CNcdConfigurationProtocolClientConfigurationImpl* self = new(ELeave) 
       
    28         CNcdConfigurationProtocolClientConfigurationImpl();
       
    29     CleanupStack::PushL( self );
       
    30     self->ConstructL();
       
    31     CleanupStack::Pop( self );
       
    32     return self;
       
    33     }
       
    34 
       
    35 CNcdConfigurationProtocolClientConfigurationImpl::CNcdConfigurationProtocolClientConfigurationImpl()
       
    36 : iCookies( 0 ),
       
    37   iDetails( 0 )
       
    38 {
       
    39 }
       
    40 
       
    41 void CNcdConfigurationProtocolClientConfigurationImpl::ConstructL()
       
    42     {
       
    43     }
       
    44 
       
    45 CNcdConfigurationProtocolClientConfigurationImpl::~CNcdConfigurationProtocolClientConfigurationImpl()
       
    46     {
       
    47     if( iCookies ) 
       
    48         {
       
    49         iCookies->ResetAndDestroy();
       
    50         delete iCookies;
       
    51         iCookies = 0;
       
    52         }
       
    53     if( iDetails )
       
    54         {
       
    55         iDetails->ResetAndDestroy();
       
    56         delete iDetails;
       
    57         iDetails = 0;
       
    58         }
       
    59     }
       
    60 
       
    61 TInt CNcdConfigurationProtocolClientConfigurationImpl::ExpirationDelta() const
       
    62     {
       
    63     return iExpirationDelta;
       
    64     }
       
    65 
       
    66 TInt CNcdConfigurationProtocolClientConfigurationImpl::CookieCount() const
       
    67     {
       
    68     if( iCookies )
       
    69         {
       
    70         return iCookies->Count();
       
    71         }
       
    72     else
       
    73         {
       
    74         return 0;
       
    75         }
       
    76     }
       
    77 
       
    78 MNcdConfigurationProtocolCookie& CNcdConfigurationProtocolClientConfigurationImpl::CookieL( TInt aIndex ) const
       
    79     {
       
    80     DASSERT( aIndex >= 0 && aIndex < iCookies->Count() );
       
    81     if ( aIndex < 0 || aIndex >= iCookies->Count() )
       
    82         {
       
    83         User::Leave( KErrArgument );
       
    84         }
       
    85 
       
    86     return *( iCookies->At( aIndex ));
       
    87     }
       
    88 
       
    89 TInt CNcdConfigurationProtocolClientConfigurationImpl::DetailCount() const
       
    90     {
       
    91     if( iDetails )
       
    92         {
       
    93         return iDetails->Count();
       
    94         }
       
    95     else
       
    96         {
       
    97         return 0;
       
    98         }
       
    99     }
       
   100 
       
   101 const MNcdConfigurationProtocolDetail& CNcdConfigurationProtocolClientConfigurationImpl::DetailL( TInt aIndex ) const
       
   102     {
       
   103     DASSERT( aIndex >= 0 && aIndex < iDetails->Count() );
       
   104     if ( aIndex < 0 || aIndex >= iDetails->Count() )
       
   105         {
       
   106         User::Leave( KErrArgument );
       
   107         }
       
   108 
       
   109     return *( iDetails->At( aIndex ));
       
   110     }