libzypp 8.13.6
|
Save and restore soft locks. More...
#include <SoftLocksFile.h>
Public Types | |
typedef std::tr1::unordered_set < IdString > | Data |
Public Member Functions | |
SoftLocksFile (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 SoftLocksFile &obj) |
Save and restore soft locks.
Definition at line 35 of file SoftLocksFile.h.
typedef std::tr1::unordered_set<IdString> zypp::target::SoftLocksFile::Data |
Definition at line 39 of file SoftLocksFile.h.
zypp::target::SoftLocksFile::SoftLocksFile | ( | const Pathname & | file_r | ) | [inline] |
Ctor taking the file to read/write.
Definition at line 43 of file SoftLocksFile.h.
const Pathname& zypp::target::SoftLocksFile::file | ( | ) | const [inline] |
Return the file path.
Definition at line 48 of file SoftLocksFile.h.
References _file.
Referenced by zypp::target::operator<<().
const Data& zypp::target::SoftLocksFile::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 55 of file SoftLocksFile.h.
References _dataPtr, _file, and load().
Referenced by zypp::target::TargetImpl::load(), and zypp::target::operator<<().
void zypp::target::SoftLocksFile::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 71 of file SoftLocksFile.h.
References _dataPtr, _file, differs(), and store().
Referenced by zypp::target::TargetImpl::commit().
bool zypp::target::SoftLocksFile::differs | ( | const Data & | lhs, |
const Data & | rhs | ||
) | const [inline, private] |
Helper testing whether two Data differ.
Definition at line 85 of file SoftLocksFile.h.
References for_.
Referenced by setData().
void zypp::target::SoftLocksFile::load | ( | const Pathname & | file_r, |
Data & | data_r | ||
) | [static, private] |
Read Data from file_r
.
Definition at line 34 of file SoftLocksFile.cc.
References MIL, zypp::iostr::EachLine::next(), zypp::str::trim(), and WAR.
Referenced by data().
void zypp::target::SoftLocksFile::store | ( | const Pathname & | file_r, |
const Data & | data_r | ||
) | [static, private] |
Write Data to file_r
.
Definition at line 54 of file SoftLocksFile.cc.
References zypp::filesystem::chmod(), zypp::dumpRange(), ERR, zypp::filesystem::TmpFile::makeSibling(), MIL, zypp::Date::now(), zypp::filesystem::TmpPath::path(), and zypp::filesystem::rename().
Referenced by setData().
std::ostream & operator<< | ( | std::ostream & | str, |
const SoftLocksFile & | obj | ||
) | [friend] |
Stream output
Definition at line 80 of file SoftLocksFile.cc.
Pathname zypp::target::SoftLocksFile::_file [private] |
Definition at line 103 of file SoftLocksFile.h.
scoped_ptr<Data> zypp::target::SoftLocksFile::_dataPtr [mutable, private] |
Definition at line 104 of file SoftLocksFile.h.
Referenced by data(), zypp::target::operator<<(), and setData().