2024-02-12 12:07:01 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct TypeSpec {
|
|
|
|
pub typemap: Vec<QmlTypeMapping>,
|
|
|
|
pub classes: Vec<Class>,
|
|
|
|
pub gadgets: Vec<Gadget>,
|
|
|
|
pub enums: Vec<Enum>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for TypeSpec {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
|
|
|
typemap: Vec::new(),
|
|
|
|
classes: Vec::new(),
|
|
|
|
gadgets: Vec::new(),
|
|
|
|
enums: Vec::new(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct QmlTypeMapping {
|
|
|
|
pub name: String,
|
|
|
|
pub cname: String,
|
|
|
|
pub module: Option<String>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct Class {
|
|
|
|
pub name: String,
|
|
|
|
pub module: String,
|
|
|
|
pub description: Option<String>,
|
|
|
|
pub details: Option<String>,
|
|
|
|
pub superclass: String,
|
|
|
|
pub singleton: bool,
|
|
|
|
pub uncreatable: bool,
|
|
|
|
pub properties: Vec<Property>,
|
|
|
|
pub functions: Vec<Function>,
|
2024-02-19 01:38:55 +00:00
|
|
|
pub signals: Vec<Signal>,
|
2024-05-19 09:20:32 +00:00
|
|
|
pub enums: Vec<Enum>,
|
2024-02-12 12:07:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct Gadget {
|
|
|
|
pub cname: String,
|
|
|
|
pub properties: Vec<Property>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct Property {
|
|
|
|
#[serde(rename = "type")]
|
|
|
|
pub type_: String,
|
|
|
|
pub name: String,
|
|
|
|
pub details: Option<String>,
|
|
|
|
pub readable: bool,
|
|
|
|
pub writable: bool,
|
|
|
|
pub default: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct Function {
|
|
|
|
pub ret: String,
|
|
|
|
pub name: String,
|
|
|
|
pub details: Option<String>,
|
2024-02-19 01:38:55 +00:00
|
|
|
pub params: Vec<FnParam>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct Signal {
|
|
|
|
pub name: String,
|
|
|
|
pub details: Option<String>,
|
|
|
|
pub params: Vec<FnParam>,
|
2024-02-12 12:07:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct FnParam {
|
|
|
|
#[serde(rename = "type")]
|
|
|
|
pub type_: String,
|
|
|
|
pub name: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct Enum {
|
|
|
|
pub name: String,
|
|
|
|
pub cname: Option<String>,
|
|
|
|
pub module: Option<String>,
|
|
|
|
pub description: Option<String>,
|
|
|
|
pub details: Option<String>,
|
|
|
|
pub varaints: Vec<Variant>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct Variant {
|
|
|
|
pub name: String,
|
|
|
|
pub details: Option<String>,
|
|
|
|
}
|