The type of interface of this component is method call.
All functionality is implemented in the CTextResolver class.
Text Resolver is used to get corresponding error text for an error code. Error codes to be resolved are defined by subsystems that need error resolving capabilities. Also standard Symbian error codes can be resolved.
The user needs to first create an instance of Text Resolver by using one of the NewL methods. If the CCoeEnv instance is passed as a parameter, the component will use it to access the resource files; otherwise, the RResourceFile API is used.
After the creation, the user can call ResolveError() to check if the error has an explanation defined in the resource file. After use, the instance of Text Resolver has to be deleted.
See the Example section below for sample code.
For unknown errors ETextResolverBlankErrorFlag flag is set to hide errors without proper explanation. If an error with ETextResolverPanicErrorFlag flag is resolved, Text Resolver will panic. See the Usage of the flags (defined in textresolver.hrh) table in the List of constants and enums section for more detailed flag usage. Also “System error” (in English localisation) is returned when error code is not known.
Sample code:
#include <textresolver.h> // Construction of an CTextResolver instance: CTextResolver* iTextResolver = CTextResolver::NewLC(*iCoeEnv); // Get error code TInt err = MyMethod(KInvalidValue); // Error Resolving, Simple: TPtrC buf; if (err != KErrNone) buf.Set(iTextResolver->ResolveErrorString(err)); // Note that buf will only be valid as long as CTextResolver // instance is alive and no new error is resolved by the same instance. // If for some reason you need to store the resolved error // beyond immediate use, make a copy of it. // Error Resolving, Advanced: TInt textId; TUint flags; TPtrC buf; if (err != KErrNone) buf.Set(iTextResolver-> ResolveErrorString(err, textId, flags)); CleanupStack::PopAndDestroy(); // iTextResolver, Free loaded resources
The interface of the Text Resolver component is described in more detail in this chapter.
An interface class for the Text Resolver component.
This factory method creates a new instance of CTextResolver. The implementation uses the passed CCoeEnv instance to access the resource files.
Parameters:
Type | Name | Description |
CCoeEnv& | aEnv | The CCoeEnv instance to be used to access the resource files. |
The return value:
The operation returns a pointer to an instance of the new CTextResolver class.
This factory method creates a new instance of CTextResolver. The implementation uses the passed CCoeEnv instance to access the resource files. Leaves the object on the cleanup stack.
Parameters:
Type | Name | Description |
CCoeEnv& | aEnv | The CCoeEnv instance to be used to access the resource files. |
The return value:
The operation returns a pointer to an instance of the new CTextResolver class.
This factory method creates a new instance of CTextResolver. Resource files are accessed through the RResourceFile API.
The return value:
The operation returns a pointer to an instance of the new CTextResolver class.
This factory method creates a new instance of CTextResolver. Leaves the object on the cleanup stack. Resource files are accessed through the RResourceFile API.
The return value:
The operation returns a pointer to an instance of the new CTextResolver class.
The destructor. Performs all necessary cleanups.
Resolves the given error code and returns the resolved text.
Parameters:
Type | Name | Description |
TInt& | aError | The error code to be resolved. |
TInt& | aTextId | ID of the returned text. |
TUint& | aFlags | Priority of the returned error. The priority is defined by the Text Resolver component. See the Usage of the flags (defined in textresolver.hrh) table in the List of constants and enums section. |
TErrorContext | aContext = ECtxAutomatic | Optional context for error numbers. If the aContext parameter is not passed to the function, it uses the default value ECtxAutomatic. See the Error contexts table in the List of constants and enums section. |
The return value:
The operation returns the error text for the resolved error. “System error” (in English localisation) is returned when error code is not known. For unknown errors blank error flag is also set to hide errors without proper explanation. There is no limit on how long the resolved string can be.
Resolves the given error code and returns the resolved text.
Parameters:
Type | Name | Description |
TInt& | aError | The error code to be resolved. |
TErrorContext | aContext = ECtxAutomatic | Optional context for error numbers. If the aContext parameter is not passed to the function, it uses the default value ECtxAutomatic. See the Error contexts table in the List of constants and enums section.. |
The return value:
The operation returns the error text for the resolved error. “System error” (in English localisation) is returned when error code is not known. For unknown errors blank error flag is also set to hide errors without proper explanation. There is no limit on how long the resolved string can be.
The interface is accessed through the textresolver.H file. The binaries are linked to the commonengine.DLL library.