2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-1999 The LyX Team
9 * This file is Copyright 1996
12 * ====================================================== */
24 /** A class to hold all the buffers in a structure
25 The point of this class is to hide from bufferlist what kind
26 of structure the buffers are stored in. Should be no concern for
27 bufferlist if the buffers is in a array or in a linked list.
29 This class should ideally be enclosed inside class BufferList, but that
30 gave me an "internal gcc error".
35 typedef vector<Buffer *> Container;
37 typedef Container::iterator iterator;
39 bool empty() const { return container.empty(); }
41 void release(Buffer * buf);
43 Buffer * newBuffer(string const & s, LyXRC *, bool = false);
45 Container::iterator begin() { return container.begin(); }
47 Container::iterator end() { return container.end(); }
49 Buffer * front() { return container.front(); }
51 Buffer * operator[](int c) { return container[c]; }
53 int size() const { return container.size(); }
60 /** The class governing all the open buffers
61 This class governs all the currently open buffers. Currently all the buffer
62 are located in a static array, soon this will change and we will have a
78 /// returns the state of the bufferlist
79 list_state getState() { return _state; }
81 /** loads a LyX file or...
82 If the optional argument tolastfiles is false (default is
83 true), the file name will not be added to the last opened
86 Buffer * loadLyXFile(string const & filename,
87 bool tolastfiles = true);
92 /// Saves buffer. Returns false if unsuccesful.
93 bool write(Buffer *, bool makeBackup);
98 /// Close all open buffers.
104 /// Read a file into a buffer readonly or not.
105 Buffer * readFile(string const &, bool ro);
107 /// Make a new file (buffer) using a template
108 Buffer * newFile(string const &, string);
110 /** This one must be moved to some other place.
115 void updateInset(Inset *, bool = true);
118 int unlockInset(UpdatableInset *);
121 void updateIncludedTeXfiles(string const &);
124 void emergencyWriteAll();
127 Returns false if operation was canceled
129 bool close(Buffer *);
134 /// returns true if the buffer exists already
135 bool exists(string const &);
137 /// returns a pointer to the buffer with the given name.
138 Buffer * getBuffer(string const &);
139 /// returns a pointer to the buffer with the given number.
140 Buffer * getBuffer(int);
144 BufferStorage bstore;