diff options
author | Marius Kintel <marius@kintel.net> | 2011-04-29 15:06:46 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-04-29 15:06:46 (GMT) |
commit | a0a20d20146758c341c0110b667bf7da3d1e6b34 (patch) | |
tree | d6a8124a2ce1016c90f15cae7e5ff9e4e43a1755 | |
parent | f13c1c6343c5f2404eefa9386f7a5f11b8e65cdb (diff) |
bugfix: Cache output for non-existing files should be 0.0
-rw-r--r-- | src/dxflinextrude.cc | 3 | ||||
-rw-r--r-- | src/dxfrotextrude.cc | 3 | ||||
-rw-r--r-- | src/printutils.cc | 5 | ||||
-rw-r--r-- | src/printutils.h | 5 |
4 files changed, 12 insertions, 4 deletions
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 <QString> #include <QList> +#include <iostream> +#include <QFileInfo> +#include <QDateTime> 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 |