S60 3rd Edition API Reference: textresolver.h Source File

textresolver.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name        : TextResolver.h
00004 *  Part of     : Common Services / Common Engine
00005 *  Interface   : SDK, Text Resolver API
00006 *  Description : Offers functionality for resolving corresponding error texts
00007 *                for error codes. 
00008 *  Version     : %version: ou1cfspd#16 %
00009 *
00010 *  Copyright © 2002-2006 Nokia. All rights reserved.
00011 *  This material, including documentation and any related 
00012 *  computer programs, is protected by copyright controlled by 
00013 *  Nokia. All rights are reserved. Copying, including 
00014 *  reproducing, storing, adapting or translating, any 
00015 *  or all of this material requires the prior written consent of 
00016 *  Nokia. This material also contains confidential 
00017 *  information which may not be disclosed to others without the 
00018 *  prior written consent of Nokia.
00019 * ============================================================================
00020 */
00021 
00022 
00023 #if !defined TEXT_RESOLVER_H
00024 #define TEXT_RESOLVER_H
00025 
00026 #include <coemain.h>    //  CCoeEnv
00027 #include <TextResolver.hrh> // Resource flags 
00028 
00029 // DEFINES
00030 typedef CArrayFixFlat<TInt> CErrorResourceIdArray;
00031 typedef CArrayFixFlat<TInt> CErrorResourceFlagArray;
00032 
00134 class CTextResolver : public CBase
00135     {
00136 
00137     public:
00138 
00145         enum TErrorContext
00146             {
00151             ECtxAutomatic = 0,
00155             ECtxNoCtx = 1,
00159             ECtxNoCtxNoSeparator = 2
00160             };
00161     public:
00171         IMPORT_C static CTextResolver* NewL(CCoeEnv& aEnv);
00172            
00182         IMPORT_C static CTextResolver* NewLC(CCoeEnv& aEnv);
00183         
00191         IMPORT_C static CTextResolver* NewL();
00192 
00200         IMPORT_C static CTextResolver* NewLC();
00201 
00202         
00206         IMPORT_C ~CTextResolver();
00207 
00227                 IMPORT_C const TDesC& ResolveErrorString(
00228              TInt aError,
00229              TInt& aTextId,
00230              TUint& aFlags,
00231              TErrorContext aContext = ECtxAutomatic);
00232 
00249             IMPORT_C const TDesC& ResolveErrorString(
00250              TInt aError,
00251              TErrorContext aContext = ECtxAutomatic);
00252 
00253         private:
00254         
00255         virtual TInt ResourceForError(TInt aError);
00256         virtual void LoadResourceFilesL();
00257 
00258         // Construction
00259         CTextResolver(CCoeEnv& aEnv);
00260         CTextResolver();
00261         void ConstructL();
00262 
00263         // Utility
00264         void FindFullPathOfResourceFile(TFileName& aResFile) const;
00265         void ReadResourcesToArraysL(TInt& aError, TInt& aTextId);
00266         void Reset();
00267         void PrepareReaderLC(TResourceReader& reader);
00268 
00269         // returns NULL if fails
00270         HBufC* ReadUnicodeString(const TInt& aTextId);
00271 
00272         // returns false if any memory allocation fails or initial values 
00273         // of necessary pointers are NULL, indicating alloc failure earlier.
00274         TBool AddContextAndSeparator(TErrorContext aContext);
00275 
00276     private:
00277         
00278         CCoeEnv*                            iCoe;
00279         RResourceFile                       iRFile;
00280         TInt                                iRDSupport;
00281         TInt                                iBaseResourceFileOffset;
00282         CArrayFix<TInt>*                    iStartError;
00283         CArrayFix<TInt>*                    iAppTexts;
00284         CArrayPtr<CErrorResourceIdArray>*   iErrorTexts;
00285         CArrayPtr<CErrorResourceFlagArray>* iFlags;
00286         HBufC*                              iTextBuffer;
00287         HBufC*                              iAppNameText;
00288         HBufC*                              iContextSeparator;
00289         RFs                                 iFs;
00290         TPtrC                               iTruncatedTextPointer;
00291     };
00292 
00293 #endif
00294 
00295 // Enf of File

Copyright © Nokia Corporation 2001-2007
Back to top