Mercurial > octave
comparison libinterp/octave-value/ov-classdef.cc @ 22898:9baa19102908
refactor display and disp functions (bug #49794)
* pr-output.cc (Fdisp, Ffdisp): Tag with dispatch classes.
(Fdisplay): New function.
* ov-class.cc (octave_class::print_with_name):
Simply call octave_base_value::print_with_name.
* ov-classdef.cc (octave_classdef::print): Simply call print_raw.
(octave_classdef::print_with_name):
Simply call octave_base_value::print_with_name.
* variables.cc (bind_ans): Call display function to print result.
* pt-assign.cc (tree_simple_assignment::rvalue1,
tree_multi_assignment::rvalue): Likewise.
* pt-id.cc (tree_identifier::rvalue): Likewise.
* display.m: Delete.
* scripts/general/module.mk: Update.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 16 Dec 2016 00:10:27 -0500 |
parents | 50495eeb5df1 |
children | 53bb781d70c0 |
comparison
equal
deleted
inserted
replaced
22897:4090c32fccf8 | 22898:9baa19102908 |
---|---|
941 } | 941 } |
942 | 942 |
943 void | 943 void |
944 octave_classdef::print (std::ostream& os, bool) | 944 octave_classdef::print (std::ostream& os, bool) |
945 { | 945 { |
946 if (! called_from_builtin ()) | |
947 { | |
948 cdef_method meth = object.get_class ().find_method ("disp"); | |
949 | |
950 if (meth.ok ()) | |
951 { | |
952 octave_value_list args; | |
953 | |
954 count++; | |
955 args(0) = octave_value (this); | |
956 | |
957 indent (os); | |
958 meth.execute (args, 0, true, "disp"); | |
959 | |
960 return; | |
961 } | |
962 } | |
963 | |
964 print_raw (os); | 946 print_raw (os); |
965 } | 947 } |
966 | 948 |
967 void | 949 void |
968 octave_classdef::print_raw (std::ostream& os, bool) const | 950 octave_classdef::print_raw (std::ostream& os, bool) const |
984 | 966 |
985 void | 967 void |
986 octave_classdef::print_with_name (std::ostream& os, const std::string& name, | 968 octave_classdef::print_with_name (std::ostream& os, const std::string& name, |
987 bool print_padding) | 969 bool print_padding) |
988 { | 970 { |
989 cdef_method meth = object.get_class ().find_method ("display"); | 971 octave_base_value::print_with_name (os, name, print_padding); |
990 | |
991 if (meth.ok ()) | |
992 { | |
993 octave_value_list args; | |
994 | |
995 count++; | |
996 args(0) = octave_value (this); | |
997 | |
998 string_vector arg_names (1); | |
999 | |
1000 arg_names[0] = name; | |
1001 args.stash_name_tags (arg_names); | |
1002 | |
1003 indent (os); | |
1004 meth.execute (args, 0, true, "display"); | |
1005 } | |
1006 else | |
1007 octave_base_value::print_with_name (os, name, print_padding); | |
1008 } | 972 } |
1009 | 973 |
1010 bool | 974 bool |
1011 octave_classdef::is_instance_of (const std::string& cls_name) const | 975 octave_classdef::is_instance_of (const std::string& cls_name) const |
1012 { | 976 { |