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 "support/docstring.h"
32 * The class holds all all open buffers, and handles construction
33 * and deletions of new ones.
37 typedef std::vector<Buffer *>::iterator iterator;
38 typedef std::vector<Buffer *>::const_iterator const_iterator;
45 const_iterator begin() const;
48 const_iterator end() const;
50 /// create a new buffer
51 /// \return 0 if the Buffer creation is not possible for whatever reason.
52 Buffer * newBuffer(std::string const & s, bool ronly = false);
55 void release(Buffer * b);
57 /// Release \p child if it really is a child and is not used elsewhere.
58 /// \return true is the file was closed.
59 bool releaseChild(Buffer * parent, Buffer * child);
61 /// Close all open buffers.
64 /// returns a vector with all the buffers filenames
65 support::FileNameList const & fileNames() const;
67 /// return true if no buffers loaded
70 /// return head of buffer list if any
73 /// return back of buffer list if any
76 /// returns true if the buffer exists already
77 bool exists(support::FileName const &) const;
79 /// returns true if the buffer is loaded
80 bool isLoaded(Buffer const * b) const;
82 /// \return index of named buffer in buffer list
83 int bufferNum(support::FileName const & name) const;
85 /** returns a pointer to the buffer with the given name
88 * If true, the buffer is searched also among internal buffers
90 Buffer * getBuffer(support::FileName const & name, bool internal = false) const;
92 /// \return a pointer to the buffer with the given number
93 Buffer * getBuffer(unsigned int);
95 /// \return a pointer to the buffer whose temppath matches the given path
96 Buffer * getBufferFromTmp(std::string const & path);
98 /** returns a pointer to the buffer that follows argument in
99 * buffer list. The buffer following the last in list is the
102 Buffer * next(Buffer const *) const;
104 /** returns a pointer to the buffer that precedes argument in
105 * buffer list. The buffer preceding the first in list is the
108 Buffer * previous(Buffer const *) const;
110 /// \name Functions that just operate on all buffers
112 /// reset current author for all buffers
113 void recordCurrentAuthor(Author const & author);
114 /// Call changed() on all buffers, internal or not
115 void changed(bool update_metrics) const;
116 /// emergency save for all buffers
117 void emergencyWriteAll();
119 void updateIncludedTeXfiles(std::string const &, OutputParams const &);
124 BufferList(BufferList const &);
125 void operator=(BufferList const &);
127 typedef std::vector<Buffer *> BufferStorage;
129 /// storage of all buffers
130 BufferStorage bstore;
131 /// storage of all internal buffers used for cut&paste, etc.
132 BufferStorage binternal;
135 /// Implementation is in LyX.cpp
136 extern BufferList & theBufferList();
141 #endif // BUFFERLIST_H