summaryrefslogtreecommitdiff
path: root/subprojects/boost-sqlite/include/boost/sqlite/detail/config.hpp
blob: 2126f602e0aff872bd722f6cf3ceb1e7d41c7232 (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
// Copyright (c) 2022 Klemens Morgenstern (klemens.morgenstern@gmx.net)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef BOOST_SQLITE_DETAIL_CONFIG_HPP
#define BOOST_SQLITE_DETAIL_CONFIG_HPP

#include <boost/config.hpp>
#include <boost/core/detail/string_view.hpp>

#if defined(BOOST_SQLITE_COMPILE_EXTENSION)
#include <sqlite3ext.h>
#define BOOST_SQLITE_COMPILING_EXTENSION 1
#define BOOST_SQLITE_BEGIN_NAMESPACE namespace boost { namespace sqlite {  inline namespace ext {
#define BOOST_SQLITE_END_NAMESPACE } } }
#else
#include <sqlite3.h>
#define BOOST_SQLITE_BEGIN_NAMESPACE namespace boost { namespace sqlite {
#define BOOST_SQLITE_END_NAMESPACE } }
#endif

// copied from boost.json
#if defined(BOOST_SQLITE_DOCS)
# define BOOST_SQLITE_DECL
#else
# if (defined(BOOST_SQLITE_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_SQLITE_STATIC_LINK)
#  if defined(BOOST_SQLITE_SOURCE)
#   define BOOST_SQLITE_DECL        BOOST_SYMBOL_EXPORT
#  else
#   define BOOST_SQLITE_DECL        BOOST_SYMBOL_IMPORT
#  endif
# endif // static lib
# ifndef  BOOST_SQLITE_DECL
#  define BOOST_SQLITE_DECL
# endif
# if !defined(BOOST_SQLITE_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SQLITE_NO_LIB)
#  define BOOST_LIB_NAME boost_sqlite
#  if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SQLITE_DYN_LINK)
#   define BOOST_DYN_LINK
#  endif
#  include <boost/config/auto_link.hpp>
# endif
#endif

BOOST_SQLITE_BEGIN_NAMESPACE


#if defined(BOOST_SQLITE_COMPILE_EXTENSION)
extern const sqlite3_api_routines *sqlite3_api;
#endif

using string_view = boost::core::string_view;

BOOST_SQLITE_END_NAMESPACE

#define BOOST_SQLITE_RETURN_EC(ev)                                                            \
do                                                                                            \
{                                                                                             \
  static constexpr auto loc##__LINE__((BOOST_CURRENT_LOCATION));                              \
  return ::boost::system::error_code(ev, boost::sqlite::sqlite_category(), &loc##__LINE__);   \
}                                                                                             \
while (false)

#define BOOST_SQLITE_ASSIGN_EC(ec, ev)                              \
do                                                                  \
{                                                                   \
  static constexpr auto loc##__LINE__((BOOST_CURRENT_LOCATION));    \
  ec.assign(ev, boost::sqlite::sqlite_category(), &loc##__LINE__);  \
}                                                                   \
while (false)

#if defined(BOOST_SQLITE_NO_VIRTUAL)
#define BOOST_SQLITE_VIRTUAL
#define BOOST_SQLITE_PURE
#else
#define BOOST_SQLITE_VIRTUAL virtual
#define BOOST_SQLITE_PURE = 0
#endif

#endif // BOOST_SQLITE_DETAIL_HPP