git » sdk » commit b10908f

Export to C as well

author Stephen Paul Weber
2026-01-12 20:41:47 UTC
committer Stephen Paul Weber
2026-01-12 20:41:47 UTC
parent 01227ce38a59bceda7ea8aa9052d9289447f9067

Export to C as well

borogove/Command.hx +15 -3

diff --git a/borogove/Command.hx b/borogove/Command.hx
index 8ed00e6..45f83ff 100644
--- a/borogove/Command.hx
+++ b/borogove/Command.hx
@@ -6,8 +6,16 @@ import borogove.DataForm;
 import borogove.Form;
 import borogove.queries.CommandExecute;
 
+#if cpp
+import HaxeCBridge;
+#end
+
 @:expose
 @:allow(borogove.CommandSession)
+#if cpp
+@:build(HaxeCBridge.expose())
+@:build(HaxeSwiftBridge.expose())
+#end
 class Command {
 	public final name: String;
 	private final jid: JID;
@@ -31,6 +39,10 @@ class Command {
 }
 
 @:expose
+#if cpp
+@:build(HaxeCBridge.expose())
+@:build(HaxeSwiftBridge.expose())
+#end
 class CommandSession {
 	public final name: String;
 	public final status: String;
@@ -59,20 +71,20 @@ class CommandSession {
 			>,
 			js.html.FormData
 		>> = null,
-		formIdx: Null<Int> = null
+		formIdx: Int = 0
 	)
 	#else
 	public function execute(
 		action: Null<String> = null,
 		data: Null<FormSubmitBuilder> = null,
-		formIdx: Null<Int> = null
+		formIdx: Int = 0
 	)
 	#end
 	: Promise<CommandSession> {
 		final extendedAction = action != null && !["prev", "next", "complete", "execute", "cancel"].contains(action);
 		var toSubmit = null;
 		if (data != null || extendedAction) {
-			toSubmit = forms[formIdx ?? 0].submit(data);
+			toSubmit = forms[formIdx].submit(data);
 			if (toSubmit == null && action != "cancel" && action != "prev") return Promise.reject("Invalid submission");
 		}