3 * Copyright 2002 the LyX Team
4 * Read the file COPYING
6 * \author Lars Gullik Bjønnes
14 #include <boost/utility.hpp>
21 * The class holds all all open buffers, and handles construction
22 * and deletions of new ones.
24 class BufferList : boost::noncopyable {
29 Loads a LyX file or...
31 \param filename The filename to read from.
32 \param tolastfiles Wether the file should be put in the
33 last opened files list or not.
34 \return The newly loaded LyX file.
36 Buffer * loadLyXFile(string const & filename,
37 bool tolastfiles = true);
39 /// write all buffers, asking the user
42 /// create a new buffer
43 Buffer * newBuffer(string const & s, bool ronly = false);
46 void release(Buffer * b);
48 /// Close all open buffers.
51 /// read the given file
52 Buffer * readFile(string const &, bool ro);
54 /// Make a new file (buffer) using a template
55 Buffer * newFile(string const &, string, bool isNamed = false);
56 /// returns a vector with all the buffers filenames
57 std::vector<string> const getFileNames() const;
60 void updateIncludedTeXfiles(string const &);
62 /// emergency save for all buffers
63 void emergencyWriteAll();
65 /// close buffer. Returns false if cancelled by user
66 bool close(Buffer * buf);
68 /// return true if no buffers loaded
71 /// return head of buffer list if any
74 /// returns true if the buffer exists already
75 bool exists(string const &) const;
77 /// returns true if the buffer is loaded
78 bool isLoaded(Buffer const * b) const;
80 /// returns a pointer to the buffer with the given name.
81 Buffer * getBuffer(string const &);
82 /// returns a pointer to the buffer with the given number.
83 Buffer * getBuffer(unsigned int);
85 /// reset current author for all buffers
86 void setCurrentAuthor(string const & name, string const & email);
89 /// ask to save a buffer on quit
90 bool qwriteOne(Buffer * buf, string const & fname,
91 string & unsaved_list);
93 typedef std::vector<Buffer *> BufferStorage;
95 /// storage of all buffers
98 /// save emergency file for the given buffer
99 void emergencyWrite(Buffer * buf);
102 #endif // BUFFERLIST_H