LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
Manage search path. More...
#include <file-library.hh>
Public Member Functions | |
Constructor. | |
An empty library. | |
file_library () | |
file_library (path p) | |
Init the library with one path. | |
Managing inclusion paths. | |
void | append_dir (path p) |
void | prepend_dir (path p) |
current directory. | |
void | push_current_directory (path p) |
void | pop_current_directory () |
path | current_directory_get () const |
Findind file | |
path | find_file (const std::string &file) |
Search a file. | |
bool | find_in_directory (const path &dir, const std::string &file) const |
Check if file exists in directory dir. | |
Printing. | |
std::ostream & | dump (std::ostream &ostr) const |
Private Types | |
typedef std::list< path > | path_list_type |
Private Member Functions | |
void | push_cwd () |
Push the working directory on the stack. | |
path | find_in_search_path (const path &relative_path, const std::string &filename) const |
Find file "\a relative_path / \a filename" using include path. | |
void | append_dir_list (std::string path_list) |
Split the string with character ':', and insert each resultant string as a new search path. | |
path | ensure_absolute_path (path p) const |
Ensure that path is absolute by prepending current directory if necessary. |
Private Attributes | |
path_list_type | search_path_ |
Inclusion path list. | |
path_list_type | current_directory_ |
Current directory stack. |
Manage search path.
Store search path and all informations used for handling paths when processing import directives.
|
private |
misc::file_library::file_library | ( | ) |
References push_cwd().
misc::file_library::file_library | ( | path | p | ) |
Init the library with one path.
References push_cwd(), and search_path_.
void misc::file_library::append_dir | ( | path | p | ) |
References ensure_absolute_path(), and search_path_.
Referenced by append_dir_list(), and parse::tasks::library_append().
|
private |
Split the string with character ':', and insert each resultant string as a new search path.
References append_dir().
path misc::file_library::current_directory_get | ( | ) | const |
References current_directory_, and precondition.
Referenced by ensure_absolute_path(), find_file(), find_in_search_path(), and push_current_directory().
std::ostream & misc::file_library::dump | ( | std::ostream & | ostr | ) | const |
References search_path_.
Referenced by misc::operator<<().
Ensure that path is absolute by prepending current directory if necessary.
References misc::path::absolute_get(), and current_directory_get().
Referenced by append_dir(), and prepend_dir().
path misc::file_library::find_file | ( | const std::string & | file | ) |
Search a file.
Determine real path of file, by looking in search path if necessary.
References misc::path::absolute_get(), misc::basedir(), misc::basename(), current_directory_get(), misc::file_exists(), filename, find_in_directory(), and find_in_search_path().
Referenced by parse::TigerParser::parse_import().
bool misc::file_library::find_in_directory | ( | const path & | dir, |
const std::string & | file | ||
) | const |
Check if file exists in directory dir.
References misc::file_exists().
Referenced by find_file(), and find_in_search_path().
|
private |
Find file "\a relative_path / \a filename" using include path.
References current_directory_get(), find_in_directory(), and search_path_.
Referenced by find_file().
void misc::file_library::pop_current_directory | ( | ) |
References current_directory_, and precondition.
Referenced by parse::parse(), and parse::TigerParser::parse_import().
void misc::file_library::prepend_dir | ( | path | p | ) |
References ensure_absolute_path(), and search_path_.
Referenced by parse::tasks::library_prepend().
void misc::file_library::push_current_directory | ( | path | p | ) |
References misc::path::absolute_get(), current_directory_, and current_directory_get().
Referenced by parse::parse(), parse::TigerParser::parse_import(), and push_cwd().
|
private |
Push the working directory on the stack.
References push_current_directory().
Referenced by file_library().
|
private |
Current directory stack.
Referenced by current_directory_get(), pop_current_directory(), and push_current_directory().
|
private |
Inclusion path list.
Referenced by append_dir(), dump(), file_library(), find_in_search_path(), and prepend_dir().