- move the callback from constructor to query()
[platform/upstream/libzypp.git] / devel / devel.dmacvicar / testbed.cc
1 #include <sys/time.h>
2
3 #include <iostream>
4 #include <fstream>
5
6 #include <zypp/base/Logger.h>
7 #include <zypp/ZYpp.h>
8 #include <zypp/ZYppFactory.h>
9
10 #include "zypp/Product.h"
11 #include "zypp/Package.h"
12
13 #include "zypp/TmpPath.h"
14 #include "zypp/ProgressData.h"
15 #include "zypp/parser/yum/RepoParser.h"
16 #include "zypp/repo/yum/Downloader.h"
17
18 #include "zypp/sat/Pool.h"
19
20 #include "zypp/PoolQuery.h"
21
22 using namespace std;
23 using namespace zypp;
24 using namespace zypp::repo;
25
26 bool result_cb( const ResObject::Ptr &r )
27 {
28   cout << r << endl;
29 }
30
31 int main(int argc, char **argv)
32 {
33     try
34     {
35       ZYpp::Ptr z = getZYpp();
36     
37       //z->initializeTarget("/");
38       //z->target()->load();
39
40       sat::Pool::instance().addRepoSolv("./foo.solv");
41
42 //       for ( ResPool::const_iterator it = z->pool().begin(); it != z->pool().end(); ++it )
43 //       {
44 //         ResObject::constPtr res = it->resolvable();
45 //         if ( res->name() == "kde4-kcolorchooser")
46 //         {
47 //           cout << res << endl;
48 //           cout << res->summary() << " | " << res->size() << endl;
49 //         }
50 //       }
51
52       PoolQuery query();
53       query.execute("kde", &result_cb);
54       
55
56     }
57     catch ( const Exception &e )
58     {
59       ZYPP_CAUGHT(e);
60       cout << e.msg() << endl;
61     }
62     
63     return 0;
64 }
65
66
67