xee_interpreter/atomic/
types.rs1use xee_schema_type::Xs;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
4pub enum IntegerType {
5 Integer,
6 NonPositiveInteger,
7 NegativeInteger,
8 NonNegativeInteger,
9 PositiveInteger,
10 Long,
11 Int,
12 Short,
13 Byte,
14 UnsignedLong,
15 UnsignedInt,
16 UnsignedShort,
17 UnsignedByte,
18}
19
20impl IntegerType {
21 pub(crate) fn schema_type(&self) -> Xs {
22 match self {
23 IntegerType::Integer => Xs::Integer,
24 IntegerType::Long => Xs::Long,
25 IntegerType::Int => Xs::Int,
26 IntegerType::Short => Xs::Short,
27 IntegerType::Byte => Xs::Byte,
28 IntegerType::UnsignedLong => Xs::UnsignedLong,
29 IntegerType::UnsignedInt => Xs::UnsignedInt,
30 IntegerType::UnsignedShort => Xs::UnsignedShort,
31 IntegerType::UnsignedByte => Xs::UnsignedByte,
32 IntegerType::NonPositiveInteger => Xs::NonPositiveInteger,
33 IntegerType::NegativeInteger => Xs::NegativeInteger,
34 IntegerType::NonNegativeInteger => Xs::NonNegativeInteger,
35 IntegerType::PositiveInteger => Xs::PositiveInteger,
36 }
37 }
38}
39
40#[allow(clippy::upper_case_acronyms)]
42#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
43pub enum StringType {
44 String,
46 NormalizedString,
48 Token,
50 Language,
52 NMTOKEN,
54 Name,
56 NCName,
58 ID,
60 IDREF,
62 ENTITY,
64 AnyURI,
67}
68
69impl StringType {
70 pub(crate) fn schema_type(&self) -> Xs {
71 match self {
72 StringType::String => Xs::String,
73 StringType::NormalizedString => Xs::NormalizedString,
74 StringType::Token => Xs::Token,
75 StringType::Language => Xs::Language,
76 StringType::NMTOKEN => Xs::NMTOKEN,
77 StringType::Name => Xs::Name,
78 StringType::NCName => Xs::NCName,
79 StringType::ID => Xs::ID,
80 StringType::IDREF => Xs::IDREF,
81 StringType::ENTITY => Xs::ENTITY,
82 StringType::AnyURI => Xs::AnyURI,
83 }
84 }
85}
86
87#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
89pub enum BinaryType {
90 Base64,
92 Hex,
94}
95
96impl BinaryType {
97 pub(crate) fn schema_type(&self) -> Xs {
98 match self {
99 BinaryType::Base64 => Xs::Base64Binary,
100 BinaryType::Hex => Xs::HexBinary,
101 }
102 }
103}