use std::ffi::c_int;
use crate::tre;
#[allow(clippy::module_name_repetitions)]
pub type RegFlags = c_int;
#[allow(clippy::module_name_repetitions)]
#[derive(Clone, Copy, Debug)]
pub struct RegcompFlags(RegFlags);
impl RegcompFlags {
pub const NONE: RegFlags = 0;
pub const BASIC: RegFlags = tre::REG_BASIC;
pub const EXTENDED: RegFlags = tre::REG_EXTENDED;
pub const ICASE: RegFlags = tre::REG_ICASE;
pub const LITERAL: RegFlags = tre::REG_LITERAL;
pub const NOSPEC: RegFlags = tre::REG_NOSPEC;
pub const NEWLINE: RegFlags = tre::REG_NEWLINE;
pub const NOSUB: RegFlags = tre::REG_NOSUB;
pub const RIGHT_ASSOC: RegFlags = tre::REG_RIGHT_ASSOC;
pub const UNGREEDY: RegFlags = tre::REG_UNGREEDY;
pub const USEBYTES: RegFlags = tre::REG_USEBYTES;
#[must_use]
pub const fn new() -> Self {
Self(0)
}
#[must_use]
#[inline]
pub const fn add(&self, flag: RegFlags) -> Self {
Self(self.0 | flag)
}
#[must_use]
#[inline]
pub const fn remove(&self, flag: RegFlags) -> Self {
Self(self.0 & !flag)
}
#[must_use]
#[inline]
pub const fn get(&self) -> RegFlags {
self.0
}
}
#[allow(clippy::module_name_repetitions)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct RegexecFlags(RegFlags);
impl RegexecFlags {
pub const NONE: RegFlags = 0;
pub const APPROX_MATCHER: RegFlags = tre::REG_APPROX_MATCHER;
pub const BACKTRACKING_MATCHER: RegFlags = tre::REG_BACKTRACKING_MATCHER;
pub const NOTBOL: RegFlags = tre::REG_NOTBOL;
pub const NOTEOL: RegFlags = tre::REG_NOTEOL;
#[must_use]
#[inline]
pub const fn new() -> Self {
Self(0)
}
#[must_use]
#[inline]
pub const fn add(&self, flag: RegFlags) -> Self {
Self(self.0 | flag)
}
#[must_use]
#[inline]
pub const fn remove(&self, flag: RegFlags) -> Self {
Self(self.0 & !flag)
}
#[must_use]
#[inline]
pub const fn get(&self) -> RegFlags {
self.0
}
}