Wt examples  4.0.0
Session.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 SESSION_H_
9 #define SESSION_H_
10 
11 #include <vector>
12 
13 #include <Wt/Auth/Login.h>
14 
15 #include <Wt/Dbo/Session.h>
16 #include <Wt/Dbo/ptr.h>
17 #include <Wt/Dbo/backend/Sqlite3.h>
18 
19 #include "User.h"
20 
21 using namespace Wt;
22 
24 
25 class Session
26 {
27 public:
28  static void configureAuth();
29 
30  Session();
31  ~Session();
32 
34  Auth::Login& login() { return login_; }
35 
36  std::vector<User> topUsers(int limit);
37 
38  /*
39  * These methods deal with the currently logged in user
40  */
41  std::string userName() const;
42  int findRanking();
43  void addToScore(int s);
44 
45  static const Auth::AuthService& auth();
46  static const Auth::AbstractPasswordService& passwordAuth();
47  static const std::vector<const Auth::OAuthService *>& oAuth();
48 
49 private:
51  std::unique_ptr<UserDatabase> users_;
53 
54  Dbo::ptr<User> user() const;
55 };
56 
57 #endif //SESSION_H_
Dbo::Session session_
Definition: Session.h:50
Auth::Dbo::UserDatabase< AuthInfo > UserDatabase
Definition: Session.h:23
Auth::Login & login()
Definition: Session.h:34
std::unique_ptr< UserDatabase > users_
Definition: Session.h:51
Auth::Login login_
Definition: Session.h:52

Generated on Mon Sep 4 2017 for the C++ Web Toolkit (Wt) by doxygen 1.8.11