source: trunk/gsdl/src/recpt/htmlutils.cpp@ 357

Last change on this file since 357 was 264, checked in by sjboddie, 25 years ago

Added a fairly minimal html_safe function

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.1 KB
Line 
1/**********************************************************************
2 *
3 * htmlutils.cpp --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * PUT COPYRIGHT NOTICE HERE
7 *
8 * $Id: htmlutils.cpp 264 1999-06-09 00:09:30Z sjboddie $
9 *
10 *********************************************************************/
11
12/*
13 $Log$
14 Revision 1.3 1999/06/09 00:09:30 sjboddie
15 Added a fairly minimal html_safe function
16
17 Revision 1.2 1999/02/08 01:28:02 rjmcnab
18
19 Got the receptionist producing something using the statusaction.
20
21 Revision 1.1 1999/01/08 08:40:58 rjmcnab
22
23 Moved from lib directory.
24
25 Revision 1.1 1999/01/08 03:57:47 rjmcnab
26
27 Initial revision
28
29 */
30
31
32#include "htmlutils.h"
33
34text_t html_safe (const text_t &instring) {
35
36 text_t outstring;
37 text_t::const_iterator here = instring.begin();
38 text_t::const_iterator end = instring.end();
39 while (here != end) {
40 if (*here == '"') outstring += """;
41 else if (*here == '&') outstring += "&";
42 else if (*here == '<') outstring += "&lt;";
43 else if (*here == '>') outstring += "&gt;";
44 else outstring.push_back(*here);
45 here ++;
46 }
47 return outstring;
48}
49
50
Note: See TracBrowser for help on using the repository browser.