29#ifndef PT_SYSTEM_APPLICATION_H
30#define PT_SYSTEM_APPLICATION_H
32#include <Pt/System/Api.h>
33#include <Pt/System/MainLoop.h>
36#include <Pt/Connectable.h>
130 {
return _systemSignal; }
148 template <
typename T>
151 return Arg<T>(*_argc, _argv, name);
156 template <
typename T>
159 return Arg<T>(*_argc, _argv, name, def);
164 template <
typename T>
167 return Arg<T>(*_argc, _argv, name);
172 template <
typename T>
175 return Arg<T>(*_argc, _argv, name, def);
203 static void setEnvVar(
const std::string& name,
const std::string& value);
222 ApplicationImpl& impl()
233 ApplicationImpl* _impl;
Command-line option extracted from argc and argv.
Definition Arg.h:211
Connection Management for Signal and Slot Objects.
Definition Connectable.h:50
Multicast Signal to call multiple slots.
Definition Signal.h:190
char ** argv() const
Command line arguments.
Definition Application.h:139
Arg< T > getArg(const char name, const T &def)
Returns the value of a short option.
Definition Application.h:173
void run()
Starts the contained event loop.
Definition Application.h:107
Application(EventLoop *loop)
Default construct with custom event loop.
static Path cwd()
Returns the current directory.
bool raiseSystemSignal(int sig)
Raise a system signal.
static void setEnvVar(const std::string &name, const std::string &value)
Set environment variable.
void exit()
Exits from the contained event loop.
Definition Application.h:112
static void chdir(const Path &path)
Changes the current directory.
Application(int &argc, char **argv=0)
Construct with command line arguments.
bool catchSystemSignal(int sig)
Catch a system signal.
bool ignoreSystemSignal(int sig)
Ignores a system signal.
EventLoop & loop()
Returns the event loop.
Definition Application.h:102
Arg< T > getArg(const char *name)
Returns the value of a long option.
Definition Application.h:149
static Path tmpdir()
Returns the systems tmp directory.
static Path rootdir()
Returns the system root path.
static std::string getEnvVar(const std::string &name)
Get environment variable.
~Application()
Destructor.
Arg< T > getArg(const char name)
Returns the value of a short option.
Definition Application.h:165
Signal< int > & systemSignal()
Notifies when a system signal was caught.
Definition Application.h:129
static unsigned long usedMemory()
Returns the amount of used memory.
static Application & instance()
Returns an instance to the application.
Arg< T > getArg(const char *name, const T &def)
Returns the value of a long option.
Definition Application.h:157
void setArgs(int &argc, char **argv)
Set command line arguments.
Application(EventLoop *loop, int &argc, char **argv=0)
Construct with custom event loop.
static void unsetEnvVar(const std::string &name)
Unset environment variable.
Application()
default Constructor.
int & argc() const
Number of command line arguments.
Definition Application.h:134
Event loop of a thread or process.
Definition EventLoop.h:83
Platform event loop.
Definition MainLoop.h:51
Represents a path in the file-system.
Definition Path.h:48
System programming
Definition Connection.h:26
Core module.
Definition Allocator.h:33