#include "lyxlex.h"
#include "support/filetools.h"
-#include "support/LAssert.h"
#include "support/lstrings.h"
#include "support/path.h"
#include "support/path_defines.h"
+#include <boost/assert.hpp>
+
#include <algorithm>
namespace support = lyx::support;
using std::endl;
using std::for_each;
+
using std::ostream;
+using std::vector;
// We have to have dummy default commands for security reasons!
ExternalTemplateManager::ExternalTemplateManager()
{
- // gimp gnuchess gnuplot ical netscape tetris xpaint
readTemplates(support::user_lyxdir());
if (lyxerr.debugging(Debug::EXTERNAL)) {
dumpPreambleDefs(lyxerr);
<< "\t\tProduct " << ft.product << '\n'
<< "\t\tUpdateFormat " << ft.updateFormat << '\n'
<< "\t\tUpdateResult " << ft.updateResult << '\n'
- << "\t\tRequirement " << ft.requirement << '\n'
- << "\t\tPreamble " << ft.preambleName << '\n'
- << "\tFormatEnd\n";
+ << "\t\tRequirement " << ft.requirement << '\n';
+
+ vector<string>::const_iterator it = ft.preambleNames.begin();
+ vector<string>::const_iterator end = ft.preambleNames.end();
+ for (; it != end; ++it) {
+ ost << "\t\tPreamble " << *it << '\n';
+ }
+
+ ost << "\tFormatEnd\n";
}
private:
ostream & ost;
}
-ExternalTemplate const & ExternalTemplateManager::getTemplateByName(string const & name)
+ExternalTemplate const *
+ExternalTemplateManager::getTemplateByName(string const & name) const
{
- return templates[name];
+ Templates::const_iterator it = templates.find(name);
+ return (it == templates.end()) ? 0 : &it->second;
}
default:
lex.printError("ExternalTemplate::readTemplate: "
"Wrong tag: $$Token");
- support::Assert(false);
+ BOOST_ASSERT(false);
break;
}
}
case FO_PREAMBLE:
lex.next(true);
- preambleName = lex.getString();
+ preambleNames.push_back(lex.getString());
break;
case FO_END: