refs #336 Renaming.

This commit is contained in:
Mathew Sutcliffe
2014-10-11 23:59:11 +01:00
parent e3446d78d8
commit 4549e84e05
2 changed files with 9 additions and 9 deletions

View File

@@ -46,20 +46,20 @@ namespace BlackMisc
} }
} }
CLogCategoryHandler *CLogHandler::handlerForCategory(const QString &category) CLogCategoryHandler *CLogHandler::handlerForCategoryPrefix(const QString &category)
{ {
if (! m_categoryHandlers.contains(category)) if (! m_categoryPrefixHandlers.contains(category))
{ {
m_categoryHandlers[category] = new CLogCategoryHandler(this, m_enableFallThrough); m_categoryPrefixHandlers[category] = new CLogCategoryHandler(this, m_enableFallThrough);
} }
return m_categoryHandlers[category]; return m_categoryPrefixHandlers[category];
} }
QList<CLogCategoryHandler *> CLogHandler::handlersForCategory(const QString &category) const QList<CLogCategoryHandler *> CLogHandler::handlersForCategory(const QString &category) const
{ {
QList<CLogCategoryHandler *> m_handlers; QList<CLogCategoryHandler *> m_handlers;
for (auto i = m_categoryHandlers.begin(); i != m_categoryHandlers.end(); ++i) for (auto i = m_categoryPrefixHandlers.begin(); i != m_categoryPrefixHandlers.end(); ++i)
{ {
if (category.startsWith(i.key())) if (category.startsWith(i.key()))
{ {
@@ -72,7 +72,7 @@ namespace BlackMisc
void CLogHandler::enableConsoleOutput(bool enable) void CLogHandler::enableConsoleOutput(bool enable)
{ {
m_enableFallThrough = enable; m_enableFallThrough = enable;
for (auto *handler : m_categoryHandlers.values()) for (auto *handler : m_categoryPrefixHandlers.values())
{ {
handler->enableConsoleOutput(enable); handler->enableConsoleOutput(enable);
} }

View File

@@ -41,8 +41,8 @@ namespace BlackMisc
//! Tell the CLogHandler to install itself with qInstallMessageHandler. //! Tell the CLogHandler to install itself with qInstallMessageHandler.
void install(); void install();
//! Return a category handler for subscribing to all messages whose category string starts with the given prefix. //! Return a category handler for subscribing to all messages with a category starting with the given prefix.
CLogCategoryHandler *handlerForCategory(const QString &prefix); CLogCategoryHandler *handlerForCategoryPrefix(const QString &prefix);
//! Enable or disable the default Qt handler. //! Enable or disable the default Qt handler.
void enableConsoleOutput(bool enable); void enableConsoleOutput(bool enable);
@@ -66,7 +66,7 @@ namespace BlackMisc
QtMessageHandler m_oldHandler = nullptr; QtMessageHandler m_oldHandler = nullptr;
bool m_enableFallThrough = true; bool m_enableFallThrough = true;
bool isFallThroughEnabled(const QList<CLogCategoryHandler *> &handlers) const; bool isFallThroughEnabled(const QList<CLogCategoryHandler *> &handlers) const;
QMap<QString, CLogCategoryHandler *> m_categoryHandlers; QMap<QString, CLogCategoryHandler *> m_categoryPrefixHandlers;
QList<CLogCategoryHandler *> handlersForCategory(const QString &category) const; QList<CLogCategoryHandler *> handlersForCategory(const QString &category) const;
}; };