Exemple #1
1
void GzWriter::writeString(string s)
{
  int16_t i = (int16_t)(s.size());
  swap_endian(i);
  out.write(reinterpret_cast<const char*>(&i),sizeof(i));
  out.write(reinterpret_cast<const char*>(&s[0]),s.size());
}
    Private(const std::string &filename, double _zoom, SvgWriter *parent)
        : p(parent), svgGzFile(filename, std::ios_base::out), zoom(_zoom), previousGroup(SvgWriter::InvalidGroup) {
        const size_t filename_len = filename.length();
        if (filename[filename_len - 3] == '.' && filename[filename_len - 2] == 'g' && filename[filename_len - 1] == 'z') {
            /// Do compress SVG file if filename ends with '.gz'
            output.push(boost::iostreams::gzip_compressor());
        }
        output.push(svgGzFile);
        output.setf(std::ofstream::fixed);
        output.precision(3);

        output << "<?xml version=\"1.0\" standalone=\"no\"?>" << std::endl;
        //output << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">" << std::endl << std::endl;
        output << "<svg width=\"" << (1000 * zoom) << "\" height=\"" << (2047 * zoom) << "\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:svg=\"http://www.w3.org/2000/svg\" version=\"1.1\">" << std::endl;
    }
Exemple #3
0
		icout_proxy() {
			stream_.push(cindent_filter(stream_));
			stream_.push(std::cout);
		}
Exemple #4
0
 void writeDouble(double d)
 {swap_endian(d); out.write(reinterpret_cast<const char*>(&d),sizeof(d));};
Exemple #5
0
 void writeInt(int i) 
 {swap_endian(i); out.write(reinterpret_cast<const char*>(&i),sizeof(i));};
Exemple #6
0
 GzWriter(string s)
 {out.push(io::gzip_compressor()); out.push(io::file_descriptor_sink(s));};