GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
pt-cell.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1999-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_pt_cell_h)
27 #define octave_pt_cell_h 1
28 
29 #include "octave-config.h"
30 
31 #include <iosfwd>
32 
33 class octave_value;
34 class octave_value_list;
35 
36 #include "pt-mat.h"
37 #include "pt-walk.h"
38 
39 namespace octave
40 {
41  class symbol_scope;
42  class tree_argument_list;
43 
44  // General cells.
45 
46  class tree_cell : public tree_array_list
47  {
48  public:
49 
50  tree_cell (tree_argument_list *row = nullptr, int l = -1, int c = -1)
51  : tree_array_list (row, l, c)
52  { }
53 
54  // No copying!
55 
56  tree_cell (const tree_cell&) = delete;
57 
58  tree_cell& operator = (const tree_cell&) = delete;
59 
60  ~tree_cell (void) = default;
61 
62  bool iscell (void) const { return true; }
63 
64  bool rvalue_ok (void) const { return true; }
65 
66  tree_expression * dup (symbol_scope& scope) const;
67 
68  octave_value evaluate (tree_evaluator&, int nargout = 1);
69 
71  {
72  return ovl (evaluate (tw, nargout));
73  }
74 
75  void accept (tree_walker& tw)
76  {
77  tw.visit_cell (*this);
78  }
79  };
80 }
81 
82 #endif
tree_cell(const tree_cell &)=delete
tree_expression * dup(symbol_scope &scope) const
Definition: pt-cell.cc:42
~tree_cell(void)=default
bool iscell(void) const
Definition: pt-cell.h:62
tree_cell & operator=(const tree_cell &)=delete
bool rvalue_ok(void) const
Definition: pt-cell.h:64
void accept(tree_walker &tw)
Definition: pt-cell.h:75
octave_value evaluate(tree_evaluator &, int nargout=1)
Definition: pt-cell.cc:52
octave_value_list evaluate_n(tree_evaluator &tw, int nargout=1)
Definition: pt-cell.h:70
tree_cell(tree_argument_list *row=nullptr, int l=-1, int c=-1)
Definition: pt-cell.h:50
virtual void visit_cell(tree_cell &)
Definition: pt-walk.cc:347
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
Definition: ovl.h:211