TempName & TempName::operator=(TempName const & other)
{
if (this != &other) {
- tempname_.removeFile();
+ if (!tempname_.empty())
+ tempname_.removeFile();
support::TempFile f("lyxextXXXXXX.tmp");
f.setAutoRemove(false);
tempname_ = f.name();
void InsetExternal::addToToc(DocIterator const & cpit, bool output_active,
UpdateType) const
{
- DocIterator pit = cpit;
- pit.push_back(CursorSlice(const_cast<InsetExternal &>(*this)));
- shared_ptr<Toc> toc = buffer().tocBackend().toc("external");
docstring str = screenLabel(params_, buffer());
- toc->push_back(TocItem(pit, 0, str, output_active));
+ TocBuilder & b = buffer().tocBackend().builder("external");
+ b.pushItem(cpit, str, output_active);
+ b.pop();
}
external::TemplateManager & etm = external::TemplateManager::get();
- it = cit->second.preambleNames.begin();
- end = cit->second.preambleNames.end();
- for (; it != end; ++it) {
- string const preamble = etm.getPreambleDefByName(*it);
+ for (string const & name : cit->second.preambleNames) {
+ docstring const preamble = etm.getPreambleDefByName(name);
if (!preamble.empty())
features.addPreambleSnippet(preamble);
}