Changeset 1146


Ignore:
Timestamp:
2000-05-04T17:16:23+12:00 (24 years ago)
Author:
sjboddie
Message:

Moved dm_safe from htmlutils to gsdltools. Also made it escape '\'
characters to prevent their mysterious disapearance from things like
windows filenames when they get passed through the macro expander.

Location:
trunk/gsdl/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/lib/gsdltools.cpp

    r1076 r1146  
    2828/*
    2929   $Log$
     30   Revision 1.4  2000/05/04 05:16:23  sjboddie
     31   Moved dm_safe from htmlutils to gsdltools. Also made it escape '\'
     32   characters to prevent their mysterious disapearance from things like
     33   windows filenames when they get passed through the macro expander.
     34
    3035   Revision 1.3  2000/04/06 19:58:01  cs025
    3136   Correcting a correction - reinstated all lib files due to silly
     
    4954}
    5055
     56text_t dm_safe (const text_t &instring) {
    5157
     58  text_t outstring;
     59  text_t::const_iterator here = instring.begin();
     60  text_t::const_iterator end = instring.end();
     61  while (here != end) {
     62    if (*here == '_' || *here == '\\') outstring.push_back('\\');
     63    outstring.push_back(*here);
     64    here ++;
     65  }
     66  return outstring;
     67}
     68
  • trunk/gsdl/lib/gsdltools.h

    r1076 r1146  
    3838bool littleEndian();
    3939
     40// escapes '\' and '_' characters with '\'
     41// note that single '\' characters occurring
     42// naturally within text (or filenames!!) will
     43// be removed by the dm macro language
     44text_t dm_safe (const text_t &instring);
     45
    4046#endif
Note: See TracChangeset for help on using the changeset viewer.