ProgParams.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. //---------------------------------------------------------------------------
  2. #ifndef ProgParamsH
  3. #define ProgParamsH
  4. //---------------------------------------------------------------------------
  5. enum TParamType {ptParam, ptSwitch};
  6. //---------------------------------------------------------------------------
  7. class TProgramParams
  8. {
  9. public:
  10. TProgramParams();
  11. bool __fastcall FindSwitch(const AnsiString Switch);
  12. bool __fastcall FindSwitch(const AnsiString Switch, AnsiString & Value);
  13. bool __fastcall FindSwitch(const AnsiString Switch, AnsiString & Value, int & Position);
  14. AnsiString __fastcall SwitchValue(const AnsiString Switch, const AnsiString Default = "");
  15. __property AnsiString SwitchValueDelimiters = { read=FSwitchValueDelimiters, write=FSwitchValueDelimiters };
  16. __property bool IgnoreCase = { read=FIgnoreCase, write=FIgnoreCase };
  17. __property Integer ParamCount = { read=GetParamCount };
  18. __property Integer Count = { read=GetCount };
  19. __property AnsiString Param[Integer Index] = { read=GetParam };
  20. __property AnsiString SwitchMarks = { read=FSwitchMarks, write=FSwitchMarks };
  21. protected:
  22. TParamType __fastcall ParamType(Integer Index, AnsiString & Value);
  23. private:
  24. AnsiString FSwitchMarks;
  25. AnsiString FSwitchValueDelimiters;
  26. bool FIgnoreCase;
  27. Integer FParamCount;
  28. Integer __fastcall GetParamCount();
  29. Integer __fastcall GetCount();
  30. AnsiString __fastcall GetParam(Integer Index);
  31. };
  32. //---------------------------------------------------------------------------
  33. #endif