qtmeetings sources to Maemo garage
[qtmeetings] / src / BusinessLogic / Utils / ErrorMapper.h
1 #ifndef ERRORMAPPER_H_\r
2 #define ERRORMAPPER_H_\r
3 \r
4 #include <QString>\r
5 #include <QMap>\r
6 \r
7 //! BusinessLogic class. Map error codes to error strings.\r
8 /*!\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
13  */\r
14 class ErrorMapper\r
15 {\r
16 \r
17 public:\r
18         //! Gets the error string of the specified error code.\r
19         /*!\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
24          */\r
25         static QString codeToString( int aCode, const QString &aAddInfo = "" );\r
26 \r
27 private:\r
28         //! Constructor.\r
29         /*!\r
30          * Constructor to initialize an ErrorMapper instance.\r
31          */\r
32         ErrorMapper();\r
33         //! Destructor.\r
34         virtual ~ErrorMapper();\r
35 \r
36         //! Loads to code-string pairs.\r
37         /*!\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
40          */\r
41         void mapFromXML( const QString &aXml );\r
42 \r
43 private:\r
44         /*!\r
45          * The static instance which is in use to load and store the code-string pairs.\r
46          */\r
47         static ErrorMapper *sInstance;\r
48         static QString sNotValidErrorCode;\r
49 \r
50         QMap<int, QString> iErrorTable;\r
51 \r
52 };\r
53 \r
54 #endif /*ERRORMAPPER_H_*/\r