GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
Dbo/Slots/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*/
13namespace 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*/
28template<> struct Wt::Dbo::dbo_traits< GCW::Dbo::Slots::Item >
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
37template<> 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*/
43namespace GCW {
44 namespace Dbo {
45 namespace Slots {
46
47/*!
48** \brief Variables Item Class
49**
50**
51*/
52class 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,
75 Wt::Dbo::field( action, m_string_val , GCW::Dbo::Slots::Field:: string_val , 4096 ); // text(4096),
78 Wt::Dbo::field( action, m_guid_val , GCW::Dbo::Slots::Field:: guid_val , 32 ); // text(32),
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.
auto double_val() const -> double
auto obj_guid() const -> const std::string &
auto int64_val() const -> long long
void persist(Action &action)
auto numeric_val_num() const -> long long
auto timespec_val() const -> const std::string &
auto name() const -> const std::string &
auto slot_type() const -> int
auto guid_val() const -> const std::string &
auto gdate_val() const -> const std::string &
auto string_val() const -> const std::string &
auto numeric_val_denom() const -> long long
void field(Action &action, V &value, const std::string &name, int size=-1)
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:18