File indexing completed on 2024-05-12 04:42:44

0001 /*
0002     SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "lineutil_p.h"
0008 #include "linecompare_p.h"
0009 #include "assetrepository_p.h"
0010 
0011 #include <knowledgedb/linemetadata.h>
0012 
0013 #include <KPublicTransport/Location>
0014 
0015 #include <QColor>
0016 #include <QDebug>
0017 #include <QString>
0018 #include <QUrl>
0019 
0020 using namespace KPublicTransport;
0021 
0022 bool LineUtil::isSameLineNameStrict(const QString &lhs, const QString &rhs)
0023 {
0024     return Internal::isSameLineName(lhs, rhs, Internal::StrictCompare);
0025 }
0026 
0027 bool LineUtil::isSameLineNameFuzzy(const QString &lhs, const QString &rhs)
0028 {
0029     return Internal::isSameLineName(lhs, rhs, Internal::FuzzyCompare);
0030 }
0031 
0032 bool LineUtil::isCompatibleMode(Line::Mode lhs, Line::Mode rhs)
0033 {
0034     if (lhs == rhs || lhs == Line::Unknown || rhs == Line::Unknown) {
0035         return true;
0036     }
0037 
0038     if (lhs == Line::Train) {
0039         return rhs == Line::LocalTrain || rhs == Line::LongDistanceTrain || rhs == Line::RapidTransit;
0040     }
0041     if (rhs == Line::Train) {
0042         return lhs == Line::LocalTrain || lhs == Line::LongDistanceTrain || lhs == Line::RapidTransit;
0043     }
0044 
0045     return false;
0046 }