Author: mlandres
Date: Tue Apr 8 17:12:11 2008
New Revision: 9471
URL: http://svn.opensuse.org/viewcvs/zypp?rev=9471&view=rev
Log:
- Fix some Patch and Pattern attributes.
- Prepare Patch and Pattern contents.
Added:
trunk/libzypp/zypp/base/Tr1hash.h
trunk/libzypp/zypp/sat/SolvableSet.cc
trunk/libzypp/zypp/sat/SolvableSet.h
Modified:
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/Capability.h
trunk/libzypp/zypp/Locale.h
trunk/libzypp/zypp/Message.h
trunk/libzypp/zypp/Patch.cc
trunk/libzypp/zypp/Patch.h
trunk/libzypp/zypp/Pattern.cc
trunk/libzypp/zypp/Pattern.h
trunk/libzypp/zypp/ResObject.h
trunk/libzypp/zypp/base/LogTools.h
trunk/libzypp/zypp/pool/PoolTraits.h
trunk/libzypp/zypp/sat/SolvAttr.cc
trunk/libzypp/zypp/sat/SolvAttr.h
trunk/libzypp/zypp/sat/Solvable.h
trunk/libzypp/zypp/sat/WhatProvides.cc
trunk/libzypp/zypp/sat/detail/PoolImpl.h
trunk/libzypp/zypp/sat/detail/PoolMember.h
trunk/libzypp/zypp/ui/PatternExpander.cc
Modified: trunk/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Tue Apr 8 17:12:11 2008
@@ -242,6 +242,7 @@
base/String.h
base/Regex.h
base/Sysconfig.h
+ base/Tr1hash.h
base/Unit.h
base/WatchFile.h
)
@@ -513,6 +514,7 @@
SET( zypp_sat_SRCS
sat/Pool.cc
sat/Solvable.cc
+ sat/SolvableSet.cc
sat/WhatProvides.cc
sat/LocaleSupport.cc
sat/LookupAttr.cc
@@ -523,6 +525,7 @@
SET( zypp_sat_HEADERS
sat/Pool.h
sat/Solvable.h
+ sat/SolvableSet.h
sat/WhatProvides.h
sat/LocaleSupport.h
sat/LookupAttr.h
Modified: trunk/libzypp/zypp/Capability.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Capability.h?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/Capability.h (original)
+++ trunk/libzypp/zypp/Capability.h Tue Apr 8 17:12:11 2008
@@ -13,7 +13,6 @@
#define ZYPP_CAPABILITY_H
#include <iosfwd>
-#include
#include "zypp/base/SafeBool.h"
#include "zypp/base/Deprecated.h"
Modified: trunk/libzypp/zypp/Locale.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Locale.h?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/Locale.h (original)
+++ trunk/libzypp/zypp/Locale.h Tue Apr 8 17:12:11 2008
@@ -13,9 +13,9 @@
#define ZYPP_LOCALE_H
#include <iosfwd>
-#include
#include "zypp/base/PtrTypes.h"
+#include "zypp/base/Tr1hash.h"
#include "zypp/IdString.h"
#include "zypp/LanguageCode.h"
Modified: trunk/libzypp/zypp/Message.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Message.h?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/Message.h (original)
+++ trunk/libzypp/zypp/Message.h Tue Apr 8 17:12:11 2008
@@ -12,6 +12,7 @@
#ifndef ZYPP_MESSAGE_H
#define ZYPP_MESSAGE_H
+#include "zypp/TranslatedText.h"
#include "zypp/ResObject.h"
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/Patch.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Patch.cc?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/Patch.cc (original)
+++ trunk/libzypp/zypp/Patch.cc Tue Apr 8 17:12:11 2008
@@ -10,6 +10,7 @@
*
*/
#include "zypp/Patch.h"
+#include "zypp/Message.h"
///////////////////////////////////////////////////////////////////
namespace zypp
@@ -40,89 +41,41 @@
//
///////////////////////////////////////////////////////////////////
- std::string Patch::id() const
- { return std::string(); }
-
- Date Patch::timestamp() const
- { return Date(); }
-
std::string Patch::category() const
- { return std::string(); }
+ { return lookupStrAttribute( sat::SolvAttr::patchcategory ); }
bool Patch::reboot_needed() const
- { return false; }
+ { return lookupBoolAttribute( sat::SolvAttr::needReboot ); }
bool Patch::affects_pkg_manager() const
- { return false; }
+ { return lookupBoolAttribute( sat::SolvAttr::needRestart ); }
-#warning Implement PATCH::ATOMS
-#if 0
- Patch::AtomList Patch::atoms() const
+ bool Patch::interactive() const
{
- if ( ! _atomlist )
+ if ( reboot_needed()
+ || ! licenseToConfirm().empty() )
+ {
+ return true;
+ }
+
+ Patch::Contents c( contents() );
+ for_( it, c.begin(), c.end() )
+ {
+ if ( it->isKind( ResKind::message )
+ || ! licenseToConfirm().empty() )
{
- if ( ! hasBackRef() )
- {
- // We are not jet connected to the Resolvable that
- // contains our dependencies.
- return AtomList();
- }
-
- // lazy init
- _atomlist.reset( new AtomList );
-
- // Build the list using the repositories resolvables.
- // Installed Patches (no repository) have this method overloaded.
- if ( repository() )
- {
- const CapSet & requires( self()->dep( Dep::REQUIRES ) );
- const ResStore & store( repository().resolvables() );
-
- for_( req, requires.begin(), requires.end() )
- {
- // lookup Patch requirements that refer to an Atom, Script or Message.
- if ( refersTo<Atom>( *req ) || refersTo<Script>( *req ) || refersTo<Message>( *req ) )
- {
- for_( res, store.begin(), store.end() )
- {
- // Collect ALL matches in the store.
- if ( hasMatches( (*res)->dep( Dep::PROVIDES ), (*req) ) )
- {
- _atomlist->push_back( *res );
- }
- }
- }
- }
- }
+ return true;
}
- return *_atomlist;
- return AtomList();
+ }
+
+ return false;
}
-#endif
- bool Patch::interactive() const
- {
-#warning Implement PATCH::INTERACTIVE
-#if 0
- if ( reboot_needed()
- || ! licenseToConfirm().empty() )
- {
- return true;
- }
-
- AtomList atoms = all_atoms();
- for ( AtomList::const_iterator it = atoms.begin(); it != atoms.end(); it++)
- {
- if ( isKind<Message>( *it )
- || ! licenseToConfirm().empty() )
- {
- return true;
- }
- }
- return false;
-#endif
- return false;
+ Patch::Contents Patch::contents() const
+ {
+#warning FILL contents
+ return Contents();
}
/////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/Patch.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Patch.h?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/Patch.h (original)
+++ trunk/libzypp/zypp/Patch.h Tue Apr 8 17:12:11 2008
@@ -30,39 +30,52 @@
*/
class Patch : public ResObject
{
- public:
- typedef Patch Self;
- typedef ResTraits<Self> TraitsType;
- typedef TraitsType::PtrType Ptr;
- typedef TraitsType::constPtrType constPtr;
-
- public:
- typedef std::listResObject::Ptr AtomList;
-
- public:
- /** Patch ID */
- std::string id() const;
- /** Patch time stamp */
- Date timestamp() const;
- /** Patch category (recommended, security,...) */
- std::string category() const;
- /** Does the system need to reboot to finish the update process? */
- bool reboot_needed() const;
- /** Does the patch affect the package manager itself? */
- bool affects_pkg_manager() const;
- /** Is the patch installation interactive? (does it need user input?) */
- bool interactive() const;
-
- /** The list of all atoms building the patch */
- ZYPP_DEPRECATED AtomList atoms() const
- { return AtomList(); }
-
- protected:
- friend Ptr make<Self>( const sat::Solvable & solvable_r );
- /** Ctor */
- Patch( const sat::Solvable & solvable_r );
- /** Dtor */
- virtual ~Patch();
+ public:
+ typedef Patch Self;
+ typedef ResTraits<Self> TraitsType;
+ typedef TraitsType::PtrType Ptr;
+ typedef TraitsType::constPtrType constPtr;
+
+ public:
+ typedef sat::SolvableSet Contents;
+
+ public:
+ /** Patch time stamp */
+ Date timestamp() const
+ { return buildtime(); }
+ /** Patch category (recommended, security,...) */
+ std::string category() const;
+ /** Does the system need to reboot to finish the update process? */
+ bool reboot_needed() const;
+ /** Does the patch affect the package manager itself? */
+ bool affects_pkg_manager() const;
+ /** Is the patch installation interactive? (does it need user input?) */
+ bool interactive() const;
+
+ public:
+ /** The collection of packages associated with this patch. */
+ Contents contents() const;
+
+ public:
+ /** Patch ID
+ * \deprecated Seems to be unsused autobuild interal data?
+ */
+ ZYPP_DEPRECATED std::string id() const
+ { return std::string(); }
+
+ /** The list of all atoms building the patch
+ * \deprecated Try contents().
+ */
+ typedef std::listResObject::Ptr AtomList;
+ ZYPP_DEPRECATED AtomList atoms() const
+ { return AtomList(); }
+
+ protected:
+ friend Ptr make<Self>( const sat::Solvable & solvable_r );
+ /** Ctor */
+ Patch( const sat::Solvable & solvable_r );
+ /** Dtor */
+ virtual ~Patch();
};
/////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/Pattern.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Pattern.cc?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/Pattern.cc (original)
+++ trunk/libzypp/zypp/Pattern.cc Tue Apr 8 17:12:11 2008
@@ -10,9 +10,12 @@
*
*/
#include <iostream>
+#include "zypp/base/Logger.h"
#include "zypp/Pattern.h"
+using std::endl;
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
@@ -91,20 +94,21 @@
}
#endif
-#warning implement PATTERN::INSTALL_PACKAGES
- const Capabilities & Pattern::includes() const
- {
- static Capabilities _val;
- return _val;
- }
+ Pattern::NameList Pattern::includes() const
+ { return NameList( sat::SolvAttr::includes, satSolvable() ); }
+
+ Pattern::NameList Pattern::extends() const
+ { return NameList( sat::SolvAttr::extends, satSolvable() ); }
- const Capabilities & Pattern::extends() const
+ Pattern::Contents Pattern::contents() const
{
- static Capabilities _val;
- return _val;
+#warning FILL contents
+ ERR << *this << endl;
+ WAR << " includes: " << includes() << endl;
+ WAR << " extends: " << extends() << endl;
+ return Contents();
}
-
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/Pattern.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Pattern.h?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/Pattern.h (original)
+++ trunk/libzypp/zypp/Pattern.h Tue Apr 8 17:12:11 2008
@@ -29,40 +29,47 @@
*/
class Pattern : public ResObject
{
- public:
- typedef Pattern Self;
- typedef ResTraits<Self> TraitsType;
- typedef TraitsType::PtrType Ptr;
- typedef TraitsType::constPtrType constPtr;
-
- public:
- typedef sat::ArrayAttr NameList;
-
- public:
- /** */
- bool isDefault() const;
- /** */
- bool userVisible() const;
- /** */
- std::string category( const Locale & lang_r = Locale() ) const;
- /** */
- Pathname icon() const;
- /** */
- Pathname script() const;
- /** */
- std::string order() const;
-
- /** Ui hint. */
- const Capabilities & includes() const;
- /** Ui hint. */
- const Capabilities & extends() const;
-
- protected:
- friend Ptr make<Self>( const sat::Solvable & solvable_r );
- /** Ctor */
- Pattern( const sat::Solvable & solvable_r );
- /** Dtor */
- virtual ~Pattern();
+ public:
+ typedef Pattern Self;
+ typedef ResTraits<Self> TraitsType;
+ typedef TraitsType::PtrType Ptr;
+ typedef TraitsType::constPtrType constPtr;
+
+ public:
+ typedef sat::ArrayAttr NameList;
+ typedef sat::SolvableSet Contents;
+
+ public:
+ /** */
+ bool isDefault() const;
+ /** */
+ bool userVisible() const;
+ /** */
+ std::string category( const Locale & lang_r = Locale() ) const;
+ /** */
+ Pathname icon() const;
+ /** */
+ Pathname script() const;
+ /** */
+ std::string order() const;
+
+ public:
+ /** Ui hint. */
+ NameList includes() const;
+ /** Ui hint. */
+ NameList extends() const;
+
+ /** The collection of packages associated with this patch.
+ * This also evaluates the patterns includes/extends relation.
+ */
+ Contents contents() const;
+
+ protected:
+ friend Ptr make<Self>( const sat::Solvable & solvable_r );
+ /** Ctor */
+ Pattern( const sat::Solvable & solvable_r );
+ /** Dtor */
+ virtual ~Pattern();
};
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/ResObject.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResObject.h?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResObject.h (original)
+++ trunk/libzypp/zypp/ResObject.h Tue Apr 8 17:12:11 2008
@@ -24,8 +24,7 @@
#include "zypp/Repository.h"
#include "zypp/sat/LookupAttr.h"
-
-#include "zypp/TranslatedText.h"
+#include "zypp/sat/SolvableSet.h"
///////////////////////////////////////////////////////////////////
namespace zypp
Modified: trunk/libzypp/zypp/base/LogTools.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/LogTools.h?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/base/LogTools.h (original)
+++ trunk/libzypp/zypp/base/LogTools.h Tue Apr 8 17:12:11 2008
@@ -18,8 +18,8 @@
#include <list>
#include <set>
#include <map>
-#include
-#include
+
+#include "zypp/base/Tr1hash.h"
#include "zypp/base/Logger.h"
#include "zypp/base/Iterator.h"
#include "zypp/base/Deprecated.h"
Added: trunk/libzypp/zypp/base/Tr1hash.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/Tr1hash.h?rev=9471&view=auto
==============================================================================
--- trunk/libzypp/zypp/base/Tr1hash.h (added)
+++ trunk/libzypp/zypp/base/Tr1hash.h Tue Apr 8 17:12:11 2008
@@ -0,0 +1,55 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/base/Tr1hash.h
+ *
+*/
+#ifndef ZYPP_BASE_TR1HASH_H
+#define ZYPP_BASE_TR1HASH_H
+
+#include <iosfwd>
+#include
+#include
+
+#include "zypp/base/PtrTypes.h"
+
+/** Define hash function for id based classes.
+ * Class has to provide a method \c id() retuning a unique number.
+ * \code
+ * // in global namespace define:
+ * ZYPP_DEFINE_ID_HASHABLE( ::zypp::sat::Sovable )
+ * \endcode
+ */
+#define ZYPP_DEFINE_ID_HASHABLE(C) \
+namespace std { namespace tr1 { \
+ template<class _Tp> struct hash; \
+ template<> struct hash<C> \
+ { \
+ size_t operator()( const C & __s ) const \
+ { return __s.id(); } \
+ }; \
+}}
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ /** clone function for RW_pointer */
+ template<class _D>
+ inline std::tr1::unordered_set<_D> * rwcowClone( const std::tr1::unordered_set<_D> * rhs )
+ { return new std::tr1::unordered_set<_D>( *rhs ); }
+
+ /** clone function for RW_pointer */
+ template
+ inline std::tr1::unordered_map<_K,_V> * rwcowClone( const std::tr1::unordered_map<_K,_V> * rhs )
+ { return new std::tr1::unordered_map<_K,_V>( *rhs ); }
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_BASE_TR1HASH_H
Modified: trunk/libzypp/zypp/pool/PoolTraits.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/pool/PoolTraits.h?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/pool/PoolTraits.h (original)
+++ trunk/libzypp/zypp/pool/PoolTraits.h Tue Apr 8 17:12:11 2008
@@ -16,10 +16,9 @@
#include <map>
#include <list>
#include <vector>
-#include
#include "zypp/base/Iterator.h"
-#include "zypp/base/Iterator.h"
+#include "zypp/base/Tr1hash.h"
#include "zypp/PoolItem.h"
#include "zypp/sat/Pool.h"
Modified: trunk/libzypp/zypp/sat/SolvAttr.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolvAttr.cc?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/SolvAttr.cc (original)
+++ trunk/libzypp/zypp/sat/SolvAttr.cc Tue Apr 8 17:12:11 2008
@@ -33,7 +33,7 @@
#warning STILL ATTRIBUTES HERE WHICH ARE NOT PROVIDED BY SOLV FILES
// At least the ones that do nat have a satsolver/knownid.
- const SolvAttr SolvAttr::name ( SOLVABLE_NAME );
+ const SolvAttr SolvAttr::name ( SOLVABLE_NAME );
const SolvAttr SolvAttr::summary ( SOLVABLE_SUMMARY ); // translated
const SolvAttr SolvAttr::description ( SOLVABLE_DESCRIPTION ); // translated
const SolvAttr SolvAttr::insnotify ( SOLVABLE_MESSAGEINS ); // translated
@@ -68,6 +68,8 @@
// patch
const SolvAttr SolvAttr::patchcategory( SOLVABLE_PATCHCATEGORY );
+ const SolvAttr SolvAttr::needReboot ( UPDATE_REBOOT );
+ const SolvAttr SolvAttr::needRestart ( UPDATE_RESTART );
//pattern
const SolvAttr SolvAttr::isvisible ( SOLVABLE_ISVISIBLE );
Modified: trunk/libzypp/zypp/sat/SolvAttr.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolvAttr.h?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/SolvAttr.h (original)
+++ trunk/libzypp/zypp/sat/SolvAttr.h Tue Apr 8 17:12:11 2008
@@ -76,6 +76,8 @@
// patch
static const SolvAttr patchcategory;
+ static const SolvAttr needReboot;
+ static const SolvAttr needRestart;
// patern
static const SolvAttr isvisible;
Modified: trunk/libzypp/zypp/sat/Solvable.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/Solvable.h?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/Solvable.h (original)
+++ trunk/libzypp/zypp/sat/Solvable.h Tue Apr 8 17:12:11 2008
@@ -301,4 +301,7 @@
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
+
+ZYPP_DEFINE_ID_HASHABLE( ::zypp::sat::Solvable )
+
#endif // ZYPP_SAT_SOLVABLE_H
Added: trunk/libzypp/zypp/sat/SolvableSet.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolvableSet.cc?rev=9471&view=auto
==============================================================================
--- trunk/libzypp/zypp/sat/SolvableSet.cc (added)
+++ trunk/libzypp/zypp/sat/SolvableSet.cc Tue Apr 8 17:12:11 2008
@@ -0,0 +1,41 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/sat/SolvableSet.cc
+ *
+*/
+#include <iostream>
+#include "zypp/base/LogTools.h"
+
+#include "zypp/sat/SolvableSet.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace sat
+ { /////////////////////////////////////////////////////////////////
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : operator<<
+ ** FUNCTION TYPE : std::ostream &
+ */
+ std::ostream & operator<<( std::ostream & str, const SolvableSet & obj )
+ {
+ return dumpRange( str, obj.begin(), obj.end() );
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace sat
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp/sat/SolvableSet.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SolvableSet.h?rev=9471&view=auto
==============================================================================
--- trunk/libzypp/zypp/sat/SolvableSet.h (added)
+++ trunk/libzypp/zypp/sat/SolvableSet.h Tue Apr 8 17:12:11 2008
@@ -0,0 +1,93 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/sat/SolvableSet.h
+ *
+*/
+#ifndef ZYPP_SAT_SOLVABLESET_H
+#define ZYPP_SAT_SOLVABLESET_H
+
+#include <iosfwd>
+
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/Tr1hash.h"
+#include "zypp/sat/Solvable.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace sat
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : SolvableSet
+ //
+ /** Solvable set wrapper to allow adding additioanal convenience iterators.
+ */
+ class SolvableSet
+ {
+ friend std::ostream & operator<<( std::ostream & str, const SolvableSet & obj );
+
+ public:
+ typedef std::tr1::unordered_set<Solvable> Container;
+ typedef Container::value_type value_type;
+ typedef Container::size_type size_type;
+ typedef Container::const_iterator const_iterator;
+
+ public:
+ /** Default ctor */
+ SolvableSet()
+ : _pimpl( new Container )
+ {}
+
+ /** Ctor building a set from a range. */
+ template<class _InputIterator>
+ SolvableSet( _InputIterator begin_r, _InputIterator end_r )
+ : _pimpl( new Container( begin_r, end_r ) )
+ {}
+
+ public:
+ /** Whether the set is epmty. */
+ bool empty() const
+ { return _pimpl->empty(); }
+
+ /** Size of the set. */
+ size_type size() const
+ { return _pimpl->size(); }
+
+ /** Iterator pointing to the first \ref Solvable. */
+ const_iterator begin() const
+ { return _pimpl->begin(); }
+
+ /** Iterator pointing behind the last \ref Solvable. */
+ const_iterator end() const
+ { return _pimpl->end(); }
+
+ public:
+ /** The set. */
+ Container & get()
+ { return *_pimpl; }
+
+ private:
+ /** Pointer to implementation */
+ RWCOW_pointer<Container> _pimpl;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates SolvableSet Stream output */
+ std::ostream & operator<<( std::ostream & str, const SolvableSet & obj );
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace sat
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SAT_SOLVABLESET_H
Modified: trunk/libzypp/zypp/sat/WhatProvides.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/WhatProvides.cc?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/WhatProvides.cc (original)
+++ trunk/libzypp/zypp/sat/WhatProvides.cc Tue Apr 8 17:12:11 2008
@@ -10,7 +10,6 @@
*
*/
#include <iostream>
-#include
#include "zypp/base/LogTools.h"
#include "zypp/sat/WhatProvides.h"
Modified: trunk/libzypp/zypp/sat/detail/PoolImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/detail/PoolImpl.h?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/detail/PoolImpl.h (original)
+++ trunk/libzypp/zypp/sat/detail/PoolImpl.h Tue Apr 8 17:12:11 2008
@@ -20,8 +20,8 @@
#include
}
#include <iosfwd>
-#include
+#include "zypp/base/Tr1hash.h"
#include "zypp/base/NonCopyable.h"
#include "zypp/base/SerialNumber.h"
#include "zypp/sat/detail/PoolMember.h"
Modified: trunk/libzypp/zypp/sat/detail/PoolMember.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/detail/PoolMember.h?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/detail/PoolMember.h (original)
+++ trunk/libzypp/zypp/sat/detail/PoolMember.h Tue Apr 8 17:12:11 2008
@@ -12,6 +12,7 @@
#ifndef ZYPP_SAT_DETAIL_POOLMEMBER_H
#define ZYPP_SAT_DETAIL_POOLMEMBER_H
+#include "zypp/base/Tr1hash.h"
#include "zypp/base/Iterator.h"
#include "zypp/base/String.h"
#include "zypp/base/Easy.h"
@@ -23,16 +24,6 @@
struct _Pool;
}
-#define ZYPP_DEFINE_ID_HASHABLE(C) \
-namespace std { namespace tr1 { \
- template<class _Tp> struct hash; \
- template<> struct hash<C> \
- { \
- size_t operator()( const C & __s ) const \
- { return __s.id(); } \
- }; \
-}}
-
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/ui/PatternExpander.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ui/PatternExpander.cc?rev=9471&r1=9470&r2=9471&view=diff
==============================================================================
--- trunk/libzypp/zypp/ui/PatternExpander.cc (original)
+++ trunk/libzypp/zypp/ui/PatternExpander.cc Tue Apr 8 17:12:11 2008
@@ -79,12 +79,11 @@
/** Store all included patterns in \c _patternMap. */
void expandIncludes( const Pattern::constPtr & pat_r )
{
- if ( ! pat_r->includes().empty() )
- {
- std::for_each( pat_r->includes().begin(),
- pat_r->includes().end(),
- bind( &Impl::expandInclude, this, _1 ) );
- }
+ Pattern::NameList c( pat_r->includes() );
+ for_( it, c.begin(), c.end() )
+ {
+ expandInclude( Capability( it->c_str(), ResKind::pattern ) );
+ }
}
/** Store Patterns matching an \c Includes capability in \c _patternMap. */
@@ -101,9 +100,12 @@
/** Store all patterns extending \c pat_r in \c _patternMap. */
void expandExtending( const Pattern::constPtr & pat_r )
{
- std::for_each( _pool.byKindBegin<Pattern>(),
- _pool.byKindEnd<Pattern>(),
- bind( &Impl::expandIfExtends, this, pat_r, _1 ) );
+ Pattern::NameList c( pat_r->extends() );
+ for_( it, c.begin(), c.end() )
+ {
+#warning TBD
+ //expandIfExtends( pat_r, Capability( it->c_str(), ResKind::pattern ) );
+ }
}
/** Store \c extending_r if it extends \c pat_r. */
@@ -113,6 +115,8 @@
if ( ! extending->extends().empty() )
{
+#warning TBD
+#if 0
if ( std::find_if( extending->extends().begin(),
extending->extends().end(),
bind( &Impl::providedBy, this, pat_r, _1 ) )
@@ -122,6 +126,7 @@
_patternMap[extending];
//DBG << mapEntry(*_patternMap.find(extending)) << endl;
}
+#endif
}
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org