ncdengine/provider/client/inc/ncdnodedownloadproxy.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:   Contains CNcdNodeDownloadProxy class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_NCD_NODE_DOWNLOAD_PROXY_H
       
    20 #define C_NCD_NODE_DOWNLOAD_PROXY_H
       
    21 
       
    22 
       
    23 // For the streams
       
    24 #include <s32mem.h>
       
    25 
       
    26 #include "ncdinterfacebaseproxy.h"
       
    27 #include "ncdnodedownload.h"
       
    28 
       
    29 class CNcdNodeMetadataProxy;
       
    30 
       
    31 
       
    32 /**
       
    33  *  This class implements the functionality for the
       
    34  *  MNcdNodeDownload interfaces. The interface is provided for
       
    35  *  API users.
       
    36  *
       
    37  *  @since S60 v3.2
       
    38  */
       
    39 class CNcdNodeDownloadProxy : public CNcdInterfaceBaseProxy, 
       
    40                               public MNcdNodeDownload
       
    41     {
       
    42 
       
    43 public:
       
    44 
       
    45     /**
       
    46      * @param aSession The session between the client proxy and the
       
    47      * corresponding server object.
       
    48      * @param aHandle The handle which identifies the server object
       
    49      * that this proxy uses.
       
    50      * @param aMetadata Owns and uses the information of this proxy.
       
    51      * The proxy also keeps track of the refence counts of its objects. 
       
    52      * And handles the deletion of these objects when the total reference 
       
    53      * count reaches zero.
       
    54      * @return CNcdNodeDownloadProxy* Pointer to the created object 
       
    55      * of this class.
       
    56      */
       
    57     static CNcdNodeDownloadProxy* NewL(
       
    58         MCatalogsClientServer& aSession,
       
    59         TInt aHandle,
       
    60         CNcdNodeMetadataProxy& aMetadata );
       
    61 
       
    62     /**
       
    63      * @param aSession The session between the client proxy and the
       
    64      * corresponding server object.
       
    65      * @param aHandle The handle which identifies the server object
       
    66      * that this proxy uses.
       
    67      * @param aMetadata Owns and uses the information of this proxy.
       
    68      * The proxy also keeps track of the refence counts of its objects. 
       
    69      * And handles the deletion of these objects when the total reference 
       
    70      * count reaches zero.
       
    71      * @return CNcdNodeDownloadProxy* Pointer to the created object 
       
    72      * of this class.
       
    73      */
       
    74     static CNcdNodeDownloadProxy* NewLC(
       
    75         MCatalogsClientServer& aSession, 
       
    76         TInt aHandle,
       
    77         CNcdNodeMetadataProxy& aMetadata );
       
    78 
       
    79 
       
    80     /**
       
    81      * Destructor.
       
    82      * The destructor is set public. So, the node that owns the Download may
       
    83      * delete it directly when the reference count of the node reaches zero
       
    84      * and the destructor of the node is called.
       
    85      */
       
    86     virtual ~CNcdNodeDownloadProxy();
       
    87 
       
    88 
       
    89     /**
       
    90      * @return CNcdNodeMetadataProxy& Gives the proxy that owns this class object.
       
    91      */
       
    92     CNcdNodeMetadataProxy& Metadata() const;
       
    93 
       
    94 
       
    95     /**
       
    96      * Gets the data for descriptors from the server side. This function is
       
    97      * called to update proxy data. The function uses the protected virtual
       
    98      * internalize functions. So, the child classes may provide their own
       
    99      * implementations for internalizations of certain metadata.
       
   100      */
       
   101     void InternalizeL();
       
   102     
       
   103 
       
   104 public: // MNcdNodeDownload
       
   105 
       
   106     /**
       
   107      * @see MNcdNodeDownload::IsDownloadedL
       
   108      */
       
   109     virtual TBool IsDownloadedL() const;
       
   110 
       
   111 
       
   112     /**
       
   113      * @see MNcdNodeDownload::DownloadContentL
       
   114      */
       
   115     virtual MNcdDownloadOperation* DownloadContentL( 
       
   116         MNcdDownloadOperationObserver& aObserver );
       
   117 
       
   118 
       
   119 protected:
       
   120 
       
   121     /**
       
   122      * Constructor
       
   123      *
       
   124      * @param aSession The session between the client proxy and the
       
   125      * corresponding server object.
       
   126      * @param aHandle The handle which identifies the server object
       
   127      * that this proxy uses.
       
   128      * @param aMetadata Owns and uses the information of this proxy.
       
   129      * The proxy also keeps track of the refence counts of its objects. 
       
   130      * And handles the deletion of these objects when the total reference 
       
   131      * count reaches zero.
       
   132      * @return CNcdNodeDownloadProxy* Pointer to the created object 
       
   133      * of this class.
       
   134      */
       
   135     CNcdNodeDownloadProxy(
       
   136         MCatalogsClientServer& aSession,
       
   137         TInt aHandle,
       
   138         CNcdNodeMetadataProxy& aMetadata );
       
   139 
       
   140     /**
       
   141      * ConstructL
       
   142      */
       
   143     virtual void ConstructL();
       
   144     
       
   145     
       
   146     // These functions are used to update the data of this class object
       
   147 
       
   148     /**
       
   149      * @param aStream This stream will contain all the data content for
       
   150      * this class object. The stream is gotten from the server side. The
       
   151      * memeber variables will be updated according to the data from
       
   152      * the stream. 
       
   153      */
       
   154     virtual void InternalizeDataL( RReadStream& aStream );
       
   155 
       
   156 
       
   157 private:
       
   158 
       
   159     // Prevent if not implemented
       
   160     CNcdNodeDownloadProxy( const CNcdNodeDownloadProxy& aObject );
       
   161     CNcdNodeDownloadProxy& operator =( const CNcdNodeDownloadProxy& aObject );
       
   162     
       
   163     
       
   164 private: // data
       
   165 
       
   166     CNcdNodeMetadataProxy& iMetadata;
       
   167 
       
   168     TBool iIsDownloaded;    
       
   169     };
       
   170 
       
   171 
       
   172 #endif // C_NCD_NODE_DOWNLOAD_PROXY_H