mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Remove unused stringutils methods
This commit is contained in:
committed by
Mat Sutcliffe
parent
beeabb51c2
commit
0c1a5a5c97
@@ -1,94 +0,0 @@
|
||||
300;1000;10
|
||||
600;2000;20
|
||||
900;3000;30
|
||||
1200;3900;
|
||||
1200;4000;40
|
||||
1500;4900;
|
||||
1500;5000;50
|
||||
1800;5900;
|
||||
1850;6000;60
|
||||
2100;6900;
|
||||
2150;7000;70
|
||||
2400;7900;
|
||||
2450;8000;80
|
||||
2700;8900;
|
||||
2750;9000;90
|
||||
3000;9800;
|
||||
3050;10000;100
|
||||
3300;10800;
|
||||
3350;11000;110
|
||||
3600;11800;
|
||||
3650;12000;120
|
||||
3900;12800;
|
||||
3950;13000;130
|
||||
4200;13800;
|
||||
4250;14000;140
|
||||
4500;14800;
|
||||
4550;15000;150
|
||||
4800;15700;
|
||||
4900;16000;160
|
||||
5100;16700;
|
||||
5200;17000;170
|
||||
5400;17700;
|
||||
5500;18000;180
|
||||
5700;18700;
|
||||
5800;19000;190
|
||||
6000;19700;
|
||||
6100;20000;200
|
||||
6300;20700;
|
||||
6400;21000;210
|
||||
6600;21700;
|
||||
6700;22000;220
|
||||
6900;22600;
|
||||
7000;23000;230
|
||||
7200;23600;
|
||||
7300;24000;240
|
||||
7500;24600;
|
||||
7600;25000;250
|
||||
7800;25600;
|
||||
7900;26000;260
|
||||
8100;26600;
|
||||
8250;27000;270
|
||||
8400;27600;
|
||||
8550;28000;280
|
||||
8600;28200;
|
||||
8850;29000;290
|
||||
8900;29100;
|
||||
9100;29900;
|
||||
9150;30000;300
|
||||
9200;30100;
|
||||
9450;31000;310
|
||||
9500;31100;
|
||||
9600;31500;
|
||||
9750;32000;320
|
||||
9800;32100;
|
||||
10050;33000;330
|
||||
10100;33100;
|
||||
10350;34000;340
|
||||
10400;34100;
|
||||
10600;34800;
|
||||
10650;35000;350
|
||||
10700;35100;
|
||||
10950;36000;360
|
||||
11000;36100;
|
||||
11100;36400;
|
||||
11300;37000;370
|
||||
11300;37100;
|
||||
11600;38000;380
|
||||
11600;38100;
|
||||
11900;39000;390
|
||||
11900;39100;
|
||||
12100;39700;
|
||||
12200;40000;400
|
||||
12200;40100;
|
||||
12500;41000;410
|
||||
13100;43000;430
|
||||
13700;44900;
|
||||
13700;45000;450
|
||||
14100;46300;
|
||||
14300;46900;
|
||||
14350;47000;470
|
||||
14900;48900;
|
||||
14950;49000;490
|
||||
15100;49500;
|
||||
15550;51000;510
|
||||
|
@@ -408,13 +408,6 @@ namespace BlackSample
|
||||
}
|
||||
out << "Remove from 100,000 strings all uppercase letters: (regex) " << timer.elapsed() << "ms" << endl << Qt::endl;
|
||||
|
||||
timer.start();
|
||||
{
|
||||
auto lines = splitLines(bigString);
|
||||
Q_UNUSED(lines);
|
||||
}
|
||||
out << "Split 100,000 line string into list of lines: (QStringList) " << timer.elapsed() << "ms" << Qt::endl;
|
||||
|
||||
timer.start();
|
||||
{
|
||||
auto lines = splitLinesRefs(bigString);
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#include "blackmisc/pq/constants.h"
|
||||
#include "blackmisc/pq/pqstring.h"
|
||||
#include "blackmisc/math/mathutils.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/swiftdirectories.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
#include "blackmisc/comparefunctions.h"
|
||||
#include "blackmisc/iconlist.h"
|
||||
@@ -27,27 +25,6 @@ using namespace BlackMisc::Math;
|
||||
|
||||
namespace BlackMisc::Aviation
|
||||
{
|
||||
namespace Private
|
||||
{
|
||||
QVector<CAltitude::MetricTuple> initMetricValues()
|
||||
{
|
||||
QVector<CAltitude::MetricTuple> v;
|
||||
const QString f = CFileUtils::appendFilePaths(CSwiftDirectories::shareMiscDirectory(), "Metric Altitudes.csv");
|
||||
const QString ma = CFileUtils::readFileToString(f);
|
||||
const QStringList values = splitLines(ma);
|
||||
for (const QString &value : values)
|
||||
{
|
||||
const QStringList alts = value.split(";");
|
||||
int v1 = -1, v2 = -1, v3 = -1;
|
||||
if (alts.size() >= 1) { v1 = alts[0].toInt(); }
|
||||
if (alts.size() >= 2) { v2 = alts[1].toInt(); }
|
||||
if (alts.size() >= 3) { v3 = alts[2].toInt(); }
|
||||
const CAltitude::MetricTuple m(v1, v2, v3);
|
||||
v.push_back(m);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
void CAltitude::registerMetadata()
|
||||
{
|
||||
@@ -58,7 +35,102 @@ namespace BlackMisc::Aviation
|
||||
|
||||
const QVector<CAltitude::MetricTuple> &CAltitude::metricTuples()
|
||||
{
|
||||
static const QVector<MetricTuple> v = Private::initMetricValues();
|
||||
static const QVector<MetricTuple> v = {
|
||||
{300,1000},
|
||||
{600,2000},
|
||||
{900,3000},
|
||||
{1200,3900},
|
||||
{1200,4000},
|
||||
{1500,4900},
|
||||
{1500,5000},
|
||||
{1800,5900},
|
||||
{1850,6000},
|
||||
{2100,6900},
|
||||
{2150,7000},
|
||||
{2400,7900},
|
||||
{2450,8000},
|
||||
{2700,8900},
|
||||
{2750,9000},
|
||||
{3000,9800},
|
||||
{3050,10000},
|
||||
{3300,10800},
|
||||
{3350,11000},
|
||||
{3600,11800},
|
||||
{3650,12000},
|
||||
{3900,12800},
|
||||
{3950,13000},
|
||||
{4200,13800},
|
||||
{4250,14000},
|
||||
{4500,14800},
|
||||
{4550,15000},
|
||||
{4800,15700},
|
||||
{4900,16000},
|
||||
{5100,16700},
|
||||
{5200,17000},
|
||||
{5400,17700},
|
||||
{5500,18000},
|
||||
{5700,18700},
|
||||
{5800,19000},
|
||||
{6000,19700},
|
||||
{6100,20000},
|
||||
{6300,20700},
|
||||
{6400,21000},
|
||||
{6600,21700},
|
||||
{6700,22000},
|
||||
{6900,22600},
|
||||
{7000,23000},
|
||||
{7200,23600},
|
||||
{7300,24000},
|
||||
{7500,24600},
|
||||
{7600,25000},
|
||||
{7800,25600},
|
||||
{7900,26000},
|
||||
{8100,26600},
|
||||
{8250,27000},
|
||||
{8400,27600},
|
||||
{8550,28000},
|
||||
{8600,28200},
|
||||
{8850,29000},
|
||||
{8900,29100},
|
||||
{9100,29900},
|
||||
{9150,30000},
|
||||
{9200,30100},
|
||||
{9450,31000},
|
||||
{9500,31100},
|
||||
{9600,31500},
|
||||
{9750,32000},
|
||||
{9800,32100},
|
||||
{10050,33000},
|
||||
{10100,33100},
|
||||
{10350,34000},
|
||||
{10400,34100},
|
||||
{10600,34800},
|
||||
{10650,35000},
|
||||
{10700,35100},
|
||||
{10950,36000},
|
||||
{11000,36100},
|
||||
{11100,36400},
|
||||
{11300,37000},
|
||||
{11300,37100},
|
||||
{11600,38000},
|
||||
{11600,38100},
|
||||
{11900,39000},
|
||||
{11900,39100},
|
||||
{12100,39700},
|
||||
{12200,40000},
|
||||
{12200,40100},
|
||||
{12500,41000},
|
||||
{13100,43000},
|
||||
{13700,44900},
|
||||
{13700,45000},
|
||||
{14100,46300},
|
||||
{14300,46900},
|
||||
{14350,47000},
|
||||
{14900,48900},
|
||||
{14950,49000},
|
||||
{15100,49500},
|
||||
{15550,51000},
|
||||
};
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace BlackMisc::Aviation
|
||||
using base_type = PhysicalQuantities::CLength;
|
||||
|
||||
//! Metric tuple
|
||||
using MetricTuple = std::tuple<int, int, int>;
|
||||
using MetricTuple = std::tuple<int, int>;
|
||||
|
||||
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CAltitude)
|
||||
BLACKMISC_DECLARE_USING_MIXIN_STRING(CAltitude)
|
||||
|
||||
@@ -569,7 +569,7 @@ namespace BlackMisc::Simulation::XPlane
|
||||
{
|
||||
++lineNum;
|
||||
QString line = in.readLine();
|
||||
auto tokens = splitString(line, [](QChar c) { return c.isSpace(); });
|
||||
auto tokens = line.split(' ');
|
||||
if (!tokens.empty())
|
||||
{
|
||||
auto it = commands.find(tokens[0]);
|
||||
@@ -615,7 +615,7 @@ namespace BlackMisc::Simulation::XPlane
|
||||
++lineNum;
|
||||
QString line = in.readLine();
|
||||
if (line.isEmpty() || line[0] == '#') continue;
|
||||
auto tokens = splitString(line, [](QChar c) { return c.isSpace(); });
|
||||
auto tokens = line.split(' ');
|
||||
if (!tokens.empty())
|
||||
{
|
||||
auto it = commands.find(tokens[0]);
|
||||
|
||||
@@ -29,11 +29,6 @@ namespace BlackMisc
|
||||
return splitStringRefs(s, [](QChar c) { return c == '\n' || c == '\r'; });
|
||||
}
|
||||
|
||||
QStringList splitLines(const QString &s)
|
||||
{
|
||||
return splitString(s, [](QChar c) { return c == '\n' || c == '\r'; });
|
||||
}
|
||||
|
||||
QByteArray utfToPercentEncoding(const QString& s, const QByteArray &allow, char percent)
|
||||
{
|
||||
QByteArray result;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#define BLACKMISC_STRINGUTILS_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/range.h"
|
||||
#include "blackmisc/typetraits.h"
|
||||
|
||||
#include <QByteArray>
|
||||
@@ -117,15 +116,6 @@ namespace BlackMisc
|
||||
//! It would be risky to call splitLinesRefs with an rvalue, so forbid it.
|
||||
void splitLinesRefs(const QString &&) = delete;
|
||||
|
||||
//! Split a string into multiple strings, using a predicate function to identify the split points.
|
||||
template <class F> QStringList splitString(const QString &s, F predicate)
|
||||
{
|
||||
return makeRange(splitStringRefs(s, predicate)).transform([](QStringRef sr) { return sr.toString(); });
|
||||
}
|
||||
|
||||
//! Split a string into multiple lines. Blank lines are skipped.
|
||||
BLACKMISC_EXPORT QStringList splitLines(const QString &s);
|
||||
|
||||
//! Extended percent encoding supporting UTF-16
|
||||
BLACKMISC_EXPORT QByteArray utfToPercentEncoding(const QString &s, const QByteArray &allow = {}, char percent = '%');
|
||||
|
||||
|
||||
@@ -181,12 +181,6 @@ namespace BlackMisc
|
||||
return test;
|
||||
}
|
||||
|
||||
const QString &CSwiftDirectories::shareMiscDirectory()
|
||||
{
|
||||
static const QString misc(CFileUtils::appendFilePaths(shareDirectory(), "misc"));
|
||||
return misc;
|
||||
}
|
||||
|
||||
const QString &CSwiftDirectories::shareTerrainProbeDirectory()
|
||||
{
|
||||
static const QString tpd(CFileUtils::appendFilePaths(shareDirectory(), "simulator/swiftTerrainProbe"));
|
||||
|
||||
@@ -74,9 +74,6 @@ namespace BlackMisc
|
||||
//! The test data directory
|
||||
static const QString &shareTestDirectory();
|
||||
|
||||
//! The misc data directory
|
||||
static const QString &shareMiscDirectory();
|
||||
|
||||
//! FSX/P3D terrain probe
|
||||
static const QString &shareTerrainProbeDirectory();
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace BlackMiscTest
|
||||
void testRemove();
|
||||
void testContains();
|
||||
void testIndexOf();
|
||||
void testSplit();
|
||||
void testTimestampParsing();
|
||||
void testCodecs();
|
||||
void testSimplify();
|
||||
@@ -61,16 +60,6 @@ namespace BlackMiscTest
|
||||
QVERIFY2(indexOfChar(s, [](QChar c) { return c.isNumber(); }) == -1, "Test not index of character by predicate");
|
||||
}
|
||||
|
||||
void CTestStringUtils::testSplit()
|
||||
{
|
||||
const QString s = "line one\nline two\r\nline three\n";
|
||||
QStringList lines = splitLines(s);
|
||||
QVERIFY2(lines.size() == 3, "Test split string into lines: correct number of lines");
|
||||
QVERIFY2(lines[0] == "line one", "Test split string into lines: correct first line");
|
||||
QVERIFY2(lines[1] == "line two", "Test split string into lines: correct second line");
|
||||
QVERIFY2(lines[2] == "line three", "Test split string into lines: correct third line");
|
||||
}
|
||||
|
||||
void CTestStringUtils::testTimestampParsing()
|
||||
{
|
||||
const QStringList dts(
|
||||
|
||||
Reference in New Issue
Block a user