2013-07-31 07:29:42 -04:00
|
|
|
/*
|
|
|
|
* Reads cty.dat file
|
|
|
|
* Establishes a map between prefixes and their country names
|
|
|
|
* VK3ACF July 2013
|
|
|
|
*/
|
|
|
|
|
2018-10-24 19:00:19 -04:00
|
|
|
#ifndef COUNTRY_DAT_H_
|
|
|
|
#define COUNTRY_DAT_H_
|
2013-07-31 07:29:42 -04:00
|
|
|
|
2018-10-24 19:00:19 -04:00
|
|
|
#include <boost/core/noncopyable.hpp>
|
2013-08-08 19:51:53 -04:00
|
|
|
#include <QString>
|
|
|
|
#include <QHash>
|
2013-07-31 07:29:42 -04:00
|
|
|
|
2018-10-24 19:00:19 -04:00
|
|
|
class CountryDat final
|
|
|
|
: private boost::noncopyable
|
2013-07-31 07:29:42 -04:00
|
|
|
{
|
2018-10-24 19:00:19 -04:00
|
|
|
public:
|
|
|
|
CountryDat ();
|
|
|
|
QString find (QString const& call) const; // return country name or ""
|
2013-07-31 07:29:42 -04:00
|
|
|
|
2015-11-17 20:28:12 -05:00
|
|
|
private:
|
2018-10-24 19:00:19 -04:00
|
|
|
QString extractName (QString const& line) const;
|
|
|
|
void removeBrackets (QString& line, QString const& a, QString const& b) const;
|
|
|
|
QStringList extractPrefix (QString& line, bool& more) const;
|
2017-10-01 17:44:07 -04:00
|
|
|
QString fixup (QString country, QString const& call) const;
|
2015-11-17 20:28:12 -05:00
|
|
|
|
2018-10-24 19:00:19 -04:00
|
|
|
QHash<QString, QString> data_;
|
2013-07-31 07:29:42 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|