#include <File.h>
Inherited by ibrcommon::TemporaryFile.

Public Member Functions | |
| File () | |
| File (const string path) | |
| virtual | ~File () |
| unsigned char | getType () const |
| int | getFiles (list< File > &files) |
| bool | isSystem () const |
| bool | isDirectory () const |
| std::string | getPath () const |
| int | remove (bool recursive=false) |
| File | get (string filename) const |
| File | getParent () const |
| bool | exists () const |
| void | update () |
| size_t | size () const |
Static Public Member Functions | |
| static void | createDirectory (File &path) |
A File object can hold a reference to any existing or non-existing files/directories. It provides a common set of file operations.
Definition at line 37 of file File.h.
| ibrcommon::File::File | ( | ) |
Instantiate a File object without a reference to a file.
Definition at line 20 of file File.cpp.
Referenced by getParent().
| ibrcommon::File::File | ( | const string | path | ) |
| ibrcommon::File::~File | ( | ) | [virtual] |
| void ibrcommon::File::createDirectory | ( | File & | path | ) | [static] |
This method creates a directory. This is done recursively.
| path | The path to create. |
Definition at line 202 of file File.cpp.
References exists(), getParent(), getPath(), and update().
Referenced by createBundleStorage().

| bool ibrcommon::File::exists | ( | ) | const |
Checks whether this file exists or not.
Definition at line 60 of file File.cpp.
Referenced by dtn::daemon::StatisticLogger::componentUp(), createBundleStorage(), createDirectory(), main(), and dtn::core::SimpleBundleStorage::BundleContainer::Holder::~Holder().
| File ibrcommon::File::get | ( | string | filename | ) | const |
| int ibrcommon::File::getFiles | ( | list< File > & | files | ) |
Get all files in the directory. The given path in the constructor has to be a directory in this case.
| files | A (empty) list to put the new file objects in. |
Definition at line 107 of file File.cpp.
References getPath(), and isDirectory().
Referenced by main(), remove(), and dtn::core::SimpleBundleStorage::SimpleBundleStorage().

| File ibrcommon::File::getParent | ( | ) | const |
Get the parent of this file. This is always the containing directory.
Definition at line 196 of file File.cpp.
References File().
Referenced by createDirectory().

| string ibrcommon::File::getPath | ( | ) | const |
Returns the full path of the file (as given in the constructor).
Definition at line 145 of file File.cpp.
Referenced by ibrcommon::TmpFileBLOB::clear(), dtn::daemon::StatisticLogger::componentUp(), createBundleStorage(), createDirectory(), get(), getFiles(), main(), ibrcommon::tcpclient::open(), ibrcommon::locked_fstream::open(), ibrcommon::locked_ofstream::open(), ibrcommon::locked_ifstream::open(), ibrcommon::TmpFileBLOB::open(), remove(), dtn::core::SimpleBundleStorage::SimpleBundleStorage(), size(), and ibrcommon::tcpserver::tcpserver().
| unsigned char ibrcommon::File::getType | ( | ) | const |
| bool ibrcommon::File::isDirectory | ( | ) | const |
Checks if a file is a directory.
Definition at line 139 of file File.cpp.
Referenced by getFiles(), remove(), and dtn::core::SimpleBundleStorage::SimpleBundleStorage().
| bool ibrcommon::File::isSystem | ( | ) | const |
Checks if a file is a system file like ".." and ".".
Definition at line 129 of file File.cpp.
Referenced by main(), remove(), and dtn::core::SimpleBundleStorage::SimpleBundleStorage().
| int ibrcommon::File::remove | ( | bool | recursive = false |
) |
Remove a file.
| recursive | If set to true, the deletion works recursive and deletes directories with files too. |
Definition at line 158 of file File.cpp.
References getFiles(), getPath(), isDirectory(), and isSystem().
Referenced by main(), dtn::core::SimpleBundleStorage::SimpleBundleStorage(), dtn::core::SimpleBundleStorage::BundleContainer::Holder::~Holder(), and ibrcommon::TmpFileBLOB::~TmpFileBLOB().

| size_t ibrcommon::File::size | ( | ) | const |
Get the size of the file.
Definition at line 217 of file File.cpp.
References getPath().
Referenced by dtn::core::SimpleBundleStorage::BundleContainer::Holder::Holder(), dtn::core::SimpleBundleStorage::BundleContainer::Holder::invokeStore(), and dtn::core::SimpleBundleStorage::store().

| void ibrcommon::File::update | ( | ) |
Updates file information like file type
Definition at line 69 of file File.cpp.
Referenced by createDirectory(), and File().
1.7.1