11#ifndef ZYPP_BASE_SETTRACKER_H
12#define ZYPP_BASE_SETTRACKER_H
165 template <
class TORDERED_SET,
typename enable_if =
typename TORDERED_SET::key_compare>
169 std::set_difference( lhs.begin(), lhs.end(), rhs.begin(), rhs.end(),
171 typename TORDERED_SET::key_compare() );
174 template <
class TUNORDERED_SET,
typename enable_if =
typename TUNORDERED_SET::hasher,
typename =
void>
178 for (
const auto &
l : lhs )
179 {
if ( rhs.find(
l ) == rhs.end() )
result_r.insert(
l ); }
189 template <
class TSet>
191 {
return str <<
"set(" <<
obj.current().size() <<
"|+" <<
obj.added().size() <<
"|-" <<
obj.removed().size() <<
')'; }
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
Track added/removed set items based on an initial set.
std::ostream & operator<<(std::ostream &str, const SetTracker< TSet > &obj)
Stream output.
bool wasRemoved(const key_type &key_r) const
Whether val_r is tracked as removed.
bool setInitial(set_type new_r)
Start tracking a new set (discards previously tracked changes).
TSet::value_type value_type
const set_type & current() const
Return the current set.
set_type & current()
Return the current set.
static void setDifference(const TORDERED_SET &lhs, const TORDERED_SET &rhs, TORDERED_SET &result_r)
static bool find(const set_type &set_r, const key_type &key_r)
SetTracker(set_type initial_r)
Ctor taking an initial set.
bool set(set_type new_r)
Set a new_r set and track changes.
bool add(const value_type &val_r)
Add an element to the set and track changes.
bool wasAdded(const key_type &key_r) const
Whether val_r is tracked as added.
const set_type & added() const
Return the set of added items.
set_type & added()
Return the set of added items.
set_type & removed()
Return the set of removed items.
bool remove(const value_type &val_r)
Remove an element from the set and track changes.
static void setDifference(const TUNORDERED_SET &lhs, const TUNORDERED_SET &rhs, TUNORDERED_SET &result_r)
SetTracker()
Default Ctor: empty set.
const set_type & removed() const
Return the set of removed items.
bool setInitial()
(Re-)Start tracking the current set (discards previously tracked changes).
bool contains(const key_type &key_r) const
Whether val_r is in the set.