Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_model_compile.c
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Adaptive Framework Model Compile
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
14 #include "afw_internal.h"
15 
16 
17 static const afw_object_t *
18 impl_compile_custom(
19  const afw_object_t *custom,
20  const afw_model_t *model,
21  afw_xctx_t *xctx);
22 
23 
24 static const afw_model_property_type_t *
25 impl_compile_property_type(
26  afw_model_object_type_t *object_type,
27  const afw_object_t *object,
28  const afw_utf8_t *property_name,
29  afw_xctx_t *xctx);
30 
31 
32 static const afw_model_object_type_t *
33 impl_object_type_compile(
34  afw_model_t *model,
35  const afw_utf8_t *adaptor_id,
36  const afw_utf8_t *object_type_id,
37  const afw_object_t *object,
38  afw_xctx_t *xctx);
39 
40 
41 static const afw_object_t *
42 impl_compile_custom(
43  const afw_object_t *custom,
44  const afw_model_t *model,
45  afw_xctx_t *xctx)
46 {
47  const afw_object_t *result;
48  const afw_iterator_t *iterator;
49  const afw_utf8_t *property_name;
50  const afw_utf8_t *s;
51  const afw_value_t *value;
52  const afw_utf8_t *source_location;
53  const afw_utf8_t *path;
54 
55  result = afw_object_create_managed(model->p, xctx);
56  path = afw_object_meta_get_path(custom, xctx);
57 
58  for (iterator = NULL;;) {
60  &iterator, &property_name, xctx);
61  if (!s) break;
62  source_location = afw_utf8_printf(model->p, xctx,
63  "%" AFW_UTF8_FMT "/custom/%" AFW_UTF8_FMT,
64  AFW_UTF8_FMT_ARG(path),
65  AFW_UTF8_FMT_ARG(property_name));
66  value = afw_compile_hybrid_source(s, source_location,
67  NULL, model->shared, NULL, xctx);
68  afw_object_set_property(result, property_name, value, xctx);
69  }
70 
71  return result;
72 }
73 
74 
75 
77 impl_compile_property_type(
78  afw_model_object_type_t *object_type,
79  const afw_object_t *object,
80  const afw_utf8_t *property_name,
81  afw_xctx_t *xctx)
82 {
83  const afw_model_t *model = object_type->model;
84  const afw_pool_t *p = model->p;
86  const afw_utf8_t *s;
87  const afw_object_t *custom;
88  const afw_utf8_t *source_location;
89  const afw_utf8_t *path;
90  afw_boolean_t b;
91  afw_boolean_t found;
92 
93  /* Allocate and initialize property type struct. */
95  pt->property_name = property_name;
97  property_name, p, xctx);
98  pt->property_type_object = object;
100  pt->property_type_object, p, xctx);
101  path = pt->property_type_path = afw_object_meta_get_path(object, xctx);
103  pt->property_type_path, p, xctx);
104 
105  /* dataType */
107  &afw_s_dataType, xctx);
108  if (s) {
110  if (!pt->data_type) {
111  AFW_THROW_ERROR_FZ(general, xctx,
112  "%" AFW_UTF8_FMT
113  "/dataType is invalid",
114  AFW_UTF8_FMT_ARG(path));
115  }
116  }
117 
118  /* constraint */
121  /* custom */
123  &afw_s_custom, xctx);
124  if (custom) {
125  pt->custom_variables = impl_compile_custom(
126  custom, model, xctx);
127  }
128 
129  /* allowQuery - default false */
131  &afw_s_allowQuery, &found, xctx);
132  pt->allow_query = found && b;
133 
134  /* allowRead - defaults to true */
136  &afw_s_allowRead, &found, xctx);
137  pt->allow_query = !found || b;
138 
139  /* allowWrite - default to true */
141  &afw_s_allowWrite, &found, xctx);
142  pt->allow_write = !found || b;
143 
144  /* required - default false */
146  &afw_s_required, &found, xctx);
147  pt->required = found && b;
148 
149  /* transitory - default false */
151  &afw_s_transitory, &found, xctx);
152  pt->transitory = found && b;
153 
154  /* unique - default false */
156  &afw_s_unique, &found, xctx);
157  pt->unique = found && b;
158 
159  /* defaultValue */
161  &afw_s_defaultValue, xctx);
162  if (s) {
163  source_location = afw_utf8_printf(p, xctx,
164  "%" AFW_UTF8_FMT "/defaultValue",
165  AFW_UTF8_FMT_ARG(path));
167  s,source_location, NULL, model->shared, NULL, xctx);
168  }
169 
170  /* mappedPropertyName */
172  &afw_s_mappedPropertyName, xctx);
173  if (!pt->mapped_property_name) {
175  }
177  pt->mapped_property_name, p, xctx);
178 
179  /* onGetProperty */
181  &afw_s_onGetProperty, xctx);
182  if (s) {
183  source_location = afw_utf8_printf(p, xctx,
184  "%" AFW_UTF8_FMT "/onGetProperty",
185  AFW_UTF8_FMT_ARG(path));
187  s, source_location, NULL, model->shared, NULL, xctx);
188  }
189 
190  /* onGetInitialValue */
192  &afw_s_onGetInitialValue, xctx);
193  if (s) {
194  source_location = afw_utf8_printf(p, xctx,
195  "%" AFW_UTF8_FMT "/onGetInitialValue",
196  AFW_UTF8_FMT_ARG(path));
198  s, source_location, NULL, model->shared, NULL, xctx);
199  }
200 
201  /* setProperty */
203  &afw_s_onSetProperty, xctx);
204  if (s) {
205  source_location = afw_utf8_printf(p, xctx,
206  "%" AFW_UTF8_FMT "/onSetProperty",
207  AFW_UTF8_FMT_ARG(path));
209  s, source_location, NULL, model->shared, NULL, xctx);
210  }
211 
212  /* Return property type struct. */
213  return pt;
214 }
215 
216 
217 static afw_boolean_t
218 impl_is_inherited(
219  const afw_object_t *object,
220  const afw_utf8_t *property_name,
221  afw_xctx_t *xctx)
222 {
223  afw_boolean_t result;
224  const afw_object_t *propertyTypes;
225  const afw_object_t *property;
226  const afw_value_t *inheritedFrom;
227 
228  result = false;
229  if (object->meta.meta_object) {
231  afw_object_meta_object(object), &afw_s_propertyTypes, xctx);
232  if (propertyTypes) {
234  propertyTypes, property_name, xctx);
235  if (property) {
236  inheritedFrom = afw_object_get_property(
237  property, &afw_s_inheritedFrom, xctx);
238  if (inheritedFrom) {
239  result = true;
240  }
241  }
242  }
243  }
244 
245  return result;
246 }
247 
248 
249 static void
250 impl_harvest_property_type(
251  const afw_object_t *embedding_object,
252  const afw_utf8_t *property_name,
253  afw_boolean_t composite,
254  const afw_object_t *object,
255  const afw_pool_t *p, afw_xctx_t *xctx)
256 {
257  const afw_object_t *result;
258  const afw_utf8_t *s;
259  const afw_value_t *value;
260 
262  embedding_object, property_name, xctx);
264  &afw_s__AdaptiveValueMeta_, xctx);
265 
266  /* additionalConstraints */
267  value = afw_object_get_property(object,
268  &afw_s_additionalConstraints, xctx);
269  if (value) {
271  &afw_s_additionalConstraints, value, xctx);
272  }
273 
274  /* allowQuery */
275  value = afw_object_get_property(object,
276  &afw_s_allowQuery, xctx);
277  if (value) {
279  &afw_s_allowQuery, value, xctx);
280  }
281 
282  /* allowWrite */
283  value = afw_object_get_property(object,
284  &afw_s_allowWrite, xctx);
285  if (value) {
287  &afw_s_allowWrite, value, xctx);
288  }
289 
290  /* collectionURIs */
292  &afw_s_collectionURIs, p, xctx);
293  if (s) {
295  &afw_s_collectionURIs, s, xctx);
296  }
297 
298  /* contextType */
300  &afw_s_contextType, p, xctx);
301  if (s) {
303  &afw_s_contextType, s, xctx);
304  }
305 
306  /* dataType */
308  &afw_s_dataType, p, xctx);
309  if (s) {
311  &afw_s_dataType, s, xctx);
312  }
313 
314  /* dataTypeParameter */
316  &afw_s_dataTypeParameter, p, xctx);
317  if (s) {
319  &afw_s_dataTypeParameter, s, xctx);
320  }
321 
322  /* description */
324  &afw_s_description, p, xctx);
325  if (s) {
327  &afw_s_description, s, xctx);
328  }
329 
330  /* label */
332  &afw_s_label, p, xctx);
333  if (s) {
335  &afw_s_label, s, xctx);
336  }
337 
338  /* originURI */
340  &afw_s_originURI, p, xctx);
341  if (s) {
343  &afw_s_originURI, s, xctx);
344  }
345 
346  /* referenceURI */
348  &afw_s_referenceURI, p, xctx);
349  if (s) {
351  &afw_s_referenceURI, s, xctx);
352  }
353 
354  /* required */
355  value = afw_object_get_property(object,
356  &afw_s_required, xctx);
357  if (value) {
359  &afw_s_required, value, xctx);
360  }
361 
362  /* testDataParameter */
364  &afw_s_testDataParameter, p, xctx);
365  if (s) {
367  &afw_s_testDataParameter, s, xctx);
368  }
369 
370  /* unique */
371  value = afw_object_get_property(object,
372  &afw_s_unique, xctx);
373  if (value) {
375  &afw_s_unique, value, xctx);
376  }
377 }
378 
379 
380 
381 static const afw_object_t *
382 impl_harvest_object_type(
383  afw_model_t *model,
384  afw_boolean_t composite,
385  const afw_utf8_t *adaptor_id,
386  const afw_utf8_t *object_type_id,
387  const afw_object_t *object,
388  const afw_pool_t *p, afw_xctx_t *xctx)
389 {
390  const afw_object_t *result;
391  const afw_utf8_t *s;
392  const afw_object_t *obj;
393  const afw_object_t *property_types;
394  const afw_object_t *propertyTypes;
395  const afw_utf8_t *property_name;
396  const afw_iterator_t *iterator;
397  const afw_value_list_t *from_parent_paths;
398  afw_value_list_t *to_parent_paths;
399  const afw_utf8_t *path;
400  afw_boolean_t flag;
401  afw_boolean_t found;
402  const afw_value_t *value;
403 
404  result = afw_object_create(p, xctx);
406  adaptor_id,
407  &afw_s__AdaptiveObjectType_,
408  object_type_id, xctx);
410  &afw_s_allowAdd, afw_value_false, xctx);
412  &afw_s_allowChange, afw_value_false, xctx);
414  &afw_s_allowDelete, afw_value_false, xctx);
415 
416  /* If object has resolvedParentPaths, use as parentPaths. */
417  value = afw_object_meta_get_property(object,
418  &afw_s_resolvedParentPaths, xctx);
419  if (value) {
420  AFW_VALUE_ASSERT_IS_DATA_TYPE(value, list, xctx);
421  from_parent_paths = (const afw_value_list_t *)value;
422  to_parent_paths = afw_value_allocate_list(p, xctx);
423  to_parent_paths->internal =
425  for (iterator = NULL;;) {
427  from_parent_paths->internal, &iterator, xctx);
428  if (!path) break;
429  if (afw_utf8_starts_with(path, model->objectType_path)) {
430  s = afw_utf8_printf(p, xctx,
431  "/*/_AdaptiveObjectType_/%" AFW_UTF8_FMT,
432  (int)(path->len - model->objectType_path->len),
433  (char *)(path->s + model->objectType_path->len));
434  afw_list_of_anyURI_add(to_parent_paths->internal, s, xctx);
435  }
436  else {
437  afw_list_of_anyURI_add(to_parent_paths->internal, path, xctx);
438  }
439  }
441  &afw_s_parentPaths, (const afw_value_t *)to_parent_paths, xctx);
442  }
443 
444  /* allowAdd */
446  &afw_s_allowAdd, &found, xctx);
447  if (found) {
449  &afw_s_allowAdd, afw_value_for_boolean(flag), xctx);
450  }
451 
452  /* allowChange */
454  &afw_s_allowChange, &found, xctx);
455  if (found) {
457  &afw_s_allowChange, afw_value_for_boolean(flag), xctx);
458  }
459 
460  /* allowDelete */
462  &afw_s_allowDelete, &found, xctx);
463  if (found) {
465  &afw_s_allowDelete, afw_value_for_boolean(flag), xctx);
466  }
467 
468  /* allowEntity */
470  &afw_s_allowEntity, &found, xctx);
471  if (found) {
473  &afw_s_allowEntity, afw_value_for_boolean(flag), xctx);
474  }
475 
476  /* collectionURIs */
478  &afw_s_collectionURIs, p, xctx);
479  if (s) {
481  &afw_s_collectionURIs, s, xctx);
482  }
483 
484  /* description */
486  &afw_s_description, p, xctx);
487  if (s) {
489  &afw_s_description, s, xctx);
490  }
491 
492  /* descriptionPropertyName */
494  &afw_s_descriptionPropertyName, p, xctx);
495  if (s) {
497  &afw_s_descriptionPropertyName, s, xctx);
498  }
499 
500  /* label */
502  &afw_s_label, p, xctx);
503  if (s) {
505  &afw_s_label, s, xctx);
506  }
507 
508  /* objectIdPropertyName */
510  &afw_s_objectIdPropertyName, p, xctx);
511  if (s) {
513  &afw_s_objectIdPropertyName, s, xctx);
514  }
515 
516  /* objectType */
518  &afw_s_objectType, object_type_id, xctx);
519 
520  /* originURI */
522  &afw_s_originURI, p, xctx);
523  if (s) {
525  &afw_s_originURI, s, xctx);
526  }
527 
528  /* otherProperties. */
530  &afw_s_otherProperties, xctx);
531  if (obj) {
532  impl_harvest_property_type(
533  result, &afw_s_otherProperties,
534  composite, obj, p, xctx);
535  }
536 
537  /* propertyTypes */
538  property_types = afw_object_old_get_property_as_object(object,
539  &afw_s_propertyTypes, xctx);
540  if (property_types) {
541 
542  /* Make new propertyTypes object. */
543  propertyTypes = afw_object_create_embedded(
544  result, &afw_s_propertyTypes, xctx);
546  &afw_s__AdaptivePropertyTypes_, xctx);
547 
548  /* If object has resolvedParentPaths, use as parentPaths. */
549  value = afw_object_meta_get_property(property_types,
550  &afw_s_resolvedParentPaths, xctx);
551  if (value) {
552  afw_object_meta_set_property(propertyTypes,
553  &afw_s_parentPaths, value, xctx);
554  }
555 
556  /* Add all properties that were not inherited. */
557  for (iterator = NULL;;) {
559  property_types, &iterator, &property_name, xctx);
560  if (!obj) break;
561  if (!impl_is_inherited(property_types, property_name, xctx)) {
562  impl_harvest_property_type(
563  propertyTypes, property_name,
564  composite, obj, p, xctx);
565  }
566  }
567  }
568 
569  /* referenceURI */
571  &afw_s_referenceURI, p, xctx);
572  if (s) {
574  &afw_s_referenceURI, s, xctx);
575  }
576 
577  /* Return result. */
578  return result;
579 }
580 
581 
583 impl_object_type_compile(
584  afw_model_t *model,
585  const afw_utf8_t *adaptor_id,
586  const afw_utf8_t *object_type_id,
587  const afw_object_t *object,
588  afw_xctx_t *xctx)
589 {
590  const afw_compile_shared_t *shared = model->shared;
591  const afw_pool_t *p = model->p;
593  const afw_object_t *properties;
594  const afw_iterator_t *iterator;
595  const afw_object_t *pt_object;
596  const afw_model_property_type_t * *pt;
597  const afw_utf8_t *property_name;
598  afw_size_t count;
599  const afw_object_t *custom;
600  const afw_utf8_t *path;
601  const afw_utf8_t *source_location;
602  const afw_utf8_t *s;
603 
604  /* Allocate afw_model_object_type_t and initialize. */
606  ot->model = model;
607  ot->object_type_object = impl_harvest_object_type(model, false,
608  adaptor_id, object_type_id, object,
609  p, xctx);
611  ot->object_type_object, p, xctx);
612  ot->object_type_path = afw_object_meta_get_path(object, xctx);
614  ot->object_type_path, p, xctx);
617  ot->object_type_id, p, xctx);
618  path = afw_object_meta_get_path(object, xctx);
619 
620  /* custom */
622  &afw_s_custom, xctx);
623  if (custom) {
624  ot->custom_variables = impl_compile_custom(
625  custom, model, xctx);
626  }
627 
628  /* Get path. */
629  path = afw_object_meta_get_path(object, xctx);
630 
631  /* onGetInitialObjectId */
633  &afw_s_onGetInitialObjectId, p, xctx);
634  if (s) {
635  source_location = afw_utf8_printf(p, xctx,
636  "%" AFW_UTF8_FMT "/onGetInitialObjectId",
637  AFW_UTF8_FMT_ARG(path));
639  source_location,
640  NULL, model->shared, NULL, xctx);
641  }
642 
643  /* mappedObjectType */
645  &afw_s_mappedObjectType, xctx);
646  if (ot->mapped_object_type_id_value) {
648  ot->mapped_object_type_id_value, xctx);
649  }
650  else {
653  }
654 
655  /* descriptionPropertyName */
657  &afw_s_descriptionPropertyName, xctx);
661  }
662 
663  /* objectIdPropertyName */
665  &afw_s_objectIdPropertyName, xctx);
669  }
670 
671  /* Count the number of properties. */
672  properties = afw_object_old_get_property_as_object(object,
673  &afw_s_propertyTypes, xctx);
674  count = 0;
675  if (properties) {
676  for (iterator = NULL;
678  properties, &iterator, &property_name, xctx));
679  count++);
680  }
681 
682  /* Create NULL terminated array of compiled property types. */
684  (count + 1) * sizeof(afw_model_property_type_t *),
685  xctx);
686  ot->property_type[count] = NULL;
687  if (properties) {
688  for (iterator = NULL,
689  pt = ot->property_type;
691  properties, &iterator, &property_name, xctx));
692  pt++)
693  {
694  *pt = impl_compile_property_type(
695  ot, pt_object, pt_object->meta.id, xctx);
696  }
697  }
698 
699  /* onAddObject */
701  &afw_s_onAddObject, p, xctx);
702  if (s) {
703  source_location = afw_utf8_printf(p, xctx,
704  "%" AFW_UTF8_FMT "/onAddObject",
705  AFW_UTF8_FMT_ARG(path));
707  s, source_location, NULL, shared, p, xctx);
708  }
709 
710  /* onDeleteObject */
712  &afw_s_onDeleteObject, p, xctx);
713  if (s) {
714  source_location = afw_utf8_printf(p, xctx,
715  "%" AFW_UTF8_FMT "/onDeleteObject",
716  AFW_UTF8_FMT_ARG(path));
718  s, source_location, NULL, shared, p, xctx);
719  }
720 
721  /* onGetObject */
723  &afw_s_onGetObject, p, xctx);
724  if (s) {
725  source_location = afw_utf8_printf(p, xctx,
726  "%" AFW_UTF8_FMT "/onGetObject",
727  AFW_UTF8_FMT_ARG(path));
729  s, source_location, NULL, shared, p, xctx);
730  }
731 
732  /* onModifyObject */
734  &afw_s_onModifyObject, p, xctx);
735  if (s) {
736  source_location = afw_utf8_printf(p, xctx,
737  "%" AFW_UTF8_FMT "/onModifyObject",
738  AFW_UTF8_FMT_ARG(path));
740  s, source_location, NULL, shared, p, xctx);
741  }
742 
743  /* onReplaceObject */
745  &afw_s_onReplaceObject, p, xctx);
746  if (s) {
747  source_location = afw_utf8_printf(p, xctx,
748  "%" AFW_UTF8_FMT "/onReplaceObject",
749  AFW_UTF8_FMT_ARG(path));
751  source_location, NULL, shared, p, xctx);
752  }
753 
754  /* onRetrieveObjects */
756  &afw_s_onRetrieveObjects, p, xctx);
757  if (s) {
758  source_location = afw_utf8_printf(p, xctx,
759  "%" AFW_UTF8_FMT "/onRetrieveObjects",
760  AFW_UTF8_FMT_ARG(path));
762  s, source_location, NULL, shared, p, xctx);
763  }
764 
765  /* Compile otherProperties, if it exists. */
766  pt_object = afw_object_old_get_property_as_object(object,
767  &afw_s_otherProperties, xctx);
768  if (pt_object) {
769  ot->property_type_other =
770  impl_compile_property_type(
771  ot, pt_object, pt_object->meta.id, xctx);
772  }
773 
774  /* Return object type struct. */
775  return ot;
776 }
777 
778 
779 
782  const afw_utf8_t *adaptor_id,
783  const afw_object_t *model_object,
784  const afw_pool_t *p, afw_xctx_t *xctx)
785 {
786  const afw_object_t *objectTypes;
787  const afw_iterator_t *iterator;
788  const afw_object_t *object_type;
789  const afw_model_object_type_t *model_object_type;
790  const afw_utf8_t *property_name;
791  afw_model_t *model;
792  const afw_utf8_t *path;
793  const afw_object_t *clone;
794  const afw_object_t *object;
795 
796  /* Allocate model and clone model_object to correct p. */
797  model = afw_pool_calloc_type(p, afw_model_t, xctx);
798  model->p = p;
799  model->shared = afw_compile_shared_create(p, xctx);
800 
801  /* Create composite view and clone it. */
802  clone = afw_object_create_clone(
803  model_object, p, xctx);
804  object = afw_object_view_create(clone, NULL,
806  p, xctx);
807  model->model_object = object;
808  model->model_id = afw_object_meta_get_object_id(model->model_object, xctx);
809  model->model_object_types = apr_hash_make(afw_pool_get_apr_pool(p));
810  path = afw_object_meta_get_path(object, xctx);
811  model->objectType_path = afw_utf8_printf(p, xctx,
812  "%" AFW_UTF8_FMT "/objectTypes/", AFW_UTF8_FMT_ARG(path));
813 
814  /* custom */
815  model->custom_variables = afw_object_old_get_property_as_object(object,
816  &afw_s_custom, xctx);
817  if (model->custom_variables) {
818  model->custom_variables = impl_compile_custom(
819  model->custom_variables, model, xctx);
820  }
821 
822  /* Get objectTypes property from model. */
824  model->model_object, &afw_s_objectTypes, xctx);
825  if (!objectTypes) {
826  AFW_THROW_ERROR_Z(general,
827  "Object model must have objectTypes property", xctx);
828  }
829 
830  /* Iterate compiling objectTypes and adding to object_types. */
831  for (iterator = NULL;;) {
833  objectTypes, &iterator, &property_name, xctx);
834  if (!object_type) break;
835  model_object_type = impl_object_type_compile(model,
836  adaptor_id, property_name, object_type, xctx);
837  apr_hash_set(model->model_object_types,
838  property_name->s, property_name->len, model_object_type);
839  }
840 
841  /* Return model. */
842  return model;
843 }
AFW_DEFINE(const afw_object_t *)
Adaptive Framework Core Internal.
afw_value_create_anyURI(const afw_utf8_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type anyURI value.
afw_data_type_anyURI
Data type struct for anyURI.
afw_list_of_anyURI_add(const afw_list_t *instance, const afw_utf8_t *value, afw_xctx_t *xctx)
Add value from list of anyURI.
afw_object_set_property_as_anyURI(const afw_object_t *object, const afw_utf8_t *property_name, const afw_utf8_t *internal, afw_xctx_t *xctx)
Set property function for data type anyURI values.
#define afw_object_old_get_property_as_boolean(object, property_name, found, xctx)
Get property function for data type boolean value.
afw_value_allocate_list(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for unmanaged data type list value.
#define afw_object_old_get_property_as_object(object, property_name, xctx)
Get property function for data type object value.
#define afw_object_old_get_next_property_as_object(object, iterator, property_name, xctx)
Get next property function for data type object value.
afw_value_create_object(const afw_object_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type object value.
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.
#define afw_object_old_get_property_as_string(object, property_name, xctx)
Get property function for data type string value.
#define afw_object_old_get_next_property_as_string(object, iterator, property_name, xctx)
Get next property function for data type string value.
afw_object_set_property_as_string(const afw_object_t *object, const afw_utf8_t *property_name, const afw_utf8_t *internal, afw_xctx_t *xctx)
Set property function for data type string values.
afw_value_as_string(const afw_value_t *value, afw_xctx_t *xctx)
Typesafe cast of data type string.
#define AFW_UTF8_FMT_ARG(A_STRING)
Convenience Macro for use with AFW_UTF8_FMT to specify arg.
Definition: afw_common.h:605
struct afw_iterator_s afw_iterator_t
_Bool afw_boolean_t
Definition: afw_common.h:373
struct afw_model_internal_s afw_model_t
#define AFW_UTF8_FMT
Format string specifier used for afw_utf8_t.
Definition: afw_common.h:588
apr_size_t afw_size_t
size_t.
Definition: afw_common.h:151
const afw_compile_shared_t * afw_compile_shared_create(const afw_pool_t *p, afw_xctx_t *xctx)
Created a struct for sharing resources by multiple compiles.
#define afw_compile_hybrid_source(string, source_location, parent, shared, p, xctx)
Compile hybrid.
Definition: afw_compile.h:256
const afw_data_type_t * afw_environment_get_data_type(const afw_utf8_t *type, afw_xctx_t *xctx)
Get the data_type associated with configuration entry type.
#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
afw_list_of_utf8_get_next(const afw_list_t *instance, const afw_iterator_t **iterator, afw_xctx_t *xctx)
Get next value from list whose data type cType is afw_utf8_t.
Definition: afw_list.c:19
#define afw_list_of_create(data_type, p, xctx)
Create an list of a specific data type in memory.
Definition: afw_list.h:64
afw_model_compile(const afw_utf8_t *adaptor_id, const afw_object_t *model_object, const afw_pool_t *p, afw_xctx_t *xctx)
Compile a model and add object types to associative array.
#define afw_object_get_property(instance, property_name, xctx)
Call method get_property of interface afw_object.
afw_object_meta_get_property_name(const afw_object_t *instance, afw_xctx_t *xctx)
Get object's property name in embedding object.
afw_object_meta_get_path(const afw_object_t *instance, afw_xctx_t *xctx)
Get an object's path.
afw_object_meta_set_object_type_id(const afw_object_t *instance, const afw_utf8_t *object_type_id, afw_xctx_t *xctx)
Set object's object type id.
#define afw_object_meta_get_property(instance, property_name, xctx)
Get a meta property.
#define afw_object_meta_object(instance)
Return meta object for an object or NULL if there is not one.
#define afw_object_meta_set_property(instance, property_name, value, xctx)
Set a property in the meta of an object.
afw_object_meta_set_ids(const afw_object_t *instance, const afw_utf8_t *adaptor_id, const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, afw_xctx_t *xctx)
Set object's ids.
afw_object_meta_get_object_id(const afw_object_t *instance, afw_xctx_t *xctx)
Get entity object's object id.
afw_object_options_composite_inheritedFrom_resolvedParentPaths
Object processing options - composite + inheritance related.
afw_object_view_create(const afw_object_t *instance, const afw_utf8_t *entity_path, const afw_object_options_t *options, const afw_pool_t *p, afw_xctx_t *xctx)
Create an object view of an object in specified pool.
afw_object_create_clone(const afw_object_t *object, const afw_pool_t *p, afw_xctx_t *xctx)
Clone an object to a specified pool.
Definition: afw_memory.c:138
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_create_managed(p, xctx)
Create an empty entity object in its own pool.
Definition: afw_object.h:913
#define afw_object_create(p, xctx)
Create an empty unmanaged object in memory.
Definition: afw_object.h:948
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
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.
#define afw_pool_malloc(instance, size, xctx)
Call method malloc of interface afw_pool.
#define afw_pool_get_apr_pool(instance)
Call method get_apr_pool of interface afw_pool.
#define afw_pool_calloc_type(instance, type, xctx)
Macro to allocate cleared memory to hold type in pool.
Definition: afw_pool.h:167
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_boolean_t afw_utf8_starts_with(const afw_utf8_t *string, const afw_utf8_t *starts_with)
Check to see if a string starts with another string.
afw_value_false
Adaptive value false.
Definition: afw_value.h:354
#define afw_value_for_boolean(variable)
Value for boolean variable.
Definition: afw_value.h:363
#define AFW_VALUE_ASSERT_IS_DATA_TYPE(A_VALUE, A_DATA_TYPE, A_SCOPE)
Throw and error if A_VALUE is not evaluated data type A_DATA_TYPE.
Definition: afw_value.h:768
Resources that can be shared by multiple compiles.
Struct for afw_model_object_type_t property_type_other member.
const afw_value_t * object_id_property_name_value
objectIdPropertyName value.
const afw_value_t * onGetObject
onGetObject or NULL.
const afw_utf8_t * object_type_id
Object type id.
const afw_model_property_type_t ** property_type
NULL terminated list of property types for this object type.
const afw_model_t * model
Model containing this object type.
const afw_value_t * mapped_object_type_id_value
mappedObjectType value.
const afw_value_t * description_property_name_value
descriptionPropertyName value.
const afw_object_t * object_type_object
Property type object.
const afw_value_t * object_type_path_value
Object type path value.
const afw_utf8_t * object_id_property_name
objectIdPropertyName.
const afw_utf8_t * object_type_path
Object type path.
const afw_value_t * onReplaceObject
onReplaceObject or NULL.
const afw_value_t * onGetInitialObjectId
onGetInitialObjectId or NULL.
const afw_value_t * onDeleteObject
onDeleteObject or NULL.
const afw_value_t * onAddObject
onAddObject or NULL.
const afw_value_t * object_type_object_value
Property type object value.
const afw_value_t * onModifyObject
onModifyObject or NULL.
const afw_value_t * onRetrieveObjects
onRetrieveObjects or NULL.
const afw_object_t * custom_variables
Custom variables.
const afw_model_property_type_t * property_type_other
Property type for other properties.
const afw_utf8_t * mapped_object_type_id
mapped object type.
const afw_utf8_t * description_property_name
descriptionPropertyName.
const afw_value_t * object_type_id_value
Object type id value.
const afw_value_t * onSetProperty
onSetProperty value or NULL if value from object used asis.
const afw_value_t * onGetProperty
onGetProperty value or NULL if value from object used asis.
afw_boolean_t allow_query
allowQuery.
const afw_value_t * onGetInitialValue
initial value or NULL if value from object used asis.
const afw_value_t * default_value
defaultValue or NULL.
const afw_value_t * property_name_value
Property name as adaptive value.
const afw_value_t * property_type_path_value
Property type path value.
const afw_utf8_t * property_name
Property name or regular expression if other.
const afw_data_type_t * data_type
Data type or NULL if not restricted.
const afw_utf8_t * property_type_path
Property type path.
const afw_utf8_t * mapped_property_name
Mapped property name.
const afw_object_t * custom_variables
constraint.
afw_boolean_t transitory
transitory.
const afw_object_t * property_type_object
Property type object.
const afw_value_t * mapped_property_name_value
Mapped property name as adaptive value.
const afw_value_t * property_type_object_value
Property type object value.
const afw_utf8_t * id
Object id or property name.
Definition: afw_common.h:782
const afw_object_t * meta_object
Meta object.
Definition: afw_common.h:761
Interface afw_object public struct.
Interface afw_pool public struct.
NFC normalized UTF-8 string.
Definition: afw_common.h:545
struct for data type list values.
Interface afw_value public struct.
Interface afw_xctx public struct.