Example #1
0
bool Identifier::equals(const wxString& rhs) const
{
    if (needsQuoting(textM))
        return (0 == rhs.Cmp(textM));
    else
        return (0 == rhs.CmpNoCase(textM));
}
Example #2
0
wxString Identifier::getQuoted() const
{
    if (IdentifierQuotes::get().getQuoteAlways() || needsQuoting(textM))
    {
        wxString retval(textM);
        return quote(escape(retval));
    }
    else
        return textM;
}
Example #3
0
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;
}
Example #4
0
  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;
  }