refs #336 Added class CLogCategory to represent a log category. The category logic of CLogMessage is moved into this new class.

This commit is contained in:
Mathew Sutcliffe
2014-10-14 00:02:16 +01:00
parent 8992bd734c
commit 067344df24
13 changed files with 485 additions and 88 deletions

View File

@@ -0,0 +1,67 @@
/* Copyright (C) 2014
* 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
* directory of this distribution and at http://www.swift-project.org/license.html. No part of Swift Project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "logcategory.h"
namespace BlackMisc
{
void CLogCategory::registerMetadata()
{
qRegisterMetaType<CLogCategory>();
qDBusRegisterMetaType<CLogCategory>();
}
uint CLogCategory::getValueHash() const
{
return qHash(TupleConverter<CLogCategory>::toMetaTuple(*this));
}
bool CLogCategory::operator ==(const CLogCategory &other) const
{
return TupleConverter<CLogCategory>::toMetaTuple(*this) == TupleConverter<CLogCategory>::toMetaTuple(other);
}
bool CLogCategory::operator !=(const CLogCategory &other) const
{
return TupleConverter<CLogCategory>::toMetaTuple(*this) != TupleConverter<CLogCategory>::toMetaTuple(other);
}
QString CLogCategory::convertToQString(bool i18n) const
{
Q_UNUSED(i18n);
return m_string;
}
int CLogCategory::getMetaTypeId() const
{
return qMetaTypeId<CLogCategory>();
}
bool CLogCategory::isA(int metaTypeId) const
{
if (metaTypeId == qMetaTypeId<CLogCategory>()) { return true; }
return this->CValueObject::isA(metaTypeId);
}
int CLogCategory::compareImpl(const CValueObject &otherBase) const
{
const auto &other = static_cast<const CLogCategory &>(otherBase);
return compare(TupleConverter<CLogCategory>::toMetaTuple(*this), TupleConverter<CLogCategory>::toMetaTuple(other));
}
void CLogCategory::marshallToDbus(QDBusArgument &argument) const
{
argument << TupleConverter<CLogCategory>::toMetaTuple(*this);
}
void CLogCategory::unmarshallFromDbus(const QDBusArgument &argument)
{
argument >> TupleConverter<CLogCategory>::toMetaTuple(*this);
}
}