ncdengine/provider/client/inc/ncdnodeupgradeproxy.h
changeset 4 32704c33136d
equal deleted inserted replaced
-1:000000000000 4:32704c33136d
       
     1 /*
       
     2 * Copyright (c) 2006-2008 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:   Contains CNcdNodeUpgradeProxy class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_NCD_NODE_UPGRADE_PROXY_H
       
    20 #define C_NCD_NODE_UPGRADE_PROXY_H
       
    21 
       
    22 
       
    23 // For the streams
       
    24 #include <s32mem.h>
       
    25 // For array
       
    26 #include <e32cmn.h>
       
    27 
       
    28 #include "ncdinterfacebaseproxy.h"
       
    29 #include "ncdnodeupgrade.h"
       
    30 
       
    31 class CNcdNodeMetadataProxy;
       
    32 class CNcdNodeManagerProxy;
       
    33 class MNcdNodeDependencyInfo;
       
    34 class CNcdAttributes;
       
    35 
       
    36 /**
       
    37  *  This class implements the functionality for the
       
    38  *  MNcdNodeUpgrade interfaces. The interface is provided for
       
    39  *  API users.
       
    40  *
       
    41  *  @since S60 v3.2
       
    42  */
       
    43 class CNcdNodeUpgradeProxy : public CNcdInterfaceBaseProxy, 
       
    44                              public MNcdNodeUpgrade
       
    45     {
       
    46 
       
    47 public:
       
    48 
       
    49     /**
       
    50      * @param aSession The session between the client proxy and the
       
    51      * corresponding server object.
       
    52      * @param aHandle The handle which identifies the server object
       
    53      * that this proxy uses.
       
    54      * @param aMetadata Owns and uses the information of this proxy.
       
    55      * The metadata also keeps track of the refence counts of its objects. 
       
    56      * And handles the deletion of these objects when the total reference 
       
    57      * count reaches zero.
       
    58      * @return CNcdNodeUpgradeProxy* Pointer to the created object 
       
    59      * of this class.
       
    60      */
       
    61     static CNcdNodeUpgradeProxy* NewL(
       
    62         MCatalogsClientServer& aSession,
       
    63         TInt aHandle,
       
    64         CNcdNodeMetadataProxy& aMetadata );
       
    65 
       
    66     /**
       
    67      * @param aSession The session between the client proxy and the
       
    68      * corresponding server object.
       
    69      * @param aHandle The handle which identifies the server object
       
    70      * that this proxy uses.
       
    71      * @param aMetadata Owns and uses the information of this proxy.
       
    72      * The metadata also keeps track of the refence counts of its objects. 
       
    73      * And handles the deletion of these objects when the total reference 
       
    74      * count reaches zero.
       
    75      * @return CNcdNodeUpgradeProxy* Pointer to the created object 
       
    76      * of this class.
       
    77      */
       
    78     static CNcdNodeUpgradeProxy* NewLC(
       
    79         MCatalogsClientServer& aSession, 
       
    80         TInt aHandle,
       
    81         CNcdNodeMetadataProxy& aMetadata );
       
    82 
       
    83 
       
    84     /**
       
    85      * Destructor.
       
    86      * The destructor is set public. So, the node that owns the Upgrade may
       
    87      * delete it directly when the reference count of the node reaches zero
       
    88      * and the destructor of the node is called.
       
    89      */
       
    90     virtual ~CNcdNodeUpgradeProxy();
       
    91 
       
    92 
       
    93     /**
       
    94      * @return CNcdNodeManagerProxy& Node manager can be used to create nodes.
       
    95      */
       
    96     CNcdNodeManagerProxy& NodeManager() const;
       
    97      
       
    98 
       
    99     /**
       
   100      * Gets the data for descriptors from the server side. This function is
       
   101      * called to update proxy data. The function uses the protected virtual
       
   102      * internalize functions. So, the child classes may provide their own
       
   103      * implementations for internalizations of certain metadata.
       
   104      */
       
   105     void InternalizeL();
       
   106     
       
   107 
       
   108 public: // MNcdNodeUpgrade
       
   109 
       
   110     /**
       
   111      * @see MNcdNodeUpgrade::Name
       
   112      */
       
   113     virtual const TDesC& Name() const;
       
   114 
       
   115     /**
       
   116      * @see MNcdNodeUpgrade::Uid
       
   117      */
       
   118     virtual TUid Uid() const;
       
   119 
       
   120     /**
       
   121      * @see MNcdNodeUpgrade::Version
       
   122      */
       
   123     virtual const TDesC& Version() const;
       
   124 
       
   125     /**
       
   126      * @see MNcdNodeUpgrade::UpgradeableNodeL
       
   127      */ 
       
   128     virtual MNcdNode* UpgradeableNodeL() const;
       
   129 
       
   130 
       
   131     /**
       
   132      * @see MNcdNodeUpgrade::UpgradeType
       
   133      */ 
       
   134     virtual MNcdNodeUpgrade::TUpgradeType UpgradeType() const;
       
   135 
       
   136 protected:
       
   137 
       
   138     /**
       
   139      * Constructor
       
   140      *
       
   141      * @param aSession The session between the client proxy and the
       
   142      * corresponding server object.
       
   143      * @param aHandle The handle which identifies the server object
       
   144      * that this proxy uses.
       
   145      * @param aMetadata Owns and uses the information of this proxy.
       
   146      * The metadata also keeps track of the refence counts of its objects. 
       
   147      * And handles the deletion of these objects when the total reference 
       
   148      * count reaches zero.
       
   149      * @return CNcdNodeUpgradeProxy* Pointer to the created object 
       
   150      * of this class.
       
   151      */
       
   152     CNcdNodeUpgradeProxy(
       
   153         MCatalogsClientServer& aSession,
       
   154         TInt aHandle,
       
   155         CNcdNodeMetadataProxy& aMetadata );
       
   156 
       
   157     /**
       
   158      * ConstructL
       
   159      */
       
   160     virtual void ConstructL();
       
   161     
       
   162     
       
   163     /**
       
   164      * @return RPointerArray Contains the info about the nodes
       
   165      * or contents that this node may upgrade.
       
   166      */
       
   167     const RPointerArray<MNcdNodeDependencyInfo>& UpgradeTargets() const;
       
   168     
       
   169 
       
   170     // These functions are used to update the data of this class object
       
   171 
       
   172     /**
       
   173      * @param aStream This stream will contain all the data content for
       
   174      * this class object. The stream is gotten from the server side. The
       
   175      * memeber variables will be updated according to the data from
       
   176      * the stream. 
       
   177      */
       
   178     virtual void InternalizeDataL( RReadStream& aStream );
       
   179 
       
   180 
       
   181 private:
       
   182 
       
   183     // Prevent if not implemented
       
   184     CNcdNodeUpgradeProxy( const CNcdNodeUpgradeProxy& aObject );
       
   185     CNcdNodeUpgradeProxy& operator =( const CNcdNodeUpgradeProxy& aObject );
       
   186 
       
   187     // Internalizes the upgrade target array from given stream.
       
   188     void InternalizeUpgradeArrayL( RReadStream& aStream );  
       
   189     
       
   190     // Refreshes iUpgradeType
       
   191     void RefreshUpgradeType();
       
   192     
       
   193 private: // data
       
   194 
       
   195     CNcdNodeManagerProxy& iNodeManager;
       
   196 
       
   197     RPointerArray<MNcdNodeDependencyInfo> iUpgradeTargets;
       
   198     TUpgradeType iUpgradeType;    
       
   199     CNcdAttributes* iUpgradeData;
       
   200     };
       
   201 
       
   202 
       
   203 #endif // C_NCD_NODE_UPGRADE_PROXY_H