mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-03-21 11:38:34 -04:00
Helper functions for callsign analysis
This commit is contained in:
parent
714a71c43a
commit
dd954be1ab
12
Radio.cpp
12
Radio.cpp
@ -14,10 +14,16 @@ namespace Radio
|
||||
double constexpr MHz_factor {1.e6};
|
||||
int constexpr frequency_precsion {6};
|
||||
|
||||
// valid callsign alphabet
|
||||
QRegularExpression callsign_alphabet_re {R"(^[A-Z0-9/]{3,11}$)"};
|
||||
|
||||
// very loose validation - callsign must contain a letter next to
|
||||
// a number
|
||||
QRegularExpression valid_callsign_regexp {R"(\d[[:alpha:]]|[[:alpha:]]\d)"};
|
||||
|
||||
// standard callsign
|
||||
QRegularExpression strict_standard_callsign_re {R"(^([A-Z][0-9]?|[0-9][A-Z])[0-9][A-Z]{0,3}$)"};
|
||||
|
||||
// suffixes that are often used and should not be interpreted as a
|
||||
// DXCC Entity prefix used as a suffix
|
||||
QRegularExpression non_prefix_suffix {R"(\A([0-9AMPQR]|QRP|F[DF]|[AM]M|L[HT]|LGT)\z)"};
|
||||
@ -112,6 +118,12 @@ namespace Radio
|
||||
return callsign.contains ('/');
|
||||
}
|
||||
|
||||
bool is_77bit_nonstandard_callsign (QString const& callsign)
|
||||
{
|
||||
return callsign.contains (callsign_alphabet_re)
|
||||
&& !callsign.contains (strict_standard_callsign_re);
|
||||
}
|
||||
|
||||
// split on first '/' and return the larger portion or the whole if
|
||||
// there is no '/'
|
||||
QString base_callsign (QString callsign)
|
||||
|
@ -53,6 +53,7 @@ namespace Radio
|
||||
//
|
||||
bool UDP_EXPORT is_callsign (QString const&);
|
||||
bool UDP_EXPORT is_compound_callsign (QString const&);
|
||||
bool is_77bit_nonstandard_callsign (QString const&);
|
||||
QString UDP_EXPORT base_callsign (QString);
|
||||
QString UDP_EXPORT effective_prefix (QString);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user