home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fs.zip / octave / octave-2.1.23 / src / pt-cmd.h < prev    next >
C/C++ Source or Header  |  2000-01-15  |  2KB  |  95 lines

  1. /*
  2.  
  3. Copyright (C) 1996, 1997 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_tree_cmd_h)
  24. #define octave_tree_cmd_h 1
  25.  
  26. #if defined (__GNUG__)
  27. #pragma interface
  28. #endif
  29.  
  30. #include <string>
  31.  
  32. class tree_walker;
  33.  
  34. #include "pt.h"
  35.  
  36. // A base class for commands.
  37.  
  38. class
  39. tree_command : public tree
  40. {
  41. public:
  42.  
  43.   tree_command (int l = -1, int c = -1)
  44.     : tree (l, c) { }
  45.  
  46.   virtual ~tree_command (void) { }
  47.  
  48.   virtual void eval (void) = 0;
  49.  
  50. private:
  51.  
  52.   // No copying!
  53.  
  54.   tree_command (const tree_command&);
  55.  
  56.   tree_command& operator = (const tree_command&);
  57. };
  58.  
  59. // No-op.
  60.  
  61. class
  62. tree_no_op_command : public tree_command
  63. {
  64. public:
  65.  
  66.   tree_no_op_command (const string& cmd = "no_op", int l = -1, int c = -1)
  67.     : tree_command (l, c), orig_cmd (cmd) { }
  68.  
  69.   ~tree_no_op_command (void) { }
  70.  
  71.   void eval (void) { }
  72.  
  73.   void accept (tree_walker& tw);
  74.  
  75.   string original_command (void) { return orig_cmd; }
  76.  
  77. private:
  78.  
  79.   string orig_cmd;
  80.  
  81.   // No copying!
  82.  
  83.   tree_no_op_command (const tree_no_op_command&);
  84.  
  85.   tree_no_op_command& operator = (const tree_no_op_command&);
  86. };
  87.  
  88. #endif
  89.  
  90. /*
  91. ;;; Local Variables: ***
  92. ;;; mode: C++ ***
  93. ;;; End: ***
  94. */
  95.