GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
env Class Reference

#include "oct-env.h"

Collaboration diagram for env:

Public Member Functions

 env (const env &)=delete
 
envoperator= (const env &)=delete
 

Static Public Member Functions

static bool absolute_pathname (const std::string &s)
 
static std::string base_pathname (const std::string &s)
 
static bool chdir (const std::string &newdir)
 
static std::string get_current_directory (void)
 
static std::string get_home_directory (void)
 
static std::string get_host_name (void)
 
static std::string get_program_invocation_name (void)
 
static std::string get_program_name (void)
 
static std::string get_temp_directory (void)
 
static std::string get_user_config_directory (void)
 
static std::string get_user_data_directory (void)
 
static std::string get_user_name (void)
 
static std::string getenv (const std::string &name)
 
static bool have_x11_display (void)
 
static std::string make_absolute (const std::string &s, const std::string &dot_path=get_current_directory())
 
static std::string polite_directory_format (const std::string &name)
 
static void putenv (const std::string &name, const std::string &value)
 
static bool rooted_relative_pathname (const std::string &s)
 
static void set_program_name (const std::string &s)
 

Protected Member Functions

 env (void)
 

Private Member Functions

bool do_absolute_pathname (const std::string &s) const
 
std::string do_base_pathname (const std::string &s) const
 
bool do_chdir (const std::string &newdir)
 
std::string do_get_home_directory (void)
 
std::string do_get_host_name (void)
 
std::string do_get_temp_directory (void) const
 
std::string do_get_user_config_directory (void)
 
std::string do_get_user_data_directory (void)
 
std::string do_get_user_name (void)
 
std::string do_getcwd (void)
 
std::string do_getenv (const std::string &name) const
 
std::string do_make_absolute (const std::string &s, const std::string &dot_path) const
 
std::string do_polite_directory_format (const std::string &name)
 
void do_putenv (const std::string &name, const std::string &value) const
 
bool do_rooted_relative_pathname (const std::string &s) const
 
void do_set_program_name (const std::string &s)
 
void error (const std::string &) const
 
void error (int) const
 
void pathname_backup (std::string &path, int n) const
 

Static Private Member Functions

static void cleanup_instance (void)
 
static bool instance_ok (void)
 

Private Attributes

std::string m_current_directory
 
bool m_follow_symbolic_links
 
std::string m_host_name
 
std::string m_prog_invocation_name
 
std::string m_prog_name
 
std::string m_user_name
 
bool m_verbatim_pwd
 

Static Private Attributes

static envm_instance = nullptr
 

Detailed Description

Definition at line 37 of file oct-env.h.

Constructor & Destructor Documentation

◆ env() [1/2]

env::env ( void  )
protected

Definition at line 72 of file oct-env.cc.

Referenced by instance_ok().

◆ env() [2/2]

env::env ( const env )
delete

Member Function Documentation

◆ absolute_pathname()

bool env::absolute_pathname ( const std::string &  s)
static

Definition at line 110 of file oct-env.cc.

References do_absolute_pathname(), instance_ok(), and m_instance.

◆ base_pathname()

std::string env::base_pathname ( const std::string &  s)
static

Definition at line 124 of file oct-env.cc.

References do_base_pathname(), instance_ok(), and m_instance.

◆ chdir()

bool env::chdir ( const std::string &  newdir)
static

Definition at line 317 of file oct-env.cc.

References do_chdir(), instance_ok(), and m_instance.

◆ cleanup_instance()

static void env::cleanup_instance ( void  )
inlinestaticprivate

Definition at line 139 of file oct-env.h.

Referenced by instance_ok().

◆ do_absolute_pathname()

bool env::do_absolute_pathname ( const std::string &  s) const
private

Definition at line 379 of file oct-env.cc.

References is_dir_sep(), and len.

Referenced by absolute_pathname(), do_base_pathname(), and do_make_absolute().

◆ do_base_pathname()

