input_argument_parser.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Kutumov Alexey                                  *
00003  *   ru.pixel@gmail.com                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
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 }

Generated on Thu Mar 5 22:36:42 2009 for gpucalc by  doxygen 1.5.6