Wt examples
3.3.0
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
build
buildd
witty-3.3.0
examples
hangman
User.h
Go to the documentation of this file.
1
// This may look like C code, but it's really -*- C++ -*-
2
/*
3
* Copyright (C) 2011 Emweb bvba, Heverlee, Belgium
4
*
5
* See the LICENSE file for terms of use.
6
*/
7
8
#ifndef USER_H_
9
#define USER_H_
10
11
#include <Wt/WDateTime>
12
#include <Wt/Dbo/Types>
13
#include <Wt/Dbo/WtSqlTraits>
14
#include <Wt/Auth/Dbo/AuthInfo>
15
16
#include <string>
17
18
class
User
;
19
typedef
Wt::Auth::Dbo::AuthInfo<User>
AuthInfo
;
20
typedef
Wt::Dbo::collection< Wt::Dbo::ptr<User>
>
Users
;
21
22
class
User
:
public
Wt::Dbo::Dbo
<User>
23
{
24
public
:
25
User
();
26
27
std::string
name
;
/* a copy of auth info's user name */
28
int
gamesPlayed
;
29
long
long
score
;
30
Wt::WDateTime
lastGame
;
31
Wt::Dbo::collection< Wt::Dbo::ptr<AuthInfo>
>
authInfos
;
32
33
template
<
class
Action>
34
void
persist
(Action& a)
35
{
36
Wt::Dbo::field
(a,
gamesPlayed
,
"gamesPlayed"
);
37
Wt::Dbo::field
(a,
score
,
"score"
);
38
Wt::Dbo::field
(a,
lastGame
,
"lastGame"
);
39
40
Wt::Dbo::hasMany
(a,
authInfos
,
Wt::Dbo::ManyToOne
,
"user"
);
41
}
42
};
43
44
DBO_EXTERN_TEMPLATES
(
User
);
45
46
#endif // USER_H_
Generated on Fri May 31 2013 for
the C++ Web Toolkit (Wt)
by
1.8.3.1