parameter.h
1 /*
2  * <one line to give the program's name and a brief idea of what it does.>
3  * Copyright (C) 2023 Jose F Rivas C <josefelixrc7@gmail.com>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef ATOM_QUERY_PARAMETER
20 #define ATOM_QUERY_PARAMETER
21 
22 
23 #include <string>
24 
25 #include "tools/dvalue.h"
26 #include "query/results.h"
27 
28 
29 namespace Atom
30 {
31  namespace Query
32  {
33  enum class ParameterType;
34  class Parameter;
35  }
36 }
37 
38 
39 enum class Atom::Query::ParameterType
40 {
41  kField
42  ,kPosition
43 };
44 
46 {
47  public:
48  using Ptr = std::shared_ptr<Parameter>;
49 
50  Parameter(std::string name, Tools::DValue value, bool editable);
51  Parameter(std::string name, Query::Field::Position field_position, std::string related_action, bool editable);
52 
53  ParameterType get_parameter_type() const { return parameter_type_; }
54  std::string get_name() const { return name_; }
55  bool get_editable() const { return editable_; }
56  Tools::DValue& get_value()
57  {
58  auto& var = value_;
59  return var;
60  }
61  Query::Field::Position& get_field_position()
62  {
63  auto& var = field_position_;
64  return var;
65  }
66  std::string get_related_action() const { return related_action_; }
67 
68  void set_parameter_type(ParameterType parameter_type) { parameter_type_ = parameter_type; }
69  void set_name(std::string name) { name_ = name; }
70  void set_editable(bool editable) { editable_ = editable; }
71  void set_value(Tools::DValue value) { value_ = value; }
72  void set_related_action(std::string related_action) { related_action_ = related_action; }
73 
74  private:
75  ParameterType parameter_type_;
76  std::string name_;
77  bool editable_;
78  Tools::DValue value_;
79  Query::Field::Position field_position_;
80  std::string related_action_;
81 };
82 
83 #endif // ATOM_QUERY_PARAMETER
Definition: parameter.h:46
Definition: dvalue.h:48
Definition: field.h:43