/*!
  * Add escaping to each quote character (") by preceding it with a backslash (\).
  */
 void EscapeQuotes()
 {
     size_t quote = _quoted.find_first_of('"');
     while (quote != STRING::npos)
     {
         _quoted.insert(quote, 1, '\\');
         quote = _quoted.find_first_of('"', quote + 2);
     }
 }
    /*!
     * Add quotes around the string if it contains any whitespace.
     */
    void AddQuotes(const T *whitespace)
    {
        if (_quoted.find_first_of(whitespace) != STRING::npos)
        {
            _quoted.insert(0, 1, '"');
            _quoted.append(1, '"');

            // If the last character (prior to adding the quotes) was a backslash,
            // it needs to be escaped now because it precedes a quote.
            //
            size_t quote = _quoted.size() - 1;
            if (_quoted[quote-1] == '\\')
            {
                size_t notSlash = _quoted.find_last_not_of('\\', quote-2);
                size_t numSlashes = quote - notSlash - 1;
                _quoted.insert(quote, numSlashes, '\\');
            }
        }
    }
 /*!
  * Add escaping to each sequence of backslashes that immediately precedes
  * a quote character.  Each backslash in such a sequence must be escaped
  * with another backslash.  Note that backslashes that are not part of a
  * sequence that immediately precedes a quote are NOT escaped.  E.g.:
  *
  *  \a" -> \a"
  *  foo\bar"baz\\"fum -> foo\bar"baz\\\\"fum
  */
 void EscapeBackSlashes()
 {
     size_t quote = _quoted.find_first_of('"', 1);
     while (quote != STRING::npos)
     {
         size_t numSlashes = 0;
         size_t notSlash = _quoted.find_last_not_of('\\', quote-1);
         if (notSlash != quote-1)
         {
             if (notSlash == STRING::npos)
                 numSlashes = quote;
             else
                 numSlashes = quote - notSlash - 1;
             _quoted.insert(quote, numSlashes, '\\');
         }
         quote = _quoted.find_first_of('"', quote + numSlashes + 1);
     }
 }