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

#include "load-path.h"

Collaboration diagram for load_path:

Classes

class  dir_info
 
class  file_info
 
class  package_info
 

Public Types

typedef void(* hook_fcn_ptr) (const std::string &dir)
 

Public Member Functions

 load_path (const load_path &)=delete
 
 load_path (interpreter &interp)
 
 ~load_path (void)=default
 
void append (const std::string &dir, bool warn=false)
 
void clear (void)
 
bool contains_canonical (const std::string &dir_name) const
 
bool contains_file_in_dir (const std::string &file_name, const std::string &dir_name)
 
std::list< std::string > dir_list (void) const
 
string_vector dirs (void) const
 
void display (std::ostream &os) const
 
void execute_pkg_add (const std::string &dir)
 
void execute_pkg_del (const std::string &dir)
 
string_vector fcn_names (void) const
 
string_vector files (const std::string &dir, bool omit_exts=false) const
 
string_vector find_all_first_of (const string_vector &files) const
 
std::string find_dir (const std::string &dir) const
 
std::string find_fcn (const std::string &fcn, const std::string &pack_name="")
 
std::string find_fcn (const std::string &fcn, std::string &dir_name, const std::string &pack_name="")
 
std::string find_fcn_file (const std::string &fcn, const std::string &pack_name="")
 
std::string find_file (const std::string &file) const
 
std::string find_first_of (const string_vector &files) const
 
string_vector find_matching_dirs (const std::string &dir) const
 
std::string find_method (const std::string &class_name, const std::string &meth, const std::string &pack_name="")
 
std::string find_method (const std::string &class_name, const std::string &meth, std::string &dir_name, const std::string &pack_name="")
 
std::string find_mex_file (const std::string &fcn, const std::string &pack_name="")
 
std::string find_oct_file (const std::string &fcn, const std::string &pack_name="")
 
bool find_package (const std::string &package_name) const
 
std::string find_private_fcn (const std::string &dir, const std::string &fcn, const std::string &pack_name="")
 
std::function< void(const std::string &)> get_add_hook (void)
 
std::list< std::string > get_all_package_names (bool only_top_level=true) const
 
std::string get_command_line_path (void) const
 
std::function< void(const std::string &)> get_remove_hook (void)
 
void initialize (bool set_initial_path=false)
 
std::list< std::string > methods (const std::string &class_name, const std::string &pack_name="")
 
load_pathoperator= (const load_path &)=delete
 
std::list< std::string > overloads (const std::string &meth) const
 
std::string path (void) const
 
void prepend (const std::string &dir, bool warn=false)
 
void read_dir_config (const std::string &dir) const
 
bool remove (const std::string &dir)
 
void set (const std::string &p, bool warn=false, bool is_init=false)
 
void set_add_hook (const std::function< void(const std::string &)> &f)
 
void set_command_line_path (const std::string &p)
 
void set_remove_hook (const std::function< void(const std::string &)> &f)
 
std::string system_path (void) const
 
void update (void)
 

Static Public Attributes

static const int M_FILE = 1
 
static const int MEX_FILE = 4
 
static const int OCT_FILE = 2
 

Private Types

typedef abs_dir_cache_type::iterator abs_dir_cache_iterator
 
typedef std::map< std::string, dir_infoabs_dir_cache_type
 
typedef abs_dir_cache_type::const_iterator const_abs_dir_cache_iterator
 
typedef dir_info_list_type::const_iterator const_dir_info_list_iterator
 
typedef fcn_map_type::const_iterator const_fcn_map_iterator
 
typedef file_info_list_type::const_iterator const_file_info_list_iterator
 
typedef method_map_type::const_iterator const_method_map_iterator
 
typedef package_map_type::const_iterator const_package_map_iterator
 
typedef private_fcn_map_type::const_iterator const_private_fcn_map_iterator
 
typedef dir_info_list_type::iterator dir_info_list_iterator
 
typedef std::list< dir_infodir_info_list_type
 
typedef fcn_map_type::iterator fcn_map_iterator
 
typedef std::map< std::string, file_info_list_typefcn_map_type
 
typedef file_info_list_type::iterator file_info_list_iterator
 
typedef std::list< file_infofile_info_list_type
 
