bool Identifier::equals(const wxString& rhs) const { if (needsQuoting(textM)) return (0 == rhs.Cmp(textM)); else return (0 == rhs.CmpNoCase(textM)); }
wxString Identifier::getQuoted() const { if (IdentifierQuotes::get().getQuoteAlways() || needsQuoting(textM)) { wxString retval(textM); return quote(escape(retval)); } else return textM; }
wxString qtIdent(const wxString &value) { if (value.Length() == 0) return value; wxString result = value; if (needsQuoting(result, false)) { result.Replace(wxT("\""), wxT("\"\"")); return wxT("\"") + result + wxT("\""); } else return result; }
static QByteArray quote( const QString & s ) { assert( isUsAscii( s ) ); QByteArray r( s.length() * 2, 0 ); bool needsQuotes = false; unsigned int j = 0; for ( int i = 0 ; i < s.length() ; ++i ) { char ch = s[i].toLatin1(); if ( isSpecial( ch ) ) { if ( needsQuoting( ch ) ) r[j++] = '\\'; needsQuotes = true; } r[j++] = ch; } r.truncate( j ); if ( needsQuotes ) return '"' + r + '"'; else return r; }