mirror of
https://github.com/redstrate/Physis.git
synced 2025-05-07 19:17:45 +00:00
Add EXD::get_row function
This commit is contained in:
parent
257f286990
commit
5efa3c9663
1 changed files with 13 additions and 3 deletions
16
src/exd.rs
16
src/exd.rs
|
@ -185,7 +185,7 @@ pub struct EXD {
|
||||||
pub rows: Vec<ExcelRow>,
|
pub rows: Vec<ExcelRow>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum ColumnData {
|
pub enum ColumnData {
|
||||||
String(String),
|
String(String),
|
||||||
Bool(bool),
|
Bool(bool),
|
||||||
|
@ -200,12 +200,12 @@ pub enum ColumnData {
|
||||||
UInt64(u64),
|
UInt64(u64),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct ExcelSingleRow {
|
pub struct ExcelSingleRow {
|
||||||
pub columns: Vec<ColumnData>,
|
pub columns: Vec<ColumnData>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum ExcelRowKind {
|
pub enum ExcelRowKind {
|
||||||
SingleRow(ExcelSingleRow),
|
SingleRow(ExcelSingleRow),
|
||||||
SubRows(Vec<ExcelSingleRow>),
|
SubRows(Vec<ExcelSingleRow>),
|
||||||
|
@ -222,6 +222,16 @@ impl EXD {
|
||||||
EXD::read_args(&mut Cursor::new(&buffer), (exh,)).ok()
|
EXD::read_args(&mut Cursor::new(&buffer), (exh,)).ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_row(&self, row_id: u32) -> Option<ExcelRowKind> {
|
||||||
|
for row in &self.rows {
|
||||||
|
if row.row_id == row_id {
|
||||||
|
return Some(row.kind.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
fn read_data_raw<T: Read + Seek, Z: BinRead<Args<'static> = ()>>(cursor: &mut T) -> Option<Z> {
|
fn read_data_raw<T: Read + Seek, Z: BinRead<Args<'static> = ()>>(cursor: &mut T) -> Option<Z> {
|
||||||
Z::read_options(cursor, Endian::Big, ()).ok()
|
Z::read_options(cursor, Endian::Big, ()).ok()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue