X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flastfiles.C;h=ef200b2c9d992c2f9941e77d107082edd069d337;hb=1fa0fb5c67656cacbe3cfe6e8b08dd98cada1f73;hp=a30deaba21ddf5b7c481c24cb20402827ce2df8b;hpb=dfe1bc44b44903faf77ef454c98c4c3e56c1d5e3;p=lyx.git diff --git a/src/lastfiles.C b/src/lastfiles.C index a30deaba21..ef200b2c9d 100644 --- a/src/lastfiles.C +++ b/src/lastfiles.C @@ -1,25 +1,35 @@ -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. +/** + * \file lastfiles.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * ======================================================*/ + * \author Lars Gullik Bjønnes + * + * Full author contact details are available in file CREDITS. + */ #include +#include "lastfiles.h" +#include "debug.h" -#ifdef __GNUG__ -#pragma implementation -#endif +#include "support/FileInfo.h" -#include #include -#include "support/FileInfo.h" -#include "lastfiles.h" -#include "debug.h" +#include +#include + +using lyx::support::FileInfo; + +using std::copy; +using std::endl; +using std::find; +using std::getline; +using std::string; +using std::ifstream; +using std::ofstream; +using std::ostream_iterator; + LastFiles::LastFiles(string const & filename, bool st, unsigned int num) : dostat(st) @@ -50,7 +60,7 @@ void LastFiles::readFile(string const & filename) 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())) @@ -65,11 +75,8 @@ void LastFiles::writeFile(string const & filename) const { ofstream ofs(filename.c_str()); if (ofs) { - for (Files::const_iterator cit = files.begin(); - cit != files.end(); - ++cit) { - ofs << (*cit) << '\n'; - } + copy(files.begin(), files.end(), + ostream_iterator(ofs, "\n")); } else lyxerr << "LyX: Warning: unable to save LastFiles: " << filename << endl; @@ -88,7 +95,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];