projects
/
platform
/
upstream
/
libzypp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d3c4ddd
)
backup
author
Ján Kupec
<jkupec@suse.cz>
Wed, 28 Jan 2009 13:36:39 +0000
(14:36 +0100)
committer
Ján Kupec
<jkupec@suse.cz>
Wed, 28 Jan 2009 13:36:39 +0000
(14:36 +0100)
devel/devel.jkupec/play.cc
patch
|
blob
|
history
diff --git
a/devel/devel.jkupec/play.cc
b/devel/devel.jkupec/play.cc
index
4852540
..
5133d74
100644
(file)
--- a/
devel/devel.jkupec/play.cc
+++ b/
devel/devel.jkupec/play.cc
@@
-1,6
+1,7
@@
#include <iostream>
#include "zypp/base/LogTools.h"
#include <iostream>
#include "zypp/base/LogTools.h"
+#include "zypp/ZYppCallbacks.h"
#include "zypp/parser/HistoryLogReader.h"
#include "zypp/parser/ParseException.h"
#include "zypp/parser/HistoryLogReader.h"
#include "zypp/parser/ParseException.h"
@@
-9,14
+10,20
@@
using std::endl;
using std::cout;
using namespace zypp;
using std::cout;
using namespace zypp;
+bool progress_function(const ProgressData & p)
+{
+ cout << ".";
+ return true;
+}
+
struct HistoryItemCollector
{
struct HistoryItemCollector
{
-
//
vector<HistoryItem::Ptr> items;
+
std::
vector<HistoryItem::Ptr> items;
bool operator()( const HistoryItem::Ptr & item_ptr )
{
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;
}
};
return true;
}
};
@@
-28,18
+35,22
@@
int main( int argc, const char * argv[] )
--argc; ++argv; // skip arg 0
HistoryItemCollector ic;
--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
{
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;
}
}
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;
}
return 0;
}