batchlas::EnvValue Class Reference

Overview

A raw captured environment value, shaped like the std::getenv call it replaces.

Distinguishes "unset" from "set to the empty string", and hands back a const char* so a migrated call site keeps the parser it already has.

Definition at line 35 of file settings.hh.

#include <batchlas/settings.hh>

Constructors

◆ EnvValue() [1/2]

batchlas::EnvValue::EnvValue ( )
default

An unset value.

◆ EnvValue() [2/2]

batchlas::EnvValue::EnvValue ( const char * raw)
inlineexplicit

Construct from what std::getenv returned.

Parameters
rawthe variable's value, or nullptr for an unset variable

Definition at line 42 of file settings.hh.

Functions

◆ unset()

EnvValue batchlas::EnvValue::unset ( )
inlinestatic

An unset value.

Definition at line 50 of file settings.hh.

◆ of()

EnvValue batchlas::EnvValue::of ( std::string v)
inlinestatic

A value that is set to v (which may be empty).

Definition at line 53 of file settings.hh.

◆ is_set()

bool batchlas::EnvValue::is_set ( ) const
inlinenoexcept

True when the variable was set, including set to the empty string.

Definition at line 61 of file settings.hh.

◆ get()

const char * batchlas::EnvValue::get ( ) const
inlinenoexcept

The value, or nullptr when unset: the drop-in for std::getenv("...").

Definition at line 64 of file settings.hh.

◆ value()

const std::string & batchlas::EnvValue::value ( ) const
inlinenoexcept

The value as text; empty when unset.

Definition at line 67 of file settings.hh.