refs #526, added removeIf/replaceOrAdd to viewbase

This commit is contained in:
Klaus Basan
2016-01-02 20:53:22 +01:00
parent 5aa1f3bc94
commit 3daa0ef0cd

View File

@@ -393,6 +393,27 @@ namespace BlackGui
//! Remove selected rows
int removeSelectedRows();
//! \copydoc BlackMisc::CContainerBase::removeIf
template <class K0, class V0, class... KeysValues>
int removeIf(K0 k0, V0 v0, KeysValues... keysValues)
{
if (this->rowCount() < 1) { return 0; }
ContainerType copy(container());
int r = copy.removeIf(k0, v0, keysValues...);
if (r < 1) { return 0; }
this->updateContainerMaybeAsync(copy);
return r;
}
//! \copydoc BlackMisc::CSequence::replaceOrAdd
template <class K1, class V1>
void replaceOrAdd(K1 key1, V1 value1, const ObjectType &replacement)
{
ContainerType copy(container());
copy.replaceOrAdd(key1, value1, replacement);
this->updateContainerMaybeAsync(copy);
}
//! Row count
int rowCount() const;