Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_runtime_const_meta.c
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Implementation of afw_object interface for const runtime meta
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
9 
10 
16 #include "afw_internal.h"
17 
18 
19 #define impl_afw_object_get_meta \
20  afw_object_impl_internal_get_meta
21 
22 #define impl_afw_object_get_property_meta \
23  afw_object_impl_internal_get_property_meta
24 
25 #define impl_afw_object_get_next_property_meta \
26  afw_object_impl_internal_get_next_property_meta
27 
30 /* Declares and rti/inf defines for interface afw_object */
31 #define AFW_IMPLEMENTATION_ID "afw_runtime_const_meta"
33 
34 /*
35  * inf for interface afw_object implementation.
36  */
38 afw_runtime_inf_const_meta_object_inf = {
39  {
40  AFW_UTF8_LITERAL("afw_object"),
41  AFW_UTF8_LITERAL(__FILE__),
43  },
47  impl_afw_object_get_meta,
49  impl_afw_object_get_property_meta,
51  impl_afw_object_get_next_property_meta,
54 };
55 
56 
57 
58 /*
59  * Implementation of method release of interface afw_object.
60  */
61 void
63  const afw_object_t * instance,
64  afw_xctx_t *xctx)
65 {
66  /* Nothing to do. */
67 }
68 
69 
70 
71 /*
72  * Implementation of method add_reference of interface afw_object.
73  */
74 void
76  const afw_object_t * instance,
77  afw_xctx_t *xctx)
78 {
79  /* Nothing to do. */
80 }
81 
82 /*
83  * Implementation of method get_count for interface afw_object.
84  */
87  const afw_object_t * instance,
88  afw_xctx_t * xctx)
89 {
90 // <afwdev {prefixed_interface_name}>_self_t *self =
91 // (<afwdev {prefixed_interface_name}>_self_t *)instance;
92 
94  AFW_THROW_ERROR_Z(general, "Method not implemented.", xctx);
95 
96 }
97 
98 /*
99  * Implementation of method get_property of interface afw_object.
100  */
101 const afw_value_t *
103  const afw_object_t * instance,
104  const afw_utf8_t * property_name,
105  afw_xctx_t *xctx)
106 {
107  /* Assign instance pointer to self. */
110  const afw_value_t *result;
111 
112  result = NULL;
113 
114  /* Parent paths. */
115  if (afw_utf8_equal(property_name, &afw_s_parentPaths)) {
116  if (self->parent_paths) {
117  result = (const afw_value_t *)self->parent_paths;
118  }
119  }
120 
121  return result;
122 }
123 
124 
125 
126 /*
127  * Implementation of method get_next_property of interface afw_object.
128  */
129 const afw_value_t *
131  const afw_object_t * instance,
132  const afw_iterator_t * * iterator,
133  const afw_utf8_t * * property_name,
134  afw_xctx_t *xctx)
135 {
136  /* Assign instance pointer to self. */
139 
140 
141  /* Parent paths is only property. */
142  if (!*iterator)
143  {
144  *iterator = (afw_iterator_t *)&afw_s_null;
145  if (self->parent_paths) {
146  if (property_name) {
147  *property_name = &afw_s_parentPaths;
148  }
149  return (const afw_value_t *)self->parent_paths;
150  }
151  }
152 
153  *iterator = NULL;
154  return NULL;
155 }
156 
157 
158 
159 /*
160  * Implementation of method has_property of interface afw_object.
161  */
164  const afw_object_t * instance,
165  const afw_utf8_t * property_name,
166  afw_xctx_t *xctx)
167 {
168  return (afw_utf8_equal(property_name, &afw_s_parentPaths)) ? true : false;
169 }
170 
171 
172 
173 /*
174  * Implementation of method get_setter of interface afw_object.
175  */
176 const afw_object_setter_t *
178  const afw_object_t * instance,
179  afw_xctx_t *xctx)
180 {
181  /* No setter. */
182  return NULL;
183 }
#define AFW_DEFINE_CONST_DATA(type)
Define a public afw variable.
Adaptive Framework Core Internal.
Interface afw_interface implementation declares.
#define AFW_IMPLEMENTATION_ID
#define AFW_UTF8_LITERAL(A_STRING)
String literal initializer.
Definition: afw_common.h:582
struct afw_iterator_s afw_iterator_t
_Bool afw_boolean_t
Definition: afw_common.h:373
apr_size_t afw_size_t
size_t.
Definition: afw_common.h:151
#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
const afw_object_setter_t * impl_afw_object_get_setter(const afw_object_t *instance, afw_xctx_t *xctx)
void impl_afw_object_add_reference(const afw_object_t *instance, afw_xctx_t *xctx)
const afw_value_t * impl_afw_object_get_next_property(const afw_object_t *instance, const afw_iterator_t **iterator, const afw_utf8_t **property_name, afw_xctx_t *xctx)
void impl_afw_object_release(const afw_object_t *instance, afw_xctx_t *xctx)
const afw_value_t * impl_afw_object_get_property(const afw_object_t *instance, const afw_utf8_t *property_name, afw_xctx_t *xctx)
afw_boolean_t impl_afw_object_has_property(const afw_object_t *instance, const afw_utf8_t *property_name, afw_xctx_t *xctx)
afw_size_t impl_afw_object_get_count(const afw_object_t *instance, afw_xctx_t *xctx)
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.
Interface afw_object_inf_s struct.
Interface afw_object public struct.
Interface afw_object_setter public struct.
meta instance with single parent path.
Definition: afw_runtime.h:195
NFC normalized UTF-8 string.
Definition: afw_common.h:545
Interface afw_value public struct.
Interface afw_xctx public struct.