Skip to main content

ohos_drawing_sys/error_code/
error_code_ffi.rs

1// automatically generated by rust-bindgen 0.71.1
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6use crate::types::*;
7
8pub type DrawingResult = Result<(), DrawingErrorCode>;
9#[cfg(feature = "api-12")]
10#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
11impl DrawingErrorCode {
12    /// Permission verification failed.
13    pub const NO_PERMISSION: DrawingErrorCode =
14        DrawingErrorCode(const { core::num::NonZero::new(201).unwrap() });
15    /// Invalid input parameter. For example, the pointer in the parameter is a nullptr.
16    pub const INVALID_PARAMETER: DrawingErrorCode =
17        DrawingErrorCode(const { core::num::NonZero::new(401).unwrap() });
18    /// The parameter is not in the valid range.
19    pub const PARAMETER_OUT_OF_RANGE: DrawingErrorCode =
20        DrawingErrorCode(const { core::num::NonZero::new(26200001).unwrap() });
21    /// mem allocate failed.
22    ///
23    /// Available since API-level: 13
24    #[cfg(feature = "api-13")]
25    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
26    pub const ALLOCATION_FAILED: DrawingErrorCode =
27        DrawingErrorCode(const { core::num::NonZero::new(26200002).unwrap() });
28    /// The attribute id is not recognized or supported.
29    ///
30    /// Available since API-level: 21
31    #[cfg(feature = "api-21")]
32    #[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
33    pub const ATTRIBUTE_ID_MISMATCH: DrawingErrorCode =
34        DrawingErrorCode(const { core::num::NonZero::new(26200003).unwrap() });
35    /// incorrect input parameter. The possible cause is that the provided pointer is null.
36    ///
37    /// Available since API-level: 22
38    #[cfg(feature = "api-22")]
39    #[cfg_attr(docsrs, doc(cfg(feature = "api-22")))]
40    pub const INCORRECT_PARAMETER: DrawingErrorCode =
41        DrawingErrorCode(const { core::num::NonZero::new(26200004).unwrap() });
42    /// File not found. The specified file does not exist or the path is incorrect..
43    ///
44    /// Available since API-level: 23
45    #[cfg(feature = "api-23")]
46    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
47    pub const FILE_NOT_FOUND: DrawingErrorCode =
48        DrawingErrorCode(const { core::num::NonZero::new(26200005).unwrap() });
49    /// Failed to open the file. The file cannot be opened due to permission or I/O issues.
50    ///
51    /// Available since API-level: 23
52    #[cfg(feature = "api-23")]
53    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
54    pub const OPEN_FILE_FAILED: DrawingErrorCode =
55        DrawingErrorCode(const { core::num::NonZero::new(26200006).unwrap() });
56    /// File seek failed. The system failed to reposition the file read pointer..
57    ///
58    /// Available since API-level: 23
59    #[cfg(feature = "api-23")]
60    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
61    pub const FILE_SEEK_FAILED: DrawingErrorCode =
62        DrawingErrorCode(const { core::num::NonZero::new(26200007).unwrap() });
63    /// Failed to get the file size. The system was unable to obtain the file size information.
64    ///
65    /// Available since API-level: 23
66    #[cfg(feature = "api-23")]
67    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
68    pub const GET_FILE_SIZE_FAILED: DrawingErrorCode =
69        DrawingErrorCode(const { core::num::NonZero::new(26200008).unwrap() });
70    /// Failed to read the file. The file could not be read completely or contains unreadable data.
71    ///
72    /// Available since API-level: 23
73    #[cfg(feature = "api-23")]
74    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
75    pub const READ_FILE_FAILED: DrawingErrorCode =
76        DrawingErrorCode(const { core::num::NonZero::new(26200009).unwrap() });
77    /// Empty file. The specified file is empty and contains no valid data.
78    ///
79    /// Available since API-level: 23
80    #[cfg(feature = "api-23")]
81    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
82    pub const EMPTY_FILE: DrawingErrorCode =
83        DrawingErrorCode(const { core::num::NonZero::new(26200010).unwrap() });
84    /// Corrupted file. The file content is invalid or damaged and cannot be parsed.
85    ///
86    /// Available since API-level: 23
87    #[cfg(feature = "api-23")]
88    #[cfg_attr(docsrs, doc(cfg(feature = "api-23")))]
89    pub const FILE_CORRUPTED: DrawingErrorCode =
90        DrawingErrorCode(const { core::num::NonZero::new(26200011).unwrap() });
91}
92#[repr(transparent)]
93/// Enumerates error codes of drawing.
94///
95/// Available since API-level: 12
96#[cfg(feature = "api-12")]
97#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
98#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
99pub struct DrawingErrorCode(pub core::num::NonZero<::core::ffi::c_uint>);
100extern "C" {
101    /// Obtains the error code of the drawing module.
102    ///
103    ///
104    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
105    ///
106    /// # Returns
107    ///
108    /// * Returns the error code.
109    ///
110    /// Available since API-level: 12
111    ///
112    /// Version: 1.0
113    #[cfg(feature = "api-12")]
114    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
115    pub fn OH_Drawing_ErrorCodeGet() -> DrawingResult;
116    /// Resets the error code of the drawing module to OH_DRAWING_SUCCESS.
117    ///
118    ///
119    /// Required System Capabilities: SystemCapability.Graphic.Graphic2D.NativeDrawing
120    ///
121    /// Available since API-level: 18
122    ///
123    /// Version: 1.0
124    #[cfg(feature = "api-18")]
125    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
126    pub fn OH_Drawing_ErrorCodeReset();
127}