///
CloneList_ptr clone_list_;
+ ///
+ std::list<Buffer const *> include_list_;
private:
/// So we can force access via the accessors.
mutable Buffer const * parent_buffer;
}
+void Buffer::pushIncludedBuffer(Buffer const * buf) const
+{
+ masterBuffer()->d->include_list_.push_back(buf);
+ if (lyxerr.debugging(Debug::FILES)) {
+ LYXERR0("Pushed. Stack now:");
+ if (masterBuffer()->d->include_list_.empty())
+ LYXERR0("EMPTY!");
+ else
+ for (auto const & b : masterBuffer()->d->include_list_)
+ LYXERR0(b->fileName());
+ }
+}
+
+
+void Buffer::popIncludedBuffer() const
+{
+ masterBuffer()->d->include_list_.pop_back();
+ if (lyxerr.debugging(Debug::FILES)) {
+ LYXERR0("Popped. Stack now:");
+ if (masterBuffer()->d->include_list_.empty())
+ LYXERR0("EMPTY!");
+ else
+ for (auto const & b : masterBuffer()->d->include_list_)
+ LYXERR0(b->fileName());
+ }
+}
+
+
+bool Buffer::isBufferIncluded(Buffer const * buf) const
+{
+ if (!buf)
+ return false;
+ if (lyxerr.debugging(Debug::FILES)) {
+ LYXERR0("Checking for " << buf->fileName() << ". Stack now:");
+ if (masterBuffer()->d->include_list_.empty())
+ LYXERR0("EMPTY!");
+ else
+ for (auto const & b : masterBuffer()->d->include_list_)
+ LYXERR0(b->fileName());
+ }
+ list<Buffer const *> const & blist = masterBuffer()->d->include_list_;
+ return find(blist.begin(), blist.end(), buf) != blist.end();
+}
+
+
+void Buffer::clearIncludeList() const
+{
+ LYXERR(Debug::FILES, "Clearing include list for " << fileName());
+ d->include_list_.clear();
+}
+
} // namespace lyx
///
support::FileName getBibfilePath(docstring const & bibid) const;
+ /// routines for dealing with possible self-inclusion
+ void pushIncludedBuffer(Buffer const * buf) const;
+ void popIncludedBuffer() const;
+ bool isBufferIncluded(Buffer const * buf) const;
+private:
+ void clearIncludeList() const;
+
private:
friend class MarkAsExporting;
/// mark the buffer as busy exporting something, or not