Poco::File Class Reference
The File class provides methods for working with a file.
More...
#include <File.h>
List of all members.
Detailed Description
The File class provides methods for working with a file.
Definition at line 65 of file File.h.
Member Typedef Documentation
Constructor & Destructor Documentation
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.
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.
Sets the modification date of the file.
Definition at line 190 of file File.cpp.
void Poco::File::handleLastError |
( |
const std::string & |
path |
) |
[static] |
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] |
bool Poco::File::operator< |
( |
const File & |
file |
) |
const [inline] |
bool Poco::File::operator<= |
( |
const File & |
file |
) |
const [inline] |
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] |
bool Poco::File::operator>= |
( |
const File & |
file |
) |
const [inline] |
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: