LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
file-library.hh
Go to the documentation of this file.
1 
6 #ifndef MISC_FILE_LIBRARY_HH
7 # define MISC_FILE_LIBRARY_HH
8 
9 # include <string>
10 # include <list>
11 # include <misc/path.hh>
12 
13 namespace misc
14 {
20  {
21  public:
25  file_library();
27  file_library(path p);
29 
32  void append_dir(path p);
33  void prepend_dir(path p);
35 
39  void pop_current_directory();
42 
45 
51  path find_file(const std::string& file);
52 
54  bool find_in_directory(const path& dir, const std::string& file) const;
56 
59  std::ostream& dump(std::ostream& ostr) const;
61 
62  private:
64  void push_cwd();
65 
69  path find_in_search_path(const path& relative_path,
70  const std::string& filename) const;
71 
74  void append_dir_list(std::string path_list);
75 
79 
80  typedef std::list<path> path_list_type;
81 
84 
87  };
88 
89  std::ostream&
90  operator<<(std::ostream& ostr, const file_library& l);
91 
92  std::string basename(const std::string& file);
93  path basedir(const std::string& file);
94  bool file_exists(const std::string& file);
95 
96 }
97 
98 # include <misc/file-library.hxx>
99 
100 #endif // !MISC_FILE_LIBRARY_HH