libzypp 9.41.1
|
00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00009 00013 #ifndef ZYPP_PARSER_HISTORYLOGREADER_H_ 00014 #define ZYPP_PARSER_HISTORYLOGREADER_H_ 00015 00016 #include "zypp/base/PtrTypes.h" 00017 #include "zypp/base/Flags.h" 00018 #include "zypp/ProgressData.h" 00019 #include "zypp/Pathname.h" 00020 00021 #include "zypp/HistoryLogData.h" 00022 00023 #if defined(WITH_DEPRECATED_HISTORYITEM_API) 00024 #warning Support for HistoryItem based parsing will be removed in the future. 00025 #warning Switch to the new HistoryLogData based HistoryLogReader API. 00026 #endif // WITH_DEPRECATED_HISTORYITEM_API 00027 00029 namespace zypp 00030 { 00031 00032 class Date; 00033 00035 namespace parser 00036 { 00037 00070 #if defined(WITH_DEPRECATED_HISTORYITEM_API) 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 #endif // WITH_DEPRECATED_HISTORYITEM_API 00084 00085 class HistoryLogReader 00086 { 00087 public: 00088 00089 enum OptionBits 00090 { 00091 IGNORE_INVALID_ITEMS = (1 << 0) 00092 }; 00093 ZYPP_DECLARE_FLAGS( Options, OptionBits ); 00094 00095 public: 00099 typedef function< bool( const HistoryLogData::Ptr & )> ProcessData; 00100 00105 HistoryLogReader( const Pathname & historyFile_r, const Options & options_r, const ProcessData & callback_r ); 00106 00107 ~HistoryLogReader(); 00108 00114 void readAll( const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() ); 00115 00124 void readFrom( const Date & date, const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() ); 00125 00145 void readFromTo( const Date & fromDate, const Date & toDate, const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() ); 00146 00152 void setIgnoreInvalidItems( bool ignoreInvalid = false ); 00153 00159 bool ignoreInvalidItems() const; 00160 00161 private: 00163 class Impl; 00164 RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl; 00165 00166 #if defined(WITH_DEPRECATED_HISTORYITEM_API) 00167 public: 00169 typedef function< bool( const HistoryItem::Ptr & )> ProcessItem; 00174 HistoryLogReader( const Pathname & repo_file, const ProcessItem & callback ) ZYPP_DEPRECATED; 00175 #endif // WITH_DEPRECATED_HISTORYITEM_API 00176 }; 00177 00179 ZYPP_DECLARE_OPERATORS_FOR_FLAGS( HistoryLogReader::Options ); 00180 00182 00183 } // namespace parser 00185 } // namespace zypp 00187 00188 #endif /* ZYPP_PARSER_HISTORYLOGREADER_H_ */