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".
39 void release(Buffer* buf);
41 Buffer* newBuffer(string const &s, LyXRC *, bool =false);
44 /** The max number of buffers there are possible to have
45 loaded at the same time. (this only applies when we use an
48 NUMBER_OF_BUFFERS = 50
51 /** The Bufferlist is currently implemented as a static array.
52 The buffers are new'ed and deleted as reqested.
54 Buffer *buffer[NUMBER_OF_BUFFERS];
56 friend class BufferStorage_Iter;
59 /// An Iterator class for BufferStorage
60 class BufferStorage_Iter {
63 BufferStorage_Iter(const BufferStorage & bs)
66 Buffer* operator() ();
68 Buffer* operator[] (int a);
71 const BufferStorage *cs;
78 /** The class governing all the open buffers
79 This class governs all the currently open buffers. Currently all the buffer
80 are located in a static array, soon this will change and we will have a
99 /// returns the state of the bufferlist
100 list_state getState() { return _state; }
102 /** loads a LyX file or...
103 If the optional argument tolastfiles is false (default is
104 true), the file name will not be added to the last opened
107 Buffer* loadLyXFile(string const & filename,
108 bool tolastfiles = true);
113 /// Saves buffer. Returns false if unsuccesful.
114 bool write(Buffer *, bool makeBackup = true);
119 /// Close all open buffers.
125 /// Read a file into a buffer readonly or not.
126 Buffer* readFile(string const &, bool ro);
128 /// Make a new file (buffer) using a template
129 Buffer* newFile(string const &, string);
131 /** This one must be moved to some other place.
135 ///** Later with multiple frames this should not be here.
137 //Buffer* switchBuffer(Buffer *from, int);
140 void updateInset(Inset*, bool = true);
143 int unlockInset(UpdatableInset*);
146 void updateIncludedTeXfiles(string const &);
149 void emergencyWriteAll();
152 Returns false if operation was canceled
154 bool close(Buffer *);
159 /// returns true if the buffer exists already
160 bool exists(string const &);
162 /// returns a pointer to the buffer with the given name.
163 Buffer* getBuffer(string const &);
164 /// returns a pointer to the buffer with the given number.
165 Buffer* getBuffer(int);
169 BufferStorage bstore;