cdef_property class

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

cdef_property class

Rik-4
3/7/19

I was trying to fix bug #55766: properties function should not return
Hidden properties.  Looking at the properties() function in ov-classdef.cc
there is a simple for loop over the properties of the class and any
non-public properties are rejected.

for (const auto& pname_prop : property_map)
  {
    octave_value acc = pname_prop.second.get ("GetAccess");

    if (! acc.is_string () || acc.string_value () != "public")
      continue;
  }

So I thought this would be easy and I added to the above.

bool hid = pname_prop.second.get ("Hidden").bool_value ();
if (hid)
  continue;

At runtime, however, I get a nasty error about not being able to take a
bool_value on a type of 'sq_string'.

This is odd, so for debugging I added

octave_value hid = pname_prop.second.get ("Hidden");
std::cerr << hid.string_value () << std::endl;

Now, for a classdef file that contains

    properties (Hidden = true)

I find that the string is

/home/rik/.octavepkg

Does anyone know how this is supposed to work?

--Rik