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"
26 * The class holds all all open buffers, and handles construction
27 * and deletions of new ones.
31 typedef std::vector<Buffer *>::iterator iterator;
32 typedef std::vector<Buffer *>::const_iterator const_iterator;
38 const_iterator begin() const;
41 const_iterator end() const;
43 /// create a new buffer
44 Buffer * newBuffer(std::string const & s, bool ronly = false);
47 void release(Buffer * b);
49 /// Close all open buffers.
52 /// returns a vector with all the buffers filenames
53 std::vector<std::string> const getFileNames() const;
56 void updateIncludedTeXfiles(std::string const &, OutputParams const &);
58 /// emergency save for all buffers
59 void emergencyWriteAll();
61 /// return true if no buffers loaded
64 /// return head of buffer list if any
67 /// return back of buffer list if any
70 /// returns true if the buffer exists already
71 bool exists(std::string const &) const;
73 /// returns true if the buffer is loaded
74 bool isLoaded(Buffer const * b) const;
76 /// return index of named buffer in buffer list
77 int bufferNum(std::string const & name) const;
78 /// returns a pointer to the buffer with the given name.
79 Buffer * getBuffer(std::string const &);
80 /// returns a pointer to the buffer with the given number.
81 Buffer * getBuffer(unsigned int);
82 /// returns a pointer to the buffer whose temppath matches the string
83 Buffer * getBufferFromTmp(std::string const &);
85 /** returns a pointer to the buffer that follows argument in
86 * buffer list. The buffer following the last in list is the
89 Buffer * next(Buffer const *) const;
91 /** returns a pointer to the buffer that precedes argument in
92 * buffer list. The buffer preceding the first in list is the
95 Buffer * previous(Buffer const *) const;
97 /// reset current author for all buffers
98 void setCurrentAuthor(docstring const & name, docstring const & email);
102 BufferList(BufferList const &);
103 void operator=(BufferList const &);
105 typedef std::vector<Buffer *> BufferStorage;
107 /// storage of all buffers
108 BufferStorage bstore;
110 /// save emergency file for the given buffer
111 void emergencyWrite(Buffer * buf);
114 /// Implementation is in LyX.cpp
115 extern BufferList & theBufferList();
120 #endif // BUFFERLIST_H