source: trunk/lib/HtmlBuf.h @ 745

Last change on this file since 745 was 693, checked in by Jari Häkkinen, 13 years ago

Fixes #339. Change to GPLv3.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1#ifndef _theplu_svndigest_html_buf_
2#define _theplu_svndigest_html_buf_
3
4// $Id: HtmlBuf.h 693 2008-09-11 20:42:56Z jari $
5
6/*
7  Copyright (C) 2007, 2008 Peter Johansson
8
9  This file is part of svndigest, http://dev.thep.lu.se/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 3 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 svndigest. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#include <cstdio>
26#include <locale>
27#include <map>
28#include <streambuf>
29#include <string>
30
31namespace theplu{
32namespace svndigest{
33  ///
34  /// Buffer that translates certain chars to the corresponding string
35  /// representing the character in HTML. The class is typically not
36  /// used directly but through the convenience class HtmlStream.
37  ///
38  class HtmlBuf : public std::streambuf
39  {
40  public:
41    /// \param buf Buffer output is sent to.
42    HtmlBuf(std::streambuf& buf);
43
44    typedef std::char_traits<char>::int_type int_type;
45
46  private:
47    // dictionary how to transform chars
48    std::map<char, std::string> map_;
49    std::streambuf& buf_;
50
51    // called from base class
52    int_type overflow (int_type c);
53  };
54
55}} // end of namespace svndigest and namespace theplu
56
57#endif
Note: See TracBrowser for help on using the repository browser.