bulia byak wrote:
FYI:  we have been using Mental's Inkscape::SVGOStringStream for
inserting text data into Repr nodes for months now, and it works very, very
well.
    

It works, but the next thing I wanted to do (and I had thought it
would be easy with the iostream and Bryce's ftos code) is to drop
insignificant 0s from numeric values written to SVG. Can anyone
suggest how to do this, if it is possible at all? Those 0s are very
annoying.

  
Heh.  Look at its definition at the bottom below.  ^^


Bob



====== SNIP =========
#ifndef INKSCAPE_STRINGSTREAM_H
#define INKSCAPE_STRINGSTREAM_H

#include <glib/gtypes.h>
#include <sstream>
#include "svg/ftos.h"

namespace Inkscape {
    class SVGOStringStream : public std::ostringstream {

    public:
        SVGOStringStream() {
            this->imbue(std::locale::classic());
            this->setf(std::ios::showpoint);
            this->precision(8);
        }

        gchar const *gcharp() const {
            return reinterpret_cast<gchar const *>(str().c_str());
        }

    };

}

#ifdef BRYCE_FLOATS
Inkscape::SVGOStringStream &operator<<(Inkscape::SVGOStringStream &os, double d)
{
    return os << ftos(d, 'g', -1, -1, 0);
}
#endif

#endif