summaryrefslogtreecommitdiff
path: root/project2/fileStrmVarWriter.cpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-02-14 10:54:32 +0000
committerrandomdan <randomdan@localhost>2011-02-14 10:54:32 +0000
commit78c50e7261df6632a1d40380d225be29491f932d (patch)
tree2a38a2498e9f62f7ad0e8fae7ae492d58821d656 /project2/fileStrmVarWriter.cpp
parentFixes to compile with all gcc warnings as errors (diff)
downloadproject2-78c50e7261df6632a1d40380d225be29491f932d.tar.bz2
project2-78c50e7261df6632a1d40380d225be29491f932d.tar.xz
project2-78c50e7261df6632a1d40380d225be29491f932d.zip
Convert dumpTask into a generic purpose file* writer
Fully implement view support in p2console
Diffstat (limited to 'project2/fileStrmVarWriter.cpp')
-rw-r--r--project2/fileStrmVarWriter.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/project2/fileStrmVarWriter.cpp b/project2/fileStrmVarWriter.cpp
new file mode 100644
index 0000000..f3812ce
--- /dev/null
+++ b/project2/fileStrmVarWriter.cpp
@@ -0,0 +1,60 @@
+#include "fileStrmVarWriter.h"
+#include "rowSet.h"
+#include "xmlObjectLoader.h"
+#include <boost/foreach.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <stdio.h>
+
+FileStreamVariableWriter::FileStreamVariableWriter(FILE * o, bool q) :
+ out(o),
+ quoting(q)
+{
+}
+
+FileStreamVariableWriter::~FileStreamVariableWriter()
+{
+}
+
+void FileStreamVariableWriter::operator()(const long long int & i) const {
+ fprintf(out, "%lld", i);
+}
+void FileStreamVariableWriter::operator()(const long int & i) const {
+ fprintf(out, "%ld", i);
+}
+void FileStreamVariableWriter::operator()(const int & i) const {
+ fprintf(out, "%d", i);
+}
+void FileStreamVariableWriter::operator()(const short int & i) const {
+ fprintf(out, "%hd", i);
+}
+void FileStreamVariableWriter::operator()(const long long unsigned int & i) const {
+ fprintf(out, "%llu", i);
+}
+void FileStreamVariableWriter::operator()(const long unsigned int & i) const {
+ fprintf(out, "%lu", i);
+}
+void FileStreamVariableWriter::operator()(const unsigned int & i) const {
+ fprintf(out, "%u", i);
+}
+void FileStreamVariableWriter::operator()(const short unsigned int & i) const {
+ fprintf(out, "%hu", i);
+}
+void FileStreamVariableWriter::operator()(const float & i) const {
+ fprintf(out, "%g", i);
+}
+void FileStreamVariableWriter::operator()(const double & i) const {
+ fprintf(out, "%g", i);
+}
+void FileStreamVariableWriter::operator()(const Glib::ustring & i) const {
+ fprintf(out, "'%.*s'", i.length(), i.c_str());
+}
+void FileStreamVariableWriter::operator()(const boost::shared_ptr<const Glib::ustring> & i) const {
+ fprintf(out, "'%.*s'", i->length(), i->c_str());
+}
+void FileStreamVariableWriter::operator()(const boost::posix_time::ptime & i) const {
+ fprintf(out, "[%s]", boost::posix_time::to_iso_extended_string(i).c_str());
+}
+void FileStreamVariableWriter::operator()(const boost::shared_ptr<const boost::posix_time::ptime> & i) const {
+ fprintf(out, "[%s]", boost::posix_time::to_iso_extended_string(*i).c_str());
+}
+