Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
zorba::file Class Reference

#include <zorba/util/file.h>

Inheritance diagram for zorba::file:
Inheritance graph
[legend]
Collaboration diagram for zorba::file:
Collaboration graph
[legend]

Public Types

typedef zorba::File::FileSize_t file_size_t
 
enum  filetype {
  type_invalid, type_non_existent, type_directory, type_link,
  type_file, type_volume, type_other
}
 
enum  flags_t { CONVERT_SLASHES = 1, RESOLVE = 2 }
 

Public Member Functions

filesystem_path branch_path () const
 
const char * c_str () const
 
void chdir ()
 
void create ()
 
void deep_mkdir ()
 
bool exists (bool follow_symlinks=true) const
 
 file (const filesystem_path &path, int flags=0)
 
filetype get_filetype (bool follow_symlinks=true) const
 
const std::string & get_path () const
 
file_size_t get_size () const
 
bool is_complete () const
 
bool is_directory (bool follow_symlinks=true) const
 
bool is_empty () const
 
bool is_file (bool follow_symlinks=true) const
 
bool is_invalid () const
 
bool is_link () const
 
bool is_root () const
 
bool is_volume (bool follow_symlinks=true) const
 
time_t lastModified () const
 
void lsdir (std::vector< std::string > &list)
 
void mkdir ()
 
 operator const std::string & () const
 
void remove (bool ignore=true)
 
void rename (std::string const &newpath)
 
void resolve_relative ()
 
void rmdir (bool ignore=true)
 
void set_filetype (filetype)
 
void set_path (std::string const &_path)
 

Static Public Member Functions

static const char * get_directory_separator ()
 
static const char * get_path_separator ()
 
static std::string normalize_path (std::string const &in, std::string const &base="")
 Utility function to normalize a path as a system conforming path and optionally resolve it. More...
 

Protected Member Functions

filetype do_stat (bool follow_symlinks=true, file_size_t *size=0) const
 
std::string getPathString () const
 

Detailed Description

Definition at line 35 of file util/file.h.

Member Typedef Documentation

Definition at line 49 of file util/file.h.

Member Enumeration Documentation

Enumerator
type_invalid 
type_non_existent 
type_directory 
type_link 
type_file 
type_volume 
type_other 

Definition at line 39 of file util/file.h.

Enumerator
CONVERT_SLASHES 
RESOLVE 

Definition at line 37 of file path.h.

Constructor & Destructor Documentation

zorba::file::file ( const filesystem_path path,
int  flags = 0 
)

Member Function Documentation

filesystem_path zorba::filesystem_path::branch_path ( ) const
inherited
const char* zorba::filesystem_path::c_str ( ) const
inlineinherited

Definition at line 80 of file path.h.

void zorba::file::chdir ( )
void zorba::file::create ( )
void zorba::file::deep_mkdir ( )
filetype zorba::file::do_stat ( bool  follow_symlinks = true,
file_size_t size = 0 
) const
protected
bool zorba::file::exists ( bool  follow_symlinks = true) const
inline

Definition at line 85 of file util/file.h.

static const char* zorba::filesystem_path::get_directory_separator ( )
staticinherited
filetype zorba::file::get_filetype ( bool  follow_symlinks = true) const
inline

Definition at line 61 of file util/file.h.

const std::string& zorba::filesystem_path::get_path ( ) const
inlineinherited

Definition at line 79 of file path.h.

Referenced by zorba::filesystem_path::filesystem_path(), and zorba::operator<<().

static const char* zorba::filesystem_path::get_path_separator ( )
staticinherited
file_size_t zorba::file::get_size ( ) const
inline

Definition at line 96 of file util/file.h.

std::string zorba::filesystem_path::getPathString ( ) const
protectedinherited
bool zorba::filesystem_path::is_complete ( ) const
inherited
bool zorba::file::is_directory ( bool  follow_symlinks = true) const
inline

Definition at line 65 of file util/file.h.

bool zorba::file::is_empty ( ) const
inline

Definition at line 111 of file util/file.h.

bool zorba::file::is_file ( bool  follow_symlinks = true) const
inline

Definition at line 69 of file util/file.h.

bool zorba::file::is_invalid ( ) const
inline

Definition at line 81 of file util/file.h.

bool zorba::file::is_link ( ) const
inline

Definition at line 73 of file util/file.h.

bool zorba::filesystem_path::is_root ( ) const
inherited
bool zorba::file::is_volume ( bool  follow_symlinks = true) const
inline

Definition at line 77 of file util/file.h.

time_t zorba::file::lastModified ( ) const
void zorba::file::lsdir ( std::vector< std::string > &  list)
void zorba::file::mkdir ( )
static std::string zorba::filesystem_path::normalize_path ( std::string const &  in,
std::string const &  base = "" 
)
staticinherited

Utility function to normalize a path as a system conforming path and optionally resolve it.

This function takes a path (as system path, file uri) and normalizes it. It converts file URIs to system paths and replaces '/' and '\' to the platform specific directory separator ('\' on Windows, '/' on UNIX like operating systems like Linux and Mac OS X). If the parameter base is set, it also resolves the path.

Parameters
inThe path to normalize.
baseThe base name to resolve a path (default = ""), if this is the empty string, it does not resolve anything, but only normalizes the path.
Returns
Returns a normalized and optionally a resolved path.
zorba::filesystem_path::operator const std::string & ( ) const
inlineinherited

Definition at line 81 of file path.h.

void zorba::file::remove ( bool  ignore = true)
void zorba::file::rename ( std::string const &  newpath)
void zorba::filesystem_path::resolve_relative ( )
inherited
void zorba::file::rmdir ( bool  ignore = true)
void zorba::file::set_filetype ( filetype  )
inline

Definition at line 59 of file util/file.h.

void zorba::file::set_path ( std::string const &  _path)
inline

Definition at line 58 of file util/file.h.


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