9 #ifndef _CRYPTO_STREAMS_LIB_EXCEPTIONS_H
10 #define _CRYPTO_STREAMS_LIB_EXCEPTIONS_H
18 # define _NOEXCEPT _GLIBCXX_USE_NOEXCEPT
19 # endif // if __GNUC__ >= 4
20 #endif // ifndef _NOEXCEPT
23 namespace exceptions {
24 #define MAX_EXCEPTION_MESSAGE_LENGTH 255
44 const std::string & message) _NOEXCEPT
45 : type_(type), error_(error)
47 CopyMessage(message.c_str(), message.length());
52 const char *
const & message) _NOEXCEPT
53 : type_(type), error_(error)
55 CopyMessage(message, strlen(message));
60 virtual const char* what()
const _NOEXCEPT
override {
64 virtual ExceptionTypes type()
const _NOEXCEPT {
68 virtual int error()
const _NOEXCEPT {
74 void CopyMessage(
const char *msg,
const size_t len) {
76 (std::min)(len, static_cast<const size_t>(MAX_EXCEPTION_MESSAGE_LENGTH - 1));
78 memset(message_, 0,
sizeof(message_));
82 memcpy_s(message_, mlen, msg, mlen);
83 #else // ifdef Q_OS_WIN32
84 memcpy(message_, msg, mlen);
85 #endif // ifdef Q_OS_WIN32
91 char message_[MAX_EXCEPTION_MESSAGE_LENGTH];
98 const std::string& message) _NOEXCEPT
102 const char *
const& message) _NOEXCEPT
112 const std::string& message) _NOEXCEPT
116 const char *
const& message) _NOEXCEPT
133 virtual int code()
const _NOEXCEPT {
192 #endif // _CRYPTO_STREAMS_LIB_EXCEPTIONS_H
Definition: RMSCryptoExceptions.h:108
Definition: RMSCryptoExceptions.h:167
Definition: BlockBasedProtectedStream.cpp:13
Definition: RMSCryptoExceptions.h:143
Definition: RMSCryptoExceptions.h:179
Definition: RMSCryptoExceptions.h:155
Definition: RMSCryptoExceptions.h:122
Definition: RMSCryptoExceptions.h:25
Definition: RMSCryptoExceptions.h:94