+ expose iterator interface in mapnik::context

+ make feature_kv_iterator friend of feature_impl
This commit is contained in:
Artem Pavlenko 2012-01-13 17:17:40 +00:00 committed by Artem Pavlenko
parent a3c338c835
commit d75eb788f3

View file

@ -62,6 +62,7 @@ public:
typedef map_type::size_type size_type; typedef map_type::size_type size_type;
typedef map_type::difference_type difference_type; typedef map_type::difference_type difference_type;
typedef map_type::iterator iterator; typedef map_type::iterator iterator;
typedef map_type::const_iterator const_iterator;
context() context()
: base_type(mapping_) {} : base_type(mapping_) {}
@ -71,6 +72,9 @@ public:
mapping_.insert(std::make_pair(name,mapping_.size())); mapping_.insert(std::make_pair(name,mapping_.size()));
} }
const_iterator begin() const { return mapping_.begin();}
const_iterator end() const { return mapping_.end();}
private: private:
map_type mapping_; map_type mapping_;
}; };
@ -79,10 +83,13 @@ typedef boost::shared_ptr<context> context_ptr;
class feature_impl : private boost::noncopyable class feature_impl : private boost::noncopyable
{ {
friend class feature_kv_iterator;
public: public:
typedef mapnik::value value_type; typedef mapnik::value value_type;
typedef std::vector<value_type> cont_type; typedef std::vector<value_type> cont_type;
feature_impl(context_ptr const& ctx, int id) feature_impl(context_ptr const& ctx, int id)
: id_(id), : id_(id),
ctx_(ctx), ctx_(ctx),