Better detection of allsign from general calls (CQ, QRZ ...)

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8027 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2017-08-16 12:10:50 +00:00
parent 84813be7db
commit 388f5d13ab
1 changed files with 2 additions and 28 deletions

View File

@ -3,40 +3,14 @@
#include <QStringList>
#include <QRegularExpression>
extern "C" {
bool stdmsg_(const char* msg, int len);
}
QString DecodedText::CQersCall()
{
// extract the CQer's call TODO: does this work with all call formats?
int s1 {0};
int position;
QString t=_string;
if ((position = _string.indexOf (" CQ DX ")) >= 0)
{
s1 = 7 + position;
}
else if ((position = _string.indexOf (" CQDX ")) >= 0)
{
s1 = 6 + position;
}
else if ((position = _string.indexOf (" CQ ")) >= 0)
{
s1 = 4 + position;
if(_string.mid(s1,3).toInt() > 0 and _string.mid(s1,3).toInt() <= 999) s1 += 4;
}
else if ((position = _string.indexOf (" DE ")) >= 0)
{
s1 = 4 + position;
}
else if ((position = _string.indexOf (" QRZ ")) >= 0)
{
s1 = 5 + position;
}
auto s2 = _string.indexOf (" ", s1);
return _string.mid (s1, s2 - s1);
QRegularExpression callsign_re {R"(\s(CQ|DE|QRZ)(\s?DX|\s([A-Z]{2}|\d{3}))?\s(?<callsign>[A-Z0-9/]{2,})(\s[A-R]{2}[0-9]{2})?)"};
return callsign_re.match (_string).captured ("callsign");
}