18 impl_state_slash_before_adaptor_id,
19 impl_state_adaptor_id,
20 impl_state_after_adaptor_id,
21 impl_state_object_type_id,
22 impl_state_after_object_type_id,
23 impl_state_option_name,
24 impl_state_after_option_name,
25 impl_state_option_value,
26 impl_state_after_option_value,
27 impl_state_entity_object_id,
28 impl_state_entity_object_id_possible_second_asterisk,
29 impl_state_property_name,
30 impl_state_property_name_slash_or_end,
37 impl_set_result_paths(
48 if (parsed->adaptor_id.len == 0 ||
49 parsed->object_type_id.len == 0 ||
50 parsed->entity_object_id.len == 0)
61 AFW_URI_OCTET_UNRESERVED, xctx) +
63 AFW_URI_OCTET_UNRESERVED, xctx) +
65 AFW_URI_OCTET_UNRESERVED, xctx);
66 parsed->entity_path.len = path_len;
67 for (name = parsed->first_property_name; name; name = name->next) {
68 path_len += name->property_name.len + 1 ;
70 parsed->normalized_path.len = path_len;
74 parsed->normalized_path.s = s;
75 parsed->entity_path.s = s;
80 AFW_URI_OCTET_UNRESERVED, p, xctx);
87 AFW_URI_OCTET_UNRESERVED, p, xctx);
93 parsed->undecoded_object_id.s = s;
94 parsed->undecoded_object_id.len = path_len;
96 AFW_URI_OCTET_UNRESERVED, p, xctx);
100 for (name = parsed->first_property_name; name; name = name->next) {
104 AFW_URI_OCTET_UNRESERVED, p, xctx);
114 impl_object_path_parse(
136 if (!path || path->len == 0)
return NULL;
140 parsed->original_path.s =
afw_memory_dup(path->s, path->len, p, xctx);
141 parsed->original_path.len = path->len;
143 relative_name = NULL;
150 current_parsed = NULL;
151 for (has_asterisk =
false,
164 parsed->contains_unresolved_substitutions =
true;
167 current_parsed = impl_object_path_parse(current_path, NULL, NULL,
173 if (*(parser.c) ==
'/') {
174 state = impl_state_slash_before_adaptor_id;
182 if (current_parsed) {
184 afw_memory_copy(&parsed->object_type_id, ¤t_parsed->object_type_id);
188 parsed->contains_unresolved_substitutions =
true;
192 parsed->contains_unresolved_substitutions =
true;
196 state = impl_state_entity_object_id;
200 while (state != impl_state_end) {
205 token = &parser.token;
206 is_reserved = parser.is_reserved;
215 case impl_state_slash_before_adaptor_id:
216 state = impl_state_adaptor_id;
221 case impl_state_adaptor_id:
224 state = impl_state_end;
233 if (!current_parsed ||
237 parsed->contains_unresolved_substitutions =
true;
238 parsed->adaptor_id.s = afw_s_a_asterisk.s;
239 parsed->adaptor_id.len = afw_s_a_asterisk.len;
242 parsed->substituted_adaptor_id =
true;
243 parsed->substitution_occurred =
true;
245 ¤t_parsed->adaptor_id);
250 parsed->adaptor_id.s = token->s;
251 parsed->adaptor_id.len = token->len;
254 state = impl_state_after_adaptor_id;
259 case impl_state_after_adaptor_id:
262 state = impl_state_end;
270 state = impl_state_object_type_id;
275 case impl_state_object_type_id:
278 state = impl_state_end;
286 if (!current_parsed ||
290 parsed->contains_unresolved_substitutions =
true;
291 parsed->object_type_id.s = afw_s_a_asterisk.s;
292 parsed->object_type_id.len = afw_s_a_asterisk.len;
295 parsed->substituted_object_type_id =
true;
296 parsed->substitution_occurred =
true;
298 ¤t_parsed->object_type_id);
303 parsed->object_type_id.s = token->s;
304 parsed->object_type_id.len = token->len;
307 state = impl_state_after_object_type_id;
312 case impl_state_after_object_type_id:
315 state = impl_state_end;
324 state = impl_state_entity_object_id;
329 state = impl_state_option_name;
330 parsed->options_object =
339 case impl_state_option_name:
341 if (at_end || is_reserved) {
346 state = impl_state_after_option_name;
351 case impl_state_after_option_name:
361 state = impl_state_end;
368 state = impl_state_option_value;
373 state = impl_state_option_name;
378 state = impl_state_entity_object_id;
387 case impl_state_option_value:
389 if (at_end || is_reserved) {
396 state = impl_state_after_option_value;
402 case impl_state_after_option_value:
405 state = impl_state_end;
410 state = impl_state_option_name;
415 state = impl_state_entity_object_id;
423 case impl_state_entity_object_id:
426 state = impl_state_end;
434 if (!current_parsed ||
438 parsed->contains_unresolved_substitutions =
true;
439 parsed->entity_object_id.s = afw_s_a_asterisk.s;
440 parsed->entity_object_id.len = afw_s_a_asterisk.len;
443 parsed->substituted_entity_object_id =
true;
444 parsed->substitution_occurred =
true;
446 ¤t_parsed->entity_object_id);
449 impl_state_entity_object_id_possible_second_asterisk;
453 parsed->entity_object_id.s = token->s;
454 parsed->entity_object_id.len = token->len;
455 state = impl_state_property_name_slash_or_end;
463 case impl_state_entity_object_id_possible_second_asterisk:
466 state = impl_state_end;
476 parsed->substituted_entire_object_id =
true;
477 if (!current_parsed ||
481 parsed->contains_unresolved_substitutions =
true;
482 parsed->entity_object_id.s = afw_s_a_asterisk.s;
483 parsed->entity_object_id.len = afw_s_a_asterisk.len;
486 parsed->first_property_name = current_parsed->first_property_name;
488 parsed->first_property_name;
489 !parsed->contains_unresolved_substitutions && curr_name;
496 parsed->contains_unresolved_substitutions =
true;
500 state = impl_state_expect_end;
508 state = impl_state_property_name;
513 case impl_state_property_name:
522 parsed->first_property_name = curr_name;
523 relative_name = (current_parsed)
525 current_parsed->first_property_name
529 prev_name->next = curr_name;
544 if (!current_parsed->first_property_name ||
550 parsed->contains_unresolved_substitutions =
true;
556 parsed->substituted_property_name =
true;
557 parsed->substitution_occurred =
true;
559 &relative_name->property_name);
567 prev_name = curr_name;
568 state = impl_state_property_name_slash_or_end;
573 case impl_state_property_name_slash_or_end:
576 state = impl_state_end;
585 state = impl_state_property_name;
590 case impl_state_expect_end:
596 state = impl_state_end;
607 impl_set_result_paths(parsed, p, xctx);
610 if (parsed->options_object) {
612 default_options, parsed->options_object, p, xctx);
614 else if (default_options) {
615 parsed->options = default_options;
623 "Error parsing object path %" AFW_UTF8_FMT " at offset %d",
625 (
int)(prev_c - (
const afw_octet_t *)parser.uri->s));
639 &first_property_name->property_name, xctx);
641 for (name = first_property_name->next; name; name = name->next) {
643 &name->property_name, xctx);
662 return impl_object_path_parse(path, current_path, default_options,
682 *object_type_id = NULL;
688 if (len-- <= 0 || *c++ !=
'/') {
692 for (s = c; len > 0 && *c !=
'/'; len--, c++);
693 if (len <= 0 || s == c) {
700 for (s = c; len > 0 && *c !=
'/'; len--, c++);
701 if (len <= 0 || s == c) {
737 if (parsed->original_path.len > 0) {
739 &afw_s_originalPath, &parsed->original_path, xctx);
742 if (parsed->normalized_path.len > 0) {
744 &afw_s_normalizedPath, &parsed->normalized_path, xctx);
747 if (parsed->entity_path.len > 0) {
749 &afw_s_entityPath, &parsed->entity_path, xctx);
752 if (parsed->adaptor_id.len > 0) {
754 &afw_s_adaptorId, &parsed->adaptor_id, xctx);
757 if (parsed->object_type_id.len > 0) {
759 &afw_s_objectType, &parsed->object_type_id, xctx);
762 if (parsed->entity_object_id.len > 0) {
764 &afw_s_entityObjectId, &parsed->entity_object_id, xctx);
767 if (parsed->undecoded_object_id.len > 0) {
769 &afw_s_objectId, &parsed->undecoded_object_id, xctx);
772 if (parsed->first_property_name) {
775 for (name = parsed->first_property_name; name; name = name->next) {
781 &afw_s_propertyTypes, list, xctx);
784 if (parsed->options_object) {
786 &afw_s_optionsObject, parsed->options_object, xctx);
789 if (parsed->substitution_occurred) {
794 if (parsed->substituted_adaptor_id) {
799 if (parsed->substituted_object_type_id) {
804 if (parsed->substituted_entire_object_id) {
809 if (parsed->substituted_entity_object_id) {
814 if (parsed->substituted_property_name) {
819 if (parsed->contains_unresolved_substitutions) {
837 if (parsed1->adaptor_id.len != parsed2->adaptor_id.len ||
838 (parsed1->adaptor_id.len != 0 &&
844 if (parsed1->object_type_id.len != parsed2->object_type_id.len ||
845 (parsed1->object_type_id.len != 0 &&
846 !
afw_utf8_equal(&parsed1->object_type_id, &parsed2->object_type_id)))
851 if (parsed1->entity_object_id.len != parsed2->entity_object_id.len ||
852 (parsed1->entity_object_id.len != 0 &&
854 &parsed1->entity_object_id, &parsed2->entity_object_id)))
860 name1 = parsed1->first_property_name,
861 name2 = parsed1->first_property_name;
868 if (name2)
goto not_equal;
872 if (!name2)
goto not_equal;
874 if (!
afw_utf8_equal(&name1->property_name, &name2->property_name)) {
918 AFW_URI_OCTET_UNRESERVED, p, xctx);
923 AFW_URI_OCTET_UNRESERVED, p, xctx);
929 AFW_URI_OCTET_UNRESERVED, p, xctx);
932 &afw_s_a_slash, adaptor_id,
933 &afw_s_a_slash, object_type_id,
934 &afw_s_a_slash, object_id,
939 &afw_s_a_slash, adaptor_id,
940 &afw_s_a_slash, object_type_id,
964 for (len = 0,
object = embedded_object;
965 object->meta.embedding_object;
966 object =
object->meta.embedding_object)
969 AFW_URI_OCTET_UNRESERVED, xctx) + 1;
975 len += entity_path->len;
979 memcpy(c, entity_path->s, entity_path->len);
981 for (
object = embedded_object;
982 object->meta.embedding_object;
983 object =
object->meta.embedding_object)
986 AFW_URI_OCTET_UNRESERVED, p, xctx);
988 memcpy(c, encoded->s, encoded->len);
1012 for (len = 0, entry = first; entry; entry = entry->next) {
1013 len += entry->property_name.len + 1;
1021 memcpy(s, first->property_name.s, first->property_name.len);
1022 s += first->property_name.len;
1024 for (entry = first->next; entry; entry = entry->next) {
1026 memcpy(s, entry->property_name.s, entry->property_name.len);
1027 s += entry->property_name.len;
AFW_DEFINE(const afw_object_t *)
Adaptive Framework Core Internal.
afw_object_set_property_as_list(const afw_object_t *object, const afw_utf8_t *property_name, const afw_list_t *internal, afw_xctx_t *xctx)
Set property function for data type list values.
afw_object_set_property_as_object(const afw_object_t *object, const afw_utf8_t *property_name, const afw_object_t *internal, afw_xctx_t *xctx)
Set property function for data type object values.
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_data_type_string
Data type struct for string.
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.
#define AFW_UTF8_FMT_ARG(A_STRING)
Convenience Macro for use with AFW_UTF8_FMT to specify arg.
#define AFW_UTF8_FMT
Format string specifier used for afw_utf8_t.
char afw_utf8_octet_t
8 bits of utf-8 codepoint.
apr_size_t afw_size_t
size_t.
unsigned char afw_octet_t
8 bits (unsigned).
#define AFW_THROW_ERROR_FZ(code, xctx, format_z,...)
Macro used to set error and 0 rv in xctx and throw it.
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
afw_list_add_value(const afw_list_t *instance, const afw_value_t *value, afw_xctx_t *xctx)
Call method add_value of interface afw_list_setter.
#define afw_list_of_create(data_type, p, xctx)
Create an list of a specific data type in memory.
void * afw_memory_dup(const void *from, apr_size_t size, const afw_pool_t *p, afw_xctx_t *xctx)
Duplicate a block of memory into specified pool.
#define afw_memory_copy(to, from)
Copy to preallocated memory of same type.
#define afw_object_get_property(instance, property_name, xctx)
Call method get_property of interface afw_object.
afw_object_options_set_from_object(const afw_object_options_t *initial_options, const afw_object_t *options_object, const afw_pool_t *p, afw_xctx_t *xctx)
Set object processing options from options object.
afw_object_path_property_name_list_get_property(const afw_object_t *object, const afw_object_path_property_name_entry_t *first_property_name, afw_xctx_t *xctx)
Get object property value using property names.
afw_object_path_parse(const afw_utf8_t *path, const afw_utf8_t *current_path, const afw_object_options_t *default_options, const afw_pool_t *p, afw_xctx_t *xctx)
Parse an object value path in specific pool.
afw_object_path_parsed_to_object(const afw_object_path_parsed_t *parsed, const afw_pool_t *p, afw_xctx_t *xctx)
Turn a parsed path into an object representation.
afw_object_path_make_property_name_expression(const afw_object_path_property_name_entry_t *first, const afw_pool_t *p, afw_xctx_t *xctx)
Construct a property name expression from property name list.
afw_object_path_make_for_embedded(const afw_object_t *embedded_object, const afw_pool_t *p, afw_xctx_t *xctx)
Construct the path for an embedded object.
afw_object_path_are_equivalent(const afw_utf8_t *path1, const afw_utf8_t *path2, const afw_utf8_t *current_path, const afw_pool_t *p, afw_xctx_t *xctx)
Determine if two paths are equivalent.
afw_object_path_make(const afw_utf8_t *adaptor_id, const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, const afw_pool_t *p, afw_xctx_t *xctx)
Construct an object path in a specified pool.
afw_object_path_parsed_are_equivalent(const afw_object_path_parsed_t *parsed1, const afw_object_path_parsed_t *parsed2, afw_xctx_t *xctx)
Determine if two parsed paths are equivalent.
afw_object_path_parse_simple(const afw_utf8_t *path, const afw_utf8_t **adaptor_id, const afw_utf8_t **object_type_id, const afw_utf8_t **object_id, const afw_pool_t *p, afw_xctx_t *xctx)
Parse simple path into ids.
#define afw_object_create_managed(p, xctx)
Create an empty entity object in its own pool.
#define afw_object_create(p, xctx)
Create an empty unmanaged object in memory.
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.
#define afw_pool_malloc(instance, size, xctx)
Call method malloc of interface afw_pool.
#define afw_pool_calloc_type(instance, type, xctx)
Macro to allocate cleared memory to hold type in pool.
#define afw_pool_malloc_type(instance, type, xctx)
Macro to allocate uncleared memory to hold type in pool.
afw_uri_parse_next_token(const afw_uri_parser_t *parser, afw_xctx_t *xctx)
Parse next token.
afw_uri_decode_create(const afw_utf8_octet_t *s, afw_size_t len, const afw_pool_t *p, afw_xctx_t *xctx)
Create a URI decoded string.
afw_uri_parser_initialize(afw_uri_parser_t *parser, const afw_utf8_t *uri, const afw_pool_t *p, afw_xctx_t *xctx)
Initialize a parser in specific pool.
afw_size_t afw_uri_encode_len(const afw_utf8_t *string, afw_uri_octet_type_t mask, afw_xctx_t *xctx)
The length needed to URI encode a string.
afw_uri_encode(const afw_utf8_t *string, afw_uri_octet_type_t mask, const afw_pool_t *p, afw_xctx_t *xctx)
URI encode a string.
afw_uri_encode_to_preallocated(afw_utf8_octet_t *s, afw_size_t s_len, const afw_utf8_t *string, afw_uri_octet_type_t mask, const afw_pool_t *p, afw_xctx_t *xctx)
URI encode a string using supplied afw_utf8_t.
const afw_utf8_t * afw_utf8_concat(const afw_pool_t *p, afw_xctx_t *xctx,...)
Concatenate strings with result in specifed pool.
afw_boolean_t afw_utf8_equal(const afw_utf8_t *s1, const afw_utf8_t *s2)
Check to see if a string equals another string.
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.
#define afw_utf8_create(s, len, p, xctx)
Create utf-8 string without copy unless necessary in pool specified.
afw_value_true
Adaptive value true.
Interface afw_list public struct.
Struct for object processing options.
Typedef for parsed object path.
Property name path struct.
Interface afw_object public struct.
Interface afw_pool public struct.
NFC normalized UTF-8 string.
Interface afw_value public struct.
Interface afw_xctx public struct.