File: countriesworked.cpp

package info (click to toggle)
js8call 2.5.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,720 kB
  • sloc: cpp: 562,651; sh: 898; python: 132; ansic: 102; makefile: 4
file content (42 lines) | stat: -rw-r--r-- 726 bytes parent folder | download
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) const
{
    if (_data.contains(countryName))
      return _data.value(countryName);

    return false;
}

qsizetype CountriesWorked::getWorkedCount() const
{
    qsizetype count = 0;
	foreach (bool value,_data)
		if (value)
			count += 1;
    return count;
}

qsizetype CountriesWorked::getSize() const
{
    return _data.count();
}