Vcsn  2.4
Be Rational
path.hxx
Go to the documentation of this file.
1 
6 #ifndef LIBPORT_PATH_HXX
7 # define LIBPORT_PATH_HXX
8 
9 # include <sys/stat.h>
10 # include <vcsn/misc/path.hh>
11 
12 namespace vcsn
13 {
14 
15  /*---------------------.
16  | Path::invalid_path. |
17  `---------------------*/
18 
19  inline
20  path::invalid_path::invalid_path(const std::string& msg)
21  : msg_(msg)
22  {}
23 
24  inline
25  const char*
26  path::invalid_path::what() const throw ()
27  {
28  return msg_.c_str();
29  }
30 
31  inline
33  {}
34 
35 
36  /*-------.
37  | path. |
38  `-------*/
39 
40  inline
41  std::ostream&
42  operator<<(std::ostream& o, const path& p)
43  {
44  return p.dump(o);
45  }
46 
47  inline
48  bool path::is_absolute() const
49  {
50  return value_[0] == '/';
51  }
52 
53  inline
54  const char*
55  path::c_str() const
56  {
57  return value_.c_str();
58  }
59 
60  inline
61  const std::string&
62  path::string() const
63  {
64  return value_;
65  }
66 
67  inline
68  const path::value_type&
70  {
71  return value_;
72  }
73 
74  inline
77  {
78  return value_;
79  }
80 }
81 
82 #endif // !LIBPORT_PATH_HXX
bool is_absolute() const
Whether starts with /.
Definition: path.hxx:48
std::ostream & operator<<(std::ostream &os, direction d)
Pretty-printing.
Definition: direction.cc:19
const char * c_str() const
Definition: path.hxx:55
Definition: a-star.hh:8
std::string value_type
The "native" type we wrap.
Definition: path.hh:36
Declaration of vcsn::path.
virtual ~invalid_path()
Definition: path.hxx:32
invalid_path(const std::string &msg)
Definition: path.hxx:20
const char * what() const
Definition: path.hxx:26
const std::string & string() const
Definition: path.hxx:62
value_type value_
Wrapped value.
Definition: path.hh:95
const value_type & value_get() const
Definition: path.hxx:69
std::ostream & dump(std::ostream &ostr) const
Definition: path.cc:65
Paths in filesystems, i.e., file names.
Definition: path.hh:21