70 OCTINTERP_API cdef_class_rep (
const std::list<cdef_class>& superclasses);
72 cdef_class_rep& operator = (
const cdef_class_rep&) =
delete;
74 ~cdef_class_rep () =
default;
78 bool is_class ()
const {
return true; }
80 std::string get_name ()
const
81 {
return get (
"Name").string_value (); }
83 void set_name (
const std::string& nm) { put (
"Name", nm); }
85 bool is_abstract ()
const {
return get (
"Abstract").bool_value (); }
87 bool is_sealed ()
const {
return get (
"Sealed").bool_value (); }
90 find_method (
const std::string& nm,
bool local =
false);
96 get_methods (
bool include_ctor);
98 OCTINTERP_API std::map<std::string, cdef_method>
99 get_method_map (
bool only_inherited,
bool include_ctor);
101 OCTINTERP_API
cdef_property find_property (
const std::string& nm);
103 OCTINTERP_API
void install_property (
const cdef_property& prop);
105 OCTINTERP_API
Cell get_properties (
int mode);
107 OCTINTERP_API std::map<property_key, cdef_property>
108 get_property_map (
int mode);
112 void set_directory (
const std::string& dir) { m_directory = dir; }
114 std::string get_directory ()
const {
return m_directory; }
116 OCTINTERP_API
void delete_object (
const cdef_object& obj);
119 meta_subsref (
const std::string& type,
120 const std::list<octave_value_list>& idx,
int nargout);
122 OCTINTERP_API
void meta_release ();
124 bool meta_accepts_postfix_index (
char type)
const
126 return (type ==
'(' || type ==
'.');
129 OCTINTERP_API
octave_value get_method (
const std::string& name)
const;
135 const bool default_initialize =
false);
139 const bool default_initialize =
false);
141 OCTINTERP_API
void initialize_object (
cdef_object& obj);
146 void mark_as_handle_class () { m_handle_class =
true; }
148 bool is_handle_class ()
const {
return m_handle_class; }
160 m_method_map.clear ();
161 m_property_map.clear ();
162 m_property_rank_map.clear ();
168 void mark_as_meta_class () { m_meta =
true; }
170 bool is_meta_class ()
const {
return m_meta; }
172 void file_name (
const std::string& nm) { m_file_name = nm; }
174 std::string file_name ()
const {
return m_file_name; }
178 OCTINTERP_API
void load_all_methods ();
180 OCTINTERP_API
void find_names (std::set<std::string>& names,
bool all);
183 find_properties (std::map<property_key, cdef_property>& props,
187 find_properties_aux (std::map<property_key, cdef_property>& props,
188 std::set<std::string>& prop_names,
192 find_methods (std::map<std::string, cdef_method>& meths,
193 bool only_inherited,
bool include_ctor =
false);
204 std::string m_directory;
206 std::string m_file_name;
210 std::map<std::string, cdef_method> m_method_map;
214 std::map<std::string, cdef_property> m_property_map;
215 std::map<std::string, unsigned int> m_property_rank_map;
230 std::list<cdef_class> m_implicit_ctor_list;
238 typedef std::map<std::string, cdef_method>::iterator method_iterator;
239 typedef std::map<std::string, cdef_method>::const_iterator method_const_iterator;
240 typedef std::map<property_key, cdef_property>::iterator property_iterator;
241 typedef std::map<property_key, cdef_property>::const_iterator property_const_iterator;
243 cdef_class_rep (
const cdef_class_rep& c) =
default;
253 const std::list<cdef_class>& superclasses)
256 get_rep ()->set_name (nm);
266 error (
"internal error: invalid assignment from %s to meta.class object",
267 class_name ().c_str ());
280 find_method (
const std::string& nm,
bool local =
false);
284 get_rep ()->install_method (meth);
289 return get_rep ()->get_methods (include_ctor);
292 std::map<std::string, cdef_method>
295 return get_rep ()->get_method_map (only_inherited, include_ctor);
298 OCTINTERP_API
cdef_property find_property (
const std::string& nm);
302 get_rep ()->install_property (prop);
307 return get_rep ()->get_properties (mode);
310 std::map<property_key, cdef_property>
313 return get_rep ()->get_property_map (mode);
320 bool is_sealed ()
const {
return get_rep ()->is_sealed (); }
324 get_rep ()->set_directory (dir);
329 return get_rep ()->get_directory ();
332 std::string
get_name ()
const {
return get_rep ()->get_name (); }
334 bool is_builtin ()
const {
return get_directory ().empty (); }
338 get_rep ()->delete_object (obj);
363 bool is_at_folder =
false);
367 return get_rep ()->get_method (nm);
372 return get_rep ()->get_method (ln);
375 OCTINTERP_API
octave_value get_method_function (
const std::string& nm);
379 return get_method_function (get_name ());
383 const bool default_initialize =
false)
385 return get_rep ()->construct (args, default_initialize);
389 const bool default_initialize =
false)
391 return get_rep ()->construct_object (args, default_initialize);
396 get_rep ()->initialize_object (obj);
401 get_rep ()->run_constructor (obj, args);
406 get_rep ()->mark_as_handle_class ();
411 return get_rep ()->is_handle_class ();
418 void file_name (
const std::string& nm) { get_rep ()->file_name (nm); }
420 std::string
file_name ()
const {
return get_rep ()->file_name (); }
433 cdef_class_rep * get_rep ()
438 const cdef_class_rep * get_rep ()
const