Files
fluxengine/lib/imagewriter/imagewriter.h
David Given 60bfe050d3 Refactor the way image extensions are handled to be generally cleaner. Add
support for validating ImageSpecs before we actually want to read/write an
image, so as to allow us to check the extension *before* wasting time reading a
disk. Make .d81 an alias of .img.
2019-08-21 00:45:10 +02:00

46 lines
1.1 KiB
C++

#ifndef IMAGEWRITER_H
#define IMAGEWRITER_H
class SectorSet;
class ImageSpec;
class ImageWriter
{
public:
ImageWriter(const SectorSet& sectors, const ImageSpec& spec);
virtual ~ImageWriter() {};
public:
static std::unique_ptr<ImageWriter> create(const SectorSet& sectors, const ImageSpec& spec);
static void verifyImageSpec(const ImageSpec& filename);
private:
typedef
std::function<
std::unique_ptr<ImageWriter>(const SectorSet& sectors, const ImageSpec& spec)
>
Constructor;
static std::map<std::string, Constructor> formats;
static std::unique_ptr<ImageWriter> createImgImageWriter(
const SectorSet& sectors, const ImageSpec& spec);
static std::unique_ptr<ImageWriter> createLDBSImageWriter(
const SectorSet& sectors, const ImageSpec& spec);
static std::unique_ptr<ImageWriter> createD64ImageWriter(
const SectorSet& sectors, const ImageSpec& spec);
static Constructor findConstructor(const ImageSpec& spec);
public:
virtual void adjustGeometry();
void printMap();
virtual void writeImage() = 0;
protected:
const SectorSet& sectors;
ImageSpec spec;
};
#endif