1 // Emacs style mode select -*- C++ -*- 2 //----------------------------------------------------------------------------- 3 // 4 // $Id: m_argv.h 4469 2014-01-03 23:38:29Z dr_sean $ 5 // 6 // Copyright (C) 1993-1996 by id Software, Inc. 7 // Copyright (C) 2006-2014 by The Odamex Team. 8 // 9 // This program is free software; you can redistribute it and/or 10 // modify it under the terms of the GNU General Public License 11 // as published by the Free Software Foundation; either version 2 12 // of the License, or (at your option) any later version. 13 // 14 // This program is distributed in the hope that it will be useful, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 // GNU General Public License for more details. 18 // 19 // DESCRIPTION: 20 // Command-line arguments 21 // 22 //----------------------------------------------------------------------------- 23 24 25 #ifndef __M_ARGV_H__ 26 #define __M_ARGV_H__ 27 28 #include "dobject.h" 29 #include "doomtype.h" 30 31 #include <string> 32 #include <vector> 33 34 // 35 // MISC 36 // 37 class DArgs : public DObject 38 { 39 DECLARE_CLASS (DArgs, DObject) 40 public: 41 DArgs (); 42 DArgs (const DArgs &args); 43 DArgs (unsigned int argc, char **argv); 44 DArgs (const char *cmdline); 45 ~DArgs (); 46 47 DArgs &operator= (const DArgs &other); 48 const char *operator[] (size_t n); 49 50 void AppendArg (const char *arg); 51 void SetArgs (unsigned int argc, char **argv); 52 void SetArgs(const char *cmdline); 53 DArgs GatherFiles (const char *param, const char *extension, bool acceptNoExt) const; 54 void SetArg (unsigned int argnum, const char *arg); 55 56 57 // Returns the position of the given parameter 58 // in the arg list (0 if not found). 59 size_t CheckParm (const char *check) const; 60 const char *CheckValue (const char *check) const; 61 const char *GetArg (size_t arg) const; 62 const std::vector<std::string> GetArgList (size_t start) const; 63 size_t NumArgs () const; 64 void FlushArgs (); 65 66 private: 67 68 std::vector<std::string> args; 69 70 void CopyArgs (unsigned int argc, char **argv); 71 72 }; 73 74 extern DArgs Args; 75 76 void M_FindResponseFile(void); 77 78 extern bool DefaultsLoaded; 79 80 #endif //__M_ARGV_H__ 81 82