XMLPatchImpl.cc

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #include <iostream>
00013 
00014 #include "zypp/base/Logger.h"
00015 #include "zypp/target/store/xml/XMLPatchImpl.h"
00016 #include "zypp/Package.h"
00017 
00018 using namespace std;
00019 
00021 namespace zypp
00022 { 
00023 
00024   namespace storage
00025   { 
00026 
00028     //
00029     //  CLASS NAME : XMLPatchImpl
00030     //
00032 
00034     XMLPatchImpl::XMLPatchImpl()
00035     {}
00036 
00038     XMLPatchImpl::~XMLPatchImpl()
00039     {}
00040 
00041     std::string XMLPatchImpl::id() const
00042     {
00043       return _patch_id;
00044     }
00045     Date XMLPatchImpl::timestamp() const
00046     {
00047       return _timestamp;
00048     }
00049 
00050     std::string XMLPatchImpl::category() const
00051     {
00052       return _category;
00053     }
00054 
00055     bool XMLPatchImpl::reboot_needed() const
00056     {
00057       return _reboot_needed;
00058     }
00059 
00060     bool XMLPatchImpl::affects_pkg_manager() const
00061     {
00062       return _affects_pkg_manager;
00063     }
00064 
00065     bool XMLPatchImpl::interactive() const {
00066       if (_reboot_needed)
00067       {
00068         DBG << "Patch needs reboot" << endl;
00069         return true;
00070       }
00071       AtomList not_installed = not_installed_atoms();
00072       for (AtomList::const_iterator it = not_installed.begin();
00073         it != not_installed.end();
00074         it++)
00075       {
00076         if ((*it)->kind() == "Message")
00077         {
00078 //        DBG << "Patch contains a message" << endl;
00079           return true;
00080         }
00081         if ((*it)->kind() == "Package")
00082         {
00083                                  // Resolvable*
00084                                   // Resolvable
00085                                    // ResolvablePtr
00086 
00087 
00088           // <ma> never do somthing like this!!!
00089 //        Package* p = (Package*)&**it;
00090           //
00091           // (*it) is a ResolvablePtr
00092 
00093 
00094 
00095 
00096           // FIXME use the condition
00097 //        if (p->licenseToConfirm() != "")
00098           if (false)
00099           {
00100 //          DBG << "Package has a license to be shown to user" << endl;
00101             return true;
00102           }
00103         }
00104       }
00105       return false;
00106     }
00107 
00108     XMLPatchImpl::AtomList XMLPatchImpl::all_atoms() const {
00109       return _atoms;
00110     }
00111 
00112     XMLPatchImpl::AtomList XMLPatchImpl::not_installed_atoms() const {
00113       AtomList ret;
00114       for (AtomList::const_iterator it = _atoms.begin();
00115         it != _atoms.end();
00116         it++)
00117       {
00118         if (true) // FIXME check if atom/resolvable is not installed
00119         {
00120           ret.push_back(*it);
00121         }
00122       }
00123       return ret;
00124     }
00125 
00126 // TODO check necessarity of functions below
00127 
00128     bool XMLPatchImpl::any_atom_selected() const {
00129       for (AtomList::const_iterator it = _atoms.begin();
00130         it != _atoms.end();
00131         it++)
00132       {
00133         if (false) // FIXME check if atom/resolvable is selected
00134         {
00135           return true;
00136         }
00137       }
00138       return false;
00139     }
00140 
00141     void XMLPatchImpl::mark_atoms_to_freshen( bool freshen ) {
00142       for (AtomList::iterator it = _atoms.begin();
00143         it != _atoms.end();
00144         it++)
00145       {
00146         // TODO mark the resolvable to be or not to be freshed
00147       }
00148     }
00150   } // namespace detail
00153 } // namespace zypp

Generated on Thu Jul 6 00:07:26 2006 for zypp by  doxygen 1.4.6