Home Libraries Author Links

stm::path< NameT > Class Template Reference
[FilesysAids: File System Aids]

List of all members.


Detailed Description

template<class NameT = pstring>
class stm::path< NameT >

Class template path refining boost::filesystem::path.

NameT shall be convertable to std::string thus representing the path's character representation.

Examples:

smartptrtest.cpp.

Definition at line 253 of file filesysaids.hpp.


Public Types

typedef NameT name_type
 Template type parameter NameT.
typedef boost::filesystem::path base
 Public base class.

Public Member Functions

 path ()
 Construct an empty path object.
 path (const boost::filesystem::path &src)
 Construct a path object from src.
 path (const std::string &src)
 Construct a path object from src.
 path (const char *src)
 Construct a path object from src.
 path (const std::string &src, name_check checker)
 Construct a path object from src with name check function checker.
 path (const char *src, name_check checker)
 Construct a path object from src with name check function checker.
const name_type string () const
 Returns this path's character representation as name_type object which is convertible to std::string.
std::string head () const
 If this path is not empty, the method returns *begin(), else an empty std::string.
path< NameT > tail_path () const
 If this path is not empty, the method retuns a path object consisting of this path with stripped off the head() component, else the empty path.
bool has_head () const
 Returns true, if head() is not empty, else false.
bool has_tail_path () const
 Returns true, if tail_path() is not empty, else false.
path< NameT > operator- (const base &stem) const
 If stem is the initial part of this path, return a path<NameT> object consisting of this path stripped off stem, else return the empty path.
path< NameT > relative_to_directory (const base &source) const
 If this path is empty, the empty path object is returned.
template<class DataT>
int recurse (DataT &parent) const
 The member function template recurse handles this path, and if it is a directory and recursion is not switched off, recursively all items of the tree spanned by this directory.
template<class DataT>
int recurse (typename DataT::env_type &env) const
 The member function template recurse handles this path, and if it is a directory and recursion is not switched off, recursively all items of the tree spanned by this directory.
template<class DataT>
int traverse (DataT &parent, const path< NameT > &route) const
 The member function template traverse handles this path, and then if the normalized route r consists of the components r1, .
template<class DataT>
int traverse (typename DataT::env_type &env, const path< NameT > &route) const
 The member function template traverse handles this path, and then if the normalized route r consists of the components r1, .

Classes

class  dirdata
 Abstract base class template of directory data created for each directory the recusion handles. More...
class  recursionenv
 Type of or public base class of the global recursion environment used by the methods recurse() and traverse(). More...

Member Typedef Documentation

template<class NameT = pstring>
typedef NameT stm::path< NameT >::name_type

Template type parameter NameT.

Definition at line 257 of file filesysaids.hpp.

template<class NameT = pstring>
typedef boost::filesystem::path stm::path< NameT >::base

Public base class.

Definition at line 260 of file filesysaids.hpp.


Constructor & Destructor Documentation

template<class NameT = pstring>
stm::path< NameT >::path (  ) 

Construct an empty path object.

template<class NameT = pstring>
stm::path< NameT >::path ( const boost::filesystem::path< NameT > &  src  ) 

Construct a path object from src.

template<class NameT = pstring>
stm::path< NameT >::path ( const std::string &  src  ) 

Construct a path object from src.

template<class NameT = pstring>
stm::path< NameT >::path ( const char *  src  ) 

Construct a path object from src.

template<class NameT = pstring>
stm::path< NameT >::path ( const std::string &  src,
name_check  checker 
)

Construct a path object from src with name check function checker.

template<class NameT = pstring>
stm::path< NameT >::path ( const char *  src,
name_check  checker 
)

Construct a path object from src with name check function checker.


Member Function Documentation

template<class NameT = pstring>
const name_type stm::path< NameT >::string (  )  const

Returns this path's character representation as name_type object which is convertible to std::string.

template<class NameT = pstring>
std::string stm::path< NameT >::head (  )  const

If this path is not empty, the method returns *begin(), else an empty std::string.

template<class NameT = pstring>
path<NameT> stm::path< NameT >::tail_path (  )  const

If this path is not empty, the method retuns a path object consisting of this path with stripped off the head() component, else the empty path.

template<class NameT = pstring>
bool stm::path< NameT >::has_head (  )  const

Returns true, if head() is not empty, else false.

template<class NameT = pstring>
bool stm::path< NameT >::has_tail_path (  )  const

Returns true, if tail_path() is not empty, else false.

