On Wed, Dec 05, Duncan Mac-Vicar Prett wrote:
The API is here: http://svn.opensuse.org/svn/zypp/trunk/libzypp/zypp/CapMatchHelper.h
In short: struct Action { bool operator()( const PoolItem & poolitem_r ) const { // ... return true; } }; ResPool my_pool; Poolitem my_item; Action my_action; // For all items in my_pool which match a my_item OBSOLETES // invoke my_action. // // - i.e. for all items obsoleted by my_item. // forEachPoolItemMatchedBy( my_pool, my_item, Dep::OBSOLETES, OncePerPoolItem( my_action ) ); // For all items in my_pool whose OBSOLETES match my_item // invoke my_action. // // - i.e. for all items obsoleting my_item. // forEachPoolItemMatching( my_pool, dep::OBSOLETES, my_item, OncePerPoolItem( my_action ) ); The actual functor signature is 'function<bool(const CapAndItem &)> '. CapAndItem is a 'Capability/PoolItem' pair containing the Capability that matched and the PoolItem the Capability belongs to. It's not unusual that multiple CapAndItems refer to the same PoolItem. In many cases you want to avoid multiple invocations for the same PoolItem. You may use OncePerPoolItem to perform an action ony once for each PoolItem. -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org