}
-void MacroTable::insert(docstring const & name, MacroData const & data)
+MacroTable::iterator
+MacroTable::insert(docstring const & name, MacroData const & data)
{
//lyxerr << "MacroTable::insert: " << to_utf8(name) << endl;
- operator[](name) = data;
+ iterator it = find(name);
+ if (it == end())
+ it = map<docstring, MacroData>::insert(
+ make_pair(name, data)).first;
+ else
+ it->second = data;
+ return it;
}
-void MacroTable::insert(Buffer * buf, docstring const & def, string const & requires)
+MacroTable::iterator
+MacroTable::insert(Buffer * buf, docstring const & def, string const & requires)
{
//lyxerr << "MacroTable::insert, def: " << to_utf8(def) << endl;
MathMacroTemplate mac(buf, def);
MacroData data(buf, mac);
data.requires() = requires;
- insert(mac.name(), data);
+ return insert(mac.name(), data);
}
{
public:
/// Parse full "\\def..." or "\\newcommand..." or ...
- void insert(Buffer * buf, docstring const & definition, std::string const &);
+ iterator insert(Buffer * buf, docstring const & definition, std::string const &);
/// Insert pre-digested macro definition
- void insert(docstring const & name, MacroData const & data);
+ iterator insert(docstring const & name, MacroData const & data);
///
MacroData const * get(docstring const & name) const;
///
string macro;
string requires;
is >> macro >> requires;
- MacroTable::globalMacros().insert(0, from_utf8(macro), requires);
+ MacroTable::iterator it = MacroTable::globalMacros().insert(
+ 0, from_utf8(macro), requires);
+ // If you change the following output, please adjust
+ // development/tools/generate_symbols_images.py.
+ LYXERR(Debug::MATHED, "read symbol '" << to_utf8(it->first)
+ << " inset: macro"
+ << " draw: 0"
+ << " extra: "
+ << " requires: " << requires << '\'');
continue;
}