This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
entry.h
129 lines (116 loc) · 2.67 KB
/
entry.h
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#pragma once
#ifndef H_ENTRY
#define H_ENTRY
class entry
{
public:
entry(string_list_const & data);
entry(const string_base & path);
entry(const entry&);
virtual ~entry(void);
void to_string_list(string_list_impl & data) const;
const string8 & get_product() const
{
return m_product;
}
const string8 & get_version() const
{
return m_version;
}
const string8 & get_vendor() const
{
return m_vendor;
}
const string8 & get_io() const
{
return m_io;
}
const string8 & get_path() const
{
return m_path;
}
const GUID & get_guid() const
{
return m_guid;
}
bool has_editor() const
{
return m_has_editor;
}
// Unfortunately, filesystem service isn't ready here yet
/*void write(service_ptr_t<file> & p_writer)
{
abort_callback_dummy cb;
p_writer->write_bendian_t(ehdr, cb);
p_writer->write_bendian_t((t_int32)eprd, cb);
p_writer->write_string(m_product, cb);
p_writer->write_bendian_t((t_int32)evrs, cb);
p_writer->write_string(m_version, cb);
p_writer->write_bendian_t((t_int32)evnd, cb);
p_writer->write_string(m_vendor, cb);
p_writer->write_bendian_t((t_int32)eioc, cb);
p_writer->write_string(m_io, cb);
p_writer->write_bendian_t((t_int32)epth, cb);
p_writer->write_string(m_path, cb);
p_writer->write_bendian_t((t_int32)egid, cb);
p_writer->write_string(print_guid(m_guid).get_ptr(), cb);
p_writer->write_bendian_t((t_int32)eedt, cb);
p_writer->write_string(m_has_editor ? "true" : "false", cb);
p_writer->write_bendian_t((t_int32)eeof, cb);
}
entry(service_ptr_t<file> & p_reader)
{
abort_callback_dummy cb;
t_int32 hdr = 0;
p_reader->read_bendian_t(hdr, cb);
if (hdr != ehdr) return;
for (t_int32 id = 0; id != eeof; p_reader->read_bendian_t(id, cb))
{
switch (id)
{
case eprd:
p_reader->read_string(m_product, cb);
break;
case evrs:
p_reader->read_string(m_version, cb);
break;
case evnd:
p_reader->read_string(m_vendor, cb);
break;
case eioc:
p_reader->read_string(m_io, cb);
break;
case epth:
p_reader->read_string(m_path, cb);
break;
case egid:
{
string8 s_guid;
p_reader->read_string(s_guid, cb);
m_guid = GUID_from_text(s_guid);
}
break;
case eedt:
{
string8 edt;
p_reader->read_string(edt, cb);
m_has_editor = edt == "true";
}
break;
}
}
}*/
protected:
string8 m_product;
string8 m_version;
string8 m_vendor;
string8 m_io;
string8 m_path;
GUID m_guid;
bool m_has_editor;
private:
static const t_int32 ehdr = '_VST';
enum d_type {eprd = 'prdc', evrs = 'vrsn', evnd = 'vndr', eioc = '_io_',
epth = 'path', egid = 'guid', eedt = 'edit', eeof = '_eof'};
};
#endif