]> git.lyx.org Git - lyx.git/blobdiff - src/lastfiles.C
Change the latex font names in order to match the names of type1inst.
[lyx.git] / src / lastfiles.C
index 6497f8998ec51deaef11072e8880b980d539c722..a3b72d408fd87d44ebfd2e2b20418a6bac4ca31c 100644 (file)
@@ -1,12 +1,12 @@
 /* This file is part of
- * ======================================================
+ * ====================================================== 
  * 
  *           LyX, The Document Processor
  *      
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-1999 The LyX Team.
+ *           Copyright 1995-2001 The LyX Team.
  *
- * ======================================================*/
+ * ====================================================== */
 
 #include <config.h>
 
 #pragma implementation
 #endif
 
-#include <fstream>
-using std::ifstream;
-using std::ofstream;
+#include "lastfiles.h"
+#include "debug.h"
+
+#include "support/FileInfo.h"
 
+#include <fstream>
 #include <algorithm>
-using std::find;
+#include <iterator>
+
+using std::getline;
+using std::endl;
 
-#include "support/FileInfo.h"
-#include "lastfiles.h"
-#include "debug.h"
 
 LastFiles::LastFiles(string const & filename, bool st, unsigned int num)
        : dostat(st)
@@ -51,11 +53,11 @@ void LastFiles::readFile(string const & filename)
 {
        // we will not complain if we can't find filename nor will
        // we issue a warning. (Lgb)
-       ifstream ifs(filename.c_str());
+       std::ifstream ifs(filename.c_str());
        string tmp;
        FileInfo fileInfo;
 
-       while(getline(ifs, tmp) && files.size() < num_files) {
+       while (getline(ifs, tmp) && files.size() < num_files) {
                if (dostat) {
                        if (!(fileInfo.newFile(tmp).exist() &&
                              fileInfo.isRegular()))
@@ -68,13 +70,10 @@ void LastFiles::readFile(string const & filename)
 
 void LastFiles::writeFile(string const & filename) const
 {
-       ofstream ofs(filename.c_str());
+       std::ofstream ofs(filename.c_str());
        if (ofs) {
-               for (Files::const_iterator cit = files.begin();
-                    cit != files.end();
-                    ++cit) {
-                       ofs << (*cit) << '\n';
-               }
+               std::copy(files.begin(), files.end(),
+                         std::ostream_iterator<string>(ofs, "\n"));
        } else
                lyxerr << "LyX: Warning: unable to save LastFiles: "
                       << filename << endl;
@@ -84,7 +83,7 @@ void LastFiles::writeFile(string const & filename) const
 void LastFiles::newFile(string const & file)
 {
        // If file already exist, delete it and reinsert at front.
-       Files::iterator it = find(files.begin(), files.end(), file);
+       Files::iterator it = std::find(files.begin(), files.end(), file);
        if (it != files.end())
                files.erase(it);
        files.push_front(file);
@@ -93,7 +92,7 @@ void LastFiles::newFile(string const & file)
 }
 
 
-string LastFiles::operator[](unsigned int i) const
+string const LastFiles::operator[](unsigned int i) const
 {
        if (i < files.size())
                return files[i];