2014-10-21 20:37:43 +00:00
|
|
|
#ifndef RESOURCEFORK_H
|
|
|
|
#define RESOURCEFORK_H
|
2014-10-08 00:52:15 +00:00
|
|
|
|
|
|
|
#include <string>
|
2014-10-12 17:12:10 +00:00
|
|
|
#include <map>
|
|
|
|
#include "ResType.h"
|
2014-10-08 00:52:15 +00:00
|
|
|
|
|
|
|
class Resource
|
|
|
|
{
|
2014-10-12 17:12:10 +00:00
|
|
|
ResType type;
|
2015-07-20 01:27:26 +00:00
|
|
|
short id;
|
2014-10-08 00:52:15 +00:00
|
|
|
std::string name;
|
|
|
|
std::string data;
|
|
|
|
int attr;
|
|
|
|
public:
|
2014-10-12 17:12:10 +00:00
|
|
|
Resource() {}
|
|
|
|
Resource(ResType type, int id, std::string data, std::string name = "", int attr = 0)
|
2014-10-16 00:25:23 +00:00
|
|
|
: type(type), id(id), name(name), data(data), attr(attr) {}
|
2014-10-08 00:52:15 +00:00
|
|
|
|
|
|
|
const std::string& getData() const { return data; }
|
2014-10-12 17:12:10 +00:00
|
|
|
inline ResType getType() const { return type; }
|
2014-10-08 00:52:15 +00:00
|
|
|
inline int getID() const { return id; }
|
2014-10-12 17:12:10 +00:00
|
|
|
inline ResRef getTypeAndID() const { return ResRef(type, id); }
|
2014-11-07 23:53:12 +00:00
|
|
|
std::string getName() const { return name; }
|
2015-07-19 23:51:33 +00:00
|
|
|
int getAttr() const { return attr; }
|
2014-10-08 00:52:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Fork
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void writeFork(std::ostream& out) const { }
|
|
|
|
virtual ~Fork() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class Resources : public Fork
|
|
|
|
{
|
2014-10-12 17:12:10 +00:00
|
|
|
std::map<ResRef, Resource> resources;
|
2014-10-08 00:52:15 +00:00
|
|
|
public:
|
|
|
|
Resources() {}
|
|
|
|
Resources(std::istream& in);
|
|
|
|
void writeFork(std::ostream& out) const;
|
2014-10-12 17:12:10 +00:00
|
|
|
void addResource(Resource res) { resources[res.getTypeAndID()] = res; }
|
2014-10-08 00:52:15 +00:00
|
|
|
void addResources(const Resources& res);
|
|
|
|
};
|
|
|
|
|
2014-10-21 20:37:43 +00:00
|
|
|
#endif // RESOURCEFORK_H
|