annotate libinterp/octave-value/ov-fcn-inline.h @ 18416:bcd71a2531d3

Support disp/display overloading in classdef * ov-classdef.h (octave_classdef::print, octave_classdef::print_raw): Move definition to C++ file. (octave_classdef::print_as_scalar): Removed method. (octave_classdef::print_name_tag, octave_classdef::print_with_name): New methods. * ov-classdef.cc (octave_classdef::print): Moved from header. (octave_classdef::print_raw): Likewise. Call overloaded disp, if defined and not called from builtin. (octave_classdef::print_name_tag): New method. (octave_classdef::print_with_name): New method, calls overloaded "display" if defined. * pr-output.cc (octave_print_internal(std::ostream, bool): Avoid compilation warning. (Frats, Fdisp, Ffdisp): Allow to call non-const octave_value::print. * ov.h (octave_value::print): Make non-const. * ov-base.h (octave_base_value::print): Likewise. * ov-base.cc (octave_base_value::print): Likewise. * ov-base-diag.h (octave_base_diag::print): Likewise. * ov-base-diag.cc (octave_base_diag::print): Likewise. * ov-base-mat.h (octave_base_matrix::print): Likewise. * ov-base-mat.cc (octave_base_matrix::print): Likewise. * ov-base-scalar.h (octave_base_scalar::print): Likewise. * ov-base-scalar.cc (octave_base_scalar::print): Likewise. * ov-base-sparse.h (octave_base_sparse::print): Likewise. * ov-base-sparse.cc (octave_base_sparse::print): Likewise. * ov-cell.h (octave_cell::print): Likewise. * ov-cell.cc (octave_cell::print): Likewise. * ov-class.h (octave_class::print): Likewise. * ov-class.cc (octave_class::print): Likewise. * ov-colon.h (octave_magic_colon::print): Likewise. * ov-colon.cc (octave_magic_colon::print): Likewise. * ov-fcn-handle.h (octave_fcn_handle::print): Likewise. * ov-fcn-handle.cc (octave_fcn_handle::print): Likewise. * ov-fcn-inline.h (octave_fcn_inline::print): Likewise. * ov-fcn-inline.cc (octave_fcn_inline::print): Likewise. * ov-java.h (octave_java::print): Likewise. * ov-java.cc (octave_java::print): Likewise. * ov-lazy-idx.h (octave_lazy_index::print): Likewise. * ov-oncleanup.h (octave_oncleanup::print): Likewise. * ov-oncleanup.cc (octave_oncleanup::print): Likewise. * ov-perm.h (octave_perm_matrix::print): Likewise. * ov-perm.cc (octave_perm_matrix::print): Likewise. * ov-range.h (octave_range::print): Likewise. * ov-range.cc (octave_range::print): Likewise. * ov-struct.h (octave_struct::print, octave_scalar_struct): Likewise. * ov-struct.cc (octave_struct::print, octave_scalar_struct): Likewise.
author Michael Goffioul <michael.goffioul@gmail.com>
date Fri, 31 Jan 2014 11:41:19 -0500
parents ebb3ef964372
children 76478d2da117
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
1 /*
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
2
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
3 Copyright (C) 2004-2013 David Bateman
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
4
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
5 This file is part of Octave.
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
6
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
8 under the terms of the GNU General Public License as published by the
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
10 option) any later version.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
11
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
15 for more details.
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
16
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6974
diff changeset
19 <http://www.gnu.org/licenses/>.
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
20
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
21 */
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
22
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
23 #if !defined (octave_ov_fcn_inline_h)
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
24 #define octave_ov_fcn_inline_h 1
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
25
8950
d865363208d6 include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
26 #include <iosfwd>
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
27 #include <string>
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
28
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
29 #include "oct-alloc.h"
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
30
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
31 #include "ov-base.h"
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
32 #include "ov-base-mat.h"
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
33 #include "ov-fcn.h"
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
34 #include "ov-typeinfo.h"
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
35 #include "symtab.h"
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
36 #include "ov-fcn-handle.h"
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
37
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
38 // Inline functions.
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
39
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
40 class
7867
f6fffa74b9b5 Export additional symbols: octave_fcn_inline, octave_fcn_handle, read_binary_data, save_binary_data.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 7017
diff changeset
41 OCTINTERP_API
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
42 octave_fcn_inline : public octave_fcn_handle
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
43 {
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
44 public:
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
45
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
46 octave_fcn_inline (void)
4967
0355f2f7d193 [project @ 2004-09-07 15:09:14 by jwe]
jwe
parents: 4954
diff changeset
47 : octave_fcn_handle (), iftext (), ifargs () { }
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
48
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
49 octave_fcn_inline (const std::string& f, const string_vector& a,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
50 const std::string& n = std::string ());
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
51
4967
0355f2f7d193 [project @ 2004-09-07 15:09:14 by jwe]
jwe
parents: 4954
diff changeset
52 octave_fcn_inline (const octave_fcn_inline& fi)
0355f2f7d193 [project @ 2004-09-07 15:09:14 by jwe]
jwe
parents: 4954
diff changeset
53 : octave_fcn_handle (fi), iftext (fi.iftext), ifargs (fi.ifargs) { }
0355f2f7d193 [project @ 2004-09-07 15:09:14 by jwe]
jwe
parents: 4954
diff changeset
54
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
55 ~octave_fcn_inline (void) { }
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
56
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
57 octave_base_value *clone (void) const
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
58 { return new octave_fcn_inline (*this); }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
59 octave_base_value *empty_clone (void) const
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
60 { return new octave_fcn_inline (); }
4967
0355f2f7d193 [project @ 2004-09-07 15:09:14 by jwe]
jwe
parents: 4954
diff changeset
61
4954
ed0f3cb6d3d4 [project @ 2004-09-01 21:24:53 by jwe]
jwe
parents: 4933
diff changeset
62 bool is_inline_function (void) const { return true; }
ed0f3cb6d3d4 [project @ 2004-09-01 21:24:53 by jwe]
jwe
parents: 4933
diff changeset
63
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
64 octave_fcn_inline *fcn_inline_value (bool = false) { return this; }
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
65
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
66 std::string fcn_text (void) const { return iftext; }
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
67
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
68 string_vector fcn_arg_names (void) const { return ifargs; }
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
69
5279
bd32f770c09a [project @ 2005-04-12 21:55:31 by jwe]
jwe
parents: 5164
diff changeset
70 octave_value convert_to_str_internal (bool, bool, char) const;
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
71
10742
604e13a89c7f initial code for structs rewrite
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
72 octave_map map_value (void) const;
6625
5d02dfacfc9e [project @ 2007-05-16 08:49:47 by dbateman]
dbateman
parents: 5958
diff changeset
73
6974
9e32bb109980 [project @ 2007-10-08 11:06:47 by jwe]
jwe
parents: 6625
diff changeset
74 bool save_ascii (std::ostream& os);
4972
724675f7f7cb [project @ 2004-09-08 17:00:20 by jwe]
jwe
parents: 4967
diff changeset
75
724675f7f7cb [project @ 2004-09-08 17:00:20 by jwe]
jwe
parents: 4967
diff changeset
76 bool load_ascii (std::istream& is);
724675f7f7cb [project @ 2004-09-08 17:00:20 by jwe]
jwe
parents: 4967
diff changeset
77
724675f7f7cb [project @ 2004-09-08 17:00:20 by jwe]
jwe
parents: 4967
diff changeset
78 bool save_binary (std::ostream& os, bool& save_as_floats);
724675f7f7cb [project @ 2004-09-08 17:00:20 by jwe]
jwe
parents: 4967
diff changeset
79
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
80 bool load_binary (std::istream& is, bool swap,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
81 oct_mach_info::float_format fmt);
4972
724675f7f7cb [project @ 2004-09-08 17:00:20 by jwe]
jwe
parents: 4967
diff changeset
82
724675f7f7cb [project @ 2004-09-08 17:00:20 by jwe]
jwe
parents: 4967
diff changeset
83 #if defined (HAVE_HDF5)
724675f7f7cb [project @ 2004-09-08 17:00:20 by jwe]
jwe
parents: 4967
diff changeset
84 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
724675f7f7cb [project @ 2004-09-08 17:00:20 by jwe]
jwe
parents: 4967
diff changeset
85
9881
b3089dba88bf Remove HDF5 cruft for older versions of HDF5
Kacper Kowalik
parents: 8950
diff changeset
86 bool load_hdf5 (hid_t loc_id, const char *name);
4972
724675f7f7cb [project @ 2004-09-08 17:00:20 by jwe]
jwe
parents: 4967
diff changeset
87 #endif
724675f7f7cb [project @ 2004-09-08 17:00:20 by jwe]
jwe
parents: 4967
diff changeset
88
18416
bcd71a2531d3 Support disp/display overloading in classdef
Michael Goffioul <michael.goffioul@gmail.com>
parents: 17822
diff changeset
89 void print (std::ostream& os, bool pr_as_read_syntax = false);
4933
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
90
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
91 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
92
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
93 private:
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
94
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
95 DECLARE_OCTAVE_ALLOCATOR
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
96
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
97 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
98
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
99 // The expression of an inline function.
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
100 std::string iftext;
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
101
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
102 // The args of an inline function.
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
103 string_vector ifargs;
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
104 };
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
105
cd58733c326b [project @ 2004-08-05 16:08:28 by jwe]
jwe
parents:
diff changeset
106 #endif