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 <boost/utility.hpp>
24 * The class holds all all open buffers, and handles construction
25 * and deletions of new ones.
27 class BufferList : boost::noncopyable {
31 /// write all buffers, asking the user, returns false if cancelled
34 /// create a new buffer
35 Buffer * newBuffer(std::string const & s, bool ronly = false);
38 void release(Buffer * b);
40 /// Close all open buffers.
43 /// returns a vector with all the buffers filenames
44 std::vector<std::string> const getFileNames() const;
47 void updateIncludedTeXfiles(std::string const &, OutputParams const &);
49 /// emergency save for all buffers
50 void emergencyWriteAll();
52 /// close buffer. Returns false if cancelled by user
53 bool close(Buffer * buf, bool ask);
55 /// return true if no buffers loaded
58 /// return head of buffer list if any
61 /// returns true if the buffer exists already
62 bool exists(std::string const &) const;
64 /// returns true if the buffer is loaded
65 bool isLoaded(Buffer const * b) const;
67 /// returns a pointer to the buffer with the given name.
68 Buffer * getBuffer(std::string const &);
69 /// returns a pointer to the buffer with the given number.
70 Buffer * getBuffer(unsigned int);
71 /// returns a pointer to the buffer whose temppath matches the string
72 Buffer * BufferList::getBufferFromTmp(std::string const &);
74 /** returns a pointer to the buffer that follows argument in
75 * buffer list. The buffer following the last in list is the
78 Buffer * next(Buffer const *) const;
80 /** returns a pointer to the buffer that precedes argument in
81 * buffer list. The buffer preceding the first in list is the
84 Buffer * previous(Buffer const *) const;
86 /// reset current author for all buffers
87 void setCurrentAuthor(std::string const & name, std::string const & email);
90 /// ask to save a buffer on quit, returns false if should cancel
91 bool quitWriteBuffer(Buffer * buf);
93 typedef std::vector<Buffer *> BufferStorage;
95 /// storage of all buffers
98 /// save emergency file for the given buffer
99 void emergencyWrite(Buffer * buf);
102 #endif // BUFFERLIST_H