29 #ifndef PT_SYSTEM_APPLICATION_H
30 #define PT_SYSTEM_APPLICATION_H
32 #include <Pt/System/Api.h>
33 #include <Pt/System/MainLoop.h>
35 #include <Pt/Signal.h>
36 #include <Pt/Connectable.h>
42 class ApplicationImpl;
111 {
return _systemSignal; }
129 template <
typename T>
132 return Arg<T>(*_argc, _argv, name);
137 template <
typename T>
140 return Arg<T>(*_argc, _argv, name, def);
145 template <
typename T>
148 return Arg<T>(*_argc, _argv, name);
153 template <
typename T>
156 return Arg<T>(*_argc, _argv, name, def);
184 static void setEnvVar(
const std::string& name,
const std::string& value);
198 static unsigned long usedMemory();
201 ApplicationImpl& impl()
212 ApplicationImpl* _impl;
222 #endif // PT_SYSTEM_APPLICATION_H
Core module.
Definition: pt-gfx-images.dox:14
Application(EventLoop *loop, int &argc, char **argv=0)
Construct with custom event loop.
static void unsetEnvVar(const std::string &name)
Unset environment variable.
static void setEnvVar(const std::string &name, const std::string &value)
Set environment variable.
Arg< T > getArg(const char *name)
Returns the value of a long option.
Definition: Application.h:130
Arg< T > getArg(const char *name, const T &def)
Returns the value of a long option.
Definition: Application.h:138
void exit()
Exits from the contained event loop.
Definition: Application.h:93
EventLoop & loop()
Returns the event loop.
Definition: Application.h:83
Read and extract command-line options.
Definition: Arg.h:200
Arg< T > getArg(const char name, const T &def)
Returns the value of a short option.
Definition: Application.h:154
bool raiseSystemSignal(int sig)
Raise a system signal.
Arg< T > getArg(const char name)
Returns the value of a short option.
Definition: Application.h:146
char ** argv() const
Command line arguments.
Definition: Application.h:120
int & argc() const
Number of command line arguments.
Definition: Application.h:115
static Path rootdir()
Returns the system root path.
Connection Management for Signal and Slot Objects.
Definition: Connectable.h:50
Application()
default Constructor.
static Application & instance()
Returns an instance to the application.
bool ignoreSystemSignal(int sig)
Ignores a system signal.
Application(int &argc, char **argv=0)
Construct with command line arguments.
static std::string getEnvVar(const std::string &name)
Get environment variable.
void run()
Starts the contained event loop.
Definition: Application.h:88
Represents a path in the file-system.
Definition: Path.h:48
Thread-safe event loop supporting I/O multiplexing and Timers.
Definition: EventLoop.h:74
static Path tmpdir()
Returns the systems tmp directory.
Signal< int > & systemSignal()
Notifies when a system signal was caught.
Definition: Application.h:110
static void chdir(const Path &path)
Changes the current directory.
void setArgs(int &argc, char **argv)
Set command line arguments.
~Application()
Destructor.
Console applications without a GUI.
Definition: Application.h:55
Thread-safe event loop supporting I/O multiplexing and Timers.
Definition: MainLoop.h:67
Application(EventLoop *loop)
Default construct with custom event loop.
static Path cwd()
Returns the current directory.
bool catchSystemSignal(int sig)
Catch a system signal.