mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
refs #336 Style and const-correctness.
This commit is contained in:
@@ -135,8 +135,7 @@ namespace BlackMisc
|
|||||||
virtual QString convertToQString(bool i18n = false) const override
|
virtual QString convertToQString(bool i18n = false) const override
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
// qualifying stringify with this-> to workaround bug in GCC 4.7.2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56402
|
for (const auto &value : derived()) { str += (str.isEmpty() ? "{" : ", ") + CContainerHelper::stringify(value, i18n); }
|
||||||
std::for_each(derived().cbegin(), derived().cend(), [ & ](const T & value) { str += (str.isEmpty() ? "{" : ", ") + CContainerHelper::stringify(value, i18n); });
|
|
||||||
if (str.isEmpty()) { str = "{"; }
|
if (str.isEmpty()) { str = "{"; }
|
||||||
return str += "}";
|
return str += "}";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
bool CLogHandler::isFallThroughEnabled(const QList<CLogCategoryHandler *> &handlers) const
|
bool CLogHandler::isFallThroughEnabled(const QList<CLogCategoryHandler *> &handlers) const
|
||||||
{
|
{
|
||||||
for (auto *handler : handlers)
|
for (const auto *handler : handlers)
|
||||||
{
|
{
|
||||||
if (handler->m_enableFallThrough != m_enableFallThrough)
|
if (handler->m_enableFallThrough != m_enableFallThrough)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QMessageLogger m_logger;
|
QMessageLogger m_logger;
|
||||||
CStatusMessage::StatusSeverity m_severity { CStatusMessage::SeverityDebug };
|
CStatusMessage::StatusSeverity m_severity = CStatusMessage::SeverityDebug;
|
||||||
QString m_category;
|
QString m_category;
|
||||||
QString m_message;
|
QString m_message;
|
||||||
QStringList m_args;
|
QStringList m_args;
|
||||||
@@ -173,6 +173,6 @@ namespace BlackMisc
|
|||||||
* Convenience macro to construct a CLogMessage with the filename, line number, and function name,
|
* Convenience macro to construct a CLogMessage with the filename, line number, and function name,
|
||||||
* for verbose debug messages.
|
* for verbose debug messages.
|
||||||
*/
|
*/
|
||||||
#define BLACK_LOG (BlackMisc::CLogMessage{ __FILE__, __LINE__, Q_FUNC_INFO })
|
#define BLACK_LOG (BlackMisc::CLogMessage { __FILE__, __LINE__, Q_FUNC_INFO })
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ namespace BlackMisc
|
|||||||
/*
|
/*
|
||||||
* Formatted string
|
* Formatted string
|
||||||
*/
|
*/
|
||||||
QString CTextMessage::asString(bool withSender, bool withRecipient, const QString separator) const
|
QString CTextMessage::asString(bool withSender, bool withRecipient, const QString &separator) const
|
||||||
{
|
{
|
||||||
QString s = this->receivedTime();
|
QString s = this->receivedTime();
|
||||||
if (withSender)
|
if (withSender)
|
||||||
@@ -150,7 +150,7 @@ namespace BlackMisc
|
|||||||
/*
|
/*
|
||||||
* As status message
|
* As status message
|
||||||
*/
|
*/
|
||||||
CStatusMessage CTextMessage::asStatusMessage(bool withSender, bool withRecipient, const QString separator) const
|
CStatusMessage CTextMessage::asStatusMessage(bool withSender, bool withRecipient, const QString &separator) const
|
||||||
{
|
{
|
||||||
QString m = this->asString(withSender, withRecipient, separator);
|
QString m = this->asString(withSender, withRecipient, separator);
|
||||||
return { this->getMessageCategory(), CStatusMessage::SeverityInfo, m };
|
return { this->getMessageCategory(), CStatusMessage::SeverityInfo, m };
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace BlackMisc
|
|||||||
* \param separator values separated by given value
|
* \param separator values separated by given value
|
||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
QString asString(bool withSender, bool withRecipient, const QString separator = ", ") const;
|
QString asString(bool withSender, bool withRecipient, const QString &separator = ", ") const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Whole message as BlackMisc::CStatusMessage.
|
* Whole message as BlackMisc::CStatusMessage.
|
||||||
@@ -142,7 +142,7 @@ namespace BlackMisc
|
|||||||
* \param separator values separated by given value
|
* \param separator values separated by given value
|
||||||
* \return
|
* \return
|
||||||
*/
|
*/
|
||||||
BlackMisc::CStatusMessage asStatusMessage(bool withSender, bool withRecipient, const QString separator = ", ") const;
|
BlackMisc::CStatusMessage asStatusMessage(bool withSender, bool withRecipient, const QString &separator = ", ") const;
|
||||||
|
|
||||||
//! \brief Toggle sender receiver, can be used to ping my own message
|
//! \brief Toggle sender receiver, can be used to ping my own message
|
||||||
void toggleSenderRecipient();
|
void toggleSenderRecipient();
|
||||||
|
|||||||
Reference in New Issue
Block a user