~ubuntu-branches/ubuntu/dapper/lurker/dapper

« back to all changes in this revision

Viewing changes to common/XmlEscape.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Meurer
  • Date: 2004-09-26 16:27:51 UTC
  • Revision ID: james.westby@ubuntu.com-20040926162751-z1ohcjltv7ojtg6z
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  $Id: XmlEscape.h,v 1.2 2003/04/21 18:25:31 terpstra Exp $
 
2
 *  
 
3
 *  XmlEscape.h - A stream manipulator-like thing for escaping XML
 
4
 *  
 
5
 *  Copyright (C) 2002 - Wesley W. Terpstra
 
6
 *  
 
7
 *  License: GPL
 
8
 *  
 
9
 *  Authors: 'Wesley W. Terpstra' <wesley@terpstra.ca>
 
10
 *  
 
11
 *    This program is free software; you can redistribute it and/or modify
 
12
 *    it under the terms of the GNU General Public License as published by
 
13
 *    the Free Software Foundation; version 2.1.
 
14
 *    
 
15
 *    This program is distributed in the hope that it will be useful,
 
16
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
 *    GNU General Public License for more details.
 
19
 *    
 
20
 *    You should have received a copy of the GNU General Public License
 
21
 *    along with this program; if not, write to the Free Software
 
22
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
23
 */
 
24
 
 
25
#ifndef XML_ESCAPE_H
 
26
#define XML_ESCAPE_H
 
27
 
 
28
#include <iostream>
 
29
#include <string>
 
30
 
 
31
using std::ostream;
 
32
using std::string;
 
33
 
 
34
// The empty type used to trigger our code.
 
35
extern struct XmlEscape { } xmlEscape;
 
36
 
 
37
class XmlOstream
 
38
{
 
39
 protected:
 
40
        ostream& o;
 
41
 
 
42
 public:
 
43
        XmlOstream(ostream& o_) : o(o_) { }
 
44
        
 
45
        ostream& operator << (const string& s);
 
46
        ostream& operator << (const char* s);
 
47
        ostream& operator << (char c);
 
48
};
 
49
 
 
50
inline XmlOstream operator << (ostream& o, const XmlEscape& e)
 
51
{
 
52
        return XmlOstream(o);
 
53
}
 
54
 
 
55
#endif