X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flastfiles.C;h=1691253373c4e486f1ec1b79ad81dbbfb15a2ea9;hb=f268743f8c014ef2dadd260fd1a3873cb1d2038b;hp=4f99284a387509ba8f1c1f3ef9b98c4a11552e33;hpb=28ed26ab13ccbc24e1ad858784893ac018fabe8f;p=lyx.git diff --git a/src/lastfiles.C b/src/lastfiles.C index 4f99284a38..1691253373 100644 --- a/src/lastfiles.C +++ b/src/lastfiles.C @@ -1,30 +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 + + +using namespace lyx::support; + using std::ifstream; using std::ofstream; - -#include +using std::getline; +using std::endl; using std::find; +using std::copy; +using std::ostream_iterator; -#include "support/FileInfo.h" -#include "lastfiles.h" -#include "debug.h" LastFiles::LastFiles(string const & filename, bool st, unsigned int num) : dostat(st) @@ -55,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())) @@ -70,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; @@ -93,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];