/* © Copyright 2008 Randal A. Koene With design assistance from J. van Pelt & A. van Ooyen, and support from the Netherlands Organization for Scientific Research (NWO) Program Computational Life Sciences grant CLS2003 (635.100.005) and from the EC Marie Curie Research and Training Network (RTN) NEURoVERS-it 019247. This file is part of NETMORPH. NETMORPH is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NETMORPH is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NETMORPH. If not, see . */ // Command_Line_Parameters.hh // Randal A. Koene, 20041215 // // These classes parse the command line or HTML form input and create // an object with command line parameter data. #ifndef __COMMAND_LINE_PARAMETERS_HH #define __COMMAND_LINE_PARAMETERS_HH #include #include //STL#include #include "StringList.hh" #define TRACK_RECOGNIZED_COMMANDS class Command_Line_Parameters { protected: bool calledbyforminput; int clpargc; char ** clpargv; void Add_to_Substitutions(String subs); void Apply_Substitutions(String & pname); #ifdef TRACK_RECOGNIZED_COMMANDS void Add_Parameter(String pname, String pvalue, String co); #else void Add_Parameter(String pname, String pvalue); #endif void Parse_File(const char filename[]); bool Detect_Form_Input(); bool Parse_Command_Line(); StringList parname, parvalue; int numparameters; int includefileerrors; #ifdef TRACK_RECOGNIZED_COMMANDS //STLstd::vector * recognized; int * recognized; StringList origin; int recognizedsize; #endif StringList substitutionpat, substitutionstr; int numsubstitutions; #ifdef TRACK_RECOGNIZED_COMMANDS protected: void Expand_Recognized(unsigned int oldlen, unsigned int newlen); #endif public: Command_Line_Parameters(int _clpargc, char * _clpargv[], const char helpstr[], const char rcfile[] = ""); int NumParameters() { return numparameters; } String ParName(int n) { if (n=0) && ((unsigned long) n < recognized->size())) (*recognized)[n]++; return n; } long Specifies_Parameter(String pname) { long n = parname.iselement(pname); if ((n>=0) && (n=0) && (n