input_argument_parser.h
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
00033 #ifndef __input_argument_parser__header__
00034 #define __input_argument_parser__header__
00035
00036
00037 #include "gpucalc/string_util.h"
00038
00039 namespace gpucalc
00040 {
00041
00042
00043 class _GpuCalcExport InputArguments
00044 {
00045
00046 friend class Application;
00047 friend class InputArgParser;
00048
00049 public:
00050 InputArguments(int argc, char * argv []): mLogFile("gpucalc.log"), mApplicationName("gpucalc"), mConfigFile("plugins.cfg"), mPluginList(),
00051 mShaders(), mLoggingLevel(LL_Normal), mDebug(false), mWarnings(true), mArgc(argc), mArgv(argv)
00052 {
00053 }
00054
00055 InputArguments(const InputArguments & ia): mLogFile(ia.mLogFile), mApplicationName(ia.mApplicationName), mConfigFile(ia.mConfigFile),
00056 mPluginList(ia.mPluginList), mShaders(ia.mShaders), mLoggingLevel(ia.mLoggingLevel), mDebug(ia.mDebug), mWarnings(ia.mWarnings),
00057 mArgc(ia.mArgc), mArgv(ia.mArgv)
00058 {
00059 }
00060
00061 ~InputArguments()
00062 {
00063 }
00064
00065
00066 const std::string & getLogFile() const
00067 {
00068 return mLogFile;
00069 }
00070
00071
00072 const std::string & getApplicationName() const
00073 {
00074 return mApplicationName;
00075 }
00076
00077
00078 const std::string & getConfigFile() const
00079 {
00080 return mConfigFile;
00081 }
00082
00083
00084 const StringList & getPluginList() const
00085 {
00086 return mPluginList;
00087 }
00088
00089 const StringMap & getShaders() const
00090 {
00091 return mShaders;
00092 }
00093
00094 std::string getArgument(unsigned int pos) const
00095 {
00096 return mArgv[pos];
00097 }
00098
00099 int getArgc()
00100 {
00101 return mArgc;
00102 }
00103
00104
00105 char ** getArgv()
00106 {
00107 return mArgv;
00108 }
00109
00110 LoggingLevel getLoggingLevel() const
00111 {
00112 return mLoggingLevel;
00113 }
00114
00115 private:
00116
00117 std::string mLogFile;
00118 std::string mApplicationName;
00119 std::string mConfigFile;
00120
00121 StringList mPluginList;
00122 StringMap mShaders;
00123
00124 LoggingLevel mLoggingLevel;
00125
00126 bool mDebug;
00127
00128 bool mWarnings;
00129
00130 int mArgc;
00131 char ** mArgv;
00132 };
00133
00134
00135
00136
00137 class _GpuCalcExport InputArgParser
00138 {
00139 public:
00140
00141
00142 static InputArguments parse(int argc, char * argv []);
00143
00144
00145 private:
00146
00147
00148
00149 static void print_version();
00150
00151
00152 static void print_plugins();
00153 };
00154 }
00155
00156
00157
00158 #endif