ncdengine/provider/server/inc/ncddependencyinfo.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     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:   CNcdDependencyInfo
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef NCD_DEPENDENCY_INFO
       
    20 #define NCD_DEPENDENCY_INFO
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <e32cmn.h>
       
    24 
       
    25 #include "ncdnodedependency.h"
       
    26 
       
    27 class RReadStream; 
       
    28 class RWriteStream;
       
    29 class CNcdNodeIdentifier;
       
    30 
       
    31 /**
       
    32  *  This class provides functions to get information about dependency
       
    33  *  nodes or dependency content.
       
    34  */
       
    35 class CNcdDependencyInfo: public CBase
       
    36 {
       
    37 public:
       
    38 
       
    39     /** 
       
    40      * @see CNcdDependencyInfo::ConstructL
       
    41      *
       
    42      * @param aIdentifier Ownership is transferred immediately, caller MUST NOT put
       
    43      * this into cleanupstack
       
    44      */
       
    45     static CNcdDependencyInfo* NewL(  
       
    46                      const TDesC& aName, 
       
    47                      const TDesC& aVersion, 
       
    48                      const TDesC& aUid,
       
    49                      CNcdNodeIdentifier* aIdentifier );
       
    50     
       
    51     /**
       
    52      * @see CNcdDependencyInfo::NewL
       
    53      * @param aIdentifier Ownership is transferred immediately, caller MUST NOT put
       
    54      * this into cleanupstack
       
    55      *
       
    56      */
       
    57     static CNcdDependencyInfo* NewLC(
       
    58                      const TDesC& aName, 
       
    59                      const TDesC& aVersion, 
       
    60                      const TDesC& aUid,
       
    61                      CNcdNodeIdentifier* aIdentifier );
       
    62 
       
    63 
       
    64     /** 
       
    65      * @see CNcdDependencyInfo::ConstructL
       
    66      * @param aIdentifier Ownership is transferred immediately, caller MUST NOT put
       
    67      * this into cleanupstack     
       
    68      */
       
    69     static CNcdDependencyInfo* NewL(  
       
    70                      const TDesC& aName, 
       
    71                      const TDesC& aVersion, 
       
    72                      TUid aUid,
       
    73                      CNcdNodeIdentifier* aIdentifier );
       
    74     
       
    75     /**
       
    76      * @see CNcdDependencyInfo::NewL
       
    77      * @param aIdentifier Ownership is transferred immediately, caller MUST NOT put
       
    78      * this into cleanupstack     
       
    79      */
       
    80     static CNcdDependencyInfo* NewLC(
       
    81                      const TDesC& aName, 
       
    82                      const TDesC& aVersion, 
       
    83                      TUid aUid,
       
    84                      CNcdNodeIdentifier* aIdentifier );
       
    85 
       
    86 
       
    87     /** 
       
    88      * @see CNcdDependencyInfo::ConstrucL
       
    89      */
       
    90     static CNcdDependencyInfo* NewL( RReadStream& aReadStream );
       
    91     
       
    92     /**
       
    93      * @see CNcdDependencyInfo::NewL
       
    94      */
       
    95     static CNcdDependencyInfo* NewLC( RReadStream& aReadStream );
       
    96 
       
    97 
       
    98     /**
       
    99      * Destructor
       
   100      */
       
   101     virtual ~CNcdDependencyInfo();
       
   102 
       
   103 
       
   104     /** 
       
   105      * @return const TDesC& Name of the dependency content
       
   106      */
       
   107     const TDesC& Name() const;
       
   108 
       
   109     /** 
       
   110      * @return const TDesC& Version of the dependency content
       
   111      */
       
   112     const TDesC& Version() const;
       
   113     
       
   114     /** 
       
   115      * @return TUid Uid of the dependency content
       
   116      */
       
   117     TUid Uid() const;
       
   118 
       
   119 
       
   120     /** 
       
   121      * return const CNcdNodeIdentifier* Identifier of the metadata that
       
   122      * will provide the dependency content. If an identifier has not
       
   123      * been set, then NULL is returned. Ownership is NOT transferred.
       
   124      */
       
   125     const CNcdNodeIdentifier* Identifier() const;
       
   126 
       
   127 
       
   128     /**
       
   129      * Dependency state setter
       
   130      *
       
   131      * @param aState Dependency state
       
   132      */
       
   133     void SetDependencyState( TNcdDependencyState aState );
       
   134     
       
   135     
       
   136     /**
       
   137      * Dependency state getter
       
   138      *
       
   139      * @return aState Dependency state
       
   140      */
       
   141     TNcdDependencyState DependencyState() const;
       
   142     
       
   143 
       
   144     /** 
       
   145      * @param aReadStream
       
   146      */
       
   147     virtual void InternalizeL( RReadStream& aReadStream );
       
   148 
       
   149     /** 
       
   150      * @param aWriteStream
       
   151      */
       
   152     virtual void ExternalizeL( RWriteStream& aWriteStream ) const;
       
   153 
       
   154 
       
   155 protected:
       
   156     /** 
       
   157      * Constructor
       
   158      * @param aIdentifier Identifier of the metadata that will provide the
       
   159      * dependency content. NULL if dependency is already given as a content
       
   160      * and node is not provided.
       
   161      */
       
   162     CNcdDependencyInfo( CNcdNodeIdentifier* aIdentifier );
       
   163     
       
   164     /** 
       
   165      * ConstructL
       
   166      *
       
   167      * @note If this function leaves, then the node identifier will be
       
   168      * deleted.
       
   169      * 
       
   170      * @param aName Name of the dependency content
       
   171      * @param aVersion Version of the dependency content
       
   172      * @param aUid Uid of the dependency content
       
   173      * Ownership is transferred.
       
   174      */
       
   175     void ConstructL( const TDesC& aName, 
       
   176                      const TDesC& aVersion, 
       
   177                      const TDesC& aUid );
       
   178 
       
   179     /** 
       
   180      * ConstructL
       
   181      *
       
   182      * @note If this function leaves, then the node identifier will be
       
   183      * deleted.
       
   184      * 
       
   185      * @param aName Name of the dependency content
       
   186      * @param aVersion Version of the dependency content
       
   187      * @param aUid Uid of the dependency content
       
   188      */
       
   189     void ConstructL( const TDesC& aName, 
       
   190                      const TDesC& aVersion, 
       
   191                      TUid aUid );
       
   192                      
       
   193     /** 
       
   194      * ConstructL
       
   195      * @param aReadStream Stream is used to internalize this class object.
       
   196      */
       
   197     void ConstructL( RReadStream& aReadStream );
       
   198 
       
   199 
       
   200 private:
       
   201     CNcdDependencyInfo( const CNcdDependencyInfo& aObject );
       
   202     CNcdDependencyInfo& operator =( const CNcdDependencyInfo& aObject );
       
   203 
       
   204 
       
   205 private: // data
       
   206 
       
   207     // Name of the dependency content
       
   208     HBufC* iName;
       
   209     // Version of the dependency content
       
   210     HBufC* iVersion;
       
   211     // Uid of the dependency content
       
   212     TUid iUid;
       
   213     // Identifier of the metadata that will provide the
       
   214     // dependency content.
       
   215     CNcdNodeIdentifier* iIdentifier;
       
   216     
       
   217     // State of the dependency: missing, upgrade available, installed
       
   218     TNcdDependencyState iDependencyState;
       
   219 };
       
   220 
       
   221 #endif // NCD_DEPENDENCY_INFO