Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Update make_property_setters.hpp.ejs
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Oct 17, 2017
1 parent 84685bf commit 63bdc0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions scripts/generate-style-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ for (const layer of layers) {
writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer_properties.cpp`, propertiesCpp(layer));
}

const propertySettersHpp = ejs.compile(fs.readFileSync('include/mbgl/style/conversion/make_property_setters.hpp.ejs', 'utf8'), {strict: true});
writeIfModified('include/mbgl/style/conversion/make_property_setters.hpp', propertySettersHpp({layers: layers}));
const propertySettersHpp = ejs.compile(fs.readFileSync('src/mbgl/style/conversion/make_property_setters.hpp.ejs', 'utf8'), {strict: true});
writeIfModified('src/mbgl/style/conversion/make_property_setters.hpp', propertySettersHpp({layers: layers}));

// Light
const lightProperties = Object.keys(spec[`light`]).reduce((memo, name) => {
Expand Down
18 changes: 8 additions & 10 deletions src/mbgl/style/conversion/make_property_setters.hpp.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,27 @@ namespace mbgl {
namespace style {
namespace conversion {

template <class V>
auto makeLayoutPropertySetters() {
std::unordered_map<std::string, PropertySetter<V>> result;
inline auto makeLayoutPropertySetters() {
std::unordered_map<std::string, PropertySetter> result;

result["visibility"] = &setVisibility<V>;
result["visibility"] = &setVisibility;

<% for (const layer of locals.layers) { -%>
<% for (const property of layer.layoutProperties) { -%>
result["<%- property.name %>"] = &setProperty<V, <%- camelize(layer.type) %>Layer, <%- propertyValueType(property) %>, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>>;
result["<%- property.name %>"] = &setProperty<<%- camelize(layer.type) %>Layer, <%- propertyValueType(property) %>, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>>;
<% } -%>
<% } -%>
return result;
}

template <class V>
auto makePaintPropertySetters() {
std::unordered_map<std::string, PropertySetter<V>> result;
inline auto makePaintPropertySetters() {
std::unordered_map<std::string, PropertySetter> result;

<% for (const layer of locals.layers) { -%>
<% for (const property of layer.paintProperties) { -%>
result["<%- property.name %>"] = &setProperty<V, <%- camelize(layer.type) %>Layer, <%- propertyValueType(property) %>, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>>;
result["<%- property.name %>-transition"] = &setTransition<V, <%- camelize(layer.type) %>Layer, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>Transition>;
result["<%- property.name %>"] = &setProperty<<%- camelize(layer.type) %>Layer, <%- propertyValueType(property) %>, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>>;
result["<%- property.name %>-transition"] = &setTransition<<%- camelize(layer.type) %>Layer, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>Transition>;
<% } -%>
<% } -%>
Expand Down

0 comments on commit 63bdc0c

Please sign in to comment.