1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#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 Null &) const {
fprintf(out, "<null>");
}
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 {
fputc('\'', out);
if (fwrite(i.c_str(), i.bytes(), 1, out) < 1) {
// Care much? None of the others check.
}
fputc('\'', out);
}
void FileStreamVariableWriter::operator()(const boost::posix_time::ptime & i) const {
fprintf(out, "[%s]", boost::posix_time::to_iso_extended_string(i).c_str());
}
|