Wt examples
3.3.1
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
build
buildd
witty-3.3.1
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_
Wt::WDateTime
User::lastGame
Wt::WDateTime lastGame
Definition:
User.h:30
User::User
User()
Definition:
User.C:17
DBO_EXTERN_TEMPLATES
DBO_EXTERN_TEMPLATES(User)
User
Definition:
User.h:22
Wt::Dbo::Dbo
User::gamesPlayed
int gamesPlayed
Definition:
User.h:28
Wt::Auth::Dbo::AuthInfo
User::score
long long score
Definition:
User.h:29
Wt::Dbo::field
void field(Action &action, V &value, const std::string &name, int size=-1)
Wt::Dbo::hasMany
void hasMany(Action &action, collection< ptr< C > > &value, RelationType type, const std::string &name=std::string())
AuthInfo
Wt::Auth::Dbo::AuthInfo< User > AuthInfo
Definition:
User.h:18
Wt::Dbo::collection
User::authInfos
Wt::Dbo::collection< Wt::Dbo::ptr< AuthInfo > > authInfos
Definition:
User.h:31
User::name
std::string name
Definition:
User.h:27
Wt::Dbo::ManyToOne
User::persist
void persist(Action &a)
Definition:
User.h:34
Users
Wt::Dbo::collection< Wt::Dbo::ptr< User > > Users
Definition:
User.h:20
Generated on Wed Jun 11 2014 for
the C++ Web Toolkit (Wt)
by
1.8.7