Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef COREAPPLICATION_H
00028 #define COREAPPLICATION_H
00029
00030 #include <string>
00031 #include <errno.h>
00032
00033 #include "GpCoreToolsDLLExport.h"
00034
00035 namespace GpCoreTools {
00036
00037 class ApplicationHelp;
00038
00039 class GPCORETOOLS_EXPORT CoreApplication
00040 {
00041 public:
00042 CoreApplication(int & argc, char ** argv, ApplicationHelp * ( *help) (), bool reportBugs=true);
00043 virtual ~CoreApplication();
00044
00045 virtual void close() {}
00046
00047 static std::string version();
00048 static std::string version(const char * item);
00049 static std::string authors();
00050 static void exit(int exitCode);
00051
00052 static bool checkOptionArg(int& i, int argc, char ** argv, bool mandatory=true);
00053 void showHelp(int& i, int argc, char ** argv, ApplicationHelp * ( *help) ());
00054
00055 static CoreApplication * instance() {return _self;}
00056
00057 static std::string getStdin();
00058 static std::string backTrace();
00059 static std::string backTraceBug();
00060 static void osSignal(int sigNum);
00061 int terminalRows() const;
00062 int terminalCols() const;
00063 const char * applicationName() const {return _applicationName.data();}
00064 void initInternalDebugger();
00065 protected:
00066 void setHelp(ApplicationHelp * h);
00067 private:
00068 void terminalSize() const;
00069 void reportBug();
00070
00071 static CoreApplication * _self;
00072 std::string _applicationName;
00073 mutable int _terminalCols, _terminalRows;
00074 bool _reportBugs;
00075 };
00076
00077 template <typename T>
00078 inline void unused(const T& x) {(void)x;}
00079
00080 #define UNUSED(x) unused(x)
00081
00082 }
00083
00084 #endif // COREAPPLICATION_H