diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2014-12-26 21:13:18 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2015-07-14 20:01:11 (GMT) |
commit | 333c7c44f1aa3c62f9401b190e45eaff15056d5c (patch) | |
tree | 254eee541a9f98d560667a05a3222d2f0a921e3e /addon/doxywizard/config_doxyw.l | |
parent | c33e03f3cb9f0ae1c00b7e785964c915f4085fe0 (diff) | |
download | Doxygen-333c7c44f1aa3c62f9401b190e45eaff15056d5c.zip Doxygen-333c7c44f1aa3c62f9401b190e45eaff15056d5c.tar.gz Doxygen-333c7c44f1aa3c62f9401b190e45eaff15056d5c.tar.bz2 |
Make doxywizard compatible with Qt5
Diffstat (limited to 'addon/doxywizard/config_doxyw.l')
-rw-r--r-- | addon/doxywizard/config_doxyw.l | 71 |
1 files changed, 40 insertions, 31 deletions
diff --git a/addon/doxywizard/config_doxyw.l b/addon/doxywizard/config_doxyw.l index 829f807..90bd09e 100644 --- a/addon/doxywizard/config_doxyw.l +++ b/addon/doxywizard/config_doxyw.l @@ -20,7 +20,16 @@ */ #include "config.h" #include "input.h" -#include <QtCore> + +#include <QString> +#include <QVariant> +#include <QStack> +#include <QTextCodec> +#include <QByteArray> +#include <QFileInfo> +#include <QStringList> +#include <QRegExp> +#include <QTextStream> #define YY_NO_UNISTD_H 1 @@ -52,7 +61,7 @@ static QVariant *g_arg; static Input *g_curOption=0; static QString g_elemStr; static QTextCodec *g_codec = QTextCodec::codecForName("UTF-8"); -static QString g_codecName = QString::fromAscii("UTF-8"); +static QString g_codecName = QString::fromLatin1("UTF-8"); static int g_lastState; static QByteArray g_tmpString; @@ -74,13 +83,13 @@ static int yyread(char *buf,int maxSize) } } -static QString warning_str = QString::fromAscii("warning: "); -static QString error_str = QString::fromAscii("error: "); +static QString warning_str = QString::fromLatin1("warning: "); +static QString error_str = QString::fromLatin1("error: "); void config_err(const char *fmt, ...) { QString msg = error_str; - msg.append(QString::fromAscii(fmt)); + msg.append(QString::fromLatin1(fmt)); va_list args; va_start(args, fmt); vfprintf(stderr, qPrintable(msg), args); @@ -89,7 +98,7 @@ void config_err(const char *fmt, ...) void config_warn(const char *fmt, ...) { QString msg = warning_str; - msg.append(QString::fromAscii(fmt)); + msg.append(QString::fromLatin1(fmt)); va_list args; va_start(args, fmt); vfprintf(stderr, qPrintable(msg), args); @@ -101,10 +110,10 @@ static void substEnvVarsInString(QString &s); static void checkEncoding() { - Input *option = g_options->value(QString::fromAscii("DOXYFILE_ENCODING")); + Input *option = g_options->value(QString::fromLatin1("DOXYFILE_ENCODING")); if (option && option->value().toString()!=g_codecName) { - QTextCodec *newCodec = QTextCodec::codecForName(option->value().toString().toAscii()); + QTextCodec *newCodec = QTextCodec::codecForName(option->value().toString().toLatin1()); if (newCodec) { g_codec = newCodec; @@ -115,7 +124,7 @@ static void checkEncoding() static FILE *tryPath(const QString &path,const QString &fileName) { - QString absName=!path.isEmpty() ? path+QString::fromAscii("/")+fileName : fileName; + QString absName=!path.isEmpty() ? path+QString::fromLatin1("/")+fileName : fileName; QFileInfo fi(absName); if (fi.exists() && fi.isFile()) { @@ -144,7 +153,7 @@ static FILE *findFile(const QString &fileName) if (f) return f; } // try cwd if g_includePathList fails - return tryPath(QString::fromAscii("."),fileName); + return tryPath(QString::fromLatin1("."),fileName); } static void readIncludeFile(const QString &incName) @@ -160,8 +169,8 @@ static void readIncludeFile(const QString &incName) substEnvVarsInString(inc); inc = inc.trimmed(); uint incLen = inc.length(); - if (inc.at(0)==QChar::fromAscii('"') && - inc.at(incLen-1)==QChar::fromAscii('"')) // strip quotes + if (inc.at(0)==QChar::fromLatin1('"') && + inc.at(incLen-1)==QChar::fromLatin1('"')) // strip quotes { inc=inc.mid(1,incLen-2); } @@ -383,7 +392,7 @@ static void readIncludeFile(const QString &incName) static void substEnvVarsInString(QString &s) { - static QRegExp re(QString::fromAscii("\\$\\([a-z_A-Z0-9]+\\)")); + static QRegExp re(QString::fromLatin1("\\$\\([a-z_A-Z0-9]+\\)")); if (s.isEmpty()) return; int p=0; int i,l; @@ -409,8 +418,8 @@ static void substEnvVarsInStrList(QStringList &sl) foreach (QString result, sl) { // an argument with quotes will have an extra space at the end, so wasQuoted will be TRUE. - bool wasQuoted = (result.indexOf(QChar::fromAscii(' '))!=-1) || - (result.indexOf(QChar::fromAscii('\t'))!=-1); + bool wasQuoted = (result.indexOf(QChar::fromLatin1(' '))!=-1) || + (result.indexOf(QChar::fromLatin1('\t'))!=-1); // here we strip the quote again substEnvVarsInString(result); @@ -430,33 +439,33 @@ static void substEnvVarsInStrList(QStringList &sl) { QChar c=0; // skip until start of new word - while (i<l && ((c=result.at(i))==QChar::fromAscii(' ') || c==QChar::fromAscii('\t'))) i++; + while (i<l && ((c=result.at(i))==QChar::fromLatin1(' ') || c==QChar::fromLatin1('\t'))) i++; p=i; // p marks the start index of the word // skip until end of a word - while (i<l && ((c=result.at(i))!=QChar::fromAscii(' ') && - c!=QChar::fromAscii('\t') && - c!=QChar::fromAscii('"'))) i++; + while (i<l && ((c=result.at(i))!=QChar::fromLatin1(' ') && + c!=QChar::fromLatin1('\t') && + c!=QChar::fromLatin1('"'))) i++; if (i<l) // not at the end of the string { - if (c==QChar::fromAscii('"')) // word within quotes + if (c==QChar::fromLatin1('"')) // word within quotes { p=i+1; for (i++;i<l;i++) { c=result.at(i); - if (c==QChar::fromAscii('"')) // end quote + if (c==QChar::fromLatin1('"')) // end quote { out += result.mid(p,i-p); p=i+1; break; } - else if (c==QChar::fromAscii('\\')) // skip escaped stuff + else if (c==QChar::fromLatin1('\\')) // skip escaped stuff { i++; } } } - else if (c==QChar::fromAscii(' ') || c==QChar::fromAscii('\t')) // separator + else if (c==QChar::fromLatin1(' ') || c==QChar::fromLatin1('\t')) // separator { out += result.mid(p,i-p); p=i+1; @@ -529,7 +538,7 @@ bool parseConfig( void writeStringValue(QTextStream &t,QTextCodec *codec,const QString &s) { QChar c; - bool needsEscaping=FALSE; + bool needsEscaping=false; // convert the string back to it original encoding //QByteArray se = codec->fromUnicode(s); t.setCodec(codec); @@ -538,10 +547,10 @@ void writeStringValue(QTextStream &t,QTextCodec *codec,const QString &s) { while (!(c=*p++).isNull() && !needsEscaping) { - needsEscaping = (c==QChar::fromAscii(' ') || - c==QChar::fromAscii('\n') || - c==QChar::fromAscii('\t') || - c==QChar::fromAscii('"')); + needsEscaping = (c==QChar::fromLatin1(' ') || + c==QChar::fromLatin1('\n') || + c==QChar::fromLatin1('\t') || + c==QChar::fromLatin1('"')); } if (needsEscaping) { @@ -549,9 +558,9 @@ void writeStringValue(QTextStream &t,QTextCodec *codec,const QString &s) p=s.data(); while (!p->isNull()) { - if (*p ==QChar::fromAscii(' ') && - *(p+1)==QChar::fromAscii('\0')) break; // skip inserted space at the end - if (*p ==QChar::fromAscii('"')) t << "\\"; // escape quotes + if (*p ==QChar::fromLatin1(' ') && + *(p+1)==QChar::fromLatin1('\0')) break; // skip inserted space at the end + if (*p ==QChar::fromLatin1('"')) t << "\\"; // escape quotes t << *p++; } t << "\""; |