#include <RequestedLocalesFile.h>
Public Member Functions | |
RequestedLocalesFile (const Pathname &file_r) | |
Ctor taking the file to read/write. | |
const Pathname & | file () const |
Return the file path. | |
const LocaleSet & | locales () const |
Return the loacale set. | |
void | setLocales (const LocaleSet &locales_r) |
Store a new locale set. | |
Private Member Functions | |
bool | differs (const LocaleSet &lhs, const LocaleSet &rhs) const |
Helper testing whether two LocaleSet differ. | |
Static Private Member Functions | |
static void | load (const Pathname &file_r, LocaleSet &locales_r) |
Read LocaleSet from file_r . | |
static void | store (const Pathname &file_r, const LocaleSet &locales_r) |
Write LocaleSet to file_r . | |
Private Attributes | |
Pathname | _file |
scoped_ptr< LocaleSet > | _localesPtr |
Friends | |
std::ostream & | operator<< (std::ostream &str, const RequestedLocalesFile &obj) |
Definition at line 35 of file RequestedLocalesFile.h.
zypp::target::RequestedLocalesFile::RequestedLocalesFile | ( | const Pathname & | file_r | ) | [inline] |
const Pathname& zypp::target::RequestedLocalesFile::file | ( | ) | const [inline] |
Return the file path.
Definition at line 46 of file RequestedLocalesFile.h.
References _file.
Referenced by zypp::target::operator<<().
const LocaleSet& zypp::target::RequestedLocalesFile::locales | ( | ) | const [inline] |
Return the loacale set.
The file is read once on demand. returns an empty set if the file does not exist or is not readable.
Definition at line 53 of file RequestedLocalesFile.h.
References _file, _localesPtr, and load().
Referenced by zypp::target::TargetImpl::load(), and zypp::target::operator<<().
void zypp::target::RequestedLocalesFile::setLocales | ( | const LocaleSet & | locales_r | ) | [inline] |
Store a new locale set.
Write the new localeset to file, unless we know it did not change. The directory containing file must exist.
Definition at line 68 of file RequestedLocalesFile.h.
References _file, _localesPtr, differs(), and store().
Referenced by zypp::target::TargetImpl::commit().
bool zypp::target::RequestedLocalesFile::differs | ( | const LocaleSet & | lhs, | |
const LocaleSet & | rhs | |||
) | const [inline, private] |
Helper testing whether two LocaleSet differ.
Definition at line 82 of file RequestedLocalesFile.h.
References for_.
Referenced by setLocales().
void zypp::target::RequestedLocalesFile::load | ( | const Pathname & | file_r, | |
LocaleSet & | locales_r | |||
) | [static, private] |
Read LocaleSet from file_r
.
Definition at line 34 of file RequestedLocalesFile.cc.
References MIL, zypp::str::trim(), and WAR.
Referenced by locales().
void zypp::target::RequestedLocalesFile::store | ( | const Pathname & | file_r, | |
const LocaleSet & | locales_r | |||
) | [static, private] |
Write LocaleSet to file_r
.
Definition at line 54 of file RequestedLocalesFile.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 setLocales().
std::ostream & operator<< | ( | std::ostream & | str, | |
const RequestedLocalesFile & | obj | |||
) | [friend] |
Stream output
Definition at line 80 of file RequestedLocalesFile.cc.
Pathname zypp::target::RequestedLocalesFile::_file [private] |
Definition at line 99 of file RequestedLocalesFile.h.
Referenced by file(), locales(), and setLocales().
scoped_ptr<LocaleSet> zypp::target::RequestedLocalesFile::_localesPtr [mutable, private] |
Definition at line 100 of file RequestedLocalesFile.h.
Referenced by locales(), zypp::target::operator<<(), and setLocales().