#include <QFile>
#include <QFileInfo>
#include <QList>
+#include <QTime>
#include <boost/assert.hpp>
#include <cerrno>
#include <fcntl.h>
-
-using std::map;
-using std::string;
-using std::ifstream;
-using std::ostringstream;
-using std::endl;
+using namespace std;
namespace lyx {
namespace support {
}
-std::string FileName::onlyFileName() const
+string FileName::onlyFileName() const
{
return support::onlyFilename(absFilename());
}
}
-FileNameList FileName::dirList(std::string const & ext) const
+FileNameList FileName::dirList(string const & ext) const
{
FileNameList dirlist;
if (!isDirectory()) {
}
-FileName FileName::tempName(FileName const & dir, std::string const & mask)
+FileName FileName::tempName(FileName const & dir, string const & mask)
{
return support::tempName(dir, mask);
}
-std::time_t FileName::lastModified() const
+time_t FileName::lastModified() const
{
return d->fi.lastModified().toTime_t();
}
LYXERR0('"' << absFilename() << "\" is a directory!");
return 0;
}
- LYXERR0("Checksumming \"" << absFilename() << "\".");
- return sum(absFilename().c_str());
+ if (!lyxerr.debugging(Debug::FILES))
+ return sum(absFilename().c_str());
+
+ QTime t;
+ t.start();
+ unsigned long r = sum(absFilename().c_str());
+ lyxerr << "Checksumming \"" << absFilename() << "\" lasted "
+ << t.elapsed() << " ms." << endl;
+ return r;
}
}
-void FileName::changeExtension(std::string const & extension)
+void FileName::changeExtension(string const & extension)
{
// FIXME: use Qt native methods...
string const oldname = absFilename();
}
-std::ostream & operator<<(std::ostream & os, FileName const & filename)
+ostream & operator<<(ostream & os, FileName const & filename)
{
return os << filename.absFilename();
}
}
-string DocFileName::mangledFilename(std::string const & dir) const
+string DocFileName::mangledFilename(string const & dir) const
{
// We need to make sure that every DocFileName instance for a given
// filename returns the same mangled name.
// Prepend a counter to the filename. This is necessary to make
// the mangled name unique.
static int counter = 0;
- std::ostringstream s;
+ ostringstream s;
s << counter++ << mname;
mname = s.str();
// If dir.size() > max length, all bets are off for YAP. We truncate
// the filename nevertheless, keeping a minimum of 10 chars.
- string::size_type max_length = std::max(100 - ((int)dir.size() + 1), 10);
+ string::size_type max_length = max(100 - ((int)dir.size() + 1), 10);
// If the mangled file name is too long, hack it to fit.
// We know we're guaranteed to have a unique file name because