m[k] = STLBinaryCode<E> (v, d);
}
-
template <class E, class F>
E
file_to_enum (F k, map<F, STLBinaryCode<E> > m, string name)
return "";
}
+
+template <class E, class F>
+boost::optional<E>
+description_to_enum (string d, map<F, STLBinaryCode<E> > const & m)
+{
+ for (typename map<F, STLBinaryCode<E> >::const_iterator i = m.begin(); i != m.end(); ++i) {
+ if (i->second.description == d) {
+ return i->second.value;
+ }
+ }
+
+ return boost::optional<E> ();
+}
DisplayStandard
STLBinaryTables::display_standard_file_to_enum (string s) const
return enum_to_description (v, _comment_map);
}
+boost::optional<Language>
+STLBinaryTables::language_description_to_enum (string d) const
+{
+ return description_to_enum (d, _language_map);
+}
+
STLBinaryTables::STLBinaryTables ()
{
code<DisplayStandard, string> (_display_standard_map, " ", DISPLAY_STANDARD_UNDEFINED, "Undefined");
#include <string>
#include <map>
+#include <boost/optional.hpp>
namespace sub {
std::string justification_enum_to_description (Justification) const;
std::string comment_enum_to_description (Comment) const;
+ boost::optional<Language> language_description_to_enum (std::string) const;
+
private:
std::map<std::string, STLBinaryCode<DisplayStandard> > _display_standard_map;
std::map<std::string, STLBinaryCode<LanguageGroup> > _language_group_map;