From 14bb3ea2497b2e5d147dccd11d37d0552e311fbd Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 25 Jul 2019 16:04:21 +0200 Subject: [PATCH] Ref T709, style --- src/blackcore/data/vatsimsetup.h | 3 --- src/blackmisc/dictionary.h | 37 ++++++++++++++++---------------- src/blackmisc/network/client.cpp | 23 ++++++++++---------- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/blackcore/data/vatsimsetup.h b/src/blackcore/data/vatsimsetup.h index 9e649e3d5..ff04cb5f5 100644 --- a/src/blackcore/data/vatsimsetup.h +++ b/src/blackcore/data/vatsimsetup.h @@ -48,9 +48,6 @@ namespace BlackCore //! Default constructor CVatsimSetup(); - //! Destructor. - ~CVatsimSetup() {} - //! VATSIM data file URLs const BlackMisc::Network::CUrlList &getDataFileUrls() const { return m_dataFileUrls; } diff --git a/src/blackmisc/dictionary.h b/src/blackmisc/dictionary.h index 57c747469..99cfaaf64 100644 --- a/src/blackmisc/dictionary.h +++ b/src/blackmisc/dictionary.h @@ -11,7 +11,6 @@ #ifndef BLACKMISC_DICTIONARY_H #define BLACKMISC_DICTIONARY_H -#include "blackmisc/blackmiscexport.h" #include "blackmisc/containerbase.h" #include "blackmisc/dbus.h" #include "blackmisc/datastream.h" @@ -23,6 +22,7 @@ #include "blackmisc/range.h" #include "blackmisc/stringutils.h" #include "blackmisc/typetraits.h" +#include "blackmisc/blackmiscexport.h" #include #include @@ -84,7 +84,6 @@ namespace BlackMisc //! \endcond } // namespace Private - /*! * Trait to select the appropriate default associative container type depending on what the key type supports. */ @@ -94,12 +93,14 @@ namespace BlackMisc /*! * Associative container with value semantics, chooses a sensible default implementation container type. */ + // *INDENT-OFF* template class Impl = TDefaultAssociativeType> class CDictionary : public Mixin::DBusOperators>, public Mixin::DataStreamOperators>, public Mixin::JsonOperators>, public Mixin::String> + // *INDENT-ON* { //! \copydoc BlackMisc::CValueObject::compare friend int compare(const CDictionary &a, const CDictionary &b) @@ -111,7 +112,7 @@ namespace BlackMisc public: //! The implementation container - using impl_type = Impl; + using impl_type = Impl; //! STL compatibility //! @{ @@ -119,10 +120,10 @@ namespace BlackMisc typedef Value value_type; typedef Value &reference; typedef const Value &const_reference; - typedef typename Impl::size_type size_type; + typedef typename Impl::size_type size_type; - typedef typename Impl::iterator iterator; - typedef typename Impl::const_iterator const_iterator; + typedef typename Impl::iterator iterator; + typedef typename Impl::const_iterator const_iterator; //! @} //! Return a copy containing only those elements for which the dictionary keys return true for a given predicate. @@ -350,18 +351,18 @@ namespace BlackMisc //! Returns an const iterator pointing to the item with the key. //! \return If key is not found, the function returns constEnd() - const_iterator constFind (const Key &key) const { return m_impl.constFind(key); } + const_iterator constFind(const Key &key) const { return m_impl.constFind(key); } //! Returns an const iterator pointing to the item with the key. //! \return If key is not found, the function returns end() - const_iterator find(const Key & key) const { return m_impl.find(key); } + const_iterator find(const Key &key) const { return m_impl.find(key); } //! Returns an iterator pointing to the item with the key. //! \return If key is not found, the function returns end() iterator find(const Key &key) { return m_impl.find(key); } //! Returns true if dictionary contains an item with key, otherwise false - bool contains (const Key &key) const {return m_impl.contains(key); } + bool contains(const Key &key) const {return m_impl.contains(key); } //! Returns the number of items with key int count(const Key &key) const { return m_impl.count(key); } @@ -388,25 +389,25 @@ namespace BlackMisc const Key key(const Value &value) const { return m_impl.key(value); } //! Return key assigned to value or if key is not found defaultKey - const Key key(const Value &value, const Key & defaultKey) const { return m_impl.key(value, defaultKey); } + const Key key(const Value &value, const Key &defaultKey) const { return m_impl.key(value, defaultKey); } //! Return a range of all keys (does not allocate a temporary container) auto keys() const { return makeRange(keyBegin(), keyEnd()); } //! Remove all items with key from the dictionary - int remove(const Key &key) { return m_impl.remove(key); } + int remove(const Key &key) { return m_impl.remove(key); } //! Returns the number of items in the hash. - int size() const { return m_impl.size(); } + int size() const { return m_impl.size(); } //! Swaps hash other with this hash. This operation is very fast and never fails. void swap(CDictionary &other) noexcept { m_impl.swap(other.m_impl); } //! Returns the value associated with the key. - const Value value(const Key &key) const { return m_impl.value(key); } + const Value value(const Key &key) const { return m_impl.value(key); } //! Returns the value associated with the key or if key is not found defaultValue - const Value value(const Key &key, const Value &defaultValue) const { return m_impl.value(key, defaultValue); } + const Value value(const Key &key, const Value &defaultValue) const { return m_impl.value(key, defaultValue); } //! Return a range of all values (does not allocate a temporary container) CRange values() const { return makeRange(begin(), end()); } @@ -415,7 +416,7 @@ namespace BlackMisc CDictionary &operator =(const CDictionary &other) { m_impl = other.m_impl; return *this; } //! Move assignment - CDictionary &operator =(CDictionary && other) noexcept { m_impl = std::move(other.m_impl); return *this; } + CDictionary &operator =(CDictionary &&other) noexcept { m_impl = std::move(other.m_impl); return *this; } //! Return reference to the internal implementation object. friend impl_type &implementationOf(CDictionary &dict) { return dict.m_impl; } @@ -428,7 +429,7 @@ namespace BlackMisc Value &operator [](const Key &key) { return m_impl[key]; } //! Access an element by its key. - const Value operator [](const Key &key) const { return m_impl[key]; } + const Value operator [](const Key &key) const { return m_impl[key]; } //! Test for equality. friend bool operator ==(const CDictionary &a, const CDictionary &b) { return a.m_impl == b.m_impl; } @@ -453,7 +454,7 @@ namespace BlackMisc //! \copydoc BlackMisc::CValueObject::marshallToDbus void marshallToDbus(QDBusArgument &argument) const { - argument << m_impl; + argument << m_impl; } //! \copydoc BlackMisc::CValueObject::unmarshallFromDbus @@ -469,7 +470,7 @@ namespace BlackMisc void unmarshalFromDataStream(QDataStream &stream) { stream >> m_impl; } private: - Impl m_impl; + Impl m_impl; }; /*! diff --git a/src/blackmisc/network/client.cpp b/src/blackmisc/network/client.cpp index 33a88072a..9a7a9774e 100644 --- a/src/blackmisc/network/client.cpp +++ b/src/blackmisc/network/client.cpp @@ -110,18 +110,19 @@ namespace BlackMisc const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexCapabilities: return CVariant::fromValue(m_capabilities); + case IndexCapabilities: return CVariant::fromValue(m_capabilities); case IndexCapabilitiesString: return CVariant(this->getCapabilitiesAsString()); - case IndexCallsign: return this->getCallsign().propertyByIndex(index.copyFrontRemoved()); - case IndexUser: return this->getUser().propertyByIndex(index.copyFrontRemoved()); - case IndexModelString: return CVariant(m_modelString); - case IndexServer: return CVariant(m_server); - case IndexVoiceCapabilities: return m_voiceCapabilities.propertyByIndex(index.copyFrontRemoved()); + case IndexCallsign: return this->getCallsign().propertyByIndex(index.copyFrontRemoved()); + case IndexUser: return this->getUser().propertyByIndex(index.copyFrontRemoved()); + case IndexModelString: return CVariant(m_modelString); + case IndexServer: return CVariant(m_server); + case IndexVoiceCapabilities: return m_voiceCapabilities.propertyByIndex(index.copyFrontRemoved()); case IndexVoiceCapabilitiesPixmap: return CVariant::from(m_voiceCapabilities.toPixmap()); - case IndexVoiceCapabilitiesIcon: return CVariant::fromValue(m_voiceCapabilities.toIcon()); + case IndexVoiceCapabilitiesIcon: return CVariant::fromValue(m_voiceCapabilities.toIcon()); case IndexVoiceCapabilitiesString: return CVariant(m_voiceCapabilities.toQString(true)); - default: return CValueObject::propertyByIndex(index); + default: break; } + return CValueObject::propertyByIndex(index); } void CClient::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) @@ -131,9 +132,9 @@ namespace BlackMisc switch (i) { case IndexCapabilities: m_capabilities = variant.toInt(); break; - case IndexModelString: m_modelString = variant.toQString(); break; - case IndexServer: m_server = variant.toQString(); break; - case IndexUser: m_user.setPropertyByIndex(index.copyFrontRemoved(), variant); break; + case IndexModelString: m_modelString = variant.toQString(); break; + case IndexServer: m_server = variant.toQString(); break; + case IndexUser: m_user.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexCallsign: m_user.setCallsign(variant.value()); break; case IndexVoiceCapabilities: m_voiceCapabilities.setPropertyByIndex(index.copyFrontRemoved(), variant); break; default: CValueObject::setPropertyByIndex(index, variant); break;