libqi-api  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Friends | List of all members
qi::Path Class Reference

The Path class allow handling filesystem path in a cross-platform maner. The class assume that all string are encoded in UTF-8 if not specified otherwise. More...

#include <path.hpp>

Public Member Functions

 Path (const std::string &unicodePath=std::string())
 
 Path (const char *unicodePath)
 
 Path (const Path &path)
 Copy Constructor. More...
 
 Path (const boost::filesystem::path &path)
 Copy Constructor from boost filesystem. More...
 
 ~Path ()
 Default destructor. More...
 
bool isEmpty () const
 is the path empty? More...
 
bool exists () const
 does this file exist? More...
 
bool isDir () const
 is the path a directory? More...
 
bool isRegularFile () const
 is the path a regular file? More...
 
bool isSymlink () const
 is the path a symlink? More...
 
std::string filename () const
 
std::string extension () const
 
Path parent () const
 
Path absolute () const
 
PathVector files () const
 
PathVector recursiveFiles () const
 
PathVector dirs () const
 
 operator std::string () const
 
std::string str () const
 
const boost::filesystem::path & bfsPath () const
 
Path operator/ (const qi::Path &rhs) const
 concat two paths adding a directory separator between them More...
 
const Pathoperator/= (const qi::Path &rhs) const
 concat two paths adding a directory separator between them More...
 
const Pathoperator= (const qi::Path &rhs) const
 copy operator More...
 
bool operator== (const qi::Path &rhs) const
 
bool operator!= (const qi::Path &rhs) const
 

Static Public Member Functions

static Path fromNative (const char *nativeCharsPath)
 
static Path fromNative (const wchar_t *nativeCharsPath)
 
static Path fromNative (const std::string &nativeCharsPath)
 
static Path fromNative (const std::wstring &nativeCharsPath)
 

Friends

std::ostream & operator<< (std::ostream &output, const qi::Path &path)
 Standard output stream operator for logging. More...
 

Detailed Description

The Path class allow handling filesystem path in a cross-platform maner. The class assume that all string are encoded in UTF-8 if not specified otherwise.

Definition at line 34 of file path.hpp.

Constructor & Destructor Documentation

qi::Path::Path ( const std::string &  unicodePath = std::string())

Default Constructor

Parameters
unicodePathPath value as UTF-8 string.
qi::Path::Path ( const char *  unicodePath)
Parameters
unicodePathPath value as UTF-8 string.
qi::Path::Path ( const Path path)

Copy Constructor.

qi::Path::Path ( const boost::filesystem::path &  path)

Copy Constructor from boost filesystem.

qi::Path::~Path ( )

Default destructor.

Member Function Documentation

Path qi::Path::absolute ( ) const
Returns
an absolute Path of the current path
const boost::filesystem::path& qi::Path::bfsPath ( ) const
Returns
the path as a boost path representation
PathVector qi::Path::dirs ( ) const
Returns
a vector of dirs contained in the current path
bool qi::Path::exists ( ) const

does this file exist?

std::string qi::Path::extension ( ) const
Returns
the extension of the last component of the path as an UTF-8 string
std::string qi::Path::filename ( ) const
Returns
the last component of the path as an UTF-8 string
PathVector qi::Path::files ( ) const
Returns
a vector of files contained in the current path
static Path qi::Path::fromNative ( const char *  nativeCharsPath)
static
Returns
A unicode-safe path from a string containing a native encoding path instead of UTF-8.
static Path qi::Path::fromNative ( const wchar_t *  nativeCharsPath)
static
Returns
A unicode-safe path from a string containing a native encoding path instead of UTF-8.
static Path qi::Path::fromNative ( const std::string &  nativeCharsPath)
static
Returns
A unicode-safe path from a string containing a native encoding path instead of UTF-8.
static Path qi::Path::fromNative ( const std::wstring &  nativeCharsPath)
static
Returns
A unicode-safe path from a string containing a native encoding path instead of UTF-8.
bool qi::Path::isDir ( ) const

is the path a directory?

bool qi::Path::isEmpty ( ) const

is the path empty?

bool qi::Path::isRegularFile ( ) const

is the path a regular file?

bool qi::Path::isSymlink ( ) const

is the path a symlink?

qi::Path::operator std::string ( ) const
explicit
Returns
the path as an UTF-8 string
bool qi::Path::operator!= ( const qi::Path rhs) const
Path qi::Path::operator/ ( const qi::Path rhs) const

concat two paths adding a directory separator between them

const Path& qi::Path::operator/= ( const qi::Path rhs) const

concat two paths adding a directory separator between them

const Path& qi::Path::operator= ( const qi::Path rhs) const

copy operator

bool qi::Path::operator== ( const qi::Path rhs) const
Path qi::Path::parent ( ) const
Returns
a Path to the parent
PathVector qi::Path::recursiveFiles ( ) const
Returns
a vector of absolute path to files contained recursively in the current path
std::string qi::Path::str ( ) const
Returns
the path as an UTF-8 string

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  output,
const qi::Path path 
)
friend

Standard output stream operator for logging.

Definition at line 125 of file path.hpp.


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