File tree 1 file changed +6
-40
lines changed
1 file changed +6
-40
lines changed Original file line number Diff line number Diff line change @@ -30,51 +30,17 @@ using FontSourceLoader = std::function<std::vector<char>()>;
30
30
31
31
struct FontSourceHandle {
32
32
33
+ FontSourceHandle () {}
34
+ ~FontSourceHandle () {}
35
+
33
36
explicit FontSourceHandle (Url path) : fontPath(path) { tag = FontPath; }
34
37
explicit FontSourceHandle (std::string name) : fontName(name) { tag = FontName; }
35
38
explicit FontSourceHandle (FontSourceLoader loader) : fontLoader(loader) { tag = FontLoader; }
36
- FontSourceHandle () {}
37
-
38
- ~FontSourceHandle () {
39
- using std::string;
40
- switch (tag) {
41
- case FontSourceHandle::FontPath:
42
- fontPath.~Url ();
43
- break ;
44
- case FontSourceHandle::FontName:
45
- fontName.~string ();
46
- break ;
47
- case FontSourceHandle::FontLoader:
48
- fontLoader.~FontSourceLoader ();
49
- break ;
50
- case FontSourceHandle::None:
51
- break ;
52
- }
53
- }
54
-
55
- FontSourceHandle (const FontSourceHandle& other) {
56
- tag = other.tag ;
57
- switch (other.tag ) {
58
- case FontSourceHandle::FontPath:
59
- fontPath = other.fontPath ;
60
- break ;
61
- case FontSourceHandle::FontName:
62
- fontName = other.fontName ;
63
- break ;
64
- case FontSourceHandle::FontLoader:
65
- fontLoader = other.fontLoader ;
66
- break ;
67
- case FontSourceHandle::None:
68
- break ;
69
- }
70
- }
71
39
72
40
enum { FontPath, FontName, FontLoader, None } tag = None;
73
- union {
74
- Url fontPath;
75
- std::string fontName;
76
- FontSourceLoader fontLoader;
77
- };
41
+ Url fontPath;
42
+ std::string fontName;
43
+ FontSourceLoader fontLoader;
78
44
79
45
bool isValid () const { return tag != None; }
80
46
};
You can’t perform that action at this time.
0 commit comments