mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-02 23:35:40 +08:00
Issue #77 Move all methods of CLogUtilities to other classes
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include "blackmisc/aviation/airlineicaocodelist.h"
|
||||
#include "blackmisc/aviation/logutils.h"
|
||||
#include "blackmisc/logcategories.h"
|
||||
#include "blackmisc/country.h"
|
||||
#include "blackmisc/range.h"
|
||||
@@ -207,52 +206,52 @@ namespace BlackMisc
|
||||
reduced = false;
|
||||
if (this->isEmpty())
|
||||
{
|
||||
if (log) { CLogUtilities::addLogDetailsToList(log, cs, loginfo % u" Empty input list, cannot reduce", getLogCategories()); }
|
||||
if (log) { CCallsign::addLogDetailsToList(log, cs, loginfo % u" Empty input list, cannot reduce", getLogCategories()); }
|
||||
return *this;
|
||||
}
|
||||
|
||||
if (telephony.isEmpty() && airlineName.isEmpty() && countryIso.isEmpty())
|
||||
{
|
||||
if (log) { CLogUtilities::addLogDetailsToList(log, cs, loginfo % u" No name/telephony/country, cannot reduce " % QString::number(this->size()) % u" entries", getLogCategories()); }
|
||||
if (log) { CCallsign::addLogDetailsToList(log, cs, loginfo % u" No name/telephony/country, cannot reduce " % QString::number(this->size()) % u" entries", getLogCategories()); }
|
||||
return *this;
|
||||
}
|
||||
|
||||
CAirlineIcaoCodeList step1Data = airlineName.isEmpty() ? *this : this->findByNamesOrTelephonyDesignator(airlineName);
|
||||
if (step1Data.size() < 1 || step1Data.size() == this->size())
|
||||
{
|
||||
if (log) { CLogUtilities::addLogDetailsToList(log, cs, loginfo % QStringLiteral(" cannot reduce by '%1'").arg(airlineName), getLogCategories()); }
|
||||
if (log) { CCallsign::addLogDetailsToList(log, cs, loginfo % QStringLiteral(" cannot reduce by '%1'").arg(airlineName), getLogCategories()); }
|
||||
step1Data = *this;
|
||||
}
|
||||
else
|
||||
{
|
||||
reduced = true;
|
||||
if (log) { CLogUtilities::addLogDetailsToList(log, cs, loginfo % QStringLiteral(" reduced by '%1'").arg(airlineName), getLogCategories()); }
|
||||
if (log) { CCallsign::addLogDetailsToList(log, cs, loginfo % QStringLiteral(" reduced by '%1'").arg(airlineName), getLogCategories()); }
|
||||
}
|
||||
if (step1Data.size() == 1) { return step1Data; }
|
||||
|
||||
CAirlineIcaoCodeList step2Data = telephony.isEmpty() ? step1Data : step1Data.findByNamesOrTelephonyDesignator(telephony);
|
||||
if (step2Data.size() < 1 || step2Data.size() == this->size())
|
||||
{
|
||||
if (log) { CLogUtilities::addLogDetailsToList(log, cs, loginfo % QStringLiteral(" cannot reduce by name '%1'").arg(telephony), getLogCategories()); }
|
||||
if (log) { CCallsign::addLogDetailsToList(log, cs, loginfo % QStringLiteral(" cannot reduce by name '%1'").arg(telephony), getLogCategories()); }
|
||||
step2Data = step1Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
reduced = true;
|
||||
if (log) { CLogUtilities::addLogDetailsToList(log, cs, loginfo % QStringLiteral(" reduced by telephony '%1'").arg(telephony), getLogCategories()); }
|
||||
if (log) { CCallsign::addLogDetailsToList(log, cs, loginfo % QStringLiteral(" reduced by telephony '%1'").arg(telephony), getLogCategories()); }
|
||||
}
|
||||
if (step2Data.size() == 1) { return step2Data; }
|
||||
|
||||
CAirlineIcaoCodeList step3Data = countryIso.isEmpty() ? step2Data : step2Data.findByCountryIsoCode(countryIso);
|
||||
if (step3Data.size() < 1 || step3Data.size() == this->size())
|
||||
{
|
||||
if (log) { CLogUtilities::addLogDetailsToList(log, cs, loginfo % QStringLiteral(" cannot reduce by country '%1'").arg(countryIso), getLogCategories()); }
|
||||
if (log) { CCallsign::addLogDetailsToList(log, cs, loginfo % QStringLiteral(" cannot reduce by country '%1'").arg(countryIso), getLogCategories()); }
|
||||
step3Data = step2Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
reduced = true;
|
||||
if (log) { CLogUtilities::addLogDetailsToList(log, cs, loginfo % QStringLiteral(" reduced by '%1'").arg(countryIso), getLogCategories()); }
|
||||
if (log) { CCallsign::addLogDetailsToList(log, cs, loginfo % QStringLiteral(" reduced by '%1'").arg(countryIso), getLogCategories()); }
|
||||
}
|
||||
return step3Data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user