3 #include <msp/core/hash.h>
4 #include <msp/strings/format.h>
12 map<Msp::GL::Tag, string> &get_tag_names()
14 static map<Msp::GL::Tag, string> names;
24 Tag::Tag(const char *s):
25 id((s && *s) ? hash32(s, strlen(s)) : 0)
29 get_tag_names().insert(make_pair(*this, string(s)));
33 Tag::Tag(const string &s):
34 id(s.empty() ? 0 : hash32(s))
38 get_tag_names().insert(make_pair(*this, s));
42 string Tag::str() const
45 const auto &names = get_tag_names();
46 auto i = names.find(*this);
50 return format("Tag(%d)", id);
53 void operator<<(LexicalConverter &conv, Tag tag)
55 conv.result(tag.str());