std::string env::do_base_pathname ( const std::string &  s) const
private

Definition at line 428 of file oct-env.cc.

References dir_sep_chars, do_absolute_pathname(), and do_rooted_relative_pathname().

Referenced by base_pathname().

◆ do_chdir()

bool env::do_chdir ( const std::string &  newdir)
private

Definition at line 600 of file oct-env.cc.

References chdir(), do_getcwd(), do_make_absolute(), is_dir_sep(), m_current_directory, and m_follow_symbolic_links.

Referenced by chdir().

◆ do_get_home_directory()

std::string env::do_get_home_directory ( void  )
private

◆ do_get_host_name()

std::string env::do_get_host_name ( void  )
private

Definition at line 576 of file oct-env.cc.

References m_host_name, and octave_gethostname_wrapper().

Referenced by get_host_name().

◆ do_get_temp_directory()

std::string env::do_get_temp_directory ( void  ) const
private

Definition at line 208 of file oct-env.cc.

References do_getenv().

Referenced by get_temp_directory().

◆ do_get_user_config_directory()

std::string env::do_get_user_config_directory ( void  )
private

Definition at line 249 of file oct-env.cc.

References dir_sep_str(), do_get_home_directory(), do_getenv(), and u8_from_wstring().

Referenced by get_user_config_directory().

◆ do_get_user_data_directory()

std::string env::do_get_user_data_directory ( void  )
private

◆ do_get_user_name()

std::string env::do_get_user_name ( void  )
private

Definition at line 563 of file oct-env.cc.

References getuid(), and m_user_name.

Referenced by get_user_name().

◆ do_getcwd()

std::string env::do_getcwd ( void  )
private

Definition at line 521 of file oct-env.cc.

References getcwd(), m_current_directory, m_follow_symbolic_links, and m_verbatim_pwd.

Referenced by do_chdir(), and get_current_directory().

◆ do_getenv()

std::string env::do_getenv ( const std::string &  name) const
private

◆ do_make_absolute()

std::string env::do_make_absolute ( const std::string &  s,
const std::string &  dot_path 
) const
private

Definition at line 445 of file oct-env.cc.

References dir_sep_chars, dir_sep_str(), do_absolute_pathname(), is_dir_sep(), and pathname_backup().

Referenced by do_chdir(), and make_absolute().

◆ do_polite_directory_format()

std::string env::do_polite_directory_format ( const std::string &  name)
private

Definition at line 358 of file oct-env.cc.

References do_get_home_directory(), is_dir_sep(), and len.

Referenced by polite_directory_format().

◆ do_putenv()

void env::do_putenv ( const std::string &  name,
const std::string &  value 
) const
private

◆ do_rooted_relative_pathname()

bool env::do_rooted_relative_pathname ( const std::string &  s) const
private

Definition at line 400 of file oct-env.cc.

References is_dir_sep(), and len.

Referenced by do_base_pathname(), and rooted_relative_pathname().

◆ do_set_program_name()

void env::do_set_program_name ( const std::string &  s)
private

◆ error() [1/2]

void env::error ( const std::string &  s) const
private

Definition at line 673 of file oct-env.cc.

◆ error() [2/2]

void env::error ( int  err_num) const
private

Definition at line 667 of file oct-env.cc.

◆ get_current_directory()

std::string env::get_current_directory ( void  )
static

Definition at line 138 of file oct-env.cc.

References do_getcwd(), instance_ok(), and m_instance.

◆ get_home_directory()

std::string env::get_home_directory ( void  )
static

Definition at line 145 of file oct-env.cc.

References do_get_home_directory(), instance_ok(), and m_instance.

◆ get_host_name()

std::string env::get_host_name ( void  )
static

Definition at line 201 of file oct-env.cc.

References do_get_host_name(), instance_ok(), and m_instance.

◆ get_program_invocation_name()

std::string env::get_program_invocation_name ( void  )
static

Definition at line 180 of file oct-env.cc.

