compiles, backup checkin
authorKlaus Kaempf <kkaempf@suse.de>
Wed, 25 Jan 2006 20:24:07 +0000 (20:24 +0000)
committerKlaus Kaempf <kkaempf@suse.de>
Wed, 25 Jan 2006 20:24:07 +0000 (20:24 +0000)
zypp/solver/detail/ProblemSolution.cc
zypp/solver/detail/ProblemSolution.h
zypp/solver/detail/ProblemSolutionIgnore.cc
zypp/solver/detail/ProblemSolutionIgnore.h
zypp/solver/detail/ProblemSolutionInstall.cc
zypp/solver/detail/ProblemSolutionInstall.h
zypp/solver/detail/ProblemSolutionUninstall.cc
zypp/solver/detail/ProblemSolutionUninstall.h

index d8a6a89cd9a3ef8df5c29dd1488ecccc71f41fba..eb6e661dd2065f13f0de48586e86edb8b3e40c21 100644 (file)
@@ -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;
 }
 
 //---------------------------------------------------------------------------
index 62b483a59afda4c37a68cc8ab771599d2b6161ed..87d81ad617679c58c0ee79271bdc9b7ac676d161 100644 (file)
@@ -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
            /**
index 5066e4e9dae308fd70fb0fecb26a6979738392dc..ee485472a39bd6b3f4d31cf1ea1ef41dfafecc8d 100644 (file)
@@ -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;
     }
 }
 
index 04a733af82fcd029ed64efe1b10804b06c0b3be1..2516cd734ffba37dd3b51a485e74cdcb29664522 100644 (file)
 #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
 
index bab9827b2f15aa949bf26ec9dbd8e13bbcbdeaea..fc327e7860b29473cc23d8310be8bd6692eb6ddb 100644 (file)
  * 02111-1307, USA.
  */
 
+#include <sstream>
+
 #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();
     
 }
 
index 2651c9baadbe5d01bc39193f51d356b37944e323..2e64c2fd9831171d12a3240d20af39701a972b53 100644 (file)
 #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 );          
        };
 
       ///////////////////////////////////////////////////////////////////
index e405e7d4b17235522c59834949c23dcfe2d80152..dbf6016258c015611443ecf68453984ee18525c5 100644 (file)
@@ -22,6 +22,8 @@
  * 02111-1307, USA.
  */
 
+#include <sstream>
+
 #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();
 }
 
       ///////////////////////////////////////////////////////////////////
index f369a843ae1111bc40de13dd3334738f7dd54581..0adfd7e2eac28b966de0814c76b2bb6af17c692b 100644 (file)
 #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);         
        };
 
       ///////////////////////////////////////////////////////////////////