GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
pt-classdef.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2012-2018 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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License 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 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if defined (HAVE_CONFIG_H)
24 # include "config.h"
25 #endif
26 
27 #include "ov-classdef.h"
28 #include "pt-classdef.h"
29 
30 namespace octave
31 {
32  // Classdef attribute
33 
34  // Classdef attribute_list
35 
37  {
38  while (! empty ())
39  {
40  iterator p = begin ();
41  delete *p;
42  erase (p);
43  }
44  }
45 
46  // Classdef superclass
47 
48  // Classdef superclass_list
49 
51  {
52  while (! empty ())
53  {
54  iterator p = begin ();
55  delete *p;
56  erase (p);
57  }
58  }
59 
60  // Classdef property
61 
62  // Classdef property_list
63 
65  {
66  while (! empty ())
67  {
68  iterator p = begin ();
69  delete *p;
70  erase (p);
71  }
72  }
73 
74  // Classdef properties_block
75 
76  // Classdef methods_list
77 
78  // Classdef methods_block
79 
80  // Classdef event
81 
82  // Classdef events_list
83 
85  {
86  while (! empty ())
87  {
88  iterator p = begin ();
89  delete *p;
90  erase (p);
91  }
92  }
93 
94  // Classdef events_block
95 
96  // Classdef enum
97 
98  // Classdef enum_list
99 
101  {
102  while (! empty ())
103  {
104  iterator p = begin ();
105  delete *p;
106  erase (p);
107  }
108  }
109 
110  // Classdef enum_block
111 
112  // Classdef body
113 
115  {
116  while (! m_properties_lst.empty ())
117  {
119  delete *p;
120  m_properties_lst.erase (p);
121  }
122 
123  while (! m_methods_lst.empty ())
124  {
126  delete *p;
127  m_methods_lst.erase (p);
128  }
129 
130  while (! m_events_lst.empty ())
131  {
133  delete *p;
134  m_events_lst.erase (p);
135  }
136 
137  while (! m_enum_lst.empty ())
138  {
139  enum_list_iterator p = m_enum_lst.begin ();
140  delete *p;
141  m_enum_lst.erase (p);
142  }
143  }
144 
145  // Classdef
146 
148  tree_classdef::make_meta_class (interpreter& interp, bool is_at_folder)
149  {
150  cdef_class cls = cdef_class::make_meta_class (interp, this, is_at_folder);
151 
152  if (cls.ok ())
153  return cls.get_constructor_function ();
154 
155  return nullptr;
156  }
157 }
std::list< tree_classdef_enum_block * > m_enum_lst
Definition: pt-classdef.h:645
static cdef_class make_meta_class(octave::interpreter &interp, octave::tree_classdef *t, bool is_at_folder=false)
Analyze the tree_classdef tree and transform it to a cdef_class.
std::list< tree_classdef_attribute * >::iterator iterator
Definition: base-list.h:40
std::list< tree_classdef_properties_block * > m_properties_lst
Definition: pt-classdef.h:639
std::list< tree_classdef_events_block * >::iterator events_list_iterator
Definition: pt-classdef.h:550
octave_function * get_constructor_function(void)
Definition: ov-classdef.h:914
bool ok(void) const
Definition: ov-classdef.h:300
std::list< tree_classdef_events_block * > m_events_lst
Definition: pt-classdef.h:643
std::list< tree_classdef_methods_block * > m_methods_lst
Definition: pt-classdef.h:641
std::list< tree_classdef_methods_block * >::iterator methods_list_iterator
Definition: pt-classdef.h:547
p
Definition: lu.cc:138
std::list< tree_classdef_properties_block * >::iterator properties_list_iterator
Definition: pt-classdef.h:544
octave_function * make_meta_class(interpreter &interp, bool is_at_folder=false)
Definition: pt-classdef.cc:148
std::list< tree_classdef_enum_block * >::iterator enum_list_iterator
Definition: pt-classdef.h:553