Poco::File Class Reference

The File class provides methods for working with a file. More...

#include <File.h>

Inheritance diagram for Poco::File:
Inheritance graph
[legend]

List of all members.

Public Types

typedef FileSizeImpl FileSize

Public Member Functions

bool canExecute () const
 Returns true iff the file is writeable.
bool canRead () const
 Returns true iff the file exists.
bool canWrite () const
 Returns true iff the file is readable.
void copyTo (const std::string &path) const
Timestamp created () const
void createDirectories ()
bool createDirectory ()
bool createFile ()
bool exists () const
 Returns the path.
 File (const File &file)
 Creates the file.
 File (const Path &path)
 Creates the file.
 File (const char *path)
 Creates the file.
 File (const std::string &path)
 Creates the file.
 File ()
Timestamp getLastModified () const
FileSize getSize () const
 Sets the modification date of the file.
bool isDevice () const
 Returns true iff the file is a directory.
bool isDirectory () const
 Returns true iff the file is a symbolic link.
bool isFile () const
bool isHidden () const
 Returns true iff the file is a device.
bool isLink () const
 Returns true iff the file is a regular file.
void list (std::vector< File > &files) const
void list (std::vector< std::string > &files) const
void moveTo (const std::string &path)
bool operator!= (const File &file) const
bool operator< (const File &file) const
bool operator<= (const File &file) const
Fileoperator= (const Path &path)
 Assignment operator.
Fileoperator= (const char *path)
 Assignment operator.
Fileoperator= (const std::string &path)
 Assignment operator.
Fileoperator= (const File &file)
 Destroys the file.
bool operator== (const File &file) const
bool operator> (const File &file) const
bool operator>= (const File &file) const
const std::string & path () const
 Swaps the file with another one.
void remove (bool recursive=false)
 Renames the file to the new name.
void renameTo (const std::string &path)
void setExecutable (bool flag=true)
void setLastModified (const Timestamp &ts)
 Returns the modification date of the file.
void setReadOnly (bool flag=true)
void setSize (FileSize size)
 Returns the size of the file in bytes.
void setWriteable (bool flag=true)
void swap (File &file)
 Assignment operator.
virtual ~File ()
 Copy constructor.

Static Public Member Functions

static void handleLastError (const std::string &path)

Protected Member Functions

void copyDirectory (const std::string &path) const

Detailed Description

The File class provides methods for working with a file.

Definition at line 65 of file File.h.


Member Typedef Documentation

Definition at line 69 of file File.h.


Constructor & Destructor Documentation

Poco::File::File (  ) 

Definition at line 53 of file File.cpp.

Poco::File::File ( const std::string &  path  ) 

Creates the file.

Definition at line 58 of file File.cpp.

Poco::File::File ( const char *  path  ) 

Creates the file.

Definition at line 63 of file File.cpp.

Poco::File::File ( const Path path  ) 

Creates the file.

Definition at line 68 of file File.cpp.

Poco::File::File ( const File file  ) 

Creates the file.

Definition at line 73 of file File.cpp.

Poco::File::~File (  )  [virtual]

Copy constructor.

Definition at line 78 of file File.cpp.


Member Function Documentation

bool Poco::File::canExecute (  )  const

Returns true iff the file is writeable.

Definition at line 136 of file File.cpp.

bool Poco::File::canRead (  )  const

Returns true iff the file exists.

Definition at line 124 of file File.cpp.

bool Poco::File::canWrite (  )  const

Returns true iff the file is readable.

Definition at line 130 of file File.cpp.

void Poco::File::copyDirectory ( const std::string &  path  )  const [protected]

For internal use only. Throws an appropriate exception for the last file-related error.

Definition at line 237 of file File.cpp.

void Poco::File::copyTo ( const std::string &  path  )  const

Makes the file executable (if flag is true), or non-executable (if flag is false) by setting the file's permission bits accordingly.

Does nothing on Windows and OpenVMS.

Definition at line 220 of file File.cpp.

Timestamp Poco::File::created (  )  const

Returns true if the file is hidden.

On Windows platforms, the file's hidden attribute is set for this to be true.

On Unix platforms, the file name must begin with a period for this to be true.

Definition at line 172 of file File.cpp.

void Poco::File::createDirectories (  ) 

Creates a directory. Returns true if the directory has been created and false if it already exists. Throws an exception if an error occurs.

Definition at line 295 of file File.cpp.

bool Poco::File::createDirectory (  ) 

Creates a new, empty file in an atomic operation. Returns true if the file has been created and false if the file already exists. Throws an exception if an error occurs.

Definition at line 289 of file File.cpp.

bool Poco::File::createFile (  ) 

Deletes the file. If recursive is true and the file is a directory, recursively deletes all files in the directory.

