libzypp
13.10.6
|
Zypp history file parserReads a zypp history log file and calls the ProcessData callback passed in the constructor for each valid history line read. More...
#include <HistoryLogReader.h>
Classes | |
struct | Impl |
Public Types | |
enum | OptionBits { IGNORE_INVALID_ITEMS = (1 << 0) } |
< Parser option flags More... | |
typedef function< bool(const HistoryLogData::Ptr &)> | ProcessData |
Callback type to consume a single history line split into fields. More... | |
Public Member Functions | |
ZYPP_DECLARE_FLAGS (Options, OptionBits) | |
HistoryLogReader (const Pathname &historyFile_r, const Options &options_r, const ProcessData &callback_r) | |
Ctor taking file to parse and data consumer callback. More... | |
~HistoryLogReader () | |
void | readAll (const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc()) |
Read the whole log file. More... | |
void | readFrom (const Date &date, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc()) |
Read log from specified date. More... | |
void | readFromTo (const Date &fromDate, const Date &toDate, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc()) |
Read log between fromDate and toDate. More... | |
void | setIgnoreInvalidItems (bool ignoreInvalid=false) |
Set the reader to ignore invalid log entries and continue with the rest. More... | |
bool | ignoreInvalidItems () const |
Whether the reader is set to ignore invalid log entries. More... | |
Private Attributes | |
RW_pointer< Impl, rw_pointer::Scoped< Impl > > | _pimpl |
Zypp history file parser
Reads a zypp history log file and calls the ProcessData callback passed in the constructor for each valid history line read.
The callbacks return value indicates whether to continue parsing.
Definition at line 66 of file HistoryLogReader.h.
typedef function< bool( const HistoryLogData::Ptr & )> zypp::parser::HistoryLogReader::ProcessData |
Callback type to consume a single history line split into fields.
The return value indicates whether to continue parsing.
Definition at line 80 of file HistoryLogReader.h.
< Parser option flags
Enumerator | |
---|---|
IGNORE_INVALID_ITEMS |
ignore invalid items and continue parsing |
Definition at line 70 of file HistoryLogReader.h.
zypp::parser::HistoryLogReader::HistoryLogReader | ( | const Pathname & | historyFile_r, |
const Options & | options_r, | ||
const ProcessData & | callback_r | ||
) |
Ctor taking file to parse and data consumer callback.
As options_r argument pass HistoryLogReader::Options()
to use the default stettings, or an OR'ed combination of OptionBits.
Definition at line 199 of file HistoryLogReader.cc.
zypp::parser::HistoryLogReader::~HistoryLogReader | ( | ) |
Definition at line 203 of file HistoryLogReader.cc.
zypp::parser::HistoryLogReader::ZYPP_DECLARE_FLAGS | ( | Options | , |
OptionBits | |||
) |
void zypp::parser::HistoryLogReader::readAll | ( | const ProgressData::ReceiverFnc & | progress = ProgressData::ReceiverFnc() | ) |
Read the whole log file.
progress | An optional progress data receiver function. |
Definition at line 212 of file HistoryLogReader.cc.
void zypp::parser::HistoryLogReader::readFrom | ( | const Date & | date, |
const ProgressData::ReceiverFnc & | progress = ProgressData::ReceiverFnc() |
||
) |
Read log from specified date.
date | Date from which to read. |
progress | An optional progress data receiver function. |
Definition at line 215 of file HistoryLogReader.cc.
void zypp::parser::HistoryLogReader::readFromTo | ( | const Date & | fromDate, |
const Date & | toDate, | ||
const ProgressData::ReceiverFnc & | progress = ProgressData::ReceiverFnc() |
||
) |
Read log between fromDate and toDate.
The date comparison's precision goes to seconds. Omitted time parts get replaced by zeroes, so if e.g. the time is not specified at all, the date means midnight of the specified date. So
fromDate = Date("2009-01-01", "%Y-%m-%d"); toDate = Date("2009-01-02", "%Y-%m-%d");
will yield log entries from midnight of January, 1st untill one second before midnight of January, 2nd.
fromDate | Date from which to read. |
toDate | Date on which to stop reading. |
progress | An optional progress data receiver function. |
Definition at line 218 of file HistoryLogReader.cc.
void zypp::parser::HistoryLogReader::setIgnoreInvalidItems | ( | bool | ignoreInvalid = false | ) |
Set the reader to ignore invalid log entries and continue with the rest.
ignoreInvalid | true will cause the reader to ignore invalid entries |
Definition at line 206 of file HistoryLogReader.cc.
bool zypp::parser::HistoryLogReader::ignoreInvalidItems | ( | ) | const |
Whether the reader is set to ignore invalid log entries.
Definition at line 209 of file HistoryLogReader.cc.
|
private |
Definition at line 144 of file HistoryLogReader.h.