]> git.lyx.org Git - lyx.git/blobdiff - src/lastfiles.C
Fix the WorkArea problems.
[lyx.git] / src / lastfiles.C
index 6497f8998ec51deaef11072e8880b980d539c722..5076e40a7f78259442de1dada48bad9be011a995 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>
 
 #endif
 
 #include <fstream>
-using std::ifstream;
-using std::ofstream;
-
 #include <algorithm>
-using std::find;
 
 #include "support/FileInfo.h"
 #include "lastfiles.h"
 #include "debug.h"
 
+using std::getline;
+using std::endl;
+
+
 LastFiles::LastFiles(string const & filename, bool st, unsigned int num)
        : dostat(st)
 {
@@ -51,7 +51,7 @@ 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;
 
@@ -68,13 +68,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 +81,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 +90,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];