Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 

77 рядки
1.9 KiB

  1. /******************************************************************************
  2. *
  3. * file: HelpVisitor.h
  4. *
  5. * Copyright (c) 2003, Michael E. Smoot .
  6. * All rights reverved.
  7. *
  8. * See the file COPYING in the top directory of this distribution for
  9. * more information.
  10. *
  11. * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
  12. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  14. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  16. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  17. * DEALINGS IN THE SOFTWARE.
  18. *
  19. *****************************************************************************/
  20. #ifndef TCLAP_HELP_VISITOR_H
  21. #define TCLAP_HELP_VISITOR_H
  22. #include "CmdLineInterface.h"
  23. #include "CmdLineOutput.h"
  24. #include "Visitor.h"
  25. namespace TCLAP {
  26. /**
  27. * A Visitor object that calls the usage method of the given CmdLineOutput
  28. * object for the specified CmdLine object.
  29. */
  30. class HelpVisitor: public Visitor
  31. {
  32. private:
  33. /**
  34. * Prevent accidental copying.
  35. */
  36. HelpVisitor(const HelpVisitor& rhs);
  37. HelpVisitor& operator=(const HelpVisitor& rhs);
  38. protected:
  39. /**
  40. * The CmdLine the output will be generated for.
  41. */
  42. CmdLineInterface* _cmd;
  43. /**
  44. * The output object.
  45. */
  46. CmdLineOutput** _out;
  47. public:
  48. /**
  49. * Constructor.
  50. * \param cmd - The CmdLine the output will be generated for.
  51. * \param out - The type of output.
  52. */
  53. HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out)
  54. : Visitor(), _cmd( cmd ), _out( out ) { }
  55. /**
  56. * Calls the usage method of the CmdLineOutput for the
  57. * specified CmdLine.
  58. */
  59. void visit() { (*_out)->usage(*_cmd); throw ExitException(0); }
  60. };
  61. }
  62. #endif