Definition at line 283 of file File.cpp.

bool Poco::File::exists (  )  const

Returns the path.

Definition at line 118 of file File.cpp.

Timestamp Poco::File::getLastModified (  )  const

Returns the creation date of the file.

Not all platforms or filesystems (e.g. Linux and most Unix platforms with the exception of FreeBSD and Mac OS X) maintain the creation date of a file. On such platforms, created() returns the time of the last inode modification.

Definition at line 178 of file File.cpp.

File::FileSize Poco::File::getSize (  )  const

Sets the modification date of the file.

Definition at line 190 of file File.cpp.

void Poco::File::handleLastError ( const std::string &  path  )  [static]

Reimplemented from Poco::FileImpl.

Definition at line 338 of file File.cpp.

bool Poco::File::isDevice (  )  const

Returns true iff the file is a directory.

Definition at line 160 of file File.cpp.

bool Poco::File::isDirectory (  )  const

Returns true iff the file is a symbolic link.

Definition at line 148 of file File.cpp.

bool Poco::File::isFile (  )  const

Returns true iff the file is executable.

On Windows and OpenVMS, the file must have the extension ".EXE" to be executable. On Unix platforms, the executable permission bit must be set.

Definition at line 142 of file File.cpp.

bool Poco::File::isHidden (  )  const

Returns true iff the file is a device.

Definition at line 166 of file File.cpp.

bool Poco::File::isLink (  )  const

Returns true iff the file is a regular file.

Definition at line 154 of file File.cpp.

void Poco::File::list ( std::vector< File > &  files  )  const

Fills the vector with the names of all files in the directory.

Definition at line 325 of file File.cpp.

void Poco::File::list ( std::vector< std::string > &  files  )  const

Creates a directory (and all parent directories if necessary).

Definition at line 312 of file File.cpp.

void Poco::File::moveTo ( const std::string &  path  ) 

Copies the file (or directory) to the given path. The target path can be a directory.

A directory is copied recursively.

Definition at line 253 of file File.cpp.

bool Poco::File::operator!= ( const File file  )  const [inline]

Definition at line 257 of file File.h.

bool Poco::File::operator< ( const File file  )  const [inline]

Definition at line 263 of file File.h.

bool Poco::File::operator<= ( const File file  )  const [inline]

Definition at line 269 of file File.h.

File & Poco::File::operator= ( const Path path  ) 

Assignment operator.

Definition at line 105 of file File.cpp.

File & Poco::File::operator= ( const char *  path  ) 

Assignment operator.

Definition at line 97 of file File.cpp.

File & Poco::File::operator= ( const std::string &  path  ) 

Assignment operator.

Definition at line 90 of file File.cpp.

File & Poco::File::operator= ( const File file  ) 

Destroys the file.

Definition at line 83 of file File.cpp.

bool Poco::File::operator== ( const File file  )  const [inline]

Fills the vector with the names of all files in the directory.

Definition at line 251 of file File.h.

bool Poco::File::operator> ( const File file  )  const [inline]

Definition at line 275 of file File.h.

bool Poco::File::operator>= ( const File file  )  const [inline]

Definition at line 281 of file File.h.

const std::string & Poco::File::path (  )  const [inline]

Swaps the file with another one.

Definition at line 245 of file File.h.

void Poco::File::remove ( bool  recursive = false  ) 

Renames the file to the new name.

Definition at line 268 of file File.cpp.

void Poco::File::renameTo ( const std::string &  path  ) 

Copies the file (or directory) to the given path and removes the original file. The target path can be a directory.

Definition at line 261 of file File.cpp.

void Poco::File::setExecutable ( bool  flag = true  ) 

Makes the file non-writeable (if flag is true), or writeable (if flag is false) by setting the file's flags in the filesystem accordingly.

Definition at line 214 of file File.cpp.

void Poco::File::setLastModified ( const Timestamp ts  ) 

Returns the modification date of the file.

Definition at line 184 of file File.cpp.

void Poco::File::setReadOnly ( bool  flag = true  ) 

Makes the file writeable (if flag is true), or non-writeable (if flag is false) by setting the file's flags in the filesystem accordingly.

Definition at line 208 of file File.cpp.

void Poco::File::setSize ( FileSize  size  ) 

Returns the size of the file in bytes.

void Poco::File::setWriteable ( bool  flag = true  ) 

Sets the size of the file in bytes. Can be used to truncate a file.

Definition at line 202 of file File.cpp.

void Poco::File::swap ( File file  ) 

Assignment operator.

Definition at line 112 of file File.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


pluginlib
Author(s): Tully Foote and Eitan Marder-Eppstein
autogenerated on Fri Jan 11 09:35:01 2013