swift
Loading...
Searching...
No Matches
aircrafticaocode.cpp
1// SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#include <QChar>
7#include <QMultiMap>
8#include <QRegularExpression>
9#include <QStringBuilder>
10#include <Qt>
11#include <QtGlobal>
12
15#include "misc/logcategories.h"
16#include "misc/pq/speed.h"
18#include "misc/statusmessage.h"
19#include "misc/stringutils.h"
20
21using namespace swift::misc;
22using namespace swift::misc::db;
23using namespace swift::misc::physical_quantities;
24
25SWIFT_DEFINE_VALUEOBJECT_MIXINS(swift::misc::aviation, CAircraftIcaoCode)
26
27namespace swift::misc::aviation
28{
29 CAircraftIcaoCode::CAircraftIcaoCode(const QString &icao, const QString &combinedType)
30 : m_designator(icao.trimmed().toUpper()), m_combinedType(combinedType.trimmed().toUpper())
31 {}
32
33 CAircraftIcaoCode::CAircraftIcaoCode(const QString &icao, const QString &combinedType, const QString &manufacturer,
34 const QString &model, CWakeTurbulenceCategory wtc, bool realworld, bool legacy,
35 bool military, int rank)
36 : m_designator(icao.trimmed().toUpper()), m_combinedType(combinedType.trimmed().toUpper()),
37 m_manufacturer(manufacturer.trimmed()), m_modelDescription(model.trimmed()), m_wtc(wtc),
38 m_realWorld(realworld), m_legacy(legacy), m_military(military), m_rank(rank)
39 {
40 if (m_rank < 0 || m_rank >= 10)
41 {
42 m_rank = 10;
43 }
44 }
45
46 CAircraftIcaoCode::CAircraftIcaoCode(const QString &icao, const QString &iata, const QString &combinedType,
47 const QString &manufacturer, const QString &model, CWakeTurbulenceCategory wtc,
48 bool realworld, bool legacy, bool military, int rank)
49 : m_designator(icao.trimmed().toUpper()), m_iataCode(iata.trimmed().toUpper()),
50 m_combinedType(combinedType.trimmed().toUpper()), m_manufacturer(manufacturer.trimmed()),
51 m_modelDescription(model.trimmed()), m_wtc(wtc), m_realWorld(realworld), m_legacy(legacy),
52 m_military(military), m_rank(rank)
53 {
54 if (m_rank < 0 || m_rank >= 10)
55 {
56 m_rank = 10;
57 }
58 }
59
60 CAircraftIcaoCode::CAircraftIcaoCode(const QString &icao, const QString &iata, const QString &family,
61 const QString &combinedType, const QString &manufacturer, const QString &model,
62 const QString &modelIata, const QString &modelSwift,
63 CWakeTurbulenceCategory wtc, bool realworld, bool legacy, bool military,
64 int rank)
65 : m_designator(icao.trimmed().toUpper()), m_iataCode(iata.trimmed().toUpper()),
66 m_family(family.trimmed().toUpper()), m_combinedType(combinedType.trimmed().toUpper()),
67 m_manufacturer(manufacturer.trimmed()), m_modelDescription(model.trimmed()),
68 m_modelIataDescription(modelIata.trimmed()), m_modelSwiftDescription(modelSwift.trimmed()), m_wtc(wtc),
69 m_realWorld(realworld), m_legacy(legacy), m_military(military), m_rank(rank)
70 {
71 if (m_rank < 0 || m_rank >= 10)
72 {
73 m_rank = 10;
74 }
75 }
76
78 {
79 return (this->isLoadedFromDb()) ? this->getDesignator() % u' ' % this->getDbKeyAsStringInParentheses() :
80 this->getDesignator();
81 }
82
84 {
85 Q_UNUSED(i18n);
86 return (this->hasCategory()) ?
87 QStringLiteral("%1 %2 %3 cat: %4")
88 .arg(this->getDesignatorDbKey(), this->getCombinedType(), this->getWtc().toQString(),
90 .trimmed() :
91 QStringLiteral("%1 %2 %3")
92 .arg(this->getDesignatorDbKey(), this->getCombinedType(), this->getWtc().toQString())
93 .trimmed();
94 }
95
97 {
98 if (!this->hasValidDesignator() && otherIcaoCode.hasValidDesignator())
99 {
100 this->setDesignator(otherIcaoCode.getDesignator());
101 }
102 if (!this->hasValidWtc() && otherIcaoCode.hasValidWtc())
103 {
104 this->setWtc(otherIcaoCode.getWtc());
105 }
106 if (!this->hasValidCombinedType() && otherIcaoCode.hasValidCombinedType())
107 {
108 this->setCombinedType(otherIcaoCode.getCombinedType());
109 }
110 if (m_manufacturer.isEmpty())
111 {
112 this->setManufacturer(otherIcaoCode.getManufacturer());
113 }
114 if (m_modelDescription.isEmpty())
115 {
116 this->setModelDescription(otherIcaoCode.getModelDescription());
117 }
118 if (m_modelIataDescription.isEmpty())
119 {
121 }
122 if (m_modelSwiftDescription.isEmpty())
123 {
125 }
126 if (m_family.isEmpty())
127 {
128 this->setFamily(otherIcaoCode.getFamily());
129 }
130 if (!this->hasValidDbKey())
131 {
132 // need to observe if it makes sense to copy the key but not copying the whole object
133 this->setDbKey(otherIcaoCode.getDbKey());
134 this->setUtcTimestamp(otherIcaoCode.getUtcTimestamp());
135 }
136 }
137
139 {
140 static const CLogCategoryList cats({ CLogCategory("swift.misc.aircrafticao"), CLogCategories::validation() });
142 if (this->isLoadedFromDb())
143 {
144 // actually we would expect all DB data to be valid, however right now
145 // we only check special cases
146 if (this->getDesignator() == getUnassignedDesignator())
147 {
148 return msg;
149 } // DB ZZZZ
150 }
151
152 if (!hasKnownDesignator())
153 {
154 msg.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, u"Aircraft ICAO: unknown designator"));
155 }
157 {
158 msg.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, u"Aircraft ICAO: invalid combined type"));
159 }
160 if (!hasValidWtc())
161 {
162 msg.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, u"Aircraft ICAO: wrong WTC"));
163 }
164 if (!hasManufacturer())
165 {
166 msg.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, u"Aircraft ICAO: missing manufacturer"));
167 }
168 if (!hasModelDescription())
169 {
170 msg.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, u"Aircraft ICAO: no description"));
171 }
172 return msg;
173 }
174
176
178 {
179 if (this->isDbEqual(otherCode))
180 {
181 addLogDetailsToList(log, *this, QString("Equal DB code: 100"));
182 return 100;
183 }
184
185 int score = 0;
186 if (this->hasValidDesignator() && this->getDesignator() == otherCode.getDesignator())
187 {
188 // 0..65
189 score += 50; // same designator
190 if (log)
191 {
192 addLogDetailsToList(log, *this, QStringLiteral("Same designator: %1").arg(score));
193 }
194
195 int scoreOld = score;
196 if (this->getRank() == 0)
197 {
198 score += 15;
199 }
200 else if (this->getRank() == 1)
201 {
202 score += 12;
203 }
204 else if (this->getRank() < 10)
205 {
206 score += (10 - this->getRank());
207 }
208 if (score > scoreOld)
209 {
210 addLogDetailsToList(log, *this, QStringLiteral("Added rank: %1").arg(score));
211 }
212 }
213 else
214 {
215 if (this->hasFamily() && this->getFamily() == otherCode.getFamily())
216 {
217 score += 40;
218 addLogDetailsToList(log, *this, QStringLiteral("Added family: %1").arg(score));
219 }
220 else if (this->hasValidCombinedType() && otherCode.getCombinedType() == this->getCombinedType())
221 {
222 score += 30;
223 addLogDetailsToList(log, *this, QStringLiteral("Added combined code: %1").arg(score));
224 }
225 else if (this->hasValidCombinedType())
226 {
227 // totally 15
228
229 // engine count
230 const int eMy = this->getEnginesCount();
231 const int eOther = otherCode.getEnginesCount();
232
233 if (eMy == eOther && eMy >= 0)
234 {
235 score += 4;
236 }
237 else if (eMy > 0 && eOther > 0)
238 {
239 const int eDiff = qAbs(eMy - eOther);
240 if (eDiff == 1)
241 {
242 score += 2;
243 }
244 else if (eDiff == 2)
245 {
246 score += 1;
247 }
248 }
249
250 // engine type
251 const QString tMy = this->getEngineType();
252 const QString tOther = this->getEngineType();
253
254 if (tMy == tOther)
255 {
256 score += 4;
257 }
258 else if (!tMy.isEmpty() && !tOther.isEmpty())
259 {
260 if (isEPTEngineType(tMy[0]) && isEPTEngineType(tOther[0]))
261 {
262 score += 2;
263 }
264 }
265
266 // aircraft type
267 if (this->getAircraftType() == otherCode.getAircraftType())
268 {
269 score += 7;
270 }
271 else if (this->isVtol() && otherCode.isVtol())
272 {
273 score += 4;
274 }
275 addLogDetailsToList(log, *this, QStringLiteral("Added combined code parts: %1").arg(score));
276 }
277 }
278
279 // 0..65 so far
280 if (this->hasManufacturer() && otherCode.hasManufacturer())
281 {
282 if (this->matchesManufacturer(otherCode.getManufacturer()))
283 {
284 score += 10;
286 log, *this,
287 QStringLiteral("Matches manufacturer '%1': %2").arg(this->getManufacturer()).arg(score));
288 }
289 else if (this->getManufacturer().contains(otherCode.getManufacturer(), Qt::CaseInsensitive))
290 {
292 log, *this,
293 QStringLiteral("Contains manufacturer '%1': %2").arg(this->getManufacturer()).arg(score));
294 score += 5;
295 }
296 }
297
298 // 0..75 so far
299 if (this->hasCategory() && otherCode.hasCategory() && this->getCategory() == otherCode.getCategory())
300 {
301 score += 8;
303 log, *this,
304 QStringLiteral("Matches military flag '%1': %2").arg(boolToYesNo(this->isMilitary())).arg(score));
305 }
306 else if (this->isMilitary() == otherCode.isMilitary())
307 {
308 score += 8;
310 log, *this,
311 QStringLiteral("Matches military flag '%1': %2").arg(boolToYesNo(this->isMilitary())).arg(score));
312 }
313 // 0..85
314 return score;
315 }
316
317 void CAircraftIcaoCode::guessModelParameters(CLength &guessedCGOut, CSpeed &guessedVRotateOut) const
318 {
319 // we do not override values
320 if (!guessedCGOut.isNull() && !guessedVRotateOut.isNull())
321 {
322 return;
323 }
324
325 // init to defaults
326 CLength guessedCG = CLength(1.5, CLengthUnit::m());
327 CSpeed guessedVRotate = CSpeed(70, CSpeedUnit::km_h());
328
329 const int engines = this->getEnginesCount();
330 const QChar engineType = this->getEngineTypeChar().toUpper();
331 do
332 {
333 if (engines == 1)
334 {
335 if (engineType == 'T')
336 {
337 guessedCG = CLength(2.0, CLengthUnit::m());
338 break;
339 }
340 }
341 else if (engines == 2)
342 {
343 guessedCG = CLength(2.0, CLengthUnit::m());
344 guessedVRotate = CSpeed(100, CSpeedUnit::kts());
345 if (engineType == 'T')
346 {
347 guessedCG = CLength(2.0, CLengthUnit::m());
348 break;
349 }
350 if (engineType == 'J')
351 {
352 // a B737 has VR 105-160kts
353 guessedVRotate = CSpeed(120, CSpeedUnit::kts());
354 guessedCG = CLength(2.5, CLengthUnit::m());
355 break;
356 }
357 }
358 else if (engines > 2)
359 {
360 guessedCG = CLength(4.0, CLengthUnit::m());
361 guessedVRotate = CSpeed(70, CSpeedUnit::kts());
362 if (engineType == 'J')
363 {
364 // A typical B747 has VR around 160kts
365 guessedCG = CLength(6.0, CLengthUnit::m());
366 guessedVRotate = CSpeed(140, CSpeedUnit::kts());
367 break;
368 }
369 }
370
371 if (engineType == 'J')
372 {
373 // MIL Jets a bit faster
374 if (this->isMilitary())
375 {
376 guessedVRotate *= 1.20;
377 }
378 else if (this->matchesDesignator("CONC"))
379 {
380 guessedVRotate = CSpeed(199, CSpeedUnit::kts());
381 }
382 }
383
384 // VTOL
385 if (this->isVtol())
386 {
387 guessedVRotate = CSpeed(0, CSpeedUnit::kts());
388 }
389 }
390 while (false);
391
392 if (guessedCGOut.isNull())
393 {
394 guessedCGOut = guessedCG;
395 }
396 if (guessedVRotateOut.isNull())
397 {
398 guessedVRotateOut = guessedVRotate;
399 }
400 }
401
403 {
404 return m_designator.isEmpty() && m_manufacturer.isEmpty() && m_modelDescription.isEmpty();
405 }
406
408 {
409 static const CAircraftIcaoCode null;
410 return null;
411 }
412
413 bool CAircraftIcaoCode::hasDesignator() const { return !m_designator.isEmpty(); }
414
415 bool CAircraftIcaoCode::hasValidDesignator() const { return isValidDesignator(m_designator); }
416
418 {
419 return (this->hasValidDesignator() && this->getDesignator() != getUnassignedDesignator());
420 }
421
423 {
424 if (!this->hasDesignator())
425 {
426 return false;
427 }
429 }
430
432 {
433 return hasDesignator() && hasIataCode() && m_iataCode == m_designator;
434 }
435
437 {
438 return hasFamily() && hasDesignator() && m_designator == m_family;
439 }
440
442
444 {
445 if (m_combinedType.length() != 3) return {};
446 return m_combinedType.right(1);
447 }
448
450 {
451 const QString et = this->getEngineType();
452 if (et.length() == 1)
453 {
454 return et[0];
455 }
456 return {};
457 }
458
460 {
461 if (m_combinedType.length() < 2)
462 {
463 return -1;
464 }
465 const QString c(m_combinedType.mid(1, 1));
466 if (c == "-")
467 {
468 return -1;
469 }
470 bool ok {};
471 int ec = c.toInt(&ok);
472 if (ok && ec >= 0 && ec < 10)
473 {
474 return ec;
475 }
476 return -1;
477 }
478
480 {
481 if (m_combinedType.length() < 2)
482 {
483 return {};
484 }
485 return m_combinedType.mid(1, 1);
486 }
487
489 {
490 if (m_combinedType.length() < 1)
491 {
492 return {};
493 }
494 QString c(m_combinedType.at(0));
495 if (c == "-")
496 {
497 return {};
498 }
499 return c;
500 }
501
503 {
504 if (m_combinedType.length() < 1)
505 {
506 return {};
507 }
508 QChar c(m_combinedType.at(0));
509 if (c == '-')
510 {
511 return {};
512 }
513 return c;
514 }
515
517 {
518 // Shortcut for most cases
519 if (!this->hasModelIataDescription() && !this->hasModelSwiftDescription())
520 {
521 return this->getModelDescription();
522 }
523
524 QStringList combined({ this->getModelDescription() });
525 if (this->hasModelIataDescription())
526 {
527 combined.append(this->getModelIataDescription());
528 }
529 if (this->hasModelSwiftDescription())
530 {
531 combined.append(this->getModelSwiftDescription());
532 }
533 combined.removeDuplicates();
534 return combined.join(", ");
535 }
536
538 {
539 if (this->hasModelDescription())
540 {
541 if (this->getModelDescription().contains(candidate, Qt::CaseInsensitive))
542 {
543 return true;
544 }
545 }
546 if (this->hasModelIataDescription())
547 {
548 if (this->getModelIataDescription().contains(candidate, Qt::CaseInsensitive))
549 {
550 return true;
551 }
552 }
553 if (this->hasModelSwiftDescription())
554 {
555 if (this->getModelSwiftDescription().contains(candidate, Qt::CaseInsensitive))
556 {
557 return true;
558 }
559 }
560 return false;
561 }
562
563 bool CAircraftIcaoCode::matchesCombinedType(const QString &combinedType) const
564 {
565 const QString cc(combinedType.toUpper().trimmed().replace(' ', '*').replace('-', '*'));
566 if (combinedType.length() != 3)
567 {
568 return false;
569 }
570 if (cc == this->getCombinedType())
571 {
572 return true;
573 }
574
575 const bool wildcard = cc.contains('*');
576 if (!wildcard)
577 {
578 return false;
579 }
580 const QChar at = cc.at(0);
581 const QChar c = cc.at(1);
582 const QChar et = cc.at(2);
583 if (at != '*')
584 {
585 const QString cat = getAircraftType();
586 if (cat.isEmpty() || cat.at(0) != at)
587 {
588 return false;
589 }
590 }
591 if (c != '*')
592 {
593 if (getEnginesCount() != c.digitValue())
594 {
595 return false;
596 }
597 }
598 if (et == '*')
599 {
600 return true;
601 }
602 const QString cet = this->getEngineType();
603 return cet.length() == 1 && cet.at(0) == et;
604 }
605
607 const QString &manufacturer) const
608 {
609 return this->matchesCombinedType(combinedType) && this->matchesManufacturer(manufacturer);
610 }
611
613 {
614 return (this->hasDesignator() ? this->getDesignator() : QStringLiteral("????")) %
615 (this->hasManufacturer() ? (u' ' % this->getManufacturer()) : QString());
616 }
617
618 bool CAircraftIcaoCode::hasManufacturer() const { return !m_manufacturer.isEmpty(); }
619
620 bool CAircraftIcaoCode::matchesManufacturer(const QString &manufacturer) const
621 {
622 if (manufacturer.isEmpty())
623 {
624 return false;
625 }
626 return (manufacturer.length() == m_manufacturer.length() &&
627 m_manufacturer.startsWith(manufacturer, Qt::CaseInsensitive));
628 }
629
631 {
632 // special designators
633 if (m_designator.length() == 4)
634 {
635 if (m_designator == "BALL" || m_designator == "SHIP" || m_designator == "GYRO" || m_designator == "UHEL")
636 {
637 return true;
638 }
639 }
640
641 if (!m_combinedType.isEmpty())
642 {
643 if (
644 // Ref T654, G is GLIDER at the moment, G as gyrocopyter will be used as in future
645 // m_combinedType.startsWith('G') || // gyrocopter
646 m_combinedType.startsWith('H') || // helicopter
647 m_combinedType.startsWith('T') // tilt wing
648 )
649 {
650 return true;
651 }
652 }
653 return false;
654 }
655
657 {
658 return m_modelIataDescription.startsWith("duplicate", Qt::CaseInsensitive) ||
659 m_modelSwiftDescription.startsWith("do not", Qt::CaseInsensitive);
660 }
661
662 void CAircraftIcaoCode::setCodeFlags(bool military, bool legacy, bool realWorld)
663 {
664 m_military = military;
665 m_legacy = legacy;
666 m_realWorld = realWorld;
667 }
668
669 void CAircraftIcaoCode::setMilitary(bool military) { m_military = military; }
670
671 void CAircraftIcaoCode::setRealWorld(bool realWorld) { m_realWorld = realWorld; }
672
673 void CAircraftIcaoCode::setLegacy(bool legacy) { m_legacy = legacy; }
674
676
677 void CAircraftIcaoCode::setRank(int rank) { m_rank = (rank < 0 || rank >= 10) ? 10 : rank; }
678
680 {
681 return (this->hasDesignator() ? this->getDesignator() : QStringLiteral("????")) %
682 (this->hasManufacturer() ? (u' ' % this->getManufacturer()) : QString()) %
683 (this->hasModelDescription() ? (u' ' % this->getModelDescription()) : QString()) %
685 }
686
688 {
689 if (!this->hasCategory())
690 {
691 return this->getCombinedIcaoStringWithKey();
692 }
693 return (this->hasDesignator() ? this->getDesignator() : QStringLiteral("????")) %
694 (this->hasManufacturer() ? (u' ' % this->getManufacturer()) : QString()) %
695 (u" [" % this->getCategory().getNameDbKey() % ']') %
696 (this->hasModelDescription() ? (u' ' % this->getModelDescription()) : QString()) %
698 }
699
701 {
702 if (!this->hasIataCode())
703 {
704 return {};
705 }
706 return this->getIataCode() % u" [IATA" % (this->hasDesignator() ? (u' ' % this->getDesignator()) : QString()) %
707 (this->hasManufacturer() ? (u' ' % this->getManufacturer()) : QString()) %
708 (this->hasModelDescription() ? (u' ' % this->getModelDescription()) : QString()) %
710 }
711
713 {
714 if (!this->hasFamily())
715 {
716 return {};
717 }
718 return this->getFamily() % u" [family" % (this->hasDesignator() ? (u' ' % this->getDesignator()) : QString()) %
719 (this->hasManufacturer() ? (u' ' % this->getManufacturer()) : QString()) %
720 (this->hasModelDescription() ? (u' ' % this->getModelDescription()) : QString()) %
722 }
723
724 bool CAircraftIcaoCode::hasCategory() const { return !m_category.isNull(); }
725
730
731 bool CAircraftIcaoCode::matchesDesignator(const QString &designator, int fuzzyMatch, int *result) const
732 {
733 Q_ASSERT_X(fuzzyMatch >= -1 && fuzzyMatch <= 100, Q_FUNC_INFO, "fuzzyMatch range 0..100 or -1");
734 if (designator.isEmpty())
735 {
736 return false;
737 }
738 const QString d = designator.trimmed().toUpper();
739 if (fuzzyMatch >= 0)
740 {
741 const int r = fuzzyShortStringComparision(this->getDesignator(), d) >= fuzzyMatch;
742 if (result)
743 {
744 *result = r;
745 }
746 return (r >= fuzzyMatch);
747 }
748 else
749 {
750 const bool e = this->getDesignator() == d;
751 if (result)
752 {
753 *result = e ? 100 : 0;
754 }
755 return e;
756 }
757 }
758
759 bool CAircraftIcaoCode::matchesIataCode(const QString &iata, int fuzzyMatch, int *result) const
760 {
761 Q_ASSERT_X(fuzzyMatch >= -1 && fuzzyMatch <= 100, Q_FUNC_INFO, "fuzzyMatch range 0..100 or -1");
762 if (iata.isEmpty())
763 {
764 return false;
765 }
766 const QString i = iata.trimmed().toUpper();
767 if (fuzzyMatch >= 0)
768 {
769 const int r = fuzzyShortStringComparision(this->getIataCode(), i) >= fuzzyMatch;
770 if (result)
771 {
772 *result = r;
773 }
774 return (r >= fuzzyMatch);
775 }
776 else
777 {
778 const bool e = this->getIataCode() == i;
779 if (result)
780 {
781 *result = e ? 100 : 0;
782 }
783 return e;
784 }
785 }
786
787 bool CAircraftIcaoCode::matchesFamily(const QString &family, int fuzzyMatch, int *result) const
788 {
789 Q_ASSERT_X(fuzzyMatch >= -1 && fuzzyMatch <= 100, Q_FUNC_INFO, "fuzzyMatch range 0..100 or -1");
790 if (family.isEmpty())
791 {
792 return false;
793 }
794 const QString f = family.trimmed().toUpper();
795 if (fuzzyMatch >= 0)
796 {
797 const int r = fuzzyShortStringComparision(this->getFamily(), f) >= fuzzyMatch;
798 if (result)
799 {
800 *result = r;
801 }
802 return r >= fuzzyMatch;
803 }
804 else
805 {
806 const bool e = this->getFamily() == f;
807 if (result)
808 {
809 *result = e ? 100 : 0;
810 }
811 return e;
812 }
813 }
814
816 {
817 if (icaoOrIata.isEmpty())
818 {
819 return false;
820 }
821 return matchesDesignator(icaoOrIata) || matchesIataCode(icaoOrIata);
822 }
823
825 {
826 if (icaoIataOrFamily.isEmpty())
827 {
828 return false;
829 }
830 return matchesDesignator(icaoIataOrFamily) || matchesIataCode(icaoIataOrFamily) ||
831 matchesFamily(icaoIataOrFamily);
832 }
833
835 {
836 if (index.isMyself())
837 {
838 return QVariant::fromValue(*this);
839 }
841 {
843 }
844 const auto i = index.frontCasted<ColumnIndex>();
845 switch (i)
846 {
847 case IndexAircraftDesignator: return QVariant::fromValue(m_designator);
848 case IndexCategory: return m_category.propertyByIndex(index.copyFrontRemoved());
849 case IndexIataCode: return QVariant::fromValue(m_iataCode);
850 case IndexFamily: return QVariant::fromValue(m_family);
851 case IndexCombinedAircraftType: return QVariant::fromValue(m_combinedType);
852 case IndexModelDescription: return QVariant::fromValue(m_modelDescription);
853 case IndexModelIataDescription: return QVariant::fromValue(m_modelIataDescription);
854 case IndexModelSwiftDescription: return QVariant::fromValue(m_modelSwiftDescription);
855 case IndexCombinedDescription: return QVariant::fromValue(this->getCombinedModelDescription());
856 case IndexManufacturer: return QVariant::fromValue(m_manufacturer);
857 case IndexWtc: return QVariant::fromValue(m_wtc);
858 case IndexIsVtol: return QVariant::fromValue(this->isVtol());
859 case IndexIsLegacy: return QVariant::fromValue(m_legacy);
860 case IndexIsMilitary: return QVariant::fromValue(m_military);
861 case IndexIsRealworld: return QVariant::fromValue(m_realWorld);
862 case IndexRank: return QVariant::fromValue(m_rank);
864 default: return CValueObject::propertyByIndex(index);
865 }
866 }
867
869 {
870 if (index.isMyself())
871 {
872 (*this) = variant.value<CAircraftIcaoCode>();
873 return;
874 }
876 {
878 return;
879 }
880 const auto i = index.frontCasted<ColumnIndex>();
881 switch (i)
882 {
883 case IndexAircraftDesignator: this->setDesignator(variant.value<QString>()); break;
884 case IndexCategory: m_category.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
885 case IndexIataCode: this->setIataCode(variant.value<QString>()); break;
886 case IndexFamily: this->setFamily(variant.value<QString>()); break;
887 case IndexCombinedAircraftType: this->setCombinedType(variant.value<QString>()); break;
888 case IndexModelDescription: this->setModelDescription(variant.value<QString>()); break;
889 case IndexModelIataDescription: this->setModelIataDescription(variant.value<QString>()); break;
890 case IndexModelSwiftDescription: this->setModelSwiftDescription(variant.value<QString>()); break;
891 case IndexManufacturer: this->setManufacturer(variant.value<QString>()); break;
892 case IndexWtc: this->setWtc(variant.value<CWakeTurbulenceCategory>()); break;
893 case IndexIsLegacy: m_legacy = variant.toBool(); break;
894 case IndexIsMilitary: m_military = variant.toBool(); break;
895 case IndexRank: m_rank = variant.toInt(); break;
896 default: CValueObject::setPropertyByIndex(index, variant); break;
897 }
898 }
899
901 {
902 if (index.isMyself())
903 {
904 return m_designator.compare(compareValue.getDesignator(), Qt::CaseInsensitive);
905 }
907 {
909 }
910 const auto i = index.frontCasted<ColumnIndex>();
911 switch (i)
912 {
913 case IndexAircraftDesignator: return m_designator.compare(compareValue.getDesignator(), Qt::CaseInsensitive);
914 case IndexCategory:
915 return m_category.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCategory());
916 case IndexIataCode: return m_iataCode.compare(compareValue.getIataCode(), Qt::CaseInsensitive);
917 case IndexFamily: return m_family.compare(compareValue.getFamily(), Qt::CaseInsensitive);
918 case IndexCombinedAircraftType:
919 return m_combinedType.compare(compareValue.getCombinedType(), Qt::CaseInsensitive);
920 case IndexModelDescription:
921 return m_modelDescription.compare(compareValue.getModelDescription(), Qt::CaseInsensitive);
922 case IndexModelIataDescription:
923 return m_modelIataDescription.compare(compareValue.getModelIataDescription(), Qt::CaseInsensitive);
924 case IndexModelSwiftDescription:
925 return m_modelSwiftDescription.compare(compareValue.getModelSwiftDescription(), Qt::CaseInsensitive);
926 case IndexCombinedDescription:
927 {
928 // compare without generating new strings
929 int c = m_modelDescription.compare(compareValue.getModelDescription(), Qt::CaseInsensitive);
930 if (c == 0)
931 {
932 c = m_modelIataDescription.compare(compareValue.getModelIataDescription(), Qt::CaseInsensitive);
933 if (c == 0)
934 {
935 c = m_modelSwiftDescription.compare(compareValue.getModelSwiftDescription(), Qt::CaseInsensitive);
936 }
937 }
938 return c;
939 }
940 case IndexManufacturer: return m_manufacturer.compare(compareValue.getManufacturer(), Qt::CaseInsensitive);
941 case IndexWtc: return m_wtc == compareValue.getWtc();
942 case IndexIsLegacy: return Compare::compare(m_legacy, compareValue.isLegacyAircraft());
943 case IndexIsMilitary: return Compare::compare(m_military, compareValue.isMilitary());
944 case IndexIsVtol: return Compare::compare(isVtol(), compareValue.isVtol());
945 case IndexIsRealworld: return Compare::compare(m_realWorld, compareValue.isRealWorld());
946 case IndexRank: return Compare::compare(m_rank, compareValue.getRank());
949 default: return CValueObject::comparePropertyByIndex(index, *this);
950 }
951 Q_ASSERT_X(false, Q_FUNC_INFO, "No comparison");
952 return 0;
953 }
954
956 {
957 if (designator.length() < DesignatorMinLength || designator.length() > DesignatorMaxLength)
958 {
959 return false;
960 }
961 if (!designator[0].isUpper())
962 {
963 return false;
964 }
965 return !containsChar(designator, [](QChar c) { return !c.isUpper() && !c.isDigit(); });
966 }
967
969 {
970 if (combinedType.length() != 3)
971 {
972 return false;
973 }
974
975 // Amphibian, Glider, Helicopter, Seaplane, Landplane, Tilt wing
976 static const QString validDescriptions = "AGHSLT";
977 // Electric, Jet, Piston, Turpoprop, and - for no engine
978 static const QString validEngines = "EJPT-";
979
980 if (!validDescriptions.contains(combinedType[0]))
981 {
982 return false;
983 }
984 if (!combinedType[1].isDigit())
985 {
986 return false;
987 }
988 if (!validEngines.contains(combinedType[2]))
989 {
990 return false;
991 }
992 return true;
993 }
994
996 {
997 static const QString z("ZZZZ");
998 return z;
999 }
1000
1002 {
1003 static const QString g("GLID");
1004 return g;
1005 }
1006
1008 {
1010 return z;
1011 }
1012
1014 {
1015 static const QStringList s({ "ZZZZ", "SHIP", "BALL", getGliderDesignator(), "ULAC", "GYRO", "UHEL" });
1016 return s;
1017 }
1018
1020 {
1021 QString n(candidate.trimmed().toUpper());
1022 n = n.left(indexOfChar(n, [](QChar c) { return c.isSpace(); }));
1023 return removeChars(n, [](QChar c) { return !c.isLetterOrNumber(); });
1024 }
1025
1027 {
1028 // manually add some replacements for frequently used types
1029 static const QMultiMap<QString, QString> knownCodes {
1030 { "L1P", "L2P" }, { "L1P", "S1P" }, { "L2J", "L3J" }, { "L2J", "L4J" }, { "L3J", "L4J" }
1031 };
1032
1033 if (isValidCombinedType(combinedCode))
1034 {
1035 return {};
1036 }
1037 if (knownCodes.contains(combinedCode))
1038 {
1039 return knownCodes.values(combinedCode);
1040 }
1041
1042 // turn E to P engine
1043 if (combinedCode.endsWith("E"))
1044 {
1045 return QStringList({ QStringView { combinedCode }.left(2) % u'P' });
1046 }
1047
1048 // turn T to H plane (tilt wing to helicopter
1049 if (combinedCode.startsWith("T"))
1050 {
1051 return QStringList({ u'H' % QStringView { combinedCode }.right(2) });
1052 }
1053
1054 // based on engine count
1055 QStringList codes;
1056 int engineCount = combinedCode[1].digitValue();
1057 if (engineCount > 1)
1058 {
1059 for (int c = 2; c < 5; c++)
1060 {
1061 if (c == engineCount)
1062 {
1063 continue;
1064 }
1065 const QString code(combinedCode.at(0) + QString::number(c) + combinedCode.at(2));
1066 codes.push_back(code);
1067 }
1068 }
1069 return codes;
1070 }
1071
1073 {
1074 const QChar e = engineType.toUpper();
1075 return e == 'P' || e == 'E' || e == 'T';
1076 }
1077
1079 const QStringList &extraCategories, CStatusMessage::StatusSeverity s)
1080 {
1081 static const CLogCategoryList cats({ CLogCategories::aviation() });
1082 const CStatusMessage m(cats.with(CLogCategoryList::fromQStringList(extraCategories)), s,
1083 icaoCode.hasDesignator() ? icaoCode.getDesignatorDbKey() + ": " + message.trimmed() :
1084 message.trimmed());
1085 return m;
1086 }
1087
1089 const QString &message, const QStringList &extraCategories,
1091 {
1092 if (!log)
1093 {
1094 return;
1095 }
1096 if (message.isEmpty())
1097 {
1098 return;
1099 }
1100 log->push_back(logMessage(icao, message, extraCategories, s));
1101 }
1102
1104 {
1105 if (!existsKey(json, prefix))
1106 {
1107 // when using relationship, this can be null
1108 return {};
1109 }
1110
1111 const int engineCount(json.value(prefix % u"enginecount").toInt(-1));
1112 const int categoryId(json.value(prefix % u"idcategory").toInt(-1));
1113 const QString designator(json.value(prefix % u"designator").toString());
1114 const QString iata(json.value(prefix % u"iata").toString());
1115 const QString family(json.value(prefix % u"family").toString());
1116 const QString manufacturer(json.value(prefix % u"manufacturer").toString());
1117 const QString model(json.value(prefix % u"model").toString());
1118 const QString modelIata(json.value(prefix % u"modeliata").toString());
1119 const QString modelSwift(json.value(prefix % u"modelswift").toString());
1120 const QString type(json.value(prefix % u"type").toString());
1121 const QString engine(json.value(prefix % u"engine").toString());
1122 const QString combined(createdCombinedString(type, engineCount, engine));
1123
1124 QString wtcString(json.value(prefix % u"wtc").toString());
1125 if (wtcString.length() > 1 && wtcString.contains("/"))
1126 {
1127 // "L/M" -> "M"
1128 wtcString = wtcString.right(1);
1129 }
1130 Q_ASSERT_X(wtcString.length() < 2, Q_FUNC_INFO, "WTC too long");
1131 const CWakeTurbulenceCategory wtc =
1132 wtcString.isEmpty() ? CWakeTurbulenceCategory() : CWakeTurbulenceCategory(wtcString.at(0));
1133
1134 const bool real = CDatastoreUtility::dbBoolStringToBool(json.value(prefix % u"realworld").toString());
1135 const bool legacy = CDatastoreUtility::dbBoolStringToBool(json.value(prefix % u"legacy").toString());
1136 const bool military = CDatastoreUtility::dbBoolStringToBool(json.value(prefix % u"military").toString());
1137 const int rank(json.value(prefix % u"rank").toInt(10));
1138
1139 CAircraftIcaoCode code(designator, iata, family, combined, manufacturer, model, modelIata, modelSwift, wtc,
1140 real, legacy, military, rank);
1141 code.setKeyVersionTimestampFromDatabaseJson(json, prefix);
1142 if (categoryId >= 0)
1143 {
1144 code.setCategoryId(categoryId);
1145 }
1146 return code;
1147 }
1148
1149 QString CAircraftIcaoCode::createdCombinedString(const QString &type, const QString &engineCount,
1150 const QString &engine)
1151 {
1152 Q_ASSERT_X(engineCount.length() < 2, Q_FUNC_INFO, "Wrong engine count");
1153 return (type.isEmpty() ? QStringLiteral("-") : type.trimmed().left(1).toUpper()) %
1154 (engineCount.isEmpty() ? QStringLiteral("-") : engineCount.trimmed()) %
1155 (engine.isEmpty() ? QStringLiteral("-") : engine.trimmed().left(1).toUpper());
1156 }
1157
1158 QString CAircraftIcaoCode::createdCombinedString(const QString &type, int engineCount, const QString &engine)
1159 {
1160 const bool valid = (engineCount >= 0 && engineCount < 10);
1161 return createdCombinedString(type, valid ? QString::number(engineCount) : "", engine);
1162 }
1163} // namespace swift::misc::aviation
static const QString & aviation()
Aviation specific.
static const QString & validation()
Validation.
A log category is an arbitrary string tag which can be attached to log messages.
Definition logcategory.h:28
A sequence of log categories.
static CLogCategoryList fromQStringList(const QStringList &stringList)
Convert a string list, such as that returned by toQStringList(), into a CLogCategoryList.
Non-owning reference to a CPropertyIndex with a subset of its features.
Q_REQUIRED_RESULT CPropertyIndexRef copyFrontRemoved() const
Copy with first element removed.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
void push_back(const T &value)
Appends an element at the end of the sequence.
Definition sequence.h:308
Streamable status message, e.g.
static constexpr auto SeverityError
Status severities.
swift::misc::StatusSeverity StatusSeverity
Status severities.
Status messages, e.g. from Core -> GUI.
QDateTime getUtcTimestamp() const
Get timestamp.
void setUtcTimestamp(const QDateTime &timestamp)
Set timestamp.
CWakeTurbulenceCategory getWtc() const
Get WTC.
QString getCombinedFamilyStringWithKey() const
Combined family descriptive string with key.
static const QString & getUnassignedDesignator()
The unassigned designator ("ZZZZ").
bool isRealWorld() const
Real world aircraft?
bool hasModelDescription() const
Has model description?
QString getCombinedIataStringWithKey() const
Combined IATA descriptive string with key.
bool hasDesignator() const
Aircraft designator?
bool isIataSameAsDesignator() const
IATA code same as designator?
bool hasKnownDesignator() const
Has designator and designator is not "ZZZZ".
bool isVtol() const
Is VTOL aircraft (helicopter, tilt wing).
@ IndexDesignatorManufacturer
designator and manufacturer
static bool isEPTEngineType(const QChar engineType)
Engine tye is Electric, Piston, TurboProp.
QString getCombinedIcaoStringWithKey() const
Combined ICAO descriptive string with key.
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
static bool isValidCombinedType(const QString &combinedType)
Valid combined type.
static const QStringList & getSpecialDesignators()
List of the special designators ("ZZZZ", "UHEL", ...).
bool hasSpecialDesignator() const
Special designator.
void setCodeFlags(bool military, bool legacy, bool realWorld)
Flags.
bool matchesDesignatorOrIata(const QString &icaoOrIata) const
Matches ICAO or IATA code.
static const CAircraftIcaoCode & unassignedIcao()
Unassigned ICAO code "ZZZZ".
QString getAircraftType() const
Aircraft type, such a L(andplane), S(eaplane), H(elicopter).
bool matchesDesignator(const QString &designator, int fuzzyMatch=-1, int *result=nullptr) const
Matches designator string?
bool matchesDesignatorIataOrFamily(const QString &icaoIataOrFamily) const
Matches ICAO, IATA, family?
QString getEngineType() const
Get engine type, e.g. "J".
static void addLogDetailsToList(CStatusMessageList *log, const CAircraftIcaoCode &icao, const QString &message, const QStringList &extraCategories={}, CStatusMessage::StatusSeverity s=CStatusMessage::SeverityInfo)
Specialized log for matching / reverse lookup.
QChar getEngineTypeChar() const
Get engine type, e.g. "J".
int getEnginesCount() const
Engine count if any, -1 if no value is set.
void setModelSwiftDescription(const QString &modelDescription)
Set the alternative swift model description.
bool matchesIataCode(const QString &iata, int fuzzyMatch=-1, int *result=nullptr) const
Matches IATA string?
QString getEngineCountString() const
Engine count as string, if not available "".
void setCategoryId(int id)
Set category id.
QString getCombinedModelDescription() const
Combined description.
QString getDesignatorDbKey() const
Designator and DB key.
const QString & getDesignator() const
Get ICAO designator, e.g. "B737".
void setIataCode(const QString &iata)
Set IATA code.
void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant)
Set property by index.
void setWtc(CWakeTurbulenceCategory wtc)
Set WTC.
void setManufacturer(const QString &manufacturer)
Set the manufacturer.
static CStatusMessage logMessage(const CAircraftIcaoCode &icaoCode, const QString &message, const QStringList &extraCategories={}, CStatusMessage::StatusSeverity s=CStatusMessage::SeverityInfo)
Specialized log message for matching / reverse lookup.
const QString & getModelSwiftDescription() const
Get swift model description.
bool matchesCombinedType(const QString &combinedType) const
Matches given combined code.
void setCombinedType(const QString &type)
Set type.
bool hasValidDesignator() const
Valid aircraft designator?
int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftIcaoCode &compareValue) const
Compare for index.
void setModelIataDescription(const QString &modelDescription)
Set the alternative IATA model description.
void updateMissingParts(const CAircraftIcaoCode &otherIcaoCode)
Update missing parts.
static constexpr int DesignatorMinLength
designator length (min)
CStatusMessageList validate() const
Validate data.
bool matchesAnyDescription(const QString &candidate) const
Matches any of the (unempty) descriptions.
bool isDbDuplicate() const
Is DB duplicate? This means a redundant ICAO DB entry.
static const CAircraftIcaoCode & null()
NULL object.
QString convertToQString(bool i18n=false) const
Cast as QString.
CAircraftIcaoCode()=default
Default constructor.
static CAircraftIcaoCode fromDatabaseJson(const QJsonObject &json, const QString &prefix=QString())
From our database JSON format.
int calculateScore(const CAircraftIcaoCode &otherCode, CStatusMessageList *log=nullptr) const
Considers rank, manufacturer and family 0..100.
QString getCombinedIcaoCategoryStringWithKey() const
Combined ICAO descriptive string with category and key.
const CAircraftCategory & getCategory() const
Get category.
void setDesignator(const QString &icaoDesignator)
Set ICAO designator, e.g. "B737".
bool isFamilySameAsDesignator() const
Family same as designator?
void setRealWorld(bool realWorld)
Real world.
void setModelDescription(const QString &modelDescription)
Set the model description (ICAO description).
const QString & getCombinedType() const
Get type, e.g. "L2J".
QString asHtmlSummary() const
As a brief HTML summary (e.g. used in tooltips).
static QStringList alternativeCombinedCodes(const QString &combinedCode)
Create relaxed combined codes, e.g "L2J" -> "L3J", ...
bool matchesCombinedTypeAndManufacturer(const QString &combinedType, const QString &manufacturer) const
Matches combined type and.
const QString & getManufacturer() const
Get manufacturer, e.g. "Airbus".
bool matchesFamily(const QString &family, int fuzzyMatch=-1, int *result=nullptr) const
Matches family?
static constexpr int DesignatorMaxLength
designator length (max)
bool isLegacyAircraft() const
Legacy aircraft (no current ICAO code).
static bool isValidDesignator(const QString &designator)
Valid designator?
const QString & getModelDescription() const
Get IACO model description, e.g. "A-330-200".
static const QString & getGliderDesignator()
Get the glider designator.
bool hasModelSwiftDescription() const
Has swift model description?
QChar getAircraftTypeChar() const
Aircraft type, such a L(andplane), S(eaplane), H(elicopter).
const QString & getIataCode() const
IATA code.
const QString & getFamily() const
Family (e.g. A350).
bool hasValidCombinedType() const
Combined type available?
void setFamily(const QString &family)
Set family.
static QString normalizeDesignator(const QString &candidate)
Normalize designator, remove illegal characters.
bool matchesManufacturer(const QString &manufacturer) const
Matching the manufacturer?
QString getDesignatorManufacturer() const
Designator + Manufacturer.
void guessModelParameters(physical_quantities::CLength &guessedCGOut, physical_quantities::CSpeed &guessedVRotateOut) const
Guess aircraft model parameters.
const QString & getModelIataDescription() const
Get IATA model description.
bool hasModelIataDescription() const
Has IATA model description?
bool hasValidWtc() const
Valid WTC code?
static bool dbBoolStringToBool(const QString &dbBool)
DB Bool value to bool.
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
QString getDbKeyAsString() const
DB key as string.
Definition datastore.cpp:33
bool isLoadedFromDb() const
Loaded from DB.
Definition datastore.cpp:58
static bool existsKey(const QJsonObject &json, const QString &prefix=QString())
Is a key available?
static bool canHandleIndex(swift::misc::CPropertyIndexRef index)
Can given index be handled?
void setDbKey(int key)
Set the DB key.
Definition datastore.h:96
bool isDbEqual(const IDatastoreObjectWithIntegerKey &other) const
Same DB key and hence equal.
Definition datastore.h:105
QString getDbKeyAsStringInParentheses(const QString &prefix={}) const
Db key in parentheses, e.g. "(3)".
Definition datastore.cpp:42
int comparePropertyByIndex(CPropertyIndexRef index, const IDatastoreObjectWithIntegerKey &compareValue) const
Compare for index.
void setKeyVersionTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix=QString())
Set key and timestamp values.
bool hasValidDbKey() const
Has valid DB key.
Definition datastore.h:102
void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant)
Set property by index.
int comparePropertyByIndex(CPropertyIndexRef index, const Derived &compareValue) const
Compare for index.
Definition mixinindex.h:203
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
Definition mixinindex.h:167
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
Definition mixinindex.h:180
QString toQString(bool i18n=false) const
Definition mixinstring.h:74
Physical unit length (length).
Definition length.h:18
static CLengthUnit m()
Meter m.
Definition units.h:140
static CSpeedUnit km_h()
Kilometer/hour km/h.
Definition units.h:852
static CSpeedUnit kts()
Knots.
Definition units.h:817
int compare(T a, T b)
Compare arithmetic values.
Free functions in swift::misc.
SWIFT_MISC_EXPORT int fuzzyShortStringComparision(const QString &str1, const QString &str2, Qt::CaseSensitivity cs=Qt::CaseSensitive)
Fuzzy compare for short strings (like ICAO designators).
QString removeChars(const QString &s, F predicate)
Return a string with characters removed that match the given predicate.
Definition stringutils.h:34
SWIFT_MISC_EXPORT const QString & boolToYesNo(bool v)
Bool to yes/no.
int indexOfChar(const QString &s, F predicate)
Index of first character in the string matching the given predicate, or -1 if not found.
Definition stringutils.h:77
bool containsChar(const QString &s, F predicate)
True if any character in the string matches the given predicate.
Definition stringutils.h:64
int digitValue(char32_t ucs4)
bool isDigit(char32_t ucs4)
bool isLetterOrNumber(char32_t ucs4)
bool isSpace(char32_t ucs4)
bool isUpper(char32_t ucs4)
char32_t toUpper(char32_t ucs4)
void push_back(QList< T >::parameter_type value)
bool contains(const Key &key) const const
QList< T > values() const const
const QChar at(qsizetype position) const const
int compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs)
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
bool endsWith(QChar c, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
bool isNull() const const
QString left(qsizetype n) &&
qsizetype length() const const
QString mid(qsizetype position, qsizetype n) &&
QString number(double n, char format, int precision)
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)
QString right(qsizetype n) &&
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
int toInt(bool *ok, int base) const const
QString toUpper() const const
QString trimmed() const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
qsizetype removeDuplicates()
QStringView left(qsizetype length) const const
QStringView right(qsizetype length) const const
CaseInsensitive
QVariant fromValue(T &&value)
bool toBool() const const
int toInt(bool *ok) const const
T value() const &const
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.
Definition valueobject.h:67