BuildCache
Public Member Functions | Private Attributes | List of all members
bcache::env_var_t Class Reference

A helper class for reading and parsing environment variables. More...

#include <env_utils.hpp>

Public Member Functions

 env_var_t (const std::string &name)
 Read an environment variable. More...
 
 operator bool () const
 
const std::string & as_string () const
 
int64_t as_int64 () const
 
bool as_bool () const
 

Private Attributes

std::string m_value
 
bool m_defined
 

Detailed Description

A helper class for reading and parsing environment variables.

Constructor & Destructor Documentation

◆ env_var_t()

bcache::env_var_t::env_var_t ( const std::string &  name)

Read an environment variable.

Parameters
nameThe name of the environment variable.

Member Function Documentation

◆ as_bool()

bool bcache::env_var_t::as_bool ( ) const
Returns
the environment variable value as a boolean value.

◆ as_int64()

int64_t bcache::env_var_t::as_int64 ( ) const
Returns
the environment variable value as an integer.

◆ as_string()

const std::string& bcache::env_var_t::as_string ( ) const
inline
Returns
the environment variable value as a string.

◆ operator bool()

bcache::env_var_t::operator bool ( ) const
inline
Returns
true if the environment variable was defined.

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