Add missing include, due to André LASSERT change
[lyx.git] / src / BufferList.h
blobf6804c522630a290b389cd8d68e3b7239ac6aa82
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 "support/docstring.h"
17 #include <vector>
20 namespace lyx {
22 class Buffer;
23 class OutputParams;
25 /**
26 * The class holds all all open buffers, and handles construction
27 * and deletions of new ones.
29 class BufferList {
30 public:
31 typedef std::vector<Buffer *>::iterator iterator;
32 typedef std::vector<Buffer *>::const_iterator const_iterator;
34 public:
35 BufferList();
37 iterator begin();
38 const_iterator begin() const;
40 iterator end();
41 const_iterator end() const;
43 /// create a new buffer
44 /// \return 0 if the Buffer creation is not possible for whatever reason.
45 Buffer * newBuffer(std::string const & s, bool ronly = false);
47 /// delete a buffer
48 void release(Buffer * b);
50 /// Close all open buffers.
51 void closeAll();
53 /// returns a vector with all the buffers filenames
54 std::vector<std::string> const getFileNames() const;
56 /// FIXME
57 void updateIncludedTeXfiles(std::string const &, OutputParams const &);
59 /// emergency save for all buffers
60 void emergencyWriteAll();
62 /// save emergency file for the given buffer
63 /**
64 * \return a status message towards the user.
66 docstring emergencyWrite(Buffer * buf);
68 /// return true if no buffers loaded
69 bool empty() const;
71 /// return head of buffer list if any
72 Buffer * first();
74 /// return back of buffer list if any
75 Buffer * last();
77 /// returns true if the buffer exists already
78 bool exists(std::string const &) const;
80 /// returns true if the buffer is loaded
81 bool isLoaded(Buffer const * b) const;
83 /// return index of named buffer in buffer list
84 int bufferNum(std::string const & name) const;
85 /// returns a pointer to the buffer with the given name.
86 Buffer * getBuffer(std::string const &);
87 /// returns a pointer to the buffer with the given number.
88 Buffer * getBuffer(unsigned int);
89 /// returns a pointer to the buffer whose temppath matches the string
90 Buffer * getBufferFromTmp(std::string const &);
92 /** returns a pointer to the buffer that follows argument in
93 * buffer list. The buffer following the last in list is the
94 * first one.
96 Buffer * next(Buffer const *) const;
98 /** returns a pointer to the buffer that precedes argument in
99 * buffer list. The buffer preceding the first in list is the
100 * last one.
102 Buffer * previous(Buffer const *) const;
104 /// reset current author for all buffers
105 void setCurrentAuthor(docstring const & name, docstring const & email);
107 private:
108 /// noncopiable
109 BufferList(BufferList const &);
110 void operator=(BufferList const &);
112 typedef std::vector<Buffer *> BufferStorage;
114 /// storage of all buffers
115 BufferStorage bstore;
118 /// Implementation is in LyX.cpp
119 extern BufferList & theBufferList();
122 } // namespace lyx
124 #endif // BUFFERLIST_H