1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use lopdf;
use std::collections::HashMap;
#[derive(Default, Debug, Copy, Clone)]
pub struct Pattern {
}
impl Pattern {
pub fn new()
-> Self
{
Self::default()
}
}
#[derive(Debug)]
pub struct PatternRef {
pub(crate) name: String,
}
impl PatternRef {
pub fn new(index: usize)
-> Self
{
Self {
name: format!("PT{}", index),
}
}
}
#[derive(Default, Debug, Clone)]
pub struct PatternList {
patterns: HashMap<String, Pattern>,
}
impl PatternList {
pub fn new()
-> Self
{
Self {
patterns: HashMap::new(),
}
}
pub fn add_pattern(&mut self, pattern: Pattern)
-> PatternRef
{
let len = self.patterns.len();
let pattern_ref = PatternRef::new(len);
self.patterns.insert(pattern_ref.name.clone(), pattern);
pattern_ref
}
}
impl Into<lopdf::Dictionary> for PatternList {
fn into(self)
-> lopdf::Dictionary
{
lopdf::Dictionary::new()
}
}