hwp/hwp/paragraph/
range_tag.rs

1use std::io::Read;
2
3use byteorder::{LittleEndian, ReadBytesExt};
4
5#[derive(Debug, Clone)]
6pub struct RangeTag {
7    /// 영역 시작
8    pub start_position: u32,
9    /// 영역 끝
10    pub end_position: u32,
11    /// 태그(종류 + 데이터)
12    ///
13    /// 상위 8비트가 종류를 하위 24비트가 종류별로 다른
14    /// 설명을 부여할 수 있는 임의의 데이터를 나타낸다.
15    pub tag: u32,
16}
17
18impl RangeTag {
19    pub fn from_reader<T: Read>(reader: &mut T) -> Self {
20        let start_position = reader.read_u32::<LittleEndian>().unwrap();
21        let end_position = reader.read_u32::<LittleEndian>().unwrap();
22        let tag = reader.read_u32::<LittleEndian>().unwrap();
23
24        Self {
25            start_position,
26            end_position,
27            tag,
28        }
29    }
30}