EasyQtSql
Easy SQL data access helper for QtSql
EasyQtSql_ParamDirectionWrapper.h
Go to the documentation of this file.
1 #ifndef EASYQTSQL_PARAMETERWRAPPER_H
2 #define EASYQTSQL_PARAMETERWRAPPER_H
3 
4 /*
5  * The MIT License (MIT)
6  * Copyright 2018 Alexey Kramin
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26  *
27 */
28 
29 #ifndef EASY_QT_SQL_MAIN
30 
31 #include <QtCore>
32 
33 #endif
34 
41 {
42  ParamDirectionWrapper(const QVariant &val, const QString &aliasName)
43  : value(val)
44  , alias(aliasName.trimmed())
45  { }
46 
48 
49  const QVariant value;
50  const QString alias;
51 
55  virtual void doesNothing() const = 0;
56 };
57 
61 struct In : public ParamDirectionWrapper
62 {
63  In(const QVariant &value, const QString &alias = QString())
64  : ParamDirectionWrapper(value, alias.trimmed().toLower())
65  { }
66 
70  virtual void doesNothing() const override {}
71 };
72 
76 struct Out : public ParamDirectionWrapper
77 {
78  explicit Out(const QString &alias)
79  : ParamDirectionWrapper(QVariant(), alias)
80  { }
81 
85  virtual void doesNothing() const override {}
86 };
87 
92 {
93  InOut(const QVariant &value, const QString &alias)
95  { }
96 
100  virtual void doesNothing() const override {}
101 };
102 
103 #endif // EASYQTSQL_PARAMETERWRAPPER_H
Input SQL parameters wrapper.
Definition: EasyQtSql_ParamDirectionWrapper.h:61
virtual ~ParamDirectionWrapper()
Definition: EasyQtSql_ParamDirectionWrapper.h:47
virtual void doesNothing() const override
Does nothing.
Definition: EasyQtSql_ParamDirectionWrapper.h:100
InOut(const QVariant &value, const QString &alias)
Definition: EasyQtSql_ParamDirectionWrapper.h:93
const QString alias
Definition: EasyQtSql_ParamDirectionWrapper.h:50
ParamDirectionWrapper(const QVariant &val, const QString &aliasName)
Definition: EasyQtSql_ParamDirectionWrapper.h:42
Out(const QString &alias)
Definition: EasyQtSql_ParamDirectionWrapper.h:78
virtual void doesNothing() const override
Does nothing.
Definition: EasyQtSql_ParamDirectionWrapper.h:70
In(const QVariant &value, const QString &alias=QString())
Definition: EasyQtSql_ParamDirectionWrapper.h:63
Base parameters wrapper struct.
Definition: EasyQtSql_ParamDirectionWrapper.h:40
virtual void doesNothing() const =0
Protection against instantiating the class.
Output SQL parameters wrapper.
Definition: EasyQtSql_ParamDirectionWrapper.h:76
Bidirectional SQL parameters wrapper.
Definition: EasyQtSql_ParamDirectionWrapper.h:91
virtual void doesNothing() const override
Does nothing.
Definition: EasyQtSql_ParamDirectionWrapper.h:85
const QVariant value
Definition: EasyQtSql_ParamDirectionWrapper.h:49