Added a new UserController class.

This commit is contained in:
Relintai 2021-08-22 20:20:30 +02:00
parent adfcdb8514
commit 6c76f625af
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,25 @@
#include "user_controller.h"
#include "user.h"
UserController *UserController::get_singleton() {
return _self;
}
UserController::UserController() :
Object() {
if (_self) {
printf("UserController::UserController(): Error! self is not null!/n");
}
_self = this;
}
UserController::~UserController() {
if (_self == this) {
_self = nullptr;
}
}
UserController *UserController::_self = nullptr;

View File

@ -0,0 +1,21 @@
#ifndef USER_CONTROLLER_H
#define USER_CONTROLLER_H
#include "core/object.h"
#include <string>
class User;
class UserController : public Object {
public:
static UserController *get_singleton();
UserController();
~UserController();
protected:
static UserController *_self;
};
#endif