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

#include "oct-env.h"

Collaboration diagram for octave::sys::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_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) const
 
std::string do_get_host_name (void) const
 
std::string do_get_temp_directory (void) const
 
std::string do_get_user_config_directory (void) const
 
std::string do_get_user_name (void) const
 
std::string do_getcwd (void) const
 
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) const
 
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) const
 
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 current_directory
 
bool follow_symbolic_links
 
std::string host_name
 
std::string prog_invocation_name
 
std::string prog_name
 
std::string user_name
 
bool verbatim_pwd
 

Static Private Attributes

static envinstance = nullptr
 

Detailed Description

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

Constructor & Destructor Documentation

◆ env() [1/2]

octave::sys::env::env ( void  )
protected

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

References do_get_host_name(), do_get_user_name(), and do_getcwd().

Referenced by instance_ok().

◆ env() [2/2]

octave::sys::env::env ( const env )
delete

Member Function Documentation

◆ absolute_pathname()

◆ base_pathname()

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

◆ chdir()

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

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

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

Referenced by octave::interpreter::chdir().

◆ cleanup_instance()

static void octave::sys::env::cleanup_instance ( void  )
inlinestaticprivate

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

Referenced by instance_ok().

◆ do_absolute_pathname()

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

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

References octave::sys::file_ops::is_dir_sep(), and len.

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

◆ do_base_pathname()

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

◆ do_chdir()

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

◆ do_get_home_directory()

std::string octave::sys::env::do_get_home_directory ( void  ) const
private

◆ do_get_host_name()

std::string octave::sys::env::do_get_host_name ( void  ) const
private

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

References host_name, and octave_gethostname_wrapper().

Referenced by env(), and get_host_name().

◆ do_get_temp_directory()

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

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

References do_getenv().

Referenced by get_temp_directory().

◆ do_get_user_config_directory()

std::string octave::sys::env::do_get_user_config_directory ( void  ) const
private

◆ do_get_user_name()

std::string octave::sys::env::do_get_user_name ( void  ) const
private

◆ do_getcwd()

std::string octave::sys::env::do_getcwd ( void  ) const
private

◆ do_getenv()

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

◆ do_make_absolute()

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

◆ do_polite_directory_format()

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

◆ do_putenv()

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

◆ do_rooted_relative_pathname()

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

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

References octave::sys::file_ops::is_dir_sep(), and len.

Referenced by do_base_pathname(), and rooted_relative_pathname().

◆ do_set_program_name()

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

◆ error() [1/2]

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

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

◆ error() [2/2]

void octave::sys::env::error ( int  err_num) const
private

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

◆ get_current_directory()

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

◆ get_home_directory()

◆ get_host_name()

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

◆ get_program_invocation_name()

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

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

References instance, instance_ok(), and prog_invocation_name.

Referenced by maybe_initialize_magick().

◆ get_program_name()

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

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

References instance, instance_ok(), and prog_name.

◆ get_temp_directory()

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

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

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

Referenced by octave::sys::tempnam().

◆ get_user_config_directory()

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

◆ get_user_name()

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

◆ getenv()

◆ have_x11_display()

bool octave::sys::env::have_x11_display ( void  )
static

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

References getenv().

◆ instance_ok()

◆ make_absolute()

◆ operator=()

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

◆ pathname_backup()

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

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

References octave::sys::file_ops::is_dir_sep(), min(), n, and path.

Referenced by do_make_absolute().

◆ polite_directory_format()

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

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

References do_polite_directory_format(), instance, instance_ok(), and name.

◆ putenv()

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

◆ rooted_relative_pathname()

◆ set_program_name()

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

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

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

Referenced by main().

Member Data Documentation

◆ current_directory

std::string octave::sys::env::current_directory
mutableprivate

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

Referenced by do_chdir(), and do_getcwd().

◆ follow_symbolic_links

bool octave::sys::env::follow_symbolic_links
private

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

Referenced by do_chdir(), and do_getcwd().

◆ host_name

std::string octave::sys::env::host_name
mutableprivate

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

Referenced by do_get_host_name().

◆ instance

◆ prog_invocation_name

std::string octave::sys::env::prog_invocation_name
mutableprivate

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

Referenced by do_set_program_name(), and get_program_invocation_name().

◆ prog_name

std::string octave::sys::env::prog_name
mutableprivate

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

Referenced by do_set_program_name(), and get_program_name().

◆ user_name

std::string octave::sys::env::user_name
mutableprivate

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

Referenced by do_get_user_name().

◆ verbatim_pwd

bool octave::sys::env::verbatim_pwd
private

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

Referenced by do_getcwd().


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