-
Notifications
You must be signed in to change notification settings - Fork 0
/
targetFileFormat.hpp
42 lines (35 loc) · 1.36 KB
/
targetFileFormat.hpp
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
/**
* Factories for code which knows how to create, load and save FileFeatures.
*
* (C) 2021 Malcolm Tyrrell
*
* Licensed under the GPLv3.0. See LICENSE file.
**/
#pragma once
#include <Common/Registry/fileTypeRegistry.hpp>
#include <Common/productInfo.hpp>
#include <istream>
#include <string>
#include <vector>
namespace babelwires {
class DataSource;
struct UserLogger;
} // namespace babelwires
namespace babelwires {
class FileFeature;
struct ProjectContext;
/// Factories which can create FileFeatures in a default state, and write those features as files.
class TargetFileFormat : public FileTypeEntry, ProductInfo {
public:
TargetFileFormat(LongId identifier, VersionNumber version, Extensions extensions);
virtual std::unique_ptr<FileFeature> createNewFeature(const ProjectContext& projectContext) const = 0;
virtual void writeToFile(const ProjectContext& projectContext, UserLogger& userLogger, const FileFeature& fileFeature, std::ostream& os) const = 0;
};
/// Registry of TargetFileFactories.
/// Note: This is not a FileTypeRegistry, since these are not expected to be queried by extension and
/// more than one can target the same extension.
class TargetFileFormatRegistry : public Registry<TargetFileFormat> {
public:
TargetFileFormatRegistry();
};
} // namespace babelwires