e32tools/elf2e32/source/errorhandler.h
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Error Handler Classes for elf2e32 tool
       
    15 // @internalComponent
       
    16 // @released
       
    17 // 
       
    18 //
       
    19 
       
    20 
       
    21 #ifndef _ERROR_HANDLER_
       
    22 #define _ERROR_HANDLER_
       
    23 
       
    24 #include "messagehandler.h"
       
    25 #include <list>
       
    26 #include <string>
       
    27 
       
    28 using std::list;
       
    29 typedef std::string String;
       
    30 
       
    31 /**
       
    32 Base class from which all other error handler classes are derived from.
       
    33 @internalComponent
       
    34 @released
       
    35 */
       
    36 class ErrorHandler
       
    37 {
       
    38 	public:
       
    39 		ErrorHandler(int aMessageIndex);
       
    40 		virtual ~ErrorHandler();
       
    41 		virtual void Report() =0;
       
    42 
       
    43 		String iMessage;
       
    44 		int iMessageIndex;
       
    45 };
       
    46 
       
    47 /**
       
    48 Base class for File Errors.
       
    49 @internalComponent
       
    50 @released
       
    51 */
       
    52 class FileError : public ErrorHandler
       
    53 {
       
    54 	public:
       
    55 		FileError(int aMessageIndex, char * aName);
       
    56 		virtual ~FileError();
       
    57 		void Report();
       
    58 
       
    59 		String iName;
       
    60 };
       
    61 
       
    62 /**
       
    63 Base class for ELFFormat Errors.
       
    64 @internalComponent
       
    65 @released
       
    66 */
       
    67 class ELFFormatError : public ErrorHandler
       
    68 {
       
    69 	public:
       
    70 		ELFFormatError(int aMessageIndex, char * aName);
       
    71 		virtual ~ELFFormatError();
       
    72 		void Report();
       
    73 
       
    74 		String iName;
       
    75 };
       
    76 
       
    77 /**
       
    78 Base class for DEF File Errors.
       
    79 @internalComponent
       
    80 @released
       
    81 */
       
    82 class DEFFileError : public ErrorHandler
       
    83 {
       
    84 	public:
       
    85 		DEFFileError(int aMessageIndex, char * aName, int aLineNo,char * aToken);
       
    86 		virtual ~DEFFileError();
       
    87 		void Report();
       
    88 
       
    89 		String iName;
       
    90 		int iLineNo;
       
    91 		String iToken;
       
    92 };
       
    93 
       
    94 /**
       
    95 Base class for Parameter Parser Errors.
       
    96 @internalComponent
       
    97 @released
       
    98 */
       
    99 class ParameterParserError : public ErrorHandler
       
   100 {
       
   101 	public:
       
   102 		ParameterParserError(int aMessageIndex, char * aName);
       
   103 		virtual ~ParameterParserError();
       
   104 		void Report();
       
   105 
       
   106 		String iName;
       
   107 };
       
   108 
       
   109 /**
       
   110 Class for Invalid Argument Errors.
       
   111 @internalComponent
       
   112 @released
       
   113 */
       
   114 class InvalidArgumentError : public ErrorHandler
       
   115 {
       
   116 	public:
       
   117 		InvalidArgumentError(int aMessageIndex, const char * aValue, char * aOption);
       
   118 		virtual ~InvalidArgumentError();
       
   119 		void Report();
       
   120 
       
   121 		String iValue;
       
   122 		String iOption;
       
   123 };
       
   124 
       
   125 /**
       
   126 Base class for E32Image Compression Errors.
       
   127 @internalComponent
       
   128 @released
       
   129 */
       
   130 class E32ImageCompressionError : public ErrorHandler
       
   131 {
       
   132 	public:
       
   133 		E32ImageCompressionError(int aMessageIndex);
       
   134 		virtual ~E32ImageCompressionError();
       
   135 		void Report();
       
   136 };
       
   137 
       
   138 /**
       
   139 Base class for Capability Errors.
       
   140 @internalComponent
       
   141 @released
       
   142 */
       
   143 class CapabilityError : public ErrorHandler
       
   144 {
       
   145 	public:
       
   146 		CapabilityError(int aMessageIndex);
       
   147 		virtual ~CapabilityError();
       
   148 		void Report();
       
   149 };
       
   150 
       
   151 /**
       
   152 Class for handling Unrecognised Capability Errors.
       
   153 @internalComponent
       
   154 @released
       
   155 */
       
   156 class UnrecognisedCapabilityError : public CapabilityError
       
   157 {
       
   158 	public:
       
   159 		UnrecognisedCapabilityError(int aMessageIndex, char * aName);
       
   160 		~UnrecognisedCapabilityError();
       
   161 		void Report();
       
   162 
       
   163 		String iName;
       
   164 };
       
   165 
       
   166 /**
       
   167 Base class for ELF File Errors.
       
   168 @internalComponent
       
   169 @released
       
   170 */
       
   171 class ELFFileError : public ErrorHandler
       
   172 {
       
   173 	public:
       
   174 		ELFFileError(int aMessageIndex, const char * aName);
       
   175 		virtual ~ELFFileError();
       
   176 		void Report();
       
   177 
       
   178 		String iName;
       
   179 };
       
   180 
       
   181 /**
       
   182 Class for handling Undefined Symbol Errors.
       
   183 @internalComponent
       
   184 @released
       
   185 */
       
   186 class UndefinedSymbolError : public ELFFileError
       
   187 {
       
   188 public:
       
   189 	UndefinedSymbolError(int aMessageIndex, char * aName, char *aSymbolName);
       
   190 	~UndefinedSymbolError();
       
   191 	void Report();
       
   192 
       
   193 	String iSymbolName;
       
   194 };
       
   195 
       
   196 /**
       
   197 Class for handling Import relocation to Data segment
       
   198 @internalComponent
       
   199 @released
       
   200 */
       
   201 class ImportRelocationError : public ELFFileError
       
   202 {
       
   203 public:
       
   204 	ImportRelocationError(int aMessageIndex, char * aName, char *aSymbolName);
       
   205 	~ImportRelocationError();
       
   206 	void Report();
       
   207 
       
   208 	String iSymbolName;
       
   209 };
       
   210 
       
   211 /**
       
   212 Class for handling Symbol Missing From Elf Errors.
       
   213 @internalComponent
       
   214 @released
       
   215 */
       
   216 class SymbolMissingFromElfError : public ELFFileError
       
   217 {
       
   218 	public:
       
   219 		SymbolMissingFromElfError(int aMessageIndex, list<String> &aSymbolList, const char * aName);
       
   220 		virtual ~SymbolMissingFromElfError();
       
   221 		void Report();
       
   222 
       
   223 		String iSymbolNames;
       
   224 };
       
   225 
       
   226 /**
       
   227 Class for handling Memory Allocation Errors.
       
   228 @internalComponent
       
   229 @released
       
   230 */
       
   231 class MemoryAllocationError : public ErrorHandler
       
   232 {
       
   233 	public:
       
   234 		MemoryAllocationError(int aMessageIndex, char * aName);
       
   235 		virtual ~MemoryAllocationError();
       
   236 		void Report();
       
   237 
       
   238 		String iName;
       
   239 };
       
   240 
       
   241 /**
       
   242 Class for handling E32 Image Errors.
       
   243 @internalComponent
       
   244 @released
       
   245 */
       
   246 class E32ImageError : public ErrorHandler
       
   247 {
       
   248 public:
       
   249 	E32ImageError(int aMessageIndex);
       
   250 	~E32ImageError();
       
   251 	void Report();
       
   252 };
       
   253 
       
   254 /**
       
   255 Class for handling Invalid Invocation Errors.
       
   256 @internalComponent
       
   257 @released
       
   258 */
       
   259 class InvalidInvocationError : public ErrorHandler
       
   260 {
       
   261 public:
       
   262 	InvalidInvocationError(int aMessageIndex);
       
   263 	~InvalidInvocationError();
       
   264 	void Report();
       
   265 };
       
   266 
       
   267 /**
       
   268 Base class for handling Target Type Errors.
       
   269 @internalComponent
       
   270 @released
       
   271 */
       
   272 class TargetTypeError : public ErrorHandler
       
   273 {
       
   274 public:
       
   275 	TargetTypeError(int aMessageIndex);
       
   276 	~TargetTypeError();
       
   277 	void Report();
       
   278 };
       
   279 
       
   280 /**
       
   281 Class for handling Unsupported Target Type Errors.
       
   282 @internalComponent
       
   283 @released
       
   284 */
       
   285 class UnsupportedTargetTypeError : public TargetTypeError
       
   286 {
       
   287 public:
       
   288 	UnsupportedTargetTypeError(int aMessageIndex, char * aName);
       
   289 	~UnsupportedTargetTypeError();
       
   290 	void Report();
       
   291 
       
   292 	String iName;
       
   293 };
       
   294 
       
   295 /**
       
   296 Class for handling Message Errors.
       
   297 @internalComponent
       
   298 @released
       
   299 */
       
   300 class MessageError : public ErrorHandler
       
   301 {
       
   302 public:
       
   303 	MessageError(int aMessageIndex, int aIndexValue);
       
   304 	~MessageError();
       
   305 	void Report();
       
   306 
       
   307 	int iIndexValue;
       
   308 };
       
   309 
       
   310 /**
       
   311 Class for handling No Message File Errors.
       
   312 @internalComponent
       
   313 @released
       
   314 */
       
   315 class NoMessageFileError : public ErrorHandler
       
   316 {
       
   317 public:
       
   318 	NoMessageFileError(int aMessageIndex);
       
   319 	~NoMessageFileError();
       
   320 	void Report();
       
   321 };
       
   322 
       
   323 /**
       
   324 Class for handling Symbol that are passed through --sysdef 
       
   325 not matching with the ones in the DEF file.
       
   326 @internalComponent
       
   327 @released
       
   328 */
       
   329 class SysDefMismatchError : public ErrorHandler
       
   330 {
       
   331 	public:
       
   332 		SysDefMismatchError(int aMessageIndex, list<String> &aSymbolList, const char * aName);
       
   333 		virtual ~SysDefMismatchError();
       
   334 		void Report();
       
   335 
       
   336 		String iName;
       
   337 		String iSymbolNames;
       
   338 };
       
   339 
       
   340 /**
       
   341 Class for handling Invalid E32 Image Error
       
   342 @internalComponent
       
   343 @released
       
   344 */
       
   345 class InvalidE32ImageError : public ErrorHandler
       
   346 {
       
   347 	public:
       
   348 		InvalidE32ImageError(int aMessageIndex, char * aName);
       
   349 		virtual ~InvalidE32ImageError();
       
   350 		void Report();
       
   351 
       
   352 		String iName;
       
   353 };
       
   354 
       
   355 #endif
       
   356