Skip to main content

qtbridge_interfaces/qobject/
proxy_cpp_bridge.rs

1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only
3
4use qtbridge_runtime::qproxies::QCppProxy;
5use qtbridge_runtime::DynamicMetaObjectData;
6use qtbridge_type_lib::QMetaObject;
7use crate::impl_qcpp_proxy;
8
9use super::proxy_rust::QObjectProxyRust;
10#[cxx::bridge]
11pub mod ffi {
12    unsafe extern "C++" {
13        include!("qtbridge-type-lib/src/generated/core/qmetaobject/cpp/qmetaobject.h");
14        type QMetaObject = qtbridge_type_lib::QMetaObject;
15        include!("qtbridge-type-lib/src/generated/core/qmetatype/cpp/qmetatype.h");
16        type QMetaType = qtbridge_type_lib::QMetaType;
17        include!("qtbridge-runtime/src/cpp/dynamicmetaobjectdata.h");
18        type DynamicMetaObjectData = qtbridge_runtime::DynamicMetaObjectData;
19        include!("qtbridge-interfaces/src/qobject/proxy_rust_bridge.rs.h");
20        type QObjectProxyRust = super::QObjectProxyRust;
21    }
22    #[namespace = "rust::bridge"]
23    unsafe extern "C++" {
24        include!("qtbridge-interfaces/src/qobject/cpp/QObjectProxyCpp.h");
25        type QObjectProxyCpp;
26        # [Self = QObjectProxyCpp]
27        # [rust_name = create]
28        unsafe fn create(rust_proxy: *mut QObjectProxyRust, metaobject: *const DynamicMetaObjectData) -> *mut QObjectProxyCpp;
29        # [Self = QObjectProxyCpp]
30        # [rust_name = create_at]
31        unsafe fn createAt(rust_proxy: *mut QObjectProxyRust, metaobject: *const DynamicMetaObjectData, addr: *mut u8)
32        -> *mut QObjectProxyCpp;
33        # [Self = QObjectProxyCpp]
34        # [rust_name = static_qmeta_object]
35        fn baseStaticMetaObject() -> &'static QMetaObject;
36        # [Self = QObjectProxyCpp]
37        # [rust_name = size_of]
38        fn sizeOfProxy() -> usize;
39        # [Self = QObjectProxyCpp]
40        # [rust_name = align_of]
41        fn alignOfProxy() -> usize;
42        # [Self = QObjectProxyCpp]
43        # [rust_name = parser_status_cast]
44        fn parserStatusCast() -> i32;
45        # [rust_name = emit_signal_cpp]
46        fn emitSignal(self: Pin<&mut Self>, signal_name: &str, argv: &[*const u8]);
47    }
48}
49pub use ffi::QObjectProxyCpp;
50
51impl_qcpp_proxy!(QObjectProxyCpp, QObjectProxyRust);