Core Library 1.7.0.0 Library containing core utilities and tools for threading, networking, logging, INI and CSV file management etc.

DetailedException.h
Go to the documentation of this file.
1 // This file is part of CoreLibrary containing useful reusable utility
2 // classes.
3 //
4 // Copyright (C) 2014 to present, Duncan Crutchley
5 // Contact <dac1976github@outlook.com>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as published
9 // by the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License and GNU Lesser General Public License
16 // for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // and GNU Lesser General Public License along with this program. If
20 // not, see <http://www.gnu.org/licenses/>.
21
27 #include "CoreLibraryDllGlobal.h"
28 #include "Platform/PlatformDefines.h"
29 #include <string>
30 #include <boost/exception/all.hpp>
31
32 #ifndef DETAILEDEXCEPTION
33 #define DETAILEDEXCEPTION
34
36 namespace core_lib
37 {
39 namespace exceptions
40 {
41
114 class DetailedException : public virtual boost::exception, public virtual std::exception
115 {
116 public:
118 DetailedException() = default;
123 explicit DetailedException(const std::string& message)
124 : m_what(message.c_str())
125 {
126 }
131 explicit DetailedException(const char* message)
132 : m_what(message)
133 {
134 }
136 ~DetailedException() noexcept override = default;
138 DetailedException(const DetailedException&) = default;
140 DetailedException& operator=(const DetailedException&) = default;
142 DetailedException(DetailedException&&) = default;
144 DetailedException& operator=(DetailedException&&) = default;
145
146 char const* what() const NO_EXCEPT_ override
147 {
148 return m_what.c_str();
149 }
150
151 private:
152 std::string m_what{"exception"};
153 };
154
155 } // namespace exceptions
156 } // namespace core_lib
157
158 #endif // DETAILEDEXCEPTION
core_lib::exceptions::DetailedException::operator=
DetailedException & operator=(const DetailedException &)=default
Copy assignment operator.
core_lib::exceptions::DetailedException
Exception class from which to define further derived custom exception classes.
Definition: DetailedException.h:114
core_lib
The core_lib namespace.
Definition: AsioDefines.h:59
core_lib::exceptions::DetailedException::DetailedException
DetailedException(const std::string &message)
Initializing constructor.
Definition: DetailedException.h:123
core_lib::exceptions::DetailedException::DetailedException
DetailedException()=default
Default constructor.
CoreLibraryDllGlobal.h
File containing declaration of DLL import/export control defines.
core_lib::exceptions::DetailedException::DetailedException
DetailedException(const char *message)
Initializing constructor.
Definition: DetailedException.h:131
PlatformDefines.h
File containing platform specific definitions.
core_lib::exceptions::DetailedException::~DetailedException
~DetailedException() noexcept override=default
Virtual destructor.
NO_EXCEPT_
#define NO_EXCEPT_
NO_EXCEPT_ definition mapping to noexcept.
Definition: PlatformDefines.h:57