input_argument_parser.cpp
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
00034 #include "gpucalc/input_argument_parser.h"
00035
00036 #include "gpucalc/application.h"
00037 #include "gpucalc/gpucalc.h"
00038
00039 namespace gpucalc
00040 {
00041 InputArguments InputArgParser::parse(int argc, char * argv [])
00042 {
00043 InputArguments result(argc, argv);
00044 for (int i = 0; i < argc; ++i)
00045 {
00046 if (std::string("--plugin") == argv[i])
00047 {
00048 ++i;
00049 if (i < argc)
00050 {
00051 result.mPluginList.push_back(argv[i]);
00052 continue;
00053 }
00054 }
00055
00056 if (std::string("--config") == argv[i])
00057 {
00058 ++i;
00059 if (i < argc)
00060 {
00061 result.mConfigFile = argv[i];
00062 continue;
00063 }
00064 }
00065
00066 if (std::string("--shader") == argv[i])
00067 {
00068 i += 2;
00069 if (i < argc)
00070 {
00071 result.mShaders.insert(std::make_pair(argv[i - 1], argv[i]));
00072 continue;
00073 }
00074 }
00075
00076 if (std::string("--log_level") == argv[i])
00077 {
00078 ++i;
00079 if (i < argc)
00080 {
00081 if (argv[i] == std::string("low")) result.mLoggingLevel = LL_Low;
00082 if (argv[i] == std::string("normal")) result.mLoggingLevel = LL_Normal;
00083 if (argv[i] == std::string("verbose")) result.mLoggingLevel = LL_Verbose;
00084 continue;
00085 }
00086 }
00087 }
00088 return result;
00089 }
00090
00091
00092 void InputArgParser::print_version()
00093 {
00094 switch (COMPILER)
00095 {
00096 case COMPILER_MSVC:
00097 std::cout << "Compiled with MS C++ compiler, version is: " << COMP_VER << std::endl;
00098 break;
00099
00100 case COMPILER_GNUC:
00101 std::cout << "Compiled with GNU C++ compiler, version is: " << COMP_VER << std::endl;
00102 break;
00103
00104 case COMPILER_BORL:
00105 std::cout << "Compiled with Borland C++ compiler, version is: " << COMP_VER << std::endl;
00106 break;
00107
00108 default:
00109 std::cout << "Unknown C++ compiler." << std::endl;
00110 }
00111
00112 switch (PLATFORM)
00113 {
00114 case PLATFORM_WIN32:
00115 std::cout << "Running under Microsoft Windows." << std::endl;
00116 break;
00117
00118 case PLATFORM_APPLE:
00119 std::cout << "Running under Apple MacOS." << std::endl;
00120 break;
00121
00122 case PLATFORM_LINUX:
00123 std::cout << "Running under Unix/Linux compatible OS." << std::endl;
00124 break;
00125
00126 default:
00127 break;
00128 }
00129 std::cout << "gpucalc version is: " << gpucalc_version << std::endl;
00130 }
00131
00132
00133 void InputArgParser::print_plugins()
00134 {
00135 std::cerr << "Finding installed plugins is not implemented yet. InputArgParser::print_plugins()" << std::endl;
00136
00137 std::cout << "GraphicCore plugins:" << std::endl;
00138 std::cout << "\tGLGraphicCore" << std::endl;
00139
00140 std::cout << std::endl << "ShaderSystem plugins: " << std::endl;
00141 std::cout << "\tGLGLSLShaderSystem" << std::endl;
00142 std::cout << "\tGLCgShaderSystem" << std::endl;
00143 }
00144
00145
00146
00147
00148
00149 }