forked from daynix/UsbDk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exception.h
87 lines (73 loc) · 2.56 KB
/
Exception.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**********************************************************************
* Copyright (c) 2013-2014 Red Hat, Inc.
*
* Developed by Daynix Computing LTD.
*
* Authors:
* Dmitry Fleytman <[email protected]>
* Pavel Gurvich <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************/
#pragma once
#include "tstrings.h"
using std::exception;
class UsbDkException : public exception
{
public:
UsbDkException();
UsbDkException(LPCTSTR lpzMessage);
UsbDkException(const tstring &Message);
UsbDkException(const UsbDkException &Other);
virtual ~UsbDkException();
virtual const char *what() const;
virtual LPCTSTR twhat() const;
protected:
void SetMessage(const tstring &Message);
private:
tstring m_Message;
string m_MBCSMessage;
};
class UsbDkNumErrorException : public UsbDkException
{
public:
UsbDkNumErrorException(LPCTSTR lpzDescription, DWORD dwErrorCode);
UsbDkNumErrorException(const tstring &Description, DWORD dwErrorCode);
UsbDkNumErrorException(const UsbDkNumErrorException& Other);
DWORD GetErrorCode(void) const { return m_dwErrorCode; }
protected:
DWORD m_dwErrorCode;
};
class UsbDkCRTErrorException : public UsbDkNumErrorException
{
public:
UsbDkCRTErrorException(int nErrorCode = errno);
UsbDkCRTErrorException(LPCTSTR lpzDescription, int nErrorCode = errno);
UsbDkCRTErrorException(const tstring &Description, int nErrorCode = errno);
UsbDkCRTErrorException(const UsbDkCRTErrorException &Other);
protected:
static tstring GetErrorString(DWORD dwErrorCode);
};
#ifdef WIN32
class UsbDkW32ErrorException : public UsbDkNumErrorException
{
public:
UsbDkW32ErrorException(DWORD dwErrorCode = GetLastError());
UsbDkW32ErrorException(LPCTSTR lpzDescription, DWORD dwErrorCode = GetLastError());
UsbDkW32ErrorException(const tstring &Description, DWORD dwErrorCode = GetLastError());
UsbDkW32ErrorException(const UsbDkW32ErrorException &Other);
protected:
static tstring GetErrorString(DWORD dwErrorCode);
};
#endif