use crate::{low::v7400::AttributeValue, tree::v7400::node::NodeNameSym};
#[derive(Debug, Clone, PartialEq)]
pub(crate) struct NodeData {
name_sym: NodeNameSym,
attributes: Vec<AttributeValue>,
}
impl NodeData {
#[inline]
#[must_use]
pub(crate) fn name_sym(&self) -> NodeNameSym {
self.name_sym
}
#[inline]
#[must_use]
pub(crate) fn attributes(&self) -> &[AttributeValue] {
&self.attributes
}
#[inline]
pub(crate) fn append_attribute(&mut self, v: AttributeValue) {
self.attributes.push(v)
}
#[inline]
pub(crate) fn get_attribute_mut(&mut self, i: usize) -> Option<&mut AttributeValue> {
self.attributes.get_mut(i)
}
#[inline]
pub(crate) fn replace_attributes(&mut self, new: Vec<AttributeValue>) -> Vec<AttributeValue> {
std::mem::replace(&mut self.attributes, new)
}
#[inline]
#[must_use]
pub(crate) fn new(name_sym: NodeNameSym, attributes: Vec<AttributeValue>) -> Self {
Self {
name_sym,
attributes,
}
}
}