ProgParams.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <Common.h>
  5. #include "ProgParams.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init)
  8. //---------------------------------------------------------------------------
  9. std::unique_ptr<TProgramParams> ProgramParamsOwner;
  10. //---------------------------------------------------------------------------
  11. TProgramParams * __fastcall TProgramParams::Instance()
  12. {
  13. if (ProgramParamsOwner.get() == NULL)
  14. {
  15. ProgramParamsOwner.reset(new TProgramParams());
  16. }
  17. return ProgramParamsOwner.get();
  18. }
  19. //---------------------------------------------------------------------------
  20. __fastcall TProgramParams::TProgramParams()
  21. {
  22. Init(CmdLine);
  23. }
  24. //---------------------------------------------------------------------------
  25. __fastcall TProgramParams::TProgramParams(const UnicodeString & CmdLine)
  26. {
  27. Init(CmdLine);
  28. }
  29. //---------------------------------------------------------------------------
  30. void __fastcall TProgramParams::Init(const UnicodeString & CmdLine)
  31. {
  32. UnicodeString CommandLine = CmdLine;
  33. UnicodeString Param;
  34. CutToken(CommandLine, Param);
  35. Parse(CommandLine);
  36. }
  37. //---------------------------------------------------------------------------
  38. UnicodeString __fastcall TProgramParams::FormatSwitch(const UnicodeString & Switch)
  39. {
  40. return FORMAT(L"/%s", (Switch));
  41. }