From 29e8bcc47c145e96973f75427fd20603f400fbef Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Thu, 19 Jan 2012 16:57:15 -0500 Subject: [PATCH] add method to access attribute values by index --- include/mapnik/feature.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/mapnik/feature.hpp b/include/mapnik/feature.hpp index 8633848bb..92f70ff50 100644 --- a/include/mapnik/feature.hpp +++ b/include/mapnik/feature.hpp @@ -59,6 +59,7 @@ class context : private boost::noncopyable, { friend class feature_impl; public: + typedef map_type::value_type value_type; typedef map_type::key_type key_type; typedef map_type::size_type size_type; @@ -143,6 +144,13 @@ public: throw std::out_of_range("Key doesn't exist"); } + value_type const& get(std::size_t index) const + { + if (index < data_.size()) + return data_[index]; + throw std::out_of_range("Index out of range"); + } + std::size_t size() const { return data_.size(); @@ -216,7 +224,7 @@ public: { return feature_kv_iterator(*this); } - + std::string to_string() const { std::stringstream ss;