From 039b05ebb462762c43ce4fc750fd98ae0c9e0093 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 8 Jun 2016 17:18:06 -0700 Subject: [core] Extract code templates to individual .ejs files --- include/mbgl/style/layers/layer.hpp.ejs | 76 +++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 include/mbgl/style/layers/layer.hpp.ejs (limited to 'include/mbgl/style/layers') diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs new file mode 100644 index 0000000000..fdf7620892 --- /dev/null +++ b/include/mbgl/style/layers/layer.hpp.ejs @@ -0,0 +1,76 @@ +<% + const type = locals.type; + const layoutProperties = locals.layoutProperties; + const paintProperties = locals.paintProperties; +-%> +// This file is generated. Do not edit. + +#pragma once + +#include +#include +#include + +#include + +<% if (type === 'line' || type === 'symbol') { -%> +#include + +<% } -%> +namespace mbgl { +namespace style { + +class <%- camelize(type) %>Layer : public Layer { +public: + <%- camelize(type) %>Layer(const std::string& layerID); + ~<%- camelize(type) %>Layer() final; + +<% if (type === 'raster') { -%> + // Source + + void setSource(const std::string& sourceID); + const std::string& getSourceID() const; + +<% } else if (type !== 'background') { -%> + // Source + + void setSource(const std::string& sourceID, const std::string& sourceLayer); + const std::string& getSourceID() const; + const std::string& getSourceLayer() const; + + void setFilter(const Filter&); + const Filter& getFilter() const; + +<% } -%> +<% if (layoutProperties.length) { -%> + // Layout properties + +<% for (const property of layoutProperties) { -%> + PropertyValue<<%- propertyType(property) %>> get<%- camelize(property.name) %>() const; + void set<%- camelize(property.name) %>(PropertyValue<<%- propertyType(property) %>>); + +<% } -%> +<% } -%> + // Paint properties + +<% for (const property of paintProperties) { -%> + PropertyValue<<%- propertyType(property) %>> get<%- camelize(property.name) %>() const; + void set<%- camelize(property.name) %>(PropertyValue<<%- propertyType(property) %>>); + +<% } -%> + // Private implementation + + class Impl; + Impl* const impl; + + <%- camelize(type) %>Layer(const Impl&); + <%- camelize(type) %>Layer(const <%- camelize(type) %>Layer&) = delete; +}; + +template <> +inline bool Layer::is<<%- camelize(type) %>Layer>() const { + return type == Type::<%- camelize(type) %>; +} + +} // namespace style +} // namespace mbgl -- cgit v1.2.1