-
Notifications
You must be signed in to change notification settings - Fork 0
/
MacRsrc.h
55 lines (45 loc) · 1.3 KB
/
MacRsrc.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
// Copyright Jean Pierre Cimalando 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include <string>
#include <vector>
#include <array>
#include <stdint.h>
class MacRsrc
{
public:
MacRsrc();
~MacRsrc();
struct Resource;
size_t GetResourceCount() const;
const Resource &GetResource(size_t index);
uint16_t FileAttributes() const;
void SetFileAttributes(uint16_t attr);
int AddResource(uint32_t id, uint8_t attr, const char *type, std::string name, const std::vector<uint8_t> &data);
int Write(FILE *stream) const;
void DisplayAsText(FILE *stream) const;
struct Resource
{
uint32_t Id = 0;
uint8_t Attr = 0;
std::array<char, 4> Type;
std::string Name;
size_t DataOffset = 0;
size_t DataSize = 0;
};
private:
uint16_t fFileAttributes = 0;
std::vector<Resource> fResources;
std::vector<uint8_t> fData;
};
enum MacResourceAttribute
{
ResSysHeap = 64,
ResPurgeable = 32,
ResLocked = 16,
ResProtected = 8,
ResPreload = 4,
ResChanged = 2
};