typedef method_map_type::iterator method_map_iterator
 
typedef std::map< std::string, fcn_map_typemethod_map_type
 
typedef package_map_type::iterator package_map_iterator
 
typedef std::map< std::string, package_infopackage_map_type
 
typedef private_fcn_map_type::iterator private_fcn_map_iterator
 
typedef std::map< std::string, dir_info::fcn_file_map_typeprivate_fcn_map_type
 

Private Member Functions

void add (const dir_info &di, bool at_end, const std::string &pname="", bool updating=false)
 
void add (const std::string &dir, bool at_end, bool warn)
 
bool contains (const std::string &dir) const
 
void execute_pkg_add_or_del (const std::string &dir, const std::string &script_file)
 
dir_info_list_iterator find_dir_info (const std::string &dir)
 
const_dir_info_list_iterator find_dir_info (const std::string &dir) const
 
string_vector get_file_list (const dir_info::fcn_file_map_type &lst) const
 
package_infoget_package (const std::string &name)
 
bool is_package (const std::string &name) const
 
void move (const dir_info &di, bool at_end, const std::string &pname="")
 
void move (dir_info_list_iterator i, bool at_end)
 
void remove (const dir_info &di, const std::string &pname="")
 

Private Attributes

std::function< void(const std::string &)> add_hook
 
std::string m_command_line_path
 
dir_info_list_type m_dir_info_list
 
std::set< std::string > m_init_dirs
 
interpreterm_interpreter
 
package_map_type m_package_map
 
package_info m_top_level_package
 
std::function< void(const std::string &)> remove_hook
 

Static Private Attributes

static abs_dir_cache_type s_abs_dir_cache
 
static std::string s_sys_path
 

Friends

dir_info::fcn_file_map_type get_fcn_files (const std::string &d)
 

Detailed Description

Definition at line 44 of file load-path.h.

Member Typedef Documentation

◆ abs_dir_cache_iterator

typedef abs_dir_cache_type::iterator load_path::abs_dir_cache_iterator
private

Definition at line 366 of file load-path.h.

◆ abs_dir_cache_type

typedef std::map<std::string, dir_info> load_path::abs_dir_cache_type
private

Definition at line 363 of file load-path.h.

◆ const_abs_dir_cache_iterator

typedef abs_dir_cache_type::const_iterator load_path::const_abs_dir_cache_iterator
private

Definition at line 365 of file load-path.h.

◆ const_dir_info_list_iterator

typedef dir_info_list_type::const_iterator load_path::const_dir_info_list_iterator
private

Definition at line 360 of file load-path.h.

◆ const_fcn_map_iterator

typedef fcn_map_type::const_iterator load_path::const_fcn_map_iterator
private

Definition at line 376 of file load-path.h.

◆ const_file_info_list_iterator

typedef file_info_list_type::const_iterator load_path::const_file_info_list_iterator
private

Definition at line 370 of file load-path.h.

◆ const_method_map_iterator

typedef method_map_type::const_iterator load_path::const_method_map_iterator
private

Definition at line 389 of file load-path.h.

◆ const_package_map_iterator

typedef package_map_type::const_iterator load_path::const_package_map_iterator
private

Definition at line 515 of file load-path.h.

◆ const_private_fcn_map_iterator

typedef private_fcn_map_type::const_iterator load_path::const_private_fcn_map_iterator
private

Definition at line 383 of file load-path.h.

◆ dir_info_list_iterator

typedef dir_info_list_type::iterator load_path::dir_info_list_iterator
private

Definition at line 361 of file load-path.h.

◆ dir_info_list_type

typedef std::list<dir_info> load_path::dir_info_list_type
private

Definition at line 358 of file load-path.h.

◆ fcn_map_iterator

typedef fcn_map_type::iterator load_path::fcn_map_iterator
private

Definition at line 377 of file load-path.h.

◆ fcn_map_type

typedef std::map<std::string, file_info_list_type> load_path::fcn_map_type
private

Definition at line 374 of file load-path.h.

◆ file_info_list_iterator

typedef file_info_list_type::iterator load_path::file_info_list_iterator
private

Definition at line 371 of file load-path.h.

◆ file_info_list_type

typedef std::list<file_info> load_path::file_info_list_type
private

Definition at line 368 of file load-path.h.

◆ hook_fcn_ptr

typedef void(* load_path::hook_fcn_ptr) (const std::string &dir)

Definition at line 52 of file load-path.h.

◆ method_map_iterator

typedef method_map_type::iterator load_path::method_map_iterator
private

Definition at line 390 of file load-path.h.

◆ method_map_type

typedef std::map<std::string, fcn_map_type> load_path::method_map_type
private

Definition at line 387 of file load-path.h.

◆ package_map_iterator

typedef package_map_type::iterator load_path::package_map_iterator
private

Definition at line 516 of file load-path.h.

◆ package_map_type

typedef std::map<std::string, package_info> load_path::package_map_type
private

Definition at line 513 of file load-path.h.

◆ private_fcn_map_iterator

typedef private_fcn_map_type::iterator load_path::private_fcn_map_iterator
private

Definition at line 384 of file load-path.h.

◆ private_fcn_map_type

typedef std::map<std::string, dir_info::fcn_file_map_type> load_path::private_fcn_map_type
private

Definition at line 381 of file load-path.h.

Constructor & Destructor Documentation

◆ load_path() [1/2]

load_path::load_path ( interpreter interp)

Definition at line 292 of file load-path.cc.

References execute_pkg_add().

◆ load_path() [2/2]

load_path::load_path ( const load_path )
delete

◆ ~load_path()

load_path::~load_path ( void  )
default

Member Function Documentation

◆ add() [1/2]

void load_path::add ( const dir_info di,
bool  at_end,
const std::string &  pname = "",
bool  updating = false 
)
private

◆ add() [2/2]

void load_path::add ( const std::string &  dir,
bool  at_end,
bool  warn 
)
private

◆ append()

void load_path::append ( const std::string &  dir,
bool  warn = false 
)

Definition at line 402 of file load-path.cc.

References add().

Referenced by Faddpath(), and set().

◆ clear()

void load_path::clear ( void  )

Definition at line 338 of file load-path.cc.

References load_path::package_info::clear(), m_dir_info_list, m_package_map, and m_top_level_package.

Referenced by set().

◆ contains()

bool load_path::contains ( const std::string &  dir) const
private

Definition at line 1082 of file load-path.cc.

References find_dir_info(), and m_dir_info_list.

◆ contains_canonical()

bool load_path::contains_canonical ( const std::string &  dir_name) const

Definition at line 482 of file load-path.cc.

References d, m_dir_info_list, and same_file().

Referenced by contains_file_in_dir().

◆ contains_file_in_dir()

bool load_path::contains_file_in_dir ( const std::string &  file_name,
const std::string &  dir_name 
)

◆ dir_list()

std::list< std::string > load_path::dir_list ( void  ) const

Definition at line 911 of file load-path.cc.

References m_dir_info_list.

Referenced by set_path_model::path_to_model().

◆ dirs()

string_vector load_path::dirs ( void  ) const

Definition at line 896 of file load-path.cc.

References len, and m_dir_info_list.

Referenced by Fpath(), and path().

◆ display()

◆ execute_pkg_add()

void load_path::execute_pkg_add ( const std::string &  dir)

Definition at line 1013 of file load-path.cc.

References execute_pkg_add_or_del().

Referenced by load_path(), and interpreter::execute_pkg_add().

◆ execute_pkg_add_or_del()

void load_path::execute_pkg_add_or_del ( const std::string &  dir,
const std::string &  script_file 
)
private

Definition at line 1024 of file load-path.cc.

References concat(), octave_interpreter_ready, and source_file().

Referenced by execute_pkg_add(), and execute_pkg_del().

◆ execute_pkg_del()

void load_path::execute_pkg_del ( const std::string &  dir)

Definition at line 1019 of file load-path.cc.

References execute_pkg_add_or_del().

◆ fcn_names()

string_vector load_path::fcn_names ( void  ) const

◆ files()

string_vector load_path::files ( const std::string &  dir,
bool  omit_exts = false 
) const

Definition at line 922 of file load-path.cc.

References find_dir_info(), len, m_dir_info_list, and string_vector::numel().

◆ find_all_first_of()

string_vector load_path::find_all_first_of ( const string_vector files) const

◆ find_dir()

std::string load_path::find_dir ( const std::string &  dir) const

◆ find_dir_info() [1/2]

load_path::dir_info_list_iterator load_path::find_dir_info ( const std::string &  dir)
private

Definition at line 1062 of file load-path.cc.

References m_dir_info_list, maybe_canonicalize(), and tilde_expand().

◆ find_dir_info() [2/2]

load_path::const_dir_info_list_iterator load_path::find_dir_info ( const std::string &  dir) const
private

Definition at line 1042 of file load-path.cc.

References m_dir_info_list, maybe_canonicalize(), and tilde_expand().

Referenced by add(), contains(), files(), and remove().

◆ find_fcn() [1/2]

std::string load_path::find_fcn ( const std::string &  fcn,
const std::string &  pack_name = "" 
)
inline

Definition at line 117 of file load-path.h.

◆ find_fcn() [2/2]

std::string load_path::find_fcn ( const std::string &  fcn,
std::string &  dir_name,
const std::string &  pack_name = "" 
)
inline

◆ find_fcn_file()

std::string load_path::find_fcn_file ( const std::string &  fcn,
const std::string &  pack_name = "" 
)
inline

Definition at line 131 of file load-path.h.

Referenced by fcn_file_in_path().

◆ find_file()

std::string load_path::find_file ( const std::string &  file) const

◆ find_first_of()

std::string load_path::find_first_of ( const string_vector files) const

◆ find_matching_dirs()

string_vector load_path::find_matching_dirs ( const std::string &  dir) const

◆ find_method() [1/2]

std::string load_path::find_method ( const std::string &  class_name,
const std::string &  meth,
const std::string &  pack_name = "" 
)
inline

Definition at line 87 of file load-path.h.

◆ find_method() [2/2]

std::string load_path::find_method ( const std::string &  class_name,
const std::string &  meth,
std::string &  dir_name,
const std::string &  pack_name = "" 
)
inline

◆ find_mex_file()

std::string load_path::find_mex_file ( const std::string &  fcn,
const std::string &  pack_name = "" 
)
inline

Definition at line 145 of file load-path.h.

◆ find_oct_file()

std::string load_path::find_oct_file ( const std::string &  fcn,
const std::string &  pack_name = "" 
)
inline

Definition at line 138 of file load-path.h.

◆ find_package()

bool load_path::find_package ( const std::string &  package_name) const
inline

Definition at line 103 of file load-path.h.

Referenced by cdef_manager::find_package().

◆ find_private_fcn()

std::string load_path::find_private_fcn ( const std::string &  dir,
const std::string &  fcn,
const std::string &  pack_name = "" 
)
inline

Definition at line 124 of file load-path.h.

Referenced by fcn_info::fcn_info_rep::load_private_function().

◆ get_add_hook()

std::function<void (const std::string&)> load_path::get_add_hook ( void  )
inline

Definition at line 174 of file load-path.h.

Referenced by interpreter::initialize_load_path().

◆ get_all_package_names()

std::list< std::string > load_path::get_all_package_names ( bool  only_top_level = true) const

Definition at line 588 of file load-path.cc.

References m_package_map.

Referenced by package_getAllPackages().

◆ get_command_line_path()

std::string load_path::get_command_line_path ( void  ) const
inline

Definition at line 207 of file load-path.h.

Referenced by Fcommand_line_path().

◆ get_file_list()

string_vector load_path::get_file_list ( const dir_info::fcn_file_map_type lst) const
private

Definition at line 1310 of file load-path.cc.

References MEX_FILE, n, and OCT_FILE.

Referenced by display(), and load_path::dir_info::initialize().

◆ get_package()

package_info& load_path::get_package ( const std::string &  name)
inlineprivate

Definition at line 543 of file load-path.h.

Referenced by add(), move(), and remove().

◆ get_remove_hook()

std::function<void (const std::string&)> load_path::get_remove_hook ( void  )
inline

Definition at line 179 of file load-path.h.

◆ initialize()

◆ is_package()

bool load_path::is_package ( const std::string &  name) const
private

Definition at line 1277 of file load-path.cc.

References m_dir_info_list.

◆ methods()

