-
-
Notifications
You must be signed in to change notification settings - Fork 383
/
Copy pathPresetFactory.hpp
51 lines (40 loc) · 1.46 KB
/
PresetFactory.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
43
44
45
46
47
48
49
50
51
#pragma once
#include "Preset.hpp"
#include <memory>
namespace libprojectM {
class PresetFactory
{
public:
PresetFactory() = default;
virtual ~PresetFactory() = default;
/**
* @brief Returns the protocol portion for the given URL
*
* Some implementation may hand over "file:///path/to/preset" as the preset filename. This method
* takes care of cutting of the URL portion and return the path. Internally, it can be used to load
* the default idle preset via the "idle://" URL.
*
* @param url The URL to parse
* @param path [out] The path portion of the URL, basically everything after the "://" delimiter.
* @return The protocol, e.g. "file"
*/
static std::string Protocol(const std::string& url, std::string& path);
/**
* @brief Constructs a new preset from a local file
* @param filename The preset filename
* @returns A valid preset object
*/
virtual std::unique_ptr<Preset> LoadPresetFromFile(const std::string& filename) = 0;
/**
* @brief Constructs a new preset from a stream
* @param data The preset data stream
* @returns A valid preset object
*/
virtual std::unique_ptr<Preset> LoadPresetFromStream(std::istream& data) = 0;
/**
* Returns a space separated list of supported extensions
* @return A space separated list of supported extensions
*/
virtual std::string supportedExtensions() const = 0;
};
} // namespace libprojectM