ThinSQLite++
A thin, safe and convenient modern C++ wrapper for the SQLite API.
Toggle main menu visibility
Loading...
Searching...
No Matches
impl
snapshot_iface.hpp
1
/*
2
Copyright 2024 Eugene Gershnik
3
4
Use of this source code is governed by a BSD-style
5
license that can be found in the LICENSE file or at
6
https://github.com/gershnik/thinsqlitepp/blob/master/LICENSE
7
*/
8
9
#ifndef HEADER_SQLITEPP_SNAPSHOT_IFACE_INCLUDED
10
#define HEADER_SQLITEPP_SNAPSHOT_IFACE_INCLUDED
11
12
#include "handle.hpp"
13
#include "meta.hpp"
14
15
namespace
thinsqlitepp
16
{
21
22
#if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 10, 0) && (THINSQLITEPP_ENABLE_EXPERIMENTAL || THINSQLITEPP_ENABLE_EXPIREMENTAL)
23
24
41
SQLITEPP_EXPORTED
42
class
snapshot
final :
public
handle
<sqlite3_snapshot, snapshot>
43
{
44
public
:
46
~snapshot
() noexcept
47
{
sqlite3_snapshot_free
(
c_ptr
()); }
48
49
55
friend
int
compare
(
const
snapshot
& lhs,
const
snapshot
& rhs)
noexcept
56
{
return
sqlite3_snapshot_cmp
(lhs.c_ptr(), rhs.c_ptr()); }
57
58
friend
bool
operator==(
const
snapshot
& lhs,
const
snapshot
& rhs)
noexcept
59
{
return
compare
(lhs, rhs) == 0; }
60
friend
bool
operator!=(
const
snapshot & lhs,
const
snapshot & rhs)
noexcept
61
{
return
compare
(lhs, rhs) != 0; }
62
63
#if defined(DOXYGEN) || __cpp_impl_three_way_comparison >= 201907
66
friend
std::strong_ordering operator<=>(
const
snapshot & lhs,
const
snapshot & rhs)
noexcept
67
{
return
strong_ordering_from_int(
compare
(lhs, rhs)); }
69
#endif
70
#if defined(DOXYGEN) || __cpp_impl_three_way_comparison < 201907
73
friend
bool
operator<(
const
snapshot & lhs,
const
snapshot & rhs)
noexcept
74
{
return
compare
(lhs, rhs) < 0; }
75
friend
bool
operator<=(
const
snapshot & lhs,
const
snapshot & rhs)
noexcept
76
{
return
compare
(lhs, rhs) <= 0; }
77
friend
bool
operator>(
const
snapshot & lhs,
const
snapshot & rhs)
noexcept
78
{
return
compare
(lhs, rhs) > 0; }
79
friend
bool
operator>=(
const
snapshot & lhs,
const
snapshot & rhs)
noexcept
80
{
return
compare
(lhs, rhs) >= 0; }
82
#endif
83
};
84
85
#endif
86
88
}
89
90
#endif
thinsqlitepp::handle< sqlite3_snapshot, snapshot >::c_ptr
sqlite3_snapshot * c_ptr() const noexcept
Definition
handle.hpp:45
thinsqlitepp::handle< sqlite3_snapshot, snapshot >::handle
handle()=delete
thinsqlitepp::snapshot
A database snapshot.
Definition
snapshot_iface.hpp:43
thinsqlitepp::snapshot::~snapshot
~snapshot() noexcept
Equivalent to sqlite3_snapshot_free.
Definition
snapshot_iface.hpp:46
thinsqlitepp::snapshot::compare
friend int compare(const snapshot &lhs, const snapshot &rhs) noexcept
Compare the ages of two snapshots.
Definition
snapshot_iface.hpp:55
thinsqlitepp
ThinSQLite++ namespace.
Definition
backup_iface.hpp:17
sqlite3_snapshot_cmp
sqlite3_snapshot_cmp
sqlite3_snapshot_free
sqlite3_snapshot_free
Generated by
1.17.0