2014-10-31 00:16:47 +00:00
|
|
|
#ifndef RESOURCEFILE_H
|
|
|
|
#define RESOURCEFILE_H
|
|
|
|
|
|
|
|
#include <memory>
|
2017-10-08 20:23:08 +00:00
|
|
|
#include <iosfwd>
|
|
|
|
#include <string>
|
|
|
|
|
2014-10-31 00:16:47 +00:00
|
|
|
#include "ResType.h"
|
|
|
|
#include "ResourceFork.h"
|
|
|
|
|
|
|
|
class ResourceFile
|
|
|
|
{
|
|
|
|
public:
|
2019-08-18 11:21:00 +00:00
|
|
|
enum class Format
|
|
|
|
{
|
|
|
|
autodetect,
|
2014-10-31 00:16:47 +00:00
|
|
|
#ifdef __APPLE__
|
2019-08-18 11:21:00 +00:00
|
|
|
real,
|
2014-10-31 00:16:47 +00:00
|
|
|
#endif
|
2019-08-18 11:21:00 +00:00
|
|
|
macbin,
|
|
|
|
diskimage,
|
|
|
|
basilisk,
|
|
|
|
applesingle,
|
|
|
|
underscore_appledouble,
|
|
|
|
percent_appledouble
|
|
|
|
};
|
|
|
|
|
2019-08-25 15:48:02 +00:00
|
|
|
bool read(std::string path, Format f = Format::autodetect);
|
|
|
|
bool write(std::string path, Format f = Format::autodetect);
|
2019-08-18 11:21:00 +00:00
|
|
|
bool read(std::istream& in, Format f);
|
|
|
|
bool write(std::ostream& in, Format f);
|
|
|
|
static bool hasPlainDataFork(Format f);
|
|
|
|
bool hasPlainDataFork();
|
2019-08-25 15:48:02 +00:00
|
|
|
Format getFormat() { return format; }
|
2019-08-18 11:21:00 +00:00
|
|
|
|
|
|
|
static bool isSingleFork(Format f);
|
|
|
|
|
|
|
|
ResType type;
|
|
|
|
ResType creator;
|
|
|
|
Resources resources;
|
|
|
|
std::string data;
|
2019-08-25 15:48:02 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool assign(std::string path, Format f = Format::autodetect);
|
|
|
|
bool read();
|
|
|
|
bool write();
|
|
|
|
|
|
|
|
std::string pathstring;
|
|
|
|
std::string filename;
|
|
|
|
Format format = Format::autodetect;
|
2014-10-31 00:16:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RESOURCEFILE_H
|