summaryrefslogtreecommitdiff
path: root/src/mbgl/style/light.cpp.ejs
blob: 5def9e3da5d8a173e0525850ca0c2ede82e50258 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<%
  const properties = locals.properties;
-%>
// This file is generated. Do not edit.

#include <mbgl/style/light.hpp>
#include <mbgl/style/light_impl.hpp>
#include <mbgl/style/light_observer.hpp>

namespace mbgl {
namespace style {

static LightObserver nullObserver;

Light::Light()
    : impl(makeMutable<Impl>()),
      observer(&nullObserver) {
}

Light::~Light() = default;

void Light::setObserver(LightObserver* observer_) {
    observer = observer_ ? observer_ : &nullObserver;
}

Mutable<Light::Impl> Light::mutableImpl() const {
    return makeMutable<Impl>(*impl);
}

<% for (const property of properties) { -%>
<%- evaluatedType(property) %> Light::getDefault<%- camelize(property.name) %>() {
    return Light<%- camelize(property.name) %>::defaultValue();
}

<%- propertyValueType(property) %> Light::get<%- camelize(property.name) %>() const {
    return impl->properties.<%- camelizeWithLeadingLowercase(property.name) %>.value;
}

void Light::set<%- camelize(property.name) %>(<%- propertyValueType(property) %> property) {
    auto impl_ = mutableImpl();
    impl_->properties.<%- camelizeWithLeadingLowercase(property.name) %>.value = property;
    impl = std::move(impl_);
    observer->onLightChanged(*this);
}

void Light::set<%- camelize(property.name) %>Transition(const TransitionOptions& options) {
    auto impl_ = mutableImpl();
    impl_->properties.<%- camelizeWithLeadingLowercase(property.name) %>.options = options;
    impl = std::move(impl_);
    observer->onLightChanged(*this);
}

TransitionOptions Light::get<%- camelize(property.name) %>Transition() const {
    return impl->properties.<%- camelizeWithLeadingLowercase(property.name) %>.options;
}

<% } -%>

} // namespace style
} // namespace mbgl