summaryrefslogtreecommitdiff
path: root/logbook/countriesworked.cpp
diff options
context:
space:
mode:
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();
+}
+
+
+
+
+
+