summaryrefslogtreecommitdiff
path: root/src/lib/efl/interfaces/efl_io_writer.eo
blob: 7e109cf372c77db03945d4c3233d06c14a9b9309 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import eina_types;

interface Efl.Io.Writer {
    [[Generic interface for objects that can write data from a provided memory.

      This interface allows external objects to transparently write
      data to this object and be notified whether more data can be written
      or if it's reached capacity.

      Calls to @.write() may or may not block: that's not up to this
      interface to specify. The user can check with event
      "can_write,changed" or property @.can_write to known whenever a write
      could push more data.

      @since 1.19
    ]]

    methods {
        write {
            [[Writes data from a pre-populated buffer.

              This operation will be executed immediately and may or
              may not block the caller thread for some time. The
              details of blocking behavior is defined by the
              implementation and may be subject to other parameters
              such as non-blocking flags, maximum timeout or even
              retry attempts.

              You can understand this method as write(2) libc function.
            ]]
            params {
                @inout slice: Eina.Slice @nonull; [[Provides a pre-populated memory to be used up to slice.len. The returned slice will be adapted as length will be set to the actually used amount of bytes, which can be smaller than the request.]]
                @out remaining: Eina.Slice @optional; [[Convenience to output the remaining parts of slice that was not written. If the full slice was written, this will be a slice of zero-length.]]
            }
            return: Eina.Error; [[0 on succeed, a mapping of errno otherwise]]
        }

        @property can_write {
            [[If $true will notify @.write can be called without blocking or failing.]]
            get { }
            set @protected { }
            values {
                can_write: bool; [[$true if it can be written without blocking or failure, $false
                         otherwise]]
            }
        }
    }

    events {
        can_write,changed: void; [[Notifies can_write property changed.

                             If @.can_write is $true there is data to
                             @.write without blocking/error. If
                             @.can_write is $false, @.write would
                             either block or fail.

                             Note that usually this event is
                             dispatched from inside
                             @Efl.Io.Writer.write, thus before it
                             returns.
                       ]]
    }
}