libsl3 1.3.51003
A C++ interface for SQLite
Loading...
Searching...
No Matches
dbvalues.hpp
1/******************************************************************************
2 ------------- Copyright (c) 2009-2023 H a r a l d A c h i t z ---------------
3 ---------- < h a r a l d dot a c h i t z at g m a i l dot c o m > ------------
4 ---- This Source Code Form is subject to the terms of the Mozilla Public -----
5 ---- License, v. 2.0. If a copy of the MPL was not distributed with this -----
6 ---------- file, You can obtain one at http://mozilla.org/MPL/2.0/. ----------
7 ******************************************************************************/
8
9#ifndef SL3_DbVALUES_HPP_
10#define SL3_DbVALUES_HPP_
11
12#include <initializer_list>
13
14#include <sl3/config.hpp>
15#include <sl3/container.hpp>
16#include <sl3/dbvalue.hpp>
17
18namespace sl3
19{
20 /**
21 * \brief A row of DbValues
22 *
23 * Fixed size vector of DbValue instances.
24 * DbValues models a row in a database, therefore assignment works only if
25 * fields are compatible.
26 *
27 *
28 */
29 class LIBSL3_API DbValues final : public Container<std::vector<DbValue>>
30 {
31 public:
32 //@{
33 /// usual typedefs
34 using container_type = Container::container_type;
35 using iterator = container_type::iterator;
36 using const_iterator = container_type::const_iterator;
37 using value_type = container_type::value_type;
38 using reference = container_type::reference;
39 using const_reference = container_type::const_reference;
40 using size_type = container_type::size_type;
41 //@}
42
43 /// Constructor
44 DbValues () noexcept;
45
46#ifndef _MSC_VER
48
49#else
50
51 DbValues (container_type) noexcept (
52 std::is_nothrow_move_constructible<DbValue>::value);
53
54 DbValues (std::initializer_list<typename container_type::value_type>);
55
56#endif
57
58 /** \brief Copy constructor
59 */
61
62 /** \brief Move constructor
63 */
64 DbValues (DbValues&&) noexcept (
65 std::is_nothrow_move_constructible<DbValue>::value);
66
67 /** \brief Assignment
68 * \throw sl3::ErrTypeMisMatch if size() is
69 * different
70 * \see assignment of DbValue
71 * \return reference to this
72 */
73 DbValues& operator= (const DbValues&);
74
75 /** \brief Assignment
76 * \throw sl3::ErrTypeMisMatch if size() is
77 * different
78 * \see assignment of DbValue
79 * \return reference to this
80 */
81 DbValues& operator= (DbValues&&);
82
83 /**
84 * \brief swap function
85 *
86 * Swaps content of 2 DbValues.
87 *
88 * \param other DbValues to swap with
89 */
90 void swap (DbValues& other) noexcept;
91 };
92
93 /**
94 * \brief DbValue specialized swap function
95 *
96 * \param a first value to swap with second value
97 * \param b second value to swap with first value
98 *
99 * This function calls a.swap(b). \see DbValues::swap
100 */
101 void swap (DbValues& a, DbValues& b) noexcept;
102
103}
104
105#endif
Container() noexcept
Constructor.
Definition container.hpp:47
This class models the duck typing sqlite uses. It supports int, real, text, blob and null values.
Definition dbvalue.hpp:43
A row of DbValues.
Definition dbvalues.hpp:30
DbValues(DbValues &&) noexcept(std::is_nothrow_move_constructible< DbValue >::value)
Move constructor.
DbValues(const DbValues &)
Copy constructor.
DbValues() noexcept
Constructor.
void swap(DbValues &other) noexcept
swap function
Container() noexcept
Constructor.
Definition container.hpp:47
Container::container_type container_type
usual typedefs
Definition dbvalues.hpp:34
Namespace of libSL3.
Definition columns.hpp:18
void swap(DbValues &a, DbValues &b) noexcept
DbValue specialized swap function.
STL namespace.