uvw  1.14.1
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 UName uname () noexcept
 Gets name and information about the current kernel. More...
 
static Passwd passwd () noexcept
 Gets a subset of the password file entry. More...
 

Detailed Description

OS dedicated utilities.

Definition at line 490 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 550 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 561 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 527 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 569 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 513 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 600 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 500 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 540 of file util.hpp.

◆ uname()

static UName uvw::Utilities::OS::uname ( )
inlinestaticnoexcept

Gets name and information about the current kernel.

This function can be used to get name and information about the current kernel. The populated data includes the operating system name, release, version, and machine.

Returns
Name and information about the current kernel.

Definition at line 582 of file util.hpp.


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