3 #include "zypp/base/LogTools.h"
4 #include "zypp/ZYppCallbacks.h"
6 #include "zypp/parser/HistoryLogReader.h"
7 #include "zypp/parser/ParseException.h"
13 bool progress_function(const ProgressData & p)
19 struct HistoryItemCollector
21 std::vector<HistoryItem::Ptr> items;
23 bool operator()( const HistoryItem::Ptr & item_ptr )
25 items.push_back(item_ptr);
26 //cout << *item_ptr << endl;
31 // ---------------------------------------------------------------------------
33 int main( int argc, const char * argv[] )
35 --argc; ++argv; // skip arg 0
37 HistoryItemCollector ic;
38 parser::HistoryLogReader reader(*argv, boost::ref(ic));
39 reader.setIgnoreInvalidItems(true);
40 ProgressReportReceiver progress;
44 //reader.readAll(&progress_function);
45 reader.readFromTo(Date("2009-01-01", "%Y-%m-%d"), Date("2009-01-02", "%Y-%m-%d"));
47 catch (const parser::ParseException & e)
49 cout << "error in " << *argv << ":" << endl;
50 cout << e.asUserHistory() << endl;
52 progress.disconnect();
54 cout << "got " << ic.items.size() << endl;