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.

62 lines
813 B

  1. #pragma once
  2. //---------------------------------------------------------------------------
  3. // Arguments Class
  4. //---------------------------------------------------------------------------
  5. class CArguments
  6. {
  7. public:
  8. CArguments(int argc, wchar_t* argv[]) :
  9. m_iArg(1),
  10. m_cArg(argc),
  11. m_ppszArg(argv)
  12. {
  13. }
  14. LPCTSTR Value()
  15. {
  16. LPCTSTR pszArg = NULL;
  17. if ((m_iArg > 0) && (m_iArg < m_cArg))
  18. {
  19. pszArg = m_ppszArg[m_iArg];
  20. }
  21. return pszArg;
  22. }
  23. bool Next()
  24. {
  25. if (m_iArg < m_cArg)
  26. {
  27. ++m_iArg;
  28. }
  29. return (m_iArg < m_cArg);
  30. }
  31. bool Prev()
  32. {
  33. if (m_iArg > 0)
  34. {
  35. --m_iArg;
  36. }
  37. return (m_iArg > 0);
  38. }
  39. protected:
  40. CArguments(const CArguments& r) {}
  41. CArguments& operator =(const CArguments& r) { return *this; }
  42. protected:
  43. int m_iArg;
  44. int m_cArg;
  45. _TCHAR** m_ppszArg;
  46. };