Vcsn  2.0
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vcsn::path Class Reference

Paths in filesystems, i.e., file names. More...

#include <path.hh>

Collaboration diagram for vcsn::path:

Classes

class  invalid_path
 Exception thrown on invalid path. More...
 

Public Types

using value_type = std::string
 The "native" type we wrap. More...
 

Public Member Functions

bool is_absolute () const
 Whether starts with /. More...
 
path parent_path () const
 Return a path which is the parent directory. More...
 
path filename () const
 Also known as basename. More...
 
const value_typevalue_get () const
 
value_typevalue_get ()
 
Constructors.
 path (const std::string &p)
 Init object with path. More...
 
 path (const char *p)
 
Operations on path.
pathoperator/= (const path &rhs)
 
path operator/ (const path &rhs) const
 
bool operator== (const path &rhs) const ATTRIBUTE_PURE
 
std::string basename () const
 
std::string extension () const
 The extension of the file, or "" if not applicable. More...
 

Static Public Member Functions

static path cwd ()
 Return the current working directory. More...
 

Private Attributes

value_type value_
 Wrapped value. More...
 

Static Private Attributes

static const char separator_ = '/'
 Path separator. More...
 

Printing and converting.

path is represented with a list of directories.

using path_type = std::list< std::string >
 
const std::string & string () const
 
const charc_str () const
 
path_type components () const
 
std::ostream & dump (std::ostream &ostr) const
 

Detailed Description

Paths in filesystems, i.e., file names.

We should rather use boost::filesystem::path, but as of today it does not work on Mac OS X: https://trac.macports.org/ticket/41588.

Definition at line 22 of file path.hh.

Member Typedef Documentation

using vcsn::path::path_type = std::list<std::string>

Definition at line 84 of file path.hh.

using vcsn::path::value_type = std::string

The "native" type we wrap.

Definition at line 37 of file path.hh.

Constructor & Destructor Documentation

vcsn::path::path ( const std::string &  p)

Init object with path.

Exceptions
invalid_pathif p isn't a valid path

Definition at line 21 of file path.cc.

vcsn::path::path ( const char p)
Exceptions
invalid_pathif p isn't a valid path

Definition at line 25 of file path.cc.

Member Function Documentation

std::string vcsn::path::basename ( ) const
const char * vcsn::path::c_str ( ) const
inline

Definition at line 55 of file path.hxx.

References value_.

Referenced by vcsn::exists().

path::path_type vcsn::path::components ( ) const

Definition at line 71 of file path.cc.

References value_.

path vcsn::path::cwd ( )
static

Return the current working directory.

Definition at line 30 of file path.cc.

Referenced by vcsn::absolute(), and vcsn::file_library::push_cwd().

std::ostream & vcsn::path::dump ( std::ostream &  ostr) const

Definition at line 65 of file path.cc.

References string().

Referenced by vcsn::operator<<().

Here is the call graph for this function:

std::string vcsn::path::extension ( ) const

The extension of the file, or "" if not applicable.

path vcsn::path::filename ( ) const

Also known as basename.

Definition at line 92 of file path.cc.

References value_.

bool vcsn::path::is_absolute ( ) const
inline

Whether starts with /.

Definition at line 48 of file path.hxx.

References value_.

Referenced by vcsn::absolute().

path vcsn::path::operator/ ( const path rhs) const
Exceptions
invalid_pathif rhs is absolute.

Definition at line 52 of file path.cc.

path & vcsn::path::operator/= ( const path rhs)
Exceptions
invalid_pathif rhs is absolute.

Definition at line 42 of file path.cc.

References value_.

bool vcsn::path::operator== ( const path rhs) const

Definition at line 59 of file path.cc.

References value_.

path vcsn::path::parent_path ( ) const

Return a path which is the parent directory.

If path is relative, current directory is returned when asking for parent of 1-depth entity.

Definition at line 83 of file path.cc.

References value_.

const std::string & vcsn::path::string ( ) const
inline

Definition at line 62 of file path.hxx.

References value_.

Referenced by dump().

const path::value_type & vcsn::path::value_get ( ) const
inline

Definition at line 69 of file path.hxx.

References value_.

path::value_type & vcsn::path::value_get ( )
inline

Definition at line 76 of file path.hxx.

References value_.

Member Data Documentation

const char vcsn::path::separator_ = '/'
staticprivate

Path separator.

Definition at line 99 of file path.hh.

value_type vcsn::path::value_
private

Wrapped value.

Definition at line 96 of file path.hh.

Referenced by c_str(), components(), filename(), is_absolute(), operator/=(), operator==(), parent_path(), string(), and value_get().


The documentation for this class was generated from the following files: