\end_document replaces \the_end.
[lyx.git] / src / bufferlist.h
blob4cedb64c9b5e0e2334626d521c1230861df352b2
1 // -*- C++ -*-
2 /**
3 * \file bufferlist.h
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
12 #ifndef BUFFER_LIST_H
13 #define BUFFER_LIST_H
15 #include "LString.h"
17 #include <boost/utility.hpp>
19 #include <vector>
21 class Buffer;
22 class LatexRunParams;
24 /**
25 * The class holds all all open buffers, and handles construction
26 * and deletions of new ones.
28 class BufferList : boost::noncopyable {
29 public:
30 BufferList();
32 /// write all buffers, asking the user, returns false if cancelled
33 bool quitWriteAll();
35 /// create a new buffer
36 Buffer * newBuffer(string const & s, bool ronly = false);
38 /// delete a buffer
39 void release(Buffer * b);
41 /// Close all open buffers.
42 void closeAll();
44 /// returns a vector with all the buffers filenames
45 std::vector<string> const getFileNames() const;
47 /// FIXME
48 void updateIncludedTeXfiles(string const &, LatexRunParams const &);
50 /// emergency save for all buffers
51 void emergencyWriteAll();
53 /// close buffer. Returns false if cancelled by user
54 bool close(Buffer * buf, bool ask);
56 /// return true if no buffers loaded
57 bool empty() const;
59 /// return head of buffer list if any
60 Buffer * first();
62 /// returns true if the buffer exists already
63 bool exists(string const &) const;
65 /// returns true if the buffer is loaded
66 bool isLoaded(Buffer const * b) const;
68 /// returns a pointer to the buffer with the given name.
69 Buffer * getBuffer(string const &);
70 /// returns a pointer to the buffer with the given number.
71 Buffer * getBuffer(unsigned int);
73 /// reset current author for all buffers
74 void setCurrentAuthor(string const & name, string const & email);
76 private:
77 /// ask to save a buffer on quit, returns false if should cancel
78 bool quitWriteBuffer(Buffer * buf);
80 typedef std::vector<Buffer *> BufferStorage;
82 /// storage of all buffers
83 BufferStorage bstore;
85 /// save emergency file for the given buffer
86 void emergencyWrite(Buffer * buf);
89 #endif // BUFFERLIST_H