1 #include "annotations.hpp"
3 const std::string Annotations::name_str("name");
5 Annotations::Annotations()
7 metadata[name_str] = "";
10 Annotations::Annotations(const std::string n)
12 metadata[name_str] = n;
15 Annotations::Annotations(const Annotations& a) :
20 Annotations::Annotations(const AnnotationsRef a) :
25 AnnotationsRef Annotations::copy() const
27 AnnotationsRef a(new Annotations(*this));
31 void Annotations::erase(const std::string& key)
33 if (key == name_str) {
34 // we must always have a name
41 void Annotations::set(const std::string key, const std::string value )
43 metadata[key] = value;
46 std::string Annotations::get(const std::string key) const
48 metadata_map::const_iterator map_i(metadata.find(key));
49 if (map_i == metadata.end()) {
50 throw annotations_key_error(key + " was not found");
56 std::string Annotations::getdefault(const std::string key, std::string default_value) const
60 } catch(annotations_key_error e) {
65 bool Annotations::has_key(const std::string key) const
67 metadata_map::const_iterator map_i(metadata.find(key));
68 return map_i != metadata.end();