mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-05 02:06:02 -04:00

- Convert last old-style cast to reinterpret_cast<> - Statement::Ptr is now private, with a friend declaration for Column - noexcept should not be defined as the depreacted throw()
59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
/**
|
|
* @file Exception.h
|
|
* @ingroup SQLiteCpp
|
|
* @brief Encapsulation of the error message from SQLite3 on a std::runtime_error.
|
|
*
|
|
* Copyright (c) 2012-2013 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
|
*
|
|
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
|
* or copy at http://opensource.org/licenses/MIT)
|
|
*/
|
|
#pragma once
|
|
|
|
#include <stdexcept>
|
|
#include <string>
|
|
|
|
|
|
namespace SQLite
|
|
{
|
|
|
|
|
|
/**
|
|
* @brief Encapsulation of the error message from SQLite3, based on std::runtime_error.
|
|
*/
|
|
class Exception : public std::runtime_error
|
|
{
|
|
public:
|
|
/**
|
|
* @brief Encapsulation of the error message from SQLite3, based on std::runtime_error.
|
|
*
|
|
* @param[in] aErrorMessage The string message describing the SQLite error
|
|
*/
|
|
explicit Exception(const std::string& aErrorMessage) :
|
|
std::runtime_error(aErrorMessage)
|
|
{
|
|
}
|
|
};
|
|
|
|
|
|
} // namespace SQLite
|
|
|
|
|
|
/// Compatibility with non-clang compilers.
|
|
#ifndef __has_feature
|
|
#define __has_feature(x) 0
|
|
#endif
|
|
|
|
// Detect whether the compiler supports C++11 noexcept exception specifications.
|
|
#if ( defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || (__GNUC__ > 4)) \
|
|
&& defined(__GXX_EXPERIMENTAL_CXX0X__))
|
|
// GCC 4.7 and following have noexcept
|
|
#elif defined(__clang__) && __has_feature(cxx_noexcept)
|
|
// Clang 3.0 and above have noexcept
|
|
#elif defined(_MSC_VER) && _MSC_VER > 1800
|
|
// Visual Studio 2015 and above have noexcept
|
|
#else
|
|
// Visual Studio 2013 does not support noexcept, and "throw()" is deprecated by C++11
|
|
#define noexcept
|
|
#endif
|