backup
[platform/upstream/libzypp.git] / devel / devel.ma / Parse.cc
1 #include <iostream>
2 #include <list>
3 #include <vector>
4 #include <string>
5 #include <iterator>
6
7 #include <zypp/base/Logger.h>
8 #include <zypp/base/Exception.h>
9 #include <zypp/base/String.h>
10 #include <zypp/base/PtrTypes.h>
11
12 #include <zypp/source/susetags/PackagesParser.h>
13
14 using std::endl;
15
16 ///////////////////////////////////////////////////////////////////
17 namespace zypp
18 { /////////////////////////////////////////////////////////////////
19   ////////////////////////////////////////////////////////////////////////////
20   //
21   //  Just for the stats
22   //
23   ////////////////////////////////////////////////////////////////////////////
24   struct Measure
25   {
26     time_t _begin;
27     Measure()
28     : _begin( time(NULL) )
29     {
30       USR << "START MEASURE..." << endl;
31     }
32     ~Measure()
33     {
34       USR << "DURATION: " << (time(NULL)-_begin) << " sec." << endl;
35     }
36   };
37   ////////////////////////////////////////////////////////////////////////////
38   ///////////////////////////////////////////////////////////////////
39   namespace parser
40   { /////////////////////////////////////////////////////////////////
41     ///////////////////////////////////////////////////////////////////
42     namespace tagfile
43     { /////////////////////////////////////////////////////////////////
44
45
46
47
48
49       /////////////////////////////////////////////////////////////////
50     } // namespace tagfile
51     ///////////////////////////////////////////////////////////////////
52     /////////////////////////////////////////////////////////////////
53   } // namespace parser
54   ///////////////////////////////////////////////////////////////////
55   /////////////////////////////////////////////////////////////////
56 } // namespace zypp
57 ///////////////////////////////////////////////////////////////////
58 ////////////////////////////////////////////////////////////////////////////
59 //
60 //  Types
61 //
62 ////////////////////////////////////////////////////////////////////////////
63
64 using namespace zypp;
65 using namespace std;
66
67 ////////////////////////////////////////////////////////////////////////////
68 //
69 //  Main
70 //
71 ////////////////////////////////////////////////////////////////////////////
72 int main( int argc, char* argv[] )
73 {
74   INT << "===[START]==========================================" << endl;
75   string infile( "p" );
76   if (argc >= 2 )
77     infile = argv[1];
78
79   try
80     {
81       std::list<Package::Ptr> result( source::susetags::parsePackages( infile ) );
82       SEC << result.size() << endl;
83     }
84   catch( Exception & excpt )
85     {
86       ZYPP_RETHROW( excpt );
87     }
88
89   INT << "===[END]============================================" << endl;
90   return 0;
91 }