37 s <<
"unknown enumerator " << e <<
" in PBD::EnumWriter";
43 virtual const char *
what()
const throw() {
44 return _message.c_str();
57 void register_bits (std::string type, std::vector<int>, std::vector<std::string>);
59 std::string
write (std::string type,
int value);
60 int read (std::string type, std::string value);
75 : values (v), names (s), bitwise (b) {}
78 typedef std::map<std::string, EnumRegistration>
Registry;
96 #define enum_2_string(e) (PBD::EnumWriter::instance().write (typeid(e).name(), e))
97 #define string_2_enum(str,e) (PBD::EnumWriter::instance().read (typeid(e).name(), (str)))
void add_to_hack_table(std::string str, std::string hacked_str)
static EnumWriter & instance()
int validate_bitwise(EnumRegistration &er, int value) const
void register_bits(std::string type, std::vector< int >, std::vector< std::string >)
int read_distinct(EnumRegistration &, std::string value)
void register_distinct(std::string type, std::vector< int >, std::vector< std::string >)
static std::map< std::string, std::string > hack_table
int read_bits(EnumRegistration &, std::string value)
std::string write(std::string type, int value)
int read(std::string type, std::string value)
std::string write_distinct(EnumRegistration &, int value)
static EnumWriter * _instance
std::string write_bits(EnumRegistration &, int value)
int validate(EnumRegistration &er, int value) const
std::map< std::string, EnumRegistration > Registry
virtual const char * what() const
unknown_enumeration(std::string const &e)
std::vector< std::string > names
std::vector< int > values
EnumRegistration(std::vector< int > &v, std::vector< std::string > &s, bool b)