Emergency 2017 Dokumentation  v3.0.1
qsf::editor::base::UserManager Class Reference

User manager class. More...

#include <UserManager.h>

Public Types

typedef std::vector< User * > UserList
 
typedef boost::container::flat_map< uint32, User * > UserMap
 

Public Member Functions

 UserManager (RightsManager &rightsManager)
 Constructor. More...
 
virtual ~UserManager ()
 Destructor. More...
 
RightsManagergetRightsManager () const
 Return the rights manager the user manager is using. More...
 
UsercreateUser ()
 Create a new user instance. More...
 
UsercreateUserWithId (uint32 id)
 Create a new user instance with an enforced given unique user identifier. More...
 
bool destroyUserById (uint32 id)
 Destroy a user instance by using its unique identifier. More...
 
void destroyAllUsers ()
 Destroy all users within this user manager. More...
 
UsergetUserById (uint32 id) const
 Return a user instance by using its unique identifier. More...
 
const UserListgetUsers () const
 Return the user list. More...
 
std::string getFilename () const
 Return the local filename of the user manager. More...
 
bool loadByFilename (const std::string &filename)
 Load a user manager by using a given filename. More...
 
bool saveByFilename (const std::string &filename)
 Save the user manager by using a given filename. More...
 

Additional Inherited Members

- Protected Member Functions inherited from qsf::Manager
 Manager ()
 Default constructor. More...
 
virtual ~Manager ()
 Destructor. More...
 

Detailed Description

User manager class.

Definition at line 58 of file UserManager.h.

Member Typedef Documentation

Definition at line 66 of file UserManager.h.

typedef boost::container::flat_map<uint32, User*> qsf::editor::base::UserManager::UserMap

Definition at line 67 of file UserManager.h.

Constructor & Destructor Documentation

qsf::editor::base::UserManager::UserManager ( RightsManager rightsManager)
inlineexplicit

Constructor.

Parameters
[in]rightsManagerRights manager, instance must stay valid as long as the user manager exists

Definition at line 24 of file UserManager-inl.h.

qsf::editor::base::UserManager::~UserManager ( )
inlinevirtual

Destructor.

Definition at line 30 of file UserManager-inl.h.

Member Function Documentation

User* qsf::editor::base::UserManager::createUser ( )

Create a new user instance.

Returns
The created user instance, null pointer on error, do no destroy the returned instance and do need keep a reference to it outside the C runtime stack (use the unique user ID instead)
User* qsf::editor::base::UserManager::createUserWithId ( uint32  id)

Create a new user instance with an enforced given unique user identifier.

Parameters
[in]idThe unique user identifier
Returns
The created user instance, null pointer on error (e.g. ID already used), do no destroy the returned instance and do need keep a reference to it outside the C runtime stack (use the unique user ID instead)
Note
  • Use "createUser()" instead of "createUserWithId()" whenever possible, do not enforce unique user identifier if you can avoid it
void qsf::editor::base::UserManager::destroyAllUsers ( )

Destroy all users within this user manager.

bool qsf::editor::base::UserManager::destroyUserById ( uint32  id)

Destroy a user instance by using its unique identifier.

Parameters
[in]idThe unique user identifier
Returns
"true" if all went fine, else "false" (unknown user identifier?)
std::string qsf::editor::base::UserManager::getFilename ( ) const
inline

Return the local filename of the user manager.

Returns
The local UTF-8 filename in platform-independent notation of the user manager

Definition at line 54 of file UserManager-inl.h.

RightsManager & qsf::editor::base::UserManager::getRightsManager ( ) const
inline

Return the rights manager the user manager is using.

Returns
The rights manager the user manager is using, do not destroy the instance

Definition at line 36 of file UserManager-inl.h.

User * qsf::editor::base::UserManager::getUserById ( uint32  id) const
inline

Return a user instance by using its unique identifier.

Parameters
[in]idThe unique user identifier
Returns
The requested user instance, null pointer on error (maybe the ID is already used?), do not destroy the instance

Definition at line 43 of file UserManager-inl.h.

const UserManager::UserList & qsf::editor::base::UserManager::getUsers ( ) const
inline

Return the user list.

Returns
Reference to the internal user list, do not manipulate the list or destroy the users

Definition at line 49 of file UserManager-inl.h.

bool qsf::editor::base::UserManager::loadByFilename ( const std::string &  filename)

Load a user manager by using a given filename.

Parameters
[in]filenameUTF-8 filename in platform-independent notation of the user manager to load
Returns
"true" if all went fine, else "false" (file not found?)
Note
  • The current user manager will get lost, so, you might want to save a manipulated user manager before loading a new one
  • The local UTF-8 filename in platform-independent notation of the user manager is set automatically
Todo:
  • TODO(co) For now, we only support JSON
bool qsf::editor::base::UserManager::saveByFilename ( const std::string &  filename)

Save the user manager by using a given filename.

Parameters
[in]filenameUTF-8 filename in platform-independent notation of the user manager to save
Returns
"true" if all went fine, else "false"
Note
  • The local UTF-8 filename in platform-independent notation of the user manager is not changed
Todo:
  • TODO(co) For now, we only support JSON

The documentation for this class was generated from the following files: