Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_object.c
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Adaptive Framework interface helpers for afw_object*
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
14 #include "afw_internal.h"
15 
16 
17 /* Set an object to immutable if it is not already. */
18 AFW_DEFINE(void)
20  const afw_object_t *instance, afw_xctx_t *xctx)
21 {
22  const afw_object_setter_t *setter;
23 
24  setter = afw_object_get_setter(instance, xctx);
25 
26  /* If already immutable, ignore, otherwise; set immutable. */
27  if (setter) {
28  afw_object_setter_set_immutable(setter, xctx);
29  }
30 }
31 
32 
33 /* Remove a property from object. */
34 AFW_DEFINE(void)
36  const afw_object_t *instance,
37  const afw_utf8_t *property_name,
38  afw_xctx_t *xctx)
39 {
40  afw_object_set_property(instance, property_name, NULL, xctx);
41 }
42 
43 
44 /* Set the value of an object's property. */
45 AFW_DEFINE(void)
47  const afw_object_t *instance,
48  const afw_utf8_t *property_name,
49  const afw_value_t *value,
50  afw_xctx_t *xctx)
51 {
52  const afw_object_setter_t *setter;
53 
54  setter = afw_object_get_setter(instance, xctx);
55 
56  if (!setter) {
57  AFW_OBJECT_ERROR_OBJECT_IMMUTABLE;
58  }
59 
60  afw_object_setter_set_property(setter, property_name, value, xctx);
61 }
62 
63 
64 /* Set a date property from parts. */
65 AFW_DEFINE(void)
67  const afw_object_t *instance,
68  const afw_utf8_t *property_name,
69  int year,
70  int month,
71  int day,
72  int tz_hours_offset,
73  int tz_minutes_offset,
74  afw_xctx_t *xctx)
75 {
76  afw_value_date_t *value;
77 
78  value = afw_value_allocate_date(instance->p, xctx);
80  &value->internal,
81  year, month, day,
82  tz_hours_offset, tz_minutes_offset,
83  xctx);
84  afw_object_set_property(instance, property_name,
85  (const afw_value_t *)value, xctx);
86 }
87 
88 
89 /* Set a dateTime property from parts. */
90 AFW_DEFINE(void)
92  const afw_object_t *instance,
93  const afw_utf8_t *property_name,
94  int year,
95  int month,
96  int day,
97  int hour,
98  int minute,
99  int second,
100  int microsecond,
101  int tz_hours_offset,
102  int tz_minutes_offset,
103  afw_xctx_t *xctx)
104 {
105  afw_value_dateTime_t *value;
106 
107  value = afw_value_allocate_dateTime(instance->p, xctx);
109  &value->internal,
110  year, month, day,
111  hour, minute, second, microsecond,
112  tz_hours_offset, tz_minutes_offset,
113  xctx);
114  afw_object_set_property(instance, property_name,
115  (const afw_value_t *)value, xctx);
116 }
117 
118 
119 /* Set a dayTimeDuration property from parts. */
120 AFW_DEFINE(void)
122  const afw_object_t *instance,
123  const afw_utf8_t *property_name,
124  afw_boolean_t is_positive,
125  int days,
126  int hours,
127  int minutes,
128  int seconds,
129  int microseconds,
130  afw_xctx_t *xctx)
131 {
133 
134  value = afw_value_allocate_dayTimeDuration(instance->p, xctx);
136  &value->internal,
137  is_positive,
138  days, hours, minutes, seconds, microseconds, xctx);
139  afw_object_set_property(instance, property_name,
140  (const afw_value_t *)value, xctx);
141 }
142 
143 
144 /* Set a time property from parts. */
145 AFW_DEFINE(void)
147  const afw_object_t *instance,
148  const afw_utf8_t *property_name,
149  int hour,
150  int minute,
151  int second,
152  int microsecond,
153  int tz_hours_offset,
154  int tz_minutes_offset,
155  afw_xctx_t *xctx)
156 {
157  afw_value_time_t *value;
158 
159  value = afw_value_allocate_time(instance->p, xctx);
161  &value->internal,
162  hour, minute, second, microsecond,
163  tz_hours_offset, tz_minutes_offset,
164  xctx);
165  afw_object_set_property(instance, property_name,
166  (const afw_value_t *)value, xctx);
167 }
168 
169 
170 /* Set a yearMonthDuration property from parts. */
171 AFW_DEFINE(void)
173  const afw_object_t *instance,
174  const afw_utf8_t *property_name,
175  afw_boolean_t is_positive,
176  int years,
177  int months,
178  afw_xctx_t *xctx)
179 {
181 
182  value = afw_value_allocate_yearMonthDuration(instance->p, xctx);
184  &value->internal, is_positive,
185  years, months,
186  xctx);
187  afw_object_set_property(instance, property_name,
188  (const afw_value_t *)value, xctx);
189 }
190 
191 
192 /* Set an afw_value_string_t property from utf8_z. */
193 AFW_DEFINE(void)
195  const afw_object_t *instance,
196  const afw_utf8_t *property_name,
197  const afw_utf8_z_t *string_z,
198  afw_xctx_t *xctx)
199 {
200  afw_value_string_t *string;
201 
202  string = afw_value_allocate_string(instance->p, xctx);
203  string->internal.s = string_z;
204  string->internal.len = strlen(string_z);
205 
206  afw_object_set_property(instance,
207  property_name, (const afw_value_t *)string,
208  xctx);
209 }
210 
211 
212 
213 /* Compile a property value using specified compile type. */
214 AFW_DEFINE(const afw_value_t *)
216  const afw_object_t *instance,
217  const afw_utf8_t *property_name,
218  const afw_utf8_t *source_location,
219  afw_compile_type_t compile_type,
220  const afw_pool_t *p,
221  afw_xctx_t *xctx)
222 {
223  const afw_utf8_t *use_source_location;
224  const afw_value_t *result;
225  const afw_value_t *value;
226 
227  if (!source_location) {
228  use_source_location = afw_object_meta_get_path(instance, xctx);
229  if (!use_source_location) {
230  use_source_location = &afw_s_a_empty_string;
231  }
232  }
233  else {
234  use_source_location = source_location;
235  }
236  use_source_location = afw_utf8_printf(p, xctx,
237  "%" AFW_UTF8_FMT "/" "%" AFW_UTF8_FMT,
238  AFW_UTF8_FMT_ARG(use_source_location), AFW_UTF8_FMT_ARG(property_name));
239 
240  value = afw_object_get_property(instance, property_name, xctx);
241 
242  result = afw_value_compile_as(value,
243  use_source_location, compile_type, p, xctx);
244 
245  return result;
246 }
247 
248 
249 
250 /* Compile and evaluate a property value using specified compile type. */
251 AFW_DEFINE(const afw_value_t *)
253  const afw_object_t *instance,
254  const afw_utf8_t *property_name,
255  const afw_utf8_t *source_location,
256  afw_compile_type_t compile_type,
257  const afw_pool_t *p,
258  afw_xctx_t *xctx)
259 {
260  const afw_value_t *compiled_value;
261  const afw_value_t *result;
262 
263  compiled_value = afw_object_get_property_compile_as(
264  instance, property_name, source_location, compile_type, p, xctx);
265  result = afw_value_evaluate(compiled_value, p, xctx);
266 
267  return result;
268 }
269 
270 
271 
272 /* Get a property in an object's lineage. */
273 AFW_DEFINE(const afw_value_t *)
275  const afw_object_t *instance,
276  const afw_utf8_t *property_name_extended,
277  afw_xctx_t *xctx)
278 {
279  const afw_object_t *obj;
280  const afw_utf8_t *meta_value;
281  afw_utf8_t after_dot;
282  const afw_value_t *result;
283  afw_utf8_t meta_pn;
284  afw_utf8_t pn;
285 
287  if (!instance ||
288  !property_name_extended ||
289  property_name_extended->len == 0)
290  {
291  return NULL;
292  }
293 
294  /* Return property from object passed or an ancestor. */
295  obj = instance;
296  result = NULL;
297 
298  /* If the property name starts with _meta_, process accordingly. */
299  if (afw_utf8_starts_with_z(property_name_extended,
301  {
302  meta_value = NULL;
303  afw_utf8_substring_byte(&meta_pn, property_name_extended,
304  strlen(AFW_OBJECT_Q_PN_META "."), property_name_extended->len);
305  if (afw_utf8_equal_utf8_z(&meta_pn, "objectId")) {
306  meta_value = afw_object_meta_get_object_id(instance, xctx);
307  }
308  else if (afw_utf8_equal_utf8_z(&meta_pn, "objectType")) {
309  meta_value = afw_object_meta_get_object_type_id(instance, xctx);
310  }
311  else if (afw_utf8_equal_utf8_z(&meta_pn, "path")) {
312  meta_value = afw_object_meta_get_path(instance, xctx);
313  }
320  if (meta_value) {
321  result = afw_value_create_string(meta_value, xctx->p, xctx);
322  }
323  return result;
324  }
325 
326  /* Check for dotted property name. */
327  pn.s = property_name_extended->s;
328  pn.len = property_name_extended->len;
329 
330  for (after_dot.s = property_name_extended->s,
331  after_dot.len = property_name_extended->len;
332  after_dot.len > 0;
333  (after_dot.s)++, (after_dot.len)--)
334  {
336  if (*after_dot.s == '.') {
337  pn.len -= after_dot.len;
338  (after_dot.s)++;
339  (after_dot.len)--;
340  break;
341  }
342  }
343 
344 
345  /* Attempt to get property and return if error or found. */
346  result = afw_object_get_property(obj, &pn, xctx);
347  if (result) {
348 
349  /* If dotted name, process rest of name if it's object. */
350  if (after_dot.len > 0) {
351  if (afw_value_is_object(result)) {
353  ((afw_value_object_t *)result)->internal,
354  &after_dot, xctx);
355  }
356  }
357  }
358 
359  /* Return result. */
360  return result;
361 }
362 
363 
364 /*
365  * Return a NULL terminated list of values for an object property in a
366  * specified pool.
367  */
368 AFW_DEFINE(const afw_value_t * const *)
370  const afw_object_t *instance,
371  const afw_utf8_t *property_name,
372  const afw_pool_t *p, afw_xctx_t *xctx)
373 {
374  const afw_value_t *value;
375 
376  value = afw_object_get_property(instance, property_name, xctx);
377 
378  return afw_value_as_array_of_values(value, p, xctx);
379 }
380 
381 
382 /*
383  * Return a NULL terminated list of strings for an object property in a
384  * specified pool.
385  */
386 AFW_DEFINE(const afw_utf8_t * const *)
388  const afw_object_t *instance, const afw_utf8_t *property_name,
389  const afw_pool_t *p, afw_xctx_t *xctx)
390 {
391  const afw_value_t *value;
392 
393  value = afw_object_get_property(instance, property_name, xctx);
394 
395  return afw_value_as_array_of_utf8(value, p, xctx);;
396 }
397 
398 
399 
400 /* Return a compiled hybrid property value. */
401 AFW_DEFINE(const afw_value_t *)
403  const afw_object_t *instance,
404  const afw_utf8_t *property_name,
405  const afw_utf8_t *source_location,
406  const afw_compile_shared_t *shared,
407  const afw_pool_t *p, afw_xctx_t *xctx)
408 {
409  const afw_value_t *result;
410 
411  /* Get value. Return NULL if it isn't present. */
412  result = afw_object_get_property(instance, property_name, xctx);
413  if (!result) {
414  return NULL;
415  }
416 
417  /* Only evaluated values are supported. */
418  if (!afw_value_is_defined_and_evaluated(result)) {
419  AFW_THROW_ERROR_FZ(general, xctx,
420  "%" AFW_UTF8_FMT " %" AFW_UTF8_FMT
421  " is not an evaluated value",
422  AFW_UTF8_FMT_OPTIONAL_ARG(source_location),
423  AFW_UTF8_FMT_ARG(property_name));
424  }
425 
426  result = afw_compile_hybrid(result,
427  source_location, NULL, shared, p, xctx);
428 
429  return result;
430 }
431 
432 
433 
434 /* Get an object's property value including ancestors as a boolean. */
437  const afw_object_t *instance,
438  const afw_utf8_t *property_name,
439  afw_xctx_t *xctx)
440 {
441  const afw_utf8_t *string;
442  const afw_value_t *value;
443  afw_boolean_t result;
444 
445  result = AFW_FALSE;
446  value = afw_object_get_property(instance, property_name, xctx);
447  if (value) {
448  value = afw_value_evaluate(value, xctx->p, xctx);
449  if (afw_value_is_boolean(value)) {
450  result = ((const afw_value_boolean_t *)value)->internal;
451  }
452  else {
453  string = afw_value_as_utf8(value, xctx->p, xctx);
454 
455  if (
456  afw_utf8_compare_ignore_case(string, &afw_s_true, xctx) == 0 ||
457  (string->len == 1 &&
458  (
459  *string->s == 't' ||
460  *string->s == 'T' ||
461  *string->s == '1')
462  )
463  )
464  {
465  result = AFW_TRUE;
466  }
467 
468  else if (
469  afw_utf8_compare_ignore_case(string, &afw_s_false, xctx)== 0 ||
470  (string->len == 1 &&
471  (
472  *string->s == 'f' ||
473  *string->s == 'F' ||
474  *string->s == '0')
475  )
476  )
477  {
478  result = AFW_FALSE;
479  }
480 
481  else
482  {
483  AFW_THROW_ERROR_Z(general, "Boolean must be true or false",
484  xctx);
485  }
486  }
487  }
488 
489  return result;
490 }
491 
492 
493 /* Get an object's property value as an integer. */
496  const afw_object_t *instance,
497  const afw_utf8_t *property_name,
498  afw_boolean_t *found,
499  afw_xctx_t *xctx)
500 {
501  const afw_value_t *value;
502  afw_integer_t result = 0;
503 
504  *found = false;
505  value = afw_object_get_property(instance, property_name, xctx);
506  if (value) {
507  if (afw_value_is_integer(value)) {
508  *found = true;
509  result = ((afw_value_integer_t *)value)->internal;
510  }
511  else {
512  value = afw_value_convert(value,
513  afw_data_type_integer, false, xctx->p, xctx);
514  if (value) {
515  result = ((afw_value_integer_t *)value)->internal;
516  *found = true;
517  }
518  }
519  }
520 
521  return result;
522 }
523 
524 
525 
526 /*
527  * Get an object's property value including ancestors as a string in specified
528  * pool.
529  */
530 AFW_DEFINE(const afw_utf8_t *)
532  const afw_object_t *instance,
533  const afw_utf8_t *property_name,
534  const afw_pool_t *p,
535  afw_xctx_t *xctx)
536 {
537  const afw_value_t *value;
538  const afw_utf8_t *string;
539 
540  string = NULL;
541  value = afw_object_get_property(instance, property_name, xctx);
542  if (value) {
543  value = afw_value_evaluate(value, p, xctx);
544  string = afw_value_as_utf8(value, p, xctx);
545  }
546  return string;
547 }
548 
549 
550 /*
551  * Get an object's property value including ancestors as a utf8_z in specified
552  * pool.
553  */
554 AFW_DEFINE(const afw_utf8_z_t *)
556  const afw_object_t *instance,
557  const afw_utf8_t *property_name,
558  const afw_pool_t *p,
559  afw_xctx_t *xctx)
560 {
561  const afw_value_t *value;
562  const afw_utf8_z_t *utf8_z;
563 
564  utf8_z = NULL;
565  value = afw_object_get_property(instance, property_name, xctx);
566  if (value) {
567  utf8_z = afw_value_as_utf8_z(value, p, xctx);
568  }
569  return utf8_z;
570 }
571 
572 
573 
574 /* Merge properties from one object into another. */
575 AFW_DEFINE(void)
577  const afw_object_t *instance,
578  const afw_object_t *from,
579  afw_boolean_t replace,
580  afw_xctx_t *xctx)
581 {
582  const afw_iterator_t *iterator;
583  const afw_value_t *value;
584  const afw_value_t *from_value;
585  const afw_utf8_t *property_name;
586  const afw_object_t *embedded_object;
587 
588  iterator = NULL;
589  while ( (from_value = afw_object_get_next_property(
590  from, &iterator, &property_name, xctx)) )
591  {
592  value = afw_object_get_property(instance, property_name, xctx);
593  if (!value)
594  {
595  if (afw_value_is_object(from_value)) {
596  embedded_object = afw_object_create_embedded(instance,
597  property_name, xctx);
598  afw_object_merge(embedded_object,
599  ((const afw_value_object_t *)from_value)->internal,
600  replace, xctx);
601  } else {
602  afw_object_set_property(instance, property_name, from_value, xctx);
603  }
604  }
605 
606  else if (afw_value_is_object(from_value) &&
607  afw_value_is_object(value))
608  {
610  ((const afw_value_object_t *)value)->internal,
611  ((const afw_value_object_t *)from_value)->internal,
612  replace, xctx);
613  }
614  else if (replace)
615  {
616  afw_object_set_property(instance, property_name, from_value, xctx);
617  }
618  }
619 }
620 
621 
622 /* Count the number of properties in an object. */
625  const afw_object_t *object,
626  afw_xctx_t *xctx)
627 {
628  afw_size_t result;
629  const afw_iterator_t *iterator;
630  const afw_utf8_t *property_name;
631 
632  iterator = NULL;
633  result = 0;
634  while (afw_object_get_next_property(object,
635  &iterator, &property_name, xctx))
636  {
637  result++;
638  }
639 
640  return result;
641 }
AFW_DEFINE(const afw_object_t *)
Adaptive Framework Core Internal.
#define afw_value_is_boolean(A_VALUE)
Macro to determine if value is evaluated boolean.
afw_value_allocate_date(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for unmanaged data type date value.
afw_value_allocate_dateTime(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for unmanaged data type dateTime value.
afw_value_allocate_dayTimeDuration(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for unmanaged data type dayTimeDuration value.
#define afw_value_is_integer(A_VALUE)
Macro to determine if value is evaluated integer.
afw_data_type_integer
Data type struct for integer.
#define afw_value_is_object(A_VALUE)
Macro to determine if value is evaluated object.
afw_value_create_string(const afw_utf8_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type string value.
afw_value_allocate_string(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for unmanaged data type string value.
afw_value_allocate_time(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for unmanaged data type time value.
afw_value_allocate_yearMonthDuration(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for unmanaged data type yearMonthDuration value.
#define AFW_UTF8_FMT_ARG(A_STRING)
Convenience Macro for use with AFW_UTF8_FMT to specify arg.
Definition: afw_common.h:605
#define AFW_FALSE
Definition: afw_common.h:392
struct afw_iterator_s afw_iterator_t
#define AFW_UTF8_FMT_OPTIONAL_ARG(A_STRING)
Convenience Macro for use with AFW_UTF8_FMT to specify optional arg.
Definition: afw_common.h:616
#define AFW_TRUE
Definition: afw_common.h:383
_Bool afw_boolean_t
Definition: afw_common.h:373
#define AFW_UTF8_FMT
Format string specifier used for afw_utf8_t.
Definition: afw_common.h:588
afw_utf8_octet_t afw_utf8_z_t
NFC normalized UTF-8 null terminated string.
Definition: afw_common.h:523
enum afw_compile_type_e afw_compile_type_t
Compile type enum.
apr_size_t afw_size_t
size_t.
Definition: afw_common.h:151
apr_int64_t afw_integer_t
typedef for big signed int.
Definition: afw_common.h:321
afw_compile_hybrid(const afw_value_t *value, const afw_utf8_t *source_location, const afw_value_compiled_value_t *parent, const afw_compile_shared_t *shared, const afw_pool_t *p, afw_xctx_t *xctx)
Compile hybrid.
Definition: afw_compile.c:385
#define AFW_THROW_ERROR_FZ(code, xctx, format_z,...)
Macro used to set error and 0 rv in xctx and throw it.
Definition: afw_error.h:319
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
Definition: afw_error.h:283
#define afw_object_get_property(instance, property_name, xctx)
Call method get_property of interface afw_object.
#define afw_object_get_next_property(instance, iterator, property_name, xctx)
Call method get_next_property of interface afw_object.
#define afw_object_get_setter(instance, xctx)
Call method get_setter of interface afw_object.
#define afw_object_meta_get_object_type_id(instance, xctx)
Get object's object_type_id.
afw_object_meta_get_path(const afw_object_t *instance, afw_xctx_t *xctx)
Get an object's path.
afw_object_meta_get_object_id(const afw_object_t *instance, afw_xctx_t *xctx)
Get entity object's object id.
#define afw_object_setter_set_property(instance, property_name, value, xctx)
Call method set_property of interface afw_object_setter.
#define afw_object_setter_set_immutable(instance, xctx)
Call method set_immutable of interface afw_object_setter.
afw_object_set_property_as_date_from_parts(const afw_object_t *instance, const afw_utf8_t *property_name, int year, int month, int day, int tz_hours_offset, int tz_minutes_offset, afw_xctx_t *xctx)
Set a date property from parts.
Definition: afw_object.c:66
afw_object_remove_property(const afw_object_t *instance, const afw_utf8_t *property_name, afw_xctx_t *xctx)
Remove a property from object.
Definition: afw_object.c:35
afw_object_old_get_property_as_utf8_z(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_pool_t *p, afw_xctx_t *xctx)
Get an object's property value including ancestors as utf8_z in specified pool.
Definition: afw_object.c:555
afw_object_set_property_as_dayTimeDuration_from_parts(const afw_object_t *instance, const afw_utf8_t *property_name, afw_boolean_t is_positive, int days, int hours, int minutes, int seconds, int microseconds, afw_xctx_t *xctx)
Set a dayTimeDuration property from parts.
Definition: afw_object.c:121
afw_object_get_property_extended(const afw_object_t *instance, const afw_utf8_t *property_name_extended, afw_xctx_t *xctx)
Get the value of an object's own property or embedded property.
Definition: afw_object.c:274
afw_object_old_get_property_as_utf8(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_pool_t *p, afw_xctx_t *xctx)
Get an object's property value as a string in specified pool.
Definition: afw_object.c:531
#define AFW_OBJECT_Q_PN_META
Quoted pseudo meta property name.
Definition: afw_object.h:78
afw_object_old_get_property_as_integer_deprecated(const afw_object_t *instance, const afw_utf8_t *property_name, afw_boolean_t *found, afw_xctx_t *xctx)
Get an object's property value as an integer.
Definition: afw_object.c:495
afw_object_merge(const afw_object_t *instance, const afw_object_t *from, afw_boolean_t replace, afw_xctx_t *xctx)
Merge properties from one object into another.
Definition: afw_object.c:576
afw_object_set_property_as_dateTime_from_parts(const afw_object_t *instance, const afw_utf8_t *property_name, int year, int month, int day, int hour, int minute, int second, int microsecond, int tz_hours_offset, int tz_minutes_offset, afw_xctx_t *xctx)
Set a dateTime property from parts.
Definition: afw_object.c:91
afw_object_old_get_property_as_array_of_strings(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_pool_t *p, afw_xctx_t *xctx)
Return a NULL terminated list of strings for an object property in a specified pool.
Definition: afw_object.c:387
afw_object_set_property_as_time_from_parts(const afw_object_t *instance, const afw_utf8_t *property_name, int hour, int minute, int second, int microsecond, int tz_hours_offset, int tz_minutes_offset, afw_xctx_t *xctx)
Set a time property from parts.
Definition: afw_object.c:146
afw_object_old_get_property_as_array_of_values(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_pool_t *p, afw_xctx_t *xctx)
Return a NULL terminated list of values for an object property in a specified pool.
Definition: afw_object.c:369
afw_object_get_property_compile_as(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_utf8_t *source_location, afw_compile_type_t compile_type, const afw_pool_t *p, afw_xctx_t *xctx)
Compile a property value using specified compile type.
Definition: afw_object.c:215
afw_object_old_get_property_as_boolean_deprecated(const afw_object_t *instance, const afw_utf8_t *property_name, afw_xctx_t *xctx)
Get an object's property value as a boolean.
Definition: afw_object.c:436
afw_object_set_property_as_yearMonthDuration_from_parts(const afw_object_t *instance, const afw_utf8_t *property_name, afw_boolean_t is_positive, int years, int months, afw_xctx_t *xctx)
Set a yearMonthDuration property from parts.
Definition: afw_object.c:172
afw_object_set_property_as_string_from_utf8_z(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_utf8_z_t *string_z, afw_xctx_t *xctx)
Set an string property from utf8_z.
Definition: afw_object.c:194
afw_object_old_get_property_as_compiled_hybrid(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_utf8_t *source_location, const afw_compile_shared_t *shared, const afw_pool_t *p, afw_xctx_t *xctx)
Return a compiled hybrid property value.
Definition: afw_object.c:402
afw_object_set_property(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_value_t *value, afw_xctx_t *xctx)
Set the value of an object's property.
Definition: afw_object.c:46
afw_object_property_count(const afw_object_t *object, afw_xctx_t *xctx)
Count the number of properties in an object.
Definition: afw_object.c:624
afw_object_get_property_compile_and_evaluate_as(const afw_object_t *instance, const afw_utf8_t *property_name, const afw_utf8_t *source_location, afw_compile_type_t compile_type, const afw_pool_t *p, afw_xctx_t *xctx)
Compile and evaluate a property value using specified compile type.
Definition: afw_object.c:252
afw_object_set_immutable(const afw_object_t *instance, afw_xctx_t *xctx)
Set an object to immutable if it is not already.
Definition: afw_object.c:19
const afw_object_t * afw_object_create_embedded(const afw_object_t *embedding_object, const afw_utf8_t *property_name, afw_xctx_t *xctx)
Create an empty embedded object in a memory object.
afw_dateTime_set_from_parts(afw_dateTime_t *dateTime, int year, int month, int day, int hour, int minute, int second, int microsecond, int tz_hours_offset, int tz_minutes_offset, afw_xctx_t *xctx)
Set afw_dateTime_t from parts.
Definition: afw_time.c:244
afw_dayTimeDuration_set_from_parts(afw_dayTimeDuration_t *dayTimeDuration, afw_boolean_t is_positive, int days, int hours, int minutes, int seconds, int microseconds, afw_xctx_t *xctx)
Set afw_dayTimeDuration_t from parts.
Definition: afw_time.c:340
afw_date_set_from_parts(afw_date_t *date, int year, int month, int day, int tz_hours_offset, int tz_minutes_offset, afw_xctx_t *xctx)
Set afw_date_t from parts.
Definition: afw_time.c:197
afw_yearMonthDuration_set_from_parts(afw_yearMonthDuration_t *yearMonthDuration, afw_boolean_t is_positive, int years, int months, afw_xctx_t *xctx)
Set afw_yearMonthDuration_t from parts.
Definition: afw_time.c:471
afw_time_set_from_parts(afw_time_t *time, int hour, int minute, int second, int microsecond, int tz_hours_offset, int tz_minutes_offset, afw_xctx_t *xctx)
Set afw_time_t from parts.
Definition: afw_time.c:425
afw_boolean_t afw_utf8_equal_utf8_z(const afw_utf8_t *s1, const afw_utf8_z_t *s2_z)
Check to see if a string equals a utf8_z string.
afw_boolean_t afw_utf8_starts_with_z(const afw_utf8_t *string, const afw_utf8_z_t *starts_with_z)
Check to see if a string starts with a utf8_z string.
int afw_utf8_compare_ignore_case(const afw_utf8_t *s1, const afw_utf8_t *s2, afw_xctx_t *xctx)
Compare two strings ignoring case.
void afw_utf8_substring_byte(afw_utf8_t *result, const afw_utf8_t *string, afw_size_t start, afw_size_t end)
Set result to a substring of string using byte indexes.
Definition: afw_utf8.h:694
afw_utf8_printf(const afw_pool_t *p, afw_xctx_t *xctx, const afw_utf8_z_t *format,...)
Create a utf-8 string using a c format string in specified pool.
Definition: afw_utf8.c:459
afw_value_as_array_of_utf8(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Return a NULL terminated list of utf8 in a specified pool.
Definition: afw_value.c:827
#define afw_value_evaluate(value, p, xctx)
Evaluate value if needed using specific pool.
Definition: afw_value.h:841
afw_value_compile_as(const afw_value_t *value, const afw_utf8_t *source_location, afw_compile_type_t compile_type, const afw_pool_t *p, afw_xctx_t *xctx)
Compile a value using specified compile type.
Definition: afw_value.c:104
afw_value_as_utf8(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Definition: afw_value.c:456
afw_value_as_utf8_z(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Definition: afw_value.c:315
#define afw_value_is_defined_and_evaluated(A_VALUE)
Macro to determine if value is defined and evaluated.
Definition: afw_value.h:481
afw_value_convert(const afw_value_t *value, const afw_data_type_t *to_data_type, afw_boolean_t required, const afw_pool_t *p, afw_xctx_t *xctx)
Convert a value to a value/data type.
Definition: afw_value.c:584
afw_value_as_array_of_values(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Return a NULL terminated list of values in a specified pool.
Definition: afw_value.c:817
Resources that can be shared by multiple compiles.
Interface afw_object public struct.
Interface afw_object_setter public struct.
Interface afw_pool public struct.
NFC normalized UTF-8 string.
Definition: afw_common.h:545
struct for data type boolean values.
struct for data type date values.
struct for data type dateTime values.
struct for data type dayTimeDuration values.
struct for data type integer values.
struct for data type object values.
Interface afw_value public struct.
struct for data type string values.
struct for data type time values.
struct for data type yearMonthDuration values.
Interface afw_xctx public struct.