1 #ifndef ERRORMAPPER_H_
\r
2 #define ERRORMAPPER_H_
\r
7 //! BusinessLogic class. Map error codes to error strings.
\r
9 * BusinessLogic class. Map error codes to error strings. The code-string pairs are defined in XML-file
\r
10 * which is read by the mapper at initialization and stored in a QMap. The class has only one public
\r
11 * static method which provides access to the code-string table, there is a static instance used but this
\r
12 * is transparent for the caller.
\r
18 //! Gets the error string of the specified error code.
\r
20 * Gets the error string of the specified error code.
\r
21 * \param aCode The code to which the string must be got.
\r
22 * \param aAddInfo Possible additional info.
\r
23 * \return The string pair of the specified code, if found; otherwise, empty string.
\r
25 static QString codeToString( int aCode, const QString &aAddInfo = "" );
\r
30 * Constructor to initialize an ErrorMapper instance.
\r
34 virtual ~ErrorMapper();
\r
36 //! Loads to code-string pairs.
\r
38 * Loads to code-string pairs from XML-file to a QMap object.
\r
39 * \param aXml The XML-file which contains the error table.
\r
41 void mapFromXML( const QString &aXml );
\r
45 * The static instance which is in use to load and store the code-string pairs.
\r
47 static ErrorMapper *sInstance;
\r
48 static QString sNotValidErrorCode;
\r
50 QMap<int, QString> iErrorTable;
\r
54 #endif /*ERRORMAPPER_H_*/
\r