mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
Ref T566, log flags/enum in own files and DBus/meta registration
I do not want to have to include the complex matcher and network classes just for the enums/flags
This commit is contained in:
committed by
Mat Sutcliffe
parent
b2065b5da3
commit
002f9e6a9b
55
src/blackmisc/simulation/matchinglog.cpp
Normal file
55
src/blackmisc/simulation/matchinglog.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/* Copyright (C) 2019
|
||||
* 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. 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 "matchinglog.h"
|
||||
#include <QStringList>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
//! Log flag to string
|
||||
const QString &matchingLogFlagToString(MatchingLogFlag logFlag)
|
||||
{
|
||||
static const QString logNothing("nothing");
|
||||
static const QString logModelstring("model string");
|
||||
static const QString logStepwiseReduce("step wise reduce");
|
||||
static const QString logScoring("scoring");
|
||||
static const QString logCombinedDefaultType("combined default type");
|
||||
static const QString logSimplified("simplified");
|
||||
static const QString logAll("all");
|
||||
|
||||
switch (logFlag)
|
||||
{
|
||||
case MatchingLogCombinedDefaultType: return logCombinedDefaultType;
|
||||
case MatchingLogNothing: return logNothing;
|
||||
case MatchingLogModelstring: return logModelstring;
|
||||
case MatchingLogStepwiseReduce: return logStepwiseReduce;
|
||||
case MatchingLogScoring: return logScoring;
|
||||
case MatchingLogSimplified: return logSimplified;
|
||||
case MatchingLogAll: return logAll;
|
||||
default: break;
|
||||
}
|
||||
|
||||
static const QString unknown("unknown");
|
||||
return unknown;
|
||||
}
|
||||
|
||||
//! Log flag to string
|
||||
const QString matchingLogToString(MatchingLog log)
|
||||
{
|
||||
if (log == MatchingLogNothing) { return matchingLogFlagToString(MatchingLogNothing); }
|
||||
QStringList l;
|
||||
if (log.testFlag(MatchingLogCombinedDefaultType)) { l << matchingLogFlagToString(MatchingLogCombinedDefaultType); }
|
||||
if (log.testFlag(MatchingLogModelstring)) { l << matchingLogFlagToString(MatchingLogModelstring); }
|
||||
if (log.testFlag(MatchingLogStepwiseReduce)) { l << matchingLogFlagToString(MatchingLogStepwiseReduce); }
|
||||
if (log.testFlag(MatchingLogScoring)) { l << matchingLogFlagToString(MatchingLogScoring); }
|
||||
return l.join(", ");
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
Reference in New Issue
Block a user