148 Commits

Author SHA1 Message Date
Jacek Sieka
187c0a02ec Move go name mangling to emitgo
This change helps keep rules for each language separate by moving `go`
rules to `emitgo` while the C bindings stay closer to the original Qt
naming (that already is mostly C-safe).

Although it doesn't practically matter for go, it makes it slightly
easier to reuse the generated code in other languages which have
different keywords and naming conventions.

The cabi generator also gains a few helpers to help keep names
consistent across files which hopefully aids reading the generator code
- it did for me at least;)

The rule that converts under_score to CamelCase is left for another day
since moving it turns out to be more invasive due to name collision
handling - when underscores are kept, there are fewer name conflicts
which ends up causing name changes in  the public go api when done
naively.
2025-02-01 13:44:32 +13:00
Jacek Sieka
439f3a1fb5 const in callbacks
Since callback signatures are now generated in C++, might as well go
ahead and retain `const` and the pointer type, removing a `const_cast`
in the process.
2025-01-27 14:14:23 +01:00
883ba8c131 genbindings: change AllInherits() to return lookupResultClass 2025-01-19 16:38:27 +13:00
3697849067 genbindings: use dynamic_cast's return value to verify override is safe 2025-01-18 17:57:16 +13:00
Jacek Sieka
929e4e630a Simplify delete
The subclassing structure in `miqt` is such that nothing ever inherits
from `MiqtVirtual` - also, for `MiqtVirtual` to work correctly when Qt
deletes an instance part of a tree of widgets, the technique can only be
used with types that already have a virtual destructor.

Therefore:
* make `MiqtVirtual` final to ensure nothing inherits from it by
accident
* remove `virtual` inheritance of its base class - since there is no MI
invonved and no further inheritance, there can also not be any diamond
inheritance structures - removing `virtual` makes inheritance a bit
cheaper
* remove `isSubclass` from `delete` function - C++ already calls the
most inherited destructor
* mark destructor `override` to verify said assumption
2025-01-18 17:46:50 +13:00
3a63a129ae
Merge pull request #124 from arnetheduck/cgo-export
Avoid dependency on exported go header
2025-01-11 15:21:00 +13:00
Jacek Sieka
a0c6344ecd Avoid dependency on exported go header
The expected type of the callback is already known from the AST - this
change reduces dependency on cgo specifics and makes the generated C ABI
entirely cgo-independent - in particular, there is no need to include
`_cgo_export.h` any more.
2025-01-07 12:55:40 +01:00
Jacek Sieka
765592cca2 Small fixes
* `stdlib` is not used / needed
* `miqt_strdup` doesn't exist
* consistently use nameprefix for `_ret`
2025-01-07 09:29:45 +01:00
641dbd6d21 genbindings/cabi: add automatic -D_Bool=bool handling 2024-12-11 19:55:32 +13:00
5a7a46e28f genbindings: use separate virtbase helper to get base pointers 2024-12-07 17:44:27 +13:00
5b25ae9cad genbindings: enums by reference also need c-style cast 2024-11-27 18:00:23 +13:00
bfbaeaf514 genbindings: add missing header includes for some container types 2024-11-26 20:09:30 +13:00
25e10f2824 genbindings/cabi: QFlags<>& use C-style cast 2024-11-26 19:52:29 +13:00
2a502f24ff genbindings: change simple operator== to use infix syntax 2024-11-22 18:58:56 +13:00
bbc75b8ef1 linuxonly: fix ifdef quirks for building on windows 2024-11-19 20:45:45 +13:00
b50870b9d9 genbindings: intptr_t-qintptr pointer casts require C-style casts 2024-11-19 20:00:35 +13:00
90de7178f2 genbindings: fix some cases of missing :: escaping 2024-11-19 19:59:55 +13:00
40abeecd54 genbindings/subclassing: accurate pointer type management for subclasses 2024-11-19 19:28:30 +13:00
6fa97722c5 genbindings: delete either subclass or direct class 2024-11-19 19:28:00 +13:00
fb56258334 genbindings: constructors return every subclass pointer 2024-11-19 19:27:19 +13:00
eca87471ee genbindings/types: pointer and return type fixes 2024-11-19 19:25:48 +13:00
943ccf7b3a genbindings: subclass support for all virtual methods (3/3) 2024-11-19 19:17:37 +13:00
58f212303e genbindings: subclass support for all virtual methods (2/3) 2024-11-19 19:17:37 +13:00
aa2fdf98ca genbindings: subclass support for all virtual methods (1/3) 2024-11-19 19:17:36 +13:00
d07996d2ed genbindings/headers: more detailed include guards, use pragma once 2024-11-17 19:18:02 +13:00
f6acae63bb genbindings/cabi: normalize container comments 2024-11-17 19:17:48 +13:00
58ec6e1821 genbindings: add QPair<> support 2024-11-17 19:17:31 +13:00
dc39b7ca65 genbindings/containers: fixes for special characters in container names 2024-11-17 19:17:22 +13:00
598b8bdb89 genbindings/cabi: inline return statements in emitAssignCppToCabi 2024-11-17 19:17:09 +13:00
caee076af8 genbindings/go: implement cabi type roundtrips for pointer types 2024-11-17 19:17:03 +13:00
5a3c3556a1 genbindings/intermediate: add Void() helper method 2024-11-17 19:16:51 +13:00
e41f991a23 qnetwork: add support in genbindings 2024-11-06 18:38:25 +13:00
a009008525 genbindings: add qmap/qhash support 2024-11-04 21:33:45 +13:00
69011a5acb genbindings/cabi: refactor and simplify getReferencedTypes 2024-11-04 20:48:56 +13:00
b53707c7cf genbindings: pass miqt_array in CABI by value 2024-11-04 20:18:11 +13:00
ba423f153a genbindings: implement "BecomesNonConstInVersion" quirk support 2024-10-26 12:35:01 +13:00
aed94883cf genbindings: escape hyphens in generated header include guards 2024-10-21 19:10:31 +13:00
301fa27e83 genbindings/main: uniform handling for package subdirectories 2024-10-21 19:10:31 +13:00
bb0132e0d5 genbindings/qbytearray: project as []byte 2024-10-19 13:06:53 +13:00
434c45273a miqt: pass all miqt_string by value, not by pointer 2024-10-19 13:06:53 +13:00
f87002914d genbindings/cabi: emit class typedef even if there is no header 2024-10-19 13:06:53 +13:00
88ef4e922c genbindings: multi-package support 2024-10-16 18:07:05 +13:00
562590fa96 libmiqt: move binding helpers to standalone package, support const_char 2024-10-16 18:05:07 +13:00
0154e3507b genbindings: marshal cgo.Handle via intptr_t instead of void* 2024-10-13 19:05:52 +13:00
c783029317 genbindings/integers: c-style cast for qsizetype, qintptr pointers 2024-10-11 18:40:12 +13:00
f733ce29bc genbindings/signals: support connecting to a const signal 2024-10-11 18:40:12 +13:00
60600530c6 genbindings/ints: ssize_t support 2024-10-11 18:40:06 +13:00
869e316715 genbindings/qflags: emit qflags as inner type 2024-09-20 18:41:22 +12:00
e2fd134509 genbindings/qset: fixes for qset marshalling 2024-09-18 13:27:53 +12:00
eae85ac325 genbindings: preserve const/ptr attributes through typedefs 2024-09-18 13:08:18 +12:00