Wt examples  3.3.0
/home/koen/project/wt/public-git/wt/examples/hangman/Session.h
Go to the documentation of this file.
00001 // This may look like C code, but it's really -*- C++ -*-
00002 /*
00003  * Copyright (C) 2011 Emweb bvba, Heverlee, Belgium.
00004  *
00005  * See the LICENSE file for terms of use.
00006  */
00007 
00008 #ifndef SESSION_H_
00009 #define SESSION_H_
00010 
00011 #include <vector>
00012 
00013 #include <Wt/Auth/Login>
00014 
00015 #include <Wt/Dbo/Session>
00016 #include <Wt/Dbo/ptr>
00017 #include <Wt/Dbo/backend/Sqlite3>
00018 
00019 #include "User.h"
00020 
00021 typedef Wt::Auth::Dbo::UserDatabase<AuthInfo> UserDatabase;
00022 
00023 class Session
00024 {
00025 public:
00026   static void configureAuth();
00027 
00028   Session();
00029   ~Session();
00030 
00031   Wt::Auth::AbstractUserDatabase& users();
00032   Wt::Auth::Login& login() { return login_; }
00033 
00034   std::vector<User> topUsers(int limit);
00035 
00036   /*
00037    * These methods deal with the currently logged in user
00038    */
00039   std::string userName() const;
00040   int findRanking();
00041   void addToScore(int s);
00042 
00043   static const Wt::Auth::AuthService& auth();
00044   static const Wt::Auth::AbstractPasswordService& passwordAuth();
00045   static const std::vector<const Wt::Auth::OAuthService *>& oAuth();
00046 
00047 private:
00048   Wt::Dbo::backend::Sqlite3 sqlite3_;
00049   mutable Wt::Dbo::Session session_;
00050   UserDatabase *users_;
00051   Wt::Auth::Login login_;
00052 
00053   Wt::Dbo::ptr<User> user() const;
00054 };
00055 
00056 #endif //SESSION_H_

Generated on Mon Apr 8 2013 for the C++ Web Toolkit (Wt) by doxygen 1.7.5.1