|
1 /* |
|
2 * Copyright (c) 2006-2009 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 the License "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: |
|
15 * Message Implementation Class for FileSystem tool |
|
16 * @internalComponent |
|
17 * @released |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 #ifndef MESSAGEIMPLEMENTATION_H |
|
24 #define MESSAGEIMPLEMENTATION_H |
|
25 |
|
26 #ifdef _MSC_VER |
|
27 #pragma warning(disable: 4514) // unreferenced inline function has been removed |
|
28 #pragma warning(disable: 4702) // unreachable code |
|
29 #pragma warning(disable: 4710) // function not inlined |
|
30 #pragma warning(disable: 4786) // identifier was truncated to '255' characters in the debug information |
|
31 #pragma warning(disable: 4103) // used #pragma pack to change alignment |
|
32 #endif |
|
33 |
|
34 #include <map> |
|
35 #include <string> |
|
36 #include <stdarg.h> |
|
37 |
|
38 typedef std::map<int,char*> Map; |
|
39 typedef std::string String; |
|
40 |
|
41 enum |
|
42 { |
|
43 ERROR = 0, |
|
44 WARNING, |
|
45 INFORMATION |
|
46 }; |
|
47 /** |
|
48 To include more error or warning messages, Just include the key word here and |
|
49 write the key word contents into the Message array at ".cpp" file. |
|
50 Then increase the Message array size by number of messages included |
|
51 */ |
|
52 enum |
|
53 { FILEOPENERROR = 1, |
|
54 FILEREADERROR, |
|
55 FILEWRITEERROR, |
|
56 MEMORYALLOCATIONERROR, |
|
57 ENTRYCREATEMSG, |
|
58 BOOTSECTORERROR, |
|
59 BOOTSECTORCREATEMSG, |
|
60 BOOTSECTORWRITEMSG, |
|
61 FATTABLEWRITEMSG, |
|
62 IMAGESIZETOOBIG, |
|
63 NOENTRIESFOUND, |
|
64 EMPTYFILENAME, |
|
65 EMPTYSHORTNAMEERROR, |
|
66 CLUSTERERROR, |
|
67 ROOTNOTFOUND, |
|
68 UNKNOWNERROR |
|
69 }; |
|
70 |
|
71 |
|
72 /** |
|
73 Abstract base Class for Message Implementation. |
|
74 |
|
75 @internalComponent |
|
76 @released |
|
77 */ |
|
78 class Message |
|
79 { |
|
80 public: |
|
81 virtual ~Message(){}; |
|
82 // get error string from message file |
|
83 virtual char * GetMessageString(int errorIndex)=0; |
|
84 // display message to output device |
|
85 virtual void Output(const char *aName) =0; |
|
86 // start logging to a file |
|
87 virtual void StartLogging(char *fileName)=0; |
|
88 virtual void ReportMessage(int aMsgType, int aMsgIndex,...)=0; |
|
89 virtual void InitializeMessages()=0; |
|
90 }; |
|
91 |
|
92 /** |
|
93 Class for Message Implementation. |
|
94 |
|
95 @internalComponent |
|
96 @released |
|
97 */ |
|
98 class MessageImplementation : public Message |
|
99 { |
|
100 public: |
|
101 MessageImplementation(); |
|
102 ~MessageImplementation(); |
|
103 |
|
104 //override base class methods |
|
105 char* GetMessageString(int errorIndex); |
|
106 void Output(const char *aName); |
|
107 void LogOutput(const char *aString); |
|
108 void StartLogging(char *fileName); |
|
109 void ReportMessage(int aMsgType, int aMsgIndex,...); |
|
110 void InitializeMessages(); |
|
111 private: |
|
112 |
|
113 bool iLogging; |
|
114 char* iLogFileName; |
|
115 FILE *iLogPtr; |
|
116 Map iMessage; |
|
117 }; |
|
118 |
|
119 /** |
|
120 Structure for Messages. |
|
121 |
|
122 @internalComponent |
|
123 @released |
|
124 */ |
|
125 struct EnglishMessage |
|
126 { |
|
127 int index; |
|
128 char message[1024]; |
|
129 }; |
|
130 |
|
131 #endif //MESSAGEIMPLEMENTATION_H |