Use std::optional instead of mbgl::optional (#911)
This commit is contained in:
@@ -65,7 +65,7 @@ MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbo
|
||||
|
||||
} // namespace
|
||||
|
||||
optional<Error> Light::setProperty(const std::string& name, const Convertible& value) {
|
||||
std::optional<Error> Light::setProperty(const std::string& name, const Convertible& value) {
|
||||
const auto it = properties.find(name.c_str());
|
||||
if (it == properties.end()) {
|
||||
return Error { "light doesn't support this property" };
|
||||
@@ -76,77 +76,77 @@ optional<Error> Light::setProperty(const std::string& name, const Convertible& v
|
||||
|
||||
if (property == Property::Anchor) {
|
||||
Error error;
|
||||
optional<PropertyValue<LightAnchorType>> typedValue = convert<PropertyValue<LightAnchorType>>(value, error, false, false);
|
||||
std::optional<PropertyValue<LightAnchorType>> typedValue = convert<PropertyValue<LightAnchorType>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setAnchor(*typedValue);
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::Color) {
|
||||
Error error;
|
||||
optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, false, false);
|
||||
std::optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setColor(*typedValue);
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::Intensity) {
|
||||
Error error;
|
||||
optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
|
||||
std::optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setIntensity(*typedValue);
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::Position) {
|
||||
Error error;
|
||||
optional<PropertyValue<Position>> typedValue = convert<PropertyValue<Position>>(value, error, false, false);
|
||||
std::optional<PropertyValue<Position>> typedValue = convert<PropertyValue<Position>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setPosition(*typedValue);
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Error error;
|
||||
optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
|
||||
std::optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
|
||||
if (!transition) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::AnchorTransition) {
|
||||
setAnchorTransition(*transition);
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::ColorTransition) {
|
||||
setColorTransition(*transition);
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::IntensityTransition) {
|
||||
setIntensityTransition(*transition);
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::PositionTransition) {
|
||||
setPositionTransition(*transition);
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user