16#include <zypp-core/base/InputStream>
17#include <zypp/base/IOStream.h>
18#include <zypp/base/Logger.h>
19#include <zypp-core/parser/ParseException>
72 WAR <<
"Ignore invalid history log entry on line #" <<
lineNr_r <<
" '"<<
line_r <<
"'" << endl;
91 WAR <<
"Ignore invalid history log entry on line #" <<
lineNr_r <<
" '"<<
line_r <<
"'" << endl;
96 ERR <<
"Invalid history log entry on line #" <<
lineNr_r <<
" '"<<
line_r <<
"'" << endl;
106 WAR <<
"Stop parsing requested by consumer callback on line #" <<
lineNr_r << endl;
124 if ( (*
line)[0] ==
'#' )
127 if ( ! parseLine( *
line,
line.lineNo() ) )
146 const std::string &
s = *
line;
154 if ( ! parseLine(
s,
line.lineNo() ) )
163 if ( ! parseLine(
s,
line.lineNo() ) )
184 const std::string &
s = *
line;
202 if ( ! parseLine(
s,
line.lineNo() ) )
#define HISTORY_LOG_DATE_FORMAT
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Store and operate on date (time_t).
Base class for Exception.
static Ptr create(FieldVector &fields_r)
Factory method creating HistoryLogData classes.
std::vector< std::string > FieldVector
shared_ptr< HistoryLogData > Ptr
Maintain [min,max] and counter (value) for progress counting.
bool tick()
Leave counter value unchanged (still alive).
void sendTo(const ReceiverFnc &fnc_r)
Set ReceiverFnc.
bool toMax()
Set counter value to current max value (unless no range).
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
bool toMin()
Set counter value to current min value.
Simple lineparser: Traverse each line in a file.
Zypp history file parser.
@ IGNORE_INVALID_ITEMS
ignore invalid items and continue parsing
void setIgnoreInvalidItems(bool ignoreInvalid=false)
Set the reader to ignore invalid log entries and continue with the rest.
void readFrom(const Date &date, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Read log from specified date.
function< bool(const HistoryLogData::Ptr &)> ProcessData
Callback type to consume a single history line split into fields.
void addActionFilter(const HistoryActionID &action_r)
Process only specific HistoryActionIDs.
bool ignoreInvalidItems() const
Whether the reader is set to ignore invalid log entries.
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
void readAll(const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Read the whole log file.
HistoryLogReader(Pathname historyFile_r, zypp::parser::HistoryLogReader::Options options_r, ProcessData callback_r)
Ctor taking file to parse and data consumer callback.
void readFromTo(const Date &fromDate, const Date &toDate, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Read log between fromDate and toDate.
unsigned splitEscaped(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t", bool withEmpty=false)
Split line_r into words with respect to escape delimeters.
std::string trim(const std::string &s, const Trim trim_r)
Easy-to use interface to the ZYPP dependency resolver.
Enumeration of known history actions.
static const HistoryActionID NONE
std::set< std::string > _actionfilter
void addActionFilter(const HistoryActionID &action_r)
Impl(Pathname &&historyFile_r, Options &&options_r, ProcessData &&callback_r)
void readFromTo(const Date &fromDate_r, const Date &toDate_r, const ProgressData::ReceiverFnc &progress_r)
bool parseLine(const std::string &line_r, unsigned int lineNr_r)
void readFrom(const Date &date_r, const ProgressData::ReceiverFnc &progress_r)
void readAll(const ProgressData::ReceiverFnc &progress_r)
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.