4852540a5ceeba85bdf40f867693d5028047290f
[platform/upstream/libzypp.git] / devel / devel.jkupec / play.cc
1 #include <iostream>
2
3 #include "zypp/base/LogTools.h"
4
5 #include "zypp/parser/HistoryLogReader.h"
6 #include "zypp/parser/ParseException.h"
7
8 using std::endl;
9 using std::cout;
10 using namespace zypp;
11
12 struct HistoryItemCollector
13 {
14 //  vector<HistoryItem::Ptr> items;
15
16   bool operator()( const HistoryItem::Ptr & item_ptr )
17   {
18 //    items.insert(item);
19     cout << *item_ptr << endl;
20     return true;
21   }
22 };
23
24 // ---------------------------------------------------------------------------
25
26 int main( int argc, const char * argv[] )
27 {
28   --argc; ++argv; // skip arg 0
29
30   HistoryItemCollector ic;
31   parser::HistoryLogReader reader(*argv, ic);
32
33   try
34   {
35     reader.readAll();
36   }
37   catch (const parser::ParseException & e)
38   {
39     cout << "error in " << *argv << ":" << endl;
40     cout << e.asUserHistory() << endl;
41   }
42
43   cout << "done" << endl;
44   return 0;
45 }