Merge pull request #4324 from FernetMenta/wasapi
[vuplus_xbmc] / lib / UnrarXLib / errhnd.hpp
1 #ifndef _RAR_ERRHANDLER_
2 #define _RAR_ERRHANDLER_
3
4 #if (defined(GUI) || !defined(_WIN_32)) && !defined(SFX_MODULE) && !defined(_WIN_CE) || defined(RARDLL)
5 #define ALLOW_EXCEPTIONS
6 #endif
7
8
9
10 #define rarmalloc malloc
11 #define rarcalloc calloc
12 #define rarrealloc realloc
13 #define rarfree free
14 #define rarstrdup strdup
15
16
17
18 enum { SUCCESS,WARNING,FATAL_ERROR,CRC_ERROR,LOCK_ERROR,WRITE_ERROR,
19        OPEN_ERROR,USER_ERROR,MEMORY_ERROR,CREATE_ERROR,USER_BREAK=255};
20
21 class ErrorHandler
22 {
23   private:
24     void ErrMsg(const char *ArcName,const char *fmt,...);
25
26     int ExitCode;
27     int ErrCount;
28     bool EnableBreak;
29     bool Silent;
30     bool DoShutdown;
31   public:
32     ErrorHandler();
33     void Clean();
34     void MemoryError();
35     void OpenError(const char *FileName);
36     void CloseError(const char *FileName);
37     void ReadError(const char *FileName);
38     bool AskRepeatRead(const char *FileName);
39     void WriteError(const char *ArcName,const char *FileName);
40     void WriteErrorFAT(const char *FileName);
41     bool AskRepeatWrite(const char *FileName);
42     void SeekError(const char *FileName);
43     void MemoryErrorMsg();
44     void OpenErrorMsg(const char *FileName);
45     void OpenErrorMsg(const char *ArcName,const char *FileName);
46     void CreateErrorMsg(const char *FileName);
47     void CreateErrorMsg(const char *ArcName,const char *FileName);
48     void ReadErrorMsg(const char *ArcName,const char *FileName);
49     void WriteErrorMsg(const char *ArcName,const char *FileName);
50     void Exit(int ExitCode);
51     void SetErrorCode(int Code);
52     int GetErrorCode() {return(ExitCode);}
53     int GetErrorCount() {return(ErrCount);}
54     void SetSignalHandlers(bool Enable);
55     void Throw(int Code);
56     void SetSilent(bool Mode) {Silent=Mode;};
57     void SetShutdown(bool Mode) {DoShutdown=Mode;};
58     void SysErrMsg();
59 };
60
61 #endif