ncdengine/provider/protocol/src/ncd_pp_purchaseentityimpl.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:   CNcdPreminetProtocolPurchaseEntityImpl implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ncd_pp_purchaseentityimpl.h"
       
    20 #include "ncd_pp_download.h"
       
    21 #include "ncdprotocolutils.h"
       
    22 
       
    23 CNcdPreminetProtocolPurchaseEntityImpl* 
       
    24 CNcdPreminetProtocolPurchaseEntityImpl::NewL() 
       
    25     {
       
    26     CNcdPreminetProtocolPurchaseEntityImpl* self =
       
    27         new (ELeave) CNcdPreminetProtocolPurchaseEntityImpl;
       
    28     CleanupStack::PushL( self );
       
    29     self->ConstructL();
       
    30     CleanupStack::Pop( self );
       
    31     return self;
       
    32     }
       
    33     
       
    34 CNcdPreminetProtocolPurchaseEntityImpl* 
       
    35 CNcdPreminetProtocolPurchaseEntityImpl::NewLC() 
       
    36     {
       
    37     CNcdPreminetProtocolPurchaseEntityImpl* self =
       
    38         new (ELeave) CNcdPreminetProtocolPurchaseEntityImpl;
       
    39     CleanupStack::PushL( self );
       
    40     self->ConstructL();
       
    41     return self;
       
    42     }
       
    43     
       
    44 void CNcdPreminetProtocolPurchaseEntityImpl::ConstructL()
       
    45     {
       
    46     NcdProtocolUtils::AssignEmptyDesL( iId );
       
    47     NcdProtocolUtils::AssignEmptyDesL( iTicket );
       
    48     NcdProtocolUtils::AssignEmptyDesL( iPriceText );
       
    49     NcdProtocolUtils::AssignEmptyDesL( iPrice );
       
    50     NcdProtocolUtils::AssignEmptyDesL( iPriceCurrency );
       
    51     }
       
    52 
       
    53 CNcdPreminetProtocolPurchaseEntityImpl::CNcdPreminetProtocolPurchaseEntityImpl()
       
    54 : CBase()
       
    55     {
       
    56     }
       
    57     
       
    58 CNcdPreminetProtocolPurchaseEntityImpl::~CNcdPreminetProtocolPurchaseEntityImpl()
       
    59     {
       
    60     DLTRACEIN((""));
       
    61     delete iId;
       
    62     delete iTicket;
       
    63     delete iPriceText;
       
    64     delete iPrice;
       
    65     delete iPriceCurrency;
       
    66     iDownloadDetails.ResetAndDestroy();
       
    67     iDeliveryMethods.Close();
       
    68     DLTRACEOUT((""));
       
    69     }
       
    70 
       
    71 const TDesC& 
       
    72 CNcdPreminetProtocolPurchaseEntityImpl::Id() const
       
    73     {
       
    74     return *iId;
       
    75     }
       
    76 
       
    77 const TDesC& 
       
    78 CNcdPreminetProtocolPurchaseEntityImpl::Ticket() const
       
    79     {
       
    80     return *iTicket;
       
    81     }
       
    82 
       
    83 const MNcdPreminetProtocolDownload&
       
    84 CNcdPreminetProtocolPurchaseEntityImpl::DownloadDetailsL(TInt aIndex) const
       
    85     {
       
    86     DASSERT( aIndex >= 0 && aIndex < iDownloadDetails.Count() );
       
    87     if ( aIndex < 0 || aIndex >= iDownloadDetails.Count() ) 
       
    88         {
       
    89         User::Leave(KErrArgument);
       
    90         }
       
    91     return *iDownloadDetails[aIndex];
       
    92     }
       
    93 
       
    94 TInt CNcdPreminetProtocolPurchaseEntityImpl::DownloadDetailsCount() const
       
    95     {
       
    96     return iDownloadDetails.Count();
       
    97     }
       
    98 
       
    99 const TDesC& 
       
   100 CNcdPreminetProtocolPurchaseEntityImpl::Price() const
       
   101     {
       
   102     return *iPrice;
       
   103     }
       
   104 
       
   105 const TDesC& 
       
   106 CNcdPreminetProtocolPurchaseEntityImpl::PriceCurrency() const
       
   107     {
       
   108     return *iPriceCurrency;
       
   109     }
       
   110 
       
   111 const TDesC& 
       
   112 CNcdPreminetProtocolPurchaseEntityImpl::PriceText() const
       
   113     {
       
   114     return *iPriceText;
       
   115     }
       
   116 
       
   117 const RArray<TNcdDeliveryMethod>& 
       
   118 CNcdPreminetProtocolPurchaseEntityImpl::DeliveryMethods() const
       
   119     {
       
   120     return iDeliveryMethods;
       
   121     }
       
   122