GNU Octave  4.0.0
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.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2012-2015 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 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include "ov-classdef.h"
28 #include "pt-classdef.h"
29 
30 // Classdef attribute
31 
32 void
34 {
35  tw.visit_classdef_attribute (*this);
36 }
37 
38 // Classdef attribute_list
39 
41 {
42  while (! empty ())
43  {
44  iterator p = begin ();
45  delete *p;
46  erase (p);
47  }
48 }
49 
50 void
52 {
54 }
55 
56 // Classdef superclass
57 
58 void
60 {
61  tw.visit_classdef_superclass (*this);
62 }
63 
64 // Classdef superclass_list
65 
67 {
68  while (! empty ())
69  {
70  iterator p = begin ();
71  delete *p;
72  erase (p);
73  }
74 }
75 
76 void
78 {
80 }
81 
82 // Classdef property
83 
84 void
86 {
87  tw.visit_classdef_property (*this);
88 }
89 
90 // Classdef property_list
91 
93 {
94  while (! empty ())
95  {
96  iterator p = begin ();
97  delete *p;
98  erase (p);
99  }
100 }
101 
102 void
104 {
105  tw.visit_classdef_property_list (*this);
106 }
107 
108 // Classdef properties_block
109 
110 void
112 {
114 }
115 
116 // Classdef methods_list
117 
118 void
120 {
121  tw.visit_classdef_methods_list (*this);
122 }
123 
124 // Classdef methods_block
125 
126 void
128 {
129  tw.visit_classdef_methods_block (*this);
130 }
131 
132 // Classdef event
133 
134 void
136 {
137  tw.visit_classdef_event (*this);
138 }
139 
140 // Classdef events_list
141 
143 {
144  while (! empty ())
145  {
146  iterator p = begin ();
147  delete *p;
148  erase (p);
149  }
150 }
151 
152 void
154 {
155  tw.visit_classdef_events_list (*this);
156 }
157 
158 // Classdef events_block
159 
160 void
162 {
163  tw.visit_classdef_events_block (*this);
164 }
165 
166 // Classdef enum
167 
168 void
170 {
171  tw.visit_classdef_enum (*this);
172 }
173 
174 // Classdef enum_list
175 
177 {
178  while (! empty ())
179  {
180  iterator p = begin ();
181  delete *p;
182  erase (p);
183  }
184 }
185 
186 void
188 {
189  tw.visit_classdef_enum_list (*this);
190 }
191 
192 // Classdef enum_block
193 
194 void
196 {
197  tw.visit_classdef_enum_block (*this);
198 }
199 
200 // Classdef body
201 
203 {
204  while (! properties_lst.empty ())
205  {
207  delete *p;
208  properties_lst.erase (p);
209  }
210 
211  while (! methods_lst.empty ())
212  {
213  methods_list_iterator p = methods_lst.begin ();
214  delete *p;
215  methods_lst.erase (p);
216  }
217 
218  while (! events_lst.empty ())
219  {
220  events_list_iterator p = events_lst.begin ();
221  delete *p;
222  events_lst.erase (p);
223  }
224 
225  while (! enum_lst.empty ())
226  {
227  enum_list_iterator p = enum_lst.begin ();
228  delete *p;
229  enum_lst.erase (p);
230  }
231 }
232 
233 // Classdef
234 
237 {
238  octave_value retval;
239  cdef_class cls = cdef_class::make_meta_class (this, is_at_folder);
240 
241  if (cls.ok ())
242  return cls.get_constructor_function ();
243 
244  return 0;
245 }
246 
250 {
251  // FIXME
252  return 0;
253 }
254 
255 void
257 {
258  tw.visit_classdef (*this);
259 }
virtual void visit_classdef_methods_list(tree_classdef_methods_list &)
Definition: pt-walk.h:240
virtual void visit_classdef_events_block(tree_classdef_events_block &)
Definition: pt-walk.h:252
virtual void visit_classdef_superclass_list(tree_classdef_superclass_list &)
Definition: pt-walk.h:228
std::list< tree_classdef_methods_block * >::iterator methods_list_iterator
Definition: pt-classdef.h:488
virtual void visit_classdef_properties_block(tree_classdef_properties_block &)
Definition: pt-walk.h:237
void accept(tree_walker &)
Definition: pt-classdef.cc:187
virtual void visit_classdef_attribute_list(tree_classdef_attribute_list &)
Definition: pt-walk.h:222
void accept(tree_walker &)
Definition: pt-classdef.cc:127
std::list< tree_classdef_properties_block * > properties_lst
Definition: pt-classdef.h:570
std::list< tree_classdef_methods_block * > methods_lst
Definition: pt-classdef.h:572
virtual void visit_classdef_enum_list(tree_classdef_enum_list &)
Definition: pt-walk.h:258
std::list< tree_classdef_properties_block * >::iterator properties_list_iterator
Definition: pt-classdef.h:485
virtual void visit_classdef_property_list(tree_classdef_property_list &)
Definition: pt-walk.h:234
std::list< tree_classdef_enum_block * > enum_lst
Definition: pt-classdef.h:576
std::list< tree_classdef_attribute * >::iterator iterator
Definition: base-list.h:36
tree_classdef * dup(symbol_table::scope_id scope, symbol_table::context_id context) const
Definition: pt-classdef.cc:248
void accept(tree_walker &)
Definition: pt-classdef.cc:85
std::list< tree_classdef_enum_block * >::iterator enum_list_iterator
Definition: pt-classdef.h:494
static cdef_class make_meta_class(tree_classdef *t, bool is_at_folder=false)
octave_function * get_constructor_function(void)
Definition: ov-classdef.h:844
void accept(tree_walker &)
Definition: pt-classdef.cc:33
void accept(tree_walker &)
Definition: pt-classdef.cc:161
std::list< tree_classdef_events_block * >::iterator events_list_iterator
Definition: pt-classdef.h:491
void accept(tree_walker &)
Definition: pt-classdef.cc:59
void accept(tree_walker &)
Definition: pt-classdef.cc:169
virtual void visit_classdef_event(tree_classdef_event &)
Definition: pt-walk.h:246
void accept(tree_walker &)
Definition: pt-classdef.cc:153
std::list< tree_classdef_events_block * > events_lst
Definition: pt-classdef.h:574
void accept(tree_walker &)
Definition: pt-classdef.cc:51
virtual void visit_classdef_methods_block(tree_classdef_methods_block &)
Definition: pt-walk.h:243
void accept(tree_walker &)
Definition: pt-classdef.cc:119
bool ok(void) const
Definition: ov-classdef.h:277
octave_function * make_meta_class(bool is_at_folder=false)
Definition: pt-classdef.cc:236
void accept(tree_walker &)
Definition: pt-classdef.cc:135
virtual void visit_classdef_property(tree_classdef_property &)
Definition: pt-walk.h:231
void accept(tree_walker &)
Definition: pt-classdef.cc:195
virtual void visit_classdef(tree_classdef &)
Definition: pt-walk.h:267
void accept(tree_walker &)
Definition: pt-classdef.cc:103
virtual void visit_classdef_attribute(tree_classdef_attribute &)
Definition: pt-walk.h:219
virtual void visit_classdef_enum(tree_classdef_enum &)
Definition: pt-walk.h:255
void accept(tree_walker &)
Definition: pt-classdef.cc:77
void accept(tree_walker &)
Definition: pt-classdef.cc:111
void accept(tree_walker &tw)
Definition: pt-classdef.cc:256
virtual void visit_classdef_events_list(tree_classdef_events_list &)
Definition: pt-walk.h:249
virtual void visit_classdef_enum_block(tree_classdef_enum_block &)
Definition: pt-walk.h:261
virtual void visit_classdef_superclass(tree_classdef_superclass &)
Definition: pt-walk.h:225