move 'systemCheck' to toplevel directory
[platform/upstream/libzypp.git] / zypp / ui / PatternContentsImpl.cc
1 /*---------------------------------------------------------------------\
2  |                          ____ _   __ __ ___                          |
3  |                         |__  / \ / / . \ . \                         |
4  |                           / / \ V /|  _/  _/                         |
5  |                          / /__ | | | | | |                           |
6  |                         /_____||_| |_| |_|                           |
7  |                                                                      |
8  \---------------------------------------------------------------------*/
9 /** \file       zypp/ui/PatternContentsImpl.cc
10  *
11 */
12
13 #include <iostream>
14 #include "zypp/base/LogTools.h"
15
16 #include "zypp/ui/PatternContentsImpl.h"
17 #include "zypp/ui/PatternExpander.h"
18
19 #include "zypp/ZYppFactory.h"
20 #include "zypp/ResPool.h"
21
22 using std::endl;
23
24 ///////////////////////////////////////////////////////////////////
25 namespace zypp
26 { /////////////////////////////////////////////////////////////////
27   ///////////////////////////////////////////////////////////////////
28   namespace ui
29   { /////////////////////////////////////////////////////////////////
30
31     ///////////////////////////////////////////////////////////////////
32     namespace
33     { /////////////////////////////////////////////////////////////////
34
35       struct CollectInstallPackages
36       {
37         CollectInstallPackages( std::set<std::string> & result )
38         : _result( &result )
39         {}
40
41         void operator()( const Pattern::constPtr & pattern )
42         {
43 #warning NEEDS FIX
44 //          std::set<std::string> s( pattern->install_packages() );
45           std::set<std::string> s;
46           _result->insert( s.begin(), s.end() );
47         }
48
49         std::set<std::string> * _result;
50       };
51
52       /////////////////////////////////////////////////////////////////
53     } // namespace
54     ///////////////////////////////////////////////////////////////////
55
56     PatternContents::Impl::Impl( const Pattern::constPtr & pattern )
57     : _pattern( pattern )
58     {}
59
60     std::set<std::string> PatternContents::Impl::install_packages() const
61     {
62       PatternExpander expander( getZYpp()->pool() );
63
64       if ( ! expander.expand( _pattern ) )
65         return std::set<std::string>(); // empty pattern set
66
67       std::set<std::string> result;
68       for_each( expander.begin(),
69                 expander.end(),
70                 CollectInstallPackages( result ) );
71       return result;
72     }
73
74     /////////////////////////////////////////////////////////////////
75   } // namespace ui
76   ///////////////////////////////////////////////////////////////////
77   /////////////////////////////////////////////////////////////////
78 } // namespace zypp
79 ///////////////////////////////////////////////////////////////////