mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 02:45:33 +08:00
Issue #77 Break cyclic dependency between CStatusMessage and CStatusException, by removing unused methods
This commit is contained in:
@@ -30,4 +30,9 @@ namespace BlackMisc
|
|||||||
if (m_temp.isNull()) { m_temp = m_payload.getMessage().toLocal8Bit(); }
|
if (m_temp.isNull()) { m_temp = m_payload.getMessage().toLocal8Bit(); }
|
||||||
return m_temp;
|
return m_temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CStatusException::maybeThrow(const CStatusMessage &message)
|
||||||
|
{
|
||||||
|
if (!message.isEmpty()) { throw CStatusException(message); }
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
* Throwable exception class containing a CStatusMessage.
|
* Throwable exception class containing a CStatusMessage.
|
||||||
*
|
|
||||||
* This is the exception type which may be thrown by CStatusMessage::maybeThrow().
|
|
||||||
*/
|
*/
|
||||||
class BLACKMISC_EXPORT CStatusException : public std::exception
|
class BLACKMISC_EXPORT CStatusException : public std::exception
|
||||||
{
|
{
|
||||||
@@ -46,6 +44,9 @@ namespace BlackMisc
|
|||||||
//! Destructor.
|
//! Destructor.
|
||||||
~CStatusException() override {}
|
~CStatusException() override {}
|
||||||
|
|
||||||
|
//! If the message is not empty then throw it.
|
||||||
|
static void maybeThrow(const CStatusMessage &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const CStatusMessage m_payload;
|
const CStatusMessage m_payload;
|
||||||
mutable QByteArray m_temp;
|
mutable QByteArray m_temp;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
#include "blackmisc/statusexception.h"
|
|
||||||
#include "blackmisc/propertyindexref.h"
|
#include "blackmisc/propertyindexref.h"
|
||||||
#include "blackmisc/iconlist.h"
|
#include "blackmisc/iconlist.h"
|
||||||
#include "blackmisc/logpattern.h"
|
#include "blackmisc/logpattern.h"
|
||||||
@@ -192,19 +191,6 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatusException CStatusMessage::asException() const
|
|
||||||
{
|
|
||||||
return CStatusException(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CStatusMessage::maybeThrow() const
|
|
||||||
{
|
|
||||||
if (! this->isEmpty())
|
|
||||||
{
|
|
||||||
throw this->asException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CStatusMessage::getCategoriesAsString() const
|
QString CStatusMessage::getCategoriesAsString() const
|
||||||
{
|
{
|
||||||
return m_categories.toQString();
|
return m_categories.toQString();
|
||||||
|
|||||||
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
{
|
{
|
||||||
class CStatusException;
|
|
||||||
|
|
||||||
namespace Private
|
namespace Private
|
||||||
{
|
{
|
||||||
//! Like QString::arg() but for QStringView.
|
//! Like QString::arg() but for QStringView.
|
||||||
@@ -376,12 +374,6 @@ namespace BlackMisc
|
|||||||
//! \sa QtMessageHandler
|
//! \sa QtMessageHandler
|
||||||
void toQtLogTriple(QtMsgType *o_type, QString *o_category, QString *o_message) const;
|
void toQtLogTriple(QtMsgType *o_type, QString *o_category, QString *o_message) const;
|
||||||
|
|
||||||
//! Return a throwable exception object containing this status message.
|
|
||||||
CStatusException asException() const;
|
|
||||||
|
|
||||||
//! If message is empty then do nothing, otherwise throw a CStatusException.
|
|
||||||
void maybeThrow() const;
|
|
||||||
|
|
||||||
//! Message categories
|
//! Message categories
|
||||||
const CLogCategoryList &getCategories() const { return this->m_categories; }
|
const CLogCategoryList &getCategories() const { return this->m_categories; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user