libzypp  17.25.0
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/ProgressData.h>
19 #include <zypp/Pathname.h>
20 
21 #include <zypp/HistoryLogData.h>
22 
24 namespace zypp
25 {
26 
27  class Date;
28 
30  namespace parser
31  {
32 
67  {
68  public:
69 
70  enum OptionBits
71  {
73  };
74  ZYPP_DECLARE_FLAGS( Options, OptionBits );
75 
76  public:
80  typedef function< bool( const HistoryLogData::Ptr & )> ProcessData;
81 
86  HistoryLogReader( const Pathname & historyFile_r, const Options & options_r, const ProcessData & callback_r );
87 
89 
95  void readAll( const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
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 
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_ */
zypp::parser::HistoryLogReader::readFromTo
void readFromTo(const Date &fromDate, const Date &toDate, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Read log between fromDate and toDate.
Definition: HistoryLogReader.cc:234
zypp::parser::HistoryLogReader::Impl
Definition: HistoryLogReader.cc:36
PtrTypes.h
zypp::parser::HistoryLogReader::ignoreInvalidItems
bool ignoreInvalidItems() const
Whether the reader is set to ignore invalid log entries.
Definition: HistoryLogReader.cc:225
Pathname.h
HistoryLogData.h
bool
zypp::HistoryActionID::NONE
static const HistoryActionID NONE
Definition: HistoryLogData.h:39
zypp::parser::HistoryLogReader
Zypp history file parser.
Definition: HistoryLogReader.h:66
zypp::RW_pointer
Wrapper for const correct access via Smart pointer types.
Definition: PtrTypes.h:285
zypp::parser::HistoryLogReader::readFrom
void readFrom(const Date &date, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Read log from specified date.
Definition: HistoryLogReader.cc:231
zypp::ZYPP_DECLARE_OPERATORS_FOR_FLAGS
ZYPP_DECLARE_OPERATORS_FOR_FLAGS(DiskUsageCounter::MountPoint::HintFlags)
zypp::parser::HistoryLogReader::clearActionFilter
void clearActionFilter()
Clear any HistoryActionIDs.
Definition: HistoryLogReader.h:151
zypp::parser::HistoryLogReader::setIgnoreInvalidItems
void setIgnoreInvalidItems(bool ignoreInvalid=false)
Set the reader to ignore invalid log entries and continue with the rest.
Definition: HistoryLogReader.cc:222
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
zypp::parser::HistoryLogReader::ProcessData
function< bool(const HistoryLogData::Ptr &)> ProcessData
Callback type to consume a single history line split into fields.
Definition: HistoryLogReader.h:80
zypp::parser::HistoryLogReader::IGNORE_INVALID_ITEMS
ignore invalid items and continue parsing
Definition: HistoryLogReader.h:72
zypp::parser::HistoryLogReader::_pimpl
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
Definition: HistoryLogReader.h:156
zypp::parser::HistoryLogReader::addActionFilter
void addActionFilter(const HistoryActionID &action_r)
Process only specific HistoryActionIDs.
Definition: HistoryLogReader.cc:237
zypp::ProgressData::ReceiverFnc
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
Definition: ProgressData.h:139
ProgressData.h
zypp::parser::HistoryLogReader::~HistoryLogReader
~HistoryLogReader()
Definition: HistoryLogReader.cc:219
zypp::Date
Store and operate on date (time_t).
Definition: Date.h:32
zypp::parser::HistoryLogReader::ZYPP_DECLARE_FLAGS
ZYPP_DECLARE_FLAGS(Options, OptionBits)
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:44
zypp::parser::HistoryLogReader::readAll
void readAll(const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Read the whole log file.
Definition: HistoryLogReader.cc:228
Flags.h
zypp::parser::HistoryLogReader::OptionBits
OptionBits
< Parser option flags
Definition: HistoryLogReader.h:70
zypp::HistoryActionID
Enumeration of known history actions.
Definition: HistoryLogData.h:37
zypp::parser::HistoryLogReader::HistoryLogReader
HistoryLogReader(const Pathname &historyFile_r, const Options &options_r, const ProcessData &callback_r)
Ctor taking file to parse and data consumer callback.
Definition: HistoryLogReader.cc:215
zypp::HistoryLogData::Ptr
shared_ptr< HistoryLogData > Ptr
Definition: HistoryLogData.h:108