mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15: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
|
||||
{
|
||||
QString str;
|
||||
// qualifying stringify with this-> to workaround bug in GCC 4.7.2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56402
|
||||
std::for_each(derived().cbegin(), derived().cend(), [ & ](const T & value) { str += (str.isEmpty() ? "{" : ", ") + CContainerHelper::stringify(value, i18n); });
|
||||
for (const auto &value : derived()) { str += (str.isEmpty() ? "{" : ", ") + CContainerHelper::stringify(value, i18n); }
|
||||
if (str.isEmpty()) { str = "{"; }
|
||||
return str += "}";
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace BlackMisc
|
||||
|
||||
bool CLogHandler::isFallThroughEnabled(const QList<CLogCategoryHandler *> &handlers) const
|
||||
{
|
||||
for (auto *handler : handlers)
|
||||
for (const auto *handler : handlers)
|
||||
{
|
||||
if (handler->m_enableFallThrough != m_enableFallThrough)
|
||||
{
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace BlackMisc
|
||||
|
||||
private:
|
||||
QMessageLogger m_logger;
|
||||
CStatusMessage::StatusSeverity m_severity { CStatusMessage::SeverityDebug };
|
||||
CStatusMessage::StatusSeverity m_severity = CStatusMessage::SeverityDebug;
|
||||
QString m_category;
|
||||
QString m_message;
|
||||
QStringList m_args;
|
||||
@@ -173,6 +173,6 @@ namespace BlackMisc
|
||||
* Convenience macro to construct a CLogMessage with the filename, line number, and function name,
|
||||
* 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
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace BlackMisc
|
||||
/*
|
||||
* 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();
|
||||
if (withSender)
|
||||
@@ -150,7 +150,7 @@ namespace BlackMisc
|
||||
/*
|
||||
* 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);
|
||||
return { this->getMessageCategory(), CStatusMessage::SeverityInfo, m };
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace BlackMisc
|
||||
* \param separator values separated by given value
|
||||
* \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.
|
||||
@@ -142,7 +142,7 @@ namespace BlackMisc
|
||||
* \param separator values separated by given value
|
||||
* \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
|
||||
void toggleSenderRecipient();
|
||||
|
||||
Reference in New Issue
Block a user