1
#ifndef SVG_CSS_OSTRINGSTREAM_H_INKSCAPE
2
#define SVG_CSS_OSTRINGSTREAM_H_INKSCAPE
4
#include <glib/gtypes.h>
9
typedef std::ios_base &(*std_oct_type)(std::ios_base &);
12
* A thin wrapper around std::ostringstream, but writing floating point numbers in the format
13
* required by CSS: `.' as decimal separator, no `e' notation, no nan or inf.
15
class CSSOStringStream {
17
std::ostringstream ostr;
22
#define INK_CSS_STR_OP(_t) \
23
CSSOStringStream &operator<<(_t arg) { \
29
INK_CSS_STR_OP(signed char)
30
INK_CSS_STR_OP(unsigned char)
32
INK_CSS_STR_OP(unsigned short)
34
INK_CSS_STR_OP(unsigned int)
36
INK_CSS_STR_OP(unsigned long)
37
INK_CSS_STR_OP(char const *)
38
INK_CSS_STR_OP(signed char const *)
39
INK_CSS_STR_OP(unsigned char const *)
40
INK_CSS_STR_OP(std::string const &)
41
INK_CSS_STR_OP(std_oct_type)
45
gchar const *gcharp() const {
46
return reinterpret_cast<gchar const *>(ostr.str().c_str());
49
std::string str() const {
53
std::streamsize precision() const {
54
return ostr.precision();
57
std::streamsize precision(std::streamsize p) {
58
return ostr.precision(p);
64
Inkscape::CSSOStringStream &operator<<(Inkscape::CSSOStringStream &os, float d);
66
Inkscape::CSSOStringStream &operator<<(Inkscape::CSSOStringStream &os, double d);
69
#endif /* !SVG_CSS_OSTRINGSTREAM_H_INKSCAPE */
74
c-file-style:"stroustrup"
75
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
80
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :