]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/application.cpp
Move accessors of static data members to .cpp files
[libs/core.git] / source / core / application.cpp
index 8447eed669d2b8f58c9b078b547b1543b0bab27f..c214a06316598b54ed59403493df366a60ca568f 100644 (file)
@@ -9,6 +9,7 @@
 #include <msp/io/print.h>
 #include <msp/strings/utils.h>
 #include "application.h"
+#include "except.h"
 #include "getopt.h"
 
 using namespace std;
@@ -24,7 +25,7 @@ void *Application::_data = nullptr;
 Application::Application(const string &n)
 {
        if(_app)
-               throw logic_error("instance already exists");
+               throw already_called("Application::Application");
 
        if(!n.empty())
                _name = n;
@@ -94,7 +95,7 @@ int Application::run(int argc, char **argv, void *data, void (*created_callback)
 void Application::set_startup_info(const char *argv0, void *data)
 {
        if(_argv0)
-               throw logic_error("startup info already set");
+               throw already_called("Application::set_startup_info");
 
        static FS::Path exe;
 
@@ -117,6 +118,21 @@ void Application::set_startup_info(const char *argv0, void *data)
        _data = data;
 }
 
+void *Application::get_data()
+{
+       return _data;
+}
+
+const char *Application::get_argv0()
+{
+       return _argv0;
+}
+
+const std::string &Application::get_name()
+{
+       return _name;
+}
+
 int Application::main()
 {
        done = false;
@@ -146,7 +162,7 @@ void Application::_sighandler(int s)
 Application::Starter::Starter()
 {
        if(_starter)
-               throw logic_error("Can't create more than one Starter instance");
+               throw already_called("Application::Starter::Starter");
 
        _starter = this;
 }