add global settings container
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 5 Jul 2008 12:46:22 +0000 (14:46 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 5 Jul 2008 12:46:22 +0000 (14:46 +0200)
GlobalSettings.cpp [new file with mode: 0644]
GlobalSettings.h [new file with mode: 0644]

diff --git a/GlobalSettings.cpp b/GlobalSettings.cpp
new file mode 100644 (file)
index 0000000..bbfc11c
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+ * © 2008 by David ‘Bombe’ Roden <bombe@pterodactylus.net>
+ */
+
+#include "GlobalSettings.h"
+
+GlobalSettings::GlobalSettings() {
+       verbose = false;
+}
+
+GlobalSettings::~GlobalSettings() {
+}
+
+GlobalSettings* GlobalSettings::instance = 0;
+
+GlobalSettings* GlobalSettings::getInstance() {
+       if (instance) {
+               return instance;
+       }
+       instance = new GlobalSettings();
+       return instance;
+}
+
+void GlobalSettings::setVerbose(bool verbose) {
+       this->verbose = verbose;
+}
+
diff --git a/GlobalSettings.h b/GlobalSettings.h
new file mode 100644 (file)
index 0000000..cc9df32
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * © 2008 by David ‘Bombe’ Roden <bombe@pterodactylus.net>
+ */
+
+#pragma once
+
+class GlobalSettings {
+
+private:
+       GlobalSettings();
+       ~GlobalSettings();
+
+public:
+       static GlobalSettings* getInstance();
+
+       void setVerbose(bool verbose);
+
+private:
+       static GlobalSettings* instance;
+       bool verbose;
+
+};
+