/[svn]/qsampler/trunk/src/qsamplerUtilities.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerUtilities.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3793 by capela, Tue Aug 13 10:19:32 2019 UTC revision 3794 by capela, Tue Jun 16 09:13:12 2020 UTC
# Line 1  Line 1 
1  // qsamplerUtilities.cpp  // qsamplerUtilities.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2019, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2020, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, 2008 Christian Schoenebeck     Copyright (C) 2007, 2008 Christian Schoenebeck
6    
7     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
# Line 25  Line 25 
25  #include "qsamplerOptions.h"  #include "qsamplerOptions.h"
26  #include "qsamplerMainForm.h"  #include "qsamplerMainForm.h"
27    
28  #include <QRegExp>  #include <QRegularExpression>
29    
30    
31  using namespace QSampler;  using namespace QSampler;
# Line 89  QString lscpEscapePath ( const QString& Line 89  QString lscpEscapePath ( const QString&
89          // replace POSIX path escape sequences (%HH) by LSCP escape sequences (\xHH)          // replace POSIX path escape sequences (%HH) by LSCP escape sequences (\xHH)
90          // TODO: missing code for other systems like Windows          // TODO: missing code for other systems like Windows
91          {          {
92                  QRegExp regexp("%[0-9a-fA-F][0-9a-fA-F]");                  QRegularExpression regexp("%[0-9a-fA-F][0-9a-fA-F]");
93                  for (int i = path.indexOf(regexp); i >= 0; i = path.indexOf(regexp, i + 4))                  for (int i = path.indexOf(regexp); i >= 0; i = path.indexOf(regexp, i + 4))
94                          path.replace(i, 1, "\\x");                          path.replace(i, 1, "\\x");
95          }          }
# Line 100  QString lscpEscapePath ( const QString& Line 100  QString lscpEscapePath ( const QString&
100          // replace all non-basic characters by LSCP escape sequences          // replace all non-basic characters by LSCP escape sequences
101          {          {
102                  const char pathSeparator = '/';                  const char pathSeparator = '/';
103                  QRegExp regexp(QRegExp::escape("\\x") + "[0-9a-fA-F][0-9a-fA-F]");                  QRegularExpression regexp(QRegularExpression::escape("\\x") + "[0-9a-fA-F][0-9a-fA-F]");
104                  for (int i = 0; i < int(path.length()); i++) {                  for (int i = 0; i < int(path.length()); i++) {
105                          // first skip all previously added LSCP escape sequences                          // first skip all previously added LSCP escape sequences
106                          if (path.indexOf(regexp, i) == i) {                          if (path.indexOf(regexp, i) == i) {
# Line 146  QString lscpEscapedPathToPosix ( const Q Line 146  QString lscpEscapedPathToPosix ( const Q
146                  path.replace(i, 1, "%%");                  path.replace(i, 1, "%%");
147    
148          // resolve LSCP hex escape sequences (\xHH)          // resolve LSCP hex escape sequences (\xHH)
149          QRegExp regexp(QRegExp::escape("\\x") + "[0-9a-fA-F][0-9a-fA-F]");          QRegularExpression regexp(QRegularExpression::escape("\\x") + "[0-9a-fA-F][0-9a-fA-F]");
150          for (int i = path.indexOf(regexp); i >= 0; i = path.indexOf(regexp, i + 4)) {          for (int i = path.indexOf(regexp); i >= 0; i = path.indexOf(regexp, i + 4)) {
151                  const QString sHex = path.mid(i + 2, 2).toLower();                  const QString sHex = path.mid(i + 2, 2).toLower();
152                  // the slash has to be escaped for POSIX as well                  // the slash has to be escaped for POSIX as well
# Line 203  QString lscpEscapedTextToRaw ( const QSt Line 203  QString lscpEscapedTextToRaw ( const QSt
203          QString text(sText);          QString text(sText);
204    
205          // resolve LSCP hex escape sequences (\xHH)          // resolve LSCP hex escape sequences (\xHH)
206          QRegExp regexp(QRegExp::escape("\\x") + "[0-9a-fA-F][0-9a-fA-F]");          QRegularExpression regexp(QRegularExpression::escape("\\x") + "[0-9a-fA-F][0-9a-fA-F]");
207          for (int i = text.indexOf(regexp); i >= 0; i = text.indexOf(regexp, i + 4)) {          for (int i = text.indexOf(regexp); i >= 0; i = text.indexOf(regexp, i + 4)) {
208                  const QString sHex = text.mid(i + 2, 2).toLower();                  const QString sHex = text.mid(i + 2, 2).toLower();
209                  // decode into raw ASCII character                  // decode into raw ASCII character

Legend:
Removed from v.3793  
changed lines
  Added in v.3794

  ViewVC Help
Powered by ViewVC