IBR-DTNSuite
0.8
|
#include <File.h>
Public Member Functions | |
File () | |
File (const string path) | |
virtual | ~File () |
unsigned char | getType () const |
int | getFiles (list< File > &files) const |
bool | isSystem () const |
bool | isDirectory () const |
std::string | getPath () const |
std::string | getBasename () const |
int | remove (bool recursive=false) |
File | get (string filename) const |
File | getParent () const |
bool | exists () const |
void | update () |
size_t | size () const |
time_t | lastaccess () const |
time_t | lastmodify () const |
time_t | laststatchange () const |
bool | operator== (const ibrcommon::File &other) const |
bool | operator< (const ibrcommon::File &other) 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.
Instantiate a File object without a reference to a file.
Definition at line 27 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 221 of file File.cpp.
References exists(), getParent(), getPath(), and update().
Referenced by dtn::storage::SQLiteBundleStorage::clear(), dtn::storage::SQLiteBundleStorage::componentUp(), createBundleStorage(), dtn::storage::DataStorage::DataStorage(), initialize_blobs(), and dtn::daemon::Configuration::Security::load().
bool ibrcommon::File::exists | ( | ) | const |
Checks whether this file exists or not.
Definition at line 67 of file File.cpp.
Referenced by dtn::daemon::StatisticLogger::componentUp(), createBundleStorage(), createConvergenceLayers(), createDirectory(), dtn::storage::DataStorage::DataStorage(), ibrcommon::FileBLOB::FileBLOB(), dtn::security::SecurityKeyManager::get(), dtn::security::SecurityKeyManager::hasKey(), init(), initialize_blobs(), main(), dtn::storage::DataStorage::retrieve(), dtn::storage::DataStorage::run(), dtn::security::SecurityKeyManager::store(), and ibrcommon::vaddress::vaddress().
File ibrcommon::File::get | ( | string | filename | ) | const |
Get a specific file in this directory.
filename | The name of the file (not the full path). |
Definition at line 169 of file File.cpp.
References getPath().
Referenced by dtn::security::SecurityKeyManager::get(), dtn::security::SecurityKeyManager::hasKey(), dtn::storage::DataStorage::retrieve(), dtn::storage::DataStorage::run(), dtn::storage::SQLiteBundleStorage::SQLiteBundleStorage(), and dtn::security::SecurityKeyManager::store().
std::string ibrcommon::File::getBasename | ( | ) | const |
int ibrcommon::File::getFiles | ( | list< File > & | files | ) | const |
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 114 of file File.cpp.
References getPath(), and isDirectory().
Referenced by dtn::storage::DataStorage::DataStorage(), ibrcommon::TLSStream::init(), dtn::storage::DataStorage::iterateAll(), main(), and remove().
File ibrcommon::File::getParent | ( | ) | const |
Get the parent of this file. This is always the containing directory.
Definition at line 215 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 152 of file File.cpp.
Referenced by __daemon_run(), dtn::net::FileConvergenceLayer::componentRun(), dtn::daemon::StatisticLogger::componentUp(), createBundleStorage(), createDirectory(), dtn::security::SecurityKeyManager::get(), dtn::storage::SQLiteBundleStorage::get(), get(), dtn::security::SecurityKey::getData(), dtn::security::SecurityKey::getEVP(), getFiles(), ibrcommon::TLSStream::init(), dtn::security::SecurityKeyManager::initialize(), dtn::security::SecurityCertificateManager::initialize(), initialize_blobs(), dtn::storage::DataStorage::istream::istream(), lastaccess(), lastmodify(), laststatchange(), main(), ibrcommon::tcpclient::open(), dtn::storage::SQLiteDatabase::open(), ibrcommon::FileBLOB::open(), remove(), dtn::storage::DataStorage::run(), size(), dtn::security::SecurityKeyManager::store(), dtn::storage::SQLiteBundleStorage::store(), dtn::storage::SQLiteDatabase::store(), and dtn::net::FileMonitor::watch().
unsigned char ibrcommon::File::getType | ( | ) | const |
bool ibrcommon::File::isDirectory | ( | ) | const |
Checks if a file is a directory.
Definition at line 146 of file File.cpp.
Referenced by getFiles(), ibrcommon::TLSStream::init(), dtn::security::SecurityCertificateManager::initialize(), initialize_blobs(), remove(), and dtn::net::FileMonitor::watch().
bool ibrcommon::File::isSystem | ( | ) | const |
time_t ibrcommon::File::lastaccess | ( | ) | const |
Get the timestamp of the last access
Definition at line 243 of file File.cpp.
References getPath().
Referenced by dtn::storage::SQLiteBundleStorage::get().
time_t ibrcommon::File::lastmodify | ( | ) | const |
Get the timestamp of the last modification
Definition at line 250 of file File.cpp.
References getPath().
Referenced by dtn::security::SecurityKeyManager::get(), and dtn::storage::SQLiteBundleStorage::get().
time_t ibrcommon::File::laststatchange | ( | ) | const |
bool ibrcommon::File::operator< | ( | const ibrcommon::File & | other | ) | const |
bool ibrcommon::File::operator== | ( | const ibrcommon::File & | other | ) | const |
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 177 of file File.cpp.
References getFiles(), getPath(), isDirectory(), and isSystem().
Referenced by dtn::storage::SQLiteBundleStorage::clear(), dtn::net::FileConvergenceLayer::componentRun(), dtn::storage::SQLiteBundleStorage::componentUp(), dtn::storage::SQLiteDatabase::expire(), main(), dtn::storage::SQLiteDatabase::remove(), dtn::storage::DataStorage::run(), dtn::security::SecurityKeyManager::store(), and dtn::storage::SQLiteBundleStorage::store().
size_t ibrcommon::File::size | ( | ) | const |
Get the size of the file.
Definition at line 236 of file File.cpp.
References getPath().
Referenced by ibrcommon::FileBLOB::__get_size(), and dtn::storage::SQLiteBundleStorage::store().
void ibrcommon::File::update | ( | ) |
Updates file information like file type
Definition at line 76 of file File.cpp.
Referenced by createDirectory(), and File().