Ref T240, style/minor fixes

* Q_DECLARE_METATYPE was wrong
* missing/unused include
* suppress CPP check warning
This commit is contained in:
Klaus Basan
2018-02-02 23:48:56 +01:00
parent 686f8067d1
commit 5b87b60682
5 changed files with 20 additions and 21 deletions

View File

@@ -16,6 +16,7 @@ variableScope:src/plugins/weatherdata/gfs/g2clib/*.c
// std::initializer_list should always be passed by value // std::initializer_list should always be passed by value
passedByValue:src/blackmisc/input/actionhotkeylist.h passedByValue:src/blackmisc/input/actionhotkeylist.h
passedByValue:src/blackmisc/network/rawfsdmessagelist.cpp
passedByValue:src/blackmisc/logcategorylist.h passedByValue:src/blackmisc/logcategorylist.h
passedByValue:src/blackmisc/platformset.cpp passedByValue:src/blackmisc/platformset.cpp

View File

@@ -52,16 +52,14 @@ namespace BlackMisc
return allPacketTypes; return allPacketTypes;
} }
CVariant CRawFsdMessage::propertyByIndex(const BlackMisc::CPropertyIndex &index) const CVariant CRawFsdMessage::propertyByIndex(const CPropertyIndex &index) const
{ {
if (index.isMyself()) { return CVariant::from(*this); } if (index.isMyself()) { return CVariant::from(*this); }
ColumnIndex i = index.frontCasted<ColumnIndex>(); const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i) switch (i)
{ {
case IndexReceptionTime: case IndexReceptionTime: return CVariant::fromValue(m_rawMessage);
return CVariant::fromValue(this->m_rawMessage); case IndexRawMessage: return CVariant::fromValue(m_receptionTime);
case IndexRawMessage:
return CVariant::fromValue(this->m_receptionTime);
default: default:
return CValueObject::propertyByIndex(index); return CValueObject::propertyByIndex(index);
} }
@@ -70,7 +68,7 @@ namespace BlackMisc
void CRawFsdMessage::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) void CRawFsdMessage::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
{ {
if (index.isMyself()) { (*this) = variant.to<CRawFsdMessage>(); return; } if (index.isMyself()) { (*this) = variant.to<CRawFsdMessage>(); return; }
ColumnIndex i = index.frontCasted<ColumnIndex>(); const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i) switch (i)
{ {
case IndexRawMessage: case IndexRawMessage:

View File

@@ -12,12 +12,11 @@
#ifndef BLACKMISC_NETWORK_RAWFSDMESSAGE_H #ifndef BLACKMISC_NETWORK_RAWFSDMESSAGE_H
#define BLACKMISC_NETWORK_RAWFSDMESSAGE_H #define BLACKMISC_NETWORK_RAWFSDMESSAGE_H
#include "blackmisc/blackmiscexport.h"
#include "blackmisc/metaclass.h"
#include "blackmisc/statusmessagelist.h"
#include "blackmisc/propertyindex.h"
#include "blackmisc/valueobject.h" #include "blackmisc/valueobject.h"
#include "blackmisc/variant.h" #include "blackmisc/variant.h"
#include "blackmisc/metaclass.h"
#include "blackmisc/propertyindex.h"
#include "blackmisc/blackmiscexport.h"
#include <QDateTime> #include <QDateTime>
#include <QMetaType> #include <QMetaType>
@@ -34,7 +33,7 @@ namespace BlackMisc
//! Properties by index //! Properties by index
enum ColumnIndex enum ColumnIndex
{ {
IndexReceptionTime = BlackMisc::CPropertyIndex::GlobalIndexCRawFsdMessage, IndexReceptionTime = CPropertyIndex::GlobalIndexCRawFsdMessage,
IndexRawMessage IndexRawMessage
}; };
@@ -63,10 +62,10 @@ namespace BlackMisc
static const QStringList &getAllPacketTypes (); static const QStringList &getAllPacketTypes ();
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex //! \copydoc BlackMisc::Mixin::Index::propertyByIndex
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; CVariant propertyByIndex(const CPropertyIndex &index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
//! \copydoc BlackMisc::Mixin::String::toQString() //! \copydoc BlackMisc::Mixin::String::toQString()
QString convertToQString(bool i18n = false) const; QString convertToQString(bool i18n = false) const;

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2017 /* Copyright (C) 2018
* swift project Community / Contributors * swift project Community / Contributors
* *
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2017 /* Copyright (C) 2018
* swift project Community / Contributors * swift project Community / Contributors
* *
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
@@ -13,12 +13,13 @@
#define BLACKMISC_NETWORK_RAWFSDMESSAGELIST_H #define BLACKMISC_NETWORK_RAWFSDMESSAGELIST_H
#include "rawfsdmessage.h" #include "rawfsdmessage.h"
#include "blackmisc/blackmiscexport.h"
#include "blackmisc/collection.h" #include "blackmisc/collection.h"
#include "blackmisc/sequence.h" #include "blackmisc/sequence.h"
#include "blackmisc/variant.h" #include "blackmisc/variant.h"
#include <QStringList> #include "blackmisc/blackmiscexport.h"
#include <QMetaType> #include <QMetaType>
#include <initializer_list>
namespace BlackMisc namespace BlackMisc
{ {
@@ -27,7 +28,7 @@ namespace BlackMisc
//! Value object encapsulating a list raw FSD messages. //! Value object encapsulating a list raw FSD messages.
class BLACKMISC_EXPORT CRawFsdMessageList : class BLACKMISC_EXPORT CRawFsdMessageList :
public CSequence<CRawFsdMessage>, public CSequence<CRawFsdMessage>,
public BlackMisc::Mixin::MetaType<CRawFsdMessageList> public Mixin::MetaType<CRawFsdMessageList>
{ {
public: public:
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CRawFsdMessageList) BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CRawFsdMessageList)
@@ -51,7 +52,7 @@ namespace BlackMisc
} // namespace } // namespace
Q_DECLARE_METATYPE(BlackMisc::Network::CRawFsdMessageList) Q_DECLARE_METATYPE(BlackMisc::Network::CRawFsdMessageList)
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Network::CRawFsdMessageList>) Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Network::CRawFsdMessage>)
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Network::CRawFsdMessageList>) Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Network::CRawFsdMessage>)
#endif //guard #endif //guard