use serde::{Deserialize, Serialize};
use crate::cea608utils::*;
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Chunk {
pub style: TextStyle,
pub underline: bool,
pub text: String,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Line {
pub column: Option<u32>,
pub row: Option<u32>,
pub chunks: Vec<Chunk>,
pub carriage_return: Option<bool>,
}
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Lines {
pub lines: Vec<Line>,
pub mode: Option<Cea608Mode>,
pub clear: Option<bool>,
}
impl Lines {
pub fn new_empty() -> Self {
Self {
lines: vec![],
mode: None,
clear: None,
}
}
}
impl Cea608Mode {
pub fn is_rollup(&self) -> bool {
*self == Cea608Mode::RollUp2 || *self == Cea608Mode::RollUp3 || *self == Cea608Mode::RollUp4
}
}