xsd_parser/types/info/
complex.rsuse crate::schema::xs::{
Annotation, NamespaceListType, NotNamespaceType, ProcessContentsType, QnameListAType,
QnameListType,
};
use crate::schema::{MaxOccurs, MinOccurs};
use crate::types::{Ident, TypeEq, Types};
use super::{AttributesInfo, Base, ElementsInfo};
#[derive(Debug, Clone)]
pub struct ComplexInfo {
pub base: Base,
pub content: Option<Ident>,
pub min_occurs: MinOccurs,
pub max_occurs: MaxOccurs,
pub is_abstract: bool,
pub attributes: AttributesInfo,
pub any_attribute: Option<AnyAttributeInfo>,
}
#[derive(Default, Debug, Clone)]
pub struct GroupInfo {
pub any: Option<AnyInfo>,
pub elements: ElementsInfo,
}
#[allow(missing_docs)]
#[derive(Default, Debug, Clone, Eq, PartialEq)]
pub struct AnyInfo {
pub id: Option<String>,
pub namespace: Option<NamespaceListType>,
pub not_namespace: Option<NotNamespaceType>,
pub process_contents: Option<ProcessContentsType>,
pub not_q_name: Option<QnameListType>,
pub min_occurs: Option<MinOccurs>,
pub max_occurs: Option<MaxOccurs>,
pub annotation: Option<Annotation>,
}
#[allow(missing_docs)]
#[derive(Default, Debug, Clone, Eq, PartialEq)]
pub struct AnyAttributeInfo {
pub id: Option<String>,
pub namespace: Option<NamespaceListType>,
pub not_namespace: Option<NotNamespaceType>,
pub process_contents: Option<ProcessContentsType>,
pub not_q_name: Option<QnameListAType>,
pub annotation: Option<Annotation>,
}
impl TypeEq for GroupInfo {
fn type_eq(&self, other: &Self, types: &Types) -> bool {
let Self { any, elements } = self;
any.eq(&other.any) && elements.type_eq(&other.elements, types)
}
}
impl Default for ComplexInfo {
fn default() -> Self {
Self {
base: Base::None,
content: None,
min_occurs: 1,
max_occurs: MaxOccurs::Bounded(1),
is_abstract: false,
attributes: AttributesInfo::default(),
any_attribute: None,
}
}
}
impl TypeEq for ComplexInfo {
fn type_eq(&self, other: &Self, types: &Types) -> bool {
let Self {
base,
content,
min_occurs,
max_occurs,
is_abstract,
attributes,
any_attribute,
} = self;
base.type_eq(&other.base, types)
&& content.type_eq(&other.content, types)
&& min_occurs.eq(&other.min_occurs)
&& max_occurs.eq(&other.max_occurs)
&& is_abstract.eq(&other.is_abstract)
&& attributes.type_eq(&other.attributes, types)
&& any_attribute.eq(&other.any_attribute)
}
}