Vcsn  2.0
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
file-library.hh
Go to the documentation of this file.
1 
6 #ifndef VCSN_MISC_FILE_LIBRARY_HH
7 # define VCSN_MISC_FILE_LIBRARY_HH
8 
9 # include <stdexcept>
10 # include <list>
11 # include <string>
12 
13 # include <vcsn/misc/path.hh>
14 
15 # include <vcsn/misc/export.hh>
16 
17 namespace vcsn
18 {
24  {
25  public:
27 
29  // using path = boost::filesystem::path;
30  using path_list_type = std::list<path>;
31 
33  class LIBVCSN_API not_found : public std::runtime_error
34  {
35  public:
36  not_found(const path& file);
37  };
38 
42  file_library();
44  file_library(const path& p);
46  file_library(const std::string& library, const char* separator);
47 
54  template <typename ForwardRange>
55  file_library(const ForwardRange& r, const char* sep);
57 
60  self_type& push_back(const path& p);
62  self_type& push_back(const std::string& library, const char* separator);
63 
70  template <typename ForwardRange>
71  self_type& push_back(const ForwardRange& r, const char* sep);
72 
73  template <class Iterable>
74  self_type& push_back(const std::string& user_path,
75  const Iterable& default_path,
76  const char* sep);
77 
78  self_type& append(const path& p);
79 
80  self_type& push_front(const path& p);
81 
85  self_type& push_front(const std::string& library, const char* separator);
86  self_type& prepend(const path& p);
88 
91  void push_current_directory(const path& p);
92  void pop_current_directory();
93  path current_directory_get() const;
95 
96 
97  using strings_type = std::list<std::string>;
103  static strings_type split(const std::string& lib, const char* sep);
104 
105 
108 
116  path find_file(const path& file) const;
118 
121  std::ostream& dump(std::ostream& ostr) const;
123 
126  const path_list_type& search_path_get() const;
127  path_list_type& search_path();
129 
130  private:
132  void push_cwd();
133 
137  path find_in_search_path(const path& filename) const;
138 
141 
144  };
145 
147  std::ostream& operator<<(std::ostream& o, const file_library& l);
148 
149 }
150 
151 # include <vcsn/misc/file-library.hxx>
152 
153 #endif // !VCSN_MISC_FILE_LIBRARY_HH
std::ostream & operator<<(std::ostream &os, direction d)
Pretty-printing.
Definition: direction.cc:19
Manage search paths.
Definition: file-library.hh:23
Paths in filesystems, i.e., file names.
Definition: path.hh:22
Declaration of vcsn::path.
path_list_type search_path_
Inclusion path list.
std::list< path > path_list_type
Broken on Mac OS X (https://trac.macports.org/ticket/41588).
Definition: file-library.hh:30
path_list_type current_directory_
Current directory stack.
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:36
Implement inline functions of vcsn/misc/file-library.hh.
#define LIBVCSN_API
Definition: export.hh:9
rat::ratexp_polynomial_t< RatExpSet > split(const RatExpSet &rs, const typename RatExpSet::value_t &e)
Split a ratexp.
Definition: split.hh:257
Exception thrown when a file cannot be located.
Definition: file-library.hh:33
std::list< std::string > strings_type
Definition: file-library.hh:97