//
// CLASS NAME : Message
//
- /** */
+ /** Class representing the message to be shown during update */
class Message : public Resolvable
{
public:
/** Dtor */
~Message();
public:
+ /** Get the text of the message */
std::string text ();
+ /** Get the type of the message (YesNo / OK) */
std::string type ();
private:
/** Pointer to implementation */
///////////////////////////////////////////////////////////////////
//
- // METHOD NAME : Patch::interactive
- // Check whether patch can be applied only interactivly
+ // METHOD NAME : Patch::id
+ // Get the patch id
//
- bool Patch::interactive ()
+ std::string Patch::id () const
{
- return _pimpl->interactive ();
+ return _pimpl->id ();
}
///////////////////////////////////////////////////////////////////
//
- // METHOD NAME : Patch::category
- // Get the category of the patch
+ // METHOD NAME : Patch::id
+ // Get the patch id
//
- std::string Patch::category ()
+ unsigned int Patch::timestamp () const
{
- return _pimpl->_category;
+ return _pimpl->timestamp ();
}
///////////////////////////////////////////////////////////////////
// METHOD NAME : Patch::summary
// Get the patch summary
//
- std::string Patch::summary ()
+ std::string Patch::summary () const
{
- return _pimpl->_summary["en"];
+ return _pimpl->summary ();
}
///////////////////////////////////////////////////////////////////
// METHOD NAME : Patch::description
// Get the patch description
//
- std::string Patch::description ()
+ std::list<std::string> Patch::description () const
+ {
+ return _pimpl->description ();
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Patch::category
+ // Get the category of the patch
+ //
+ std::string Patch::category () const
+ {
+ return _pimpl->category ();
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Patch::reboot_needed
+ // Check whether reboot is needed to finish the patch installation
+ //
+ bool Patch::reboot_needed () const {
+ return _pimpl->reboot_needed ();
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Patch::affects_pkg_manager
+ // Check whether the patch installation affects package manager
+ // (and it should be restarted after patch installation)
+ //
+ bool Patch::affects_pkg_manager () const {
+ return _pimpl->affects_pkg_manager ();
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Patch::atoms
+ // Get the list of all atoms building the patch
+ //
+ atom_list Patch::atoms () const {
+ return _pimpl->all_atoms ();
+ }
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Patch::interactive
+ // Check whether patch can be applied only interactivly
+ //
+ bool Patch::interactive ()
{
- return _pimpl->_description["en"];
+ return _pimpl->interactive ();
}
void Patch::mark_atoms_to_freshen (bool freshen)
#define ZYPP_PATCH_H
#include <iosfwd>
+#include <list>
#include "zypp/Resolvable.h"
///////////////////////////////////////////////////////////////////
DEFINE_PTR_TYPE(Patch)
+ #define atom_list std::list<ResolvablePtr>
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : Patch
//
- /** */
+ /** Class representing a patch */
class Patch : public Resolvable
{
public:
/** Dtor */
~Patch();
public:
+ /** Patch ID */
+ std::string id () const;
+ /** Patch time stamp */
+ unsigned int timestamp () const;
+ /** Patch summary */
+ std::string summary () const;
+ /** Patch description */
+ std::list<std::string> description() const;
+ /** Patch category (recommended, security,...) */
+ std::string category () const;
+ /** Does the system need to reboot to finish the update process? */
+ bool reboot_needed () const;
+ /** Does the patch affect the package manager itself? */
+ bool affects_pkg_manager () const;
+ /** The list of all atoms building the patch */
+ atom_list atoms () const;
+ /** Is the patch installation interactive? (does it need user input?) */
bool interactive ();
- std::string do_script ();
- std::string undo_script ();
- bool undo_available ();
- std::string category ();
- std::string description ();
- std::string summary ();
+ // TODO add comments and reevaluate the need for functions below
void mark_atoms_to_freshen (bool freshen);
bool any_atom_selected ();
void select (); // TODO parameter to specify select/unselect or another function
//
// CLASS NAME : Script
//
- /** */
+ /** Class representing an update script */
class Script : public Resolvable
{
public:
/** Dtor */
~Script();
public:
+ /** Get the script to perform the change */
std::string do_script ();
+ /** Get the script to undo the change */
std::string undo_script ();
+ /** Check whether script to undo the change is available */
bool undo_available ();
private:
/** Pointer to implementation */
//
// CLASS NAME : MessageImpl
//
- /** */
+ /** Class representing the message to be shown during update */
class MessageImpl : public ResolvableImpl
{
public:
~MessageImpl();
public:
+ /** Get the text of the message */
virtual std::string text () const;
+ /** Get the type of the message (YesNo / OK) */
virtual std::string type () const;
protected:
+ /** The text of the message */
std::string _text;
+ /** The type of the message (YesNo / OK) */
std::string _type;
};
///////////////////////////////////////////////////////////////////
{
}
+ std::string PatchImpl::id () const
+ {
+ return _patch_id;
+ }
+ unsigned int PatchImpl::timestamp () const
+ {
+ return _timestamp;
+ }
+
+ std::string PatchImpl::summary () const
+ {
+ return _summary;
+ }
+
+ std::list<std::string> PatchImpl::description () const
+ {
+ return _description;
+ }
+
+ std::string PatchImpl::category () const
+ {
+ return _category;
+ }
+
+ bool PatchImpl::reboot_needed () const
+ {
+ return _reboot_needed;
+ }
+
+ bool PatchImpl::affects_pkg_manager () const
+ {
+ return _affects_pkg_manager;
+ }
+
bool PatchImpl::interactive () {
if (_reboot_needed)
{
{
if ((std::string)((*it)->kind ()) == "message")
{
- DBG << "Patch contains a message" << endl;
+// DBG << "Patch contains a message" << endl;
return true;
}
if ((std::string)((*it)->kind ()) == "package")
{
- ResolvablePtr r = *it;
- // FIXME package with license
-// if (r->licenseToConfirm() != "")
+ // Resolvable*
+ // Resolvable
+ // ResolvablePtr
+ Package* p = (Package*)&**it;
+ // FIXME use the condition
+// if (p->licenseToConfirm() != "")
if (false)
{
- DBG << "Package has a license to be shown to user" << endl;
+// DBG << "Package has a license to be shown to user" << endl;
return true;
}
}
return false;
}
+ atom_list PatchImpl::all_atoms () {
+ return _atoms;
+ }
+
atom_list PatchImpl::not_installed_atoms () {
atom_list ret;
for (atom_list::iterator it = _atoms.begin ();
return ret;
}
+// TODO check necessarity of functions below
+
bool PatchImpl::any_atom_selected () {
for (atom_list::iterator it = _atoms.begin ();
it != _atoms.end ();
#ifndef ZYPP_DETAIL_PATCHIMPL_H
#define ZYPP_DETAIL_PATCHIMPL_H
-#include <map>
#include <list>
#include <string>
namespace detail
{ /////////////////////////////////////////////////////////////////
-// typedef std::list<Resolvable> atom_list;
- #define atom_list std::list<ResolvablePtr>
-
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : PatchImpl
//
- /** */
+ /** Class representing a patch */
class PatchImpl : public ResolvableImpl
{
public:
~PatchImpl();
public:
- std::string _category;
- std::map<std::string,std::string> _summary;
- std::map<std::string,std::string> _description;
- int _timestamp;
- std::string _patch_id;
- bool _reboot_needed;
- bool _package_manager;
+ /** Patch ID */
+ std::string id () const;
+ /** Patch time stamp */
+ unsigned int timestamp () const;
+ /** Patch summary */
+ std::string summary () const;
+ /** Patch description */
+ std::list<std::string> description () const;
+ /** Patch category (recommended, security,...) */
+ std::string category () const;
+ /** Does the system need to reboot to finish the update process? */
+ bool reboot_needed () const;
+ /** Does the patch affect the package manager itself? */
+ bool affects_pkg_manager () const;
+ /** Is the patch installation interactive? (does it need user input?) */
bool interactive ();
+ /** The list of all atoms building the patch */
+ atom_list all_atoms ();
+ /** The list of those atoms which have not been installed */
+ atom_list not_installed_atoms ();
+
+// TODO check necessarity of functions below
bool any_atom_selected ();
void mark_atoms_to_freshen (bool freshen);
protected:
- atom_list not_installed_atoms ();
+ /** Patch ID */
+ std::string _patch_id;
+ /** Patch time stamp */
+ int _timestamp;
+ /** Patch summary */
+ std::string _summary;
+ /** Patch description */
+ std::list<std::string> _description;
+ /** Patch category (recommended, security,...) */
+ std::string _category;
+ /** Does the system need to reboot to finish the update process? */
+ bool _reboot_needed;
+ /** Does the patch affect the package manager itself? */
+ bool _affects_pkg_manager;
+ /** The list of all atoms building the patch */
atom_list _atoms;
};
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : ScriptImpl
//
- /** */
+ /** Class representing an update script */
class ScriptImpl : public ResolvableImpl
{
public:
~ScriptImpl();
public:
+ /** Get the script to perform the change */
std::string do_script () const;
+ /** Get the script to undo the change */
std::string undo_script () const;
- bool undo_available () const;
+ /** Check whether script to undo the change is available */
+ virtual bool undo_available () const;
protected:
+ /** The script to perform the change */
std::string _do_script;
+ /** The script to undo the change */
std::string _undo_script;
};
///////////////////////////////////////////////////////////////////