libzypp 17.37.17
HistoryLogReader.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9
13#ifndef ZYPP_PARSER_HISTORYLOGREADER_H_
14#define ZYPP_PARSER_HISTORYLOGREADER_H_
15
16#include <zypp/base/PtrTypes.h>
17#include <zypp/base/Flags.h>
18#include <zypp-core/ui/ProgressData>
19#include <zypp/Pathname.h>
20
21#include <zypp/HistoryLogData.h>
22
24namespace zypp
25{
26
27 class Date;
28
30 namespace parser
31 {
32
67 {
68 public:
69
71 {
73 };
75
76 public:
80 using ProcessData = function<bool (const HistoryLogData::Ptr &)>;
81
86 HistoryLogReader(Pathname historyFile_r, zypp::parser::HistoryLogReader::Options options_r, ProcessData callback_r );
87
89
96
105 void readFrom( const Date & date, const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
106
126 void readFromTo( const Date & fromDate, const Date & toDate, const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
127
133 void setIgnoreInvalidItems( bool ignoreInvalid = false );
134
140 bool ignoreInvalidItems() const;
141
142
148 void addActionFilter( const HistoryActionID & action_r );
149
152 { addActionFilter( HistoryActionID::NONE ); }
153
154 private:
156 struct Impl;
158 };
159
161 ZYPP_DECLARE_OPERATORS_FOR_FLAGS( HistoryLogReader::Options );
162
164
165 } // namespace parser
167} // namespace zypp
169
170#endif /* ZYPP_PARSER_HISTORYLOGREADER_H_ */
Store and operate on date (time_t).
Definition Date.h:33
shared_ptr< HistoryLogData > Ptr
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
void clearActionFilter()
Clear any HistoryActionIDs.
OptionBits
< Parser option flags
@ 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.
ZYPP_DECLARE_FLAGS(Options, OptionBits)
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.
Easy-to use interface to the ZYPP dependency resolver.
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
Enumeration of known history actions.
Wrapper for const correct access via Smart pointer types.
Definition PtrTypes.h:293
#define ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Name)
Definition Flags.h:177