boost_sqlite 1
A sqlite C++ library
Loading...
Searching...
No Matches
config.hpp
1//
2// Copyright (c) 2022 Klemens Morgenstern (klemens.morgenstern@gmx.net)
3//
4// Distributed under the Boost Software License, Version 1.0. (See accompanying
5// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7
8#ifndef BOOST_SQLITE_DETAIL_CONFIG_HPP
9#define BOOST_SQLITE_DETAIL_CONFIG_HPP
10
11#include <boost/config.hpp>
12#include <boost/core/detail/string_view.hpp>
13
14#if defined(BOOST_SQLITE_COMPILE_EXTENSION)
15#include <sqlite3ext.h>
16#define BOOST_SQLITE_COMPILING_EXTENSION 1
17#define BOOST_SQLITE_BEGIN_NAMESPACE namespace boost { namespace sqlite { inline namespace ext {
18#define BOOST_SQLITE_END_NAMESPACE } } }
19#else
20#include <sqlite3.h>
21#define BOOST_SQLITE_BEGIN_NAMESPACE namespace boost { namespace sqlite {
22#define BOOST_SQLITE_END_NAMESPACE } }
23#endif
24
25// copied from boost.json
26#if defined(BOOST_SQLITE_DOCS)
27# define BOOST_SQLITE_DECL
28#else
29# if (defined(BOOST_SQLITE_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_SQLITE_STATIC_LINK)
30# if defined(BOOST_SQLITE_SOURCE)
31# define BOOST_SQLITE_DECL BOOST_SYMBOL_EXPORT
32# else
33# define BOOST_SQLITE_DECL BOOST_SYMBOL_IMPORT
34# endif
35# endif // static lib
36# ifndef BOOST_SQLITE_DECL
37# define BOOST_SQLITE_DECL
38# endif
39# if !defined(BOOST_SQLITE_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SQLITE_NO_LIB)
40# define BOOST_LIB_NAME boost_sqlite
41# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SQLITE_DYN_LINK)
42# define BOOST_DYN_LINK
43# endif
44# include <boost/config/auto_link.hpp>
45# endif
46#endif
47
48BOOST_SQLITE_BEGIN_NAMESPACE
49
50
51#if defined(BOOST_SQLITE_COMPILE_EXTENSION)
52extern const sqlite3_api_routines *sqlite3_api;
53#endif
54
55using string_view = boost::core::string_view;
56
57BOOST_SQLITE_END_NAMESPACE
58
59#define BOOST_SQLITE_RETURN_EC(ev) \
60{ \
61 static constexpr auto loc##__LINE__((BOOST_CURRENT_LOCATION)); \
62 return ::boost::system::error_code(ev, boost::sqlite::sqlite_category(), &loc##__LINE__); \
63}
64
65#define BOOST_SQLITE_ASSIGN_EC(ec, ev) \
66{ \
67 static constexpr auto loc##__LINE__((BOOST_CURRENT_LOCATION)); \
68 ec.assign(ev, boost::sqlite::sqlite_category(), &loc##__LINE__); \
69}
70
71#if defined(BOOST_SQLITE_NO_VIRTUAL)
72#define BOOST_SQLITE_VIRTUAL
73#define BOOST_SQLITE_PURE
74#else
75#define BOOST_SQLITE_VIRTUAL virtual
76#define BOOST_SQLITE_PURE = 0
77#endif
78
79#endif // BOOST_SQLITE_DETAIL_HPP