|
|
@ -436,49 +436,26 @@ TQCString LFtoCRLF(const TQCString &s)
|
|
|
|
|
|
|
|
|
|
|
|
void removeQuots(TQCString &str)
|
|
|
|
void removeQuots(TQCString &str)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool inQuote=false;
|
|
|
|
str.replace(TQRegExp("\\\""), "\"");
|
|
|
|
|
|
|
|
str.replace(TQRegExp("\\\\"), "\\");
|
|
|
|
for (int i=0; i < (int)str.length(); i++) {
|
|
|
|
|
|
|
|
if (str[i] == '"') {
|
|
|
|
|
|
|
|
str.remove(i,1);
|
|
|
|
|
|
|
|
i--;
|
|
|
|
|
|
|
|
inQuote = !inQuote;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (inQuote && (str[i] == '\\'))
|
|
|
|
|
|
|
|
str.remove(i,1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void removeQuots(TQString &str)
|
|
|
|
void removeQuots(TQString &str)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool inQuote=false;
|
|
|
|
str.replace(TQRegExp("\\\""), "\"");
|
|
|
|
|
|
|
|
str.replace(TQRegExp("\\\\"), "\\");
|
|
|
|
for (int i=0; i < (int)str.length(); i++) {
|
|
|
|
|
|
|
|
if (str[i] == '"') {
|
|
|
|
|
|
|
|
str.remove(i,1);
|
|
|
|
|
|
|
|
i--;
|
|
|
|
|
|
|
|
inQuote = !inQuote;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (inQuote && (str[i] == '\\'))
|
|
|
|
|
|
|
|
str.remove(i,1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void addQuotes(TQCString &str, bool forceQuotes)
|
|
|
|
void addQuotes(TQCString &str, bool forceQuotes)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool needsQuotes=false;
|
|
|
|
bool needsQuotes=false;
|
|
|
|
for (unsigned int i=0; i < str.length(); i++) {
|
|
|
|
if ( TQString( str ) .contains( TQRegExp( TQString( "\"|\\\\|=|\\]|\\[|:|;|,|\\.|,|@|<|>|\\)|\\(" ) ) ) )
|
|
|
|
if (strchr("()<>@,.;:[]=\\\"",str[i])!=0)
|
|
|
|
|
|
|
|
needsQuotes = true;
|
|
|
|
needsQuotes = true;
|
|
|
|
if (str[i]=='\\' || str[i]=='\"') {
|
|
|
|
|
|
|
|
str.insert(i, '\\');
|
|
|
|
str.replace(TQRegExp("\\"), "\\\\");
|
|
|
|
i++;
|
|
|
|
str.replace(TQRegExp("\""), "\\\"");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (needsQuotes || forceQuotes) {
|
|
|
|
if (needsQuotes || forceQuotes) {
|
|
|
|
str.insert(0,'\"');
|
|
|
|
str.insert(0,'\"');
|
|
|
|