This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
forked from fnc12/sqlite_orm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolumn_pointer.h
62 lines (49 loc) · 1.91 KB
/
column_pointer.h
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
#pragma once
#include <string> // std::string
#include <utility> // std::move
#include "functional/cxx_core_features.h"
#include "conditions.h"
#include "alias_traits.h"
namespace sqlite_orm {
namespace internal {
/**
* This class is used to store explicit mapped type T and its column descriptor (member pointer/getter/setter).
* Is useful when mapped type is derived from other type and base class has members mapped to a storage.
*/
template<class T, class F>
struct column_pointer {
using self = column_pointer<T, F>;
using type = T;
using field_type = F;
field_type field;
template<class R>
is_equal_t<self, R> operator==(R rhs) const {
return {*this, std::move(rhs)};
}
template<class R>
is_not_equal_t<self, R> operator!=(R rhs) const {
return {*this, std::move(rhs)};
}
template<class R>
lesser_than_t<self, R> operator<(R rhs) const {
return {*this, std::move(rhs)};
}
template<class R>
lesser_or_equal_t<self, R> operator<=(R rhs) const {
return {*this, std::move(rhs)};
}
template<class R>
greater_than_t<self, R> operator>(R rhs) const {
return {*this, std::move(rhs)};
}
template<class R>
greater_or_equal_t<self, R> operator>=(R rhs) const {
return {*this, std::move(rhs)};
}
};
template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_column_pointer_v = polyfill::is_specialization_of_v<T, column_pointer>;
template<class T>
using is_column_pointer = polyfill::bool_constant<is_column_pointer_v<T>>;
}
}