GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pt-classdef.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2012-2017 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 3 of the License, or (at your
10 option) any 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, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_tree_classdef_h)
24 #define octave_tree_classdef_h 1
25 
26 #include "octave-config.h"
27 
28 class octave_value;
29 
30 class tree_walker;
31 
32 #include "pt-cmd.h"
33 #include "pt-exp.h"
34 #include "pt-id.h"
35 
36 #include "base-list.h"
37 
38 #include <list>
39 
41 {
42 public:
43 
45  : id (i), expr (e), neg (false) { }
46 
48  : id (i), expr (0), neg (b) { }
49 
51  {
52  delete id;
53  delete expr;
54  }
55 
56  tree_identifier *ident (void) { return id; }
57 
58  tree_expression *expression (void) { return expr; }
59 
60  bool negate (void) { return neg; }
61 
62  void accept (tree_walker&);
63 
64 private:
65 
68  bool neg;
69 
70  // No copying!
71 
73 
75 };
76 
77 class tree_classdef_attribute_list : public octave::base_list<tree_classdef_attribute *>
78 {
79 public:
80 
82 
84 
87 
89 
90  void accept (tree_walker&);
91 
92 private:
93 
94  // No copying!
95 
97 
99 };
100 
102 {
103 public:
104 
106  : cls_name (cname) { }
107 
109 
110  std::string class_name (void) { return cls_name; }
111 
112  void accept (tree_walker&);
113 
114 private:
115 
117 
118  // No copying!
119 
121 
123 };
124 
125 class tree_classdef_superclass_list : public octave::base_list<tree_classdef_superclass *>
126 {
127 public:
128 
130 
132 
135 
137 
138  void accept (tree_walker&);
139 
140 private:
141 
142  // No copying!
143 
145 
147 };
148 
149 template <typename T>
151 {
152 public:
153 
155  octave::base_list<T> *elist,
157  int l = -1, int c = -1)
158  : tree (l, c), attr_list (a), elt_list (elist),
159  lead_comm (lc), trail_comm (tc)
160  { }
161 
163  {
164  delete attr_list;
165  delete elt_list;
166  delete lead_comm;
167  delete trail_comm;
168  }
169 
171 
173 
175 
177 
178  void accept (tree_walker&) { }
179 
180 private:
181 
182  // List of attributes that apply to this class.
184 
185  // The list of objects contained in this block.
187 
188  // Comment preceding the token marking the beginning of the block.
190 
191  // Comment preceding END token.
193 
194  // No copying!
195 
197 
199 };
200 
202 {
203 public:
204 
206  : id (i), expr (e) { }
207 
209  {
210  delete id;
211  delete expr;
212  }
213 
214  tree_identifier *ident (void) { return id; }
215 
216  tree_expression *expression (void) { return expr; }
217 
218  void accept (tree_walker&);
219 
220 private:
221 
224 
225  // No copying!
226 
228 
230 };
231 
232 class tree_classdef_property_list : public octave::base_list<tree_classdef_property *>
233 {
234 public:
235 
237 
239 
242 
244 
245  void accept (tree_walker&);
246 
247 private:
248 
249  // No copying!
250 
252 
254 };
255 
257  : public tree_classdef_element<tree_classdef_property *>
258 {
259 public:
260 
265  int l = -1, int c = -1)
266  : tree_classdef_element<tree_classdef_property *> (a, plist, lc, tc, l, c) { }
267 
269 
270  void accept (tree_walker&);
271 
272 private:
273 
274  // No copying!
275 
277 
279 };
280 
281 class tree_classdef_methods_list : public octave::base_list<octave_value>
282 {
283 public:
284 
286 
288 
290  : octave::base_list<octave_value> (a) { }
291 
293 
294  void accept (tree_walker&);
295 
296 private:
297 
298  // No copying!
299 
301 
303 };
304 
306 {
307 public:
308 
312  octave_comment_list *tc, int l = -1, int c = -1)
313  : tree_classdef_element<octave_value> (a, mlist, lc, tc, l, c) { }
314 
316 
317  void accept (tree_walker&);
318 
319 private:
320 
321  // No copying!
322 
324 
326 };
327 
329 {
330 public:
331 
333 
335  {
336  delete id;
337  }
338 
339  tree_identifier *ident (void) { return id; }
340 
341  void accept (tree_walker&);
342 
343 private:
344 
346 
347  // No copying!
348 
350 
352 };
353 
354 class tree_classdef_events_list : public octave::base_list<tree_classdef_event *>
355 {
356 public:
357 
359 
361 
363  : octave::base_list<tree_classdef_event *> (a) { }
364 
366 
367  void accept (tree_walker&);
368 
369 private:
370 
371  // No copying!
372 
374 
376 };
377 
379  : public tree_classdef_element<tree_classdef_event *>
380 {
381 public:
382 
386  octave_comment_list *tc, int l = -1, int c = -1)
387  : tree_classdef_element<tree_classdef_event *> (a, elist, lc, tc, l, c) { }
388 
390 
391  void accept (tree_walker&);
392 
393 private:
394 
395  // No copying!
396 
398 
400 };
401 
403 {
404 public:
405 
406  tree_classdef_enum (void) : id (0), expr (0) { }
407 
409  : id (i), expr (e) { }
410 
412  {
413  delete id;
414  delete expr;
415  }
416 
417  tree_identifier *ident (void) { return id; }
418 
419  tree_expression *expression (void) { return expr; }
420 
421  void accept (tree_walker&);
422 
423 private:
424 
427 
428  // No copying!
429 
431 
433 };
434 
435 class tree_classdef_enum_list : public octave::base_list<tree_classdef_enum *>
436 {
437 public:
438 
440 
442 
444  : octave::base_list<tree_classdef_enum *> (a) { }
445 
447 
448  void accept (tree_walker&);
449 
450 private:
451 
452  // No copying!
453 
455 
457 };
458 
460  : public tree_classdef_element<tree_classdef_enum *>
461 {
462 public:
463 
467  octave_comment_list *tc, int l = -1, int c = -1)
468  : tree_classdef_element<tree_classdef_enum *> (a, elist, lc, tc, l, c) { }
469 
471 
472  void accept (tree_walker&);
473 
474 private:
475 
476  // No copying!
477 
479 
481 };
482 
484 {
485 public:
486 
487  typedef std::list<tree_classdef_properties_block *>::iterator properties_list_iterator;
488  typedef std::list<tree_classdef_properties_block *>::const_iterator properties_list_const_iterator;
489 
490  typedef std::list<tree_classdef_methods_block *>::iterator methods_list_iterator;
491  typedef std::list<tree_classdef_methods_block *>::const_iterator methods_list_const_iterator;
492 
493  typedef std::list<tree_classdef_events_block *>::iterator events_list_iterator;
494  typedef std::list<tree_classdef_events_block *>::const_iterator events_list_const_iterator;
495 
496  typedef std::list<tree_classdef_enum_block *>::iterator enum_list_iterator;
497  typedef std::list<tree_classdef_enum_block *>::const_iterator enum_list_const_iterator;
498 
500  : properties_lst (), methods_lst (), events_lst (), enum_lst () { }
501 
504  {
505  append (pb);
506  }
507 
510  {
511  append (mb);
512  }
513 
516  {
517  append (evb);
518  }
519 
522  {
523  append (enb);
524  }
525 
526  ~tree_classdef_body (void);
527 
529  {
530  properties_lst.push_back (pb);
531  }
532 
534  {
535  methods_lst.push_back (mb);
536  }
537 
539  {
540  events_lst.push_back (evb);
541  }
542 
544  {
545  enum_lst.push_back (enb);
546  }
547 
548  std::list<tree_classdef_properties_block *> properties_list (void)
549  {
550  return properties_lst;
551  }
552 
553  std::list<tree_classdef_methods_block *> methods_list (void)
554  {
555  return methods_lst;
556  }
557 
558  std::list<tree_classdef_events_block *> events_list (void)
559  {
560  return events_lst;
561  }
562 
563  std::list<tree_classdef_enum_block *> enum_list (void)
564  {
565  return enum_lst;
566  }
567 
568  void accept (tree_walker&);
569 
570 private:
571 
572  std::list<tree_classdef_properties_block *> properties_lst;
573 
574  std::list<tree_classdef_methods_block *> methods_lst;
575 
576  std::list<tree_classdef_events_block *> events_lst;
577 
578  std::list<tree_classdef_enum_block *> enum_lst;
579 
580  // No copying!
581 
583 
585 };
586 
587 // Classdef definition.
588 
590 {
591 public:
592 
597  const std::string& pn = "", int l = -1,
598  int c = -1)
599  : tree_command (l, c), attr_list (a), id (i),
600  supclass_list (sc), element_list (b), lead_comm (lc), trail_comm (tc),
601  pack_name (pn) { }
602 
604  {
605  delete attr_list;
606  delete id;
607  delete supclass_list;
608  delete element_list;
609  delete lead_comm;
610  delete trail_comm;
611  }
612 
614 
615  tree_identifier *ident (void) { return id; }
616 
618 
620 
623 
624  const std::string& package_name (void) const { return pack_name; }
625 
626  octave_function* make_meta_class (bool is_at_folder = false);
627 
630 
631  void accept (tree_walker& tw);
632 
633 private:
634 
636 
638 
640 
642 
645 
647 
648  // No copying!
649 
650  tree_classdef (const tree_classdef&);
651 
653 };
654 
655 #endif
tree_classdef_body & operator=(const tree_classdef_body &)
For example cd octave end example noindent changes the current working directory to an error message is printed and the working directory is not changed sc
Definition: dirfns.cc:120
Octave interface to the compression and uncompression libraries.
Definition: aepbalance.cc:47
tree_classdef_attribute_list(const octave::base_list< tree_classdef_attribute * > &a)
Definition: pt-classdef.h:85
tree_classdef_attribute(tree_identifier *i=0, tree_expression *e=0)
Definition: pt-classdef.h:44
void accept(tree_walker &)
octave_comment_list * lead_comm
Definition: pt-classdef.h:643
std::list< tree_classdef_methods_block * >::iterator methods_list_iterator
Definition: pt-classdef.h:490
void append(tree_classdef_properties_block *pb)
Definition: pt-classdef.h:528
octave_comment_list * leading_comment(void)
Definition: pt-classdef.h:174
void accept(tree_walker &)
Definition: pt-classdef.cc:187
tree_classdef_enum & operator=(const tree_classdef_enum &)
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
tree_expression * expression(void)
Definition: pt-classdef.h:419
octave_comment_list * trailing_comment(void)
Definition: pt-classdef.h:176
tree_classdef_element & operator=(const tree_classdef_element &)
tree_classdef_enum_list & operator=(const tree_classdef_enum_list &)
tree_classdef_property & operator=(const tree_classdef_property &)
tree_classdef_body * element_list
Definition: pt-classdef.h:641
tree_classdef_attribute_list * attribute_list(void)
Definition: pt-classdef.h:170
tree_classdef_body * body(void)
Definition: pt-classdef.h:619
tree_classdef_property(tree_identifier *i=0, tree_expression *e=0)
Definition: pt-classdef.h:205
std::list< tree_classdef_methods_block * > methods_list(void)
Definition: pt-classdef.h:553
tree_classdef_enum(tree_identifier *i, tree_expression *e)
Definition: pt-classdef.h:408
tree_classdef_property_list(tree_classdef_property *p)
Definition: pt-classdef.h:238
tree_identifier * ident(void)
Definition: pt-classdef.h:615
tree_classdef_event & operator=(const tree_classdef_event &)
void accept(tree_walker &)
Definition: pt-classdef.cc:127
tree_identifier * id
Definition: pt-classdef.h:222
tree_classdef_superclass & operator=(const tree_classdef_superclass &)
octave_comment_list * leading_comment(void)
Definition: pt-classdef.h:621
tree_classdef_attribute_list * attr_list
Definition: pt-classdef.h:183
~tree_classdef(void)
Definition: pt-classdef.h:603
tree_classdef_superclass(const std::string &cname)
Definition: pt-classdef.h:105
octave_comment_list * lead_comm
Definition: pt-classdef.h:189
tree_classdef_events_list(tree_classdef_event *e)
Definition: pt-classdef.h:360
tree_identifier * id
Definition: pt-classdef.h:425
tree_classdef_methods_list & operator=(const tree_classdef_methods_list &)
i e
Definition: data.cc:2724
tree_classdef_methods_block(tree_classdef_attribute_list *a, tree_classdef_methods_list *mlist, octave_comment_list *lc, octave_comment_list *tc, int l=-1, int c=-1)
Definition: pt-classdef.h:309
std::list< tree_classdef_properties_block * > properties_lst
Definition: pt-classdef.h:572
std::list< tree_classdef_methods_block * > methods_lst
Definition: pt-classdef.h:574
std::list< tree_classdef_properties_block * >::iterator properties_list_iterator
Definition: pt-classdef.h:487
octave_comment_list * trailing_comment(void)
Definition: pt-classdef.h:622
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
tree_classdef_attribute_list(tree_classdef_attribute *a)
Definition: pt-classdef.h:83
void append(tree_classdef_enum_block *enb)
Definition: pt-classdef.h:543
octave_comment_list * trail_comm
Definition: pt-classdef.h:192
std::list< tree_classdef_enum_block * > enum_lst
Definition: pt-classdef.h:578
tree_classdef_superclass_list * supclass_list
Definition: pt-classdef.h:639
tree_classdef * dup(symbol_table::scope_id scope, symbol_table::context_id context) const
Definition: pt-classdef.cc:247
tree_identifier * id
Definition: pt-classdef.h:345
tree_identifier * ident(void)
Definition: pt-classdef.h:214
void accept(tree_walker &)
Definition: pt-classdef.cc:85
tree_classdef_property_list & operator=(const tree_classdef_property_list &)
tree_classdef_body(tree_classdef_enum_block *enb)
Definition: pt-classdef.h:520
std::list< tree_classdef_enum_block * >::iterator enum_list_iterator
Definition: pt-classdef.h:496
tree_classdef_element(tree_classdef_attribute_list *a, octave::base_list< T > *elist, octave_comment_list *lc, octave_comment_list *tc, int l=-1, int c=-1)
Definition: pt-classdef.h:154
octave::base_list< T > * element_list(void)
Definition: pt-classdef.h:172
void accept(tree_walker &)
Definition: pt-classdef.cc:33
tree_classdef(tree_classdef_attribute_list *a, tree_identifier *i, tree_classdef_superclass_list *sc, tree_classdef_body *b, octave_comment_list *lc, octave_comment_list *tc, const std::string &pn="", int l=-1, int c=-1)
Definition: pt-classdef.h:593
void accept(tree_walker &)
Definition: pt-classdef.cc:161
static llvm::LLVMContext & context
Definition: jit-typeinfo.cc:76
std::list< tree_classdef_events_block * > events_list(void)
Definition: pt-classdef.h:558
tree_expression * expr
Definition: pt-classdef.h:426
std::list< tree_classdef_events_block * >::iterator events_list_iterator
Definition: pt-classdef.h:493
void accept(tree_walker &)
Definition: pt-classdef.cc:59
void accept(tree_walker &)
Definition: pt-classdef.cc:169
tree_identifier * ident(void)
Definition: pt-classdef.h:417
tree_classdef_enum_block & operator=(const tree_classdef_enum_block &)
void accept(tree_walker &)
Definition: pt-classdef.cc:153
std::string pack_name
Definition: pt-classdef.h:646
is false
Definition: cellfun.cc:398
tree_classdef_attribute_list & operator=(const tree_classdef_attribute_list &)
tree_classdef_attribute & operator=(const tree_classdef_attribute &)
std::list< tree_classdef_events_block * > events_lst
Definition: pt-classdef.h:576
std::list< tree_classdef_properties_block * > properties_list(void)
Definition: pt-classdef.h:548
tree_classdef_methods_list(const octave::base_list< octave_value > &a)
Definition: pt-classdef.h:289
tree_classdef_property_list(const octave::base_list< tree_classdef_property * > &a)
Definition: pt-classdef.h:240
tree_expression * expression(void)
Definition: pt-classdef.h:58
tree_classdef_superclass_list(tree_classdef_superclass *sc)
Definition: pt-classdef.h:131
std::list< tree_classdef_events_block * >::const_iterator events_list_const_iterator
Definition: pt-classdef.h:494
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
tree_classdef_superclass_list(const octave::base_list< tree_classdef_superclass * > &a)
Definition: pt-classdef.h:133
tree_expression * expression(void)
Definition: pt-classdef.h:216
tree_classdef_attribute_list * attr_list
Definition: pt-classdef.h:635
void accept(tree_walker &)
Definition: pt-classdef.cc:51
tree_identifier * ident(void)
Definition: pt-classdef.h:339
tree_identifier * ident(void)
Definition: pt-classdef.h:56
tree_classdef_body(tree_classdef_events_block *evb)
Definition: pt-classdef.h:514
void accept(tree_walker &)
Definition: pt-classdef.h:178
tree_classdef_body(tree_classdef_methods_block *mb)
Definition: pt-classdef.h:508
void accept(tree_walker &)
Definition: pt-classdef.cc:119
tree_classdef_events_list & operator=(const tree_classdef_events_list &)
tree_classdef_event(tree_identifier *i=0)
Definition: pt-classdef.h:332
tree_identifier * id
Definition: pt-classdef.h:66
octave_function * make_meta_class(bool is_at_folder=false)
Definition: pt-classdef.cc:236
octave_comment_list * trail_comm
Definition: pt-classdef.h:644
=val(i)}if ode{val(i)}occurs in table i
Definition: lookup.cc:239
void accept(tree_walker &)
Definition: pt-classdef.cc:135
void accept(tree_walker &)
Definition: pt-classdef.cc:195
void accept(tree_walker &)
Definition: pt-classdef.cc:103
p
Definition: lu.cc:138
tree_classdef_events_block & operator=(const tree_classdef_events_block &)
Definition: pt.h:39
tree_classdef_enum_list(tree_classdef_enum *e)
Definition: pt-classdef.h:441
octave::base_list< T > * elt_list
Definition: pt-classdef.h:186
tree_classdef_properties_block(tree_classdef_attribute_list *a, tree_classdef_property_list *plist, octave_comment_list *lc, octave_comment_list *tc, int l=-1, int c=-1)
Definition: pt-classdef.h:261
tree_classdef_enum_block(tree_classdef_attribute_list *a, tree_classdef_enum_list *elist, octave_comment_list *lc, octave_comment_list *tc, int l=-1, int c=-1)
Definition: pt-classdef.h:464
tree_classdef_superclass_list & operator=(const tree_classdef_superclass_list &)
b
Definition: cellfun.cc:398
void accept(tree_walker &)
Definition: pt-classdef.cc:77
tree_classdef_superclass_list * superclass_list(void)
Definition: pt-classdef.h:617
tree_classdef_methods_list(const octave_value &f)
Definition: pt-classdef.h:287
std::list< tree_classdef_enum_block * >::const_iterator enum_list_const_iterator
Definition: pt-classdef.h:497
void accept(tree_walker &)
Definition: pt-classdef.cc:111
void accept(tree_walker &tw)
Definition: pt-classdef.cc:255
tree_identifier * id
Definition: pt-classdef.h:637
void append(const tree_classdef_attribute *&s)
Definition: base-list.h:110
std::list< tree_classdef_properties_block * >::const_iterator properties_list_const_iterator
Definition: pt-classdef.h:488
void append(tree_classdef_methods_block *mb)
Definition: pt-classdef.h:533
std::string class_name(void)
Definition: pt-classdef.h:110
tree_classdef_enum_list(const octave::base_list< tree_classdef_enum * > &a)
Definition: pt-classdef.h:443
tree_classdef_body(tree_classdef_properties_block *pb)
Definition: pt-classdef.h:502
const std::string & package_name(void) const
Definition: pt-classdef.h:624
tree_classdef_events_list(const octave::base_list< tree_classdef_event * > &a)
Definition: pt-classdef.h:362
void append(tree_classdef_events_block *evb)
Definition: pt-classdef.h:538
tree_classdef_properties_block & operator=(const tree_classdef_properties_block &)
tree_expression * expr
Definition: pt-classdef.h:67
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
tree_expression * expr
Definition: pt-classdef.h:223
tree_classdef_attribute_list * attribute_list(void)
Definition: pt-classdef.h:613
std::list< tree_classdef_methods_block * >::const_iterator methods_list_const_iterator
Definition: pt-classdef.h:491
std::list< tree_classdef_enum_block * > enum_list(void)
Definition: pt-classdef.h:563
tree_classdef_attribute(tree_identifier *i, bool b)
Definition: pt-classdef.h:47
tree_classdef_methods_block & operator=(const tree_classdef_methods_block &)
tree_classdef & operator=(const tree_classdef &)
tree_classdef_events_block(tree_classdef_attribute_list *a, tree_classdef_events_list *elist, octave_comment_list *lc, octave_comment_list *tc, int l=-1, int c=-1)
Definition: pt-classdef.h:383