Re: [Vala] How to extend IOStream in Vala?



On Mon, Nov 21, 2011 at 11:50 AM, Paul Jakma <paul jakma org> wrote:

Hi,

I want to extend IOStream, to create a memory channel based IO stream, by
wrapping around some modified Memory{In,Out}putStreams. However, it doesn't
seem to be possible, because the input_stream and output_stream properties
of IOStream are read-only. I get this warning if I try to set them from my
extending class:

MemoryIOStream.vala:44.5-44.**23: error: Property
`GLib.IOStream.input_stream' is read-only

If I try to define these fields in my extending class, i.e.:

 public InputStream input_stream { public get; private set; }
 public OutputStream output_stream { public get; private set; }

I get a warning that I'm hiding the visibility of the inherited
property[1]:


There's a bug in the bindings. Both input_stream and output_stream must be
abstract.
This should be the right way to extend IOStream:

public class Foo : IOStream {
        public override InputStream input_stream { get {
                return your_input_stream; } }
        public override OutputStream output_stream { get {
                return your_output_stream; } }
}

Feel free to report a bug at bugzilla.gnome.org .

-- 
www.debian.org - The Universal Operating System


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]