uvw  1.3.0
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 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 427 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 461 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 472 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 438 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 480 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 496 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 451 of file util.hpp.


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