Changeset 264


Ignore:
Timestamp:
1999-06-09T12:09:30+12:00 (25 years ago)
Author:
sjboddie
Message:

Added a fairly minimal html_safe function

Location:
trunk/gsdl/src/recpt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/htmlutils.cpp

    r155 r264  
    1212/*
    1313   $Log$
     14   Revision 1.3  1999/06/09 00:09:30  sjboddie
     15   Added a fairly minimal html_safe function
     16
    1417   Revision 1.2  1999/02/08 01:28:02  rjmcnab
    1518
     
    2932#include "htmlutils.h"
    3033
     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}
    3149
    3250
    33 
  • trunk/gsdl/src/recpt/htmlutils.h

    r108 r264  
    1414#define HTMLUTILS_H
    1515
     16#include "gsdlconf.h"
     17#include "text_t.h"
    1618
    17 
     19text_t html_safe (const text_t &instring);
    1820
    1921#endif
Note: See TracChangeset for help on using the changeset viewer.