C++: Include AccessibleRole in the slint::testing namespace docs

This commit is contained in:
Simon Hausmann 2024-06-13 11:06:34 +02:00 committed by Simon Hausmann
parent c76f9fe795
commit 2be4b320b9

View file

@ -28,14 +28,30 @@ fn enums(path: &Path) -> anyhow::Result<()> {
writeln!(enums_priv, "using slint::PointerEventButton;")?; writeln!(enums_priv, "using slint::PointerEventButton;")?;
&mut enums_pub &mut enums_pub
}}; }};
(AccessibleRole) => {{
writeln!(enums_priv, "using slint::testing::AccessibleRole;")?;
&mut enums_pub
}};
($_:ident) => { ($_:ident) => {
&mut enums_priv &mut enums_priv
}; };
} }
macro_rules! enum_sub_namespace {
(AccessibleRole) => {{
Some("testing")
}};
($_:ident) => {
None
};
}
macro_rules! print_enums { macro_rules! print_enums {
($( $(#[doc = $enum_doc:literal])* $(#[non_exhaustive])? enum $Name:ident { $( $(#[doc = $value_doc:literal])* $Value:ident,)* })*) => { ($( $(#[doc = $enum_doc:literal])* $(#[non_exhaustive])? enum $Name:ident { $( $(#[doc = $value_doc:literal])* $Value:ident,)* })*) => {
$( $(
let file = enum_file!($Name); let file = enum_file!($Name);
let namespace: Option<&'static str> = enum_sub_namespace!($Name);
if let Some(ns) = namespace {
writeln!(file, "namespace {} {{", ns)?;
}
$(writeln!(file, "///{}", $enum_doc)?;)* $(writeln!(file, "///{}", $enum_doc)?;)*
writeln!(file, "enum class {} {{", stringify!($Name))?; writeln!(file, "enum class {} {{", stringify!($Name))?;
$( $(
@ -43,6 +59,9 @@ fn enums(path: &Path) -> anyhow::Result<()> {
writeln!(file, " {},", stringify!($Value).trim_start_matches("r#"))?; writeln!(file, " {},", stringify!($Value).trim_start_matches("r#"))?;
)* )*
writeln!(file, "}};")?; writeln!(file, "}};")?;
if namespace.is_some() {
writeln!(file, "}}")?;
}
)* )*
} }
} }