ncdengine/provider/client/inc/ncdnodescreenshotproxy.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 CNcdNodeScreenshotProxy class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_NCD_NODE_SCREENSHOT_PROXY_H
       
    20 #define C_NCD_NODE_SCREENSHOT_PROXY_H
       
    21 
       
    22 
       
    23 // For the streams
       
    24 #include <s32mem.h>
       
    25 
       
    26 #include "ncdinterfacebaseproxy.h"
       
    27 #include "ncdnodescreenshot.h"
       
    28 
       
    29 class CNcdNodeMetadataProxy;
       
    30 
       
    31 
       
    32 /**
       
    33  *  This class implements the functionality for the
       
    34  *  MNcdNodeScreenshot interfaces. The interface is provided for
       
    35  *  API users.
       
    36  *
       
    37  *  @since S60 v3.2
       
    38  */
       
    39 class CNcdNodeScreenshotProxy : public CNcdInterfaceBaseProxy, 
       
    40                                 public MNcdNodeScreenshot
       
    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 metadata 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 CNcdNodeScreenshotProxy* Pointer to the created object 
       
    55      * of this class.
       
    56      */
       
    57     static CNcdNodeScreenshotProxy* 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 metadata 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 CNcdNodeScreenshotProxy* Pointer to the created object 
       
    72      * of this class.
       
    73      */
       
    74     static CNcdNodeScreenshotProxy* 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 Screenshot 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 ~CNcdNodeScreenshotProxy();
       
    87 
       
    88 
       
    89     /**
       
    90      * @return CNcdNodeMetadataProxy& Gives the proxy that owns this class object.
       
    91      * @exception KNcdErrorObsolete if the object has been set as obsolete. Then, we
       
    92      * cannot be sure if the original metadata still exists because it is not the parent
       
    93      * of this class object anymore.
       
    94      */
       
    95     CNcdNodeMetadataProxy& MetadataL() const;
       
    96 
       
    97      
       
    98     /**
       
    99      * Gets the data for descriptors from the server side. This function is
       
   100      * called to update proxy data. The function uses the protected virtual
       
   101      * internalize functions. So, the child classes may provide their own
       
   102      * implementations for internalizations of certain data.
       
   103      */
       
   104     void InternalizeL();
       
   105     
       
   106 
       
   107 public: // MNcdNodeScreenshot
       
   108 
       
   109     /**
       
   110      * @see MNcdNodeScreenshot::ScreenshotCount
       
   111      */ 
       
   112     TInt ScreenshotCount() const;
       
   113 
       
   114     /**
       
   115      * @see MNcdNodeScreenshot::ScreenshotMimeType
       
   116      */ 
       
   117     const TDesC& ScreenshotMimeType( TInt aIndex ) const;
       
   118 
       
   119     /**
       
   120      * @see MNcdNodeScreenshot::LoadScreenshotL
       
   121      */ 
       
   122     MNcdDownloadOperation* LoadScreenshotL(
       
   123         TInt aIndex,
       
   124         MNcdDownloadOperationObserver* aObserver );
       
   125 
       
   126     /**
       
   127      * @see MNcdNodeScreenshot::ScreenshotDataL
       
   128      */ 
       
   129     HBufC8* ScreenshotDataL( TInt aIndex ) const;
       
   130 
       
   131 
       
   132 protected:
       
   133 
       
   134     /**
       
   135      * Constructor
       
   136      *
       
   137      * @param aSession The session between the client proxy and the
       
   138      * corresponding server object.
       
   139      * @param aHandle The handle which identifies the server object
       
   140      * that this proxy uses.
       
   141      * @param aMetadata Owns and uses the information of this proxy.
       
   142      * The metadata also keeps track of the refence counts of its objects. 
       
   143      * And handles the deletion of these objects when the total reference 
       
   144      * count reaches zero.
       
   145      * @return CNcdNodeScreenshotProxy* Pointer to the created object 
       
   146      * of this class.
       
   147      */
       
   148     CNcdNodeScreenshotProxy(
       
   149         MCatalogsClientServer& aSession,
       
   150         TInt aHandle,
       
   151         CNcdNodeMetadataProxy& aMetadata );
       
   152 
       
   153     /**
       
   154      * ConstructL
       
   155      */
       
   156     virtual void ConstructL();
       
   157 
       
   158 
       
   159     /**
       
   160      * @return TBool ETrue if this object has been set as obsolete.
       
   161      */
       
   162     TBool IsObsolete() const;
       
   163     
       
   164     /**
       
   165      * @param aObsolete ETrue if the object should be set as obsolete else EFalse.
       
   166      */
       
   167     void SetObsolete( TBool aObsolete );
       
   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     CNcdNodeScreenshotProxy( const CNcdNodeScreenshotProxy& aObject );
       
   185     CNcdNodeScreenshotProxy& operator =( const CNcdNodeScreenshotProxy& aObject );
       
   186     
       
   187     
       
   188 private: // data
       
   189 
       
   190     CNcdNodeMetadataProxy& iMetadata;
       
   191     TBool iObsolete;
       
   192     TInt iScreenshotCount;
       
   193     RPointerArray<HBufC> iScreenshotMimeType;
       
   194 
       
   195     };
       
   196 
       
   197 
       
   198 #endif // C_NCD_NODE_SCREENSHOT_PROXY_H