static const std::string name_str;
public:
- typedef std::map<std::string, std::string> metadata_map;
+ typedef std::string key_type;
+ typedef std::string mapped_type;
+ typedef std::map<key_type, mapped_type> metadata_map;
+ typedef metadata_map::iterator iterator;
+ typedef metadata_map::const_iterator const_iterator;
typedef metadata_map::size_type size_type;
Annotations();
//! make a shared pointer copy of our object
AnnotationsRef copy() const;
+
+ mapped_type& operator[](const key_type& k) { return metadata[k]; }
//! provide a special case for accessing a name
std::string name() const { return metadata.find(name_str)->second; }
//! Generic metadata handling
//@{
+ //! begin iterator
+ iterator begin() { return metadata.begin(); }
+ //! const begin iterator
+ const_iterator begin() const { return metadata.begin(); }
+ //! end iterator
+ iterator end() { return metadata.end(); }
+ //! const end iterator
+ const_iterator end() const { return metadata.end(); }
//! remove some key from our "dictionary"
void erase(const std::string& key);
+ //! find an element in the map
+ iterator find( const key_type& key) { return metadata.find(key); }
+ const_iterator find( const key_type& key) const { return metadata.find(key); }
//! set a metadata element
void set(const std::string key, const std::string value );
//! look for a key, \throws annotation_key_error if it doesn't find it
std::string getdefault(const std::string key, std::string default_value) const;
//! check for a key
bool has_key(const std::string key) const;
- //! return all the keys of our metadata map
- //std::list<std::string> keys() const;
+ //! return number of items in the map
size_type size() const { return metadata.size(); }
//@}
protected: