[zypp-commit] r9619 - in /trunk/libzypp/zypp: ./ sat/
Author: schubi2 Date: Mon Apr 14 19:33:35 2008 New Revision: 9619 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9619&view=rev Log: added new solver request Added: trunk/libzypp/zypp/sat/SolverQueueItemDelete.cc trunk/libzypp/zypp/sat/SolverQueueItemDelete.h trunk/libzypp/zypp/sat/SolverQueueItemInstall.cc trunk/libzypp/zypp/sat/SolverQueueItemInstall.h trunk/libzypp/zypp/sat/SolverQueueItemInstallOneOf.cc trunk/libzypp/zypp/sat/SolverQueueItemInstallOneOf.h trunk/libzypp/zypp/sat/SolverQueueItemUpdate.cc trunk/libzypp/zypp/sat/SolverQueueItemUpdate.h Modified: trunk/libzypp/zypp/CMakeLists.txt trunk/libzypp/zypp/sat/SolverQueueItem.cc trunk/libzypp/zypp/sat/SolverQueueItem.h Modified: trunk/libzypp/zypp/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=9619&r1=9618&r2=9619&view=diff ============================================================================== --- trunk/libzypp/zypp/CMakeLists.txt (original) +++ trunk/libzypp/zypp/CMakeLists.txt Mon Apr 14 19:33:35 2008 @@ -522,6 +522,10 @@ sat/SATResolver.cc sat/SolvAttr.cc sat/SolverQueueItem.cc + sat/SolverQueueItemInstall.cc + sat/SolverQueueItemDelete.cc + sat/SolverQueueItemUpdate.cc + sat/SolverQueueItemInstallOneOf.cc ) SET( zypp_sat_HEADERS @@ -534,6 +538,10 @@ sat/LookupAttr.h sat/SATResolver.h sat/SolverQueueItem.h + sat/SolverQueueItemInstall.h + sat/SolverQueueItemDelete.h + sat/SolverQueueItemUpdate.h + sat/SolverQueueItemInstallOneOf.h sat/SolvAttr.h ) Modified: trunk/libzypp/zypp/sat/SolverQueueItem.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolverQueueItem.cc?rev=9619&r1=9618&r2=9619&view=diff ============================================================================== --- trunk/libzypp/zypp/sat/SolverQueueItem.cc (original) +++ trunk/libzypp/zypp/sat/SolverQueueItem.cc Mon Apr 14 19:33:35 2008 @@ -44,8 +44,8 @@ switch (_type) { case QUEUE_ITEM_TYPE_UNKNOWN : os << "unknown"; break; case QUEUE_ITEM_TYPE_UPDATE : os << "update"; break; - case QUEUE_ITEM_TYPE_REQUIRE : os << "require"; break; - case QUEUE_ITEM_TYPE_CONFLICT : os << "conflict"; break; + case QUEUE_ITEM_TYPE_INSTALL : os << "install"; break; + case QUEUE_ITEM_TYPE_DELETE : os << "delete"; break; case QUEUE_ITEM_TYPE_INSTALL_ONE_OF: os << "install one of"; break; default: os << "?solverqueueitem?"; break; } Modified: trunk/libzypp/zypp/sat/SolverQueueItem.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolverQueueItem.h?rev=9619&r1=9618&r2=9619&view=diff ============================================================================== --- trunk/libzypp/zypp/sat/SolverQueueItem.h (original) +++ trunk/libzypp/zypp/sat/SolverQueueItem.h Mon Apr 14 19:33:35 2008 @@ -28,10 +28,8 @@ #include "zypp/base/ReferenceCounted.h" #include "zypp/base/NonCopyable.h" #include "zypp/base/PtrTypes.h" - #include "zypp/ResPool.h" - ///////////////////////////////////////////////////////////////////////// namespace zypp { /////////////////////////////////////////////////////////////////////// @@ -45,8 +43,8 @@ typedef enum { QUEUE_ITEM_TYPE_UNKNOWN = 0, QUEUE_ITEM_TYPE_UPDATE, - QUEUE_ITEM_TYPE_REQUIRE, - QUEUE_ITEM_TYPE_CONFLICT, + QUEUE_ITEM_TYPE_INSTALL, + QUEUE_ITEM_TYPE_DELETE, QUEUE_ITEM_TYPE_INSTALL_ONE_OF, } SolverQueueItemType; @@ -91,8 +89,8 @@ void copy (const SolverQueueItem *from); - bool isConflict (void) const { return _type == QUEUE_ITEM_TYPE_CONFLICT; } - bool isRequire (void) const { return _type == QUEUE_ITEM_TYPE_REQUIRE; } + bool isDelete (void) const { return _type == QUEUE_ITEM_TYPE_DELETE; } + bool isInstall (void) const { return _type == QUEUE_ITEM_TYPE_INSTALL; } bool isUpdate (void) const { return _type == QUEUE_ITEM_TYPE_UPDATE; } bool isInstallOneOf (void) const { return _type == QUEUE_ITEM_TYPE_INSTALL_ONE_OF; } Added: trunk/libzypp/zypp/sat/SolverQueueItemDelete.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolverQueueItemDelete.cc?rev=9619&view=auto ============================================================================== --- trunk/libzypp/zypp/sat/SolverQueueItemDelete.cc (added) +++ trunk/libzypp/zypp/sat/SolverQueueItemDelete.cc Mon Apr 14 19:33:35 2008 @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* SolverQueueItem.cc + * + * Copyright (C) 2008 SUSE Linux Products GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include "zypp/base/Logger.h" +#include "zypp/sat/SolverQueueItemDelete.h" + +///////////////////////////////////////////////////////////////////////// +namespace zypp +{ /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + namespace solver + { ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + namespace detail + { /////////////////////////////////////////////////////////////////// + +using namespace std; + +IMPL_PTR_TYPE(SolverQueueItemDelete); + +//--------------------------------------------------------------------------- + +std::ostream & +SolverQueueItemDelete::dumpOn( std::ostream & os ) const +{ + os << "[" << (_soft?"Soft":"") << "Delete: "; + os << _name; + + return os; +} + +//--------------------------------------------------------------------------- + +SolverQueueItemDelete::SolverQueueItemDelete (const ResPool & pool, std::string name, bool soft) + : SolverQueueItem (QUEUE_ITEM_TYPE_DELETE, pool) + , _name (name) + , _soft (soft) +{ +} + + +SolverQueueItemDelete::~SolverQueueItemDelete() +{ +} + +//--------------------------------------------------------------------------- + +SolverQueueItem_Ptr +SolverQueueItemDelete::copy (void) const +{ + SolverQueueItemDelete_Ptr new_delete = new SolverQueueItemDelete (pool(), _name); + new_delete->SolverQueueItem::copy(this); + + new_delete->_soft = _soft; + return new_delete; +} + + +//--------------------------------------------------------------------------- + + +/////////////////////////////////////////////////////////////////// + };// namespace detail + ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + };// namespace solver + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// +};// namespace zypp +///////////////////////////////////////////////////////////////////////// Added: trunk/libzypp/zypp/sat/SolverQueueItemDelete.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolverQueueItemDelete.h?rev=9619&view=auto ============================================================================== --- trunk/libzypp/zypp/sat/SolverQueueItemDelete.h (added) +++ trunk/libzypp/zypp/sat/SolverQueueItemDelete.h Mon Apr 14 19:33:35 2008 @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* QueueItem.h + * + * Copyright (C) 2008 SUSE Linux Products GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMDELETE_H +#define ZYPP_SOLVER_DETAIL_QUEUEITEMDELETE_H + +#include <iosfwd> +#include <string> + +#include "zypp/sat/SolverQueueItem.h" + +///////////////////////////////////////////////////////////////////////// +namespace zypp +{ /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + namespace solver + { ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + namespace detail + { /////////////////////////////////////////////////////////////////// + +DEFINE_PTR_TYPE(SolverQueueItemDelete); + + +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : SolverQueueItemDelete + +class SolverQueueItemDelete : public SolverQueueItem { + + private: + + std::string _name; + bool _soft; // if triggered by a soft requirement (a recommends) + + public: + + SolverQueueItemDelete (const ResPool & pool, std::string name, bool soft = false); + virtual ~SolverQueueItemDelete(); + + // ---------------------------------- I/O + + virtual std::ostream & dumpOn( std::ostream & str ) const; + + friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemDelete & obj) + { return obj.dumpOn (str); } + + // ---------------------------------- accessors + + bool isSoft (void) const { return _soft; } + + // ---------------------------------- methods + + virtual SolverQueueItem_Ptr copy (void) const; + virtual int cmp (SolverQueueItem_constPtr item) const; +}; + +/////////////////////////////////////////////////////////////////// + };// namespace detail + ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + };// namespace solver + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// +};// namespace zypp +///////////////////////////////////////////////////////////////////////// + +#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMDELETE_H Added: trunk/libzypp/zypp/sat/SolverQueueItemInstall.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolverQueueItemInstall.cc?rev=9619&view=auto ============================================================================== --- trunk/libzypp/zypp/sat/SolverQueueItemInstall.cc (added) +++ trunk/libzypp/zypp/sat/SolverQueueItemInstall.cc Mon Apr 14 19:33:35 2008 @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* SolverQueueItem.cc + * + * Copyright (C) 2008 SUSE Linux Products GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include "zypp/base/Logger.h" +#include "zypp/sat/SolverQueueItemInstall.h" + +///////////////////////////////////////////////////////////////////////// +namespace zypp +{ /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + namespace solver + { ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + namespace detail + { /////////////////////////////////////////////////////////////////// + +using namespace std; + +IMPL_PTR_TYPE(SolverQueueItemInstall); + +//--------------------------------------------------------------------------- + +std::ostream & +SolverQueueItemInstall::dumpOn( std::ostream & os ) const +{ + os << "[" << (_soft?"Soft":"") << "Install: "; + os << _name; + + return os; +} + +//--------------------------------------------------------------------------- + +SolverQueueItemInstall::SolverQueueItemInstall (const ResPool & pool, std::string name, bool soft) + : SolverQueueItem (QUEUE_ITEM_TYPE_INSTALL, pool) + , _name (name) + , _soft (soft) +{ +} + + +SolverQueueItemInstall::~SolverQueueItemInstall() +{ +} + +//--------------------------------------------------------------------------- + +SolverQueueItem_Ptr +SolverQueueItemInstall::copy (void) const +{ + SolverQueueItemInstall_Ptr new_install = new SolverQueueItemInstall (pool(), _name); + new_install->SolverQueueItem::copy(this); + + new_install->_soft = _soft; + return new_install; +} + + +//--------------------------------------------------------------------------- + + +/////////////////////////////////////////////////////////////////// + };// namespace detail + ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + };// namespace solver + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// +};// namespace zypp +///////////////////////////////////////////////////////////////////////// Added: trunk/libzypp/zypp/sat/SolverQueueItemInstall.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolverQueueItemInstall.h?rev=9619&view=auto ============================================================================== --- trunk/libzypp/zypp/sat/SolverQueueItemInstall.h (added) +++ trunk/libzypp/zypp/sat/SolverQueueItemInstall.h Mon Apr 14 19:33:35 2008 @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* QueueItem.h + * + * Copyright (C) 2008 SUSE Linux Products GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALL_H +#define ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALL_H + +#include <iosfwd> +#include <string> + +#include "zypp/sat/SolverQueueItem.h" + +///////////////////////////////////////////////////////////////////////// +namespace zypp +{ /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + namespace solver + { ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + namespace detail + { /////////////////////////////////////////////////////////////////// + +DEFINE_PTR_TYPE(SolverQueueItemInstall); + + +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : SolverQueueItemInstall + +class SolverQueueItemInstall : public SolverQueueItem { + + private: + + std::string _name; + bool _soft; // if triggered by a soft requirement (a recommends) + + public: + + SolverQueueItemInstall (const ResPool & pool, std::string name, bool soft = false); + virtual ~SolverQueueItemInstall(); + + // ---------------------------------- I/O + + virtual std::ostream & dumpOn( std::ostream & str ) const; + + friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemInstall & obj) + { return obj.dumpOn (str); } + + // ---------------------------------- accessors + + bool isSoft (void) const { return _soft; } + + // ---------------------------------- methods + + virtual SolverQueueItem_Ptr copy (void) const; + virtual int cmp (SolverQueueItem_constPtr item) const; +}; + +/////////////////////////////////////////////////////////////////// + };// namespace detail + ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + };// namespace solver + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// +};// namespace zypp +///////////////////////////////////////////////////////////////////////// + +#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALL_H Added: trunk/libzypp/zypp/sat/SolverQueueItemInstallOneOf.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolverQueueItemInstallOneOf.cc?rev=9619&view=auto ============================================================================== --- trunk/libzypp/zypp/sat/SolverQueueItemInstallOneOf.cc (added) +++ trunk/libzypp/zypp/sat/SolverQueueItemInstallOneOf.cc Mon Apr 14 19:33:35 2008 @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* SolverQueueItem.cc + * + * Copyright (C) 2008 SUSE Linux Products GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include "zypp/base/Logger.h" +#include "zypp/sat/SolverQueueItemInstallOneOf.h" + +///////////////////////////////////////////////////////////////////////// +namespace zypp +{ /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + namespace solver + { ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + namespace detail + { /////////////////////////////////////////////////////////////////// + +using namespace std; + +IMPL_PTR_TYPE(SolverQueueItemInstallOneOf); + +//--------------------------------------------------------------------------- + +std::ostream & +SolverQueueItemInstallOneOf::dumpOn( std::ostream & os ) const +{ + os << "[" << (_soft?"Soft":"") << "InstallOneOf: "; + for (PoolItemList::const_iterator iter = _oneOfList.begin(); + iter != _oneOfList.end(); + iter++) + os << *iter; + + return os; +} + +//--------------------------------------------------------------------------- + +SolverQueueItemInstallOneOf::SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList, bool soft) + : SolverQueueItem (QUEUE_ITEM_TYPE_INSTALL_ONE_OF, pool) + , _oneOfList (itemList) + , _soft (soft) +{ +} + + +SolverQueueItemInstallOneOf::~SolverQueueItemInstallOneOf() +{ +} + +//--------------------------------------------------------------------------- + +SolverQueueItem_Ptr +SolverQueueItemInstallOneOf::copy (void) const +{ + SolverQueueItemInstallOneOf_Ptr new_installOneOf = new SolverQueueItemInstallOneOf (pool(), _oneOfList, _soft); + new_installOneOf->SolverQueueItem::copy(this); + + new_installOneOf->_soft = _soft; + return new_installOneOf; +} + + +//--------------------------------------------------------------------------- + + +/////////////////////////////////////////////////////////////////// + };// namespace detail + ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + };// namespace solver + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// +};// namespace zypp +///////////////////////////////////////////////////////////////////////// Added: trunk/libzypp/zypp/sat/SolverQueueItemInstallOneOf.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolverQueueItemInstallOneOf.h?rev=9619&view=auto ============================================================================== --- trunk/libzypp/zypp/sat/SolverQueueItemInstallOneOf.h (added) +++ trunk/libzypp/zypp/sat/SolverQueueItemInstallOneOf.h Mon Apr 14 19:33:35 2008 @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* QueueItem.h + * + * Copyright (C) 2008 SUSE Linux Products GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALLONEOF_H +#define ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALLONEOF_H + +#include <iosfwd> +#include <string> + +#include "zypp/sat/SolverQueueItem.h" + +///////////////////////////////////////////////////////////////////////// +namespace zypp +{ /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + namespace solver + { ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + namespace detail + { /////////////////////////////////////////////////////////////////// + +DEFINE_PTR_TYPE(SolverQueueItemInstallOneOf); + + +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : SolverQueueItemInstallOneOf + +class SolverQueueItemInstallOneOf : public SolverQueueItem { + + public: + typedef std::list<PoolItem> PoolItemList; + + private: + + PoolItemList _oneOfList; // List of candidates + bool _soft; // if triggered by a soft requirement (a recommends) + + public: + + SolverQueueItemInstallOneOf (const ResPool & pool, const PoolItemList & itemList, bool soft = false); + virtual ~SolverQueueItemInstallOneOf(); + + // ---------------------------------- I/O + + virtual std::ostream & dumpOn( std::ostream & str ) const; + + friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemInstallOneOf & obj) + { return obj.dumpOn (str); } + + // ---------------------------------- accessors + + bool isSoft (void) const { return _soft; } + + // ---------------------------------- methods + + virtual SolverQueueItem_Ptr copy (void) const; + virtual int cmp (SolverQueueItem_constPtr item) const; +}; + +/////////////////////////////////////////////////////////////////// + };// namespace detail + ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + };// namespace solver + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// +};// namespace zypp +///////////////////////////////////////////////////////////////////////// + +#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMINSTALLONEOF_H Added: trunk/libzypp/zypp/sat/SolverQueueItemUpdate.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolverQueueItemUpdate.cc?rev=9619&view=auto ============================================================================== --- trunk/libzypp/zypp/sat/SolverQueueItemUpdate.cc (added) +++ trunk/libzypp/zypp/sat/SolverQueueItemUpdate.cc Mon Apr 14 19:33:35 2008 @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* SolverQueueItem.cc + * + * Copyright (C) 2008 SUSE Linux Products GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include "zypp/base/Logger.h" +#include "zypp/sat/SolverQueueItemUpdate.h" + +///////////////////////////////////////////////////////////////////////// +namespace zypp +{ /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + namespace solver + { ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + namespace detail + { /////////////////////////////////////////////////////////////////// + +using namespace std; + +IMPL_PTR_TYPE(SolverQueueItemUpdate); + +//--------------------------------------------------------------------------- + +std::ostream & +SolverQueueItemUpdate::dumpOn( std::ostream & os ) const +{ + os << "[" << (_soft?"Soft":"") << "Update: "; + os << _item; + + return os; +} + +//--------------------------------------------------------------------------- + +SolverQueueItemUpdate::SolverQueueItemUpdate (const ResPool & pool, + const PoolItem & item, bool soft) + : SolverQueueItem (QUEUE_ITEM_TYPE_UPDATE, pool) + , _item (item) + , _soft (soft) +{ +} + + +SolverQueueItemUpdate::~SolverQueueItemUpdate() +{ +} + +//--------------------------------------------------------------------------- + +SolverQueueItem_Ptr +SolverQueueItemUpdate::copy (void) const +{ + SolverQueueItemUpdate_Ptr new_update = new SolverQueueItemUpdate (pool(), _item); + new_update->SolverQueueItem::copy(this); + + new_update->_soft = _soft; + return new_update; +} + + +//--------------------------------------------------------------------------- + + +/////////////////////////////////////////////////////////////////// + };// namespace detail + ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + };// namespace solver + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// +};// namespace zypp +///////////////////////////////////////////////////////////////////////// Added: trunk/libzypp/zypp/sat/SolverQueueItemUpdate.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolverQueueItemUpdate.h?rev=9619&view=auto ============================================================================== --- trunk/libzypp/zypp/sat/SolverQueueItemUpdate.h (added) +++ trunk/libzypp/zypp/sat/SolverQueueItemUpdate.h Mon Apr 14 19:33:35 2008 @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* QueueItem.h + * + * Copyright (C) 2008 SUSE Linux Products GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMUPDATE_H +#define ZYPP_SOLVER_DETAIL_QUEUEITEMUPDATE_H + +#include <iosfwd> +#include <string> + +#include "zypp/sat/SolverQueueItem.h" +#include "zypp/PoolItem.h" + +///////////////////////////////////////////////////////////////////////// +namespace zypp +{ /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + namespace solver + { ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + namespace detail + { /////////////////////////////////////////////////////////////////// + +DEFINE_PTR_TYPE(SolverQueueItemUpdate); + + +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : SolverQueueItemUpdate + +class SolverQueueItemUpdate : public SolverQueueItem { + + private: + + PoolItem _item; // the item to-be-updated + bool _soft; // if triggered by a soft requirement (a recommends) + + public: + + SolverQueueItemUpdate (const ResPool & pool, const PoolItem & item, bool soft = false); + virtual ~SolverQueueItemUpdate(); + + // ---------------------------------- I/O + + virtual std::ostream & dumpOn( std::ostream & str ) const; + + friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemUpdate & obj) + { return obj.dumpOn (str); } + + // ---------------------------------- accessors + + bool isSoft (void) const { return _soft; } + + // ---------------------------------- methods + + virtual SolverQueueItem_Ptr copy (void) const; + virtual int cmp (SolverQueueItem_constPtr item) const; +}; + +/////////////////////////////////////////////////////////////////// + };// namespace detail + ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + };// namespace solver + /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// +};// namespace zypp +///////////////////////////////////////////////////////////////////////// + +#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMUPDATE_H -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
schubi2@svn.opensuse.org