ncdengine/provider/protocol/src/ncd_pp_dataentityimpl.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:   CNcdPreminetProtocolDataEntityImpl implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ncd_pp_purchaseoption.h"
       
    20 #include "ncd_pp_dataentityimpl.h"
       
    21 #include "ncd_pp_dataentitycontent.h"
       
    22 #include "ncd_pp_skin.h"
       
    23 #include "ncd_pp_icon.h"
       
    24 #include "ncd_pp_download.h"
       
    25 #include "ncd_cp_query.h"
       
    26 #include "ncdprotocolutils.h"
       
    27 #include "catalogsdebug.h"
       
    28 #include "ncd_cp_detail.h"
       
    29 
       
    30 CNcdPreminetProtocolDataEntityImpl* 
       
    31 CNcdPreminetProtocolDataEntityImpl::NewL() 
       
    32     {
       
    33     CNcdPreminetProtocolDataEntityImpl* self =
       
    34         new (ELeave) CNcdPreminetProtocolDataEntityImpl;
       
    35     CleanupStack::PushL( self );
       
    36     self->ConstructL();
       
    37     CleanupStack::Pop( self );
       
    38     return self;
       
    39     }
       
    40     
       
    41 CNcdPreminetProtocolDataEntityImpl* 
       
    42 CNcdPreminetProtocolDataEntityImpl::NewLC() 
       
    43     {
       
    44     CNcdPreminetProtocolDataEntityImpl* self =
       
    45         new (ELeave) CNcdPreminetProtocolDataEntityImpl;
       
    46     CleanupStack::PushL( self );
       
    47     self->ConstructL();
       
    48     return self;
       
    49     }
       
    50     
       
    51 void CNcdPreminetProtocolDataEntityImpl::ConstructL()
       
    52     {
       
    53     NcdProtocolUtils::AssignEmptyDesL( iId );
       
    54     NcdProtocolUtils::AssignEmptyDesL( iTimestamp );
       
    55     NcdProtocolUtils::AssignEmptyDesL( iNamespace );
       
    56     NcdProtocolUtils::AssignEmptyDesL( iServerUri );
       
    57     NcdProtocolUtils::AssignEmptyDesL( iName );
       
    58     NcdProtocolUtils::AssignEmptyDesL( iDescription );
       
    59     NcdProtocolUtils::AssignEmptyDesL( iLayoutType );
       
    60     
       
    61     }
       
    62 
       
    63 CNcdPreminetProtocolDataEntityImpl::~CNcdPreminetProtocolDataEntityImpl()
       
    64     {
       
    65     DLTRACEIN((""));
       
    66     delete iId;
       
    67     delete iTimestamp;
       
    68     delete iNamespace;
       
    69     delete iServerUri;
       
    70     delete iName;
       
    71     delete iDescription;
       
    72     delete iDisclaimer;
       
    73     delete iIcon;
       
    74     
       
    75     iPurchaseOptions.ResetAndDestroy();    
       
    76     iScreenshots.ResetAndDestroy();
       
    77     iPreviews.ResetAndDestroy();
       
    78     
       
    79     delete iDownloadableContent;
       
    80     delete iSubscribableContent;
       
    81     
       
    82     if( iDetails )
       
    83         {
       
    84         iDetails->ResetAndDestroy();
       
    85         }
       
    86     delete iDetails;    
       
    87     delete iLayoutType;
       
    88     delete iSkin;
       
    89     delete iMoreInfo;
       
    90     }
       
    91 
       
    92 TNcdDataEntityType CNcdPreminetProtocolDataEntityImpl::Type() const
       
    93     {
       
    94     return iType;
       
    95     }
       
    96     
       
    97 const TDesC& CNcdPreminetProtocolDataEntityImpl::Id() const
       
    98     {
       
    99     DASSERT( iId );
       
   100     return *iId;
       
   101     }
       
   102 
       
   103 const TDesC& CNcdPreminetProtocolDataEntityImpl::Timestamp() const
       
   104     {
       
   105     DASSERT( iTimestamp );
       
   106     return *iTimestamp;
       
   107     }
       
   108 
       
   109 const TDesC& CNcdPreminetProtocolDataEntityImpl::Namespace() const
       
   110     {
       
   111     DASSERT( iNamespace );
       
   112     return *iNamespace;
       
   113     }
       
   114 
       
   115 const TDesC& CNcdPreminetProtocolDataEntityImpl::ServerUri() const
       
   116     {
       
   117     DASSERT( iServerUri );
       
   118     return *iServerUri;
       
   119     }
       
   120 
       
   121 const TDesC& CNcdPreminetProtocolDataEntityImpl::Name() const
       
   122     {
       
   123     DASSERT( iName );
       
   124     return *iName;    
       
   125     }
       
   126 
       
   127 const TDesC& CNcdPreminetProtocolDataEntityImpl::Description() const
       
   128     {
       
   129     DASSERT( iDescription );
       
   130     return *iDescription;
       
   131     }
       
   132     
       
   133 const MNcdConfigurationProtocolQuery* 
       
   134 CNcdPreminetProtocolDataEntityImpl::Disclaimer() const
       
   135     {
       
   136     return iDisclaimer;
       
   137     }
       
   138     
       
   139 const MNcdPreminetProtocolDownload* 
       
   140 CNcdPreminetProtocolDataEntityImpl::HelpInformation() const
       
   141     {
       
   142     return 0;
       
   143     //return iHelpInformation;
       
   144     }
       
   145     
       
   146 const MNcdPreminetProtocolDataEntityContent* 
       
   147 CNcdPreminetProtocolDataEntityImpl::DownloadableContent() const 
       
   148     {
       
   149     return iDownloadableContent;
       
   150     }
       
   151 
       
   152 const MNcdPreminetProtocolDataEntityContent* 
       
   153 CNcdPreminetProtocolDataEntityImpl::SubscribableContent() const 
       
   154     {
       
   155     return iSubscribableContent;
       
   156     }
       
   157 
       
   158     
       
   159 const MNcdPreminetProtocolIcon* 
       
   160 CNcdPreminetProtocolDataEntityImpl::Icon() const
       
   161     {    
       
   162     return iIcon;
       
   163     }
       
   164 
       
   165 TInt CNcdPreminetProtocolDataEntityImpl::PurchaseOptionCount() const 
       
   166     {
       
   167     return iPurchaseOptions.Count();
       
   168     }
       
   169     
       
   170 const MNcdPreminetProtocolPurchaseOption&
       
   171 CNcdPreminetProtocolDataEntityImpl::PurchaseOptionL(TInt aIndex) const 
       
   172     {
       
   173     DASSERT( aIndex >= 0 && aIndex < iPurchaseOptions.Count() );
       
   174     if (aIndex < 0 || aIndex >= iPurchaseOptions.Count()) 
       
   175         {
       
   176         User::Leave(KErrArgument);
       
   177         }
       
   178     return *iPurchaseOptions[aIndex];
       
   179     }
       
   180     
       
   181 const MNcdPreminetProtocolSkin* 
       
   182 CNcdPreminetProtocolDataEntityImpl::Skin() const 
       
   183     {
       
   184     return iSkin;
       
   185     }
       
   186     
       
   187 const TDesC& CNcdPreminetProtocolDataEntityImpl::LayoutType() const
       
   188     {
       
   189     return *iLayoutType;
       
   190     }
       
   191 
       
   192 TInt CNcdPreminetProtocolDataEntityImpl::ScreenshotCount() const 
       
   193     {
       
   194     return iScreenshots.Count();
       
   195     }
       
   196 
       
   197 const MNcdPreminetProtocolDownload&
       
   198 CNcdPreminetProtocolDataEntityImpl::ScreenshotL(TInt aIndex) const
       
   199     {
       
   200     if ( aIndex < 0 || aIndex >= iScreenshots.Count() ) 
       
   201         {
       
   202         User::Leave(KErrArgument);
       
   203         }
       
   204     return *iScreenshots[aIndex];
       
   205     }
       
   206 
       
   207 TInt CNcdPreminetProtocolDataEntityImpl::PreviewCount() const 
       
   208     {
       
   209     return iPreviews.Count();
       
   210     }
       
   211 
       
   212 const MNcdPreminetProtocolDownload&
       
   213 CNcdPreminetProtocolDataEntityImpl::PreviewL(TInt aIndex) const
       
   214     {
       
   215     if ( aIndex < 0 || aIndex >= iPreviews.Count() ) 
       
   216         {
       
   217         User::Leave(KErrArgument);
       
   218         }
       
   219     return *iPreviews[aIndex];
       
   220     }
       
   221 
       
   222 const MNcdConfigurationProtocolQuery* 
       
   223 CNcdPreminetProtocolDataEntityImpl::MoreInfo() const
       
   224     {
       
   225     return iMoreInfo;
       
   226     }
       
   227 
       
   228 TInt CNcdPreminetProtocolDataEntityImpl::DetailCount() const
       
   229     {
       
   230     if( iDetails )
       
   231         {
       
   232         return iDetails->Count();
       
   233         }
       
   234     else
       
   235         {
       
   236         return 0;
       
   237         }
       
   238     }
       
   239 
       
   240 const MNcdConfigurationProtocolDetail&
       
   241 CNcdPreminetProtocolDataEntityImpl::DetailL( TInt aIndex ) const
       
   242     {
       
   243     if( aIndex < 0 || !iDetails || aIndex >= iDetails->Count() )
       
   244         {
       
   245         User::Leave( KErrArgument );
       
   246         }
       
   247     return *iDetails->At( aIndex );
       
   248     }