homescreenpluginsrv/inc/hspsresource.h
branchRCL_3
changeset 114 a5a39a295112
equal deleted inserted replaced
113:0efa10d348c0 114:a5a39a295112
       
     1 /*
       
     2 * Copyright (c) 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:  Declaration of a file resource
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef hspsRESOURCE_H
       
    20 #define hspsRESOURCE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <apmstd.h> // MIME
       
    24 #include <s32mem.h> // streams
       
    25  
       
    26 const TInt KMaxTagsLength = 50;
       
    27 
       
    28 /**
       
    29 * ThspsLockingPolicy
       
    30 * Locking policy flag-definitions for HSPS. These are bit-masked.
       
    31 */
       
    32 enum ThspsLockingPolicy
       
    33   {
       
    34   EhspsUnlocked           = 0x0000, //0b0000000000000000,			Resource is replaceable
       
    35   EhspsLocked             = 0x0001  //0b0000000000000001,			The resource is always fetched from ROM and it cannot be replaced
       
    36   };
       
    37     
       
    38 /**
       
    39  * Resource file extension definitions for HSPS.
       
    40  */
       
    41 _LIT(KODTFileExtension, ".o0000");
       
    42 _LIT(KDTDFileExtension, ".dtd");
       
    43 _LIT(KXMLFileExtension, ".xml");
       
    44 _LIT(KDATFileExtension, ".dat");
       
    45     
       
    46 
       
    47 /**
       
    48 * ThspsResourceType
       
    49 * Resource-type definitions for HSPS.
       
    50 */
       
    51 enum ThspsResourceType
       
    52     {
       
    53     /**
       
    54     * EResourceNone. No type at all - juts a file path.
       
    55     */
       
    56     EResourceNone,
       
    57             
       
    58     /**
       
    59     * EResourceODT. Resource is ODT (HSPS Application Theme's binary format)
       
    60     */
       
    61     EResourceODT,
       
    62     
       
    63     /**
       
    64     * EResourceDTD.
       
    65     */
       
    66     EResourceDTD,
       
    67     
       
    68     /**
       
    69     * EResourceXML.
       
    70     */
       
    71     EResourceXML,
       
    72     
       
    73     /**
       
    74     * EResourceDAT.
       
    75     */
       
    76     EResourceDAT,
       
    77     
       
    78     /**
       
    79     * EResourceRES. Resource is some media content.
       
    80     */
       
    81     EResourceRES,
       
    82             
       
    83     /**
       
    84     * EResourceOther. Other extension. 
       
    85     */
       
    86     EResourceOther
       
    87     
       
    88     };
       
    89 
       
    90 
       
    91 /**
       
    92  * ChspsResource is HSPS-utility class defining resource-structure.
       
    93  *
       
    94  * @lib hspsResource.lib
       
    95  * @since S60 5.0
       
    96  * @ingroup group_hspsresource 
       
    97  */
       
    98 class ChspsResource : public CBase
       
    99     {
       
   100     public:  // Constructors and destructor
       
   101         
       
   102         /**
       
   103         * Two-phased constructor.
       
   104         * 
       
   105         * @since S60 5.0
       
   106         */
       
   107         IMPORT_C static ChspsResource* NewL();
       
   108         
       
   109         
       
   110         /**
       
   111         * Makes a clone of this class.
       
   112         * 
       
   113         * @since S60 5.0
       
   114         */
       
   115         IMPORT_C ChspsResource* CloneL();
       
   116         
       
   117         /**
       
   118         * Destructor.
       
   119         */
       
   120         virtual ~ChspsResource();
       
   121 
       
   122     public: // New functions
       
   123         
       
   124         /**
       
   125         * Sets value of iLockingPolicy data member.
       
   126         * 
       
   127         * @since S60 5.0
       
   128         * @param aLockingPolicy is new value for iLockingPolicy data member.
       
   129         */
       
   130         IMPORT_C void SetLockingPolicy( ThspsLockingPolicy aLockingPolicy );
       
   131         
       
   132         /**
       
   133         * Gets value of iLockingPolicy data member.
       
   134         * 
       
   135         * @since S60 5.0
       
   136         * @return ThspsLockingPolicy iLockingPolicy.
       
   137         */
       
   138         IMPORT_C ThspsLockingPolicy LockingPolicy() const;
       
   139         
       
   140         /**
       
   141         * Sets value of iResourceType data member.
       
   142         * 
       
   143         * @since S60 5.0
       
   144         * @param aResourceType is new value of iResourceType data member.
       
   145         */    
       
   146         IMPORT_C void SetResourceType( ThspsResourceType aResourceType );
       
   147         
       
   148         /**
       
   149         * Gets value of iResourceType data member.
       
   150         * 
       
   151         * @since S60 5.0
       
   152         * @return ThspsResourceType iResourceType.
       
   153         */
       
   154         IMPORT_C ThspsResourceType ResourceType() const;
       
   155         
       
   156         /**
       
   157         * Sets value of iResourceId data member.
       
   158         * 
       
   159         * @since S60 5.0
       
   160         * @param aResourceId is new value of iResourceId data member.
       
   161         */
       
   162         IMPORT_C void SetResourceIdL( const TDesC& aResourceId );
       
   163         
       
   164         /**
       
   165         * Gets value of iResourceId data member.
       
   166         * 
       
   167         * @since S60 5.0
       
   168         * @return TDesC& iResourceId.
       
   169         */
       
   170         IMPORT_C const TDesC& ResourceId() const;
       
   171         
       
   172         /**
       
   173         * Sets value of iFileName data member.
       
   174         * 
       
   175         * @since S60 5.0
       
   176         * @param aFileName is new iFileName value.
       
   177         */
       
   178         IMPORT_C void SetFileNameL( const TDesC& aFileName );
       
   179         
       
   180         /**
       
   181         * Gets value of iFileName data member.
       
   182         * 
       
   183         * @since S60 5.0
       
   184         * @return TDes& iFileName.
       
   185         */
       
   186         IMPORT_C const TDesC& FileName() const;
       
   187         
       
   188         /**
       
   189         * Sets value of iMimeType data member.
       
   190         *  
       
   191         * @since S60 5.0
       
   192         * @param aDataType is a new value of iMimeType.
       
   193         */
       
   194         IMPORT_C void SetMimeTypeL( const TDataType aDataType );
       
   195         
       
   196         /**
       
   197         * Get iMimeType of this ChspsResource-object.
       
   198         * 
       
   199         * @since S60 5.0
       
   200         * @return TDataType iMimeType.
       
   201         */
       
   202         IMPORT_C TDataType MimeType() const;
       
   203         
       
   204         /**
       
   205         * Externalizes ChspsResource-object's member data.
       
   206         * 
       
   207         * @since S60 5.0
       
   208         * @param aStream is a write stream given.
       
   209         */
       
   210         IMPORT_C void ExternalizeL( RWriteStream& aStream) const;
       
   211         
       
   212         /**
       
   213         * Internalizes ChspsResource-object's member data.
       
   214         * 
       
   215         * @since S60 5.0
       
   216         * @param aStream is data read stream given.
       
   217         */
       
   218         IMPORT_C void InternalizeL( RReadStream& aStream);
       
   219         
       
   220         /**
       
   221         * Set to ELangNone if the resource is common to all locales,
       
   222         * otherwise it's language specific.
       
   223         * 
       
   224         * @since S60 5.0
       
   225         * @param aLanguage is new value of iLanguage data member.
       
   226         */        
       
   227         IMPORT_C void SetLanguage( const TLanguage& aLanguage );
       
   228         
       
   229         /**
       
   230         * Gets value of iLanguage data member.
       
   231         * 
       
   232         * @since S60 5.0
       
   233         * @return TLanguage& iLanguage.
       
   234         */
       
   235         IMPORT_C const TLanguage& Language() const;
       
   236 
       
   237         /**
       
   238          * Sets value of the iConfigurationUid member
       
   239          * @since S60 5.0
       
   240          * @param aConfUid Configuration UID
       
   241          */
       
   242         IMPORT_C void SetConfigurationUid( const TInt aConfUid );
       
   243         
       
   244         /**
       
   245          * Gets value of the iConfigurationUid member
       
   246          * @since S60 5.0
       
   247          * @return UID
       
   248          */
       
   249         IMPORT_C TInt ConfigurationUid() const;
       
   250         
       
   251         /**
       
   252          * Sets value of the iTags member
       
   253          * @since S60 5.0
       
   254          * @param aTag Tags
       
   255          */
       
   256         IMPORT_C void SetTagsL( const TDesC& aTag );
       
   257         
       
   258         /**
       
   259          * Gets value of the iTags member
       
   260          * @since S60 5.0
       
   261          * @return tags descriptor
       
   262          */
       
   263         IMPORT_C const TDesC& Tags() const;
       
   264         
       
   265     private:
       
   266 
       
   267         /**
       
   268         * C++ default constructor.
       
   269         */
       
   270         ChspsResource();
       
   271 
       
   272         /**
       
   273         * By default Symbian 2nd phase constructor is private.
       
   274         */
       
   275         void ConstructL();
       
   276 
       
   277     private:     // Data
       
   278         
       
   279         // Not used?
       
   280         ThspsLockingPolicy iLockingPolicy;
       
   281         
       
   282         // Resource type
       
   283         ThspsResourceType iResourceType;
       
   284         
       
   285         // Language of the resource
       
   286         TLanguage iLanguage;
       
   287         
       
   288         // Identifies the configuration that owns the resource
       
   289         TInt iConfigurationUid;
       
   290         
       
   291         // Filename without the extension
       
   292         HBufC* iResourceID;
       
   293         
       
   294         // Full path and name
       
   295         HBufC* iFileName;
       
   296                 
       
   297         TDataType iMimeType;
       
   298         
       
   299         // Tags seperated with a colon
       
   300         HBufC* iTags;
       
   301 
       
   302          // Reserved pointer for future extension
       
   303         TAny* iReserved;
       
   304     };
       
   305 
       
   306 #endif      // hspsRESOURCE_H   
       
   307 // End of File