#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ClassFlags(pub(crate) u16);
#[derive(Debug, Clone, Copy)]
pub struct InnerClassFlags(u16);
#[derive(Debug, Clone, Copy)]
pub struct MethodFlags(u16);
#[derive(Debug, Clone, Copy)]
pub struct MethodParamFlags(u16);
#[derive(Debug, Clone, Copy)]
pub struct FieldFlags(u16);
impl ClassFlags {
pub fn new(value: u16) -> Self {
Self(value)
}
pub fn is_public(&self) -> bool {
self.0 & 0x0001 != 0
}
pub fn is_final(&self) -> bool {
self.0 & 0x0010 != 0
}
pub fn is_super(&self) -> bool {
self.0 & 0x0020 != 0
}
pub fn is_interface(&self) -> bool {
self.0 & 0x0200 != 0
}
pub fn is_abstract(&self) -> bool {
self.0 & 0x0400 != 0
}
pub fn is_synthetic(&self) -> bool {
self.0 & 0x1000 != 0
}
pub fn is_annotation(&self) -> bool {
self.0 & 0x2000 != 0
}
pub fn is_enum(&self) -> bool {
self.0 & 0x4000 != 0
}
pub fn is_module(&self) -> bool {
self.0 & 0x8000 != 0
}
pub fn get_raw(&self) -> &u16 {
&self.0
}
pub fn get_raw_i32(&self) -> i32 {
self.0 as i32
}
}
impl InnerClassFlags {
pub fn new(value: u16) -> Self {
Self(value)
}
pub fn is_public(&self) -> bool {
self.0 & 0x0001 != 0
}
pub fn is_private(&self) -> bool {
self.0 & 0x0002 != 0
}
pub fn is_protected(&self) -> bool {
self.0 & 0x0004 != 0
}
pub fn is_static(&self) -> bool {
self.0 & 0x0008 != 0
}
pub fn is_final(&self) -> bool {
self.0 & 0x0010 != 0
}
pub fn is_interface(&self) -> bool {
self.0 & 0x0200 != 0
}
pub fn is_abstract(&self) -> bool {
self.0 & 0x0400 != 0
}
pub fn is_synthetic(&self) -> bool {
self.0 & 0x1000 != 0
}
pub fn is_annotation(&self) -> bool {
self.0 & 0x2000 != 0
}
pub fn is_enum(&self) -> bool {
self.0 & 0x4000 != 0
}
pub fn get_raw(&self) -> &u16 {
&self.0
}
}
impl MethodFlags {
pub fn new(value: u16) -> Self {
Self(value)
}
pub fn is_public(&self) -> bool {
self.0 & 0x0001 != 0
}
pub fn is_private(&self) -> bool {
self.0 & 0x0002 != 0
}
pub fn is_protected(&self) -> bool {
self.0 & 0x0004 != 0
}
pub fn is_static(&self) -> bool {
self.0 & 0x0008 != 0
}
pub fn is_final(&self) -> bool {
self.0 & 0x0010 != 0
}
pub fn is_synchronized(&self) -> bool {
self.0 & 0x0020 != 0
}
pub fn is_bridge(&self) -> bool {
self.0 & 0x0040 != 0
}
pub fn is_varargs(&self) -> bool {
self.0 & 0x0080 != 0
}
pub fn is_native(&self) -> bool {
self.0 & 0x0100 != 0
}
pub fn is_abstract(&self) -> bool {
self.0 & 0x0400 != 0
}
pub fn is_strict(&self) -> bool {
self.0 & 0x0800 != 0
}
pub fn is_synthetic(&self) -> bool {
self.0 & 0x1000 != 0
}
pub fn get_raw(&self) -> &u16 {
&self.0
}
}
impl MethodParamFlags {
pub fn new(value: u16) -> Self {
Self(value)
}
pub fn is_final(&self) -> bool {
self.0 & 0x0010 != 0
}
pub fn is_synthetic(&self) -> bool {
self.0 & 0x1000 != 0
}
pub fn is_mandated(&self) -> bool {
self.0 & 0x8000 != 0
}
pub fn get_raw(&self) -> &u16 {
&self.0
}
}
impl FieldFlags {
pub fn new(value: u16) -> Self {
Self(value)
}
pub fn is_public(&self) -> bool {
self.0 & 0x0001 != 0
}
pub fn is_private(&self) -> bool {
self.0 & 0x0002 != 0
}
pub fn is_protected(&self) -> bool {
self.0 & 0x0004 != 0
}
pub fn is_static(&self) -> bool {
self.0 & 0x0008 != 0
}
pub fn is_final(&self) -> bool {
self.0 & 0x0010 != 0
}
pub fn is_volatile(&self) -> bool {
self.0 & 0x0040 != 0
}
pub fn is_transient(&self) -> bool {
self.0 & 0x0080 != 0
}
pub fn is_synthetic(&self) -> bool {
self.0 & 0x1000 != 0
}
pub fn is_enum(&self) -> bool {
self.0 & 0x4000 != 0
}
pub fn get_raw(&self) -> &u16 {
&self.0
}
}