X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flastfiles.C;h=5076e40a7f78259442de1dada48bad9be011a995;hb=f360c39690150b6ff9116ff56c39c3a0e0a92fd2;hp=6497f8998ec51deaef11072e8880b980d539c722;hpb=6899c9c176e649b62a30b597ad18da74f5003102;p=lyx.git diff --git a/src/lastfiles.C b/src/lastfiles.C index 6497f8998e..5076e40a7f 100644 --- a/src/lastfiles.C +++ b/src/lastfiles.C @@ -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 @@ -16,16 +16,16 @@ #endif #include -using std::ifstream; -using std::ofstream; - #include -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(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];