arkui_sys/native_interface/
native_interface_ffi.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// automatically generated by rust-bindgen 0.71.1

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::native_type::*;

#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
impl ArkUI_NativeAPIVariantKind {
    /// API related to UI components. For details, see the struct definition in <arkui/native_node.h>.
    pub const ARKUI_NATIVE_NODE: ArkUI_NativeAPIVariantKind = ArkUI_NativeAPIVariantKind(0);
}
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
impl ArkUI_NativeAPIVariantKind {
    /// API related to dialog boxes. For details, see the struct definition in <arkui/native_dialog.h>.
    pub const ARKUI_NATIVE_DIALOG: ArkUI_NativeAPIVariantKind = ArkUI_NativeAPIVariantKind(1);
}
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
impl ArkUI_NativeAPIVariantKind {
    /// API related to gestures. For details, see the struct definition in <arkui/native_gesture.h>.
    pub const ARKUI_NATIVE_GESTURE: ArkUI_NativeAPIVariantKind = ArkUI_NativeAPIVariantKind(2);
}
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
impl ArkUI_NativeAPIVariantKind {
    /// API related to animations. For details, see the struct definition in <arkui/native_animate.h>.
    pub const ARKUI_NATIVE_ANIMATE: ArkUI_NativeAPIVariantKind = ArkUI_NativeAPIVariantKind(3);
}
#[repr(transparent)]
/// Defines the native API types.
///
///
/// Available since API-level: 12
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
#[derive(Clone, Hash, PartialEq, Eq)]
pub struct ArkUI_NativeAPIVariantKind(pub ::core::ffi::c_uint);
extern "C" {
    /// Obtains the native API set of a specified type.
    ///
    /// # Arguments
    ///
    /// * `type` - Indicates the type of the native API set provided by ArkUI, for example, <b>ARKUI_NATIVE_NODE</b>
    /// and <b>ARKUI_NATIVE_GESTURE</b>.
    ///
    /// * `sturctName` - Indicates the name of a native struct defined in the corresponding header file, for example,
    /// <b>ArkUI_NativeNodeAPI_1</b> in <arkui/native_node.h>.
    ///
    /// # Returns
    ///
    /// * Returns the pointer to the abstract native API, which can be used after being converted into a specific type.
    /// ```cpp
    /// #include<arkui/native_interface.h>
    /// #include<arkui/native_node.h>
    /// #include<arkui/native_gesture.h>
    ///
    /// auto* anyNativeAPI = OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1");
    /// if (anyNativeAPI) {
    /// auto nativeNodeApi = reinterpret_cast<ArkUI_NativeNodeAPI_1*>(anyNativeAPI);
    /// }
    /// auto anyGestureAPI = OH_ArkUI_QueryModuleInterface(ARKUI_NATIVE_GESTURE, "ArkUI_NativeGestureAPI_1");
    /// if (anyNativeAPI) {
    /// auto basicGestureApi = reinterpret_cast<ArkUI_NativeGestureAPI_1*>(anyGestureAPI);
    /// }
    /// ```
    ///
    ///
    /// Available since API-level: 12
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_ArkUI_QueryModuleInterfaceByName(
        type_: ArkUI_NativeAPIVariantKind,
        structName: *const ::core::ffi::c_char,
    ) -> *mut ::core::ffi::c_void;
}