summaryrefslogtreecommitdiff
path: root/include/mbgl/sourcemanager/source_factory.hpp
blob: 31d392163b31fcf1864ad69a062aea842af68a3f (plain)
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
#pragma once

#include <mbgl/style/source.hpp>

namespace mbgl {
namespace style {
namespace conversion {
class Convertible;
struct Error;
} // namespace conversion
} // namespace style

class RenderSource;

/**
 * @brief The SourceFactory abstract class
 *
 * This class is responsible for creation of the source objects that belong to a concrete source type.
 */
class SourceFactory {
public:
    virtual ~SourceFactory() = default;

    /// Returns the source type data.
    virtual const style::SourceTypeInfo* getTypeInfo() const noexcept = 0;

    /// Returns a new Source instance on success call; returns `nullptr` otherwise with Error updated
    /// accordingly.
    virtual std::unique_ptr<style::Source> createSource(const std::string& id,
                                                        const style::conversion::Convertible& value,
                                                        style::conversion::Error&) noexcept = 0;

    /// Returns a new RenderSource instance.
    virtual std::unique_ptr<RenderSource> createRenderSource(Immutable<style::Source::Impl>) noexcept = 0;
};

} // namespace mbgl