26 #if ! defined (octave_cdef_class_h)
27 #define octave_cdef_class_h 1
29 #include "octave-config.h"
75 {
return get (
"Name").string_value (); }
77 void set_name (
const std::string& nm) { put (
"Name", nm); }
79 bool is_abstract (
void)
const {
return get (
"Abstract").bool_value (); }
81 bool is_sealed (
void)
const {
return get (
"Sealed").bool_value (); }
83 cdef_method find_method (
const std::string& nm,
bool local =
false);
87 Cell get_methods (
bool include_ctor);
89 std::map<std::string, cdef_method>
90 get_method_map (
bool only_inherited,
bool include_ctor);
96 Cell get_properties (
int mode);
98 std::map<std::string, cdef_property> get_property_map (
int mode);
109 meta_subsref (
const std::string&
type,
110 const std::list<octave_value_list>& idx,
int nargout);
112 void meta_release (
void);
116 return (
type ==
'(' ||
type ==
'.');
144 property_map.clear ();
154 void doc_string (
const std::string& txt) { m_doc_string = txt; }
160 void load_all_methods (
void);
162 void find_names (std::set<std::string>& names,
bool all);
164 void find_properties (std::map<std::string,cdef_property>& props,
167 void find_methods (std::map<std::string, cdef_method>& meths,
168 bool only_inherited,
bool include_ctor =
false);
226 cdef_class (
const std::string& nm,
const std::list<cdef_class>& superclasses)
229 get_rep ()->set_name (nm);
239 error (
"internal error: invalid assignment from %s to meta.class object",
240 class_name ().c_str ());
252 cdef_method find_method (
const std::string& nm,
bool local =
false);
256 get_rep ()->install_method (meth);
261 return get_rep ()->get_methods (include_ctor);
264 std::map<std::string, cdef_method>
267 return get_rep ()->get_method_map (only_inherited, include_ctor);
274 get_rep ()->install_property (prop);
279 return get_rep ()->get_properties (mode);
282 std::map<std::string, cdef_property>
285 return get_rep ()->get_property_map (mode);
290 bool is_abstract (
void)
const {
return get_rep ()->is_abstract (); }
292 bool is_sealed (
void)
const {
return get_rep ()->is_sealed (); }
296 get_rep ()->set_directory (dir);
301 return get_rep ()->get_directory ();
304 std::string
get_name (
void)
const {
return get_rep ()->get_name (); }
306 bool is_builtin (
void)
const {
return get_directory ().empty (); }
310 get_rep ()->delete_object (obj);
335 bool is_at_folder =
false);
339 return get_rep ()->get_method (nm);
342 octave_value get_method_function (
const std::string& nm);
346 return get_method_function (get_name ());
351 return get_rep ()->construct (args);
356 return get_rep ()->construct_object (args);
361 get_rep ()->initialize_object (obj);
366 get_rep ()->run_constructor (obj, args);
371 get_rep ()->mark_as_handle_class ();
376 return get_rep ()->is_handle_class ();
383 void doc_string (
const std::string& txt) { get_rep ()->doc_string (txt); }
385 std::string
doc_string (
void)
const {
return get_rep ()->doc_string (); }
426 return ! (clsa == clsb);
void set_name(const std::string &nm)
bool is_sealed(void) const
octave_idx_type static_count(void) const
std::string doc_string(void) const
bool meta_accepts_postfix_index(char type) const
std::map< std::string, cdef_property >::iterator property_iterator
cdef_property find_property(const std::string &nm)
void mark_as_handle_class(void)
void set_directory(const std::string &dir)
bool is_handle_class(void) const
cdef_class_rep(const cdef_class_rep &c)=default
std::map< std::string, cdef_method > method_map
~cdef_class_rep(void)=default
void mark_as_meta_class(void)
std::map< std::string, cdef_method >::const_iterator method_const_iterator
octave_idx_type member_count
std::list< cdef_class > implicit_ctor_list
void doc_string(const std::string &txt)
cdef_object_rep * copy(void) const
std::map< std::string, cdef_property >::const_iterator property_const_iterator
std::map< std::string, cdef_method >::iterator method_iterator
bool is_class(void) const
cdef_method find_method(const std::string &nm, bool local=false)
std::map< std::string, cdef_property > property_map
bool is_meta_class(void) const
std::string get_name(void) const
bool is_abstract(void) const
std::string get_directory(void) const
~cdef_class(void)=default
std::string doc_string(void) const
Cell get_methods(bool include_ctor=false)
void delete_object(const cdef_object &obj)
friend void install_classdef(interpreter &interp)
void set_directory(const std::string &dir)
void install_property(const cdef_property &prop)
bool is_builtin(void) const
void doc_string(const std::string &txt)
void install_method(const cdef_method &meth)
bool is_meta_class(void) const
cdef_class(const cdef_object &obj)
bool is_abstract(void) const
std::string get_directory(void) const
const cdef_class_rep * get_rep(void) const
bool is_sealed(void) const
cdef_method find_method(const std::string &nm, bool local=false)
cdef_class(const cdef_class &cls)
cdef_property find_property(const std::string &nm)
octave_value get_method(const std::string &nm) const
string_vector get_names(void)
void initialize_object(cdef_object &obj)
Cell get_properties(int mode=property_normal)
std::map< std::string, cdef_method > get_method_map(bool only_inherited=false, bool include_ctor=false)
octave_value construct(const octave_value_list &args)
cdef_class(const std::string &nm, const std::list< cdef_class > &superclasses)
std::map< std::string, cdef_property > get_property_map(int mode=property_normal)
cdef_class_rep * get_rep(void)
void mark_as_handle_class(void)
bool is_handle_class(void) const
std::string get_name(void) const
void mark_as_meta_class(void)
octave_value get_constructor_function(void)
void run_constructor(cdef_object &obj, const octave_value_list &args)
cdef_object construct_object(const octave_value_list &args)
cdef_object & operator=(const cdef_object &obj)
const cdef_object_rep * get_rep(void) const
void error(const char *fmt,...)
bool operator<(const cdef_class &clsa, const cdef_class &clsb)
bool operator!=(const cdef_class &clsa, const cdef_class &clsb)
bool operator==(const cdef_class &clsa, const cdef_class &clsb)