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 /// return back of buffer list if any
67 /// returns true if the buffer exists already
68 bool exists(std::string const &) const;
70 /// returns true if the buffer is loaded
71 bool isLoaded(Buffer const * b) const;
73 /// returns a pointer to the buffer with the given name.
74 Buffer * getBuffer(std::string const &);
75 /// returns a pointer to the buffer with the given number.
76 Buffer * getBuffer(unsigned int);
77 /// returns a pointer to the buffer whose temppath matches the string
78 Buffer * getBufferFromTmp(std::string const &);
80 /** returns a pointer to the buffer that follows argument in
81 * buffer list. The buffer following the last in list is the
84 Buffer * next(Buffer const *) const;
86 /** returns a pointer to the buffer that precedes argument in
87 * buffer list. The buffer preceding the first in list is the
90 Buffer * previous(Buffer const *) const;
92 /// reset current author for all buffers
93 void setCurrentAuthor(std::string const & name, std::string const & email);
96 /// ask to save a buffer on quit, returns false if should cancel
97 bool quitWriteBuffer(Buffer * buf);
99 typedef std::vector<Buffer *> BufferStorage;
101 /// storage of all buffers
102 BufferStorage bstore;
104 /// save emergency file for the given buffer
105 void emergencyWrite(Buffer * buf);
108 /// Implementation is in lyx_main.C
109 extern BufferList & theBufferList();
114 #endif // BUFFERLIST_H