From a0a20d20146758c341c0110b667bf7da3d1e6b34 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Fri, 29 Apr 2011 11:06:46 -0400 Subject: bugfix: Cache output for non-existing files should be 0.0 diff --git a/src/dxflinextrude.cc b/src/dxflinextrude.cc index 40ddbb7..bb4a7dd 100644 --- a/src/dxflinextrude.cc +++ b/src/dxflinextrude.cc @@ -150,11 +150,10 @@ std::string DxfLinearExtrudeNode::toString() const std::stringstream stream; QString text; - QFileInfo fileInfo(this->filename); stream << this->name() << "(" "file = \"" << this->filename << "\", " - "cache = \"" << std::hex << (int)fileInfo.lastModified().toTime_t() << "." << (int)fileInfo.size() << "\", " + "cache = \"" << QFileInfo(this->filename) << "\", " "layer = \"" << this->layername << "\", " "height = " << std::dec << this->height << ", " "origin = [ " << this->origin_x << " " << this->origin_y << " ], " diff --git a/src/dxfrotextrude.cc b/src/dxfrotextrude.cc index 7b89676..06892aa 100644 --- a/src/dxfrotextrude.cc +++ b/src/dxfrotextrude.cc @@ -125,10 +125,9 @@ std::string DxfRotateExtrudeNode::toString() const { std::stringstream stream; - QFileInfo fileInfo(this->filename); stream << this->name() << "(" "file = \"" << this->filename << "\", " - "cache = \"" << std::hex << (int)fileInfo.lastModified().toTime_t() << "." << (int)fileInfo.size() << "\", " + "cache = \"" << QFileInfo(this->filename) << "\", " "layer = \"" << this->layername << "\", " "origin = [ " << std::dec << this->origin_x << " " << this->origin_y << " ], " "scale = " << this->scale << ", " diff --git a/src/printutils.cc b/src/printutils.cc index 0f4c67d..01fa06b 100644 --- a/src/printutils.cc +++ b/src/printutils.cc @@ -48,3 +48,8 @@ void PRINT_NOCACHE(const QString &msg) outputhandler(msg, outputhandler_data); } } + +std::ostream &operator<<(std::ostream &os, const QFileInfo &fi) { + os << std::hex << (fi.exists()?fi.lastModified().toTime_t():0) << "." << fi.size(); + return os; +} diff --git a/src/printutils.h b/src/printutils.h index 7f2e828..0432622 100644 --- a/src/printutils.h +++ b/src/printutils.h @@ -3,6 +3,9 @@ #include #include +#include +#include +#include typedef void (OutputHandlerFunc)(const QString &msg, void *userdata); extern OutputHandlerFunc *outputhandler; @@ -22,4 +25,6 @@ void PRINT_NOCACHE(const QString &msg); #define PRINTF_NOCACHE(_fmt, ...) do { QString _m; _m.sprintf(_fmt, ##__VA_ARGS__); PRINT_NOCACHE(_m); } while (0) #define PRINTA_NOCACHE(_fmt, ...) do { QString _m = QString(_fmt).arg(__VA_ARGS__); PRINT_NOCACHE(_m); } while (0) +std::ostream &operator<<(std::ostream &os, const QFileInfo &fi); + #endif -- cgit v0.10.1