field.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 NAF_QUERY_FIELD
20 #define NAF_QUERY_FIELD
21 
22 
23 #include <string>
24 
25 #include "tools/dvalue.h"
26 
27 
28 namespace NAF
29 {
30  namespace Query
31  {
32  class Field;
33  }
34 }
35 
36 
38 {
39  public:
40  using Ptr = std::shared_ptr<Field>;
41 
42  struct Position
43  {
44  Position(std::size_t row, std::size_t column) : row(row), column(column) {}
45 
46  std::size_t row;
47  std::size_t column;
48  };
49 
50  Field(std::string column_name, Tools::DValue value);
51 
52  std::string get_column_name() const { return column_name_;}
53  Tools::DValue get_value() const {return value_;}
54  Tools::DValue& get_value()
55  {
56  auto& var = value_;
57  return var;
58  }
59 
60  void set_column_name(std::string column_name) { column_name_ = column_name;}
61  void set_value(Tools::DValue value) { value_ = value;}
62 
63  std::string String_();
64  float Float_();
65  bool Bool_();
66  int Int_();
67 
68  private:
69  std::string column_name_;
70  Tools::DValue value_;
71 };
72 
73 
74 #endif // NAF_QUERY_FIELD
Definition: field.h:38
Definition: dvalue.h:48
Definition: field.h:43