CONZEPT 16 C++ API
C16::User Class Reference

User buffer to operate on users of a database. More...

#include "C16/User.hpp"

Detailed Description

User buffer to operate on users of a database.

Examples

Iteration

#include "C16/Library.hpp"
using namespace C16;
void users_iterate(const Database& database)
{
User user(database);
for
(
Result result = user.read(Place::FIRST);
result != Result::NO_REC;
result = user.read(Place::NEXT)
)
{
...
}
}

Classes

class  Logout
 Logout of a user from a database. More...
 

Public Member Functions

 User (const Database &database)
 Constructs a user buffer. More...
 
const Databasedatabase () const
 Gets the database the user buffer relates to. More...
 
bool loaded () const
 Gets if a user is loaded into the user buffer. More...
 
unsigned int id () const
 Gets the id of the loaded user. More...
 
unsigned int number () const
 Gets the number of the loaded user. More...
 
const std::string & name () const
 Gets the name of the loaded user. More...
 
const Value::Datelogin_date () const
 Gets the date of the login of the loaded user to the database. More...
 
const Value::Timelogin_time () const
 Gets the time of the login of the loaded user to the database. More...
 
long long int login_duration () const
 Gets the duration since the login of the loaded user to the database in units of seconds. More...
 
const Value::Datelast_request_date () const
 Gets the date of the last request of the loaded user to the database. More...
 
const Value::Timelast_request_time () const
 Gets the time of the last request of the loaded user to the database. More...
 
long long int last_request_duration () const
 Gets the duration since the last request of the loaded user to the database in units of seconds. More...
 
const std::string & system_name () const
 Gets the name of the system of the loaded user. More...
 
const std::string & system_hostname () const
 Gets the hostname of the system of the loaded user. More...
 
const std::string & system_ip_address () const
 Gets the IP address of the system of the loaded user. More...
 
const std::string & system_account_name () const
 Gets the name of the system account of the loaded user. More...
 
const std::string & network_account_name () const
 Gets the name of the network account of the loaded user. More...
 
Result read (unsigned int id, Place place=Place::KEY)
 Reads a user by means of a id into the user buffer. More...
 
Result read (Place place)
 Reads a user by means of a place into the user buffer. More...
 
Result reload ()
 Reloads the loaded user. More...
 
void unload ()
 Unloads the loaded user. More...
 
Logout::Result log_out (const std::string &server_password=std::string()) const
 Logs the loaded user out of the database. More...
 

Constructor & Destructor Documentation

◆ User()

C16::User::User ( const Database database)
explicit

Constructs a user buffer.

Parameters
databaseDatabase the user buffer relates to

Member Function Documentation

◆ database()

const Database& C16::User::database ( ) const

Gets the database the user buffer relates to.

◆ loaded()

bool C16::User::loaded ( ) const

Gets if a user is loaded into the user buffer.

◆ id()

unsigned int C16::User::id ( ) const

Gets the id of the loaded user.

◆ number()

unsigned int C16::User::number ( ) const

Gets the number of the loaded user.

◆ name()

const std::string& C16::User::name ( ) const

Gets the name of the loaded user.

◆ login_date()

const Value::Date& C16::User::login_date ( ) const

Gets the date of the login of the loaded user to the database.

◆ login_time()

const Value::Time& C16::User::login_time ( ) const

Gets the time of the login of the loaded user to the database.

◆ login_duration()

long long int C16::User::login_duration ( ) const

Gets the duration since the login of the loaded user to the database in units of seconds.

◆ last_request_date()

const Value::Date& C16::User::last_request_date ( ) const

Gets the date of the last request of the loaded user to the database.

◆ last_request_time()

const Value::Time& C16::User::last_request_time ( ) const

Gets the time of the last request of the loaded user to the database.

◆ last_request_duration()

long long int C16::User::last_request_duration ( ) const

Gets the duration since the last request of the loaded user to the database in units of seconds.

◆ system_name()

const std::string& C16::User::system_name ( ) const

Gets the name of the system of the loaded user.

◆ system_hostname()

const std::string& C16::User::system_hostname ( ) const

Gets the hostname of the system of the loaded user.

◆ system_ip_address()

const std::string& C16::User::system_ip_address ( ) const

Gets the IP address of the system of the loaded user.

Returns
String representing the IP address of the system of the loaded user

The IP address is represented by a string of the form <block>.<block>.<block>.<block>, where the parts in angle brackets (< ... >) contain the following data:

  • <block> – Block of the IP address. An integer within an interval of 0 to 255.

◆ system_account_name()

const std::string& C16::User::system_account_name ( ) const

Gets the name of the system account of the loaded user.

◆ network_account_name()

const std::string& C16::User::network_account_name ( ) const

Gets the name of the network account of the loaded user.

◆ read() [1/2]

Result C16::User::read ( unsigned int  id,
Place  place = Place::KEY 
)

Reads a user by means of a id into the user buffer.

Parameters
idReference id
placePlace of the user
Place::KEYReads the user with the same id as the reference id.
Place::NEXTReads the user with the id following the reference id.
Returns
Result
Return values
Result::OKUser read and loaded.
Result::NO_RECUser inexistent. No user loaded.
Note
Users are ordered by id.

◆ read() [2/2]

Result C16::User::read ( Place  place)

Reads a user by means of a place into the user buffer.

Parameters
placePlace of the user
Place::FIRSTReads the first user.
Place::NEXTReads the user with the id following the id of the loaded user.
Returns
Result
Return values
Result::OKUser loaded.
Result::NO_RECUser inexistent or not loaded. No user loaded.
Note
Users are ordered by id.
See also
Example

◆ reload()

Result C16::User::reload ( )

Reloads the loaded user.

The user is identified by its id.

Returns
Result
Return values
Result::OKUser read and loaded.
Result::NO_RECUser inexistent or not loaded. No user loaded.

◆ unload()

void C16::User::unload ( )

Unloads the loaded user.

◆ log_out()

Logout::Result C16::User::log_out ( const std::string &  server_password = std::string()) const

Logs the loaded user out of the database.

Parameters
server_passwordPassword of the server
Returns
Result of the logout
Note
The user wont be logged out immediately but after a couple of seconds.
See also
Users::log_out
C16::User::database
const Database & database() const
Gets the database the user buffer relates to.
C16::User
User buffer to operate on users of a database.
Definition: User.hpp:57
C16::Place::NEXT
@ NEXT
Operate on the next entity.
C16::Place::FIRST
@ FIRST
Operate on the first entity.
Library.hpp
CONZEPT 16 C++ API.
C16::Database
Database hosted by a server.
Definition: Database.hpp:38
C16::Result
Result
Result of an operation related to a database entity.
Definition: Result.hpp:12
C16
Namespace.
Definition: Array.hpp:6
C16::Result::NO_REC
@ NO_REC
Entity inexistent.