done LookupAttr, added ArrayAttr container to retrieve list attributes.
[platform/upstream/libzypp.git] / zypp / Patch.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Patch.cc
10  *
11 */
12 #include "zypp/Patch.h"
13
14 ///////////////////////////////////////////////////////////////////
15 namespace zypp
16 { /////////////////////////////////////////////////////////////////
17
18   IMPL_PTR_TYPE( Patch );
19
20   ///////////////////////////////////////////////////////////////////
21   //
22   //    METHOD NAME : Patch::Patch
23   //    METHOD TYPE : Ctor
24   //
25   Patch::Patch( const sat::Solvable & solvable_r )
26   : ResObject( solvable_r )
27   {}
28
29   ///////////////////////////////////////////////////////////////////
30   //
31   //    METHOD NAME : Patch::~Patch
32   //    METHOD TYPE : Dtor
33   //
34   Patch::~Patch()
35   {}
36
37   ///////////////////////////////////////////////////////////////////
38   //
39   //    Patch interface forwarded to implementation
40   //
41   ///////////////////////////////////////////////////////////////////
42
43   std::string Patch::id() const
44   { return std::string(); }
45
46   Date Patch::timestamp() const
47   { return Date(); }
48
49   std::string Patch::category() const
50   { return std::string(); }
51
52   bool Patch::reboot_needed() const
53   { return false; }
54
55   bool Patch::affects_pkg_manager() const
56   { return false; }
57
58 #warning Implement PATCH::ATOMS
59 #if 0
60   Patch::AtomList Patch::atoms() const
61   {
62       if ( ! _atomlist )
63       {
64         if ( ! hasBackRef() )
65         {
66           // We are not jet connected to the Resolvable that
67           // contains our dependencies.
68           return AtomList();
69         }
70
71         // lazy init
72         _atomlist.reset( new AtomList );
73
74         // Build the list using the repositories resolvables.
75         // Installed Patches (no repository) have this method overloaded.
76         if ( repository() )
77         {
78           const CapSet &   requires( self()->dep( Dep::REQUIRES ) );
79           const ResStore & store( repository().resolvables() );
80
81           for_( req, requires.begin(), requires.end() )
82           {
83             // lookup Patch requirements that refer to an Atom, Script or Message.
84             if ( refersTo<Atom>( *req ) || refersTo<Script>( *req ) || refersTo<Message>( *req ) )
85             {
86               for_( res, store.begin(), store.end() )
87               {
88                 // Collect ALL matches in the store.
89                 if ( hasMatches( (*res)->dep( Dep::PROVIDES ), (*req) ) )
90                 {
91                   _atomlist->push_back( *res );
92                 }
93               }
94             }
95           }
96         }
97       }
98       return *_atomlist;
99     return AtomList();
100   }
101 #endif
102
103   bool Patch::interactive() const
104   {
105 #warning Implement PATCH::INTERACTIVE
106 #if 0
107       if ( reboot_needed()
108            || ! licenseToConfirm().empty() )
109         {
110           return true;
111         }
112
113       AtomList atoms = all_atoms();
114       for ( AtomList::const_iterator it = atoms.begin(); it != atoms.end(); it++)
115         {
116           if (    isKind<Message>( *it )
117                || ! licenseToConfirm().empty() )
118             {
119               return true;
120             }
121         }
122
123       return false;
124 #endif
125     return false;
126   }
127
128   /////////////////////////////////////////////////////////////////
129 } // namespace zypp
130 ///////////////////////////////////////////////////////////////////