forked from crabapples-h/navicat-keygen-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExceptionCapstone.hpp
39 lines (29 loc) · 1.1 KB
/
ExceptionCapstone.hpp
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
#pragma once
#include <capstone/capstone.h>
#include "Exception.hpp"
namespace ARL {
class CapstoneError final : public Exception {
private:
cs_err m_ErrorCode;
public:
template<typename... __ArgTypes>
CapstoneError(const char* SourceFile, size_t SourceLine, cs_err ErrorCode, const char* Format, __ArgTypes&&... Args) noexcept :
Exception(SourceFile, SourceLine, Format, std::forward<__ArgTypes>(Args)...),
m_ErrorCode(ErrorCode) {}
[[nodiscard]]
// NOLINTNEXTLINE: mark "virtual" explicitly for more readability
virtual bool HasErrorCode() const noexcept override {
return true;
}
[[nodiscard]]
// NOLINTNEXTLINE: mark "virtual" explicitly for more readability
virtual intptr_t ErrorCode() const noexcept override {
return m_ErrorCode;
}
[[nodiscard]]
// NOLINTNEXTLINE: mark "virtual" explicitly for more readability
virtual const char* ErrorString() const noexcept override {
return cs_strerror(m_ErrorCode);
}
};
}