uvw  1.11.2
Static Public Member Functions | List of all members
uvw::Utilities::OS Struct Reference

OS dedicated utilities. More...

#include <util.hpp>

Static Public Member Functions

static PidType pid () noexcept
 Returns the current process id. More...
 
static PidType parent () noexcept
 Returns the parent process id. More...
 
static std::string homedir () noexcept
 Gets the current user's home directory. More...
 
static std::string tmpdir () noexcept
 Gets the temp directory. More...
 
static std::string env (const std::string &name) noexcept
 Retrieves an environment variable. More...
 
static bool env (const std::string &name, const std::string &value) noexcept
 Creates, updates or deletes an environment variable. More...
 
static std::string hostname () noexcept
 Returns the hostname. More...
 
static Passwd passwd () noexcept
 Gets a subset of the password file entry. More...
 

Detailed Description

OS dedicated utilities.

Definition at line 441 of file util.hpp.

Member Function Documentation

◆ env() [1/2]

static std::string uvw::Utilities::OS::env ( const std::string &  name)
inlinestaticnoexcept

Retrieves an environment variable.

Parameters
nameThe name of the variable to be retrieved.
Returns
The value of the environment variable, an empty string in case of errors.

Definition at line 501 of file util.hpp.

◆ env() [2/2]

static bool uvw::Utilities::OS::env ( const std::string &  name,
const std::string &  value 
)
inlinestaticnoexcept

Creates, updates or deletes an environment variable.

Parameters
nameThe name of the variable to be updated.
valueThe value to be used for the variable (an empty string to unset it).
Returns
True in case of success, false otherwise.

Definition at line 512 of file util.hpp.

◆ homedir()

static std::string uvw::Utilities::OS::homedir ( )
inlinestaticnoexcept

Gets the current user's home directory.

See the official documentation for further details.

Returns
The current user's home directory, an empty string in case of errors.

Definition at line 478 of file util.hpp.

◆ hostname()

static std::string uvw::Utilities::OS::hostname ( )
inlinestaticnoexcept

Returns the hostname.

Returns
The hostname, an empty string in case of errors.

Definition at line 520 of file util.hpp.

◆ parent()

static PidType uvw::Utilities::OS::parent ( )
inlinestaticnoexcept

Returns the parent process id.

See the official documentation for further details.

Returns
The parent process id.

Definition at line 464 of file util.hpp.

◆ passwd()

static Passwd uvw::Utilities::OS::passwd ( )
inlinestaticnoexcept

Gets a subset of the password file entry.

This function can be used to get the subset of the password file entry for the current effective uid (not the real uid).

See the official documentation for further details.

Returns
The accessible subset of the password file entry.

Definition at line 536 of file util.hpp.

◆ pid()

static PidType uvw::Utilities::OS::pid ( )
inlinestaticnoexcept

Returns the current process id.

See the official documentation for further details.

Returns
The current process id.

Definition at line 451 of file util.hpp.

◆ tmpdir()

static std::string uvw::Utilities::OS::tmpdir ( )
inlinestaticnoexcept

Gets the temp directory.

See the official documentation for further details.

Returns
The temp directory, an empty string in case of errors.

Definition at line 491 of file util.hpp.


The documentation for this struct was generated from the following file: