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

#include "load-path.h"

Collaboration diagram for octave::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)
 
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) const
 

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) const
 
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) const
 
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
 
dir_info_list_type dir_info_list
 
std::set< std::string > init_dirs
 
std::string m_command_line_path
 
interpreterm_interpreter
 
package_map_type package_map
 
std::function< void(const std::string &)> remove_hook
 
package_info top_level_package
 

Static Private Attributes

static abs_dir_cache_type abs_dir_cache
 
static std::string 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 octave::load_path::abs_dir_cache_iterator
private

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

◆ abs_dir_cache_type

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

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

◆ const_abs_dir_cache_iterator

typedef abs_dir_cache_type::const_iterator octave::load_path::const_abs_dir_cache_iterator
private

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

◆ const_dir_info_list_iterator

typedef dir_info_list_type::const_iterator octave::load_path::const_dir_info_list_iterator
private

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

◆ const_fcn_map_iterator

typedef fcn_map_type::const_iterator octave::load_path::const_fcn_map_iterator
private

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

◆ const_file_info_list_iterator

typedef file_info_list_type::const_iterator octave::load_path::const_file_info_list_iterator
private

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

◆ const_method_map_iterator

typedef method_map_type::const_iterator octave::load_path::const_method_map_iterator
private

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

◆ const_package_map_iterator

typedef package_map_type::const_iterator octave::load_path::const_package_map_iterator
private

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

◆ const_private_fcn_map_iterator

typedef private_fcn_map_type::const_iterator octave::load_path::const_private_fcn_map_iterator
private

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

◆ dir_info_list_iterator

typedef dir_info_list_type::iterator octave::load_path::dir_info_list_iterator
private

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

◆ dir_info_list_type

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

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

◆ fcn_map_iterator

typedef fcn_map_type::iterator octave::load_path::fcn_map_iterator
private

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

◆ fcn_map_type

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

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

◆ file_info_list_iterator

typedef file_info_list_type::iterator octave::load_path::file_info_list_iterator
private

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

◆ file_info_list_type

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

◆ hook_fcn_ptr

typedef void(* octave::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 octave::load_path::method_map_iterator
private

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

◆ method_map_type

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

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

◆ package_map_iterator

typedef package_map_type::iterator octave::load_path::package_map_iterator
private

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

◆ package_map_type

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

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

◆ private_fcn_map_iterator

typedef private_fcn_map_type::iterator octave::load_path::private_fcn_map_iterator
private

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

◆ private_fcn_map_type

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

Constructor & Destructor Documentation

◆ load_path() [1/2]

octave::load_path::load_path ( interpreter interp)

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

References execute_pkg_add().

◆ load_path() [2/2]

octave::load_path::load_path ( const load_path )
delete

◆ ~load_path()

octave::load_path::~load_path ( void  )
default

Member Function Documentation

◆ add() [1/2]

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

◆ add() [2/2]

◆ append()

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

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

References add().

Referenced by Faddpath(), and set().

◆ clear()

void octave::load_path::clear ( void  )

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

References octave::load_path::package_info::clear(), dir_info_list, package_map, and top_level_package.

Referenced by set().

◆ contains()

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

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

References dir_info_list, and find_dir_info().

◆ contains_canonical()

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

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

References d, dir_info_list, retval, and octave::same_file().

Referenced by contains_file_in_dir().

◆ contains_file_in_dir()

◆ dir_list()

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

◆ dirs()

string_vector octave::load_path::dirs ( void  ) const

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

References dir_info_list, len, and retval.

Referenced by Fpath(), and path().

◆ display()

◆ execute_pkg_add()

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

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

References execute_pkg_add_or_del().

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

◆ execute_pkg_add_or_del()

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

◆ execute_pkg_del()

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

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

References execute_pkg_add_or_del().

◆ fcn_names()

string_vector octave::load_path::fcn_names ( void  ) const

◆ files()

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

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

References dir_info_list, find_dir_info(), len, Array< T >::numel(), and retval.

◆ find_all_first_of()

◆ find_dir()

◆ find_dir_info() [1/2]

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

◆ find_dir_info() [2/2]

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

◆ find_fcn() [1/2]

std::string octave::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 octave::load_path::find_fcn ( const std::string &  fcn,
std::string &  dir_name,
const std::string &  pack_name = "" 
)
inline

◆ find_fcn_file()

std::string octave::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 octave::fcn_file_in_path().

◆ find_file()

◆ find_first_of()

◆ find_matching_dirs()

◆ find_method() [1/2]

std::string octave::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]

◆ find_mex_file()

std::string octave::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 octave::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 octave::load_path::find_package ( const std::string &  package_name) const
inline

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

Referenced by octave::cdef_manager::find_package().

◆ find_private_fcn()

std::string octave::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 octave::fcn_info::fcn_info_rep::load_private_function().

◆ get_add_hook()

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

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

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

◆ get_all_package_names()

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

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

References package_map, and retval.

Referenced by octave::package_getAllPackages().

◆ get_command_line_path()

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

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

Referenced by Fcommand_line_path().

◆ get_file_list()

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

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

References MEX_FILE, n, OCT_FILE, and retval.

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

◆ get_package()

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

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

References name.

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

◆ get_remove_hook()

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

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

◆ initialize()

◆ is_package()

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

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

References dir_info_list, and name.

◆ methods()

std::list<std::string> octave::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 octave::cdef_class::make_meta_class().

◆ move() [1/2]

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

◆ move() [2/2]

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

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

References dir_info_list.

Referenced by add(), and move().

◆ operator=()

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

◆ overloads()

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

◆ path()

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

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

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

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

◆ prepend()

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

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

References add().

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

◆ remove() [1/2]

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

◆ remove() [2/2]

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

◆ set()

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

◆ set_add_hook()

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

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

References octave::f().

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

◆ set_command_line_path()

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

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

References octave::directory_path::path_sep_str().

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

◆ set_remove_hook()

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

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

References octave::f().

◆ system_path()

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

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

Referenced by F__pathorig__(), Frestoredefaultpath(), and read_mat5_binary_element().

◆ 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

◆ abs_dir_cache

load_path::abs_dir_cache_type octave::load_path::abs_dir_cache
staticprivate

◆ add_hook

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

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

Referenced by add(), and set().

◆ dir_info_list

◆ init_dirs

std::set<std::string> octave::load_path::init_dirs
mutableprivate

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

Referenced by set().

◆ m_command_line_path

std::string octave::load_path::m_command_line_path
private

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

Referenced by initialize().

◆ M_FILE

◆ m_interpreter

interpreter& octave::load_path::m_interpreter
private

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

Referenced by contains_file_in_dir().

◆ MEX_FILE

◆ OCT_FILE

◆ package_map

package_map_type octave::load_path::package_map
mutableprivate

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

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

◆ remove_hook

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

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

Referenced by remove().

◆ sys_path

std::string octave::load_path::sys_path
staticprivate

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

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

◆ top_level_package

package_info octave::load_path::top_level_package
mutableprivate

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

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


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