annotate libinterp/octave-value/cdef-method.h @ 26773:a95887edd55e

style fixes for classdef classes * cdef-class.cc, cdef-class.h, cdef-method.h, cdef-package.cc, cdef-package.h, cdef-property.h: Style fixes.
author John W. Eaton <jwe@octave.org>
date Fri, 22 Feb 2019 15:40:15 +0000
parents d1419ac09564
children 568c2ab2782d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 /*
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
3 Copyright (C) 2012-2019 Michael Goffioul
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 This file is part of Octave.
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 Octave is free software: you can redistribute it and/or modify it
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 (at your option) any later version.
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 GNU General Public License for more details.
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 <https://www.gnu.org/licenses/>.
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 */
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 #if ! defined (octave_cdef_method_h)
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24 #define octave_cdef_method_h 1
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #include "octave-config.h"
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 #include <map>
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 #include <set>
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 #include <string>
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 #include "oct-refcount.h"
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 #include "cdef-object.h"
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 #include "ov.h"
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 class
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 cdef_method : public cdef_meta_object
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 {
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 friend class cdef_class;
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 private:
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 class
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 cdef_method_rep : public cdef_meta_object_rep
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46 {
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 public:
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
48
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 cdef_method_rep (void)
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 : cdef_meta_object_rep (), function (), dispatch_type ()
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 { }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 cdef_method_rep& operator = (const cdef_method_rep& m) = delete;
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 ~cdef_method_rep (void) = default;
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 cdef_object_rep * copy (void) const { return new cdef_method_rep(*this); }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 bool is_method (void) const { return true; }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 std::string get_name (void) const { return get("Name").string_value (); }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63 void set_name (const std::string& nm) { put ("Name", nm); }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 bool is_static (void) const { return get("Static").bool_value (); }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 octave_value get_function (void) const { return function; }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 void set_function (const octave_value& fcn) { function = fcn; }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 bool check_access (void) const;
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 bool is_external (void) const { return ! dispatch_type.empty (); }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 void mark_as_external (const std::string& dtype)
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
76 {
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
77 dispatch_type = dtype;
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
78 }
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80 octave_value_list execute (const octave_value_list& args, int nargout,
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 bool do_check_access = true,
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82 const std::string& who = "");
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
84 octave_value_list execute (const cdef_object& obj,
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85 const octave_value_list& args, int nargout,
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
86 bool do_check_access = true,
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
87 const std::string& who = "");
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
88
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89 bool is_constructor (void) const;
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
91 octave_value_list
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92 meta_subsref (const std::string& type,
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
93 const std::list<octave_value_list>& idx, int nargout);
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
94
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
95 bool meta_accepts_postfix_index (char type) const
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
96 {
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
97 return (type == '(' || type == '.');
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
98 }
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
99
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100 private:
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
101
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
102 cdef_method_rep (const cdef_method_rep& m)
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
103 : cdef_meta_object_rep (m), function (m.function),
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
104 dispatch_type (m.dispatch_type)
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
105 { }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
106
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
107 void check_method (void);
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
108
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
109 cdef_method wrap (void)
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
110 {
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
111 refcount++;
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
112 return cdef_method (this);
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113 }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
114
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
115 octave_value function;
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
116
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
117 // When non-empty, the method is externally defined and this member
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
118 // is used to cache the dispatch type to look for the method.
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
119
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120 std::string dispatch_type;
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
121 };
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
122
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
123 public:
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
124
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
125 cdef_method (void) : cdef_meta_object () { }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
126
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
127 cdef_method (const std::string& nm)
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
128 : cdef_meta_object (new cdef_method_rep ())
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
129 {
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
130 get_rep ()->set_name (nm);
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
131 }
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
132
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
133 cdef_method (const cdef_method& meth) : cdef_meta_object (meth) { }
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
134
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
135 cdef_method (const cdef_object& obj)
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
136 : cdef_meta_object (obj)
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
137 {
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
138 // This should never happen...
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
139 if (! is_method ())
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
140 error ("internal error: invalid assignment from %s to meta.method object",
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
141 class_name ().c_str ());
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
142 }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
143
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
144 cdef_method& operator = (const cdef_method& meth)
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
145 {
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
146 cdef_object::operator = (meth);
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
147
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
148 return *this;
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
149 }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
150
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
151 ~cdef_method (void) = default;
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
152
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
153 // normal invocation
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
154 octave_value_list execute (const octave_value_list& args, int nargout,
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
155 bool do_check_access = true,
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
156 const std::string& who = "")
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
157 {
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
158 return get_rep ()->execute (args, nargout, do_check_access, who);
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
159 }
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
160
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
161 // dot-invocation: object is pushed as 1st argument
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
162 octave_value_list execute (const cdef_object& obj,
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
163 const octave_value_list& args, int nargout,
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
164 bool do_check_access = true,
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
165 const std::string& who = "")
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
166 {
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
167 return get_rep ()->execute (obj, args, nargout, do_check_access, who);
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
168 }
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
169
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
170 bool check_access (void) const { return get_rep ()->check_access (); }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
171
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
172 std::string get_name (void) const { return get_rep ()->get_name (); }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
173
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
174 bool is_static (void) const { return get_rep ()->is_static (); }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
175
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
176 void set_function (const octave_value& fcn)
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
177 {
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
178 get_rep ()->set_function (fcn);
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
179 }
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
180
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
181 octave_value get_function (void) const
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
182 {
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
183 return get_rep ()->get_function ();
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
184 }
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
185
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
186 bool is_constructor (void) const
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
187 {
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
188 return get_rep ()->is_constructor ();
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
189 }
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
190
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
191 bool is_external (void) const { return get_rep ()->is_external (); }
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
192
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
193 void mark_as_external (const std::string& dtype)
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
194 {
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
195 get_rep ()->mark_as_external (dtype);
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
196 }
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
197
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
198 private:
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
199
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
200 cdef_method_rep * get_rep (void)
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
201 {
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
202 return dynamic_cast<cdef_method_rep *> (cdef_object::get_rep ());
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
203 }
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
204
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
205 const cdef_method_rep * get_rep (void) const
26773
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
206 {
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
207 return dynamic_cast<const cdef_method_rep *> (cdef_object::get_rep ());
a95887edd55e style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents: 26772
diff changeset
208 }
26772
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
209 };
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
210
d1419ac09564 split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff changeset
211 #endif