use std::fmt::Debug;
use std::hash::Hash;
use std::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Not};
use cxx::ExternType;
mod private {
pub trait Sealed {}
}
pub trait QFlagRepr: Sized + private::Sealed {
type Int: From<Self>
+ Copy
+ Debug
+ Default
+ Eq
+ Ord
+ Hash
+ BitAnd<Output = Self::Int>
+ BitAndAssign
+ BitOr<Output = Self::Int>
+ BitOrAssign
+ BitXor<Output = Self::Int>
+ BitXorAssign
+ Not<Output = Self::Int>
+ ExternType<Kind = cxx::kind::Trivial>;
const ZERO: Self::Int;
}
macro_rules! impl_repr {
($t:ty, $i:ty) => {
impl private::Sealed for $t {}
impl QFlagRepr for $t {
type Int = $i;
const ZERO: Self::Int = 0;
}
};
}
impl_repr!(i8, i32);
impl_repr!(i16, i32);
impl_repr!(i32, i32);
impl_repr!(u8, u32);
impl_repr!(u16, u32);
impl_repr!(u32, u32);
#[cfg(cxxqt_qt_version_at_least_6_9)]
impl_repr!(i64, i64);
#[cfg(cxxqt_qt_version_at_least_6_9)]
impl_repr!(u64, u64);