#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) |
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_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) |
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) |
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 |
interpreter & | m_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) |
Definition at line 44 of file load-path.h.
|
private |
Definition at line 366 of file load-path.h.
|
private |
Definition at line 363 of file load-path.h.
|
private |
Definition at line 365 of file load-path.h.
|
private |
Definition at line 360 of file load-path.h.
|
private |
Definition at line 376 of file load-path.h.
|
private |
Definition at line 370 of file load-path.h.
|
private |
Definition at line 389 of file load-path.h.
|
private |
Definition at line 515 of file load-path.h.
|
private |
Definition at line 383 of file load-path.h.
|
private |
Definition at line 361 of file load-path.h.
|
private |
Definition at line 358 of file load-path.h.
|
private |
Definition at line 377 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.
typedef void(* load_path::hook_fcn_ptr) (const std::string &dir) |
Definition at line 52 of file load-path.h.
|
private |
Definition at line 390 of file load-path.h.
|
private |
Definition at line 387 of file load-path.h.
|
private |
Definition at line 516 of file load-path.h.
|
private |
Definition at line 513 of file load-path.h.
|
private |
Definition at line 384 of file load-path.h.
|
private |
Definition at line 381 of file load-path.h.
load_path::load_path | ( | interpreter & | interp | ) |
Definition at line 292 of file load-path.cc.
References execute_pkg_add().
|
delete |
|
default |
|
private |
Definition at line 1289 of file load-path.cc.
References load_path::package_info::add(), add(), get_package(), and load_path::dir_info::package_dir_map.
|
private |
Definition at line 1126 of file load-path.cc.
References add_hook, find_dir_info(), len, m_dir_info_list, maybe_canonicalize(), move(), read_dir_config(), strip_trailing_separators(), tilde_expand(), warning(), and warning_with_id().
void load_path::append | ( | const std::string & | dir, |
bool | warn = false |
||
) |
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().
|
private |
Definition at line 1082 of file load-path.cc.
References find_dir_info(), and m_dir_info_list.
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().
bool load_path::contains_file_in_dir | ( | const std::string & | file_name, |
const std::string & | dir_name | ||
) |
Definition at line 499 of file load-path.cc.
References interpreter::chdir(), contains_canonical(), event_manager::debug_cd_or_addpath_error(), find_file(), interpreter::get_event_manager(), m_interpreter, prepend(), and same_file().
Referenced by bp_file_info::bp_file_info().
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().
string_vector load_path::dirs | ( | void | ) | const |
Definition at line 896 of file load-path.cc.
References len, and m_dir_info_list.
void load_path::display | ( | std::ostream & | os | ) | const |
Definition at line 974 of file load-path.cc.
References load_path::package_info::display(), string_vector::empty(), get_file_list(), string_vector::list_in_columns(), m_dir_info_list, m_package_map, m_top_level_package, and load_path::dir_info::class_info::method_file_map.
Referenced by F__dump_load_path__().
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().
|
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().
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().
string_vector load_path::fcn_names | ( | void | ) | const |
Definition at line 950 of file load-path.cc.
References load_path::package_info::fcn_names(), and m_top_level_package.
Referenced by file_editor_tab::update_lexer_settings().
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().
string_vector load_path::find_all_first_of | ( | const string_vector & | files | ) | const |
Definition at line 828 of file load-path.cc.
References absolute_pathname(), concat(), dir_sep_chars, len, m_dir_info_list, string_vector::numel(), and string_vector::resize().
Referenced by Ffile_in_loadpath().
std::string load_path::find_dir | ( | const std::string & | dir | ) | const |
Definition at line 657 of file load-path.cc.
References absolute_pathname(), dir_sep_chars, dir_sep_str(), is_dir_sep(), m_dir_info_list, and maybe_canonicalize().
Referenced by contents_file_in_path(), and Fdir_in_loadpath().
|
private |
Definition at line 1062 of file load-path.cc.
References m_dir_info_list, maybe_canonicalize(), and tilde_expand().
|
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().
|
inline |
Definition at line 117 of file load-path.h.
|
inline |
Definition at line 111 of file load-path.h.
Referenced by fcn_info::fcn_info_rep::find_user_function(), out_of_date_check(), and symbol_exist().
|
inline |
Definition at line 131 of file load-path.h.
Referenced by fcn_file_in_path().
std::string load_path::find_file | ( | const std::string & | file | ) | const |
Definition at line 602 of file load-path.cc.
References absolute_pathname(), concat(), dir_sep_chars, find_private_file(), len, m_dir_info_list, and string_vector::numel().
Referenced by contains_file_in_dir(), file_in_path(), find_data_file_in_load_path(), and tree_evaluator::lookup_autoload().
std::string load_path::find_first_of | ( | const string_vector & | files | ) | const |
Definition at line 751 of file load-path.cc.
References absolute_pathname(), concat(), dir_sep_chars, len, m_dir_info_list, string_vector::numel(), and string_vector::resize().
Referenced by Ffile_in_loadpath().
string_vector load_path::find_matching_dirs | ( | const std::string & | dir | ) | const |
Definition at line 704 of file load-path.cc.
References absolute_pathname(), dir_sep_chars, dir_sep_str(), is_dir_sep(), m_dir_info_list, and maybe_canonicalize().
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 cdef_method::cdef_method_rep::check_method(), load_path::package_info::find_fcn(), fcn_info::fcn_info_rep::load_class_constructor(), fcn_info::fcn_info_rep::load_class_method(), out_of_date_check(), 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 cdef_manager::find_package().
|
inline |
Definition at line 124 of file load-path.h.
Referenced by fcn_info::fcn_info_rep::load_private_function().
|
inline |
Definition at line 174 of file load-path.h.
Referenced by interpreter::initialize_load_path().
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().
|
inline |
Definition at line 207 of file load-path.h.
Referenced by Fcommand_line_path().
|
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().
|
inlineprivate |
Definition at line 543 of file load-path.h.
|
inline |
Definition at line 179 of file load-path.h.
void load_path::initialize | ( | bool | set_initial_path = false | ) |
Definition at line 300 of file load-path.cc.
References fcn_file_dir(), local_api_fcn_file_dir(), local_api_oct_file_dir(), local_fcn_file_dir(), local_oct_file_dir(), local_ver_fcn_file_dir(), local_ver_oct_file_dir(), m_command_line_path, maybe_add_path_elts(), oct_data_dir(), oct_file_dir(), directory_path::path_sep_str(), s_sys_path, and set().
Referenced by Frestoredefaultpath(), and interpreter::initialize_load_path().
|
private |
Definition at line 1277 of file load-path.cc.
References m_dir_info_list.
|
inline |
Definition at line 95 of file load-path.h.
Referenced by F__methods__(), and cdef_class::make_meta_class().
|
private |
Definition at line 1106 of file load-path.cc.
References get_package(), load_path::package_info::move(), move(), and load_path::dir_info::package_dir_map.
|
private |
Definition at line 1088 of file load-path.cc.
References m_dir_info_list.
std::list< std::string > load_path::overloads | ( | const std::string & | meth | ) | const |
Definition at line 573 of file load-path.cc.
References m_package_map, m_top_level_package, and load_path::package_info::overloads().
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().
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().
void load_path::read_dir_config | ( | const std::string & | dir | ) | const |
Definition at line 1205 of file load-path.cc.
References __get_input_system__(), canonicalize_file_name(), dir_sep_str(), fgets(), fopen(), and input_system::set_dir_encoding().
Referenced by add(), and interpreter::chdir().
|
private |
Definition at line 1185 of file load-path.cc.
References get_package(), load_path::dir_info::package_dir_map, load_path::package_info::remove(), and remove().
bool load_path::remove | ( | const std::string & | dir | ) |
Definition at line 416 of file load-path.cc.
References find_dir_info(), m_dir_info_list, remove_hook, same_file(), strip_trailing_separators(), tilde_expand(), and warning().
void load_path::set | ( | const std::string & | p, |
bool | warn = false , |
||
bool | is_init = false |
||
) |
Definition at line 348 of file load-path.cc.
References add_hook, append(), clear(), m_dir_info_list, m_init_dirs, maybe_canonicalize(), prepend(), action_container::protect_var(), unwind_protect::run_first(), split_path(), and warning_with_id().
Referenced by Fpath(), initialize(), and set_path_model::model_to_path().
|
inline |
Definition at line 184 of file load-path.h.
References f.
Referenced by interpreter::initialize_load_path().
|
inline |
Definition at line 199 of file load-path.h.
References directory_path::path_sep_str().
Referenced by interpreter::interpreter().
|
inline |
Definition at line 189 of file load-path.h.
References f.
|
inline |
Definition at line 212 of file load-path.h.
Referenced by F__pathorig__(), and Frestoredefaultpath().
void load_path::update | ( | void | ) |
Definition at line 457 of file load-path.cc.
References add(), load_path::package_info::clear(), m_dir_info_list, m_package_map, m_top_level_package, and warning_with_id().
Referenced by fcn_info::fcn_info_rep::builtin_find(), interpreter::chdir(), fcn_info::fcn_info_rep::find(), and rehash_internal().
|
friend |
Definition at line 1338 of file load-path.cc.
Referenced by load_path::dir_info::get_method_file_map(), and load_path::dir_info::get_private_file_map().
|
private |
Definition at line 518 of file load-path.h.
|
private |
Definition at line 579 of file load-path.h.
Referenced by initialize().
|
private |
Definition at line 575 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().
|
static |
Definition at line 214 of file load-path.h.
Referenced by load_path::package_info::add_to_fcn_map(), load_path::package_info::check_file_type(), and load_path::package_info::print_types().
|
private |
Definition at line 577 of file load-path.h.
Referenced by set().
|
private |
Definition at line 569 of file load-path.h.
Referenced by contains_file_in_dir().
|
private |
Definition at line 571 of file load-path.h.
Referenced by clear(), display(), get_all_package_names(), overloads(), and update().
|
private |
Definition at line 573 of file load-path.h.
Referenced by clear(), display(), fcn_names(), overloads(), and update().
|
static |
Definition at line 216 of file load-path.h.
Referenced by load_path::package_info::add_to_fcn_map(), load_path::package_info::check_file_type(), get_file_list(), and load_path::package_info::print_types().
|
static |
Definition at line 215 of file load-path.h.
Referenced by load_path::package_info::add_to_fcn_map(), load_path::package_info::check_file_type(), get_file_list(), and load_path::package_info::print_types().
|
private |
Definition at line 520 of file load-path.h.
Referenced by remove().
|
staticprivate |
Definition at line 567 of file load-path.h.
Referenced by load_path::dir_info::initialize(), and load_path::dir_info::update().
|
staticprivate |
Definition at line 565 of file load-path.h.
Referenced by load_path::package_info::add_to_fcn_map(), and initialize().