Use std::optional instead of mbgl::optional (#911)

This commit is contained in:
Bart Louwers
2023-03-17 12:51:59 +01:00
committed by GitHub
parent 36846439c6
commit 15ad65dd3d
482 changed files with 2605 additions and 2652 deletions

View File

@@ -277,7 +277,7 @@ Value <%- camelize(type) %>Layer::serialize() const {
return result;
}
optional<Error> <%- camelize(type) %>Layer::setPropertyInternal(const std::string& name, const Convertible& value) {
std::optional<Error> <%- camelize(type) %>Layer::setPropertyInternal(const std::string& name, const Convertible& value) {
const auto it = layerProperties.find(name.c_str());
if (it == layerProperties.end()) return Error{"layer doesn't support this property"};
@@ -312,24 +312,24 @@ optional<Error> <%- camelize(type) %>Layer::setPropertyInternal(const std::strin
}
<% if (properties.length == 1) { %>
set<%- camelize(properties[0].name) %>(*typedValue);
return nullopt;
return std::nullopt;
<% } else for (const property of properties) { %>
if (property == Property::<%- camelize(property.name) %>) {
set<%- camelize(property.name) %>(*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;
}
<% for (const property of paintProperties) { %>
if (property == Property::<%- camelize(property.name) %>Transition) {
set<%- camelize(property.name) %>Transition(*transition);
return nullopt;
return std::nullopt;
}
<% } %>
return Error{"layer doesn't support this property"};