GnuCashew ~ GnuCash Enabled Web
GCW
Dbo
GncLock
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
*/
17
namespace
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
*/
32
template
<>
struct
Wt::Dbo::dbo_traits<
GCW
::Dbo::GncLock::Item >
33
:
public
Wt::Dbo::dbo_default_traits
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
41
template
<>
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
*/
47
namespace
GCW
{
48
namespace
Dbo {
49
namespace
GncLock {
50
51
template
<
class
C>
52
class
Template
53
:
public
GCW::Dbo::BaseItem
<C>
54
{
55
public
:
56
57
Template
(){}
58
59
template
<
class
Action>
60
void
persist
( Action & a )
61
{
62
// Wt::Dbo::field( a, m_hostname , GCW::Dbo::GncLock::FieldDef::hostname );
63
Wt::Dbo::field( a,
m_pid
,
GCW::Dbo::GncLock::FieldDef::pid
);
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
Definition.h
GCW::Dbo::BaseItem
Definition:
BaseItem.h:36
GCW::Dbo::GncLock::Template
Definition:
Template.h:54
GCW::Dbo::GncLock::Template::persist
void persist(Action &a)
Definition:
Template.h:60
GCW::Dbo::GncLock::Template::m_pid
int m_pid
Definition:
Template.h:68
GCW::Dbo::GncLock::Template::m_hostname
std::string m_hostname
Definition:
Template.h:67
GCW::Dbo::GncLock::Template::Template
Template()
Definition:
Template.h:57
GCW::Dbo::GncLock::FieldDef::pid
const Wt::WFormModel::Field pid
Definition:
GncLock.cpp:8
GCW
Definition:
App.h:17
Wt::Dbo::dbo_traits< GCW::Dbo::GncLock::Item >::IdType
std::string IdType
Definition:
Template.h:35
Wt::Dbo::dbo_traits< GCW::Dbo::GncLock::Item >::invalidId
static auto invalidId() -> IdType
Definition:
Template.h:36
Wt::Dbo::dbo_traits< GCW::Dbo::GncLock::Item >::surrogateIdField
static auto surrogateIdField() -> const char *
Definition:
Template.h:37
Wt::Dbo::dbo_traits< GCW::Dbo::GncLock::Item >::versionField
static auto versionField() -> const char *
Definition:
Template.h:38
Generated on Fri Mar 7 2025 11:49:32 for GnuCashew ~ GnuCash Enabled Web by
1.9.1