forked from qt-creator/qt-creator
Library wizard: Create export symbol correctly.
...if the directory contains a '-'. Export a function to generate identifier correctly and use that. Reviewed-by: con <qtc-committer@nokia.com> Task-number: QTCREATORBUG-248
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
static QString toAlphaNum(const QString &s)
|
QTCREATOR_UTILS_EXPORT QString fileNameToCppIdentifier(const QString &s)
|
||||||
{
|
{
|
||||||
QString rc;
|
QString rc;
|
||||||
const int len = s.size();
|
const int len = s.size();
|
||||||
@@ -55,9 +55,9 @@ static QString toAlphaNum(const QString &s)
|
|||||||
QTCREATOR_UTILS_EXPORT QString headerGuard(const QString &file)
|
QTCREATOR_UTILS_EXPORT QString headerGuard(const QString &file)
|
||||||
{
|
{
|
||||||
const QFileInfo fi(file);
|
const QFileInfo fi(file);
|
||||||
QString rc = toAlphaNum(fi.completeBaseName()).toUpper();
|
QString rc = fileNameToCppIdentifier(fi.completeBaseName()).toUpper();
|
||||||
rc += QLatin1Char('_');
|
rc += QLatin1Char('_');
|
||||||
rc += toAlphaNum(fi.suffix()).toUpper();
|
rc += fileNameToCppIdentifier(fi.suffix()).toUpper();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,6 +40,10 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace Utils {
|
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 QString headerGuard(const QString &file);
|
||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT
|
QTCREATOR_UTILS_EXPORT
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "qtprojectparameters.h"
|
#include "qtprojectparameters.h"
|
||||||
|
#include <utils/codegeneration.h>
|
||||||
|
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
@@ -108,7 +109,7 @@ QString createMacro(const QString &name, const QString &suffix)
|
|||||||
if (extensionPosition != -1)
|
if (extensionPosition != -1)
|
||||||
rc.truncate(extensionPosition);
|
rc.truncate(extensionPosition);
|
||||||
rc += suffix;
|
rc += suffix;
|
||||||
return rc;
|
return Utils::fileNameToCppIdentifier(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QtProjectParameters::exportMacro(const QString &projectName)
|
QString QtProjectParameters::exportMacro(const QString &projectName)
|
||||||
|
Reference in New Issue
Block a user