landmarks/locationlandmarks/internalservices/inc/EPos_CPosLmResourceReader.h
changeset 0 667063e416a2
equal deleted inserted replaced
-1:000000000000 0:667063e416a2
       
     1 /*
       
     2 * Copyright (c) 2005 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: Simplified interface to resource files
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CPOSLMRESOURCEREADER_H
       
    21 #define CPOSLMRESOURCEREADER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <barsc.h>
       
    26 #include <barsread.h>
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 /**
       
    33 *  Simplified interface to resource files
       
    34 */
       
    35 class CPosLmResourceReader : public CBase
       
    36     {
       
    37     public:     // Constructors and destructor
       
    38 
       
    39         /**
       
    40         * Two-phased constructor.
       
    41         * @param aPath Path to the resource file (excluding drive).
       
    42         */
       
    43         IMPORT_C static CPosLmResourceReader* NewLC(
       
    44         /* IN  */       const TDesC& aPath
       
    45         );
       
    46 
       
    47         /**
       
    48         * Destructor.
       
    49         */
       
    50         IMPORT_C virtual ~CPosLmResourceReader();
       
    51 
       
    52     public:     // New functions
       
    53 
       
    54         /**
       
    55         * Reads a string from the currently loaded resource.
       
    56         *
       
    57         * @param aResourceId Resource id to read from. The function leaves if
       
    58         *   there is no matching resource or the offset does not match.
       
    59         * @return A heap-allocated string.
       
    60         */
       
    61         IMPORT_C HBufC* ReadHBufCL(
       
    62         /* IN  */      TInt aResourceId
       
    63         );
       
    64 
       
    65         /**
       
    66         * Reads an TInt/integer from the currently loaded resource.
       
    67         *
       
    68         * @param aResourceId Resource id to read from. The function leaves if
       
    69         *   there is no matching resource or the offset does not match.
       
    70         * @return An integer.
       
    71         */
       
    72         IMPORT_C TInt ReadInt16L(
       
    73         /* IN  */      TInt aResourceId
       
    74         );
       
    75 
       
    76         /**
       
    77         * Reads an TInt/integer from the currently loaded resource.
       
    78         *
       
    79         * @param aResourceId Resource id to read from. The function leaves if
       
    80         *   there is no matching resource or the offset does not match.
       
    81         * @return An integer.
       
    82         */
       
    83         IMPORT_C TInt ReadInt32L(
       
    84         /* IN  */      TInt aResourceId
       
    85         );
       
    86 
       
    87     protected: // New functions
       
    88 
       
    89         /**
       
    90         * Loads a resource from the resource file into the buffer.
       
    91         *
       
    92         * @param aResourceId Id of the resource to be loaded.
       
    93         */
       
    94         IMPORT_C void LoadResourceL(
       
    95         /* IN  */       TInt aResourceId
       
    96         );
       
    97 
       
    98     private:
       
    99 
       
   100         /**
       
   101         * C++ default constructor.
       
   102         */
       
   103         CPosLmResourceReader();
       
   104 
       
   105         /**
       
   106         * By default Symbian 2nd phase constructor is private.
       
   107         * @param aPath Path to the resource file (excluding drive).
       
   108         */
       
   109         void ConstructL(
       
   110         /* IN  */   const TDesC& aPath
       
   111         );
       
   112 
       
   113         // By default, prohibit copy constructor
       
   114         CPosLmResourceReader( const CPosLmResourceReader& );
       
   115         // Prohibit assigment operator
       
   116         CPosLmResourceReader& operator= ( const CPosLmResourceReader& );
       
   117 
       
   118     private:    // Data
       
   119 
       
   120         RFs             iFileSession;
       
   121         RResourceFile   iResourceFile;
       
   122         HBufC8*         iResourceBuffer;
       
   123         TResourceReader iResourceReader;
       
   124     };
       
   125 
       
   126 #endif      // CPOSLMRESOURCEREADER_H
       
   127 
       
   128 // End of File