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;
61 explicit Application(
int argc = 0,
char** argv = 0);
92 bool ignoreSystemSignal(
int sig);
96 bool catchSystemSignal(
int sig);
100 bool raiseSystemSignal(
int sig);
105 {
return _systemSignal; }
119 template <
typename T>
122 return Arg<T>(_argc, _argv, name);
127 template <
typename T>
130 return Arg<T>(_argc, _argv, name, def);
135 template <
typename T>
138 return Arg<T>(_argc, _argv, name);
143 template <
typename T>
146 return Arg<T>(_argc, _argv, name, def);
151 static void chdir(
const Path& path);
160 static Path rootdir();
168 static Path tmpdir();
174 static void setEnvVar(
const std::string& name,
const std::string& value);
180 static void unsetEnvVar(
const std::string& name);
186 static std::string getEnvVar(
const std::string& name);
188 static unsigned long usedMemory();
191 ApplicationImpl& impl()
196 void init(EventLoop& loop);
201 ApplicationImpl* _impl;
211 #endif // PT_SYSTEM_APPLICATION_H
Console applications without a GUI.
Definition: Application.h:56
Connection Management for Signal and Slot Objects.
Definition: Connectable.h:49
Represents a path in the file-system.
Definition: Path.h:47
void run()
Starts the contained event loop.
Definition: Application.h:82
char ** argv() const
Command line arguments.
Definition: Application.h:114
Read and extract command-line options.
Definition: Arg.h:199
Signal< int > & systemSignal()
Notifies when a system signal was caught.
Definition: Application.h:104
EventLoop & loop()
Returns the event loop.
Definition: Application.h:77
Thread-safe event loop supporting I/O multiplexing and Timers.
Definition: EventLoop.h:72
int argc() const
Number of command line arguments.
Definition: Application.h:109
Arg< T > getArg(const char *name)
Returns the value of a long option.
Definition: Application.h:120
Arg< T > getArg(const char name)
Returns the value of a short option.
Definition: Application.h:136
void exit()
Exits from the contained event loop.
Definition: Application.h:87
Arg< T > getArg(const char name, const T &def)
Returns the value of a short option.
Definition: Application.h:144
Arg< T > getArg(const char *name, const T &def)
Returns the value of a long option.
Definition: Application.h:128