Mercurial > octave
annotate libinterp/octave-value/cdef-package.h @ 30346:91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
* __isprimelarge__.cc, bsxfun.cc, cellfun.cc, chol.cc, data.cc, error.h,
event-manager.h, filter.cc, find.cc, gcd.cc, gl-render.h, gl2ps-print.cc,
graphics.cc, graphics.in.h, hash.cc, help.cc, hex2num.cc, input.cc, inv.cc,
load-path.cc, load-save.cc, ls-hdf5.cc, ls-hdf5.h, ls-mat5.cc, lu.cc,
mappers.cc, matrix_type.cc, max.cc, mex.cc, mxarray.h, oct-errno.in.cc,
oct-map.cc, oct-stream.cc, oct-stream.h, pr-output.cc, psi.cc, qr.cc, rand.cc,
regexp.cc, sparse-xdiv.h, stack-frame.cc, strfind.cc, strfns.cc, sylvester.cc,
symbfact.cc, symrec.h, symscope.cc, typecast.cc, utils.cc, variables.h, xdiv.h,
xpow.h, __init_fltk__.cc, __ode15__.cc, audiodevinfo.cc, audioread.cc,
convhulln.cc, cdef-class.cc, cdef-class.h, cdef-manager.cc, cdef-method.cc,
cdef-object.cc, cdef-object.h, cdef-package.h, cdef-utils.cc, ov-base-diag.cc,
ov-base-int.cc, ov-base.h, ov-bool-mat.cc, ov-bool.cc, ov-cell.cc,
ov-ch-mat.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-colon.h,
ov-complex.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-dld-fcn.h, ov-fcn-handle.cc,
ov-float.cc, ov-flt-complex.cc, ov-flt-cx-diag.cc, ov-flt-cx-mat.cc,
ov-flt-re-diag.cc, ov-flt-re-mat.cc, ov-java.cc, ov-lazy-idx.cc, ov-lazy-idx.h,
ov-range.cc, ov-re-mat.cc, ov-re-mat.h, ov-re-sparse.cc, ov-scalar.cc,
ov-str-mat.cc, ov-struct.cc, ov-typeinfo.cc, ov.cc, ov.h, octave.h,
bp-table.cc, bp-table.h, lex.h, oct-lvalue.h, profiler.cc, profiler.h,
pt-binop.h, pt-colon.cc, pt-eval.cc, pt-exp.h, pt-select.h:
Shorten some long lines in libinterp to <= 80 characters.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 24 Nov 2021 09:38:51 -0800 |
parents | 0e0cc2760540 |
children | cd5836f814b8 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27932
diff
changeset
|
3 // Copyright (C) 2012-2021 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
26772
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 #if ! defined (octave_cdef_package_h) |
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 #define octave_cdef_package_h 1 |
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 |
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 #include "octave-config.h" |
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 |
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 #include <map> |
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include <set> |
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 #include <string> |
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 |
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 #include "oct-refcount.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 #include "cdef-object.h" |
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 #include "ov.h" |
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 namespace octave |
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 class interpreter; |
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 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
45 cdef_package : public cdef_meta_object |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 { |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
47 friend class cdef_class; |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 |
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 private: |
26773
a95887edd55e
style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents:
26772
diff
changeset
|
50 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
51 class |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
52 cdef_package_rep : public cdef_meta_object_rep |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 { |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
54 public: |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
55 |
30075
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
56 cdef_package_rep (void) : cdef_meta_object_rep (), m_member_count (0) { } |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
57 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
58 cdef_package_rep& operator = (const cdef_package_rep&) = delete; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
59 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
60 ~cdef_package_rep (void) = default; |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
61 |
30346
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
30075
diff
changeset
|
62 cdef_object_rep * copy (void) const |
91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents:
30075
diff
changeset
|
63 { return new cdef_package_rep (*this); } |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
64 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
65 bool is_package (void) const { return true; } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
66 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
67 std::string get_name (void) const { return get("Name").string_value (); } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
68 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
69 void set_name (const std::string& nm) { put ("Name", nm); } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
70 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
71 OCTINTERP_API void |
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
72 install_class (const cdef_class& cls, const std::string& nm); |
26773
a95887edd55e
style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents:
26772
diff
changeset
|
73 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
74 OCTINTERP_API void |
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
75 install_function (const octave_value& fcn, const std::string& nm); |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
76 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
77 OCTINTERP_API void |
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
78 install_package (const cdef_package& pack, const std::string& nm); |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
79 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
80 OCTINTERP_API Cell get_classes (void) const; |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
81 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
82 OCTINTERP_API Cell get_functions (void) const; |
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
83 |
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
84 OCTINTERP_API Cell get_packages (void) const; |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
85 |
30075
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
86 octave_idx_type static_count (void) const { return m_member_count; } |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
87 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
88 void destroy (void) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
89 { |
30075
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
90 if (m_member_count) |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
91 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
92 m_count++; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
93 cdef_package lock (this); |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
94 |
30075
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
95 m_member_count = 0; |
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
96 m_class_map.clear (); |
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
97 m_package_map.clear (); |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
98 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
99 else |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
100 delete this; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
101 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
102 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
103 OCTINTERP_API octave_value_list |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
104 meta_subsref (const std::string& type, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
105 const std::list<octave_value_list>& idx, int nargout); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
106 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
107 OCTINTERP_API void meta_release (void); |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
108 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
109 bool meta_accepts_postfix_index (char type) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
110 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
111 return (type == '.'); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
112 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
113 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
114 OCTINTERP_API octave_value find (const std::string& nm); |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
115 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
116 private: |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
117 |
30075
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
118 std::string m_full_name; |
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
119 std::map<std::string, cdef_class> m_class_map; |
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
120 std::map<std::string, octave_value> m_function_map; |
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
121 std::map<std::string, cdef_package> m_package_map; |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
122 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
123 // The number of registered members in this package (classes, packages). |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
124 // This only accounts for the members that back-reference to this package. |
30075
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
125 octave_idx_type m_member_count; |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
126 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
127 typedef std::map<std::string, cdef_class>::iterator class_iterator; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
128 typedef std::map<std::string, cdef_class>::const_iterator class_const_iterator; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
129 typedef std::map<std::string, octave_value>::iterator function_iterator; |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
130 typedef std::map<std::string, octave_value>::const_iterator |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
131 function_const_iterator; |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
132 typedef std::map<std::string, cdef_package>::iterator package_iterator; |
27932
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
133 typedef std::map<std::string, cdef_package>::const_iterator |
b018f553fd85
maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
134 package_const_iterator; |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
135 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
136 cdef_package_rep (const cdef_package_rep& p) |
30075
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
137 : cdef_meta_object_rep (p), m_full_name (p.m_full_name), |
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
138 m_class_map (p.m_class_map), m_function_map (p.m_function_map), |
0e0cc2760540
maint: use "m_" prefix for member variables in some classdef classes.
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
139 m_package_map (p.m_package_map), m_member_count (p.m_member_count) |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
140 { } |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
141 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
142 cdef_package wrap (void) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
143 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
144 m_count++; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
145 return cdef_package (this); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
146 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
147 }; |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
148 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
149 public: |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
150 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
151 cdef_package (void) : cdef_meta_object () { } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
152 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
153 cdef_package (const std::string& nm) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
154 : cdef_meta_object (new cdef_package_rep ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
155 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
156 get_rep ()->set_name (nm); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
157 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
158 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
159 cdef_package (const cdef_package& pack) : cdef_meta_object (pack) { } |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
160 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
161 cdef_package (const cdef_object& obj) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
162 : cdef_meta_object (obj) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
163 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
164 // This should never happen... |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
165 if (! is_package ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
166 error ("internal error: invalid assignment from %s to meta.package object", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
167 class_name ().c_str ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
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 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
170 cdef_package& operator = (const cdef_package& pack) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
171 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
172 cdef_object::operator = (pack); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
173 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
174 return *this; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
175 } |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
176 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
177 ~cdef_package (void) = default; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
178 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
179 void install_class (const cdef_class& cls, const std::string& nm) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
180 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
181 get_rep ()->install_class (cls, nm); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
182 } |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
183 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
184 void install_function (const octave_value& fcn, const std::string& nm) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
185 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
186 get_rep ()->install_function (fcn, nm); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
187 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
188 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
189 void install_package (const cdef_package& pack, const std::string& nm) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
190 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
191 get_rep ()->install_package (pack, nm); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
192 } |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
193 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
194 Cell get_classes (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
195 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
196 return get_rep ()->get_classes (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
197 } |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
198 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
199 Cell get_functions (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
200 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
201 return get_rep ()->get_functions (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
202 } |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
203 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
204 Cell get_packages (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
205 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
206 return get_rep ()->get_packages (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
207 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
208 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
209 std::string get_name (void) const { return get_rep ()->get_name (); } |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
210 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
211 octave_value find (const std::string& nm) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
212 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
213 return get_rep ()->find (nm); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
214 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
215 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
216 private: |
26773
a95887edd55e
style fixes for classdef classes
John W. Eaton <jwe@octave.org>
parents:
26772
diff
changeset
|
217 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
218 cdef_package_rep * get_rep (void) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
219 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
220 return dynamic_cast<cdef_package_rep *> (cdef_object::get_rep ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
221 } |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
222 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
223 const cdef_package_rep * get_rep (void) const |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
224 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
225 return dynamic_cast<const cdef_package_rep *> (cdef_object::get_rep ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
226 } |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
227 |
29234
853e60367cb6
Set API tags in files in libinterp/octave-value (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27932
diff
changeset
|
228 friend OCTINTERP_API void install_classdef (interpreter& interp); |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
229 }; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26773
diff
changeset
|
230 } |
26772
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
231 |
d1419ac09564
split method, package, and property classes from cdef-class file
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
232 #endif |