#include <HardLocksFile.h>
Public Types | |
typedef pool::PoolTraits::HardLockQueries | Data |
Public Member Functions | |
HardLocksFile (const Pathname &file_r) | |
Ctor taking the file to read/write. | |
const Pathname & | file () const |
Return the file path. | |
const Data & | data () const |
Return the data. | |
void | setData (const Data &data_r) |
Store new Data. | |
Private Member Functions | |
bool | differs (const Data &lhs, const Data &rhs) const |
Helper testing whether two Data differ. | |
Static Private Member Functions | |
static void | load (const Pathname &file_r, Data &data_r) |
Read Data from file_r . | |
static void | store (const Pathname &file_r, const Data &data_r) |
Write Data to file_r . | |
Private Attributes | |
Pathname | _file |
scoped_ptr< Data > | _dataPtr |
Friends | |
std::ostream & | operator<< (std::ostream &str, const HardLocksFile &obj) |
Definition at line 36 of file HardLocksFile.h.
Definition at line 41 of file HardLocksFile.h.
zypp::target::HardLocksFile::HardLocksFile | ( | const Pathname & | file_r | ) | [inline] |
const Pathname& zypp::target::HardLocksFile::file | ( | ) | const [inline] |
Return the file path.
Definition at line 50 of file HardLocksFile.h.
References _file.
Referenced by zypp::target::operator<<().
const Data& zypp::target::HardLocksFile::data | ( | ) | const [inline] |
Return the data.
The file is read once on demand. Returns empty Data if the file does not exist or is not readable.
Definition at line 57 of file HardLocksFile.h.
References _dataPtr, _file, and load().
Referenced by zypp::target::TargetImpl::load(), and zypp::target::operator<<().
void zypp::target::HardLocksFile::setData | ( | const Data & | data_r | ) | [inline] |
Store new Data.
Write the new Data to file, unless we know it did not change. The directory containing file must exist.
Definition at line 73 of file HardLocksFile.h.
References _dataPtr, _file, differs(), and store().
Referenced by zypp::target::TargetImpl::commit().
bool zypp::target::HardLocksFile::differs | ( | const Data & | lhs, | |
const Data & | rhs | |||
) | const [inline, private] |
Helper testing whether two Data differ.
Definition at line 87 of file HardLocksFile.h.
References for_.
Referenced by setData().
void zypp::target::HardLocksFile::load | ( | const Pathname & | file_r, | |
Data & | data_r | |||
) | [static, private] |
Read Data from file_r
.
Definition at line 35 of file HardLocksFile.cc.
References MIL, zypp::readPoolQueriesFromFile(), and WAR.
Referenced by data().
void zypp::target::HardLocksFile::store | ( | const Pathname & | file_r, | |
const Data & | data_r | |||
) | [static, private] |
Write Data to file_r
.
Definition at line 49 of file HardLocksFile.cc.
References zypp::filesystem::chmod(), ERR, zypp::filesystem::TmpFile::makeSibling(), MIL, zypp::filesystem::TmpPath::path(), zypp::filesystem::rename(), and zypp::writePoolQueriesToFile().
Referenced by setData().
std::ostream & operator<< | ( | std::ostream & | str, | |
const HardLocksFile & | obj | |||
) | [friend] |
Stream output
Definition at line 72 of file HardLocksFile.cc.
Pathname zypp::target::HardLocksFile::_file [private] |
scoped_ptr<Data> zypp::target::HardLocksFile::_dataPtr [mutable, private] |
Definition at line 109 of file HardLocksFile.h.
Referenced by data(), zypp::target::operator<<(), and setData().