diff --git a/samples/blackmisc/sampleschangeobject.cpp b/samples/blackmisc/sampleschangeobject.cpp index acfc874cd..b4c418e7b 100644 --- a/samples/blackmisc/sampleschangeobject.cpp +++ b/samples/blackmisc/sampleschangeobject.cpp @@ -70,7 +70,7 @@ namespace BlackMiscTest // now Jane's time is over CPropertyIndexVariantMap anotherController; anotherController.addValue(CAtcStation::IndexController, CVariant::fromValue(CUser("445566", "Fuzzy"))); - atcList.applyIf(newController, anotherController); + atcList.applyIf(BlackMisc::Predicates::Equals(newController), anotherController); qDebug() << "-- after update via value map"; qDebug() << atcList.toQString(); diff --git a/src/blackmisc/containerbase.h b/src/blackmisc/containerbase.h index 9691b33b5..2abb189cf 100644 --- a/src/blackmisc/containerbase.h +++ b/src/blackmisc/containerbase.h @@ -13,7 +13,6 @@ #define BLACKMISC_CONTAINERBASE_H #include "range.h" -#include "propertyindexvariantmap.h" #include "blackmiscfreefunctions.h" #include "predicates.h" #include "json.h" diff --git a/src/blackmisc/propertyindexvariantmap.h b/src/blackmisc/propertyindexvariantmap.h index 410f8b173..6a2e35a27 100644 --- a/src/blackmisc/propertyindexvariantmap.h +++ b/src/blackmisc/propertyindexvariantmap.h @@ -14,20 +14,13 @@ #include "variant.h" #include "valueobject.h" -#include "propertyindex.h" +#include "propertyindexlist.h" #include "blackmiscexport.h" - -// a) "propertyindex.h" needed for QMap below, despite forward declaration -// b) "propertyindexlist.h" here causes circular dependencies - #include #include namespace BlackMisc { - // forward declaration - class CPropertyIndex; - class CPropertyIndexList; /*! * Specialized value object compliant map for variants, diff --git a/src/blackmisc/range.h b/src/blackmisc/range.h index 3389a6565..929f33ed9 100644 --- a/src/blackmisc/range.h +++ b/src/blackmisc/range.h @@ -13,10 +13,10 @@ #define BLACKMISC_RANGE_H #include "blackmiscexport.h" -#include "propertyindexvariantmap.h" #include "iterator.h" #include "predicates.h" #include +#include #include #include #include @@ -71,12 +71,6 @@ namespace BlackMisc inline auto findBy(K0 k0, V0 v0, KeysValues... keysValues) const -> CRange>; - /*! - * \brief Return a copy containing only those elements matching a given value map. - */ - inline auto findBy(CPropertyIndexVariantMap valueMap) const - -> CRange>; - /*! * \brief Return true if there is an element for which a given predicate returns true. */ @@ -268,13 +262,6 @@ namespace BlackMisc return findBy(BlackMisc::Predicates::MemberEqual(k0, v0, keysValues...)); } - template - auto CRangeBase::findBy(CPropertyIndexVariantMap valueMap) const - -> CRange> - { - return findBy(BlackMisc::Predicates::Equals(std::move(valueMap))); - } - } #endif // guard diff --git a/src/blackmisc/sequence.h b/src/blackmisc/sequence.h index 280e7ad2d..5c10d4c6b 100644 --- a/src/blackmisc/sequence.h +++ b/src/blackmisc/sequence.h @@ -352,8 +352,8 @@ namespace BlackMisc * \brief Modify by applying a value map to each element for which a given predicate returns true. * \return The number of elements modified. */ - template - int applyIf(Predicate p, const CPropertyIndexVariantMap &newValues, bool skipEqualValues = false) + template + int applyIf(Predicate p, const VariantMap &newValues, bool skipEqualValues = false) { int count = 0; for (auto &value : *this) @@ -371,21 +371,12 @@ namespace BlackMisc * \param skipEqualValues Equal values will not be updated * \return The number of elements modified. */ - template - int applyIf(K1 key1, V1 value1, const CPropertyIndexVariantMap &newValues, bool skipEqualValues = false) + template + int applyIf(K1 key1, V1 value1, const VariantMap &newValues, bool skipEqualValues = false) { return applyIf(BlackMisc::Predicates::MemberEqual(key1, value1), newValues, skipEqualValues); } - /*! - * \brief Modify by applying a value map to each element matching a given value map. - * \return The number of elements modified. - */ - int applyIf(const CPropertyIndexVariantMap &pattern, const CPropertyIndexVariantMap &newValues, bool skipEqualValues = false) - { - return applyIf([ & ](const T & value) { return value == pattern; }, newValues, skipEqualValues); - } - /*! * \brief Remove all elements equal to the given object, if it is contained. * \pre The sequence must be initialized.