From: Michael Andres Date: Mon, 13 Mar 2006 12:55:18 +0000 (+0000) Subject: - Allow ui::Selectable queries via Selectable::Fate (TO_DELETE/UNMODIFIED/TO_INSTALL) X-Git-Tag: BASE-SuSE-SLE-10-SP2-Branch~1573 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ef568c5ff7f3a5a26a82723848c00e4e1a0503ba;p=platform%2Fupstream%2Flibzypp.git - Allow ui::Selectable queries via Selectable::Fate (TO_DELETE/UNMODIFIED/TO_INSTALL) --- diff --git a/zypp/ui/Selectable.cc b/zypp/ui/Selectable.cc index 734eff8..f21a693 100644 --- a/zypp/ui/Selectable.cc +++ b/zypp/ui/Selectable.cc @@ -91,6 +91,31 @@ namespace zypp { _pimpl->setLicenceConfirmed( val_r ); } + Selectable::Fate Selectable::fate() const + { + switch ( status() ) { + case S_Update: + case S_Install: + case S_AutoUpdate: + case S_AutoInstall: + return TO_INSTALL; + break; + + case S_Del: + case S_AutoDel: + return TO_DELETE; + break; + + case S_Protected: + case S_Taboo: + case S_KeepInstalled: + case S_NoInst: + break; + } + return UNMODIFIED; + }; + + /****************************************************************** ** ** FUNCTION NAME : operator<< diff --git a/zypp/ui/Selectable.h b/zypp/ui/Selectable.h index 7b66702..82d9cb7 100644 --- a/zypp/ui/Selectable.h +++ b/zypp/ui/Selectable.h @@ -120,6 +120,35 @@ namespace zypp { return ! installedObj() && candidateObj(); } //@} + public: + /** \name Query objects fate in case of commit. + */ + //@{ + enum Fate { + TO_DELETE = -1, + UNMODIFIED = 0, + TO_INSTALL = 1 + }; + /** */ + Fate fate() const; + + /** True if either to delete or to install */ + bool unmodified() const + { return fate() == UNMODIFIED; } + + /** True if either to delete or to install */ + bool toModify() const + { return fate() != UNMODIFIED; } + + /** True if to delete */ + bool toDelete() const + { return fate() == TO_DELETE; } + + /** True if to install */ + bool toInstall() const + { return fate() == TO_INSTALL; } + //@} + public: /** \name Special inteface for Y2UI. * \note This interface acts on \ref ResStatus::USER level.