summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno da Silva Belo <brunodasilvabelo@gmail.com>2019-09-06 15:45:18 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-09-06 15:55:17 +0200
commit353524e1b89deb48b64c6125a92c1627a05deb75 (patch)
tree8c472f871bb7e1ea104b5641b080c9c744c90ba3 /src
parent5e1f2cd68cb1563c0a5b03fa4093e6972d46c2e3 (diff)
eolian-mono: Renaming suffix for event and event args
Summary: suffix _Args to Args, Evt to Event Reviewers: lauromoura, felipealmeida Reviewed By: lauromoura Subscribers: Jaehyun_Cho, woohyun, segfaultxavi, cedric, felipealmeida, #reviewers, lauromoura, #committers Tags: #refactoring, PHID-PROJ-uhnmnvlvunw6jgoqdnd4, #efl_language_bindings Maniphest Tasks: T8164, T8163 Differential Revision: https://phab.enlightenment.org/D9692
Diffstat (limited to 'src')
-rw-r--r--src/bin/eolian_mono/eolian/mono/name_helpers.hh6
-rw-r--r--src/bindings/mono/efl_mono/GenericModel.cs24
-rw-r--r--src/bindings/mono/efl_mono/efl_csharp_application.cs8
-rw-r--r--src/examples/elementary/efl_ui_unit_converter.cs6
-rw-r--r--src/tests/efl_mono/Errors.cs2
-rw-r--r--src/tests/efl_mono/Events.cs40
-rw-r--r--src/tests/efl_mono/Model.cs2
7 files changed, 43 insertions, 45 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/name_helpers.hh b/src/bin/eolian_mono/eolian/mono/name_helpers.hh
index d6064b2..8104a78 100644
--- a/src/bin/eolian_mono/eolian/mono/name_helpers.hh
+++ b/src/bin/eolian_mono/eolian/mono/name_helpers.hh
@@ -420,14 +420,12 @@ inline std::string klass_get_full_name(T const& clsname)
420// Events 420// Events
421inline std::string managed_event_name(std::string const& name) 421inline std::string managed_event_name(std::string const& name)
422{ 422{
423 return utils::to_pascal_case(utils::split(name, "_,"), "") + "Evt"; 423 return utils::to_pascal_case(utils::split(name, "_,"), "") + "Event";
424} 424}
425 425
426inline std::string managed_event_args_short_name(attributes::event_def const& evt) 426inline std::string managed_event_args_short_name(attributes::event_def const& evt)
427{ 427{
428 std::string ret; 428 return klass_concrete_or_interface_name(evt.klass) + name_helpers::managed_event_name(evt.name) + "Args";
429 ret = klass_concrete_or_interface_name(evt.klass);
430 return ret + name_helpers::managed_event_name(evt.name) + "_Args";
431} 429}
432 430
433inline std::string managed_event_args_name(attributes::event_def evt) 431inline std::string managed_event_args_name(attributes::event_def evt)
diff --git a/src/bindings/mono/efl_mono/GenericModel.cs b/src/bindings/mono/efl_mono/GenericModel.cs
index 1bfa91e..95389f8 100644
--- a/src/bindings/mono/efl_mono/GenericModel.cs
+++ b/src/bindings/mono/efl_mono/GenericModel.cs
@@ -125,46 +125,46 @@ public class GenericModel<T> : Efl.Object, Efl.IModel, IDisposable
125 } 125 }
126 126
127 /// <summary>Event triggered when properties on the wrapped model changes.</summary> 127 /// <summary>Event triggered when properties on the wrapped model changes.</summary>
128 public event EventHandler<Efl.IModelPropertiesChangedEvt_Args> PropertiesChangedEvt 128 public event EventHandler<Efl.IModelPropertiesChangedEventArgs> PropertiesChangedEvent
129 { 129 {
130 add { 130 add {
131 model.PropertiesChangedEvt += value; 131 model.PropertiesChangedEvent += value;
132 } 132 }
133 remove { 133 remove {
134 model.PropertiesChangedEvt -= value; 134 model.PropertiesChangedEvent -= value;
135 } 135 }
136 } 136 }
137 137
138 /// <summary>Event triggered when a child is added from the wrapped model.</summary> 138 /// <summary>Event triggered when a child is added from the wrapped model.</summary>
139 public event EventHandler<Efl.IModelChildAddedEvt_Args> ChildAddedEvt 139 public event EventHandler<Efl.IModelChildAddedEventArgs> ChildAddedEvent
140 { 140 {
141 add { 141 add {
142 model.ChildAddedEvt += value; 142 model.ChildAddedEvent += value;
143 } 143 }
144 remove { 144 remove {
145 model.ChildAddedEvt -= value; 145 model.ChildAddedEvent -= value;
146 } 146 }
147 } 147 }
148 148
149 /// <summary>Event triggered when a child is removed from the wrapped model.</summary> 149 /// <summary>Event triggered when a child is removed from the wrapped model.</summary>
150 public event EventHandler<Efl.IModelChildRemovedEvt_Args> ChildRemovedEvt 150 public event EventHandler<Efl.IModelChildRemovedEventArgs> ChildRemovedEvent
151 { 151 {
152 add { 152 add {
153 model.ChildRemovedEvt += value; 153 model.ChildRemovedEvent += value;
154 } 154 }
155 remove { 155 remove {
156 model.ChildRemovedEvt -= value; 156 model.ChildRemovedEvent -= value;
157 } 157 }
158 } 158 }
159 159
160 /// <summary>Event triggered when the number of children changes.</summary> 160 /// <summary>Event triggered when the number of children changes.</summary>
161 public event EventHandler ChildrenCountChangedEvt 161 public event EventHandler ChildrenCountChangedEvent
162 { 162 {
163 add { 163 add {
164 model.ChildrenCountChangedEvt += value; 164 model.ChildrenCountChangedEvent += value;
165 } 165 }
166 remove { 166 remove {
167 model.ChildrenCountChangedEvt -= value; 167 model.ChildrenCountChangedEvent -= value;
168 } 168 }
169 } 169 }
170} 170}
diff --git a/src/bindings/mono/efl_mono/efl_csharp_application.cs b/src/bindings/mono/efl_mono/efl_csharp_application.cs
index 4e3a252..93df6e7 100644
--- a/src/bindings/mono/efl_mono/efl_csharp_application.cs
+++ b/src/bindings/mono/efl_mono/efl_csharp_application.cs
@@ -135,7 +135,7 @@ public abstract class Application
135#if EFL_BETA 135#if EFL_BETA
136 app.SetCommandArray(command_line); 136 app.SetCommandArray(command_line);
137#endif 137#endif
138 app.ArgumentsEvt += (object sender, LoopArgumentsEvt_Args evt) => 138 app.ArgumentsEvent += (object sender, LoopArgumentsEventArgs evt) =>
139 { 139 {
140 if (evt.arg.Initialization) 140 if (evt.arg.Initialization)
141 { 141 {
@@ -152,15 +152,15 @@ public abstract class Application
152 152
153 OnArguments(evt.arg); 153 OnArguments(evt.arg);
154 }; 154 };
155 app.PauseEvt += (object sender, EventArgs e) => 155 app.PauseEvent += (object sender, EventArgs e) =>
156 { 156 {
157 OnPause(); 157 OnPause();
158 }; 158 };
159 app.ResumeEvt += (object sender, EventArgs e) => 159 app.ResumeEvent += (object sender, EventArgs e) =>
160 { 160 {
161 OnResume(); 161 OnResume();
162 }; 162 };
163 app.TerminateEvt += (object sender, EventArgs e) => 163 app.TerminateEvent += (object sender, EventArgs e) =>
164 { 164 {
165 OnTerminate(); 165 OnTerminate();
166 }; 166 };
diff --git a/src/examples/elementary/efl_ui_unit_converter.cs b/src/examples/elementary/efl_ui_unit_converter.cs
index 3460af3..93a5f89 100644
--- a/src/examples/elementary/efl_ui_unit_converter.cs
+++ b/src/examples/elementary/efl_ui_unit_converter.cs
@@ -23,7 +23,7 @@ public class Example
23 popup.SetVisible(true); 23 popup.SetVisible(true);
24 popup.SetButton(Efl.Ui.AlertPopupButton.Positive, "Ok", null); 24 popup.SetButton(Efl.Ui.AlertPopupButton.Positive, "Ok", null);
25 popup.SetSize(new Eina.Size2D(150, 30)); 25 popup.SetSize(new Eina.Size2D(150, 30));
26 popup.ButtonClickedEvt += (object sender, Efl.Ui.AlertPopupButtonClickedEvt_Args e) => { 26 popup.ButtonClickedEvent += (object sender, Efl.Ui.AlertPopupButtonClickedEventArgs e) => {
27 popup.SetParent(null); 27 popup.SetParent(null);
28 popup.Invalidate(); 28 popup.Invalidate();
29 }; 29 };
@@ -99,7 +99,7 @@ public class Example
99 kms_box.DoPack(kms_input); 99 kms_box.DoPack(kms_input);
100 kms_box.DoPack(kms_button); 100 kms_box.DoPack(kms_button);
101 101
102 ((Efl.Ui.Clickable)kms_button).ClickedEvt += (object sender, EventArgs e) => { 102 ((Efl.Ui.Clickable)kms_button).ClickedEvent += (object sender, EventArgs e) => {
103 try 103 try
104 { 104 {
105 string text = kms_input.GetText(); 105 string text = kms_input.GetText();
@@ -115,7 +115,7 @@ public class Example
115 } 115 }
116 }; 116 };
117 117
118 ((Efl.Ui.Clickable)miles_button).ClickedEvt += (object sender, EventArgs e) => { 118 ((Efl.Ui.Clickable)miles_button).ClickedEvent += (object sender, EventArgs e) => {
119 try 119 try
120 { 120 {
121 string text = miles_input.GetText(); 121 string text = miles_input.GetText();
diff --git a/src/tests/efl_mono/Errors.cs b/src/tests/efl_mono/Errors.cs
index 802ac33..9229ad0 100644
--- a/src/tests/efl_mono/Errors.cs
+++ b/src/tests/efl_mono/Errors.cs
@@ -99,7 +99,7 @@ class TestEolianError
99 // the managed code 99 // the managed code
100 var obj = new Dummy.TestObject(); 100 var obj = new Dummy.TestObject();
101 Listener listener = new Listener(); 101 Listener listener = new Listener();
102 obj.EvtWithIntEvt += listener.callback; 102 obj.EvtWithIntEvent += listener.callback;
103 103
104 Test.AssertRaises<Efl.EflException>(() => { obj.EmitEventWithInt(2); }); 104 Test.AssertRaises<Efl.EflException>(() => { obj.EmitEventWithInt(2); });
105 } 105 }
diff --git a/src/tests/efl_mono/Events.cs b/src/tests/efl_mono/Events.cs
index b664e2b..d7da6f6 100644
--- a/src/tests/efl_mono/Events.cs
+++ b/src/tests/efl_mono/Events.cs
@@ -30,7 +30,7 @@ class TestEoEvents
30 loop.SetName("loop"); 30 loop.SetName("loop");
31 TestEoEvents listener = new TestEoEvents(); 31 TestEoEvents listener = new TestEoEvents();
32 listener.loop = loop; 32 listener.loop = loop;
33 loop.IdleEvt += listener.callback; 33 loop.IdleEvent += listener.callback;
34 34
35 Test.Assert(!listener.called); 35 Test.Assert(!listener.called);
36 Test.Assert(!listener.correct_sender); 36 Test.Assert(!listener.correct_sender);
@@ -46,7 +46,7 @@ class TestEoEvents
46 var obj = new Dummy.TestObject(); 46 var obj = new Dummy.TestObject();
47 string received_string = null; 47 string received_string = null;
48 48
49 obj.EvtWithStringEvt += (object sender, Dummy.TestObjectEvtWithStringEvt_Args e) => { 49 obj.EvtWithStringEvent += (object sender, Dummy.TestObjectEvtWithStringEventArgs e) => {
50 received_string = e.arg; 50 received_string = e.arg;
51 }; 51 };
52 52
@@ -60,7 +60,7 @@ class TestEoEvents
60 var obj = new Dummy.TestObject(); 60 var obj = new Dummy.TestObject();
61 int received_int= 0; 61 int received_int= 0;
62 62
63 obj.EvtWithIntEvt += (object sender, Dummy.TestObjectEvtWithIntEvt_Args e) => { 63 obj.EvtWithIntEvent += (object sender, Dummy.TestObjectEvtWithIntEventArgs e) => {
64 received_int = e.arg; 64 received_int = e.arg;
65 }; 65 };
66 66
@@ -74,7 +74,7 @@ class TestEoEvents
74 var obj = new Dummy.TestObject(); 74 var obj = new Dummy.TestObject();
75 bool received_bool = false; 75 bool received_bool = false;
76 76
77 obj.EvtWithBoolEvt += (object sender, Dummy.TestObjectEvtWithBoolEvt_Args e) => { 77 obj.EvtWithBoolEvent += (object sender, Dummy.TestObjectEvtWithBoolEventArgs e) => {
78 received_bool = e.arg; 78 received_bool = e.arg;
79 }; 79 };
80 80
@@ -91,7 +91,7 @@ class TestEoEvents
91 { 91 {
92 var obj = new Dummy.TestObject(); 92 var obj = new Dummy.TestObject();
93 uint received_uint = 0; 93 uint received_uint = 0;
94 obj.EvtWithUintEvt += (object sender, Dummy.TestObjectEvtWithUintEvt_Args e) => { 94 obj.EvtWithUintEvent += (object sender, Dummy.TestObjectEvtWithUintEventArgs e) => {
95 received_uint = e.arg; 95 received_uint = e.arg;
96 }; 96 };
97 97
@@ -104,7 +104,7 @@ class TestEoEvents
104 { 104 {
105 var obj = new Dummy.TestObject(); 105 var obj = new Dummy.TestObject();
106 float received_float = 0; 106 float received_float = 0;
107 obj.EvtWithFloatEvt += (object sender, Dummy.TestObjectEvtWithFloatEvt_Args e) => { 107 obj.EvtWithFloatEvent += (object sender, Dummy.TestObjectEvtWithFloatEventArgs e) => {
108 received_float = e.arg; 108 received_float = e.arg;
109 }; 109 };
110 110
@@ -118,7 +118,7 @@ class TestEoEvents
118 var obj = new Dummy.TestObject(); 118 var obj = new Dummy.TestObject();
119 double received_double = 0; 119 double received_double = 0;
120 double reference = float.MaxValue + 42; 120 double reference = float.MaxValue + 42;
121 obj.EvtWithDoubleEvt += (object sender, Dummy.TestObjectEvtWithDoubleEvt_Args e) => { 121 obj.EvtWithDoubleEvent += (object sender, Dummy.TestObjectEvtWithDoubleEventArgs e) => {
122 received_double = e.arg; 122 received_double = e.arg;
123 }; 123 };
124 124
@@ -132,7 +132,7 @@ class TestEoEvents
132 var obj = new Dummy.TestObject(); 132 var obj = new Dummy.TestObject();
133 Dummy.TestObject received_obj = null; 133 Dummy.TestObject received_obj = null;
134 134
135 obj.EvtWithObjEvt += (object sender, Dummy.TestObjectEvtWithObjEvt_Args e) => { 135 obj.EvtWithObjEvent += (object sender, Dummy.TestObjectEvtWithObjEventArgs e) => {
136 received_obj = e.arg; 136 received_obj = e.arg;
137 }; 137 };
138 138
@@ -148,7 +148,7 @@ class TestEoEvents
148 var obj = new Dummy.TestObject(); 148 var obj = new Dummy.TestObject();
149 Eina.Error received_error = 0; 149 Eina.Error received_error = 0;
150 150
151 obj.EvtWithErrorEvt += (object sender, Dummy.TestObjectEvtWithErrorEvt_Args e) => { 151 obj.EvtWithErrorEvent += (object sender, Dummy.TestObjectEvtWithErrorEventArgs e) => {
152 received_error = e.arg; 152 received_error = e.arg;
153 }; 153 };
154 154
@@ -164,7 +164,7 @@ class TestEoEvents
164 var obj = new Dummy.TestObject(); 164 var obj = new Dummy.TestObject();
165 Dummy.StructSimple received_struct = default(Dummy.StructSimple); 165 Dummy.StructSimple received_struct = default(Dummy.StructSimple);
166 166
167 obj.EvtWithStructEvt += (object sender, Dummy.TestObjectEvtWithStructEvt_Args e) => { 167 obj.EvtWithStructEvent += (object sender, Dummy.TestObjectEvtWithStructEventArgs e) => {
168 received_struct = e.arg; 168 received_struct = e.arg;
169 }; 169 };
170 170
@@ -181,7 +181,7 @@ class TestEoEvents
181 var obj = new Dummy.TestObject(); 181 var obj = new Dummy.TestObject();
182 Dummy.StructComplex received_struct = default(Dummy.StructComplex); 182 Dummy.StructComplex received_struct = default(Dummy.StructComplex);
183 183
184 obj.EvtWithStructComplexEvt += (object sender, Dummy.TestObjectEvtWithStructComplexEvt_Args e) => { 184 obj.EvtWithStructComplexEvent += (object sender, Dummy.TestObjectEvtWithStructComplexEventArgs e) => {
185 received_struct = e.arg; 185 received_struct = e.arg;
186 }; 186 };
187 187
@@ -202,7 +202,7 @@ class TestEoEvents
202 sent.Append("Def"); 202 sent.Append("Def");
203 sent.Append("Ghi"); 203 sent.Append("Ghi");
204 204
205 obj.EvtWithArrayEvt += (object sender, Dummy.TestObjectEvtWithArrayEvt_Args e) => { 205 obj.EvtWithArrayEvent += (object sender, Dummy.TestObjectEvtWithArrayEventArgs e) => {
206 received = e.arg; 206 received = e.arg;
207 }; 207 };
208 208
@@ -222,16 +222,16 @@ class TestEventAddRemove
222 var obj = new Dummy.TestObject(); 222 var obj = new Dummy.TestObject();
223 bool called = true; 223 bool called = true;
224 224
225 EventHandler<Dummy.TestObjectEvtWithIntEvt_Args> evtCb = (object sender, Dummy.TestObjectEvtWithIntEvt_Args e) => { 225 EventHandler<Dummy.TestObjectEvtWithIntEventArgs> evtCb = (object sender, Dummy.TestObjectEvtWithIntEventArgs e) => {
226 called = true; 226 called = true;
227 }; 227 };
228 228
229 obj.EvtWithIntEvt += evtCb; 229 obj.EvtWithIntEvent += evtCb;
230 obj.EmitEventWithInt(42); 230 obj.EmitEventWithInt(42);
231 Test.Assert(called); 231 Test.Assert(called);
232 232
233 called = false; 233 called = false;
234 obj.EvtWithIntEvt -= evtCb; 234 obj.EvtWithIntEvent -= evtCb;
235 obj.EmitEventWithInt(42); 235 obj.EmitEventWithInt(42);
236 Test.Assert(!called); 236 Test.Assert(!called);
237 } 237 }
@@ -248,7 +248,7 @@ class TestInterfaceEvents
248 called = true; 248 called = true;
249 }; 249 };
250 250
251 obj.NonconflictedEvt += cb; 251 obj.NonconflictedEvent += cb;
252 obj.EmitNonconflicted(); 252 obj.EmitNonconflicted();
253 Test.Assert(called); 253 Test.Assert(called);
254 } 254 }
@@ -266,7 +266,7 @@ class TestEventNaming
266 test_called = true; 266 test_called = true;
267 }; 267 };
268 268
269 obj.EvtWithUnderEvt += cb; 269 obj.EvtWithUnderEvent += cb;
270 270
271 obj.EmitEventWithUnder(); 271 obj.EmitEventWithUnder();
272 272
@@ -279,12 +279,12 @@ class TestEventWithDeadWrappers
279{ 279{
280 280
281 private static WeakReference AttachToManager(Dummy.EventManager manager, 281 private static WeakReference AttachToManager(Dummy.EventManager manager,
282 EventHandler<Dummy.TestObjectEvtWithIntEvt_Args> cb) 282 EventHandler<Dummy.TestObjectEvtWithIntEventArgs> cb)
283 { 283 {
284 var obj = new Dummy.TestObject(); 284 var obj = new Dummy.TestObject();
285 manager.Emitter = obj; 285 manager.Emitter = obj;
286 286
287 obj.EvtWithIntEvt += cb; 287 obj.EvtWithIntEvent += cb;
288 return new WeakReference(obj); 288 return new WeakReference(obj);
289 } 289 }
290 290
@@ -298,7 +298,7 @@ class TestEventWithDeadWrappers
298 int received = -1; 298 int received = -1;
299 299
300 // attach to evt with int 300 // attach to evt with int
301 EventHandler<Dummy.TestObjectEvtWithIntEvt_Args> cb = (object sender, Dummy.TestObjectEvtWithIntEvt_Args args) => { 301 EventHandler<Dummy.TestObjectEvtWithIntEventArgs> cb = (object sender, Dummy.TestObjectEvtWithIntEventArgs args) => {
302 callbackCalled = true; 302 callbackCalled = true;
303 received = args.arg; 303 received = args.arg;
304 Test.Assert(Object.ReferenceEquals(sender, wref.Target)); 304 Test.Assert(Object.ReferenceEquals(sender, wref.Target));
diff --git a/src/tests/efl_mono/Model.cs b/src/tests/efl_mono/Model.cs
index a43d9da..829accf 100644
--- a/src/tests/efl_mono/Model.cs
+++ b/src/tests/efl_mono/Model.cs
@@ -66,7 +66,7 @@ public class TestModel {
66 string propertyBound = null; 66 string propertyBound = null;
67 bool callbackCalled = false; 67 bool callbackCalled = false;
68 var factory = new Efl.Ui.ItemFactory<Efl.Ui.Button>(); 68 var factory = new Efl.Ui.ItemFactory<Efl.Ui.Button>();
69 factory.PropertyBoundEvt += (object sender, Efl.Ui.IPropertyBindPropertyBoundEvt_Args args) => { 69 factory.PropertyBoundEvent += (object sender, Efl.Ui.IPropertyBindPropertyBoundEventArgs args) => {
70 propertyBound = args.arg; 70 propertyBound = args.arg;
71 callbackCalled = true; 71 callbackCalled = true;
72 }; 72 };