Logo Search packages:      
Sourcecode: yate version File versions  Download package

String String::msgUnescape ( const char *  str,
int *  errptr = 0,
char  extraEsc = 0 
) [static]

Decode an escaped string back to its raw form

Parameters:
str String to convert to unescaped format
errptr Pointer to an integer to receive the place of 1st error
extraEsc Character to unescape other than the default ones
Returns:
The string with special characters unescaped

Definition at line 759 of file String.cpp.

Referenced by msgUnescape().

{
    if (!str)
      str = "";
    if (extraEsc)
      extraEsc += '@';
    const char *pos = str;
    String s;
    char c;
    while ((c=*pos++)) {
      if (c < ' ') {
          if (errptr)
            *errptr = (pos-str);
          return s;
      }
      else if (c == '%') {
          c=*pos++;
          if ((c > '@' && c <= '_') || c == extraEsc)
            c -= '@';
          else if (c != '%') {
            if (errptr)
                *errptr = (pos-str);
            return s;
          }
      }
      s += c;
    }
    if (errptr)
      *errptr = -1;
    return s;
}


Generated by  Doxygen 1.6.0   Back to index