backup
authorJán Kupec <jkupec@suse.cz>
Mon, 26 Jan 2009 09:33:06 +0000 (10:33 +0100)
committerJán Kupec <jkupec@suse.cz>
Mon, 26 Jan 2009 09:33:06 +0000 (10:33 +0100)
devel/devel.jkupec/play.cc

index fb5ea6d..4852540 100644 (file)
@@ -2,9 +2,24 @@
 
 #include "zypp/base/LogTools.h"
 
+#include "zypp/parser/HistoryLogReader.h"
+#include "zypp/parser/ParseException.h"
+
 using std::endl;
 using std::cout;
+using namespace zypp;
+
+struct HistoryItemCollector
+{
+//  vector<HistoryItem::Ptr> items;
 
+  bool operator()( const HistoryItem::Ptr & item_ptr )
+  {
+//    items.insert(item);
+    cout << *item_ptr << endl;
+    return true;
+  }
+};
 
 // ---------------------------------------------------------------------------
 
@@ -12,7 +27,19 @@ int main( int argc, const char * argv[] )
 {
   --argc; ++argv; // skip arg 0
 
+  HistoryItemCollector ic;
+  parser::HistoryLogReader reader(*argv, ic);
+
+  try
+  {
+    reader.readAll();
+  }
+  catch (const parser::ParseException & e)
+  {
+    cout << "error in " << *argv << ":" << endl;
+    cout << e.asUserHistory() << endl;
+  }
+
   cout << "done" << endl;
   return 0;
 }
-