ohos-rawfile-sys 0.1.3

Raw Bindings to the rawfile API of OpenHarmony
Documentation
// automatically generated by rust-bindgen 0.71.1

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#[cfg(doc)]
use crate::raw_dir::OH_ResourceManager_CloseRawDir;
use crate::raw_dir::RawDir;
#[cfg(doc)]
use crate::raw_file::{OH_ResourceManager_CloseRawFile, OH_ResourceManager_CloseRawFile64};
use crate::RawFile;
#[cfg(feature = "api-11")]
use crate::RawFile64;
use ohos_sys_opaque_types::{napi_env, napi_value};

/// Presents the resource manager.
///
/// This class encapsulates the native implementation of the JavaScript resource manager. The pointer to a
/// <b>ResourceManager</b> object can be obtained by calling [`OH_ResourceManager_InitNativeResourceManager`].
///
///
/// Available since API-level: 8
///
/// Version: 1.0
#[repr(C)]
pub struct NativeResourceManager {
    _unused: [u8; 0],
}
extern "C" {
    /// Obtains the native resource manager based on the JavaScipt resource manager.
    ///
    /// You need to obtain the resource manager to process raw files as required.
    ///
    /// # Arguments
    ///
    /// * `env` - Indicates the pointer to the JavaScipt Native Interface (napi) environment.
    ///
    /// * `jsResMgr` - Indicates the JavaScipt resource manager.
    ///
    /// # Returns
    ///
    /// * Returns the pointer to [`NativeResourceManager`]. If failed returns nullptr.
    ///
    /// Available since API-level: 8
    ///
    /// Version: 1.0
    pub fn OH_ResourceManager_InitNativeResourceManager(
        env: napi_env,
        jsResMgr: napi_value,
    ) -> *mut NativeResourceManager;
    /// Releases the native resource manager.
    ///
    ///
    ///
    /// # Arguments
    ///
    /// * `resMgr` - Indicates the pointer to [`RawDir`].
    ///
    /// Available since API-level: 8
    ///
    /// Version: 1.0
    pub fn OH_ResourceManager_ReleaseNativeResourceManager(resMgr: *mut NativeResourceManager);
    /// Opens a raw file directory.
    ///
    /// After it is opened, you can traverse its raw files.
    ///
    /// # Arguments
    ///
    /// * `mgr` - Indicates the pointer to [`NativeResourceManager`] obtained by calling
    /// [`OH_ResourceManager_InitNativeResourceManager`].
    ///
    /// * `dirName` - Indicates the name of the raw file directory to open. You can pass an empty string to open the
    /// top-level raw file directory.
    ///
    /// # Returns
    ///
    /// * Returns the pointer to [`RawDir`]. If failed or mgr is nullptr also returns nullptr.
    /// After you finish using the pointer, call [`OH_ResourceManager_CloseRawDir`] to release it.
    /// [`OH_ResourceManager_InitNativeResourceManager`] [`OH_ResourceManager_CloseRawDir`]
    /// Available since API-level: 8
    ///
    /// Version: 1.0
    pub fn OH_ResourceManager_OpenRawDir(
        mgr: *const NativeResourceManager,
        dirName: *const ::core::ffi::c_char,
    ) -> *mut RawDir;
    /// Opens a raw file.
    ///
    /// After it is opened, you can read its data.
    ///
    /// # Arguments
    ///
    /// * `mgr` - Indicates the pointer to [`NativeResourceManager`] obtained by calling
    /// [`OH_ResourceManager_InitNativeResourceManager`].
    ///
    /// * `fileName` - Indicates the file path relative to the top-level raw file directory.
    ///
    /// # Returns
    ///
    /// * Returns the pointer to [`RawFile`]. If failed or mgr and fileName is nullptr also returns nullptr.
    /// After you finish using the pointer, call [`OH_ResourceManager_CloseRawFile`] to release it.
    /// [`OH_ResourceManager_InitNativeResourceManager`] [`OH_ResourceManager_CloseRawFile`]
    /// Available since API-level: 8
    ///
    /// Version: 1.0
    pub fn OH_ResourceManager_OpenRawFile(
        mgr: *const NativeResourceManager,
        fileName: *const ::core::ffi::c_char,
    ) -> *mut RawFile;
    /// Opens a raw file.
    ///
    /// After it is opened, you can read its data.
    ///
    /// # Arguments
    ///
    /// * `mgr` - Indicates the pointer to [`NativeResourceManager`] obtained by calling
    /// [`OH_ResourceManager_InitNativeResourceManager`].
    ///
    /// * `fileName` - Indicates the file path relative to the top-level raw file directory.
    ///
    /// # Returns
    ///
    /// * Returns the pointer to [`RawFile64`]. If failed or mgr and fileName is nullptr also returns nullptr.
    /// After you finish using the pointer, call [`OH_ResourceManager_CloseRawFile64`] to release it.
    /// [`OH_ResourceManager_InitNativeResourceManager`] [`OH_ResourceManager_CloseRawFile64`]
    /// Available since API-level: 11
    ///
    /// Version: 1.0
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_ResourceManager_OpenRawFile64(
        mgr: *const NativeResourceManager,
        fileName: *const ::core::ffi::c_char,
    ) -> *mut RawFile64;
    /// Whether the rawfile resource is a directory or not.
    ///
    /// # Arguments
    ///
    /// * `mgr` - Indicates the pointer to [`NativeResourceManager`] obtained by calling
    /// [`OH_ResourceManager_InitNativeResourceManager`].
    ///
    /// * `path` - Indicates the rawfile resource relative path.
    ///
    /// # Returns
    ///
    /// * Returns true means the file path is directory, else false.
    ///
    /// Available since API-level: 12
    ///
    /// Version: 1.0
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_ResourceManager_IsRawDir(
        mgr: *const NativeResourceManager,
        path: *const ::core::ffi::c_char,
    ) -> bool;
}