mpserviceplugins/inc/mpxresource.h
changeset 19 4e84c994a771
equal deleted inserted replaced
5:2a40e88564c8 19:4e84c994a771
       
     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:  This class provide API to read resource from resource file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMPXRESOURCE_H
       
    20 #define CMPXRESOURCE_H
       
    21 
       
    22 //INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <badesca.h>
       
    25 #include <barsc.h>
       
    26 
       
    27 // CLASS DECLARATION
       
    28 
       
    29 /**
       
    30 *  Resource class
       
    31 *  Singleton for one thread
       
    32 */
       
    33 class CMPXResource : public CBase
       
    34     {
       
    35     public: // Factory and Release
       
    36 
       
    37         /**
       
    38         * Factory function, create the object.
       
    39         * Note that calls to this must be matched with a call to Release().
       
    40         *
       
    41         * @param aResourceFile the resource file
       
    42         *        In order to support installation of individual plugin.
       
    43         *        aResourceFile must be a final name, including full file path.
       
    44         *        All parse should be done in the plugin side.
       
    45         *
       
    46         * @return the resource object pointer
       
    47         */
       
    48         IMPORT_C static CMPXResource* NewL(const TDesC& aResourceFile);
       
    49 
       
    50         /**
       
    51         * Factory function, create the object.
       
    52         * Note that calls to this must be matched with a call to Release().
       
    53         * @param aResourceFile the resource file
       
    54         *        In order to support installation of individual plugin.
       
    55         *        aResourceFile must be a final name, including full file path.
       
    56         *        All parse should be done in the plugin side.
       
    57         *
       
    58         * @return the resource object pointer
       
    59         */
       
    60         IMPORT_C static CMPXResource* NewLC(const TDesC& aResourceFile);
       
    61 
       
    62         /**
       
    63         * Decrements the reference count, and delete the object if it is 0
       
    64         */
       
    65         IMPORT_C void Release();
       
    66 
       
    67     public: // New functions
       
    68 
       
    69         /**
       
    70         * Read array of descriptors
       
    71         * @param aResourceId resource id
       
    72         * @return array of descriptors. Ownership is abandoned.
       
    73         */
       
    74         IMPORT_C CDesCArrayFlat* ReadDesCArrayL(TInt aResourceId);
       
    75 
       
    76         /**
       
    77         * Read array of descriptors
       
    78         * @param aResourceId resource id
       
    79         * @return array of descriptors. Ownership is abandoned.
       
    80         */
       
    81         IMPORT_C CDesCArrayFlat* ReadDesCArrayLC(TInt aResourceId);
       
    82 
       
    83         /**
       
    84         * Get a heap descriptor from the resource file
       
    85         * @param aResourceId resource id
       
    86         * @return pointer to the heap descriptor.  Ownership is abandoned.
       
    87         */
       
    88         IMPORT_C HBufC* ReadHBufCL(TInt aResourceId);
       
    89 
       
    90         /**
       
    91         * Read array of menu items
       
    92         * @param aResourceId resource id
       
    93         * @param aIdArray array of Id within the specified resource
       
    94         * @return array of descriptors
       
    95         */
       
    96         IMPORT_C CDesCArrayFlat* ReadMenuArrayL(TInt aResourceId, RArray<TInt>& aIdArray);
       
    97 
       
    98         /**
       
    99         * Read array of menu items
       
   100         * @param aResourceId resource id
       
   101         * @param aIdArray array of Id within the specified resource
       
   102         * @return array of descriptors
       
   103         */
       
   104         IMPORT_C CDesCArrayFlat* ReadMenuArrayLC(TInt aResourceId, RArray<TInt>& aIdArray);
       
   105 
       
   106 
       
   107     private:
       
   108 
       
   109         /**
       
   110         * C++ constructor.
       
   111         */
       
   112         CMPXResource();
       
   113 
       
   114         /**
       
   115         * By default Symbian 2nd phase constructor is private.
       
   116         */
       
   117         void ConstructL(const TDesC& aResourceFile);
       
   118 
       
   119         /**
       
   120         * Don't allow users to delete this object
       
   121         * Release has to be called
       
   122         */
       
   123         virtual ~CMPXResource();
       
   124 
       
   125 
       
   126     private: // Data
       
   127         // Member variables
       
   128         RFs               iFs;
       
   129         RResourceFile     iResourceFile;
       
   130     };
       
   131 
       
   132 #endif // CMPXRESOURCE_H
       
   133 
       
   134 // End of File