ctkVTKCommandOptions.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Library:   CTK
00004  
00005   Copyright (c) 2010  Kitware Inc.
00006 
00007   Licensed under the Apache License, Version 2.0 (the "License");
00008   you may not use this file except in compliance with the License.
00009   You may obtain a copy of the License at
00010 
00011       http://www.commontk.org/LICENSE
00012 
00013   Unless required by applicable law or agreed to in writing, software
00014   distributed under the License is distributed on an "AS IS" BASIS,
00015   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016   See the License for the specific language governing permissions and
00017   limitations under the License.
00018  
00019 =========================================================================*/
00020 /*=========================================================================
00021   
00022   Program:   ParaView
00023   Module:    $RCSfile: vtkCommandOptions.h,v $
00024 
00025   Copyright (c) Kitware, Inc.
00026   All rights reserved.
00027   See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
00028 
00029      This software is distributed WITHOUT ANY WARRANTY; without even
00030      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00031      PURPOSE.  See the above copyright notice for more information.
00032 
00033 =========================================================================*/
00034 
00035 #ifndef __ctkVTKCommandOptions_h
00036 #define __ctkVTKCommandOptions_h
00037 
00038 // Qt includes
00039 #include <QStringList>
00040 
00041 // CTK includes
00042 #include <ctkPimpl.h>
00043 
00044 // STD includes
00045 #include <vector>
00046 #include <string>
00047 
00048 #include "CTKVisualizationVTKCoreExport.h"
00049 
00050 class QSettings;
00051 class ctkVTKCommandOptionsPrivate;
00052 
00053 class CTK_VISUALIZATION_VTK_CORE_EXPORT ctkVTKCommandOptions
00054 {
00055 public:
00057   explicit ctkVTKCommandOptions(QSettings* _settings);
00058   virtual ~ctkVTKCommandOptions();
00059 
00060   virtual void printAdditionalInfo();
00061 
00062   enum
00063   {
00064     ALL = 0,
00065     QSETTINGS_ONLY = 0x1
00066   };
00067 
00070   bool parse(int argc, const char* const argv[]);
00071 
00074   QStringList remainingArguments();
00075   void remainingArguments(int* argc, char*** argv);
00076 
00079   bool ignoreRest()const;
00080 
00083   QStringList ignoredArguments()const;
00084 
00087   int indexOfLastParsedArgument();
00088   
00091   bool helpSelected()const;
00092   QString help(); 
00093 
00096   bool disableSettings()const;
00097 
00101   int processType()const;
00102   void setProcessType(int p);
00103 
00106   QSettings* settings()const;
00107 
00110   QString unknownArgument()const;
00111 
00114   QString errorMessage()const;
00115 
00116 protected:
00117   
00125   void addBooleanArgument(const char* longarg, const char* shortarg,
00126                           bool* var, const char* arghelp, bool defaultValue = false,
00127                           int type=ALL);
00128   void addDeprecatedArgument(const char* longarg, const char* shortarg,
00129                              const char* arghelp, int type=ALL);
00130   void addArgument(const char* longarg, const char* shortarg,
00131                    int* var, const char* arghelp, int defaultValue = 0, int type=ALL);
00132   void addArgument(const char* longarg, const char* shortarg,
00133                    QString* var, const char* arghelp,
00134                    const QString& defaultValue = QString(), int type=ALL);
00135   void addArgument(const char* longarg, const char* shortarg,
00136                    QStringList* var, const char* arghelp,
00137                    const QStringList& defaultValue = QStringList(), int type=ALL);
00138 
00139 
00141   virtual void initialize();
00142 
00144   virtual void disableCurrentSettings() = 0;
00145   
00148   virtual bool postProcess(int argc, const char* const* argv);
00149 
00152   virtual bool wrongArgument(const char* argument);
00153 
00156   virtual bool deprecatedArgument(const char* argument);
00157   
00158 private:
00159   CTK_DECLARE_PRIVATE(ctkVTKCommandOptions);
00160 }; 
00161 
00162 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines