summaryrefslogtreecommitdiff
path: root/src/lib/ecore/efl_promise.eo
blob: c68f9e56f02aad070e0453632c879fbf885aa536 (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
import eina_types;

class Efl.Promise (Efl.Loop_User)
{
   [[Efl promise class]]
   methods {
      progress_set {
         [[Updates the progress and send it immediately to all connected Efl_Future.

           The progress is not kept and when the function return 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 then callback 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 while the progress will be updated by progress_set.]]
         }
      }
      @property value {
      	 [[The value expected by all connected future.]]
         set {
	    [[
              This function can be called only once and you can not call #failed.set after that.
              The value will be owned by the promise until it is destroyed. The value will be cleaned
              when the promise and all the future 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 can not call #value.set after that.
	    ]]
	 }
         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
           succeed or fail respectively with the value provided by the future.
	 ]]
	 params {
	    @in f: future<void_ptr, void_ptr>; [[The future to connect this promise to.]]
	 }
	 return: bool; [[Returns $false if unable to setup the connection.]]
      }
   }
   events {
      future,set: future<void_ptr>; [[This event is triggered whenever a future is fully set to receive all events and that the user of it do not hold any more reference on it.]]
      future,progress,set: future<void_ptr>; [[This event is triggered whenever a future has a progress callback registered and the user does not hold any more reference on it.]]
      future,none; [[This event is triggered whenever there is no more future connected to the promise.]]
   }
   implements {
      Efl.Object.destructor;
      Efl.Object.constructor;
   }
}