Skip to content

Commit

Permalink
libcore: Singleton accessor methods for Config and CommandLine
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Mar 23, 2016
1 parent 5eb0fa9 commit 800ee97
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doomsday/sdk/libcore/include/de/core/commandline.h
Expand Up @@ -227,6 +227,8 @@ class DENG2_PUBLIC CommandLine
*/
bool executeAndWait(String *output = 0) const;

static CommandLine &get();

private:
DENG2_PRIVATE(d)
};
Expand Down
2 changes: 2 additions & 0 deletions doomsday/sdk/libcore/include/de/core/config.h
Expand Up @@ -105,6 +105,8 @@ class DENG2_PUBLIC Config : public RecordAccessor, public IObject
Record &objectNamespace();
Record const &objectNamespace() const;

static Config &get();

private:
DENG2_PRIVATE(d)
};
Expand Down
6 changes: 6 additions & 0 deletions doomsday/sdk/libcore/src/core/commandline.cpp
Expand Up @@ -21,6 +21,7 @@
#include "de/String"
#include "de/NativePath"
#include "de/Log"
#include "de/App"

#include <QFile>
#include <QDir>
Expand Down Expand Up @@ -469,6 +470,11 @@ bool CommandLine::executeAndWait(String *output) const
return result;
}

CommandLine &CommandLine::get()
{
return App::commandLine();
}

CommandLine::ArgWithParams::ArgWithParams() : pos(0)
{}

Expand Down
5 changes: 5 additions & 0 deletions doomsday/sdk/libcore/src/core/config.cpp
Expand Up @@ -192,6 +192,11 @@ Record const &Config::objectNamespace() const
return d->config.globals();
}

Config &Config::get()
{
return App::config();
}

Version Config::upgradedFromVersion() const
{
return d->oldVersion;
Expand Down

0 comments on commit 800ee97

Please sign in to comment.