Code

remove svglsimpl
[inkscape.git] / src / svg / stringstream.h
1 #ifndef INKSCAPE_STRINGSTREAM_H
2 #define INKSCAPE_STRINGSTREAM_H
4 #include <glib/gtypes.h>
5 #include <sstream>
7 namespace Inkscape {
9 typedef std::ios_base &(*std_oct_type)(std::ios_base &);
11 class SVGOStringStream {
12 private:
13     std::ostringstream ostr;
15 public:
16     SVGOStringStream();
18 #define INK_SVG_STR_OP(_t) \
19     SVGOStringStream &operator<<(_t arg) {  \
20         ostr << arg;    \
21         return *this;   \
22     }
24     INK_SVG_STR_OP(char)
25     INK_SVG_STR_OP(signed char)
26     INK_SVG_STR_OP(unsigned char)
27     INK_SVG_STR_OP(short)
28     INK_SVG_STR_OP(unsigned short)
29     INK_SVG_STR_OP(int)
30     INK_SVG_STR_OP(unsigned int)
31     INK_SVG_STR_OP(long)
32     INK_SVG_STR_OP(unsigned long)
33     INK_SVG_STR_OP(char const *)
34     INK_SVG_STR_OP(signed char const *)
35     INK_SVG_STR_OP(unsigned char const *)
36     INK_SVG_STR_OP(std::string const &)
37     INK_SVG_STR_OP(std_oct_type)
39 #undef INK_SVG_STR_OP
41     gchar const *gcharp() const {
42         return reinterpret_cast<gchar const *>(ostr.str().c_str());
43     }
45     std::string str() const {
46         return ostr.str();
47     }
49     std::streamsize precision() const {
50         return ostr.precision();
51     }
53     std::streamsize precision(std::streamsize p) {
54         return ostr.precision(p);
55     }
57     std::ios::fmtflags setf(std::ios::fmtflags fmtfl) {
58         return ostr.setf(fmtfl);
59     }
61     std::ios::fmtflags setf(std::ios::fmtflags fmtfl, std::ios::fmtflags mask) {
62         return ostr.setf(fmtfl, mask);
63     }
65     void unsetf(std::ios::fmtflags mask) {
66         ostr.unsetf(mask);
67     }
68 };
70 }
72 Inkscape::SVGOStringStream &operator<<(Inkscape::SVGOStringStream &os, float d);
74 Inkscape::SVGOStringStream &operator<<(Inkscape::SVGOStringStream &os, double d);
77 #endif
79 /*
80   Local Variables:
81   mode:c++
82   c-file-style:"stroustrup"
83   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
84   indent-tabs-mode:nil
85   fill-column:99
86   End:
87 */
88 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :