summaryrefslogtreecommitdiff
path: root/src/mbgl/style/sources/vector_source.cpp
blob: 4bcd3b8985f17cf9f062e7a60de8d15c6e57b0f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <mbgl/style/sources/vector_source.hpp>
#include <mbgl/style/sources/vector_source_impl.hpp>

namespace mbgl {
namespace style {

VectorSource::VectorSource(std::string id, variant<std::string, Tileset> urlOrTileset)
    : Source(SourceType::Vector, std::make_unique<VectorSource::Impl>(std::move(id), *this, std::move(urlOrTileset))),
      impl(static_cast<Impl*>(baseImpl.get())) {
}

optional<std::string> VectorSource::getURL() const {
    auto urlOrTileset = impl->getURLOrTileset();
    if (urlOrTileset.is<std::string>()) {
        return urlOrTileset.get<std::string>();
    } else {
        return {};
    }
}

} // namespace style
} // namespace mbgl