GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
Template.h
Go to the documentation of this file.
1#line 2 "src/Dbo/GncLock/Template.h"
2
3#ifndef __DBO_GNCLOCK_TEMPLATE_H___
4#define __DBO_GNCLOCK_TEMPLATE_H___
5
6#include <string>
7
8#include <Wt/Dbo/Dbo.h>
9
10#include "../BaseItem.h"
11#include "Definition.h"
12
13/*
14** Predefine the GncLock class that fixin to come up.
15**
16*/
17namespace GCW {
18 namespace Dbo {
19 namespace GncLock {
20 class Item;
21 }
22 }
23}
24
25/*
26** Define these dbo_traits to prevent the system from
27** automatically generating an ID field or a VERSION
28** field, and instead substitute the guid field
29** as the primary key.
30**
31*/
32template<> struct Wt::Dbo::dbo_traits< GCW::Dbo::GncLock::Item >
34{
35 using IdType = std::string;
36 static auto invalidId()-> IdType { return std::string(); }
37 static auto surrogateIdField()-> const char * { return "Hostname"; }
38 static auto versionField()-> const char * { return nullptr; }
39};
40
41template<> struct Wt::Dbo::dbo_traits< const GCW::Dbo::GncLock::Item > : Wt::Dbo::dbo_traits< GCW::Dbo::GncLock::Item > {};
42
43/*
44** Now we can start building our class!
45**
46*/
47namespace GCW {
48 namespace Dbo {
49 namespace GncLock {
50
51template <class C>
53: public GCW::Dbo::BaseItem<C>
54{
55 public:
56
58
59 template<class Action>
60 void persist( Action & a )
61 {
62// Wt::Dbo::field( a, m_hostname , GCW::Dbo::GncLock::FieldDef::hostname );
64
65 } // endvoid persist( Action & a )
66
67 std::string m_hostname ;
68 int m_pid = -1 ;
69
70}; // endclass Template
71
72 } // endnamespace GncLock {
73 } // endnamespace Dbo {
74} // endnamespace Swims {
75
76#endif // #ifndef __DBO_GNCLOCK_TEMPLATE_H___
77
78
void persist(Action &a)
Definition Template.h:60
void field(Action &action, V &value, const std::string &name, int size=-1)
const Wt::WFormModel::Field pid
Definition GncLock.cpp:8
auto addNew() -> GCW::Dbo::GncLock::Item::Ptr
Definition App.h:18
static auto surrogateIdField() -> const char *
Definition Template.h:37
static auto versionField() -> const char *
Definition Template.h:38