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