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"
30 * The class holds all all open buffers, and handles construction
31 * and deletions of new ones.
35 typedef std::vector<Buffer *>::iterator iterator;
36 typedef std::vector<Buffer *>::const_iterator const_iterator;
42 const_iterator begin() const;
45 const_iterator end() const;
47 /// create a new buffer
48 /// \return 0 if the Buffer creation is not possible for whatever reason.
49 Buffer * newBuffer(std::string const & s, bool ronly = false);
52 void release(Buffer * b);
54 /// Release \p child if it really is a child and is not used elsewhere.
55 /// \return true is the file was closed.
56 bool releaseChild(Buffer * parent, Buffer * child);
58 /// Close all open buffers.
61 /// returns a vector with all the buffers filenames
62 std::vector<std::string> const getFileNames() const;
65 void updateIncludedTeXfiles(std::string const &, OutputParams const &);
67 /// emergency save for all buffers
68 void emergencyWriteAll();
70 /// save emergency file for the given buffer
72 * \return a status message towards the user.
74 docstring emergencyWrite(Buffer * buf);
76 /// return true if no buffers loaded
79 /// return head of buffer list if any
82 /// return back of buffer list if any
85 /// returns true if the buffer exists already
86 bool exists(support::FileName const &) const;
88 /// returns true if the buffer is loaded
89 bool isLoaded(Buffer const * b) const;
91 /// return index of named buffer in buffer list
92 int bufferNum(std::string const & name) const;
93 /// returns a pointer to the buffer with the given name.
94 Buffer * getBuffer(support::FileName const &) const;
95 /// returns a pointer to the buffer with the given number.
96 Buffer * getBuffer(unsigned int);
97 /// returns a pointer to the buffer whose temppath matches the string
98 Buffer * getBufferFromTmp(std::string const &);
100 /** returns a pointer to the buffer that follows argument in
101 * buffer list. The buffer following the last in list is the
104 Buffer * next(Buffer const *) const;
106 /** returns a pointer to the buffer that precedes argument in
107 * buffer list. The buffer preceding the first in list is the
110 Buffer * previous(Buffer const *) const;
112 /// reset current author for all buffers
113 void setCurrentAuthor(docstring const & name, docstring const & email);
117 BufferList(BufferList const &);
118 void operator=(BufferList const &);
120 typedef std::vector<Buffer *> BufferStorage;
122 /// storage of all buffers
123 BufferStorage bstore;
126 /// Implementation is in LyX.cpp
127 extern BufferList & theBufferList();
132 #endif // BUFFERLIST_H