12#ifndef FDL_CUSTOM_ATTR_INTERNAL_H
13#define FDL_CUSTOM_ATTR_INTERNAL_H
15#include <jsoncons/json.hpp>
21namespace fdl::detail::custom_attr {
31std::string
make_key(
const char* name);
39bool has(
const ojson* node,
const char* name);
65int set_int(
ojson* node,
const char* name, int64_t value);
100int get_int(
const ojson* node,
const char* name, int64_t* out);
158int get_dims_f64(
const ojson* node,
const char* name,
double* width,
double* height);
178int get_dims_i64(
const ojson* node,
const char* name, int64_t* width, int64_t* height);
Named constants replacing magic numbers throughout the FDL core library.
Public C ABI for the FDL (Framing Decision List) core library.
uint32_t fdl_custom_attr_type_t
Type identifier for custom attributes.
Definition fdl_core.h:40
int get_dims_i64(const ojson *node, const char *name, int64_t *width, int64_t *height)
Get a dims_i64 custom attribute.
Definition fdl_custom_attr.cpp:334
int remove(ojson *node, const char *name)
Remove a custom attribute.
Definition fdl_custom_attr.cpp:362
int set_dims_f64(ojson *node, const char *name, double width, double height)
Set a dims_f64 custom attribute.
Definition fdl_custom_attr.cpp:208
int set_dims_i64(ojson *node, const char *name, int64_t width, int64_t height)
Set a dims_i64 custom attribute.
Definition fdl_custom_attr.cpp:217
std::string make_key(const char *name)
Build the internal key by prepending '_' to the user-visible name.
Definition fdl_custom_attr.cpp:53
const char * get_string(const ojson *node, const char *name)
Get a string custom attribute.
Definition fdl_custom_attr.cpp:230
int set_float(ojson *node, const char *name, double value)
Set a floating-point custom attribute.
Definition fdl_custom_attr.cpp:187
int get_dims_f64(const ojson *node, const char *name, double *width, double *height)
Get a dims_f64 custom attribute.
Definition fdl_custom_attr.cpp:313
int set_string(ojson *node, const char *name, const char *value)
Set a string custom attribute.
Definition fdl_custom_attr.cpp:175
int set_int(ojson *node, const char *name, int64_t value)
Set an integer custom attribute.
Definition fdl_custom_attr.cpp:182
int get_point_f64(const ojson *node, const char *name, double *x, double *y)
Get a point_f64 custom attribute.
Definition fdl_custom_attr.cpp:296
bool has(const ojson *node, const char *name)
Check if a custom attribute exists on a node.
Definition fdl_custom_attr.cpp:64
const char * name_at(const ojson *node, uint32_t index)
Get the name of a custom attribute by index.
Definition fdl_custom_attr.cpp:391
int set_point_f64(ojson *node, const char *name, double x, double y)
Set a point_f64 custom attribute.
Definition fdl_custom_attr.cpp:199
int get_int(const ojson *node, const char *name, int64_t *out)
Get an integer custom attribute.
Definition fdl_custom_attr.cpp:244
int get_bool(const ojson *node, const char *name, int *out)
Get a boolean custom attribute.
Definition fdl_custom_attr.cpp:276
uint32_t count(const ojson *node)
Count the number of custom attributes on a node.
Definition fdl_custom_attr.cpp:378
fdl_custom_attr_type_t get_type(const ojson *node, const char *name)
Get the type of a custom attribute.
Definition fdl_custom_attr.cpp:71
int set_bool(ojson *node, const char *name, int value)
Set a boolean custom attribute.
Definition fdl_custom_attr.cpp:191
int get_float(const ojson *node, const char *name, double *out)
Get a floating-point custom attribute.
Definition fdl_custom_attr.cpp:260
jsoncons::ojson ojson
Alias for ordered JSON type.
Definition fdl_custom_attr.h:24