summaryrefslogtreecommitdiff
path: root/src/lib/ecore/efl_promise.eo
blob: bed53b393a371b2d2e9659dff5b94e610585838b (plain) (blame)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import eina_types;

class Efl.Promise (Efl.Loop.Consumer)
{
   [[Efl promise class]]
   methods {
      progress_set {
         [[Updates progress and sends it immediately to all connected Efl_Future.

           The progress is not stored and when the function returns it will not be accessed
           anymore. The pointer is owned by the caller and will remain so after the return
	   of the function call.
	 ]]
         params {
            @in p: const(void_ptr); [[Progress to be set]]
	 }
      }
      @property future {
         [[Requests a new future linked to this promise.

	   Efl_Future are optional and will be automatically deleted if no callbacks have
	   been set before the next iteration of the main loop.
	 ]]
         get {
	    [[The returned new future.]]
         }
         values {
            f: future<void_ptr, void_ptr>; [[Returns a future where the value will be set by calling value_set whilst the progress is 
            updated by progress_set.]]
         }
      }
      @property value {
      	 [[The value expected by all connected future.]]
         set {
	    [[
              This function can be called only once. You cannot call #failed.set after doing so.
              The value will be owned by the promise until it's destroyed. It will be cleaned
              when the promise and all futures depending on it are destroyed.
            ]]
	 }
	 values {
	    v: void_ptr; [[The pointer to the value.]]
	    free_cb: __builtin_free_cb; [[The function to call to free the value.]]
	 }
      }
      @property failed {
         [[Defines the failure state of this promise.]]
	 set {
	    [[
              This function can be called only once and you cannot call #value.set after doing so.
	    ]]
	 }
         values {
	    err: Eina.Error; [[The reason for failure of this promise.]]
         }
      }
      connect {
         [[Connects a future output to this promise.

           This helper will automatically trigger #value.set or #failed.set when the future
           succeeds or fails respectively, with the value provided by the future.
	 ]]
	 params {
	    @in f: future<void_ptr, void_ptr>; [[The future to connect to this promise.]]
	 }
	 return: bool; [[Returns $false if unable to set up the connection.]]
      }
   }
   events {
      future,set: future<void_ptr>; [[This event is triggered whenever a future is fully set to receive all events and the user
      holds no more references to it.]]
      future,progress,set: future<void_ptr>; [[This event is triggered whenever a future has a progress callback registered and the user holds no more reference to it.]]
      future,none; [[This event is triggered whenever there are no more futures connected to the promise.]]
   }
   implements {
      Efl.Object.destructor;
      Efl.Object.constructor;
      Efl.Object.parent { set; }
   }
}