2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2000 The LyX Team.
10 * ====================================================== */
23 /** The latest documents loaded
24 This class takes care of the last .lyx files used by the LyX user. It
25 both reads and writes this information to a file. The number of files
26 kept are user defined, but defaults to four.
31 typedef std::deque<string> Files;
34 typedef Files::const_iterator const_iterator;
36 /**@name Constructors and Deconstructors */
39 Parameters are: name of file to read. Whether LastFiles should
40 check for file existance, and the number of files to remember.
42 explicit LastFiles(string const &,
43 bool dostat = true, unsigned int num = 4);
49 This funtion inserts #file# into the last files list. If the file
50 already exist it is moved to the top of the list, else exist it
51 is placed on the top of the list. If the list is full the last
52 file in the list is popped from the end.
54 void newFile(string const &);
55 /** Writes the lastfiles table to disk. One file on each line, this
56 way we can at least have some special chars (e.g. space), but
57 newline in filenames are thus not allowed.
59 void writeFile(string const &) const;
61 string operator[](unsigned int) const;
63 Files::const_iterator begin() const { return files.begin(); }
65 Files::const_iterator end() const { return files.end(); }
68 /**@name const variables */
73 /** There is no point in keeping more than this number
74 of files at the same time. However perhaps someday
75 someone finds use for more files and wants to
76 change it. Please do. But don't show the files in
79 ABSOLUTEMAXLASTFILES = 20
85 /// a list of lastfiles
87 /// number of files in the lastfiles list.
88 unsigned int num_files;
89 /// check for file existance or not.
95 /** reads the .lyx_lastfiles at the beginning of the LyX session.
96 This will read the lastfiles file (usually .lyx_lastfiles). It
97 will normally discard files that don't exist anymore, unless
98 LastFiles has been initialized with dostat = false.
100 void readFile(string const &);
101 /// used by the constructor to set the number of stored last files.
102 void setNumberOfFiles(unsigned int num);