#include <FileSystemStorage.h>
Inheritance diagram for OpenDDS::FileSystemStorage::File:
Public Types | |
typedef RcHandle< File > | Ptr |
Public Member Functions | |
bool | write (std::ofstream &stream) |
bool | read (std::ifstream &stream) |
bool | remove () |
OPENDDS_STRING | name () const |
Directory::Ptr | parent () const |
Private Member Functions | |
File (const ACE_TString &fname_phys, const ACE_TString &logical, Directory *parent) | |
Private Attributes | |
ACE_TString | physical_file_ |
ACE_TString | physical_dir_ |
ACE_TString | logical_relative_ |
Directory::Ptr | parent_ |
Friends | |
class | Directory |
class | Directory::Iterator |
Definition at line 217 of file FileSystemStorage.h.
Definition at line 219 of file FileSystemStorage.h.
OpenDDS::FileSystemStorage::File::File | ( | const ACE_TString & | fname_phys, | |
const ACE_TString & | logical, | |||
Directory * | parent | |||
) | [private] |
Definition at line 457 of file FileSystemStorage.cpp.
References physical_dir_, and physical_file_.
00459 : physical_file_() 00460 , physical_dir_() 00461 , logical_relative_(logical) 00462 , parent_(parent, false) 00463 { 00464 String_Index_t last_slash = fname_phys.rfind(ACE_TEXT('/')); 00465 00466 if (last_slash == ACE_TString::npos) { 00467 physical_file_ = fname_phys; 00468 physical_dir_ = ACE_TEXT("."); 00469 00470 } else { 00471 physical_file_ = fname_phys.c_str() + last_slash + 1; 00472 physical_dir_.set(fname_phys.c_str(), last_slash, true); 00473 } 00474 }
OPENDDS_STRING OpenDDS::FileSystemStorage::File::name | ( | ) | const |
Definition at line 508 of file FileSystemStorage.cpp.
References logical_relative_.
00509 { 00510 return ACE_TEXT_ALWAYS_CHAR(logical_relative_.c_str()); 00511 }
Directory::Ptr OpenDDS::FileSystemStorage::File::parent | ( | ) | const [inline] |
bool OpenDDS::FileSystemStorage::File::read | ( | std::ifstream & | stream | ) |
Definition at line 484 of file FileSystemStorage.cpp.
References physical_dir_, and physical_file_.
00485 { 00486 CwdGuard cg(physical_dir_); 00487 stream.open(ACE_TEXT_ALWAYS_CHAR(physical_file_.c_str()), 00488 ios::binary | ios::in); 00489 return !stream.bad() && !stream.fail(); 00490 }
bool OpenDDS::FileSystemStorage::File::remove | ( | ) |
Definition at line 492 of file FileSystemStorage.cpp.
References logical_relative_, parent_, physical_dir_, and physical_file_.
00493 { 00494 int unlink_result = -1; 00495 { 00496 CwdGuard cg(physical_dir_); 00497 unlink_result = ACE_OS::unlink(physical_file_.c_str()); 00498 } 00499 00500 if (unlink_result != -1) { 00501 parent_->removing(logical_relative_, true); 00502 return true; 00503 } 00504 00505 return false; 00506 }
bool OpenDDS::FileSystemStorage::File::write | ( | std::ofstream & | stream | ) |
Definition at line 476 of file FileSystemStorage.cpp.
References physical_dir_, and physical_file_.
00477 { 00478 CwdGuard cg(physical_dir_); 00479 stream.open(ACE_TEXT_ALWAYS_CHAR(physical_file_.c_str()), 00480 ios::binary | ios::out); 00481 return !stream.bad() && !stream.fail(); 00482 }
friend class Directory [friend] |
Definition at line 230 of file FileSystemStorage.h.
friend class Directory::Iterator [friend] |
Definition at line 231 of file FileSystemStorage.h.
ACE_TString OpenDDS::FileSystemStorage::File::logical_relative_ [private] |
ACE_TString OpenDDS::FileSystemStorage::File::physical_dir_ [private] |
ACE_TString OpenDDS::FileSystemStorage::File::physical_file_ [private] |