|
FDL Core Library
ASC Framing Decision List — C/C++ Reference Implementation
|
Internal helpers for custom attribute operations on ojson nodes. More...
Go to the source code of this file.
Typedefs | |
| using | fdl::detail::custom_attr::ojson = jsoncons::ojson |
| Alias for ordered JSON type. | |
Functions | |
| std::string | fdl::detail::custom_attr::make_key (const char *name) |
| Build the internal key by prepending '_' to the user-visible name. | |
| bool | fdl::detail::custom_attr::has (const ojson *node, const char *name) |
| Check if a custom attribute exists on a node. | |
| fdl_custom_attr_type_t | fdl::detail::custom_attr::get_type (const ojson *node, const char *name) |
| Get the type of a custom attribute. | |
| int | fdl::detail::custom_attr::set_string (ojson *node, const char *name, const char *value) |
| Set a string custom attribute. | |
| int | fdl::detail::custom_attr::set_int (ojson *node, const char *name, int64_t value) |
| Set an integer custom attribute. | |
| int | fdl::detail::custom_attr::set_float (ojson *node, const char *name, double value) |
| Set a floating-point custom attribute. | |
| int | fdl::detail::custom_attr::set_bool (ojson *node, const char *name, int value) |
| Set a boolean custom attribute. | |
| const char * | fdl::detail::custom_attr::get_string (const ojson *node, const char *name) |
| Get a string custom attribute. | |
| int | fdl::detail::custom_attr::get_int (const ojson *node, const char *name, int64_t *out) |
| Get an integer custom attribute. | |
| int | fdl::detail::custom_attr::get_float (const ojson *node, const char *name, double *out) |
| Get a floating-point custom attribute. | |
| int | fdl::detail::custom_attr::get_bool (const ojson *node, const char *name, int *out) |
| Get a boolean custom attribute. | |
| int | fdl::detail::custom_attr::set_point_f64 (ojson *node, const char *name, double x, double y) |
| Set a point_f64 custom attribute. | |
| int | fdl::detail::custom_attr::get_point_f64 (const ojson *node, const char *name, double *x, double *y) |
| Get a point_f64 custom attribute. | |
| int | fdl::detail::custom_attr::set_dims_f64 (ojson *node, const char *name, double width, double height) |
| Set a dims_f64 custom attribute. | |
| int | fdl::detail::custom_attr::get_dims_f64 (const ojson *node, const char *name, double *width, double *height) |
| Get a dims_f64 custom attribute. | |
| int | fdl::detail::custom_attr::set_dims_i64 (ojson *node, const char *name, int64_t width, int64_t height) |
| Set a dims_i64 custom attribute. | |
| int | fdl::detail::custom_attr::get_dims_i64 (const ojson *node, const char *name, int64_t *width, int64_t *height) |
| Get a dims_i64 custom attribute. | |
| int | fdl::detail::custom_attr::remove (ojson *node, const char *name) |
| Remove a custom attribute. | |
| uint32_t | fdl::detail::custom_attr::count (const ojson *node) |
| Count the number of custom attributes on a node. | |
| const char * | fdl::detail::custom_attr::name_at (const ojson *node, uint32_t index) |
| Get the name of a custom attribute by index. | |
Internal helpers for custom attribute operations on ojson nodes.
Custom attributes are user-defined keys prefixed with '_' in the FDL JSON. Users pass attribute names without the prefix; the library prepends it internally. All functions operate on a single ojson node (the target object) and are called from the C ABI wrappers with the document mutex held.
| std::string fdl::detail::custom_attr::make_key | ( | const char * | name | ) |
Build the internal key by prepending '_' to the user-visible name.
| name | User-visible attribute name (without '_' prefix). |
| bool fdl::detail::custom_attr::has | ( | const ojson * | node, |
| const char * | name | ||
| ) |
Check if a custom attribute exists on a node.
| node | Target JSON node. |
| name | User-visible attribute name. |
| fdl_custom_attr_type_t fdl::detail::custom_attr::get_type | ( | const ojson * | node, |
| const char * | name | ||
| ) |
Get the type of a custom attribute.
| node | Target JSON node. |
| name | User-visible attribute name. |
| int fdl::detail::custom_attr::set_string | ( | ojson * | node, |
| const char * | name, | ||
| const char * | value | ||
| ) |
Set a string custom attribute.
Fails if the key exists with a different type.
| node | Target JSON node. |
| name | User-visible attribute name. |
| value | String value to set. |
| int fdl::detail::custom_attr::set_int | ( | ojson * | node, |
| const char * | name, | ||
| int64_t | value | ||
| ) |
Set an integer custom attribute.
Fails if the key exists with a different type.
| node | Target JSON node. |
| name | User-visible attribute name. |
| value | Integer value to set. |
| int fdl::detail::custom_attr::set_float | ( | ojson * | node, |
| const char * | name, | ||
| double | value | ||
| ) |
Set a floating-point custom attribute.
Fails if the key exists with a different type.
| node | Target JSON node. |
| name | User-visible attribute name. |
| value | Double value to set. |
| int fdl::detail::custom_attr::set_bool | ( | ojson * | node, |
| const char * | name, | ||
| int | value | ||
| ) |
Set a boolean custom attribute.
Fails if the key exists with a different type.
| node | Target JSON node. |
| name | User-visible attribute name. |
| value | Boolean value (non-zero = true, zero = false). |
| const char * fdl::detail::custom_attr::get_string | ( | const ojson * | node, |
| const char * | name | ||
| ) |
Get a string custom attribute.
| node | Target JSON node. |
| name | User-visible attribute name. |
| int fdl::detail::custom_attr::get_int | ( | const ojson * | node, |
| const char * | name, | ||
| int64_t * | out | ||
| ) |
Get an integer custom attribute.
| node | Target JSON node. |
| name | User-visible attribute name. |
| out | Output pointer for the integer value. |
| int fdl::detail::custom_attr::get_float | ( | const ojson * | node, |
| const char * | name, | ||
| double * | out | ||
| ) |
Get a floating-point custom attribute.
| node | Target JSON node. |
| name | User-visible attribute name. |
| out | Output pointer for the double value. |
| int fdl::detail::custom_attr::get_bool | ( | const ojson * | node, |
| const char * | name, | ||
| int * | out | ||
| ) |
Get a boolean custom attribute.
| node | Target JSON node. |
| name | User-visible attribute name. |
| out | Output pointer for the boolean value (FDL_TRUE or FDL_FALSE). |
| int fdl::detail::custom_attr::set_point_f64 | ( | ojson * | node, |
| const char * | name, | ||
| double | x, | ||
| double | y | ||
| ) |
Set a point_f64 custom attribute.
Fails if the key exists with a different type.
| node | Target JSON node. |
| name | User-visible attribute name. |
| x | X coordinate. |
| y | Y coordinate. |
| int fdl::detail::custom_attr::get_point_f64 | ( | const ojson * | node, |
| const char * | name, | ||
| double * | x, | ||
| double * | y | ||
| ) |
Get a point_f64 custom attribute.
| node | Target JSON node. |
| name | User-visible attribute name. |
| x | Output pointer for X coordinate. |
| y | Output pointer for Y coordinate. |
| int fdl::detail::custom_attr::set_dims_f64 | ( | ojson * | node, |
| const char * | name, | ||
| double | width, | ||
| double | height | ||
| ) |
Set a dims_f64 custom attribute.
Fails if the key exists with a different type.
| node | Target JSON node. |
| name | User-visible attribute name. |
| width | Width value. |
| height | Height value. |
| int fdl::detail::custom_attr::get_dims_f64 | ( | const ojson * | node, |
| const char * | name, | ||
| double * | width, | ||
| double * | height | ||
| ) |
Get a dims_f64 custom attribute.
| node | Target JSON node. |
| name | User-visible attribute name. |
| width | Output pointer for width. |
| height | Output pointer for height. |
| int fdl::detail::custom_attr::set_dims_i64 | ( | ojson * | node, |
| const char * | name, | ||
| int64_t | width, | ||
| int64_t | height | ||
| ) |
Set a dims_i64 custom attribute.
Fails if the key exists with a different type.
| node | Target JSON node. |
| name | User-visible attribute name. |
| width | Width value. |
| height | Height value. |
| int fdl::detail::custom_attr::get_dims_i64 | ( | const ojson * | node, |
| const char * | name, | ||
| int64_t * | width, | ||
| int64_t * | height | ||
| ) |
Get a dims_i64 custom attribute.
| node | Target JSON node. |
| name | User-visible attribute name. |
| width | Output pointer for width. |
| height | Output pointer for height. |
| int fdl::detail::custom_attr::remove | ( | ojson * | node, |
| const char * | name | ||
| ) |
Remove a custom attribute.
| node | Target JSON node. |
| name | User-visible attribute name. |
| uint32_t fdl::detail::custom_attr::count | ( | const ojson * | node | ) |
Count the number of custom attributes on a node.
| node | Target JSON node. |
| const char * fdl::detail::custom_attr::name_at | ( | const ojson * | node, |
| uint32_t | index | ||
| ) |
Get the name of a custom attribute by index.
Returns names without the '_' prefix. The index refers to the order among custom attributes only (not all keys).
| node | Target JSON node. |
| index | Zero-based index among custom attributes. |