Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
css-ostringstream.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
/*
5 * Authors: see git history
6 *
7 * Copyright (C) 2014 Authors
8 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
9 */
10#ifndef SVG_CSS_OSTRINGSTREAM_H_INKSCAPE
11#define SVG_CSS_OSTRINGSTREAM_H_INKSCAPE
12
13#include <sstream>
14#include <type_traits>
15
16namespace Inkscape {
17
23private:
24 std::ostringstream ostr;
25
26public:
28
29 template <typename T,
30 // disable this template for float and double
31 typename std::enable_if<!std::is_floating_point<T>::value, int>::type = 0>
33 {
34 ostr << arg;
35 return *this;
36 }
37
38 CSSOStringStream &operator<<(double);
39
40 std::string str() const {
41 return ostr.str();
42 }
43
44 std::streamsize precision() const {
45 return ostr.precision();
46 }
47
48 std::streamsize precision(std::streamsize p) {
49 return ostr.precision(p);
50 }
51};
52
53}
54
55
56#endif /* !SVG_CSS_OSTRINGSTREAM_H_INKSCAPE */
57
58/*
59 Local Variables:
60 mode:c++
61 c-file-style:"stroustrup"
62 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
63 indent-tabs-mode:nil
64 fill-column:99
65 End:
66*/
67// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
A thin wrapper around std::ostringstream, but writing floating point numbers in the format required b...
std::streamsize precision() const
CSSOStringStream & operator<<(T const &arg)
std::streamsize precision(std::streamsize p)
Helper class to stream background task notifications as a series of messages.