4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
15 #include "support/docstring.h"
32 * The class holds all all open buffers, and handles construction
33 * and deletions of new ones.
37 typedef std::vector<Buffer *>::iterator iterator;
38 typedef std::vector<Buffer *>::const_iterator const_iterator;
45 const_iterator begin() const;
48 const_iterator end() const;
50 /// create a new buffer
51 /// \return 0 if the Buffer creation is not possible for whatever reason.
52 Buffer * newBuffer(std::string const & s, bool ronly = false);
55 void release(Buffer * b);
57 /// Release \p child if it really is a child and is not used elsewhere.
58 /// \return true is the file was closed.
59 bool releaseChild(Buffer * parent, Buffer * child);
61 /// Close all open buffers.
64 /// returns a vector with all the buffers filenames
65 support::FileNameList const & fileNames() const;
67 /// return true if no buffers loaded
70 /// return head of buffer list if any
73 /// return back of buffer list if any
76 /// returns true if the buffer exists already
77 bool exists(support::FileName const &) const;
79 /// returns true if the buffer is loaded
80 bool isLoaded(Buffer const * b) const;
82 /// \return index of named buffer in buffer list
83 int bufferNum(support::FileName const & name) const;
84 /// \return a pointer to the buffer with the given name
85 Buffer * getBuffer(support::FileName const & name) const;
86 /// \return a pointer to the buffer with the given number
87 Buffer * getBuffer(unsigned int);
88 /// \return a pointer to the buffer whose temppath matches the given path
89 Buffer * getBufferFromTmp(std::string const & path);
91 /** returns a pointer to the buffer that follows argument in
92 * buffer list. The buffer following the last in list is the
95 Buffer * next(Buffer const *) const;
97 /** returns a pointer to the buffer that precedes argument in
98 * buffer list. The buffer preceding the first in list is the
101 Buffer * previous(Buffer const *) const;
103 /// \name Functions that just operate on all buffers
105 /// reset current author for all buffers
106 void recordCurrentAuthor(Author const & author);
107 /// Call changed() on all buffers, internal or not
108 void changed(bool update_metrics) const;
109 /// emergency save for all buffers
110 void emergencyWriteAll();
112 void updateIncludedTeXfiles(std::string const &, OutputParams const &);
117 BufferList(BufferList const &);
118 void operator=(BufferList const &);
120 typedef std::vector<Buffer *> BufferStorage;
122 /// storage of all buffers
123 BufferStorage bstore;
124 /// storage of all internal buffers used for cut&paste, etc.
125 BufferStorage binternal;
128 /// Implementation is in LyX.cpp
129 extern BufferList & theBufferList();
134 #endif // BUFFERLIST_H