Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: cwargv.hxx
  8. //
  9. // Contents: argv parsing api
  10. //
  11. // History: 02-Oct-1997 pberkman create
  12. //
  13. //--------------------------------------------------------------------------
  14. #ifndef CWARGV_HXX
  15. #define CWARGV_HXX
  16. #include "stack.hxx"
  17. #define WARGV_VALUETYPE_BOOL 1 // just there or not
  18. #define WARGV_VALUETYPE_WCHAR 2 // -p file_name, etc.
  19. #define WARGV_VALUETYPE_DWORDH 3 // -c 99, etc. hex
  20. #define WARGV_VALUETYPE_DWORDD 4 // -c 99, etc. decimal
  21. //
  22. // command file argument is xxxx.exe [options] [filename] [@commandfile]
  23. //
  24. class cWArgv_
  25. {
  26. public:
  27. cWArgv_(HINSTANCE hInst0, BOOL *pfFailed, BOOL fCheckForCommandFile = TRUE);
  28. virtual ~cWArgv_(void);
  29. BOOL Add2List(DWORD dwsidOption, DWORD dwsidOptionHellp,
  30. DWORD dwValueType, void *pvDefaultValue = NULL,
  31. BOOL fInternalArg = FALSE);
  32. BOOL Fill(int argc, WCHAR **wargv);
  33. void *GetValue(DWORD dwsidOption);
  34. WCHAR *GetOption(DWORD dwsidOption);
  35. WCHAR *GetOptionHelp(DWORD dwsidOption);
  36. WCHAR *GetFileName(DWORD *pdwidxLast = NULL);
  37. // the format should be "usage" "[options]"
  38. // "[@commandfile]" "filename"
  39. // "<input param>"
  40. void AddUsageText(DWORD dwsidUsageWord, DWORD dwsidUsageOptionsText,
  41. DWORD dwsidUsageCmdFileText, DWORD dwsidUsageAddText,
  42. DWORD dwsidOptionParamText);
  43. WCHAR *GetUsageString(void);
  44. BOOL IsSet(DWORD dwsidOption);
  45. private:
  46. HINSTANCE hInst;
  47. BOOL fChkCmdF;
  48. BOOL fShowHiddenArgs;
  49. BOOL fNonHiddenParamArgs;
  50. WCHAR *pwszThisFilename;
  51. WCHAR *pwszUsageWord;
  52. WCHAR *pwszUsageOptionsText;
  53. WCHAR *pwszUsageCmdFileText;
  54. WCHAR *pwszOptionParamText;
  55. WCHAR *pwszUsageAddText;
  56. WCHAR *pwszUsageString;
  57. WCHAR *pwszNonParamArgBlanks;
  58. DWORD dwLongestArg;
  59. Stack_ *pArgs;
  60. BOOL ProcessCommandFile(WCHAR *pwszFile);
  61. int ProcessArg(int argc, WCHAR **wargv);
  62. BOOL AddFile(WCHAR *pwszFile);
  63. void StripQuotes(WCHAR *pwszIn);
  64. };
  65. #endif // CWARGV_HXX