summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-08-23 17:29:31 -0300
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-08-23 18:32:13 -0300
commitc158d5c17a93ba75013b340dd092441631c785e6 (patch)
tree0cb5ddf9b2be7ab790939fd20085ffce0bf3e6a7
parent39acaab5e9d5b49c7f87c529bab0eae5e1d5a3a7 (diff)
eina_value_util: add missing eina_value_*_new() for basic types.
make all basic types available as _new() helpers.
-rw-r--r--src/lib/eina/eina_inline_value_util.x176
1 files changed, 176 insertions, 0 deletions
diff --git a/src/lib/eina/eina_inline_value_util.x b/src/lib/eina/eina_inline_value_util.x
index 2d5c264442..f863fd56cc 100644
--- a/src/lib/eina/eina_inline_value_util.x
+++ b/src/lib/eina/eina_inline_value_util.x
@@ -129,6 +129,118 @@ eina_value_type_offset(const Eina_Value_Type *type, unsigned int base)
129 129
130/** 130/**
131 * @brief Create a new #Eina_Value containing the passed parameter 131 * @brief Create a new #Eina_Value containing the passed parameter
132 * @param c The value to use
133 * @return The #Eina_Value
134 * @since 1.21
135 */
136static inline Eina_Value *
137eina_value_uchar_new(unsigned char c)
138{
139 Eina_Value *v;
140
141 v = eina_value_new(EINA_VALUE_TYPE_UCHAR);
142 if (v) eina_value_set(v, c);
143 return v;
144}
145
146/**
147 * @brief Create a new #Eina_Value containing the passed parameter
148 * @param s The value to use
149 * @return The #Eina_Value
150 * @since 1.21
151 */
152static inline Eina_Value *
153eina_value_ushort_new(unsigned short s)
154{
155 Eina_Value *v;
156
157 v = eina_value_new(EINA_VALUE_TYPE_USHORT);
158 if (v) eina_value_set(v, s);
159 return v;
160}
161
162/**
163 * @brief Create a new #Eina_Value containing the passed parameter
164 * @param i The value to use
165 * @return The #Eina_Value
166 * @since 1.21
167 */
168static inline Eina_Value *
169eina_value_uint_new(unsigned int i)
170{
171 Eina_Value *v;
172
173 v = eina_value_new(EINA_VALUE_TYPE_UINT);
174 if (v) eina_value_set(v, i);
175 return v;
176}
177
178/**
179 * @brief Create a new #Eina_Value containing the passed parameter
180 * @param l The value to use
181 * @return The #Eina_Value
182 * @since 1.21
183 */
184static inline Eina_Value *
185eina_value_ulong_new(unsigned long l)
186{
187 Eina_Value *v;
188
189 v = eina_value_new(EINA_VALUE_TYPE_ULONG);
190 if (v) eina_value_set(v, l);
191 return v;
192}
193
194/**
195 * @brief Create a new #Eina_Value containing the passed parameter
196 * @param i The value to use
197 * @return The #Eina_Value
198 * @since 1.21
199 */
200static inline Eina_Value *
201eina_value_uint64_new(uint64_t i)
202{
203 Eina_Value *v;
204
205 v = eina_value_new(EINA_VALUE_TYPE_UINT64);
206 if (v) eina_value_set(v, i);
207 return v;
208}
209
210/**
211 * @brief Create a new #Eina_Value containing the passed parameter
212 * @param c The value to use
213 * @return The #Eina_Value
214 * @since 1.21
215 */
216static inline Eina_Value *
217eina_value_char_new(char c)
218{
219 Eina_Value *v;
220
221 v = eina_value_new(EINA_VALUE_TYPE_CHAR);
222 if (v) eina_value_set(v, c);
223 return v;
224}
225
226/**
227 * @brief Create a new #Eina_Value containing the passed parameter
228 * @param s The value to use
229 * @return The #Eina_Value
230 * @since 1.21
231 */
232static inline Eina_Value *
233eina_value_short_new(short s)
234{
235 Eina_Value *v;
236
237 v = eina_value_new(EINA_VALUE_TYPE_SHORT);
238 if (v) eina_value_set(v, s);
239 return v;
240}
241
242/**
243 * @brief Create a new #Eina_Value containing the passed parameter
132 * @param i The value to use 244 * @param i The value to use
133 * @return The #Eina_Value 245 * @return The #Eina_Value
134 * @since 1.21 246 * @since 1.21
@@ -145,6 +257,54 @@ eina_value_int_new(int i)
145 257
146/** 258/**
147 * @brief Create a new #Eina_Value containing the passed parameter 259 * @brief Create a new #Eina_Value containing the passed parameter
260 * @param l The value to use
261 * @return The #Eina_Value
262 * @since 1.21
263 */
264static inline Eina_Value *
265eina_value_long_new(long l)
266{
267 Eina_Value *v;
268
269 v = eina_value_new(EINA_VALUE_TYPE_LONG);
270 if (v) eina_value_set(v, l);
271 return v;
272}
273
274/**
275 * @brief Create a new #Eina_Value containing the passed parameter
276 * @param i The value to use
277 * @return The #Eina_Value
278 * @since 1.21
279 */
280static inline Eina_Value *
281eina_value_int64_new(int64_t i)
282{
283 Eina_Value *v;
284
285 v = eina_value_new(EINA_VALUE_TYPE_INT64);
286 if (v) eina_value_set(v, i);
287 return v;
288}
289
290/**
291 * @brief Create a new #Eina_Value containing the passed parameter
292 * @param f The value to use
293 * @return The #Eina_Value
294 * @since 1.21
295 */
296static inline Eina_Value *
297eina_value_float_new(float f)
298{
299 Eina_Value *v;
300
301 v = eina_value_new(EINA_VALUE_TYPE_FLOAT);
302 if (v) eina_value_set(v, f);
303 return v;
304}
305
306/**
307 * @brief Create a new #Eina_Value containing the passed parameter
148 * @param d The value to use 308 * @param d The value to use
149 * @return The #Eina_Value 309 * @return The #Eina_Value
150 * @since 1.21 310 * @since 1.21
@@ -225,6 +385,22 @@ eina_value_time_new(time_t t)
225 385
226/** 386/**
227 * @brief Create a new #Eina_Value containing the passed parameter 387 * @brief Create a new #Eina_Value containing the passed parameter
388 * @param err The error code
389 * @return The #Eina_Value
390 * @since 1.21
391 */
392static inline Eina_Value *
393eina_value_error_new(Eina_Error err)
394{
395 Eina_Value *v;
396
397 v = eina_value_new(EINA_VALUE_TYPE_ERROR);
398 if (v) eina_value_set(v, err);
399 return v;
400}
401
402/**
403 * @brief Create a new #Eina_Value containing the passed parameter
228 * @param val The value to use 404 * @param val The value to use
229 * @return The #Eina_Value 405 * @return The #Eina_Value
230 * @since 1.21 406 * @since 1.21