GnuCashew ~ GnuCash Enabled Web
GCW
Item.h
Go to the documentation of this file.
1 #line 2 "src/Dbo/Slots/Slots.h"
2 
3 #ifndef __DBO_SLOTS_ITEM_H___
4 #define __DBO_SLOTS_ITEM_H___
5 
6 #include "../BaseItem.h"
7 #include "Definition.h"
8 
9 /*
10 ** Predefine the class that fixin to come up.
11 **
12 */
13 namespace GCW {
14  namespace Dbo {
15  namespace Slots {
16  class Item;
17  }
18  }
19 }
20 
21 /*
22 ** Define these dbo_traits to prevent the system from
23 ** automatically generating an ID field or a VERSION
24 ** field, and instead substitute the guid field
25 ** as the primary key.
26 **
27 */
28 template<> struct Wt::Dbo::dbo_traits< GCW::Dbo::Slots::Item >
29 : public Wt::Dbo::dbo_default_traits
30 {
31 // using IdType = long long;
32 // static IdType invalidId() { return -1; }
33 // static const char * surrpgateIdField() { return nullptr; }
34  static const char * versionField() { return nullptr; }
35 };
36 
37 template<> struct Wt::Dbo::dbo_traits< const GCW::Dbo::Slots::Item > : Wt::Dbo::dbo_traits< GCW::Dbo::Slots::Item > {};
38 
39 /*
40 ** Now we can start building our class!
41 **
42 */
43 namespace GCW {
44  namespace Dbo {
45  namespace Slots {
46 
47 /*!
48 ** \brief Variables Item Class
49 **
50 **
51 */
52 class Item
53 : public GCW::Dbo::BaseItem< Item >
54 {
55  public:
56 
57  auto obj_guid () const-> const std::string & { return m_obj_guid ; } // text(32) NOT NULL
58  auto name () const-> const std::string & { return m_name ; } // text(4096) NOT NULL
59  auto slot_type () const-> int { return m_slot_type ; } // integer NOT NULL
60  auto int64_val () const-> long long { return m_int64_val ; } // bigint
61  auto string_val () const-> const std::string & { return m_string_val ; } // text(4096),
62  auto double_val () const-> double { return m_double_val ; } // float8,
63  auto timespec_val () const-> const std::string & { return m_timespec_val ; } // text(19),
64  auto guid_val () const-> const std::string & { return m_guid_val ; } // text(32),
65  auto numeric_val_num () const-> long long { return m_numeric_val_num ; } // bigint,
66  auto numeric_val_denom () const-> long long { return m_numeric_val_denom ; } // bigint,
67  auto gdate_val () const-> const std::string & { return m_gdate_val ; } // text(8)
68 
69  template< class Action > void persist( Action & action )
70  {
71  Wt::Dbo::field( action, m_obj_guid , GCW::Dbo::Slots::Field:: obj_guid , 32 ); // text(32) NOT NULL,
72  Wt::Dbo::field( action, m_name , GCW::Dbo::Slots::Field:: name , 4096 ); // text(4096) NOT NULL,
73  Wt::Dbo::field( action, m_slot_type , GCW::Dbo::Slots::Field:: slot_type ); // integer NOT NULL,
74  Wt::Dbo::field( action, m_int64_val , GCW::Dbo::Slots::Field:: int64_val ); // bigint,
75  Wt::Dbo::field( action, m_string_val , GCW::Dbo::Slots::Field:: string_val , 4096 ); // text(4096),
76  Wt::Dbo::field( action, m_double_val , GCW::Dbo::Slots::Field:: double_val ); // float8,
77  Wt::Dbo::field( action, m_timespec_val , GCW::Dbo::Slots::Field:: timespec_val , 19 ); // text(19),
78  Wt::Dbo::field( action, m_guid_val , GCW::Dbo::Slots::Field:: guid_val , 32 ); // text(32),
81  Wt::Dbo::field( action, m_gdate_val , GCW::Dbo::Slots::Field:: gdate_val , 32 ); // text(8)
82  }
83 
84  private:
85 
86  std::string m_obj_guid ; // text(32) NOT NULL
87  std::string m_name ; // text(4096) NOT NULL
88  int m_slot_type ; // integer NOT NULL
89  long long m_int64_val ; // bigint
90  std::string m_string_val ; // text(4096),
91  double m_double_val ; // float8,
92  std::string m_timespec_val ; // text(19),
93  std::string m_guid_val ; // text(32),
94  long long m_numeric_val_num ; // bigint,
95  long long m_numeric_val_denom ; // bigint,
96  std::string m_gdate_val ; // text(8)
97 
98 }; // endclass Item
99 
100  } // endnamespace Slots {
101  } // endnamespace Dbo {
102 } // endnamespace GCW {
103 
104 #endif // end#ifndef __SLOTS_H___
105 
Variables Item Class.
Definition: Item.h:54
auto double_val() const -> double
Definition: Item.h:62
auto obj_guid() const -> const std::string &
Definition: Item.h:57
std::string m_guid_val
Definition: Item.h:93
auto int64_val() const -> long long
Definition: Item.h:60
void persist(Action &action)
Definition: Item.h:69
std::string m_obj_guid
Definition: Item.h:86
auto numeric_val_num() const -> long long
Definition: Item.h:65
long long m_int64_val
Definition: Item.h:89
auto timespec_val() const -> const std::string &
Definition: Item.h:63
double m_double_val
Definition: Item.h:91
auto name() const -> const std::string &
Definition: Item.h:58
std::string m_string_val
Definition: Item.h:90
auto slot_type() const -> int
Definition: Item.h:59
auto guid_val() const -> const std::string &
Definition: Item.h:64
std::string m_name
Definition: Item.h:87
auto gdate_val() const -> const std::string &
Definition: Item.h:67
auto string_val() const -> const std::string &
Definition: Item.h:61
long long m_numeric_val_denom
Definition: Item.h:95
long long m_numeric_val_num
Definition: Item.h:94
std::string m_timespec_val
Definition: Item.h:92
auto numeric_val_denom() const -> long long
Definition: Item.h:66
std::string m_gdate_val
Definition: Item.h:96
const Wt::WFormModel::Field action
Definition: Entries.cpp:14
Wt::WFormModel::Field gdate_val
Definition: Slots.cpp:24
Wt::WFormModel::Field double_val
Definition: Slots.cpp:19
Wt::WFormModel::Field obj_guid
Definition: Slots.cpp:14
Wt::WFormModel::Field int64_val
Definition: Slots.cpp:17
Wt::WFormModel::Field string_val
Definition: Slots.cpp:18
Wt::WFormModel::Field timespec_val
Definition: Slots.cpp:20
Wt::WFormModel::Field numeric_val_num
Definition: Slots.cpp:22
Wt::WFormModel::Field name
Definition: Slots.cpp:15
Wt::WFormModel::Field slot_type
Definition: Slots.cpp:16
Wt::WFormModel::Field guid_val
Definition: Slots.cpp:21
Wt::WFormModel::Field numeric_val_denom
Definition: Slots.cpp:23
Definition: App.h:17
Definition: guid.cpp:397
static const char * versionField()
Definition: Item.h:34