Adaptive Framework
0.9.0
|
Files | |
file | afw_object_meta.h |
afw_object Interface meta helpers. | |
Data Structures | |
struct | afw_object_meta_object_s |
Macros | |
#define | afw_object_meta_object(instance) (const afw_object_t *)((instance)->meta.meta_object) |
Return meta object for an object or NULL if there is not one. More... | |
#define | afw_object_meta_add_error_z(instance, message_z, xctx) |
Add a null terminated error message to instance's meta. More... | |
#define | afw_object_meta_add_error_fz(instance, xctx, format_z, ...) |
Add a formatted error message to instance's meta. More... | |
#define | afw_object_meta_add_property_error_z(instance, property_name, message_z, xctx) |
Add a null terminate error message for a property to instance's meta. More... | |
#define | afw_object_meta_add_property_error_fz(instance, property_name, xctx, format_z, ...) |
Add a formatted error message for a property to instance's meta. More... | |
#define | afw_object_meta_get_property(instance, property_name, xctx) |
Get a meta property. More... | |
#define | afw_object_meta_get_property_as_string(instance, property_name, xctx) |
Get a meta property as single string. More... | |
#define | afw_object_meta_get_embedding_object(instance, xctx) ((instance)->embedding_object) |
Get entity object's embedding object. More... | |
#define | afw_object_meta_get_object_type_id(instance, xctx) |
Get object's object_type_id. More... | |
#define | afw_object_meta_set_property(instance, property_name, value, xctx) |
Set a property in the meta of an object. More... | |
#define | afw_object_meta_set_property_from_utf8_z(instance, property_name, string_z, xctx) |
Set a string property in the meta of an object from utf8_z. More... | |
#define | afw_object_meta_set_property_as(instance, property_name, data_type, value, xctx) |
Set a property in the meta of an object as a value and data type. More... | |
#define | afw_object_meta_set_property_type_property(instance, property_name, property_type_property_name, value, xctx) |
Set a property type property for a property in the meta of an object. More... | |
#define | afw_object_meta_set_property_type_property_from_utf8_z(instance, property_name, property_type_property_name, string_z, xctx) |
Set a property type string property for a property in the meta of an object from utf8_z. More... | |
#define | afw_object_meta_set_property_type_property_as(instance, property_name, property_type_property_name, data_type, value, xctx) |
Set a property type property for a property in the meta of an object as a value and data type. More... | |
Functions | |
void | afw_object_meta_add_error (const afw_object_t *instance, const afw_utf8_t *message, afw_xctx_t *xctx) |
Add an error message to instance's meta. More... | |
void | afw_object_meta_add_needed_object_type (const afw_object_t *instance, const afw_object_t *object_type, afw_xctx_t *xctx) |
Add a needed object type object. More... | |
void | afw_object_meta_add_thrown_error (const afw_object_t *instance, const afw_error_t *error, afw_xctx_t *xctx) |
Add a thrown error to instance's meta. More... | |
void | afw_object_meta_add_property_error (const afw_object_t *instance, const afw_utf8_t *property_name, const afw_utf8_t *message, afw_xctx_t *xctx) |
Add an error message for a property to instance's meta. More... | |
void | afw_object_meta_add_thrown_property_error (const afw_object_t *instance, const afw_utf8_t *property_name, afw_integer_t index, const afw_error_t *error, afw_xctx_t *xctx) |
Add a thrown error for a property to instance's meta. More... | |
afw_boolean_t | afw_object_meta_has_errors (const afw_object_t *instance, afw_xctx_t *xctx) |
Check if object flagged for errors. More... | |
void | afw_object_meta_log_errors (const afw_object_t *instance, const afw_utf8_t *source_location, afw_xctx_t *xctx) |
Log meta errors. More... | |
const afw_object_t * | afw_object_meta_create_accessor_with_options (const afw_object_t *instance, const afw_object_options_t *options, const afw_pool_t *p, afw_xctx_t *xctx) |
Create an object instance to access an object's meta with options. More... | |
const afw_object_meta_object_t * | afw_object_meta_get_nonempty_meta_object (const afw_object_t *instance, afw_xctx_t *xctx) |
Return meta object for an object creating an empty one if needed. More... | |
const afw_object_t * | afw_object_meta_get_nonempty_delta (const afw_object_t *instance, afw_xctx_t *xctx) |
Return meta delta object for an object creating an empty one if needed. More... | |
const afw_utf8_t * | afw_object_meta_get_object_id (const afw_object_t *instance, afw_xctx_t *xctx) |
Get entity object's object id. More... | |
const afw_utf8_t * | afw_object_meta_get_property_name (const afw_object_t *instance, afw_xctx_t *xctx) |
Get object's property name in embedding object. More... | |
const afw_value_string_t * | afw_object_meta_get_object_id_value (const afw_object_t *instance, afw_xctx_t *xctx) |
Get entity object's object id value. More... | |
void | afw_object_meta_add_parent_path (const afw_object_t *instance, const afw_utf8_t *parent_path, afw_xctx_t *xctx) |
Add a parent path to instance's meta. More... | |
const afw_value_list_t * | afw_object_meta_get_parent_paths_value (const afw_object_t *instance, afw_xctx_t *xctx) |
Get meta parentPaths property value. More... | |
const afw_utf8_t * | afw_object_meta_get_path (const afw_object_t *instance, afw_xctx_t *xctx) |
Get an object's path. More... | |
const afw_object_t * | afw_object_meta_get_property_type (const afw_object_t *instance, const afw_utf8_t *property_name, afw_xctx_t *xctx) |
Get the property type object for an object's property from the meta of an object, creating it if needed. More... | |
afw_object_meta_set_meta_object (const afw_object_t *instance, const afw_object_t *meta, afw_xctx_t *xctx) | |
Set an object's meta from a meta object. More... | |
const afw_object_t * | afw_object_meta_set_empty (const afw_object_t *instance, afw_xctx_t *xctx) |
Create and set object's meta to an empty object and return delta. More... | |
void | 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. More... | |
void | afw_object_meta_set_ids_using_path (const afw_object_t *instance, const afw_utf8_t *path, afw_xctx_t *xctx) |
Set object's ids using path. More... | |
void | afw_object_meta_set_read_only (const afw_object_t *instance, afw_xctx_t *xctx) |
Set object's meta to indicate object is read-only. More... | |
void | afw_object_meta_set_object_type (const afw_object_t *instance, const afw_object_type_t *object_type, afw_xctx_t *xctx) |
Set object's object type id. More... | |
void | 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. More... | |
void | afw_object_meta_set_parent_paths (const afw_object_t *instance, const afw_value_list_t *parent_paths, afw_xctx_t *xctx) |
Set meta parentPaths property. More... | |
void | afw_object_meta_clone_and_set (const afw_object_t *instance, const afw_object_t *from, afw_xctx_t *xctx) |
Set object's meta using a clone of the meta of another object. More... | |
Provide afw_object interface common support.
#define afw_object_meta_add_error_fz | ( | instance, | |
xctx, | |||
format_z, | |||
... | |||
) |
Add a formatted error message to instance's meta.
instance | of object. |
xctx | of caller. |
format_z | format for error message. |
... | for format_z. |
Definition at line 90 of file afw_object_meta.h.
#define afw_object_meta_add_error_z | ( | instance, | |
message_z, | |||
xctx | |||
) |
Add a null terminated error message to instance's meta.
instance | of object. |
message_z | null terminated string error message. |
xctx | of caller. |
Definition at line 75 of file afw_object_meta.h.
#define afw_object_meta_add_property_error_fz | ( | instance, | |
property_name, | |||
xctx, | |||
format_z, | |||
... | |||
) |
Add a formatted error message for a property to instance's meta.
instance | of object. |
property_name | of property. |
xctx | of caller. |
format_z | format for error message. |
... | for format_z. |
Definition at line 169 of file afw_object_meta.h.
#define afw_object_meta_add_property_error_z | ( | instance, | |
property_name, | |||
message_z, | |||
xctx | |||
) |
Add a null terminate error message for a property to instance's meta.
instance | of object. |
property_name | of property. |
message_z | null terminated string error message. |
xctx | of caller. |
Definition at line 153 of file afw_object_meta.h.
#define afw_object_meta_get_embedding_object | ( | instance, | |
xctx | |||
) | ((instance)->embedding_object) |
Get entity object's embedding object.
instance | of object. |
xctx | of caller. |
Definition at line 313 of file afw_object_meta.h.
#define afw_object_meta_get_object_type_id | ( | instance, | |
xctx | |||
) |
Get object's object_type_id.
instance | of object. |
xctx | of caller. |
Definition at line 336 of file afw_object_meta.h.
#define afw_object_meta_get_property | ( | instance, | |
property_name, | |||
xctx | |||
) |
Get a meta property.
instance | of object. |
property_name | of meta property. Can be dotted. |
xctx | of caller. |
Definition at line 282 of file afw_object_meta.h.
#define afw_object_meta_get_property_as_string | ( | instance, | |
property_name, | |||
xctx | |||
) |
Get a meta property as single string.
instance | of object. |
property_name | of meta property. Can be dotted. |
xctx | of caller. |
Definition at line 297 of file afw_object_meta.h.
#define afw_object_meta_object | ( | instance | ) | (const afw_object_t *)((instance)->meta.meta_object) |
Return meta object for an object or NULL if there is not one.
instance | of object whose meta object is to be returned. |
Definition at line 50 of file afw_object_meta.h.
#define afw_object_meta_set_property | ( | instance, | |
property_name, | |||
value, | |||
xctx | |||
) |
Set a property in the meta of an object.
instance | of object. |
property_name | of meta property to set. |
value | to set. |
xctx | of caller. |
Definition at line 579 of file afw_object_meta.h.
#define afw_object_meta_set_property_as | ( | instance, | |
property_name, | |||
data_type, | |||
value, | |||
xctx | |||
) |
Set a property in the meta of an object as a value and data type.
instance | of object. |
property_name | of meta property to set. |
data_type | unquoted id |
value | to set. |
xctx | of caller. |
Definition at line 608 of file afw_object_meta.h.
#define afw_object_meta_set_property_from_utf8_z | ( | instance, | |
property_name, | |||
string_z, | |||
xctx | |||
) |
Set a string property in the meta of an object from utf8_z.
instance | of object. |
property_name | of meta property to set. |
string_z | zero terminate string. |
xctx | of caller. |
Definition at line 592 of file afw_object_meta.h.
#define afw_object_meta_set_property_type_property | ( | instance, | |
property_name, | |||
property_type_property_name, | |||
value, | |||
xctx | |||
) |
Set a property type property for a property in the meta of an object.
instance | of object. |
property_name | of property in instance. |
property_type_property_name | is name of property in property type. |
value | to set. |
xctx | of caller. |
Definition at line 624 of file afw_object_meta.h.
#define afw_object_meta_set_property_type_property_as | ( | instance, | |
property_name, | |||
property_type_property_name, | |||
data_type, | |||
value, | |||
xctx | |||
) |
Set a property type property for a property in the meta of an object as a value and data type.
instance | of object. |
property_name | of meta property to set. |
property_type_property_name | is name of property in property type. |
data_type | unquoted id |
value | to set. |
xctx | of caller. |
Definition at line 659 of file afw_object_meta.h.
#define afw_object_meta_set_property_type_property_from_utf8_z | ( | instance, | |
property_name, | |||
property_type_property_name, | |||
string_z, | |||
xctx | |||
) |
Set a property type string property for a property in the meta of an object from utf8_z.
instance | of object. |
property_name | of property in instance. |
property_type_property_name | is name of property in property type. |
string_z | zero terminate string. |
xctx | of caller. |
Definition at line 641 of file afw_object_meta.h.
void afw_object_meta_add_error | ( | const afw_object_t * | instance, |
const afw_utf8_t * | message, | ||
afw_xctx_t * | xctx | ||
) |
Add an error message to instance's meta.
instance | of object. |
message | to add. |
xctx | of caller. |
Definition at line 582 of file afw_object_meta.c.
void afw_object_meta_add_needed_object_type | ( | const afw_object_t * | instance, |
const afw_object_t * | object_type, | ||
afw_xctx_t * | xctx | ||
) |
Add a needed object type object.
instance | of object. |
object_type | object. |
xctx | of caller. |
An error is thrown if the object is immutable.
This will add/replace a property with then property name of the supplied object type in the meta objectTypes property of the instance's entity.
Definition at line 67 of file afw_object_meta.c.
void afw_object_meta_add_parent_path | ( | const afw_object_t * | instance, |
const afw_utf8_t * | parent_path, | ||
afw_xctx_t * | xctx | ||
) |
Add a parent path to instance's meta.
instance | of object. |
parent_path. | |
xctx | of caller. |
If the object already has a parent path, this one will be added to the end.
Definition at line 139 of file afw_object_meta.c.
void afw_object_meta_add_property_error | ( | const afw_object_t * | instance, |
const afw_utf8_t * | property_name, | ||
const afw_utf8_t * | message, | ||
afw_xctx_t * | xctx | ||
) |
Add an error message for a property to instance's meta.
instance | of object. |
message | to add. |
property_name | of property. |
xctx | of caller. |
Definition at line 752 of file afw_object_meta.c.
void afw_object_meta_add_thrown_error | ( | const afw_object_t * | instance, |
const afw_error_t * | error, | ||
afw_xctx_t * | xctx | ||
) |
Add a thrown error to instance's meta.
instance | of object. |
error | to add. |
xctx | of caller. |
Definition at line 729 of file afw_object_meta.c.
void afw_object_meta_add_thrown_property_error | ( | const afw_object_t * | instance, |
const afw_utf8_t * | property_name, | ||
afw_integer_t | index, | ||
const afw_error_t * | error, | ||
afw_xctx_t * | xctx | ||
) |
Add a thrown error for a property to instance's meta.
instance | of object. |
property_name | of property or NULL. |
index | if list entry, otherwise -1. |
error | to add. |
xctx | of caller. |
If property_name is NULL, afw_object_meta_add_thrown_error() is called.
Definition at line 782 of file afw_object_meta.c.
void afw_object_meta_clone_and_set | ( | const afw_object_t * | instance, |
const afw_object_t * | from, | ||
afw_xctx_t * | xctx | ||
) |
Set object's meta using a clone of the meta of another object.
instance | of object whose meta is to be set. |
from | is object whose meta is to be cloned. |
xctx | of caller. |
If the from object has no meta, this function just returns.
If the meta is already set in the instance, an error is thrown.
Definition at line 92 of file afw_object_meta.c.
const afw_object_t* afw_object_meta_create_accessor_with_options | ( | const afw_object_t * | instance, |
const afw_object_options_t * | options, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create an object instance to access an object's meta with options.
instance | of object whose meta is to be accessed. |
options. | |
p | to use. |
xctx | of caller. |
This is a special purpose and limited implementation of the afw_object inteface. It only implements the get_next_property() and afw_object_release() methods – all other methods will throw an error.
The original purpose of this implementation is for implementations of the write_value) method of the afw_content_type interface to assist in producing the requested meta information. See afw_json_from_value.c for an example of its use.
Definition at line 36 of file afw_object_meta_accessor.c.
const afw_object_t* afw_object_meta_get_nonempty_delta | ( | const afw_object_t * | instance, |
afw_xctx_t * | xctx | ||
) |
Return meta delta object for an object creating an empty one if needed.
instance | of object whose meta object is to be returned. |
xctx | of caller. |
Definition at line 440 of file afw_object_meta.c.
const afw_object_meta_object_t* afw_object_meta_get_nonempty_meta_object | ( | const afw_object_t * | instance, |
afw_xctx_t * | xctx | ||
) |
Return meta object for an object creating an empty one if needed.
instance | of object whose meta object is to be returned. |
xctx | of caller. |
Definition at line 422 of file afw_object_meta.c.
const afw_utf8_t* afw_object_meta_get_object_id | ( | const afw_object_t * | instance, |
afw_xctx_t * | xctx | ||
) |
Get entity object's object id.
instance | of object. |
xctx | of caller. |
Definition at line 199 of file afw_object_meta.c.
const afw_value_string_t* afw_object_meta_get_object_id_value | ( | const afw_object_t * | instance, |
afw_xctx_t * | xctx | ||
) |
Get entity object's object id value.
instance | of object. |
xctx | of caller. |
Definition at line 119 of file afw_object_meta.c.
const afw_value_list_t* afw_object_meta_get_parent_paths_value | ( | const afw_object_t * | instance, |
afw_xctx_t * | xctx | ||
) |
Get meta parentPaths property value.
instance | of object. |
xctx | of caller. |
Definition at line 171 of file afw_object_meta.c.
const afw_utf8_t* afw_object_meta_get_path | ( | const afw_object_t * | instance, |
afw_xctx_t * | xctx | ||
) |
Get an object's path.
instance | of object. |
xctx | of caller. |
If the object does not have a path, is an embedded object, and is not a const object (has a p), afw_object_path_make_for_embedded) will be used to make the path and that path will be stored as the object's path. This works this way so that paths do not have to be created for embedded objects unless the are accessed, so as the use of the inheritedFrom object option.
If a object is a const object and does not have a path, NULL is returned.
Definition at line 231 of file afw_object_meta.c.
const afw_utf8_t* afw_object_meta_get_property_name | ( | const afw_object_t * | instance, |
afw_xctx_t * | xctx | ||
) |
Get object's property name in embedding object.
instance | of object. |
xctx | of caller. |
Definition at line 215 of file afw_object_meta.c.
const afw_object_t* afw_object_meta_get_property_type | ( | const afw_object_t * | instance, |
const afw_utf8_t * | property_name, | ||
afw_xctx_t * | xctx | ||
) |
Get the property type object for an object's property from the meta of an object, creating it if needed.
instance | of object. |
property_name | of property in instance. |
xctx | of caller. |
Definition at line 262 of file afw_object_meta.c.
afw_boolean_t afw_object_meta_has_errors | ( | const afw_object_t * | instance, |
afw_xctx_t * | xctx | ||
) |
Check if object flagged for errors.
instance | of object. |
xctx | of caller. |
Definition at line 610 of file afw_object_meta.c.
void afw_object_meta_log_errors | ( | const afw_object_t * | instance, |
const afw_utf8_t * | source_location, | ||
afw_xctx_t * | xctx | ||
) |
Log meta errors.
instance | of object. |
source_location | to preface log messages. |
xctx | of caller. |
Definition at line 653 of file afw_object_meta.c.
const afw_object_t* afw_object_meta_set_empty | ( | const afw_object_t * | instance, |
afw_xctx_t * | xctx | ||
) |
Create and set object's meta to an empty object and return delta.
instance | of object whose meta is to be set to empty object. |
xctx | of caller. |
Create an new unmanaged object to hold the object meta in the pool of the instance and set instance->meta to that object.
Definition at line 398 of file afw_object_meta.c.
void 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.
instance | of object. |
adaptor_id | |
object_type_id | |
object_id | |
xctx | of caller. |
This produces the same results as afw_object_meta_set_ids_using_path().
An error is thrown if the object is immutable.
Definition at line 510 of file afw_object_meta.c.
void afw_object_meta_set_ids_using_path | ( | const afw_object_t * | instance, |
const afw_utf8_t * | path, | ||
afw_xctx_t * | xctx | ||
) |
Set object's ids using path.
instance | of object. |
path | |
xctx | of caller. |
This produces the same results as afw_object_meta_set_ids().
An error is thrown if the object is immutable.
Definition at line 538 of file afw_object_meta.c.
afw_object_meta_set_meta_object | ( | const afw_object_t * | instance, |
const afw_object_t * | meta, | ||
afw_xctx_t * | xctx | ||
) |
Set an object's meta from a meta object.
instance | of object whose meta is to be set. |
meta | object. |
xctx | of caller. |
This will set an instances parentPaths and path meta from a meta object. The meta must have a lifetime as long as the instance.
Definition at line 315 of file afw_object_meta.c.
void afw_object_meta_set_object_type | ( | const afw_object_t * | instance, |
const afw_object_type_t * | object_type, | ||
afw_xctx_t * | xctx | ||
) |
Set object's object type id.
instance | of object. |
object_type | of object. |
xctx | of caller. |
An error is thrown if the object is immutable.
Definition at line 460 of file afw_object_meta.c.
void 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.
instance | of object. |
object_type_id | of object. |
xctx | of caller. |
An error is thrown if the object is immutable.
Definition at line 479 of file afw_object_meta.c.
void afw_object_meta_set_parent_paths | ( | const afw_object_t * | instance, |
const afw_value_list_t * | parent_paths, | ||
afw_xctx_t * | xctx | ||
) |
Set meta parentPaths property.
instance | of object. |
parent_paths | value. |
xctx | of caller. |
Definition at line 493 of file afw_object_meta.c.
void afw_object_meta_set_read_only | ( | const afw_object_t * | instance, |
afw_xctx_t * | xctx | ||
) |
Set object's meta to indicate object is read-only.
instance | of object. |
xctx | of caller. |
This sets allowChange and allowDelete to false in meta.
Definition at line 569 of file afw_object_meta.c.