use crate::util::Utf16String;
pub struct AbstractTemplateEvent {
template_name: Option<Utf16String>,
line: i32,
col: i32,
}
impl AbstractTemplateEvent {
#[must_use]
pub const fn new() -> Self {
Self {
template_name: None,
line: -1,
col: -1,
}
}
#[must_use]
pub fn with_location(template_name: Option<Utf16String>, line: i32, col: i32) -> Self {
Self {
template_name,
line,
col,
}
}
#[must_use]
pub fn copy_of(original: &Self) -> Self {
Self {
template_name: original.template_name.clone(),
line: original.line,
col: original.col,
}
}
#[must_use]
pub const fn has_location(&self) -> bool {
self.template_name.is_some() && self.line != -1 && self.col != -1
}
#[must_use]
pub const fn get_template_name(&self) -> Option<&Utf16String> {
self.template_name.as_ref()
}
#[must_use]
pub const fn get_line(&self) -> i32 {
self.line
}
#[must_use]
pub const fn get_col(&self) -> i32 {
self.col
}
}
impl Default for AbstractTemplateEvent {
fn default() -> Self {
Self::new()
}
}