AnCH Framework  0.1
Another C++ Hack Framework
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Static Public Attributes | List of all members
anch::file::File Class Reference

#include <file.hpp>

Collaboration diagram for anch::file::File:

Public Member Functions

 File (const std::string &path, bool init=true)
 
 File (const std::string &parent, const std::string &name)
 
 File (const File &parent, const std::string &name)
 
 File (std::shared_ptr< File > parent, const std::string &name)
 
 File (const File &file)
 
virtual ~File ()
 
void createFile () throw (anch::file::FileException)
 
void createFile (std::ofstream &out) throw (anch::file::FileException)
 
void createDirectory (bool parents=false) throw (anch::file::FileException)
 
void deleteFile () throw (anch::file::FileException)
 
void list (std::vector< std::string > &files) throw (anch::file::FileException)
 
void list (std::vector< File > &files) throw (anch::file::FileException)
 
const std::string & getPath () const
 
std::shared_ptr< FilegetParent () const
 
bool exists () const
 
bool isDirectory () const
 
bool isFile () const
 
bool canRead () const
 
bool canWrite () const
 
bool canExecute () const
 
uint64_t getSize () const
 
const anch::date::DategetLastAccess () const
 
const anch::date::DategetLastModification () const
 
const anch::date::DategetLastStatusChange () const
 

Static Public Attributes

static const char SEP = '/'
 

Detailed Description

File class utility

Author
Vincent Lachenal

Constructor & Destructor Documentation

File::File ( const std::string &  path,
bool  init = true 
)

File constructor

Parameters
pathThe File path
initInitialize file members
File::File ( const std::string &  parent,
const std::string &  name 
)

File constructor

Parameters
parentThe parent File path
nameThe File name
File::File ( const File parent,
const std::string &  name 
)

File constructor

Parameters
parentThe parent File
nameThe File name

File constructor

Parameters
parentthe parent File
namethe File name
File::File ( std::shared_ptr< File parent,
const std::string &  name 
)

File constructor

Parameters
parentThe parent File
nameThe File name

File constructor

Parameters
parentthe parent File
nameThe File name
File::File ( const File file)

File copy constructor

Parameters
fileFile to copy
File::~File ( )
virtual

File destructor

Member Function Documentation

bool anch::file::File::canExecute ( ) const
inline

Return the executable state

Returns
true is the File can be executed, false otherwise.
bool anch::file::File::canRead ( ) const
inline

Return the readable state

Returns
true is the File can be read, false otherwise.
bool anch::file::File::canWrite ( ) const
inline

Return the writable state

Returns
true is the File can be written, false otherwise.
void File::createDirectory ( bool  parents = false)
throw (anch::file::FileException
)

Create directory

Parameters
parentsCreate parent directories if needed
Exceptions
anch::file::FileExceptionany error on directory creation

Create directory

Parameters
parentsCreate parent directories if needed
Exceptions
FileExceptionany error on directory creation
void File::createFile ( )
throw (anch::file::FileException
)

Create a new file

Exceptions
anch::file::FileExceptionany error on file creation

Create a new file

Exceptions
FileExceptionany error on file creation
void File::createFile ( std::ofstream &  out)
throw (anch::file::FileException
)

Create a new file

Parameters
outThe output stream on the file
Exceptions
anch::file::FileExceptionany error on file creation

Create a new file

Parameters
outThe output stream on the file
Exceptions
FileExceptionany error on file creation
void File::deleteFile ( )
throw (anch::file::FileException
)

Delete this File

Exceptions
anch::file::FileExceptionany error on file deletion

Delete this File

Exceptions
FileExceptionany error on file deletion
bool anch::file::File::exists ( ) const
inline

Check if File exist.

Returns
true if File exists, false otherwise.
const anch::date::Date& anch::file::File::getLastAccess ( ) const
inline

File last access getter

Returns
the File last access
const anch::date::Date& anch::file::File::getLastModification ( ) const
inline

File last modification getter

Returns
the File last modification
const anch::date::Date& anch::file::File::getLastStatusChange ( ) const
inline

File last status change getter

Returns
the File last status change
std::shared_ptr<File> anch::file::File::getParent ( ) const
inline

Get the parent File

Returns
the parent File
const std::string& anch::file::File::getPath ( ) const
inline

Get the File path

Returns
the File path
uint64_t anch::file::File::getSize ( ) const
inline

File size getter

Returns
the File size
bool anch::file::File::isDirectory ( ) const
inline

Check is File is a directory.

Returns
true if File is a directory, false otherwise.
bool anch::file::File::isFile ( ) const
inline

Check is File is a regular file.

Returns
true if File is a regular file, false otherwise.
void File::list ( std::vector< std::string > &  files)
throw (anch::file::FileException
)

List files and directories in current directory.

Parameters
filesthe files list
Exceptions
anch::file::FileExceptionany error on directory list

List files and directories in current directory.

Returns
The files list
Exceptions
FileExceptionany error on directory list
void File::list ( std::vector< File > &  files)
throw (anch::file::FileException
)

List files and directories in current directory.

Parameters
filesThe File list
Exceptions
anch::file::FileExceptionany error on directory list

List files and directories in current directory.

Returns
The File list
Exceptions
FileExceptionany error on directory list

Member Data Documentation

const char File::SEP = '/'
static

File separator character


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