this repo has no description
1#ifndef RESOURCEFORK_H
2#define RESOURCEFORK_H
3
4#include <string>
5#include <map>
6#include "ResType.h"
7
8class Resource
9{
10 ResType type;
11 short id;
12 std::string name;
13 std::string data;
14 int attr;
15public:
16 Resource() {}
17 Resource(ResType type, int id, std::string data, std::string name = "", int attr = 0)
18 : type(type), id(id), name(name), data(data), attr(attr) {}
19
20 const std::string& getData() const { return data; }
21 inline ResType getType() const { return type; }
22 inline int getID() const { return id; }
23 inline ResRef getTypeAndID() const { return ResRef(type, id); }
24 std::string getName() const { return name; }
25 int getAttr() const { return attr; }
26};
27
28class Fork
29{
30public:
31 virtual void writeFork(std::ostream& out) const { }
32 virtual ~Fork() {}
33};
34
35class Resources : public Fork
36{
37public:
38 std::map<ResRef, Resource> resources;
39
40 Resources() {}
41 Resources(std::istream& in);
42 void writeFork(std::ostream& out) const;
43 void addResource(Resource res) { resources[res.getTypeAndID()] = res; }
44 void addResources(const Resources& res);
45
46 unsigned countResources() const { return resources.size(); }
47};
48
49#endif // RESOURCEFORK_H