Mercurial > octave
changeset 28346:d0555f415774 stable
fix constness of some graphics properties methods
* graphics.in.h, graphics.cc (base_properties::has_dynamic_property,
base_properties::get_property_dynamic): Now const.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 21 May 2020 11:23:24 -0400 |
parents | c5f12165d294 |
children | 00a9a49c7670 |
files | libinterp/corefcn/graphics.cc libinterp/corefcn/graphics.in.h |
diffstat | 2 files changed, 19 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc Thu May 21 09:14:27 2020 -0400 +++ b/libinterp/corefcn/graphics.cc Thu May 21 11:23:24 2020 -0400 @@ -3341,7 +3341,7 @@ } bool -base_properties::has_dynamic_property (const std::string& pname) +base_properties::has_dynamic_property (const std::string& pname) const { const std::set<std::string>& dynprops = dynamic_property_names (); @@ -3368,7 +3368,7 @@ } property -base_properties::get_property_dynamic (const caseless_str& pname) +base_properties::get_property_dynamic (const caseless_str& pname) const { std::map<caseless_str, property, cmp_caseless_str>::const_iterator it = all_props.find (pname);
--- a/libinterp/corefcn/graphics.in.h Thu May 21 09:14:27 2020 -0400 +++ b/libinterp/corefcn/graphics.in.h Thu May 21 11:23:24 2020 -0400 @@ -2233,6 +2233,9 @@ virtual octave_value get (bool all = false) const; + // FIXME: It seems like this function should be const, but that is + // currently not possible with the way that properties are stored as + // specific types in the graphics_object classes. virtual property get_property (const caseless_str& pname); virtual bool has_property (const caseless_str&) const @@ -2358,7 +2361,7 @@ std::set<std::string> dynamic_property_names (void) const; - bool has_dynamic_property (const std::string& pname); + bool has_dynamic_property (const std::string& pname) const; protected: std::set<std::string> dynamic_properties; @@ -2369,7 +2372,7 @@ octave_value get_dynamic (bool all = false) const; - property get_property_dynamic (const caseless_str& pname); + property get_property_dynamic (const caseless_str& pname) const; BEGIN_BASE_PROPERTIES // properties common to all objects @@ -2534,10 +2537,16 @@ return base_properties::has_readonly_property (pname); } + // FIXME: It seems like this function should be const, but that is + // currently not possible. virtual std::string values_as_string (void); + // FIXME: It seems like this function should be const, but that is + // currently not possible. virtual std::string value_as_string (const std::string& prop); + // FIXME: It seems like this function should be const, but that is + // currently not possible. virtual octave_scalar_map values_as_struct (void); virtual graphics_handle get_parent (void) const @@ -2783,13 +2792,19 @@ return rep->has_readonly_property (pname); } + // FIXME: It seems like this function should be const, but that is + // currently not possible. std::string values_as_string (void) { return rep->values_as_string (); } + // FIXME: It seems like this function should be const, but that is + // currently not possible. std::string value_as_string (const std::string& prop) { return rep->value_as_string (prop); } + // FIXME: It seems like this function should be const, but that is + // currently not possible. octave_map values_as_struct (void) { return rep->values_as_struct (); } graphics_handle get_parent (void) const { return rep->get_parent (); }