src/tao/util.cc
static string elideQuote(const string &s, size_t thresh, size_t prefix,
                         size_t suffix) {
  if (s.size() < thresh) return s;
  size_t i = 0;
  while (i < prefix) {
    if (s[i] == '\\' && '0' <= s[i + 1] && s[i + 1] <= '7')
      i += 4;  // skip octal escape
    else if (s[i] == '\\')
      i += 2;  // skip other escape
    else
      i++;
  }
  prefix = i;
  size_t j = i;
  while (s.size() - i >= suffix) {
    j = i;
    if (s[i] == '\\' && '0' <= s[i + 1] && s[i + 1] <= '7')
      i += 4;  // skip octal escape
    else if (s[i] == '\\')
      i += 2;  // skip other escape
    else
      i++;
  }
  suffix = j;
  return s.substr(0, prefix) + "..." + s.substr(suffix);
}
/// Elide a already-escaped string if necessary. If the string is short, it will
/// be returned as-is. Otherwise, a few characters at the beginning and end
/// will be left, and the middle replaced with ellipses. Escape sequences will
/// not be broken, and it is assumed that all backslashes are followed by
/// either a 3-character octal escape or a 1-character non-octal escape.
/// @param s The string to be elided.
/// @param thresh If s is no longer than this, it will be returned as-is.
/// @param prefix At least this many characters will be left before the
/// ellipses.
/// @param suffix At least this many characters will be left after the ellipses.
Elide a already-escaped string if necessary. If the string is short, it will
be returned as-is. Otherwise, a few characters at the beginning and end
will be left, and the middle replaced with ellipses. Escape sequences will
not be broken, and it is assumed that all backslashes are followed by
either a 3-character octal escape or a 1-character non-octal escape.
Elide a already - escaped string if necessary . If the string is short it will be returned as - is . Otherwise a few characters at the beginning and end will be left and the middle replaced with ellipses . Escape sequences will not be broken and it is assumed that all backslashes are followed by either a 3 - character octal escape or a 1 - character non - octal escape .
static string elideQuote(const string &s, size_t thresh, size_t prefix,
                         size_t suffix) {
  if (s.size() < thresh) return s;
  size_t i = 0;
  while (i < prefix) {
    if (s[i] == '\\' && '0' <= s[i + 1] && s[i + 1] <= '7')
      i += 4;  
    else if (s[i] == '\\')
      i += 2;  
    else
      i++;
  }
  prefix = i;
  size_t j = i;
  while (s.size() - i >= suffix) {
    j = i;
    if (s[i] == '\\' && '0' <= s[i + 1] && s[i + 1] <= '7')
      i += 4;  
    else if (s[i] == '\\')
      i += 2;  
    else
      i++;
  }
  suffix = j;
  return s.substr(0, prefix) + "..." + s.substr(suffix);
}
static string elideQuote ( const string & s , size_t thresh , size_t prefix , size_t suffix ) { if ( s . size ( ) < thresh ) return s ; size_t i = 0 ; while ( i < prefix ) { if ( s [ i ] == ' \\ ' && ' ' <= s [ i + 1 ] && s [ i + 1 ] <= ' ' ) i += 4 ; else if ( s [ i ] == ' \\ ' ) i += 2 ; else i ++ ; } prefix = i ; size_t j = i ; while ( s . size ( ) - i >= suffix ) { j = i ; if ( s [ i ] == ' \\ ' && ' ' <= s [ i + 1 ] && s [ i + 1 ] <= ' ' ) i += 4 ; else if ( s [ i ] == ' \\ ' ) i += 2 ; else i ++ ; } suffix = j ; return s . substr ( 0 , prefix ) + " " + s . substr ( suffix ) ; }
Elide a already-escaped string if necessary.
Elide a already - escaped string if necessary .
// skip octal escape // skip other escape // skip octal escape // skip other escape