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 ==
'.');
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; }
166 void file_name (
const std::string& nm) { m_file_name = nm; }
168 std::string
file_name (
void)
const {
return m_file_name; }
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);
242 cdef_class (
const std::string& nm,
const std::list<cdef_class>& superclasses)
245 get_rep ()->set_name (nm);
255 error (
"internal error: invalid assignment from %s to meta.class object",
256 class_name ().c_str ());
269 find_method (
const std::string& nm,
bool local =
false);
273 get_rep ()->install_method (meth);
278 return get_rep ()->get_methods (include_ctor);
281 std::map<std::string, cdef_method>
284 return get_rep ()->get_method_map (only_inherited, include_ctor);
287 OCTINTERP_API
cdef_property find_property (
const std::string& nm);
291 get_rep ()->install_property (prop);
296 return get_rep ()->get_properties (mode);
299 std::map<std::string, cdef_property>
302 return get_rep ()->get_property_map (mode);
307 bool is_abstract (
void)
const {
return get_rep ()->is_abstract (); }
309 bool is_sealed (
void)
const {
return get_rep ()->is_sealed (); }
313 get_rep ()->set_directory (dir);
318 return get_rep ()->get_directory ();
321 std::string
get_name (
void)
const {
return get_rep ()->get_name (); }
323 bool is_builtin (
void)
const {
return get_directory ().empty (); }
327 get_rep ()->delete_object (obj);
352 bool is_at_folder =
false);
356 return get_rep ()->get_method (nm);
359 OCTINTERP_API
octave_value get_method_function (
const std::string& nm);
363 return get_method_function (get_name ());
368 return get_rep ()->construct (args);
373 return get_rep ()->construct_object (args);
378 get_rep ()->initialize_object (obj);
383 get_rep ()->run_constructor (obj, args);
388 get_rep ()->mark_as_handle_class ();
393 return get_rep ()->is_handle_class ();
400 void doc_string (
const std::string& txt) { get_rep ()->doc_string (txt); }
402 std::string
doc_string (
void)
const {
return get_rep ()->doc_string (); }
404 void file_name (
const std::string& nm) { get_rep ()->file_name (nm); }
406 std::string
file_name (
void)
const {
return get_rep ()->file_name (); }
447 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_method > m_method_map
std::map< std::string, cdef_property >::iterator property_iterator
std::list< cdef_class > m_implicit_ctor_list
OCTINTERP_API cdef_property find_property(const std::string &nm)
void mark_as_handle_class(void)
void set_directory(const std::string &dir)
void file_name(const std::string &nm)
std::map< std::string, cdef_property > m_property_map
bool is_handle_class(void) const
cdef_class_rep(const cdef_class_rep &c)=default
~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 m_member_count
void doc_string(const std::string &txt)
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
OCTINTERP_API cdef_method find_method(const std::string &nm, bool local=false)
bool is_meta_class(void) const
cdef_object_rep * copy(void) const
std::string file_name(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 file_name(void) const
std::string doc_string(void) const
Cell get_methods(bool include_ctor=false)
std::map< std::string, cdef_property > get_property_map(int mode=property_normal)
void delete_object(const cdef_object &obj)
void set_directory(const std::string &dir)
void install_property(const cdef_property &prop)
std::map< std::string, cdef_method > get_method_map(bool only_inherited=false, bool include_ctor=false)
bool is_builtin(void) const
friend OCTINTERP_API void install_classdef(interpreter &interp)
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
bool is_sealed(void) const
OCTINTERP_API cdef_method find_method(const std::string &nm, bool local=false)
cdef_class(const cdef_class &cls)
const cdef_class_rep * get_rep(void) const
OCTINTERP_API 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)
octave_value construct(const octave_value_list &args)
cdef_class(const std::string &nm, const std::list< cdef_class > &superclasses)
void mark_as_handle_class(void)
bool is_handle_class(void) const
void file_name(const std::string &nm)
std::string get_name(void) const
cdef_class_rep * get_rep(void)
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,...)
class OCTINTERP_API cdef_class
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)