summaryrefslogtreecommitdiff
path: root/logbook/countriesworked.cpp
diff options
context:
space:
mode:
authorIain R. Learmonth <irl@debian.org>2015-10-18 18:51:00 +0100
committerIain R. Learmonth <irl@debian.org>2015-10-18 18:51:00 +0100
commitd63dd8d081a6fcd0715cd13f26df59fb831769d2 (patch)
treeb9c1f6245147a310aac3762630bad389bbb57335 /logbook/countriesworked.cpp
parentc720a3d55c5ec832c29cb7ce50b6fb4b70c55b11 (diff)
Imported Upstream version 1.5.0upstream/1.5.0
Diffstat (limited to 'logbook/countriesworked.cpp')
-rw-r--r--logbook/countriesworked.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/logbook/countriesworked.cpp b/logbook/countriesworked.cpp
new file mode 100644
index 00000000..a70a4e1a
--- /dev/null
+++ b/logbook/countriesworked.cpp
@@ -0,0 +1,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();
+}
+
+
+
+
+
+