From 9b6bd2ccf71e5783b1aa441d183b2f9f3682e2be Mon Sep 17 00:00:00 2001 From: Klaus Kaempf Date: Wed, 25 Jan 2006 20:24:07 +0000 Subject: [PATCH] compiles, backup checkin --- zypp/solver/detail/ProblemSolution.cc | 58 +++++-------------- zypp/solver/detail/ProblemSolution.h | 14 ++--- zypp/solver/detail/ProblemSolutionIgnore.cc | 6 +- zypp/solver/detail/ProblemSolutionIgnore.h | 8 ++- zypp/solver/detail/ProblemSolutionInstall.cc | 29 ++++++---- zypp/solver/detail/ProblemSolutionInstall.h | 7 ++- .../solver/detail/ProblemSolutionUninstall.cc | 26 +++++---- zypp/solver/detail/ProblemSolutionUninstall.h | 7 ++- 8 files changed, 69 insertions(+), 86 deletions(-) diff --git a/zypp/solver/detail/ProblemSolution.cc b/zypp/solver/detail/ProblemSolution.cc index d8a6a89cd..eb6e661dd 100644 --- a/zypp/solver/detail/ProblemSolution.cc +++ b/zypp/solver/detail/ProblemSolution.cc @@ -40,60 +40,32 @@ IMPL_PTR_TYPE(ProblemSolution); //--------------------------------------------------------------------------- -string -ProblemSolution::asString ( void ) const -{ - return toString (*this); -} - - -string -ProblemSolution::toString ( const ProblemSolution & solution ) +ostream& +operator<<( ostream& os, const ProblemSolution & solution) { - string ret ("Solution:\n"); - ret += solution._description + "\n"; - ret += solution._details + "\n"; - ret += SolutionAction::toString (solution._actions); - return ret; + os << "Solution:" << endl; + os << solution._description << endl; + os << solution._details << endl; + os << solution._actions; + return os; } - -std::string -ProblemSolution::toString (const ProblemSolutionList & solutionlist) +ostream& +operator<<( ostream& os, const ProblemSolutionList & solutionlist) { - string ret; for (ProblemSolutionList::const_iterator iter = solutionlist.begin(); iter != solutionlist.end(); ++iter) { - ret += (*iter)->asString(); - ret += "\n"; + os << (*iter) << endl; } - return ret; + return os; } - -std::string -ProblemSolution::toString (const CProblemSolutionList & solutionlist) +ostream& +operator<<( ostream& os, const CProblemSolutionList & solutionlist) { - string ret; for (CProblemSolutionList::const_iterator iter = solutionlist.begin(); iter != solutionlist.end(); ++iter) { - ret += (*iter)->asString(); - ret += "\n"; + os << (*iter) << endl; } - return ret; -} - - -ostream & -ProblemSolution::dumpOn( ostream & str ) const -{ - str << asString(); - return str; -} - - -ostream& -operator<<( ostream& os, const ProblemSolution & solution) -{ - return os << solution.asString(); + return os; } //--------------------------------------------------------------------------- diff --git a/zypp/solver/detail/ProblemSolution.h b/zypp/solver/detail/ProblemSolution.h index 62b483a59..87d81ad61 100644 --- a/zypp/solver/detail/ProblemSolution.h +++ b/zypp/solver/detail/ProblemSolution.h @@ -15,9 +15,9 @@ #include "zypp/base/ReferenceCounted.h" #include "zypp/base/PtrTypes.h" +#include "zypp/solver/detail/Types.h" + #include "zypp/solver/detail/Resolver.h" -#include "zypp/solver/detail/ProblemSolutionPtr.h" -#include "zypp/solver/detail/ResolverProblemPtr.h" #include "zypp/solver/detail/SolutionAction.h" ///////////////////////////////////////////////////////////////////////// @@ -78,15 +78,9 @@ namespace zypp // ---------------------------------- I/O - static std::string toString (const ProblemSolution & solution); - static std::string toString (const ProblemSolutionList & solutionlist); - static std::string toString (const CProblemSolutionList & solutionlist); - - virtual std::ostream & dumpOn(std::ostream & str ) const; - friend std::ostream& operator<<(std::ostream&, const ProblemSolution & solution); - - std::string asString (void) const; + friend std::ostream& operator<<(std::ostream&, const ProblemSolutionList & solutionlist); + friend std::ostream& operator<<(std::ostream&, const CProblemSolutionList & solutionlist); // ---------------------------------- accessors /** diff --git a/zypp/solver/detail/ProblemSolutionIgnore.cc b/zypp/solver/detail/ProblemSolutionIgnore.cc index 5066e4e9d..ee485472a 100644 --- a/zypp/solver/detail/ProblemSolutionIgnore.cc +++ b/zypp/solver/detail/ProblemSolutionIgnore.cc @@ -45,20 +45,20 @@ IMPL_PTR_TYPE(ProblemSolutionIgnore); ProblemSolutionIgnore::ProblemSolutionIgnore( ResolverProblem_Ptr parent, const Dep &kind, - ResItem_constPtr resItem, + PoolItem *item, const Capability & capability) : ProblemSolution (parent, "", "") { if (kind == Dep::CONFLICTS) { // TranslatorExplanation %s = name of package, patch, selection ... _description = str::form (_("Ignoring conflict of %s"), - resItem->name().c_str()); + (*item)->name().c_str()); addAction (new InjectSolutionAction (capability, kind)); } else if (kind == Dep::PROVIDES) { _description = _("Ignoring this requirement"); addAction ( new InjectSolutionAction (capability, kind)); } else { - ERR << "Wrong kind of capability: " << kind.asString() << endl; + ERR << "Wrong kind of capability: " << kind << endl; } } diff --git a/zypp/solver/detail/ProblemSolutionIgnore.h b/zypp/solver/detail/ProblemSolutionIgnore.h index 04a733af8..2516cd734 100644 --- a/zypp/solver/detail/ProblemSolutionIgnore.h +++ b/zypp/solver/detail/ProblemSolutionIgnore.h @@ -22,9 +22,11 @@ #ifndef ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONIGNORE_H #define ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONIGNORE_H +#include "zypp/solver/detail/Types.h" + #include "zypp/solver/detail/Resolver.h" #include "zypp/solver/detail/ProblemSolution.h" -#include "zypp/solver/detail/ProblemSolutionIgnorePtr.h" + ///////////////////////////////////////////////////////////////////////// namespace zypp @@ -50,7 +52,7 @@ namespace zypp **/ ProblemSolutionIgnore( ResolverProblem_Ptr parent, const Dep &dep, - ResItem_constPtr resItem, + PoolItem *item, const Capability & capability); }; @@ -64,5 +66,5 @@ namespace zypp };// namespace zypp ///////////////////////////////////////////////////////////////////////// -#endif // ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONAIGNORE_H +#endif // ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONIGNORE_H diff --git a/zypp/solver/detail/ProblemSolutionInstall.cc b/zypp/solver/detail/ProblemSolutionInstall.cc index bab9827b2..fc327e786 100644 --- a/zypp/solver/detail/ProblemSolutionInstall.cc +++ b/zypp/solver/detail/ProblemSolutionInstall.cc @@ -22,8 +22,11 @@ * 02111-1307, USA. */ +#include + #include "zypp/base/String.h" #include "zypp/base/Gettext.h" + #include "zypp/solver/detail/ProblemSolutionInstall.h" using namespace std; @@ -43,31 +46,35 @@ IMPL_PTR_TYPE(ProblemSolutionInstall); //--------------------------------------------------------------------------- ProblemSolutionInstall::ProblemSolutionInstall( ResolverProblem_Ptr parent, - ResItem_constPtr resItem ) + PoolItem * item ) : ProblemSolution (parent, "", "") { // TranslatorExplanation %s = name of package, patch, selection ... - _description = str::form (_("Installing %s"), resItem->name().c_str() ); + _description = str::form (_("Installing %s"), (*item)->name().c_str() ); + ostringstream item_str; + item_str << (*item); // TranslatorExplanation %s = name of package, patch, selection ... - _details = str::form (_("Installing %s"), resItem->asString().c_str() ); + _details = str::form (_("Installing %s"), item_str.str().c_str() ); - addAction ( new TransactionSolutionAction (resItem, + addAction ( new TransactionSolutionAction (item, INSTALL)); } ProblemSolutionInstall::ProblemSolutionInstall( ResolverProblem_Ptr parent, - CResItemList & resItemList ) + PoolItemList & itemList ) : ProblemSolution (parent, "", "") { _description = _("Installing missing resolvables"); - for (CResItemList::const_iterator iter = resItemList.begin(); - iter != resItemList.end(); iter++) { - ResItem_constPtr resItem = *iter; - addAction ( new TransactionSolutionAction (resItem, INSTALL)); + for (PoolItemList::iterator iter = itemList.begin(); + iter != itemList.end(); iter++) { + PoolItem *item = *iter; + addAction ( new TransactionSolutionAction (item, INSTALL)); } - - _details = SolutionAction::toString (_actions); + + ostringstream details; + details << _actions; + _details = details.str(); } diff --git a/zypp/solver/detail/ProblemSolutionInstall.h b/zypp/solver/detail/ProblemSolutionInstall.h index 2651c9baa..2e64c2fd9 100644 --- a/zypp/solver/detail/ProblemSolutionInstall.h +++ b/zypp/solver/detail/ProblemSolutionInstall.h @@ -22,9 +22,10 @@ #ifndef ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONINSTALL_H #define ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONINSTALL_H +#include "zypp/solver/detail/Types.h" + #include "zypp/solver/detail/Resolver.h" #include "zypp/solver/detail/ProblemSolution.h" -#include "zypp/solver/detail/ProblemSolutionInstallPtr.h" ///////////////////////////////////////////////////////////////////////// namespace zypp @@ -48,8 +49,8 @@ namespace zypp /** * Constructor. **/ - ProblemSolutionInstall( ResolverProblem_Ptr parent, ResItem_constPtr resItem ); - ProblemSolutionInstall( ResolverProblem_Ptr parent, CResItemList & resItemList ); + ProblemSolutionInstall( ResolverProblem_Ptr parent, PoolItem *item); + ProblemSolutionInstall( ResolverProblem_Ptr parent, PoolItemList & itemlist ); }; /////////////////////////////////////////////////////////////////// diff --git a/zypp/solver/detail/ProblemSolutionUninstall.cc b/zypp/solver/detail/ProblemSolutionUninstall.cc index e405e7d4b..dbf601625 100644 --- a/zypp/solver/detail/ProblemSolutionUninstall.cc +++ b/zypp/solver/detail/ProblemSolutionUninstall.cc @@ -22,6 +22,8 @@ * 02111-1307, USA. */ +#include + #include "zypp/base/String.h" #include "zypp/base/Gettext.h" #include "zypp/solver/detail/ProblemSolutionUninstall.h" @@ -43,30 +45,34 @@ IMPL_PTR_TYPE(ProblemSolutionUninstall); //--------------------------------------------------------------------------- ProblemSolutionUninstall::ProblemSolutionUninstall( ResolverProblem_Ptr parent, - ResItem_constPtr resItem ) + PoolItem *item) : ProblemSolution (parent, "", "") { // TranslatorExplanation %s = name of package, patch, selection ... - _description = str::form (_("Deleting %s"), resItem->name().c_str() ); + _description = str::form (_("Deleting %s"), (*item)->name().c_str() ); + ostringstream item_str; + item_str << (*item); // TranslatorExplanation %s = name of package, patch, selection ... - _details = str::form (_("Deleting %s"), resItem->asString().c_str() ); + _details = str::form (_("Deleting %s"), item_str.str().c_str() ); - addAction ( new TransactionSolutionAction (resItem, REMOVE)); + addAction ( new TransactionSolutionAction (item, REMOVE)); } ProblemSolutionUninstall::ProblemSolutionUninstall( ResolverProblem_Ptr parent, - CResItemList & resItemList ) + PoolItemList & itemlist) : ProblemSolution (parent, "", "") { _description = _("Removing conflicting resolvables"); - for (CResItemList::const_iterator iter = resItemList.begin(); - iter != resItemList.end(); iter++) { - ResItem_constPtr resItem = *iter; - addAction ( new TransactionSolutionAction (resItem, REMOVE)); + for (PoolItemList::iterator iter = itemlist.begin(); + iter != itemlist.end(); iter++) { + PoolItem *item = *iter; + addAction ( new TransactionSolutionAction (item, REMOVE)); } - _details = SolutionAction::toString (_actions); + ostringstream details; + details << _actions; + _details = details.str(); } /////////////////////////////////////////////////////////////////// diff --git a/zypp/solver/detail/ProblemSolutionUninstall.h b/zypp/solver/detail/ProblemSolutionUninstall.h index f369a843a..0adfd7e2e 100644 --- a/zypp/solver/detail/ProblemSolutionUninstall.h +++ b/zypp/solver/detail/ProblemSolutionUninstall.h @@ -22,9 +22,10 @@ #ifndef ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONUNINSTALL_H #define ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONUNINSTALL_H +#include "zypp/solver/detail/Types.h" + #include "zypp/solver/detail/Resolver.h" #include "zypp/solver/detail/ProblemSolution.h" -#include "zypp/solver/detail/ProblemSolutionUninstallPtr.h" ///////////////////////////////////////////////////////////////////////// namespace zypp @@ -48,8 +49,8 @@ namespace zypp /** * Constructor. **/ - ProblemSolutionUninstall( ResolverProblem_Ptr parent, ResItem_constPtr resItem ); - ProblemSolutionUninstall( ResolverProblem_Ptr parent, CResItemList & resItemList ); + ProblemSolutionUninstall( ResolverProblem_Ptr parent, PoolItem *item); + ProblemSolutionUninstall( ResolverProblem_Ptr parent, PoolItemList & itemlist); }; /////////////////////////////////////////////////////////////////// -- 2.34.1