#include "load-path.h"
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_path & | operator= (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_info > | abs_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_info > | dir_info_list_type |
typedef fcn_map_type::iterator | fcn_map_iterator |
typedef std::map< std::string, file_info_list_type > | fcn_map_type |
typedef file_info_list_type::iterator | file_info_list_iterator |
typedef std::list< file_info > | file_info_list_type |
typedef method_map_type::iterator | method_map_iterator |
typedef std::map< std::string, fcn_map_type > | method_map_type |
typedef package_map_type::iterator | package_map_iterator |
typedef std::map< std::string, package_info > | package_map_type |
typedef private_fcn_map_type::iterator | private_fcn_map_iterator |
typedef std::map< std::string, dir_info::fcn_file_map_type > | private_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_info & | get_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 |
interpreter & | m_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) |
Definition at line 44 of file load-path.h.
|
private |
Definition at line 363 of file load-path.h.
|
private |
Definition at line 360 of file load-path.h.
|
private |
Definition at line 362 of file load-path.h.
|
private |
Definition at line 357 of file load-path.h.
|
private |
Definition at line 373 of file load-path.h.
|
private |
Definition at line 367 of file load-path.h.
|
private |
Definition at line 386 of file load-path.h.
|
private |
Definition at line 512 of file load-path.h.
|
private |
Definition at line 380 of file load-path.h.
|
private |
Definition at line 358 of file load-path.h.
|
private |
Definition at line 355 of file load-path.h.
|
private |
Definition at line 374 of file load-path.h.
|
private |
Definition at line 371 of file load-path.h.
|
private |
Definition at line 368 of file load-path.h.
|
private |
Definition at line 365 of file load-path.h.
typedef void(* octave::load_path::hook_fcn_ptr) (const std::string &dir) |
Definition at line 52 of file load-path.h.
|
private |
Definition at line 387 of file load-path.h.
|
private |
Definition at line 384 of file load-path.h.
|
private |
Definition at line 513 of file load-path.h.
|
private |
Definition at line 510 of file load-path.h.
|
private |
Definition at line 381 of file load-path.h.
|
private |
Definition at line 378 of file load-path.h.
octave::load_path::load_path | ( | interpreter & | interp | ) |
Definition at line 230 of file load-path.cc.
References execute_pkg_add().
|
delete |
|
default |
|
private |
Definition at line 1152 of file load-path.cc.
References octave::load_path::package_info::add(), add(), get_package(), and octave::load_path::dir_info::package_dir_map.
|
private |
Definition at line 1063 of file load-path.cc.
References add_hook, dir_info_list, octave::sys::base_file_stat::error(), find_dir_info(), octave::sys::base_file_stat::is_dir(), len, octave::maybe_canonicalize(), move(), octave::strip_trailing_separators(), octave::sys::file_ops::tilde_expand(), warning(), and warning_with_id().
void octave::load_path::append | ( | const std::string & | dir, |
bool | warn = false |
||
) |
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().
|
private |
Definition at line 1019 of file load-path.cc.
References dir_info_list, and find_dir_info().
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().
bool octave::load_path::contains_file_in_dir | ( | const std::string & | file_name, |
const std::string & | dir_name | ||
) |
Definition at line 435 of file load-path.cc.
References octave::sys::env::base_pathname(), octave::interpreter::chdir(), contains_canonical(), octave::event_manager::debug_cd_or_addpath_error(), find_file(), octave::sys::env::get_current_directory(), octave::interpreter::get_event_manager(), m_interpreter, prepend(), and octave::same_file().
Referenced by octave::file_editor_tab::add_breakpoint_event(), octave::file_editor_tab::handle_request_remove_breakpoint(), and octave::file_editor_tab::remove_all_breakpoints().
std::list< std::string > octave::load_path::dir_list | ( | void | ) | const |
Definition at line 847 of file load-path.cc.
References dir_info_list, and retval.
Referenced by octave::load_path::package_info::display(), octave::load_path::package_info::move(), octave::set_path_model::path_to_model(), and octave::load_path::package_info::remove().
string_vector octave::load_path::dirs | ( | void | ) | const |
Definition at line 832 of file load-path.cc.
References dir_info_list, len, and retval.
void octave::load_path::display | ( | std::ostream & | os | ) | const |
Definition at line 910 of file load-path.cc.
References dir_info_list, octave::load_path::package_info::display(), string_vector::empty(), get_file_list(), string_vector::list_in_columns(), octave::load_path::dir_info::class_info::method_file_map, package_map, and top_level_package.
Referenced by F__dump_load_path__().
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().
|
private |
Definition at line 960 of file load-path.cc.
References octave::sys::file_ops::concat(), octave::sys::base_file_stat::exists(), octave_interpreter_ready, and octave::source_file().
Referenced by execute_pkg_add(), and 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().
string_vector octave::load_path::fcn_names | ( | void | ) | const |
Definition at line 886 of file load-path.cc.
References octave::load_path::package_info::fcn_names(), and top_level_package.
Referenced by octave::file_editor_tab::update_lexer_settings().
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.
string_vector octave::load_path::find_all_first_of | ( | const string_vector & | files | ) | const |
Definition at line 764 of file load-path.cc.
References octave::sys::env::absolute_pathname(), octave::sys::file_ops::concat(), dir_info_list, octave::sys::file_ops::dir_sep_chars(), octave::sys::base_file_stat::exists(), len, string_vector::numel(), string_vector::resize(), and octave::sys::env::rooted_relative_pathname().
Referenced by Ffile_in_loadpath().
std::string octave::load_path::find_dir | ( | const std::string & | dir | ) | const |
Definition at line 593 of file load-path.cc.
References octave::sys::env::absolute_pathname(), dir_info_list, octave::sys::file_ops::dir_sep_chars(), octave::sys::file_ops::dir_sep_str(), octave::sys::base_file_stat::exists(), octave::sys::base_file_stat::is_dir(), octave::sys::file_ops::is_dir_sep(), octave::maybe_canonicalize(), retval, and octave::sys::env::rooted_relative_pathname().
Referenced by octave::contents_file_in_path(), and Fdir_in_loadpath().
|
private |
Definition at line 999 of file load-path.cc.
References dir_info_list, octave::maybe_canonicalize(), retval, and octave::sys::file_ops::tilde_expand().
|
private |
Definition at line 979 of file load-path.cc.
References dir_info_list, octave::maybe_canonicalize(), retval, and octave::sys::file_ops::tilde_expand().
Referenced by add(), contains(), files(), and remove().
|
inline |
Definition at line 117 of file load-path.h.
|
inline |
Definition at line 111 of file load-path.h.
Referenced by octave::fcn_info::fcn_info_rep::find_user_function(), octave::out_of_date_check(), and symbol_exist().
|
inline |
Definition at line 131 of file load-path.h.
Referenced by octave::fcn_file_in_path().
std::string octave::load_path::find_file | ( | const std::string & | file | ) | const |
Definition at line 538 of file load-path.cc.
References octave::sys::env::absolute_pathname(), octave::sys::file_ops::concat(), dir_info_list, octave::sys::file_ops::dir_sep_chars(), octave::sys::base_file_stat::exists(), octave::find_private_file(), len, string_vector::numel(), retval, and octave::sys::env::rooted_relative_pathname().
Referenced by contains_file_in_dir(), octave::file_in_path(), octave::find_data_file_in_load_path(), and octave::tree_evaluator::lookup_autoload().
std::string octave::load_path::find_first_of | ( | const string_vector & | files | ) | const |
Definition at line 687 of file load-path.cc.
References octave::sys::env::absolute_pathname(), octave::sys::file_ops::concat(), dir_info_list, octave::sys::file_ops::dir_sep_chars(), octave::sys::base_file_stat::exists(), len, string_vector::numel(), string_vector::resize(), retval, and octave::sys::env::rooted_relative_pathname().
Referenced by Ffile_in_loadpath().
string_vector octave::load_path::find_matching_dirs | ( | const std::string & | dir | ) | const |
Definition at line 640 of file load-path.cc.
References octave::sys::env::absolute_pathname(), dir_info_list, octave::sys::file_ops::dir_sep_chars(), octave::sys::file_ops::dir_sep_str(), octave::sys::base_file_stat::exists(), octave::sys::base_file_stat::is_dir(), octave::sys::file_ops::is_dir_sep(), octave::maybe_canonicalize(), and octave::sys::env::rooted_relative_pathname().
Referenced by Fdir_in_loadpath().
|
inline |
Definition at line 87 of file load-path.h.
|
inline |
Definition at line 79 of file load-path.h.
Referenced by octave::cdef_method::cdef_method_rep::check_method(), octave::load_path::package_info::find_fcn(), octave_class::load_ascii(), octave_class::load_binary(), octave::fcn_info::fcn_info_rep::load_class_constructor(), octave::fcn_info::fcn_info_rep::load_class_method(), octave_class::load_hdf5(), octave::out_of_date_check(), read_mat5_binary_element(), octave_class::save_ascii(), octave_class::save_binary(), octave_class::save_hdf5(), save_mat5_binary_element(), and symbol_exist().
|
inline |
Definition at line 145 of file load-path.h.
|
inline |
Definition at line 138 of file load-path.h.
|
inline |
Definition at line 103 of file load-path.h.
Referenced by octave::cdef_manager::find_package().
|
inline |
Definition at line 124 of file load-path.h.
Referenced by octave::fcn_info::fcn_info_rep::load_private_function().
|
inline |
Definition at line 174 of file load-path.h.
Referenced by octave::interpreter::initialize_load_path().
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().
|
inline |
Definition at line 205 of file load-path.h.
Referenced by Fcommand_line_path().
|
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().
|
inlineprivate |
|
inline |
Definition at line 179 of file load-path.h.
void octave::load_path::initialize | ( | bool | set_initial_path = false | ) |
Definition at line 238 of file load-path.cc.
References octave::config::fcn_file_dir(), octave::sys::env::getenv(), octave::config::local_api_fcn_file_dir(), octave::config::local_api_oct_file_dir(), octave::config::local_fcn_file_dir(), octave::config::local_oct_file_dir(), octave::config::local_ver_fcn_file_dir(), octave::config::local_ver_oct_file_dir(), m_command_line_path, octave::maybe_add_path_elts(), octave::config::oct_data_dir(), octave::config::oct_file_dir(), octave::directory_path::path_sep_str(), set(), and sys_path.
Referenced by Frestoredefaultpath(), and octave::interpreter::initialize_load_path().
|
private |
Definition at line 1140 of file load-path.cc.
References dir_info_list, and name.
|
inline |
Definition at line 95 of file load-path.h.
Referenced by F__methods__(), and octave::cdef_class::make_meta_class().
|
private |
Definition at line 1043 of file load-path.cc.
References get_package(), octave::load_path::package_info::move(), move(), and octave::load_path::dir_info::package_dir_map.
|
private |
Definition at line 1025 of file load-path.cc.
References dir_info_list.
std::list< std::string > octave::load_path::overloads | ( | const std::string & | meth | ) | const |
Definition at line 509 of file load-path.cc.
References octave::load_path::package_info::overloads(), package_map, retval, and top_level_package.
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().
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().
|
private |
Definition at line 1120 of file load-path.cc.
References get_package(), octave::load_path::dir_info::package_dir_map, octave::load_path::package_info::remove(), and remove().
bool octave::load_path::remove | ( | const std::string & | dir | ) |
Definition at line 354 of file load-path.cc.
References dir_info_list, find_dir_info(), remove_hook, retval, octave::strip_trailing_separators(), octave::sys::file_ops::tilde_expand(), and warning().
void octave::load_path::set | ( | const std::string & | p, |
bool | warn = false , |
||
bool | is_init = false |
||
) |
Definition at line 286 of file load-path.cc.
References add_hook, append(), clear(), dir_info_list, init_dirs, octave::maybe_canonicalize(), prepend(), octave::action_container::protect_var(), octave::unwind_protect::run_first(), octave::split_path(), and warning_with_id().
Referenced by Fpath(), initialize(), and octave::set_path_model::model_to_path().
|
inline |
Definition at line 184 of file load-path.h.
References octave::f().
Referenced by octave::interpreter::initialize_load_path().
|
inline |
Definition at line 197 of file load-path.h.
References octave::directory_path::path_sep_str().
Referenced by octave::interpreter::interpreter().
|
inline |
Definition at line 189 of file load-path.h.
References octave::f().
|
inline |
Definition at line 210 of file load-path.h.
Referenced by F__pathorig__(), Frestoredefaultpath(), and read_mat5_binary_element().
void octave::load_path::update | ( | void | ) | const |
Definition at line 395 of file load-path.cc.
References add(), octave::load_path::package_info::clear(), dir_info_list, package_map, top_level_package, and warning().
Referenced by octave::fcn_info::fcn_info_rep::builtin_find(), octave::interpreter::chdir(), octave::fcn_info::fcn_info_rep::find(), and octave::rehash_internal().
|
friend |
Definition at line 1201 of file load-path.cc.
Referenced by octave::load_path::dir_info::get_method_file_map(), and octave::load_path::dir_info::get_private_file_map().
|
staticprivate |
Definition at line 529 of file load-path.h.
Referenced by octave::load_path::dir_info::initialize(), and octave::load_path::dir_info::update().
|
private |
Definition at line 531 of file load-path.h.
|
mutableprivate |
Definition at line 521 of file load-path.h.
Referenced by add(), clear(), contains(), contains_canonical(), dir_list(), dirs(), display(), files(), find_all_first_of(), find_dir(), find_dir_info(), find_file(), find_first_of(), find_matching_dirs(), is_package(), move(), remove(), set(), and update().
|
mutableprivate |
Definition at line 523 of file load-path.h.
Referenced by set().
|
private |
Definition at line 525 of file load-path.h.
Referenced by initialize().
|
static |
Definition at line 212 of file load-path.h.
Referenced by octave::load_path::package_info::add_to_fcn_map(), octave::load_path::package_info::check_file_type(), and octave::load_path::package_info::print_types().
|
private |
Definition at line 515 of file load-path.h.
Referenced by contains_file_in_dir().
|
static |
Definition at line 214 of file load-path.h.
Referenced by octave::load_path::package_info::add_to_fcn_map(), octave::load_path::package_info::check_file_type(), get_file_list(), and octave::load_path::package_info::print_types().
|
static |
Definition at line 213 of file load-path.h.
Referenced by octave::load_path::package_info::add_to_fcn_map(), octave::load_path::package_info::check_file_type(), get_file_list(), and octave::load_path::package_info::print_types().
|
mutableprivate |
Definition at line 517 of file load-path.h.
Referenced by clear(), display(), get_all_package_names(), overloads(), and update().
|
private |
Definition at line 533 of file load-path.h.
Referenced by remove().
|
staticprivate |
Definition at line 527 of file load-path.h.
Referenced by octave::load_path::package_info::add_to_fcn_map(), and initialize().
|
mutableprivate |
Definition at line 519 of file load-path.h.
Referenced by clear(), display(), fcn_names(), overloads(), and update().