// This file is generated. Do not edit. #include #include #include #include #include #include #include #include #include namespace mbgl { namespace style { static LightObserver nullObserver; Light::Light() : impl(makeMutable()), observer(&nullObserver) { } Light::~Light() = default; void Light::setObserver(LightObserver* observer_) { observer = observer_ ? observer_ : &nullObserver; } Mutable Light::mutableImpl() const { return makeMutable(*impl); } using namespace conversion; optional Light::setProperty(const std::string& name, const Convertible& value) { enum class Property : uint8_t { Anchor, Color, Intensity, Position, AnchorTransition, ColorTransition, IntensityTransition, PositionTransition, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map({ { "anchor", static_cast(Property::Anchor) }, { "color", static_cast(Property::Color) }, { "intensity", static_cast(Property::Intensity) }, { "position", static_cast(Property::Position) }, { "anchor-transition", static_cast(Property::AnchorTransition) }, { "color-transition", static_cast(Property::ColorTransition) }, { "intensity-transition", static_cast(Property::IntensityTransition) }, { "position-transition", static_cast(Property::PositionTransition) } }); const auto it = properties.find(name.c_str()); if (it == properties.end()) { return Error { "light doesn't support this property" }; } auto property = static_cast(it->second); if (property == Property::Anchor) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setAnchor(*typedValue); return nullopt; } if (property == Property::Color) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setColor(*typedValue); return nullopt; } if (property == Property::Intensity) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setIntensity(*typedValue); return nullopt; } if (property == Property::Position) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setPosition(*typedValue); return nullopt; } Error error; optional transition = convert(value, error); if (!transition) { return error; } if (property == Property::AnchorTransition) { setAnchorTransition(*transition); return nullopt; } if (property == Property::ColorTransition) { setColorTransition(*transition); return nullopt; } if (property == Property::IntensityTransition) { setIntensityTransition(*transition); return nullopt; } if (property == Property::PositionTransition) { setPositionTransition(*transition); return nullopt; } return Error { "light doesn't support this property" }; } LightAnchorType Light::getDefaultAnchor() { return LightAnchor::defaultValue(); } PropertyValue Light::getAnchor() const { return impl->properties.template get().value; } void Light::setAnchor(PropertyValue property) { auto impl_ = mutableImpl(); impl_->properties.template get().value = property; impl = std::move(impl_); observer->onLightChanged(*this); } void Light::setAnchorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->properties.template get().options = options; impl = std::move(impl_); observer->onLightChanged(*this); } TransitionOptions Light::getAnchorTransition() const { return impl->properties.template get().options; } Color Light::getDefaultColor() { return LightColor::defaultValue(); } PropertyValue Light::getColor() const { return impl->properties.template get().value; } void Light::setColor(PropertyValue property) { auto impl_ = mutableImpl(); impl_->properties.template get().value = property; impl = std::move(impl_); observer->onLightChanged(*this); } void Light::setColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->properties.template get().options = options; impl = std::move(impl_); observer->onLightChanged(*this); } TransitionOptions Light::getColorTransition() const { return impl->properties.template get().options; } float Light::getDefaultIntensity() { return LightIntensity::defaultValue(); } PropertyValue Light::getIntensity() const { return impl->properties.template get().value; } void Light::setIntensity(PropertyValue property) { auto impl_ = mutableImpl(); impl_->properties.template get().value = property; impl = std::move(impl_); observer->onLightChanged(*this); } void Light::setIntensityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->properties.template get().options = options; impl = std::move(impl_); observer->onLightChanged(*this); } TransitionOptions Light::getIntensityTransition() const { return impl->properties.template get().options; } Position Light::getDefaultPosition() { return LightPosition::defaultValue(); } PropertyValue Light::getPosition() const { return impl->properties.template get().value; } void Light::setPosition(PropertyValue property) { auto impl_ = mutableImpl(); impl_->properties.template get().value = property; impl = std::move(impl_); observer->onLightChanged(*this); } void Light::setPositionTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->properties.template get().options = options; impl = std::move(impl_); observer->onLightChanged(*this); } TransitionOptions Light::getPositionTransition() const { return impl->properties.template get().options; } } // namespace style } // namespace mbgl