libsl3 1.2.41002
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 conatiner_type = Container::conatiner_type;
35 using iterator = conatiner_type::iterator;
36 using const_iterator = conatiner_type::const_iterator;
37 using value_type = conatiner_type::value_type;
38 using reference = conatiner_type::reference;
39 using const_reference = conatiner_type::const_reference;
40 using size_type = conatiner_type::size_type;
41 //@}
42
43 /// Constructor
44 DbValues () noexcept;
45
46#ifndef _MSC_VER
47 using Container::Container;
48
49#else
50
51 DbValues (conatiner_type) noexcept (
52 std::is_nothrow_move_constructible<DbValue>::value);
53
54 DbValues (std::initializer_list<typename conatiner_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 Assigment
68 * \throw sl3::ErrTypeMisMatch if size() is different
69 * \see assignment of DbValue
70 * \return reference ot this
71 */
72 DbValues& operator= (const DbValues&);
73
74 /** \brief Assigment
75 * \throw sl3::ErrTypeMisMatch if size() is different
76 * \see assignment of DbValue
77 * \return reference ot this
78 */
79 DbValues& operator= (DbValues&&);
80
81 /**
82 * \brief swap function
83 *
84 * Swaps content of 2 DbValues.
85 *
86 * \param other DbValues to swap wit
87 */
88 void swap (DbValues& other) noexcept;
89 };
90
91 /**
92 * \brief DbValue specialized swap function
93 *
94 * \param a first value to swap with second value
95 * \param b second value to swap with first value
96 *
97 * This function call a.swap(b). \see DbValues::swap
98 */
99 void swap (DbValues& a, DbValues& b) noexcept;
100
101}
102
103#endif
Wrapper to provide begin, end and random access of a container.
Definition: container.hpp:29
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.
Container::conatiner_type conatiner_type
usual typedefs
Definition: dbvalues.hpp:34
Namespace of libSL3.
Definition: columns.hpp:18
STL namespace.