From c2ac37f5527b24343803db52f987855023dc610a Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Thu, 29 Oct 2020 22:43:00 +0000 Subject: [PATCH] Issue #77 Remove unused methods --- src/blackgui/components/textmessagecomponent.cpp | 3 ++- src/blackmisc/logmessage.cpp | 5 ----- src/blackmisc/logmessage.h | 3 --- src/blackmisc/mixin/mixinindex.h | 10 ---------- src/blackmisc/valueobject.h | 3 --- src/blackmisc/variant.cpp | 15 --------------- src/blackmisc/variant.h | 3 --- src/blackmisc/variantprivate.h | 10 ---------- 8 files changed, 2 insertions(+), 50 deletions(-) diff --git a/src/blackgui/components/textmessagecomponent.cpp b/src/blackgui/components/textmessagecomponent.cpp index e817b76e7..25316a43a 100644 --- a/src/blackgui/components/textmessagecomponent.cpp +++ b/src/blackgui/components/textmessagecomponent.cpp @@ -203,7 +203,8 @@ namespace BlackGui if (msgSettings.popupSelcalMessages()) { - this->emitDisplayInInfoWindow(CLogMessage(this).info(u"SELCAL received"), 3 * 1000); + CStatusMessage msg = CLogMessage(this).info(u"SELCAL received"); + this->emitDisplayInInfoWindow(CVariant::from(msg), 3 * 1000); } continue; } diff --git a/src/blackmisc/logmessage.cpp b/src/blackmisc/logmessage.cpp index 6c19d83d5..474f52ba5 100644 --- a/src/blackmisc/logmessage.cpp +++ b/src/blackmisc/logmessage.cpp @@ -22,11 +22,6 @@ namespace BlackMisc return { m_categories, m_severity, message() }; } - CLogMessage::operator CVariant() - { - return CVariant::from(static_cast(*this)); - } - CLogMessage::~CLogMessage() { ostream(qtCategory()).noquote() << message(); diff --git a/src/blackmisc/logmessage.h b/src/blackmisc/logmessage.h index 2dcf92183..c5c1480e5 100644 --- a/src/blackmisc/logmessage.h +++ b/src/blackmisc/logmessage.h @@ -49,9 +49,6 @@ namespace BlackMisc //! Convert to CStatusMessage for returning the message directly from the function which generated it. operator CStatusMessage(); - //! Convert to CVariant for returning the message directly from the function which generated it. - operator CVariant(); - //! Sends a verbatim, preformatted message to the log. static void preformatted(const CStatusMessage &statusMessage); diff --git a/src/blackmisc/mixin/mixinindex.h b/src/blackmisc/mixin/mixinindex.h index 0af286968..14ac0e58b 100644 --- a/src/blackmisc/mixin/mixinindex.h +++ b/src/blackmisc/mixin/mixinindex.h @@ -61,9 +61,6 @@ namespace BlackMisc //! Property by index CVariant propertyByIndex(const CPropertyIndex &index) const; - //! Property by index as String - QString propertyByIndexAsString(const CPropertyIndex &index, bool i18n = false) const; - //! Compare for index int comparePropertyByIndex(const CPropertyIndex &index, const Derived &compareValue) const; @@ -109,7 +106,6 @@ namespace BlackMisc using ::BlackMisc::Mixin::Index::apply; \ using ::BlackMisc::Mixin::Index::setPropertyByIndex; \ using ::BlackMisc::Mixin::Index::propertyByIndex; \ - using ::BlackMisc::Mixin::Index::propertyByIndexAsString; \ using ::BlackMisc::Mixin::Index::comparePropertyByIndex; \ using ::BlackMisc::Mixin::Index::equalsPropertyByIndex; // *INDENT-ON* @@ -141,12 +137,6 @@ namespace BlackMisc } } - template - QString Index::propertyByIndexAsString(const CPropertyIndex &index, bool i18n) const - { - return derived()->propertyByIndex(index).toQString(i18n); - } - template bool Index::equalsPropertyByIndex(const CVariant &compareValue, const CPropertyIndex &index) const { diff --git a/src/blackmisc/valueobject.h b/src/blackmisc/valueobject.h index c2588387c..69d193ce4 100644 --- a/src/blackmisc/valueobject.h +++ b/src/blackmisc/valueobject.h @@ -116,9 +116,6 @@ namespace BlackMisc //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex using Mixin::Index::comparePropertyByIndex; - //! \copydoc BlackMisc::Mixin::Index::propertyByIndexAsString - using Mixin::Index::propertyByIndexAsString; - //! \copydoc BlackMisc::Mixin::Index::equalsPropertyByIndex using Mixin::Index::equalsPropertyByIndex; diff --git a/src/blackmisc/variant.cpp b/src/blackmisc/variant.cpp index 71e9512a8..a00283453 100644 --- a/src/blackmisc/variant.cpp +++ b/src/blackmisc/variant.cpp @@ -477,21 +477,6 @@ namespace BlackMisc } } - QString CVariant::propertyByIndexAsString(const CPropertyIndex &index, bool i18n) const - { - auto *meta = getValueObjectMetaInfo(); - Q_ASSERT(meta); - try - { - return meta->propertyByIndexAsString(data(), index, i18n); - } - catch (const Private::CVariantException &ex) - { - CLogMessage(this).debug() << ex.what(); - return {}; - } - } - bool CVariant::equalsPropertyByIndex(const CVariant &compareValue, const CPropertyIndex &index) const { auto *meta = getValueObjectMetaInfo(); diff --git a/src/blackmisc/variant.h b/src/blackmisc/variant.h index 9e8103ce0..eba4b197a 100644 --- a/src/blackmisc/variant.h +++ b/src/blackmisc/variant.h @@ -250,9 +250,6 @@ namespace BlackMisc //! \copydoc BlackMisc::Mixin::Index::propertyByIndex CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; - //! \copydoc BlackMisc::Mixin::Index::propertyByIndexAsString - QString propertyByIndexAsString(const CPropertyIndex &index, bool i18n = false) const; - //! \copydoc CValueObject::equalsPropertyByIndex bool equalsPropertyByIndex(const CVariant &compareValue, const CPropertyIndex &index) const; diff --git a/src/blackmisc/variantprivate.h b/src/blackmisc/variantprivate.h index f8d71db52..211632c0b 100644 --- a/src/blackmisc/variantprivate.h +++ b/src/blackmisc/variantprivate.h @@ -54,7 +54,6 @@ namespace BlackMisc virtual int compareImpl(const void *lhs, const void *rhs) const = 0; virtual void setPropertyByIndex(void *object, const CVariant &variant, const CPropertyIndex &index) const = 0; virtual void propertyByIndex(const void *object, CVariant &o_variant, const BlackMisc::CPropertyIndex &index) const = 0; - virtual QString propertyByIndexAsString(const void *object, const CPropertyIndex &index, bool i18n) const = 0; virtual bool equalsPropertyByIndex(const void *object, const CVariant &compareValue, const CPropertyIndex &index) const = 0; virtual bool matches(const void *object, const CVariant &value) const = 0; virtual int toIcon(const void *object) const = 0; @@ -125,11 +124,6 @@ namespace BlackMisc template static void propertyByIndex(CVariant &, const T &object, const CPropertyIndex &, ...) { throw CVariantException(object, "propertyByIndex"); } - template - static QString propertyByIndexAsString(const T &object, const CPropertyIndex &index, bool i18n, decltype(static_cast(object.propertyByIndexAsString(index, i18n)), 0)) { return object.propertyByIndexAsString(index, i18n); } - template - static QString propertyByIndexAsString(const T &object, const CPropertyIndex &, bool, ...) { throw CVariantException(object, "propertyByIndexAsString"); } - template static bool equalsPropertyByIndex(const T &object, const CVariant &variant, const CPropertyIndex &index, decltype(static_cast(object.equalsPropertyByIndex(variant, index)), 0)) { return object.equalsPropertyByIndex(variant, index); } template @@ -199,10 +193,6 @@ namespace BlackMisc { CValueObjectMetaInfoHelper::propertyByIndex(o_variant, cast(object), index, 0); } - virtual QString propertyByIndexAsString(const void *object, const CPropertyIndex &index, bool i18n) const override - { - return CValueObjectMetaInfoHelper::propertyByIndexAsString(cast(object), index, i18n, 0); - } virtual bool equalsPropertyByIndex(const void *object, const CVariant &compareValue, const CPropertyIndex &index) const override { return CValueObjectMetaInfoHelper::equalsPropertyByIndex(cast(object), compareValue, index, 0);