mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-13 06:03:37 +02:00
2021-02-24 Fred Gleason <fredg@paravelsystems.com>
* Updated build system to use Qt5 instead of Qt4. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Escape non-valid characters in a string.
|
||||
//
|
||||
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -74,34 +74,36 @@ QString RDCheckDateTime(QDate const &date, QString const &format)
|
||||
|
||||
}
|
||||
|
||||
|
||||
QString RDEscapeString(QString const &str)
|
||||
{
|
||||
QString orig=str;
|
||||
QString res;
|
||||
|
||||
for(int i=0;i<str.length();i++) {
|
||||
QChar c=orig[i];
|
||||
switch(c.toAscii()) {
|
||||
case '"':
|
||||
bool modified=false;
|
||||
if(str.at(i)==QChar('"')) {
|
||||
res+=QString("\\\"");
|
||||
break;
|
||||
modified=true;
|
||||
}
|
||||
|
||||
case '`':
|
||||
if(str.at(i)==QChar('`')) {
|
||||
res+=QString("\\`");
|
||||
break;
|
||||
modified=true;
|
||||
}
|
||||
|
||||
case '\'':
|
||||
if(str.at(i)==QChar('\'')) {
|
||||
res+=QString("\\\'");
|
||||
break;
|
||||
modified=true;
|
||||
}
|
||||
|
||||
case '\\':
|
||||
if(str.at(i)==QChar('\\')) {
|
||||
res+=QString("\\");
|
||||
res+=QString("\\");
|
||||
break;
|
||||
modified=true;
|
||||
}
|
||||
|
||||
default:
|
||||
res+=c;
|
||||
break;
|
||||
if(!modified) {
|
||||
res+=str.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user