Mercurial > hg > octave-avbm
changeset 13874:c1b754d93572
copy parent class info when performing operations on class objects
* ov.h (octave_value::octave_value (const Octave_map&,
const std::string&, const std::list<std::string>&)):
Don't provide default value for parent_list argument.
Change all callers that used only two arguments.
* ov-class.h (octave_class::octave_class (const octave_map&,
const std::string&, const std::list<std::string>&)): Likewise.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 17 Nov 2011 04:01:04 -0500 |
parents | 1bf8c244040a |
children | c1b072ef1fc7 |
files | src/ls-mat5.cc src/ov-class.cc src/ov-class.h src/ov.h |
diffstat | 4 files changed, 17 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ls-mat5.cc +++ b/src/ls-mat5.cc @@ -1224,7 +1224,9 @@ } else { - octave_class* cls = new octave_class (m, classname); + octave_class* cls + = new octave_class (m, classname, + std::list<std::string> ()); if (cls->reconstruct_exemplar ()) {
--- a/src/ov-class.cc +++ b/src/ov-class.cc @@ -515,7 +515,7 @@ } else retval(0) = octave_value (map.index (idx.front ()), - class_name ()); + c_name, parent_list); } break; @@ -591,8 +591,8 @@ else { if (type.length () == 1 && type[0] == '(') - retval(0) = octave_value (map.index (idx.front ()), class_name (), - parent_class_name_list ()); + retval(0) = octave_value (map.index (idx.front ()), c_name, + parent_list); else gripe_invalid_index1 (); } @@ -993,7 +993,7 @@ if (meth.is_defined ()) { octave_value_list args; - args(0) = octave_value (new octave_class (map, c_name)); + args(0) = octave_value (new octave_class (map, c_name, parent_list)); octave_value_list tmp = feval (meth.function_value (), args, 1); @@ -1123,7 +1123,7 @@ if (meth.is_defined ()) { octave_value_list args; - args(0) = octave_value (new octave_class (map, c_name)); + args(0) = octave_value (new octave_class (map, c_name, parent_list)); octave_value_list tmp = feval (meth.function_value (), args, 1); @@ -1954,7 +1954,9 @@ if (! error_state) { if (nargin == 2) - retval = octave_value (new octave_class (m, id)); + retval + = octave_value (new octave_class + (m, id, std::list<std::string> ())); else { octave_value_list parents = args.slice (2, nargin-2);
--- a/src/ov-class.h +++ b/src/ov-class.h @@ -55,19 +55,18 @@ { } octave_class (const octave_map& m, const std::string& id, - const std::list<std::string>& plist - = std::list<std::string> ()) + const std::list<std::string>& plist) : octave_base_value (), map (m), c_name (id), parent_list (plist), obsolete_copies (0) { } + octave_class (const octave_map& m, const std::string& id, + const octave_value_list& parents); + octave_class (const octave_class& s) : octave_base_value (s), map (s.map), c_name (s.c_name), parent_list (s.parent_list), obsolete_copies (0) { } - octave_class (const octave_map& m, const std::string& id, - const octave_value_list& parents); - ~octave_class (void) { } octave_base_value *clone (void) const { return new octave_class (*this); } @@ -76,7 +75,7 @@ octave_base_value *empty_clone (void) const { - return new octave_class (octave_map (map.keys ()), class_name ()); + return new octave_class (octave_map (map.keys ()), c_name, parent_list); } Cell dotref (const octave_value_list& idx);
--- a/src/ov.h +++ b/src/ov.h @@ -280,8 +280,7 @@ octave_value (const octave_scalar_map& m); octave_value (const Octave_map& m); octave_value (const Octave_map& m, const std::string& id, - const std::list<std::string>& plist - = std::list<std::string> ()); + const std::list<std::string>& plist); octave_value (const octave_value_list& m, bool = false); octave_value (octave_value::magic_colon);