From 0471f3369a2667a362bc30e7d9949a55e588f14c Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 15 Aug 2016 12:20:19 +0100 Subject: [PATCH] add order_by_name helper method --- include/mapnik/feature_layer_desc.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/mapnik/feature_layer_desc.hpp b/include/mapnik/feature_layer_desc.hpp index 9d1186a7c..cd69d831f 100644 --- a/include/mapnik/feature_layer_desc.hpp +++ b/include/mapnik/feature_layer_desc.hpp @@ -94,12 +94,21 @@ public: { return extra_params_; } + bool has_name(std::string const& name) const { auto result = std::find_if(std::begin(descriptors_), std::end(descriptors_), [&name](attribute_descriptor const& desc) { return name == desc.get_name();}); return result != std::end(descriptors_); } + void order_by_name() + { + std::sort(std::begin(descriptors_), std::end(descriptors_), + [](attribute_descriptor const& d0, attribute_descriptor const& d1) + { + return d0.get_name() < d1.get_name(); + }); + } private: std::string name_; std::string encoding_;