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;
138 OCTINTERP_API
void initialize_object (
cdef_object& obj);
143 void mark_as_handle_class () { m_handle_class =
true; }
145 bool is_handle_class ()
const {
return m_handle_class; }
157 m_method_map.clear ();
158 m_property_map.clear ();
159 m_property_rank_map.clear ();
165 void mark_as_meta_class () { m_meta =
true; }
167 bool is_meta_class ()
const {
return m_meta; }
169 void file_name (
const std::string& nm) { m_file_name = nm; }
171 std::string file_name ()
const {
return m_file_name; }
175 OCTINTERP_API
void load_all_methods ();
177 OCTINTERP_API
void find_names (std::set<std::string>& names,
bool all);
180 find_properties (std::map<property_key, cdef_property>& props,
184 find_properties_aux (std::map<property_key, cdef_property>& props,
185 std::set<std::string>& prop_names,
189 find_methods (std::map<std::string, cdef_method>& meths,
190 bool only_inherited,
bool include_ctor =
false);
201 std::string m_directory;
203 std::string m_file_name;
207 std::map<std::string, cdef_method> m_method_map;
211 std::map<std::string, cdef_property> m_property_map;
212 std::map<std::string, unsigned int> m_property_rank_map;
227 std::list<cdef_class> m_implicit_ctor_list;
235 typedef std::map<std::string, cdef_method>::iterator method_iterator;
236 typedef std::map<std::string, cdef_method>::const_iterator method_const_iterator;
237 typedef std::map<property_key, cdef_property>::iterator property_iterator;
238 typedef std::map<property_key, cdef_property>::const_iterator property_const_iterator;
240 cdef_class_rep (
const cdef_class_rep& c) =
default;
250 const std::list<cdef_class>& superclasses)
253 get_rep ()->set_name (nm);
263 error (
"internal error: invalid assignment from %s to meta.class object",
264 class_name ().c_str ());
277 find_method (
const std::string& nm,
bool local =
false);
281 get_rep ()->install_method (meth);
286 return get_rep ()->get_methods (include_ctor);
289 std::map<std::string, cdef_method>
292 return get_rep ()->get_method_map (only_inherited, include_ctor);
295 OCTINTERP_API
cdef_property find_property (
const std::string& nm);
299 get_rep ()->install_property (prop);
304 return get_rep ()->get_properties (mode);
307 std::map<property_key, cdef_property>
310 return get_rep ()->get_property_map (mode);
317 bool is_sealed ()
const {
return get_rep ()->is_sealed (); }
321 get_rep ()->set_directory (dir);
326 return get_rep ()->get_directory ();
329 std::string
get_name ()
const {
return get_rep ()->get_name (); }
331 bool is_builtin ()
const {
return get_directory ().empty (); }
335 get_rep ()->delete_object (obj);
360 bool is_at_folder =
false);
364 return get_rep ()->get_method (nm);
369 return get_rep ()->get_method (ln);
372 OCTINTERP_API
octave_value get_method_function (
const std::string& nm);
376 return get_method_function (get_name ());
381 return get_rep ()->construct (args);
386 return get_rep ()->construct_object (args);
391 get_rep ()->initialize_object (obj);
396 get_rep ()->run_constructor (obj, args);
401 get_rep ()->mark_as_handle_class ();
406 return get_rep ()->is_handle_class ();
413 void file_name (
const std::string& nm) { get_rep ()->file_name (nm); }
415 std::string
file_name ()
const {
return get_rep ()->file_name (); }
428 cdef_class_rep * get_rep ()
433 const cdef_class_rep * get_rep ()
const