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"
31 * The class holds all all open buffers, and handles construction
32 * and deletions of new ones.
36 typedef std::vector<Buffer *>::iterator iterator;
37 typedef std::vector<Buffer *>::const_iterator const_iterator;
43 const_iterator begin() const;
46 const_iterator end() const;
48 /// create a new buffer
49 /// \return 0 if the Buffer creation is not possible for whatever reason.
50 Buffer * newBuffer(std::string const & s, bool ronly = false);
53 void release(Buffer * b);
55 /// Release \p child if it really is a child and is not used elsewhere.
56 /// \return true is the file was closed.
57 bool releaseChild(Buffer * parent, Buffer * child);
59 /// Close all open buffers.
62 /// returns a vector with all the buffers filenames
63 support::FileNameList const & fileNames() const;
66 void updateIncludedTeXfiles(std::string const &, OutputParams const &);
68 /// emergency save for all buffers
69 void emergencyWriteAll();
71 /// save emergency file for the given buffer
73 * \return a status message towards the user.
75 docstring emergencyWrite(Buffer * buf);
77 /// return true if no buffers loaded
80 /// return head of buffer list if any
83 /// return back of buffer list if any
86 /// returns true if the buffer exists already
87 bool exists(support::FileName const &) const;
89 /// returns true if the buffer is loaded
90 bool isLoaded(Buffer const * b) const;
92 /// return index of named buffer in buffer list
93 int bufferNum(support::FileName const & name) const;
94 /// returns a pointer to the buffer with the given name.
95 Buffer * getBuffer(support::FileName const &) const;
96 /// returns a pointer to the buffer with the given number.
97 Buffer * getBuffer(unsigned int);
98 /// returns a pointer to the buffer whose temppath matches the string
99 Buffer * getBufferFromTmp(std::string const &);
101 /** returns a pointer to the buffer that follows argument in
102 * buffer list. The buffer following the last in list is the
105 Buffer * next(Buffer const *) const;
107 /** returns a pointer to the buffer that precedes argument in
108 * buffer list. The buffer preceding the first in list is the
111 Buffer * previous(Buffer const *) const;
113 /// reset current author for all buffers
114 void setCurrentAuthor(docstring const & name, docstring const & email);
118 BufferList(BufferList const &);
119 void operator=(BufferList const &);
121 typedef std::vector<Buffer *> BufferStorage;
123 /// storage of all buffers
124 BufferStorage bstore;
127 /// Implementation is in LyX.cpp
128 extern BufferList & theBufferList();
133 #endif // BUFFERLIST_H