26 #if ! defined (octave_cdef_class_h)
27 #define octave_cdef_class_h 1
29 #include "octave-config.h"
66 OCTINTERP_API
cdef_class_rep (
const std::list<cdef_class>& superclasses);
77 {
return get (
"Name").string_value (); }
79 void set_name (
const std::string& nm) { put (
"Name", nm); }
81 bool is_abstract (
void)
const {
return get (
"Abstract").bool_value (); }
83 bool is_sealed (
void)
const {
return get (
"Sealed").bool_value (); }
86 find_method (
const std::string& nm,
bool local =
false);
92 get_methods (
bool include_ctor);
94 OCTINTERP_API std::map<std::string, cdef_method>
95 get_method_map (
bool only_inherited,
bool include_ctor);
97 OCTINTERP_API
cdef_property find_property (
const std::string& nm);
99 OCTINTERP_API
void install_property (
const cdef_property& prop);
101 OCTINTERP_API
Cell get_properties (
int mode);
103 OCTINTERP_API std::map<std::string, cdef_property>
104 get_property_map (
int mode);
112 OCTINTERP_API
void delete_object (
const cdef_object& obj);
115 meta_subsref (
const std::string& type,
116 const std::list<octave_value_list>& idx,
int nargout);
118 OCTINTERP_API
void meta_release (
void);
122 return (type ==
'(' || type ==
'.');
125 OCTINTERP_API
octave_value get_method (
const std::string& name)
const;
132 OCTINTERP_API
void initialize_object (
cdef_object& obj);
151 m_method_map.clear ();
152 m_property_map.clear ();
162 void doc_string (
const std::string& txt) { m_doc_string = txt; }
172 OCTINTERP_API
void load_all_methods (
void);
174 OCTINTERP_API
void find_names (std::set<std::string>& names,
bool all);
177 find_properties (std::map<std::string, cdef_property>& props,
181 find_methods (std::map<std::string, cdef_method>& meths,
182 bool only_inherited,
bool include_ctor =
false);
243 const std::list<cdef_class>& superclasses)
246 get_rep ()->set_name (nm);
256 error (
"internal error: invalid assignment from %s to meta.class object",
257 class_name ().c_str ());
270 find_method (
const std::string& nm,
bool local =
false);
274 get_rep ()->install_method (meth);
279 return get_rep ()->get_methods (include_ctor);
282 std::map<std::string, cdef_method>
285 return get_rep ()->get_method_map (only_inherited, include_ctor);
288 OCTINTERP_API
cdef_property find_property (
const std::string& nm);
292 get_rep ()->install_property (prop);
297 return get_rep ()->get_properties (mode);
300 std::map<std::string, cdef_property>
303 return get_rep ()->get_property_map (mode);
308 bool is_abstract (
void)
const {
return get_rep ()->is_abstract (); }
310 bool is_sealed (
void)
const {
return get_rep ()->is_sealed (); }
314 get_rep ()->set_directory (dir);
319 return get_rep ()->get_directory ();
322 std::string
get_name (
void)
const {
return get_rep ()->get_name (); }
324 bool is_builtin (
void)
const {
return get_directory ().empty (); }
328 get_rep ()->delete_object (obj);
353 bool is_at_folder =
false);
357 return get_rep ()->get_method (nm);
360 OCTINTERP_API
octave_value get_method_function (
const std::string& nm);
364 return get_method_function (get_name ());
369 return get_rep ()->construct (args);
374 return get_rep ()->construct_object (args);
379 get_rep ()->initialize_object (obj);
384 get_rep ()->run_constructor (obj, args);
389 get_rep ()->mark_as_handle_class ();
394 return get_rep ()->is_handle_class ();
401 void doc_string (
const std::string& txt) { get_rep ()->doc_string (txt); }
403 std::string
doc_string (
void)
const {
return get_rep ()->doc_string (); }
405 void file_name (
const std::string& nm) { get_rep ()->file_name (nm); }
407 std::string
file_name (
void)
const {
return get_rep ()->file_name (); }
448 return ! (clsa == clsb);
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)
class OCTINTERP_API cdef_class
octave_idx_type static_count(void) const
std::string get_name(void) const
void mark_as_handle_class(void)
std::map< std::string, cdef_property > m_property_map
void file_name(const std::string &nm)
bool is_meta_class(void) const
bool is_class(void) const
bool is_abstract(void) const
cdef_class_rep(const cdef_class_rep &c)=default
OCTINTERP_API cdef_property find_property(const std::string &nm)
std::list< cdef_class > m_implicit_ctor_list
bool is_sealed(void) const
std::string get_directory(void) const
std::map< std::string, cdef_property >::const_iterator property_const_iterator
std::map< std::string, cdef_method >::const_iterator method_const_iterator
std::map< std::string, cdef_method > m_method_map
bool is_handle_class(void) const
~cdef_class_rep(void)=default
octave_idx_type m_member_count
OCTINTERP_API cdef_method find_method(const std::string &nm, bool local=false)
void mark_as_meta_class(void)
void set_name(const std::string &nm)
std::map< std::string, cdef_property >::iterator property_iterator
void set_directory(const std::string &dir)
bool meta_accepts_postfix_index(char type) const
std::string doc_string(void) const
void doc_string(const std::string &txt)
std::string file_name(void) const
cdef_object_rep * copy(void) const
std::map< std::string, cdef_method >::iterator method_iterator
OCTINTERP_API cdef_method find_method(const std::string &nm, bool local=false)
octave_value construct(const octave_value_list &args)
void install_property(const cdef_property &prop)
std::string file_name(void) const
std::string get_name(void) const
cdef_class(const std::string &nm, const std::list< cdef_class > &superclasses)
void install_method(const cdef_method &meth)
std::string doc_string(void) const
string_vector get_names(void)
void run_constructor(cdef_object &obj, const octave_value_list &args)
cdef_class_rep * get_rep(void)
bool is_meta_class(void) const
octave_value get_method(const std::string &nm) const
octave_value get_constructor_function(void)
std::map< std::string, cdef_property > get_property_map(int mode=property_normal)
std::string get_directory(void) const
std::map< std::string, cdef_method > get_method_map(bool only_inherited=false, bool include_ctor=false)
bool is_abstract(void) const
const cdef_class_rep * get_rep(void) const
cdef_class(const cdef_class &cls)
void mark_as_meta_class(void)
void file_name(const std::string &nm)
void initialize_object(cdef_object &obj)
void delete_object(const cdef_object &obj)
bool is_sealed(void) const
void doc_string(const std::string &txt)
bool is_builtin(void) const
OCTINTERP_API cdef_property find_property(const std::string &nm)
friend void install_classdef(octave::interpreter &interp)
bool is_handle_class(void) const
Cell get_properties(int mode=property_normal)
cdef_object construct_object(const octave_value_list &args)
cdef_class(const cdef_object &obj)
Cell get_methods(bool include_ctor=false)
void set_directory(const std::string &dir)
~cdef_class(void)=default
void mark_as_handle_class(void)
cdef_object & operator=(const cdef_object &obj)
const cdef_object_rep * get_rep(void) const
tree_classdef & operator=(const tree_classdef &)=delete
octave_value make_meta_class(interpreter &interp, bool is_at_folder=false)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void error(const char *fmt,...)