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"
31 * The class holds all all open buffers, and handles construction
32 * and deletions of new ones.
36 typedef std::vector
<Buffer
*>::iterator iterator
;
37 typedef std::vector
<Buffer
*>::const_iterator const_iterator
;
44 const_iterator
begin() const;
47 const_iterator
end() const;
49 /// create a new buffer
50 /// \return 0 if the Buffer creation is not possible for whatever reason.
51 Buffer
* newBuffer(std::string
const & s
, bool ronly
= false);
54 void release(Buffer
* b
);
56 /// Release \p child if it really is a child and is not used elsewhere.
57 /// \return true is the file was closed.
58 bool releaseChild(Buffer
* parent
, Buffer
* child
);
60 /// Close all open buffers.
63 /// returns a vector with all the buffers filenames
64 support::FileNameList
const & fileNames() const;
67 void updateIncludedTeXfiles(std::string
const &, OutputParams
const &);
69 /// emergency save for all buffers
70 void emergencyWriteAll();
72 /// return true if no buffers loaded
75 /// return head of buffer list if any
78 /// return back of buffer list if any
81 /// returns true if the buffer exists already
82 bool exists(support::FileName
const &) const;
84 /// returns true if the buffer is loaded
85 bool isLoaded(Buffer
const * b
) const;
87 /// return index of named buffer in buffer list
88 int bufferNum(support::FileName
const & name
) const;
89 /// returns a pointer to the buffer with the given name.
90 Buffer
* getBuffer(support::FileName
const &) const;
91 /// returns a pointer to the buffer with the given number.
92 Buffer
* getBuffer(unsigned int);
93 /// returns a pointer to the buffer whose temppath matches the string
94 Buffer
* getBufferFromTmp(std::string
const &);
96 /** returns a pointer to the buffer that follows argument in
97 * buffer list. The buffer following the last in list is the
100 Buffer
* next(Buffer
const *) const;
102 /** returns a pointer to the buffer that precedes argument in
103 * buffer list. The buffer preceding the first in list is the
106 Buffer
* previous(Buffer
const *) const;
108 /// reset current author for all buffers
109 void setCurrentAuthor(docstring
const & name
, docstring
const & email
);
113 BufferList(BufferList
const &);
114 void operator=(BufferList
const &);
116 typedef std::vector
<Buffer
*> BufferStorage
;
118 /// storage of all buffers
119 BufferStorage bstore
;
120 /// storage of all internal buffers used for cut&paste, etc.
121 BufferStorage binternal
;
124 /// Implementation is in LyX.cpp
125 extern BufferList
& theBufferList();
130 #endif // BUFFERLIST_H