ncdengine/provider/client/inc/ncdpurchaseoptionproxy.h
changeset 4 32704c33136d
equal deleted inserted replaced
-1:000000000000 4:32704c33136d
       
     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 #ifndef C_PURCHASE_OPTION_PROXY
       
    20 #define C_PURCHASE_OPTION_PROXY
       
    21 
       
    22 #include <s32mem.h>
       
    23 
       
    24 #include "ncdinterfacebaseproxy.h"
       
    25 #include "ncdpurchaseoption.h"
       
    26 
       
    27 class CNcdClientSubscription;
       
    28 class CNcdClientPartOfSubscription;
       
    29 class CNcdClientUpgrade;
       
    30 class CNcdNodePurchaseProxy;
       
    31 
       
    32 /**
       
    33  *  Class to represent purchaseoption.
       
    34  *
       
    35  *  Proxy-class to represent a purchaseoption.
       
    36  *
       
    37  *  @lib ?library
       
    38  *  @since S60 ?S60_version *** for example, S60 v3.0
       
    39  */
       
    40 class CNcdPurchaseOptionProxy : public CNcdInterfaceBaseProxy,
       
    41                                 public MNcdPurchaseOption
       
    42     {
       
    43 
       
    44 public:
       
    45 
       
    46     virtual ~CNcdPurchaseOptionProxy();
       
    47 
       
    48     static CNcdPurchaseOptionProxy* NewL( 
       
    49         MCatalogsClientServer& aSession,
       
    50         TInt aHandle,
       
    51         CNcdNodePurchaseProxy& aParentNodePurchase );
       
    52 
       
    53     static CNcdPurchaseOptionProxy* NewLC( 
       
    54         MCatalogsClientServer& aSession,
       
    55         TInt aHandle,
       
    56         CNcdNodePurchaseProxy& aParentNodePurchase );
       
    57 
       
    58     /**
       
    59      * This function is called to update proxy data.
       
    60      * The function uses the protected virtual internalize functions. 
       
    61      * So, the child classes may provide their own implementations 
       
    62      * for internalizations of certain data.
       
    63      *
       
    64      * @since S60 ?S60_version
       
    65      */
       
    66     void InternalizeL();
       
    67     
       
    68     /**
       
    69      * Getter for id of this purchaseoption.
       
    70      *
       
    71      * @since S60 ?S60_version
       
    72      * @return Id of this purchaseoption.
       
    73      */    
       
    74     const TDesC& Id() const;
       
    75     
       
    76 
       
    77     /**
       
    78      * Getter for pointer to the NodePurchase that owns this
       
    79      * purchaseoption proxy.
       
    80      *
       
    81      * @since S60 ?S60_version
       
    82      * @return Pointer to owning node. NULL If this purchaseoption
       
    83      *         is obsolete.
       
    84      */
       
    85     CNcdNodePurchaseProxy* ParentNodePurchase() const;
       
    86 
       
    87     /**
       
    88      * Getter for partofsubscription info. As const pointer implies
       
    89      * ownership is not transferred.
       
    90      *
       
    91      * @since S60 ?S60_version
       
    92      * @return Pointer to object containin part of subscription info.
       
    93      *         If NULL, does not exist.
       
    94      */    
       
    95     const CNcdClientPartOfSubscription* PartOfSubscription() const;
       
    96 
       
    97     /**
       
    98      * Sets purchaseoption into obsolete state and it should
       
    99      * not be used anymore.
       
   100      *
       
   101      * @since S60 ?S60_version
       
   102      * @param aIsObsolete New value for obsolete info of the
       
   103      *                    purchaseoption.
       
   104      */ 
       
   105     void SetObsolete();
       
   106     
       
   107 public: // from base class MNcdPurchaseOption
       
   108 
       
   109     /**
       
   110      * From MNcdPurchaseOption.
       
   111      * @see MNcdPurchaseOption::Name
       
   112      */
       
   113     virtual const TDesC& Name() const;
       
   114 
       
   115 
       
   116     /**
       
   117      * From MNcdPurchaseOption.
       
   118      * @see MNcdPurchaseOption::Price
       
   119      */
       
   120     virtual const TDesC& Price() const;
       
   121 
       
   122 
       
   123     /**
       
   124      * From MNcdPurchaseOption.
       
   125      * @see MNcdPurchaseOption::IsFree
       
   126      */
       
   127     virtual TBool IsFree() const;
       
   128 
       
   129 
       
   130     /**
       
   131      * From MNcdPurchaseOption.
       
   132      * @see MNcdPurchaseOption::PurchaseOptionType
       
   133      */
       
   134     virtual MNcdPurchaseOption::TType PurchaseOptionType() const;
       
   135 
       
   136     /**
       
   137      * From MNcdPurchaseOption.
       
   138      * @see MNcdPurchaseOption::IsObsolete
       
   139      */
       
   140     virtual TBool IsObsolete() const;
       
   141 
       
   142     /**
       
   143      * From MNcdPurchaseOption.
       
   144      * @see MNcdPurchaseOption::IsUsableL
       
   145      */
       
   146     virtual TBool IsUsableL() const;
       
   147 
       
   148     /**
       
   149      * From MNcdPurchaseOption.
       
   150      * @see MNcdPurchaseOption::ParentSubscriptionL
       
   151      */ 
       
   152     virtual MNcdSubscription* ParentSubscriptionL() const;
       
   153  
       
   154      /**
       
   155      * From MNcdPurchaseOption.
       
   156      * @see MNcdPurchaseOption::ParentSubscriptionNodeL
       
   157      */   
       
   158     virtual MNcdNode* ParentSubscriptionNodeL() const;
       
   159 
       
   160      /**
       
   161      * From MNcdPurchaseOption.
       
   162      * @see MNcdPurchaseOption::ParentSubscriptionPurchaseOptionId
       
   163      */       
       
   164     virtual const TDesC& ParentSubscriptionPurchaseOptionIdL() const;
       
   165 
       
   166 
       
   167 protected:
       
   168 
       
   169     
       
   170     CNcdPurchaseOptionProxy( 
       
   171         MCatalogsClientServer& aSession,
       
   172         TInt aHandle,
       
   173         CNcdNodePurchaseProxy& aParentNodePurchase );
       
   174 
       
   175     void ConstructL();
       
   176 
       
   177     /**
       
   178      * Function that does the actual internalization of
       
   179      * data for this proxy.
       
   180      *
       
   181      * @since S60 ?S60_version
       
   182      * @param aStream Stream where from data is internalized.
       
   183      */
       
   184     virtual void InternalizeDataL( RReadStream& aStream );
       
   185 
       
   186 
       
   187 private:
       
   188 
       
   189 
       
   190 
       
   191 
       
   192 private: // data
       
   193 
       
   194     /**
       
   195      * Purchase interface into which this purchaseoptionproxy is
       
   196      * related to.
       
   197      * Not own.
       
   198      */
       
   199     CNcdNodePurchaseProxy* iParentNodePurchase;
       
   200 
       
   201     /**
       
   202      * Pointer to possible subscription-component of purchase-option.
       
   203      * Null if not present.
       
   204      * Own.
       
   205      */
       
   206     CNcdClientSubscription* iSubscriptionComponent;
       
   207 
       
   208     /**
       
   209      * Pointer to possible partofsubscription-component of purchase-option.
       
   210      * Null if not present.
       
   211      * Own.
       
   212      */
       
   213     CNcdClientPartOfSubscription* iPartOfSubscriptionComponent;
       
   214 
       
   215     /**
       
   216      * Pointer to possible upgrade-component of purchase-option.
       
   217      * Null if not present.
       
   218      * Own.
       
   219      */    
       
   220     CNcdClientUpgrade* iUpgradeComponent;
       
   221 
       
   222 
       
   223     /**
       
   224      * Name of the option. For example "Try" or "Full". 
       
   225      */  
       
   226     HBufC* iName;
       
   227     /**
       
   228      * Textual representation of price when using this purchase option.
       
   229      */      
       
   230     HBufC* iPriceText;
       
   231     /**
       
   232      * If iPriceText is not used then this tells the price.
       
   233      */     
       
   234     TReal32 iPrice;
       
   235     /**
       
   236      * Currency of iPriceText.
       
   237      * Own. 
       
   238      */     
       
   239     HBufC* iPriceCurrency;
       
   240     /**
       
   241      * If target is free using this purchase option.
       
   242      */ 
       
   243     TBool iIsFree;
       
   244 
       
   245 
       
   246     /**
       
   247      * Id of this purchase option.
       
   248      */ 
       
   249     HBufC* iPurchaseOptionId;
       
   250     
       
   251     /**
       
   252      * Type for this entity.
       
   253      * Own. 
       
   254      */   
       
   255     MNcdPurchaseOption::TType iType;
       
   256     
       
   257     /**
       
   258      * If purchase process is needed when buying target with this
       
   259      * purchase option.
       
   260      */    
       
   261     TBool iRequirePurchaseProcess;
       
   262 
       
   263     /**
       
   264      * If this purchaseoption is obsolete and should not be used
       
   265      * anymore. This can happen if the node is reinternalized
       
   266      * and someone still has handle to any of the purchaseoptions
       
   267      * of the node.
       
   268      */ 
       
   269     TBool iObsolete;
       
   270 
       
   271     };
       
   272 
       
   273 
       
   274 
       
   275 #endif // C_PURCHASE_OPTION_PROXY