template<class NameT = pstring>
path<NameT> stm::path< NameT >::operator- ( const base stem  )  const

If stem is the initial part of this path, return a path<NameT> object consisting of this path stripped off stem, else return the empty path.

template<class NameT = pstring>
path<NameT> stm::path< NameT >::relative_to_directory ( const base source  )  const

If this path is empty, the empty path object is returned.

If the completed forms of this path and source have the same root directory, a non-empty normalized path object result is returned such that source / result designates the same file system element as this path, where source is assumed to be a directory. Else the completed form of this path is returned.

template<class NameT = pstring>
template<class DataT>
int stm::path< NameT >::recurse ( DataT &  parent  )  const

The member function template recurse handles this path, and if it is a directory and recursion is not switched off, recursively all items of the tree spanned by this directory.

It is an error, if this path does not exist.

Provided EnvT is publicly derived from path<NameT>::recursionenv and DataT is publicly derived from path<NameT>::dirdata<DataT, EnvT>, then EnvT is the same type as DataT::env_type and is the type of the recursion environment. The argument parent describes the directory data of this path's parent directory and shall be obtained by the constructor

     DataT parent (env);
The recursion environment env shall be obtained by the constructor
     EnvT env (root, flags);
where the constructor argument root is this path.

After successful return the results of the execution are contained in the directory data parent and in the recursion environment accessible through parent.env ().

On success 0 is returned, else a value < 0. If -1 is returned, the variable errno reflects the error's cause.

template<class NameT = pstring>
template<class DataT>
int stm::path< NameT >::recurse ( typename DataT::env_type &  env  )  const

The member function template recurse handles this path, and if it is a directory and recursion is not switched off, recursively all items of the tree spanned by this directory.

It is an error, if this path does not exist.

Provided EnvT is publicly derived from path<NameT>::recursionenv and DataT is publicly derived from path<NameT>::dirdata<DataT, EnvT>, then EnvT is the same type as DataT::env_type and is the type of the recursion environment. The argument env of this type shall be obtained by the constructor

     EnvT env (root, flags);
where the constructor argument root is this path.

After successful return the results of the execution are contained in the recursion environment env.

On success 0 is returned, else a value < 0. If -1 is returned, the variable errno reflects the error's cause.

template<class NameT = pstring>
template<class DataT>
int stm::path< NameT >::traverse ( DataT &  parent,
const path< NameT > &  route 
) const

The member function template traverse handles this path, and then if the normalized route r consists of the components r1, .

.., rn, successively the paths *this / r1, *this / r1 / r2, ..., *this / r1 / ... / rn.

It is an error, if r.has_root_path() is true, or if r.head() == '.' or r.head() == '..' holds, whereas it is not required that this path or any of the composed paths exist.

Provided EnvT is publicly derived from path<NameT>::recursionenv and DataT is publicly derived from path<NameT>::dirdata<DataT, EnvT>, then EnvT is the same type as DataT::env_type and is the type of the recursion environment. The argument parent describes the directory data of this path's parent directory and shall be obtained by the constructor

     DataT parent (env);
The recursion environment env shall be obtained by the constructor
     EnvT env (root, flags);
where the constructor argument root is this path.

After successful return the results of the execution are contained in the directory data parent and in the recursion environment accessible through parent.env ().

On success 0 is returned, else a value < 0. If -1 is returned, the variable errno reflects the error's cause.

template<class NameT = pstring>
template<class DataT>
int stm::path< NameT >::traverse ( typename DataT::env_type &  env,
const path< NameT > &  route 
) const

The member function template traverse handles this path, and then if the normalized route r consists of the components r1, .

.., rn, successively the paths *this / r1, *this / r1 / r2, ..., *this / r1 / ... / rn.

It is an error, if r.has_root_path() is true, or if r.head() == '.' or r.head() == '..' holds, whereas it is not required that this path or any of the composed paths exist.

Provided EnvT is publicly derived from path<NameT>::recursionenv and DataT is publicly derived from path<NameT>::dirdata<DataT, EnvT>, then EnvT is the same type as DataT::env_type and is the type of the recursion environment. The argument env of this type shall be obtained by the constructor

     EnvT env (root, flags);
where the constructor argument root is this path.

After successful return the results of the execution are contained in the recursion environment env.

On success 0 is returned, else a value < 0. If -1 is returned, the variable errno reflects the error's cause.


© Copyright Tom Michaelis 2002-2007

Distributed under the SysToMath Software License (See the accompanying file license.txt or a copy at www.SysToMath.com).