blob: 2e3c8ae60fc31d0fb5ed0f0d59a13a4821144688 (
plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/*
* Copyright (C) 2009-2012 Geometer Plus <contact@geometerplus.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef __DBCOMMANDPARAMETERS_H__
#define __DBCOMMANDPARAMETERS_H__
#include <vector>
#include "DBValues.h"
class DBCommandParameter {
public:
// create anonymous parameter with DBNULL value:
DBCommandParameter();
// create named parameter with DBNULL value:
DBCommandParameter(const std::string &name);
// create anonymous parameter with default value of specified type:
DBCommandParameter(DBValue::ValueType type);
// create named parameter with default value of specified type:
DBCommandParameter(const std::string &name, DBValue::ValueType type);
// create anonymous parameter with specified value:
DBCommandParameter(shared_ptr<DBValue> value);
// create named parameter with specified value:
DBCommandParameter(const std::string &name, shared_ptr<DBValue> value);
public:
const std::string &name() const;
void setName(const std::string &name);
shared_ptr<DBValue> value() const;
void setValue(shared_ptr<DBValue> value);
DBValue::ValueType type() const;
bool hasName() const;
public: // implement copying:
DBCommandParameter(const DBCommandParameter &par);
const DBCommandParameter &operator = (const DBCommandParameter &par);
private:
std::string myName;
DBValue::ValueType myType;
shared_ptr<DBValue> myValue;
};
inline const std::string &DBCommandParameter::name() const { return myName; }
inline void DBCommandParameter::setName(const std::string &name) { myName = name; }
inline shared_ptr<DBValue> DBCommandParameter::value() const { return myValue; }
inline void DBCommandParameter::setValue(shared_ptr<DBValue> value) { myValue = value; }
inline DBValue::ValueType DBCommandParameter::type() const { return myValue->type(); }
inline bool DBCommandParameter::hasName() const { return myName != ""; }
#endif /* __DBCOMMANDPARAMETERS_H__ */
|