//---------------------------------------------------------------------------
-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;
}
//---------------------------------------------------------------------------
#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"
/////////////////////////////////////////////////////////////////////////
// ---------------------------------- 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
/**
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;
}
}
#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
**/
ProblemSolutionIgnore( ResolverProblem_Ptr parent,
const Dep &dep,
- ResItem_constPtr resItem,
+ PoolItem *item,
const Capability & capability);
};
};// namespace zypp
/////////////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONAIGNORE_H
+#endif // ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONIGNORE_H
* 02111-1307, USA.
*/
+#include <sstream>
+
#include "zypp/base/String.h"
#include "zypp/base/Gettext.h"
+
#include "zypp/solver/detail/ProblemSolutionInstall.h"
using namespace std;
//---------------------------------------------------------------------------
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();
}
#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
/**
* 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 );
};
///////////////////////////////////////////////////////////////////
* 02111-1307, USA.
*/
+#include <sstream>
+
#include "zypp/base/String.h"
#include "zypp/base/Gettext.h"
#include "zypp/solver/detail/ProblemSolutionUninstall.h"
//---------------------------------------------------------------------------
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();
}
///////////////////////////////////////////////////////////////////
#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
/**
* 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);
};
///////////////////////////////////////////////////////////////////