std::list<std::string> load_path::methods ( const std::string &  class_name,
const std::string &  pack_name = "" 
)
inline

Definition at line 95 of file load-path.h.

Referenced by F__methods__(), and cdef_class::make_meta_class().

◆ move() [1/2]

void load_path::move ( const dir_info di,
bool  at_end,
const std::string &  pname = "" 
)
private

◆ move() [2/2]

void load_path::move ( dir_info_list_iterator  i,
bool  at_end 
)
private

Definition at line 1088 of file load-path.cc.

References m_dir_info_list.

Referenced by add(), and move().

◆ operator=()

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

◆ overloads()

std::list< std::string > load_path::overloads ( const std::string &  meth) const

◆ path()

std::string load_path::path ( void  ) const

Definition at line 956 of file load-path.cc.

References dirs(), len, string_vector::numel(), and directory_path::path_sep_str().

Referenced by Faddpath(), Fpath(), and Frmpath().

◆ prepend()

void load_path::prepend ( const std::string &  dir,
bool  warn = false 
)

Definition at line 409 of file load-path.cc.

References add().

Referenced by contains_file_in_dir(), Faddpath(), and set().

◆ read_dir_config()

void load_path::read_dir_config ( const std::string &  dir) const

◆ remove() [1/2]

void load_path::remove ( const dir_info di,
const std::string &  pname = "" 
)
private

◆ remove() [2/2]

bool load_path::remove ( const std::string &  dir)

◆ set()

void load_path::set ( const std::string &  p,
bool  warn = false,
bool  is_init = false 
)

◆ set_add_hook()

void load_path::set_add_hook ( const std::function< void(const std::string &)> &  f)
inline

Definition at line 184 of file load-path.h.

References f.

Referenced by interpreter::initialize_load_path().

◆ set_command_line_path()

void load_path::set_command_line_path ( const std::string &  p)
inline

Definition at line 199 of file load-path.h.

References directory_path::path_sep_str().

Referenced by interpreter::interpreter().

◆ set_remove_hook()

void load_path::set_remove_hook ( const std::function< void(const std::string &)> &  f)
inline

Definition at line 189 of file load-path.h.

References f.

◆ system_path()

std::string load_path::system_path ( void  ) const
inline

Definition at line 212 of file load-path.h.

Referenced by F__pathorig__(), and Frestoredefaultpath().

◆ update()

Friends And Related Function Documentation

◆ get_fcn_files

dir_info::fcn_file_map_type get_fcn_files ( const std::string &  d)
friend

Member Data Documentation

◆ add_hook

std::function<void (const std::string&)> load_path::add_hook
private

Definition at line 518 of file load-path.h.

Referenced by add(), and set().

◆ m_command_line_path

std::string load_path::m_command_line_path
private

Definition at line 579 of file load-path.h.

Referenced by initialize().

◆ m_dir_info_list

◆ M_FILE

const int load_path::M_FILE = 1
static

◆ m_init_dirs

std::set<std::string> load_path::m_init_dirs
private

Definition at line 577 of file load-path.h.

Referenced by set().

◆ m_interpreter

interpreter& load_path::m_interpreter
private

Definition at line 569 of file load-path.h.

Referenced by contains_file_in_dir().

◆ m_package_map

package_map_type load_path::m_package_map
private

Definition at line 571 of file load-path.h.

Referenced by clear(), display(), get_all_package_names(), overloads(), and update().

◆ m_top_level_package

package_info load_path::m_top_level_package
private

Definition at line 573 of file load-path.h.

Referenced by clear(), display(), fcn_names(), overloads(), and update().

◆ MEX_FILE

◆ OCT_FILE

◆ remove_hook

std::function<void (const std::string&)> load_path::remove_hook
private

Definition at line 520 of file load-path.h.

Referenced by remove().

◆ s_abs_dir_cache

load_path::abs_dir_cache_type load_path::s_abs_dir_cache
staticprivate

Definition at line 567 of file load-path.h.

Referenced by load_path::dir_info::initialize(), and load_path::dir_info::update().

◆ s_sys_path

std::string load_path::s_sys_path
staticprivate

Definition at line 565 of file load-path.h.

Referenced by load_path::package_info::add_to_fcn_map(), and initialize().


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