summaryrefslogtreecommitdiff
path: root/logbook/countriesworked.cpp
blob: a70a4e1af8b27de89c87bf419c5c334d71eddc19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#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);
}     
      
bool CountriesWorked::getHasWorked(const QString countryName)
{  
    if (_data.contains(countryName))
      return _data.value(countryName);  

    return false;
}
    
int CountriesWorked::getWorkedCount()
{
    int count = 0;
	foreach (bool value,_data)
		if (value)
			count += 1;
    return count;
}
    
int CountriesWorked::getSize()
{
    return _data.count();
}