2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright (C) 1995 1996 Matthias Ettrich
10 *======================================================*/
22 /** The latest documents loaded
23 This class takes care of the last .lyx files used by the LyX user. It
24 both reads and writes this information to a file. The number of files
25 kept are user defined, but defaults to four.
30 /**@name Constructors and Deconstructors */
33 Parameters are: name of file to read. Whether you want LastFiles
34 to check for file existance, and the number of files to remember.
36 LastFiles(string const &, bool dostat = true, char num = 4);
44 This funtion inserts #file# into the last files list. If the file
45 already exist it is moved to the top of the list. If it don't
46 exist it is placed on the top of the list. If the list already is
47 full the last visited file in the list is puched out and deleted.
49 void newFile(string const &);
50 /** Writes the lastfiles table to disk. A " is placed around the
51 filenames to preserve special chars. (not all are preserved
52 anyway, but at least space is.)
54 void writeFile(string const &) const;
57 /**@name const variables */
64 /** There is no point in keeping more than this number of files
65 at the same time. However perhaps someday someone finds use for
66 more files and wants to change it. Please do. But don't show
67 the files in a menu...
71 ABSOLUTEMAXLASTFILES = 20
77 /// an array of lastfiles
79 /// number of files in the lastfiles list.
81 /// check for file existance or not.
87 /** reads the .lyx_lastfiles at the beginning of the LyX session.
88 This will read the lastfiles file (usually .lyx_lastfiles). It
89 will normally discard files that don't exist anymore, unless
90 LastFiles has been initialized with dostat = false.
92 void readFile(string const &);
93 /// used by the constructor to set the number of stored last files.
94 void setNumberOfFiles(char num);
100 friend class LastFiles_Iter;
105 /// An Iterator class for LastFiles
106 class LastFiles_Iter {
109 LastFiles_Iter(const LastFiles& la)
110 {cs = &la; index = 0;}
114 return (index < cs->num_files)? cs->files[index++]
118 string operator[] (int a)
119 { return cs->files[a];}