Commit 59baf80b authored by Emmanuel Promayon's avatar Emmanuel Promayon

UPDATED modernize using raw string (improves readibility)

parent 36720a23
......@@ -189,7 +189,7 @@ camitk::ImageOrientationHelper::PossibleImageOrientations DicomComponent::readDi
// convert the string into the appropriate couple of cosine vectors
double x[3] = {0.0, 0.0, 0.0};
double y[3] = {0.0, 0.0, 0.0};
std::sscanf(value.c_str(), "%lf\\%lf\\%lf\\%lf\\%lf\\%lf", &x[0], &x[1], &x[2], &y[0], &y[1], &y[2]);
std::sscanf(value.c_str(), R"(%lf\%lf\%lf\%lf\%lf\%lf)", &x[0], &x[1], &x[2], &y[0], &y[1], &y[2]);
// get the 90 degrees closest cosines for each vector
x[0] = roundCosine(x[0]);
......
......@@ -42,9 +42,9 @@ XmlHighlighter::XmlHighlighter(QTextDocument* parent)
//Taken from W3C: <http://www.w3.org/TR/REC-xml/#sec-suggested-names>
//These are removed: \\x10000-\\xEFFFF (we can't fit them into the \xhhhh format).
const QString nameStartCharList = ":A-Z_a-z\\x00C0-\\x00D6\\x00D8-\\x00F6\\x00F8-\\x02FF\\x0370-\\x037D\\x037F-\\x1FFF\\x200C-\\x200D\\x2070-\\x218F\\x2C00-\\x2FEF\\x3001-\\xD7FF\\xF900-\\xFDCF\\xFDF0-\\xFFFD";
const QString nameStartCharList = R"(:A-Z_a-z\x00C0-\x00D6\x00D8-\x00F6\x00F8-\x02FF\x0370-\x037D\x037F-\x1FFF\x200C-\x200D\x2070-\x218F\x2C00-\x2FEF\x3001-\xD7FF\xF900-\xFDCF\xFDF0-\xFFFD)";
const QString nameCharList = nameStartCharList + "\\-\\.0-9\\x00B7\\x0300-\\x036F\\x203F-\\x2040";
const QString nameCharList = nameStartCharList + R"(\-\.0-9\x00B7\x0300-\x036F\x203F-\x2040)";
const QString nameStart = "[" + nameStartCharList + "]";
const QString nameChar = "[" + nameCharList + "]";
const QString xmlName = nameStart + "(" + nameChar + ")*";
......@@ -90,16 +90,16 @@ XmlHighlighter::XmlHighlighter(QTextDocument* parent)
xmlTagFormat.setFontItalic(false);
//Attributes
xmlAttributeStartExpression = QRegExp("\\s*" + xmlName + "\\s*=\\s*((\\x0022)|(\\x0027))");
xmlAttributeStartExpression = QRegExp("\\s*" + xmlName + R"(\s*=\s*((\x0022)|(\x0027)))");
xmlAttributeStartExpression.setMinimal(true);
xmlAttributeEndExpression = QRegExp("(([^\\x0022]*\\x0022)|([^\\x0027]*\\x0027))");
xmlAttributeEndExpression = QRegExp(R"((([^\x0022]*\x0022)|([^\x0027]*\x0027)))");
xmlAttributeStartExpression.setMinimal(true);
xmlAttributeFormat.setFont(font);
xmlAttributeFormat.setForeground(Qt::darkGreen);
xmlAttributeFormat.setFontItalic(false);
//Attribute values.
xmlAttValStartExpression = QRegExp("((\\x0022[^\\x0022]*)|(\\x0027[^\\x0027]*))");
xmlAttValStartExpression = QRegExp(R"(((\x0022[^\x0022]*)|(\x0027[^\x0027]*)))");
xmlAttValStartExpression.setMinimal(true);
//The end expression varies depending on what's matched with the start expression (single or double quote).
//This regexp is actually reset repeatedly during the highlighting process.
......
......@@ -375,7 +375,7 @@ void ActionStateMachine::createTransitions(QDomNodeList nodeList) {
// Find the corresponding target state
QMap <QString, ActionState* >::iterator it = statesMap->find(targetName);
if (it == statesMap->end()) {
QString msg = tr("XML Parsing: %1 in state \"%2\": cannot find target \"%3\" for event \"%4\"")
QString msg = tr(R"(XML Parsing: %1 in state "%2": cannot find target "%3" for event "%4")")
.arg(getDomNodeLocation(transitionsList.item(transNb)),
state->getName(),
targetName,
......
......@@ -204,7 +204,7 @@ QString ParameterGenerator::getToString() const {
QString cppName = getCppName();
switch (this->type) {
case BOOLEAN:
toString = "(" + cppName + "? \"true\" : \"false\")";
toString = "(" + cppName + R"(? "true" : "false"))";
break;
case INT:
case DOUBLE:
......
......@@ -944,7 +944,7 @@ void Application::saveHistoryAsSXML() {
// Create the XML document
QDomDocument doc;
QDomNode xmlProlog = doc.createProcessingInstruction("xml","version=\"1.0\" encoding=\"UTF-8\"");
QDomNode xmlProlog = doc.createProcessingInstruction("xml",R"(version="1.0" encoding="UTF-8")");
doc.appendChild(xmlProlog);
// root element
......
......@@ -1034,7 +1034,7 @@ void InteractiveViewer::addWhatsThisItem(const QString& key, const QString& desc
oddWhatsThis = !oddWhatsThis;
whatsThis += "<td align=\"center\"><font size=\"8pt\">" + key + "&nbsp;&nbsp;</font></td>\
whatsThis += R"(<td align="center"><font size="8pt">)" + key + "&nbsp;&nbsp;</font></td>\
<td align=\"left\"><font size=\"8pt\">" + description + "</font></td>\
</tr>";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment