diff options
author | randomdan <randomdan@localhost> | 2011-02-14 10:54:32 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2011-02-14 10:54:32 +0000 |
commit | 7e0d50d0a57338b0bcf5ca88ad2f105d0068bb59 (patch) | |
tree | 2a38a2498e9f62f7ad0e8fae7ae492d58821d656 /project2/fileStrmVarWriter.cpp | |
parent | Fixes to compile with all gcc warnings as errors (diff) | |
download | project2-7e0d50d0a57338b0bcf5ca88ad2f105d0068bb59.tar.bz2 project2-7e0d50d0a57338b0bcf5ca88ad2f105d0068bb59.tar.xz project2-7e0d50d0a57338b0bcf5ca88ad2f105d0068bb59.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.cpp | 60 |
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()); +} + |