|
IBR-DTNSuite 0.6
|
#include <File.h>


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 |
| 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 |
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.
| ibrcommon::File::File | ( | ) |
Instantiate a File object without a reference to a file.
Definition at line 24 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 211 of file File.cpp.
References exists(), getParent(), getPath(), and update().
Referenced by dtn::core::SQLiteBundleStorage::clear(), createBundleStorage(), dtn::core::DataStorage::DataStorage(), dtn::daemon::Configuration::Security::load(), dtn::core::SQLiteBundleStorage::openDatabase(), and setGlobalVars().

| bool ibrcommon::File::exists | ( | ) | const |
Checks whether this file exists or not.
Definition at line 64 of file File.cpp.
Referenced by dtn::daemon::StatisticLogger::componentUp(), createBundleStorage(), createDirectory(), dtn::core::DataStorage::DataStorage(), dtn::security::SecurityKeyManager::get(), dtn::security::SecurityKeyManager::hasKey(), main(), dtn::core::DataStorage::retrieve(), dtn::core::DataStorage::run(), and dtn::security::SecurityKeyManager::store().
| 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 159 of file File.cpp.
References getPath().
Referenced by dtn::security::SecurityKeyManager::get(), dtn::security::SecurityKeyManager::hasKey(), dtn::core::SQLiteBundleStorage::openDatabase(), dtn::core::DataStorage::retrieve(), dtn::core::DataStorage::run(), and dtn::security::SecurityKeyManager::store().

| std::string ibrcommon::File::getBasename | ( | ) | 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 111 of file File.cpp.
References getPath(), and isDirectory().
Referenced by dtn::core::DataStorage::DataStorage(), dtn::core::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 205 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 149 of file File.cpp.
Referenced by __daemon_run(), ibrcommon::TmpFileBLOB::clear(), dtn::daemon::StatisticLogger::componentUp(), createBundleStorage(), createDirectory(), get(), dtn::security::SecurityKeyManager::get(), dtn::security::SecurityKey::getData(), dtn::security::SecurityKey::getEVP(), getFiles(), dtn::security::SecurityKeyManager::initialize(), dtn::core::DataStorage::istream::istream(), lastaccess(), lastmodify(), laststatchange(), main(), ibrcommon::tcpclient::open(), ibrcommon::locked_fstreambuf::open(), ibrcommon::TmpFileBLOB::open(), ibrcommon::FileBLOB::open(), dtn::core::SQLiteBundleStorage::openDatabase(), remove(), dtn::core::DataStorage::run(), size(), and dtn::security::SecurityKeyManager::store().
| unsigned char ibrcommon::File::getType | ( | ) | const |
| bool ibrcommon::File::isDirectory | ( | ) | const |
Checks if a file is a directory.
Definition at line 143 of file File.cpp.
Referenced by getFiles(), and remove().
| bool ibrcommon::File::isSystem | ( | ) | const |
| time_t ibrcommon::File::lastaccess | ( | ) | const |
| time_t ibrcommon::File::lastmodify | ( | ) | const |
Get the timestamp of the last modification
Definition at line 240 of file File.cpp.
References getPath().
Referenced by dtn::security::SecurityKeyManager::get().

| time_t ibrcommon::File::laststatchange | ( | ) | 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 167 of file File.cpp.
References getFiles(), getPath(), isDirectory(), and isSystem().
Referenced by dtn::core::SQLiteBundleStorage::clear(), main(), dtn::core::DataStorage::run(), dtn::security::SecurityKeyManager::store(), and ibrcommon::TmpFileBLOB::~TmpFileBLOB().

| size_t ibrcommon::File::size | ( | ) | const |
Get the size of the file.
Definition at line 226 of file File.cpp.
References getPath().
Referenced by ibrcommon::TmpFileBLOB::__get_size(), and ibrcommon::FileBLOB::__get_size().

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