commit fff2dcb58ab85b590c7c3d511532fd5a3e5460e4
Author: Ján Kupec
Date: Wed Jan 28 14:36:39 2009 +0100
backup
---
devel/devel.jkupec/play.cc | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/devel/devel.jkupec/play.cc b/devel/devel.jkupec/play.cc
index 4852540..5133d74 100644
--- a/devel/devel.jkupec/play.cc
+++ b/devel/devel.jkupec/play.cc
@@ -1,6 +1,7 @@
#include <iostream>
#include "zypp/base/LogTools.h"
+#include "zypp/ZYppCallbacks.h"
#include "zypp/parser/HistoryLogReader.h"
#include "zypp/parser/ParseException.h"
@@ -9,14 +10,20 @@ using std::endl;
using std::cout;
using namespace zypp;
+bool progress_function(const ProgressData & p)
+{
+ cout << ".";
+ return true;
+}
+
struct HistoryItemCollector
{
-// vectorHistoryItem::Ptr items;
+ std::vectorHistoryItem::Ptr items;
bool operator()( const HistoryItem::Ptr & item_ptr )
{
-// items.insert(item);
- cout << *item_ptr << endl;
+ items.push_back(item_ptr);
+ //cout << *item_ptr << endl;
return true;
}
};
@@ -28,18 +35,22 @@ int main( int argc, const char * argv[] )
--argc; ++argv; // skip arg 0
HistoryItemCollector ic;
- parser::HistoryLogReader reader(*argv, ic);
-
+ parser::HistoryLogReader reader(*argv, boost::ref(ic));
+ reader.setIgnoreInvalidItems(true);
+ ProgressReportReceiver progress;
+ progress.connect();
try
{
- reader.readAll();
+ //reader.readAll(&progress_function);
+ reader.readFromTo(Date("2009-01-01", "%Y-%m-%d"), Date("2009-01-02", "%Y-%m-%d"));
}
catch (const parser::ParseException & e)
{
cout << "error in " << *argv << ":" << endl;
cout << e.asUserHistory() << endl;
}
+ progress.disconnect();
- cout << "done" << endl;
+ cout << "got " << ic.items.size() << endl;
return 0;
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org