References instance_ok(), m_instance, and m_prog_invocation_name.

◆ get_program_name()

std::string env::get_program_name ( void  )
static

Definition at line 173 of file oct-env.cc.

References instance_ok(), m_instance, and m_prog_name.

◆ get_temp_directory()

std::string env::get_temp_directory ( void  )
static

Definition at line 152 of file oct-env.cc.

References do_get_temp_directory(), instance_ok(), and m_instance.

Referenced by tempnam().

◆ get_user_config_directory()

std::string env::get_user_config_directory ( void  )
static

Definition at line 159 of file oct-env.cc.

References do_get_user_config_directory(), instance_ok(), and m_instance.

◆ get_user_data_directory()

std::string env::get_user_data_directory ( void  )
static

Definition at line 166 of file oct-env.cc.

References do_get_user_data_directory(), instance_ok(), and m_instance.

◆ get_user_name()

std::string env::get_user_name ( void  )
static

Definition at line 194 of file oct-env.cc.

References do_get_user_name(), instance_ok(), and m_instance.

◆ getenv()

std::string env::getenv ( const std::string &  name)
static

Definition at line 296 of file oct-env.cc.

References do_getenv(), instance_ok(), and m_instance.

Referenced by have_x11_display().

◆ have_x11_display()

bool env::have_x11_display ( void  )
static

Definition at line 309 of file oct-env.cc.

References getenv().

◆ instance_ok()

◆ make_absolute()

std::string env::make_absolute ( const std::string &  s,
const std::string &  dot_path = get_current_directory () 
)
static

Definition at line 131 of file oct-env.cc.

References do_make_absolute(), instance_ok(), and m_instance.

◆ operator=()

env& env::operator= ( const env )
delete

◆ pathname_backup()

void env::pathname_backup ( std::string &  path,
int  n 
) const
private

Definition at line 635 of file oct-env.cc.

References is_dir_sep(), min(), and n.

Referenced by do_make_absolute().

◆ polite_directory_format()

std::string env::polite_directory_format ( const std::string &  name)
static

Definition at line 103 of file oct-env.cc.

References do_polite_directory_format(), instance_ok(), and m_instance.

◆ putenv()

void env::putenv ( const std::string &  name,
const std::string &  value 
)
static

Definition at line 303 of file oct-env.cc.

References putenv_wrapper().

◆ rooted_relative_pathname()

bool env::rooted_relative_pathname ( const std::string &  s)
static

Definition at line 117 of file oct-env.cc.

References do_rooted_relative_pathname(), instance_ok(), and m_instance.

◆ set_program_name()

void env::set_program_name ( const std::string &  s)
static

Definition at line 187 of file oct-env.cc.

References do_set_program_name(), instance_ok(), and m_instance.

Member Data Documentation

◆ m_current_directory

std::string env::m_current_directory
private

Definition at line 151 of file oct-env.h.

Referenced by do_chdir(), and do_getcwd().

◆ m_follow_symbolic_links

bool env::m_follow_symbolic_links
private

Definition at line 144 of file oct-env.h.

Referenced by do_chdir(), and do_getcwd().

◆ m_host_name

std::string env::m_host_name
private

Definition at line 160 of file oct-env.h.

Referenced by do_get_host_name().

◆ m_instance

◆ m_prog_invocation_name

std::string env::m_prog_invocation_name
private

Definition at line 156 of file oct-env.h.

Referenced by do_set_program_name(), and get_program_invocation_name().

◆ m_prog_name

std::string env::m_prog_name
private

Definition at line 154 of file oct-env.h.

Referenced by do_set_program_name(), and get_program_name().

◆ m_user_name

std::string env::m_user_name
private

Definition at line 158 of file oct-env.h.

Referenced by do_get_user_name().

◆ m_verbatim_pwd

bool env::m_verbatim_pwd
private

Definition at line 148 of file oct-env.h.

Referenced by do_getcwd().


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