Commit 901239e1 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Library wizard: Create export symbol correctly.



...if the directory contains a '-'. Export a function to generate
identifier correctly and use that.
Reviewed-by: default avatarcon <qtc-committer@nokia.com>
Task-number: QTCREATORBUG-248
parent 90337491
......@@ -35,7 +35,7 @@
namespace Utils {
static QString toAlphaNum(const QString &s)
QTCREATOR_UTILS_EXPORT QString fileNameToCppIdentifier(const QString &s)
{
QString rc;
const int len = s.size();
......@@ -55,9 +55,9 @@ static QString toAlphaNum(const QString &s)
QTCREATOR_UTILS_EXPORT QString headerGuard(const QString &file)
{
const QFileInfo fi(file);
QString rc = toAlphaNum(fi.completeBaseName()).toUpper();
QString rc = fileNameToCppIdentifier(fi.completeBaseName()).toUpper();
rc += QLatin1Char('_');
rc += toAlphaNum(fi.suffix()).toUpper();
rc += fileNameToCppIdentifier(fi.suffix()).toUpper();
return rc;
}
......
......@@ -40,6 +40,10 @@ QT_END_NAMESPACE
namespace Utils {
// Convert a file name to a Cpp identifier (stripping invalid characters
// or replacing them by an underscore).
QTCREATOR_UTILS_EXPORT QString fileNameToCppIdentifier(const QString &s);
QTCREATOR_UTILS_EXPORT QString headerGuard(const QString &file);
QTCREATOR_UTILS_EXPORT
......
......@@ -28,6 +28,7 @@
**************************************************************************/
#include "qtprojectparameters.h"
#include <utils/codegeneration.h>
#include <QtCore/QTextStream>
#include <QtCore/QDir>
......@@ -108,7 +109,7 @@ QString createMacro(const QString &name, const QString &suffix)
if (extensionPosition != -1)
rc.truncate(extensionPosition);
rc += suffix;
return rc;
return Utils::fileNameToCppIdentifier(rc);
}
QString QtProjectParameters::exportMacro(const QString &projectName)
......
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