input_argument_parser.h

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 
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

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