summaryrefslogtreecommitdiff
path: root/logbook/countriesworked.cpp
diff options
context:
space:
mode:
authorIain R. Learmonth <irl@debian.org>2015-10-18 18:51:03 +0100
committerIain R. Learmonth <irl@debian.org>2015-10-18 18:51:03 +0100
commit7ccc963875ee66fe4c817da95461d891039ba1a2 (patch)
tree742cb44e4987b2dfe2db2aac83cd052040a97a8c /logbook/countriesworked.cpp
parent5c4ba866a16d2d10d751152dd162d3761d68aacd (diff)
parentd63dd8d081a6fcd0715cd13f26df59fb831769d2 (diff)
Merge tag 'upstream/1.5.0'
Upstream version 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();
+}
+
+
+
+
+
+