1 | #ifndef _theplu_svndigest_html_stream_ |
---|
2 | #define _theplu_svndigest_html_stream_ |
---|
3 | |
---|
4 | // $Id: HtmlStream.h 286 2007-05-07 16:07:23Z peter $ |
---|
5 | |
---|
6 | /* |
---|
7 | Copyright (C) 2007 Peter Johansson |
---|
8 | |
---|
9 | This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest |
---|
10 | |
---|
11 | svndigest is free software; you can redistribute it and/or modify it |
---|
12 | under the terms of the GNU General Public License as published by |
---|
13 | the Free Software Foundation; either version 2 of the License, or |
---|
14 | (at your option) any later version. |
---|
15 | |
---|
16 | svndigest is distributed in the hope that it will be useful, but |
---|
17 | WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
19 | General Public License for more details. |
---|
20 | |
---|
21 | You should have received a copy of the GNU General Public License |
---|
22 | along with this program; if not, write to the Free Software |
---|
23 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
24 | 02111-1307, USA. |
---|
25 | */ |
---|
26 | |
---|
27 | #include <map> |
---|
28 | #include <fstream> |
---|
29 | #include <sstream> |
---|
30 | |
---|
31 | namespace theplu{ |
---|
32 | namespace svndigest{ |
---|
33 | |
---|
34 | /// |
---|
35 | /// Filtering text to html code. |
---|
36 | /// |
---|
37 | class HtmlStream |
---|
38 | { |
---|
39 | public: |
---|
40 | |
---|
41 | /// |
---|
42 | /// @brief Constructor |
---|
43 | /// |
---|
44 | HtmlStream(std::ostream&); |
---|
45 | |
---|
46 | /// |
---|
47 | /// @brief Destructor |
---|
48 | /// |
---|
49 | ~HtmlStream(void); |
---|
50 | |
---|
51 | /// |
---|
52 | /// \brief filter and print stringstream |
---|
53 | /// |
---|
54 | void print(std::stringstream&); |
---|
55 | |
---|
56 | /// |
---|
57 | /// \return reference to underlying ostream |
---|
58 | /// |
---|
59 | std::ostream& stream(void); |
---|
60 | |
---|
61 | private: |
---|
62 | /// |
---|
63 | /// @brief Copy Constructor, not implemented |
---|
64 | /// |
---|
65 | HtmlStream(const HtmlStream&); |
---|
66 | |
---|
67 | std::map<char, std::string> map_; |
---|
68 | std::ostream& os_; |
---|
69 | }; |
---|
70 | |
---|
71 | |
---|
72 | template <typename T> |
---|
73 | HtmlStream& operator<<(HtmlStream& html, const T& rhs) |
---|
74 | { |
---|
75 | std::stringstream ss; |
---|
76 | ss << rhs; |
---|
77 | html.print(ss); |
---|
78 | return html; |
---|
79 | } |
---|
80 | |
---|
81 | }} // end of namespace svndigest and namespace theplu |
---|
82 | |
---|
83 | #endif |
---|