Skip to content

Commit

Permalink
Fix API
Browse files Browse the repository at this point in the history
  • Loading branch information
fschutt committed May 13, 2024
1 parent 32f0de5 commit cf0fbd4
Show file tree
Hide file tree
Showing 6 changed files with 298 additions and 7 deletions.
39 changes: 38 additions & 1 deletion api.json
Original file line number Diff line number Diff line change
Expand Up @@ -14001,6 +14001,27 @@
}
}
},
"TessellatedColoredSvgNodeVec": {
"doc": "Wrapper over a Rust-allocated `Vec<TessellatedColoredSvgNode>`",
"custom_destructor": true,
"external": "azul_impl::svg::TessellatedColoredSvgNodeVec",
"struct_fields": [
{ "ptr": { "type": "*const TessellatedColoredSvgNode" } },
{ "len": { "type": "usize" } },
{ "cap": { "type": "usize" } },
{ "destructor": { "type": "TessellatedColoredSvgNodeVecDestructor" } }
],
"functions": {
"as_ref_vec": {
"doc": "Returns the `TessellatedColoredSvgNodeVec` as a non-owning slice, NOTE: The `TessellatedColoredSvgNodeVec` that this slice was borrowed from MUST NOT be deleted before the `U8VecRef`",
"fn_args": [
{"self": "ref"}
],
"returns": {"type": "TessellatedColoredSvgNodeVecRef"},
"fn_body": "tessellatedcoloredsvgnodevec.get_ref()"
}
}
},
"StyleFontFamilyVec": {
"doc": "Wrapper over a Rust-allocated `Vec<StyleFontFamily>`",
"custom_destructor": true,
Expand Down Expand Up @@ -14270,7 +14291,7 @@
"custom_destructor": true,
"external": "azul_core::svg::SvgColoredVertexVec",
"struct_fields": [
{ "ptr": { "type": "*const SvgVertex" } },
{ "ptr": { "type": "*const SvgColoredVertex" } },
{ "len": { "type": "usize" } },
{ "cap": { "type": "usize" } },
{ "destructor": { "type": "SvgColoredVertexVecDestructor" } }
Expand Down Expand Up @@ -14839,6 +14860,22 @@
]
}
},
"TessellatedColoredSvgNodeVecDestructor": {
"external": "azul_impl::svg::TessellatedColoredSvgNodeVecDestructor",
"derive": ["Copy"],
"enum_fields": [
{"DefaultRust": {}},
{"NoDestructor": {}},
{"External": {"type": "TessellatedColoredSvgNodeVecDestructorType"}}
]
},
"TessellatedColoredSvgNodeVecDestructorType": {
"callback_typedef": {
"fn_args": [
{"type": "TessellatedColoredSvgNodeVec", "ref": "refmut"}
]
}
},
"XmlNodeVecDestructor": {
"external": "azul_impl::xml::XmlNodeVecDestructor",
"derive": ["Copy"],
Expand Down
59 changes: 57 additions & 2 deletions api/c/azul.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ struct AzTessellatedSvgNodeVec;
typedef struct AzTessellatedSvgNodeVec AzTessellatedSvgNodeVec;
typedef void (*AzTessellatedSvgNodeVecDestructorType)(AzTessellatedSvgNodeVec* restrict A);

struct AzTessellatedColoredSvgNodeVec;
typedef struct AzTessellatedColoredSvgNodeVec AzTessellatedColoredSvgNodeVec;
typedef void (*AzTessellatedColoredSvgNodeVecDestructorType)(AzTessellatedColoredSvgNodeVec* restrict A);

struct AzXmlNodeVec;
typedef struct AzXmlNodeVec AzXmlNodeVec;
typedef void (*AzXmlNodeVecDestructorType)(AzXmlNodeVec* restrict A);
Expand Down Expand Up @@ -2617,6 +2621,26 @@ union AzTessellatedSvgNodeVecDestructor {
};
typedef union AzTessellatedSvgNodeVecDestructor AzTessellatedSvgNodeVecDestructor;

enum AzTessellatedColoredSvgNodeVecDestructorTag {
AzTessellatedColoredSvgNodeVecDestructorTag_DefaultRust,
AzTessellatedColoredSvgNodeVecDestructorTag_NoDestructor,
AzTessellatedColoredSvgNodeVecDestructorTag_External,
};
typedef enum AzTessellatedColoredSvgNodeVecDestructorTag AzTessellatedColoredSvgNodeVecDestructorTag;

struct AzTessellatedColoredSvgNodeVecDestructorVariant_DefaultRust { AzTessellatedColoredSvgNodeVecDestructorTag tag; };
typedef struct AzTessellatedColoredSvgNodeVecDestructorVariant_DefaultRust AzTessellatedColoredSvgNodeVecDestructorVariant_DefaultRust;
struct AzTessellatedColoredSvgNodeVecDestructorVariant_NoDestructor { AzTessellatedColoredSvgNodeVecDestructorTag tag; };
typedef struct AzTessellatedColoredSvgNodeVecDestructorVariant_NoDestructor AzTessellatedColoredSvgNodeVecDestructorVariant_NoDestructor;
struct AzTessellatedColoredSvgNodeVecDestructorVariant_External { AzTessellatedColoredSvgNodeVecDestructorTag tag; AzTessellatedColoredSvgNodeVecDestructorType payload; };
typedef struct AzTessellatedColoredSvgNodeVecDestructorVariant_External AzTessellatedColoredSvgNodeVecDestructorVariant_External;
union AzTessellatedColoredSvgNodeVecDestructor {
AzTessellatedColoredSvgNodeVecDestructorVariant_DefaultRust DefaultRust;
AzTessellatedColoredSvgNodeVecDestructorVariant_NoDestructor NoDestructor;
AzTessellatedColoredSvgNodeVecDestructorVariant_External External;
};
typedef union AzTessellatedColoredSvgNodeVecDestructor AzTessellatedColoredSvgNodeVecDestructor;

enum AzXmlNodeVecDestructorTag {
AzXmlNodeVecDestructorTag_DefaultRust,
AzXmlNodeVecDestructorTag_NoDestructor,
Expand Down Expand Up @@ -6734,7 +6758,7 @@ struct AzSvgVertexVec {
typedef struct AzSvgVertexVec AzSvgVertexVec;

struct AzSvgColoredVertexVec {
AzSvgVertex* ptr;
AzSvgColoredVertex* ptr;
size_t len;
size_t cap;
AzSvgColoredVertexVecDestructor destructor;
Expand Down Expand Up @@ -8620,6 +8644,14 @@ struct AzTessellatedSvgNodeVec {
};
typedef struct AzTessellatedSvgNodeVec AzTessellatedSvgNodeVec;

struct AzTessellatedColoredSvgNodeVec {
AzTessellatedColoredSvgNode* ptr;
size_t len;
size_t cap;
AzTessellatedColoredSvgNodeVecDestructor destructor;
};
typedef struct AzTessellatedColoredSvgNodeVec AzTessellatedColoredSvgNodeVec;

struct AzStyleTransformVec {
AzStyleTransform* ptr;
size_t len;
Expand Down Expand Up @@ -11144,6 +11176,9 @@ typedef struct AzCss AzCss;
#define AzTessellatedSvgNodeVecDestructor_DefaultRust { .DefaultRust = { .tag = AzTessellatedSvgNodeVecDestructorTag_DefaultRust } }
#define AzTessellatedSvgNodeVecDestructor_NoDestructor { .NoDestructor = { .tag = AzTessellatedSvgNodeVecDestructorTag_NoDestructor } }
#define AzTessellatedSvgNodeVecDestructor_External(v) { .External = { .tag = AzTessellatedSvgNodeVecDestructorTag_External, .payload = v } }
#define AzTessellatedColoredSvgNodeVecDestructor_DefaultRust { .DefaultRust = { .tag = AzTessellatedColoredSvgNodeVecDestructorTag_DefaultRust } }
#define AzTessellatedColoredSvgNodeVecDestructor_NoDestructor { .NoDestructor = { .tag = AzTessellatedColoredSvgNodeVecDestructorTag_NoDestructor } }
#define AzTessellatedColoredSvgNodeVecDestructor_External(v) { .External = { .tag = AzTessellatedColoredSvgNodeVecDestructorTag_External, .payload = v } }
#define AzXmlNodeVecDestructor_DefaultRust { .DefaultRust = { .tag = AzXmlNodeVecDestructorTag_DefaultRust } }
#define AzXmlNodeVecDestructor_NoDestructor { .NoDestructor = { .tag = AzXmlNodeVecDestructorTag_NoDestructor } }
#define AzXmlNodeVecDestructor_External(v) { .External = { .tag = AzXmlNodeVecDestructorTag_External, .payload = v } }
Expand Down Expand Up @@ -12205,6 +12240,10 @@ AzTessellatedSvgNode AzTessellatedSvgNodeVecArray[] = {};
#define AzTessellatedSvgNodeVec_fromConstArray(v) { .ptr = &v, .len = sizeof(v) / sizeof(AzTessellatedSvgNode), .cap = sizeof(v) / sizeof(AzTessellatedSvgNode), .destructor = { .NoDestructor = { .tag = AzTessellatedSvgNodeVecDestructorTag_NoDestructor, }, }, }
#define AzTessellatedSvgNodeVec_empty { .ptr = &AzTessellatedSvgNodeVecArray, .len = 0, .cap = 0, .destructor = { .NoDestructor = { .tag = AzTessellatedSvgNodeVecDestructorTag_NoDestructor, }, }, }

AzTessellatedColoredSvgNode AzTessellatedColoredSvgNodeVecArray[] = {};
#define AzTessellatedColoredSvgNodeVec_fromConstArray(v) { .ptr = &v, .len = sizeof(v) / sizeof(AzTessellatedColoredSvgNode), .cap = sizeof(v) / sizeof(AzTessellatedColoredSvgNode), .destructor = { .NoDestructor = { .tag = AzTessellatedColoredSvgNodeVecDestructorTag_NoDestructor, }, }, }
#define AzTessellatedColoredSvgNodeVec_empty { .ptr = &AzTessellatedColoredSvgNodeVecArray, .len = 0, .cap = 0, .destructor = { .NoDestructor = { .tag = AzTessellatedColoredSvgNodeVecDestructorTag_NoDestructor, }, }, }

AzStyleFontFamily AzStyleFontFamilyVecArray[] = {};
#define AzStyleFontFamilyVec_fromConstArray(v) { .ptr = &v, .len = sizeof(v) / sizeof(AzStyleFontFamily), .cap = sizeof(v) / sizeof(AzStyleFontFamily), .destructor = { .NoDestructor = { .tag = AzStyleFontFamilyVecDestructorTag_NoDestructor, }, }, }
#define AzStyleFontFamilyVec_empty { .ptr = &AzStyleFontFamilyVecArray, .len = 0, .cap = 0, .destructor = { .NoDestructor = { .tag = AzStyleFontFamilyVecDestructorTag_NoDestructor, }, }, }
Expand Down Expand Up @@ -12301,7 +12340,7 @@ AzSvgVertex AzSvgVertexVecArray[] = {};
#define AzSvgVertexVec_fromConstArray(v) { .ptr = &v, .len = sizeof(v) / sizeof(AzSvgVertex), .cap = sizeof(v) / sizeof(AzSvgVertex), .destructor = { .NoDestructor = { .tag = AzSvgVertexVecDestructorTag_NoDestructor, }, }, }
#define AzSvgVertexVec_empty { .ptr = &AzSvgVertexVecArray, .len = 0, .cap = 0, .destructor = { .NoDestructor = { .tag = AzSvgVertexVecDestructorTag_NoDestructor, }, }, }

AzSvgVertex AzSvgColoredVertexVecArray[] = {};
AzSvgColoredVertex AzSvgColoredVertexVecArray[] = {};
#define AzSvgColoredVertexVec_fromConstArray(v) { .ptr = &v, .len = sizeof(v) / sizeof(AzSvgColoredVertex), .cap = sizeof(v) / sizeof(AzSvgColoredVertex), .destructor = { .NoDestructor = { .tag = AzSvgColoredVertexVecDestructorTag_NoDestructor, }, }, }
#define AzSvgColoredVertexVec_empty { .ptr = &AzSvgColoredVertexVecArray, .len = 0, .cap = 0, .destructor = { .NoDestructor = { .tag = AzSvgColoredVertexVecDestructorTag_NoDestructor, }, }, }

Expand Down Expand Up @@ -13350,6 +13389,8 @@ extern DLLIMPORT void AzAccessibilityStateVec_delete(AzAccessibilityStateVec* re
extern DLLIMPORT void AzMenuItemVec_delete(AzMenuItemVec* restrict instance);
extern DLLIMPORT AzTessellatedSvgNodeVecRef AzTessellatedSvgNodeVec_asRefVec(const AzTessellatedSvgNodeVec* tessellatedsvgnodevec);
extern DLLIMPORT void AzTessellatedSvgNodeVec_delete(AzTessellatedSvgNodeVec* restrict instance);
extern DLLIMPORT AzTessellatedColoredSvgNodeVecRef AzTessellatedColoredSvgNodeVec_asRefVec(const AzTessellatedColoredSvgNodeVec* tessellatedcoloredsvgnodevec);
extern DLLIMPORT void AzTessellatedColoredSvgNodeVec_delete(AzTessellatedColoredSvgNodeVec* restrict instance);
extern DLLIMPORT void AzStyleFontFamilyVec_delete(AzStyleFontFamilyVec* restrict instance);
extern DLLIMPORT void AzXmlNodeVec_delete(AzXmlNodeVec* restrict instance);
extern DLLIMPORT void AzFmtArgVec_delete(AzFmtArgVec* restrict instance);
Expand Down Expand Up @@ -19251,6 +19292,20 @@ bool AzTessellatedSvgNodeVecDestructor_matchMutExternal(AzTessellatedSvgNodeVecD
return valid;
}

bool AzTessellatedColoredSvgNodeVecDestructor_matchRefExternal(const AzTessellatedColoredSvgNodeVecDestructor* value, const AzTessellatedColoredSvgNodeVecDestructorType** restrict out) {
const AzTessellatedColoredSvgNodeVecDestructorVariant_External* casted = (const AzTessellatedColoredSvgNodeVecDestructorVariant_External*)value;
bool valid = casted->tag == AzTessellatedColoredSvgNodeVecDestructorTag_External;
if (valid) { *out = &casted->payload; } else { *out = 0; }
return valid;
}

bool AzTessellatedColoredSvgNodeVecDestructor_matchMutExternal(AzTessellatedColoredSvgNodeVecDestructor* restrict value, AzTessellatedColoredSvgNodeVecDestructorType* restrict * restrict out) {
AzTessellatedColoredSvgNodeVecDestructorVariant_External* restrict casted = (AzTessellatedColoredSvgNodeVecDestructorVariant_External* restrict)value;
bool valid = casted->tag == AzTessellatedColoredSvgNodeVecDestructorTag_External;
if (valid) { *out = &casted->payload; } else { *out = 0; }
return valid;
}

bool AzXmlNodeVecDestructor_matchRefExternal(const AzXmlNodeVecDestructor* value, const AzXmlNodeVecDestructorType** restrict out) {
const AzXmlNodeVecDestructorVariant_External* casted = (const AzXmlNodeVecDestructorVariant_External*)value;
bool valid = casted->tag == AzXmlNodeVecDestructorTag_External;
Expand Down
33 changes: 32 additions & 1 deletion api/cpp/azul.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ namespace dll {
struct TessellatedSvgNodeVec;
using TessellatedSvgNodeVecDestructorType = void(*)(TessellatedSvgNodeVec* restrict);

struct TessellatedColoredSvgNodeVec;
using TessellatedColoredSvgNodeVecDestructorType = void(*)(TessellatedColoredSvgNodeVec* restrict);

struct XmlNodeVec;
using XmlNodeVecDestructorType = void(*)(XmlNodeVec* restrict);

Expand Down Expand Up @@ -2531,6 +2534,22 @@ namespace dll {
};


enum class TessellatedColoredSvgNodeVecDestructorTag {
DefaultRust,
NoDestructor,
External,
};

struct TessellatedColoredSvgNodeVecDestructorVariant_DefaultRust { TessellatedColoredSvgNodeVecDestructorTag tag; };
struct TessellatedColoredSvgNodeVecDestructorVariant_NoDestructor { TessellatedColoredSvgNodeVecDestructorTag tag; };
struct TessellatedColoredSvgNodeVecDestructorVariant_External { TessellatedColoredSvgNodeVecDestructorTag tag; TessellatedColoredSvgNodeVecDestructorType payload; };
union TessellatedColoredSvgNodeVecDestructor {
TessellatedColoredSvgNodeVecDestructorVariant_DefaultRust DefaultRust;
TessellatedColoredSvgNodeVecDestructorVariant_NoDestructor NoDestructor;
TessellatedColoredSvgNodeVecDestructorVariant_External External;
};


enum class XmlNodeVecDestructorTag {
DefaultRust,
NoDestructor,
Expand Down Expand Up @@ -6172,7 +6191,7 @@ namespace dll {
};

struct SvgColoredVertexVec {
SvgVertex* ptr;
SvgColoredVertex* ptr;
size_t len;
size_t cap;
SvgColoredVertexVecDestructor destructor;
Expand Down Expand Up @@ -7902,6 +7921,16 @@ namespace dll {
TessellatedSvgNodeVec() = delete; /* disable default constructor, use C++20 designated initializer instead */
};

struct TessellatedColoredSvgNodeVec {
TessellatedColoredSvgNode* ptr;
size_t len;
size_t cap;
TessellatedColoredSvgNodeVecDestructor destructor;
TessellatedColoredSvgNodeVec& operator=(const TessellatedColoredSvgNodeVec&) = delete; /* disable assignment operator, use std::move (default) or .clone() */
TessellatedColoredSvgNodeVec(const TessellatedColoredSvgNodeVec&) = delete; /* disable copy constructor, use explicit .clone() */
TessellatedColoredSvgNodeVec() = delete; /* disable default constructor, use C++20 designated initializer instead */
};

struct StyleTransformVec {
StyleTransform* ptr;
size_t len;
Expand Down Expand Up @@ -11208,6 +11237,8 @@ namespace dll {
void MenuItemVec_delete(MenuItemVec* restrict instance);
TessellatedSvgNodeVecRef TessellatedSvgNodeVec_asRefVec(const TessellatedSvgNodeVec* tessellatedsvgnodevec);
void TessellatedSvgNodeVec_delete(TessellatedSvgNodeVec* restrict instance);
TessellatedColoredSvgNodeVecRef TessellatedColoredSvgNodeVec_asRefVec(const TessellatedColoredSvgNodeVec* tessellatedcoloredsvgnodevec);
void TessellatedColoredSvgNodeVec_delete(TessellatedColoredSvgNodeVec* restrict instance);
void StyleFontFamilyVec_delete(StyleFontFamilyVec* restrict instance);
void XmlNodeVec_delete(XmlNodeVec* restrict instance);
void FmtArgVec_delete(FmtArgVec* restrict instance);
Expand Down
Loading

0 comments on commit cf0fbd4

Please sign in to comment.