mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
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:
67
src/blackmisc/logcategory.cpp
Normal file
67
src/blackmisc/logcategory.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user