ncdengine/provider/client/inc/ncdnodeskinproxy.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 CNcdNodeSkinProxy class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_NCD_NODE_SKIN_PROXY_H
       
    20 #define C_NCD_NODE_SKIN_PROXY_H
       
    21 
       
    22 
       
    23 // For the streams
       
    24 #include <s32mem.h>
       
    25 // For TTime 
       
    26 #include <e32std.h>
       
    27 
       
    28 
       
    29 #include "ncdinterfacebaseproxy.h"
       
    30 #include "ncdnodeskin.h"
       
    31 
       
    32 class CNcdNodeMetadataProxy;
       
    33 
       
    34 
       
    35 /**
       
    36  *  This class implements the functionality for the
       
    37  *  MNcdNodeSkin interfaces. The interface is provided for
       
    38  *  API users.
       
    39  *
       
    40  *  @since S60 v3.2
       
    41  */
       
    42 class CNcdNodeSkinProxy : public CNcdInterfaceBaseProxy, 
       
    43                           public MNcdNodeSkin
       
    44     {
       
    45 
       
    46 public:
       
    47 
       
    48     /**
       
    49      * @param aSession The session between the client proxy and the
       
    50      * corresponding server object.
       
    51      * @param aHandle The handle which identifies the server object
       
    52      * that this proxy uses.
       
    53      * @param aMetadata Owns and uses the information of this proxy.
       
    54      * It also keeps track of the refence counts of its objects. 
       
    55      * And handles the deletion of these objects when the total reference 
       
    56      * count reaches zero.
       
    57      * @return CNcdNodeSkinProxy* Pointer to the created object 
       
    58      * of this class.
       
    59      */
       
    60     static CNcdNodeSkinProxy* NewL(
       
    61         MCatalogsClientServer& aSession,
       
    62         TInt aHandle,
       
    63         CNcdNodeMetadataProxy& aMetadata );
       
    64 
       
    65     /**
       
    66      * @param aSession The session between the client proxy and the
       
    67      * corresponding server object.
       
    68      * @param aHandle The handle which identifies the server object
       
    69      * that this proxy uses.
       
    70      * @param aMetadata Owns and uses the information of this proxy.
       
    71      * It also keeps track of the refence counts of its objects. 
       
    72      * And handles the deletion of these objects when the total reference 
       
    73      * count reaches zero.
       
    74      * @return CNcdNodeSkinProxy* Pointer to the created object 
       
    75      * of this class.
       
    76      */
       
    77     static CNcdNodeSkinProxy* NewLC(
       
    78         MCatalogsClientServer& aSession, 
       
    79         TInt aHandle,
       
    80         CNcdNodeMetadataProxy& aMetadata );
       
    81 
       
    82 
       
    83     /**
       
    84      * Destructor.
       
    85      * The destructor is set public. So, the node that owns the Skin may
       
    86      * delete it directly when the reference count of the node reaches zero
       
    87      * and the destructor of the node is called.
       
    88      */
       
    89     virtual ~CNcdNodeSkinProxy();
       
    90      
       
    91 
       
    92     /**
       
    93      * Gets the data for descriptors from the server side. This function is
       
    94      * called to update proxy data. The function uses the protected virtual
       
    95      * internalize functions. So, the child classes may provide their own
       
    96      * implementations for internalizations of certain metadata.
       
    97      */
       
    98     void InternalizeL();
       
    99     
       
   100 
       
   101 public: // MNcdNodeSkin
       
   102 
       
   103     /**
       
   104      * @see MNcdNodeSkin::SkinId
       
   105      */
       
   106     virtual const TDesC& SkinId() const;
       
   107 
       
   108 
       
   109     /**
       
   110      * @see MNcdNodeSkin::SkinTimeStamp
       
   111      */
       
   112     virtual TTime SkinTimeStamp() const;
       
   113 
       
   114 
       
   115     /**
       
   116      * @see MNcdNodeSkin::LoadSkinL
       
   117      */ 
       
   118     virtual MNcdFileDownloadOperation* LoadSkinL( 
       
   119         const TDesC& aTargetFileName,
       
   120         MNcdFileDownloadOperationObserver& aObserver );
       
   121 
       
   122 
       
   123 protected:
       
   124 
       
   125     /**
       
   126      * Constructor
       
   127      *
       
   128      * @param aSession The session between the client proxy and the
       
   129      * corresponding server object.
       
   130      * @param aHandle The handle which identifies the server object
       
   131      * that this proxy uses.
       
   132      * @param aMetadata Owns and uses the information of this proxy.
       
   133      * It also keeps track of the refence counts of its objects. 
       
   134      * And handles the deletion of these objects when the total reference 
       
   135      * count reaches zero.
       
   136      * @return CNcdNodeSkinProxy* Pointer to the created object 
       
   137      * of this class.
       
   138      */
       
   139     CNcdNodeSkinProxy(
       
   140         MCatalogsClientServer& aSession,
       
   141         TInt aHandle,
       
   142         CNcdNodeMetadataProxy& aMetadata );
       
   143 
       
   144     /**
       
   145      * ConstructL
       
   146      */
       
   147     virtual void ConstructL();
       
   148 
       
   149 
       
   150     /**
       
   151      * @return CNcdNodeMetadataProxy& The metadata that owns this object.
       
   152      * @exception KNcdErrorObsolete if the object has been set as obsolete. Then, we
       
   153      * cannot be sure if the original metadata still exists because it is not the parent
       
   154      * of this class object anymore.
       
   155      */
       
   156     CNcdNodeMetadataProxy& MetadataL() const;     
       
   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     CNcdNodeSkinProxy( const CNcdNodeSkinProxy& aObject );
       
   185     CNcdNodeSkinProxy& operator =( const CNcdNodeSkinProxy& aObject );
       
   186     
       
   187     
       
   188 private: // data
       
   189 
       
   190     CNcdNodeMetadataProxy& iMetadata;
       
   191     TBool iObsolete;
       
   192     
       
   193     // Skin data
       
   194     HBufC* iSkinId;
       
   195     TTime iTimeStamp;
       
   196     
       
   197     };
       
   198 
       
   199 
       
   200 #endif // C_NCD_NODE_SKIN_PROXY_H