Mercurial > octave
diff libinterp/octave-value/ov-classdef.cc @ 27186:b15b71bcd679
properties function: omit hidden properties (bug #55766)
* ov-classdef.cc (Fproperties): Also skip hidden properties.
* test/classdef/class_bug55766.m: New file.
* classdef.tst: New test.
* test/classdef/module.mk: Update.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 14 Jun 2019 12:52:27 -0500 |
parents | 1ccb40372115 |
children | 792fe198c105 |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-classdef.cc Fri Jun 14 11:14:01 2019 -0500 +++ b/libinterp/octave-value/ov-classdef.cc Fri Jun 14 12:52:27 2019 -0500 @@ -524,13 +524,14 @@ @deftypefn {} {} properties (@var{class_name}) @deftypefnx {} {} properties (@var{obj}) @deftypefnx {} {@var{plist} =} properties (@dots{}) -Return or display the public properties for the named class @var{class_name} or -classdef object @var{obj}. +Return or display the public properties for the named class +@var{class_name} or classdef object @var{obj}. -If an output value is requested, return the list of property names in a cell -array. +If an output value is requested, return the list of property names in a +cell array. -Programming Note: Property names are returned if the @code{GetAccess} attribute is public and if the @code{Hidden} attribute is false. +Programming Note: Property names are returned if the @code{GetAccess} +attribute is public and if the @code{Hidden} attribute is false. @seealso{methods} @end deftypefn */) { @@ -561,13 +562,20 @@ for (const auto& pname_prop : property_map) { - std::string nm = pname_prop.second.get_name (); + const octave::cdef_property& prop = pname_prop.second; - octave_value acc = pname_prop.second.get ("GetAccess"); + std::string nm = prop.get_name (); + + octave_value acc = prop.get ("GetAccess"); if (! acc.is_string () || acc.string_value () != "public") continue; + octave_value hid = prop.get ("Hidden"); + + if (hid.bool_value ()) + continue; + property_names.push_back (nm); }