root/trunk/gsdl/src/recpt/htmlutils.cpp @ 533

Revision 533, 2.0 KB (checked in by sjboddie, 20 years ago)

added GPL notice

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1/**********************************************************************
2 *
3 * htmlutils.cpp --
4 * Copyright (C) 1999  The New Zealand Digital Library Project
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 * $Id$
25 *
26 *********************************************************************/
27
28/*
29   $Log$
30   Revision 1.4  1999/09/07 04:56:56  sjboddie
31   added GPL notice
32
33   Revision 1.3  1999/06/09 00:09:30  sjboddie
34   Added a fairly minimal html_safe function
35
36   Revision 1.2  1999/02/08 01:28:02  rjmcnab
37
38   Got the receptionist producing something using the statusaction.
39
40   Revision 1.1  1999/01/08 08:40:58  rjmcnab
41
42   Moved from lib directory.
43
44   Revision 1.1  1999/01/08 03:57:47  rjmcnab
45
46   Initial revision
47
48 */
49
50
51#include "htmlutils.h"
52
53text_t html_safe (const text_t &instring) {
54 
55  text_t outstring;
56  text_t::const_iterator here = instring.begin();
57  text_t::const_iterator end = instring.end();
58  while (here != end) {
59    if (*here == '"') outstring += """;
60    else if (*here == '&') outstring += "&";
61    else if (*here == '<') outstring += "&lt;";
62    else if (*here == '>') outstring += "&gt;";
63    else outstring.push_back(*here);
64    here ++;
65  }
66  return outstring;
67}
68
69
Note: See TracBrowser for help on using the browser.