2013-07-31 07:29:42 -04:00
|
|
|
#include "countriesworked.h"
|
|
|
|
|
|
|
|
void CountriesWorked::init(const QStringList countryNames)
|
|
|
|
{
|
|
|
|
_data.clear();
|
|
|
|
foreach(QString name,countryNames)
|
|
|
|
_data.insert(name,false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CountriesWorked::setAsWorked(const QString countryName)
|
|
|
|
{
|
|
|
|
if (_data.contains(countryName))
|
|
|
|
_data.insert(countryName,true);
|
|
|
|
}
|
|
|
|
|
2017-08-29 22:27:57 -04:00
|
|
|
bool CountriesWorked::getHasWorked(const QString countryName) const
|
2013-07-31 07:29:42 -04:00
|
|
|
{
|
|
|
|
if (_data.contains(countryName))
|
|
|
|
return _data.value(countryName);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-08-29 22:27:57 -04:00
|
|
|
int CountriesWorked::getWorkedCount() const
|
2013-07-31 07:29:42 -04:00
|
|
|
{
|
|
|
|
int count = 0;
|
|
|
|
foreach (bool value,_data)
|
|
|
|
if (value)
|
|
|
|
count += 1;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2017-08-29 22:27:57 -04:00
|
|
|
int CountriesWorked::getSize() const
|
2013-07-31 07:29:42 -04:00
|
|
|
{
|
|
|
|
return _data.count();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|