Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef USER_H_
00009 #define USER_H_
00010
00011 #include <Wt/WDateTime>
00012 #include <Wt/Dbo/Dbo>
00013 #include <Wt/Dbo/WtSqlTraits>
00014
00015 #include <string>
00016
00017 class User : public Wt::Dbo::ptr<User> {
00018 public:
00019 std::string name;
00020 int gamesPlayed;
00021 long long score;
00022 Wt::WDateTime lastLogin;
00023
00024 template<class Action>
00025 void persist(Action& a)
00026 {
00027 Wt::Dbo::field(a, name, "name");
00028 Wt::Dbo::field(a, password_, "password");
00029 Wt::Dbo::field(a, gamesPlayed, "gamesPlayed");
00030 Wt::Dbo::field(a, score, "score");
00031 Wt::Dbo::field(a, lastLogin, "lastLogin");
00032 }
00033
00034 User() {}
00035
00036 void setPassword(const std::string& password);
00037 bool authenticate(const std::string& password) const;
00038
00039 User(const std::string &name, const std::string &password);
00040
00041 private:
00042 std::string password_;
00043 };
00044
00045 typedef Wt::Dbo::collection< Wt::Dbo::ptr<User> > Users;
00046
00047 #endif //USER_H_