forked from qt-creator/qt-creator
Utils: Collapse most of porting,h
Taking the Qt 6 branches, leaving some dummies until downstream adapted. Change-Id: Ib9b86568d73c341c8f740ba497c3cbfab830d8a1 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -151,9 +151,9 @@ bool operator==(const FullyQualifiedName &left, const FullyQualifiedName &right)
|
||||
return compareFullyQualifiedName(left.fqn, right.fqn);
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const FullyQualifiedName &fullyQualifiedName)
|
||||
size_t qHash(const FullyQualifiedName &fullyQualifiedName)
|
||||
{
|
||||
Utils::QHashValueType h = 0;
|
||||
size_t h = 0;
|
||||
for (int i = 0; i < fullyQualifiedName.fqn.size(); ++i) {
|
||||
if (const Name *n = fullyQualifiedName.fqn.at(i)) {
|
||||
if (const Identifier *id = n->identifier()) {
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
|
||||
using namespace CPlusPlus;
|
||||
|
||||
Utils::QHashValueType CPlusPlus::qHash(const LookupItem &key)
|
||||
size_t CPlusPlus::qHash(const LookupItem &key)
|
||||
{
|
||||
const Utils::QHashValueType h1 = QT_PREPEND_NAMESPACE(qHash)(key.type().type());
|
||||
const Utils::QHashValueType h2 = QT_PREPEND_NAMESPACE(qHash)(key.scope());
|
||||
const size_t h1 = QT_PREPEND_NAMESPACE(qHash)(key.type().type());
|
||||
const size_t h2 = QT_PREPEND_NAMESPACE(qHash)(key.scope());
|
||||
return ((h1 << 16) | (h1 >> 16)) ^ h2;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,6 @@ private:
|
||||
ClassOrNamespace *_binding;
|
||||
};
|
||||
|
||||
Utils::QHashValueType qHash(const CPlusPlus::LookupItem &result);
|
||||
size_t qHash(const CPlusPlus::LookupItem &result);
|
||||
|
||||
} // namespace CPlusPlus
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace ExtensionSystem {
|
||||
\fn uint ExtensionSystem::qHash(const ExtensionSystem::PluginDependency &value)
|
||||
\internal
|
||||
*/
|
||||
Utils::QHashValueType qHash(const PluginDependency &value)
|
||||
size_t qHash(const PluginDependency &value)
|
||||
{
|
||||
return qHash(value.name);
|
||||
}
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
|
||||
#include "extensionsystem_global.h"
|
||||
|
||||
#include <utils/porting.h>
|
||||
|
||||
#include <QHash>
|
||||
#include <QStaticPlugin>
|
||||
#include <QString>
|
||||
@@ -61,7 +59,7 @@ struct EXTENSIONSYSTEM_EXPORT PluginDependency
|
||||
|
||||
PluginDependency() : type(Required) {}
|
||||
|
||||
friend Utils::QHashValueType qHash(const PluginDependency &value);
|
||||
friend size_t qHash(const PluginDependency &value);
|
||||
|
||||
QString name;
|
||||
QString version;
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
ObjectVisuals m_objectVisuals;
|
||||
};
|
||||
|
||||
Utils::QHashValueType qHash(const ObjectStyleKey &styleKey)
|
||||
size_t qHash(const ObjectStyleKey &styleKey)
|
||||
{
|
||||
return ::qHash(styleKey.m_elementType) ^ qHash(styleKey.m_objectVisuals);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
DObject::VisualPrimaryRole m_visualPrimaryRole = DObject::PrimaryRoleNormal;
|
||||
};
|
||||
|
||||
Utils::QHashValueType qHash(const RelationStyleKey &styleKey)
|
||||
size_t qHash(const RelationStyleKey &styleKey)
|
||||
{
|
||||
return ::qHash(styleKey.m_elementType) ^ ::qHash(styleKey.m_visualPrimaryRole);
|
||||
}
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
DAnnotation::VisualRole m_visualRole = DAnnotation::RoleNormal;
|
||||
};
|
||||
|
||||
Utils::QHashValueType qHash(const AnnotationStyleKey &styleKey)
|
||||
size_t qHash(const AnnotationStyleKey &styleKey)
|
||||
{
|
||||
return ::qHash(styleKey.m_visualRole);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ class BoundaryStyleKey
|
||||
{
|
||||
};
|
||||
|
||||
Utils::QHashValueType qHash(const BoundaryStyleKey &styleKey)
|
||||
size_t qHash(const BoundaryStyleKey &styleKey)
|
||||
{
|
||||
Q_UNUSED(styleKey)
|
||||
|
||||
@@ -163,7 +163,7 @@ class SwimlaneStyleKey
|
||||
{
|
||||
};
|
||||
|
||||
Utils::QHashValueType qHash(const SwimlaneStyleKey &styleKey)
|
||||
size_t qHash(const SwimlaneStyleKey &styleKey)
|
||||
{
|
||||
Q_UNUSED(styleKey)
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ bool operator==(const ObjectVisuals &lhs, const ObjectVisuals &rhs)
|
||||
&& lhs.depth() == rhs.depth();
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const ObjectVisuals &objectVisuals)
|
||||
size_t qHash(const ObjectVisuals &objectVisuals)
|
||||
{
|
||||
return ::qHash(static_cast<int>(objectVisuals.visualPrimaryRole()))
|
||||
^ ::qHash(static_cast<int>(objectVisuals.visualSecondaryRole()))
|
||||
|
||||
@@ -62,6 +62,6 @@ private:
|
||||
};
|
||||
|
||||
bool operator==(const ObjectVisuals &lhs, const ObjectVisuals &rhs);
|
||||
Utils::QHashValueType qHash(const ObjectVisuals &objectVisuals);
|
||||
size_t qHash(const ObjectVisuals &objectVisuals);
|
||||
|
||||
} // namespace qmt
|
||||
|
||||
@@ -149,7 +149,7 @@ void DragWidget::leaveEvent(QEvent *)
|
||||
unsetCursor();
|
||||
}
|
||||
|
||||
void DragWidget::enterEvent(EnterEvent *)
|
||||
void DragWidget::enterEvent(QEnterEvent *)
|
||||
{
|
||||
if (HostOsInfo::isMacHost())
|
||||
setCursor(Qt::ArrowCursor);
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
|
||||
#include "qmleditorwidgets_global.h"
|
||||
|
||||
#include <utils/porting.h>
|
||||
|
||||
#include <QFrame>
|
||||
#include <QPointer>
|
||||
|
||||
@@ -65,7 +63,7 @@ protected:
|
||||
void mouseMoveEvent(QMouseEvent * event) override;
|
||||
void virtual protectedMoved();
|
||||
void leaveEvent(QEvent *) override;
|
||||
void enterEvent(Utils::EnterEvent *) override;
|
||||
void enterEvent(QEnterEvent *) override;
|
||||
|
||||
private:
|
||||
QGraphicsDropShadowEffect *m_dropShadowEffect;
|
||||
|
||||
@@ -186,7 +186,7 @@ void CustomColorDialog::leaveEvent(QEvent *)
|
||||
unsetCursor();
|
||||
}
|
||||
|
||||
void CustomColorDialog::enterEvent(EnterEvent *)
|
||||
void CustomColorDialog::enterEvent(QEnterEvent *)
|
||||
{
|
||||
if (HostOsInfo::isMacHost())
|
||||
setCursor(Qt::ArrowCursor);
|
||||
|
||||
@@ -86,7 +86,7 @@ signals:
|
||||
protected:
|
||||
void setupWidgets();
|
||||
void leaveEvent(QEvent *) override;
|
||||
void enterEvent(Utils::EnterEvent *) override;
|
||||
void enterEvent(QEnterEvent *) override;
|
||||
|
||||
private:
|
||||
QFrame *m_beforeColorWidget;
|
||||
|
||||
@@ -221,9 +221,9 @@ QList<Dialect> Dialect::companionLanguages() const
|
||||
return langs;
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const Dialect &o)
|
||||
size_t qHash(const Dialect &o)
|
||||
{
|
||||
return Utils::QHashValueType(o.dialect());
|
||||
return size_t(o.dialect());
|
||||
}
|
||||
|
||||
QDebug operator << (QDebug &dbg, const Dialect &dialect)
|
||||
|
||||
@@ -74,7 +74,7 @@ private:
|
||||
Enum m_dialect;
|
||||
};
|
||||
|
||||
QMLJS_EXPORT Utils::QHashValueType qHash(const Dialect &o);
|
||||
QMLJS_EXPORT size_t qHash(const Dialect &o);
|
||||
|
||||
QMLJS_EXPORT QDebug operator << (QDebug &dbg, const Dialect &dialect);
|
||||
|
||||
|
||||
@@ -502,9 +502,9 @@ QString ImportKey::toString() const
|
||||
return res;
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const ImportKey &info)
|
||||
size_t qHash(const ImportKey &info)
|
||||
{
|
||||
Utils::QHashValueType res = ::qHash(info.type) ^
|
||||
size_t res = ::qHash(info.type) ^
|
||||
::qHash(info.majorVersion) ^ ::qHash(info.minorVersion);
|
||||
foreach (const QString &s, info.splitPath)
|
||||
res = res ^ ::qHash(s);
|
||||
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
QString toString() const;
|
||||
};
|
||||
|
||||
Utils::QHashValueType qHash(const ImportKey &info);
|
||||
size_t qHash(const ImportKey &info);
|
||||
bool operator ==(const ImportKey &i1, const ImportKey &i2);
|
||||
bool operator !=(const ImportKey &i1, const ImportKey &i2);
|
||||
bool operator <(const ImportKey &i1, const ImportKey &i2);
|
||||
|
||||
@@ -175,7 +175,7 @@ bool FakeMetaObjectWithOrigin::operator ==(const FakeMetaObjectWithOrigin &o) co
|
||||
return fakeMetaObject == o.fakeMetaObject;
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const FakeMetaObjectWithOrigin &fmoo)
|
||||
size_t qHash(const FakeMetaObjectWithOrigin &fmoo)
|
||||
{
|
||||
return qHash(fmoo.fakeMetaObject);
|
||||
}
|
||||
|
||||
@@ -735,7 +735,7 @@ public:
|
||||
bool operator ==(const FakeMetaObjectWithOrigin &o) const;
|
||||
};
|
||||
|
||||
QMLJS_EXPORT Utils::QHashValueType qHash(const FakeMetaObjectWithOrigin &fmoo);
|
||||
QMLJS_EXPORT size_t qHash(const FakeMetaObjectWithOrigin &fmoo);
|
||||
|
||||
class QMLJS_EXPORT CppQmlTypes
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
{}
|
||||
|
||||
private:
|
||||
friend Utils::QHashValueType qHash(const ImportCacheKey &);
|
||||
friend size_t qHash(const ImportCacheKey &);
|
||||
friend bool operator==(const ImportCacheKey &, const ImportCacheKey &);
|
||||
|
||||
int m_type;
|
||||
@@ -64,7 +64,7 @@ private:
|
||||
int m_minorVersion;
|
||||
};
|
||||
|
||||
Utils::QHashValueType qHash(const ImportCacheKey &info)
|
||||
size_t qHash(const ImportCacheKey &info)
|
||||
{
|
||||
return ::qHash(info.m_type) ^ ::qHash(info.m_path) ^
|
||||
::qHash(info.m_majorVersion) ^ ::qHash(info.m_minorVersion);
|
||||
|
||||
@@ -293,7 +293,7 @@ void DetailsWidget::paintEvent(QPaintEvent *paintEvent)
|
||||
}
|
||||
}
|
||||
|
||||
void DetailsWidget::enterEvent(EnterEvent *event)
|
||||
void DetailsWidget::enterEvent(QEnterEvent *event)
|
||||
{
|
||||
QWidget::enterEvent(event);
|
||||
d->changeHoverState(true);
|
||||
|
||||
@@ -96,7 +96,7 @@ private:
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *paintEvent) override;
|
||||
void enterEvent(EnterEvent *event) override;
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
DockWidget(QWidget *inner, FancyMainWindow *parent, bool immutable = false);
|
||||
|
||||
bool eventFilter(QObject *, QEvent *event) override;
|
||||
void enterEvent(EnterEvent *event) override;
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void handleMouseTimeout();
|
||||
void handleToplevelChanged(bool floating);
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
|
||||
QSize minimumSizeHint() const override { return sizeHint(); }
|
||||
|
||||
void enterEvent(EnterEvent *event) override
|
||||
void enterEvent(QEnterEvent *event) override
|
||||
{
|
||||
if (isEnabled())
|
||||
update();
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
setProperty("managed_titlebar", 1);
|
||||
}
|
||||
|
||||
void enterEvent(EnterEvent *event) override
|
||||
void enterEvent(QEnterEvent *event) override
|
||||
{
|
||||
setActive(true);
|
||||
QWidget::enterEvent(event);
|
||||
@@ -303,7 +303,7 @@ bool DockWidget::eventFilter(QObject *, QEvent *event)
|
||||
return false;
|
||||
}
|
||||
|
||||
void DockWidget::enterEvent(EnterEvent *event)
|
||||
void DockWidget::enterEvent(QEnterEvent *event)
|
||||
{
|
||||
if (!m_immutable)
|
||||
QApplication::instance()->installEventFilter(this);
|
||||
|
||||
@@ -1410,7 +1410,7 @@ FilePath FilePath::stringAppended(const QString &str) const
|
||||
return fn;
|
||||
}
|
||||
|
||||
QHashValueType FilePath::hash(uint seed) const
|
||||
size_t FilePath::hash(uint seed) const
|
||||
{
|
||||
if (HostOsInfo::fileNameCaseSensitivity() == Qt::CaseInsensitive)
|
||||
return qHash(m_data.toCaseFolded(), seed);
|
||||
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
void clear();
|
||||
bool isEmpty() const;
|
||||
|
||||
QHashValueType hash(uint seed) const;
|
||||
size_t hash(uint seed) const;
|
||||
|
||||
[[nodiscard]] FilePath resolvePath(const FilePath &tail) const;
|
||||
[[nodiscard]] FilePath resolvePath(const QString &tail) const;
|
||||
@@ -224,7 +224,7 @@ private:
|
||||
|
||||
using FilePaths = QList<FilePath>;
|
||||
|
||||
inline QHashValueType qHash(const Utils::FilePath &a, uint seed = 0)
|
||||
inline size_t qHash(const Utils::FilePath &a, uint seed = 0)
|
||||
{
|
||||
return a.hash(seed);
|
||||
}
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ public:
|
||||
static QSet<Id> fromStringList(const QStringList &list);
|
||||
static QStringList toStringList(const QSet<Id> &ids);
|
||||
|
||||
friend QHashValueType qHash(Id id) { return static_cast<QHashValueType>(id.uniqueIdentifier()); }
|
||||
friend size_t qHash(Id id) { return static_cast<size_t>(id.uniqueIdentifier()); }
|
||||
friend QTCREATOR_UTILS_EXPORT QDataStream &operator<<(QDataStream &ds, Id id);
|
||||
friend QTCREATOR_UTILS_EXPORT QDataStream &operator>>(QDataStream &ds, Id &id);
|
||||
friend QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug dbg, const Id &id);
|
||||
|
||||
@@ -63,7 +63,7 @@ Link Link::fromFilePath(const FilePath &filePath, bool canContainLineNumber, QSt
|
||||
return Link{filePath.withNewPath(fileName.left(postfixPos)), lineColumn.line, lineColumn.column};
|
||||
}
|
||||
|
||||
QHashValueType qHash(const Link &l)
|
||||
size_t qHash(const Link &l)
|
||||
{
|
||||
QString s = l.targetFilePath.toString();
|
||||
return qHash(s.append(':').append(QString::number(l.targetLine)).append(':')
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
int targetColumn;
|
||||
};
|
||||
|
||||
QTCREATOR_UTILS_EXPORT QHashValueType qHash(const Link &l);
|
||||
QTCREATOR_UTILS_EXPORT size_t qHash(const Link &l);
|
||||
|
||||
using LinkHandler = std::function<void(const Link &)>;
|
||||
using Links = QList<Link>;
|
||||
|
||||
@@ -190,13 +190,13 @@ private:
|
||||
enum Element { QtCreatorElement, DataElement, VariableElement,
|
||||
SimpleValueElement, ListValueElement, MapValueElement, UnknownElement };
|
||||
|
||||
Element element(const StringView &r) const;
|
||||
Element element(const QStringView &r) const;
|
||||
static inline bool isValueElement(Element e)
|
||||
{ return e == SimpleValueElement || e == ListValueElement || e == MapValueElement; }
|
||||
QVariant readSimpleValue(QXmlStreamReader &r, const QXmlStreamAttributes &attributes) const;
|
||||
|
||||
bool handleStartElement(QXmlStreamReader &r);
|
||||
bool handleEndElement(const StringView &name);
|
||||
bool handleEndElement(const QStringView &name);
|
||||
|
||||
static QString formatWarning(const QXmlStreamReader &r, const QString &message);
|
||||
|
||||
@@ -235,7 +235,7 @@ QVariantMap ParseContext::parse(const FilePath &file)
|
||||
|
||||
bool ParseContext::handleStartElement(QXmlStreamReader &r)
|
||||
{
|
||||
const StringView name = r.name();
|
||||
const QStringView name = r.name();
|
||||
const Element e = element(name);
|
||||
if (e == VariableElement) {
|
||||
m_currentVariableName = r.readElementText();
|
||||
@@ -270,7 +270,7 @@ bool ParseContext::handleStartElement(QXmlStreamReader &r)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ParseContext::handleEndElement(const StringView &name)
|
||||
bool ParseContext::handleEndElement(const QStringView &name)
|
||||
{
|
||||
const Element e = element(name);
|
||||
if (ParseContext::isValueElement(e)) {
|
||||
@@ -299,7 +299,7 @@ QString ParseContext::formatWarning(const QXmlStreamReader &r, const QString &me
|
||||
return result;
|
||||
}
|
||||
|
||||
ParseContext::Element ParseContext::element(const StringView &r) const
|
||||
ParseContext::Element ParseContext::element(const QStringView &r) const
|
||||
{
|
||||
if (r == valueElement)
|
||||
return SimpleValueElement;
|
||||
@@ -319,7 +319,7 @@ ParseContext::Element ParseContext::element(const StringView &r) const
|
||||
QVariant ParseContext::readSimpleValue(QXmlStreamReader &r, const QXmlStreamAttributes &attributes) const
|
||||
{
|
||||
// Simple value
|
||||
const StringView type = attributes.value(typeAttribute);
|
||||
const QStringView type = attributes.value(typeAttribute);
|
||||
const QString text = r.readElementText();
|
||||
if (type == QLatin1String("QChar")) { // Workaround: QTBUG-12345
|
||||
QTC_ASSERT(text.size() == 1, return QVariant());
|
||||
|
||||
@@ -34,63 +34,21 @@
|
||||
|
||||
namespace Utils {
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
using QHashValueType = uint;
|
||||
#else
|
||||
// FIXME: Remove when downstream has been adapted
|
||||
|
||||
using QHashValueType = size_t;
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
using QtSizeType = int;
|
||||
#else
|
||||
using QtSizeType = qsizetype;
|
||||
#endif
|
||||
|
||||
// StringView - either QStringRef or QStringView
|
||||
// Can be used where it is not possible to completely switch to QStringView
|
||||
// For example where QString::splitRef / QStringView::split is essential.
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
using StringView = QStringRef;
|
||||
#else
|
||||
using StringView = QStringView;
|
||||
#endif
|
||||
|
||||
inline StringView make_stringview(const QString &s)
|
||||
inline QStringView make_stringview(const QString &s)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
return QStringRef(&s);
|
||||
#else
|
||||
return QStringView(s);
|
||||
#endif
|
||||
}
|
||||
|
||||
// QStringView::mid in Qt5 does not do bounds checking, in Qt6 it does
|
||||
inline QStringView midView(const QString &s, int offset, int length = -1)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
const int size = s.size();
|
||||
if (offset > size)
|
||||
return {};
|
||||
if (offset < 0) {
|
||||
if (length < 0 || length + offset >= size)
|
||||
return QStringView(s);
|
||||
if (length + offset <= 0)
|
||||
return {};
|
||||
return QStringView(s).left(length + offset);
|
||||
} else if (length < 0 || length > size - offset)
|
||||
return QStringView(s).mid(offset);
|
||||
return QStringView(s).mid(offset, length);
|
||||
#else
|
||||
return QStringView(s).mid(offset, length);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef QT_GUI_LIB
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
using EnterEvent = QEvent;
|
||||
#else
|
||||
using EnterEvent = QEnterEvent;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
@@ -62,7 +62,7 @@ QIcon Diagnostic::icon() const
|
||||
return {};
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const Diagnostic &diagnostic)
|
||||
size_t qHash(const Diagnostic &diagnostic)
|
||||
{
|
||||
return qHash(diagnostic.name)
|
||||
^ qHash(diagnostic.description)
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
QIcon icon() const;
|
||||
|
||||
friend bool operator==(const Diagnostic &lhs, const Diagnostic &rhs);
|
||||
friend Utils::QHashValueType qHash(const Diagnostic &diagnostic);
|
||||
friend size_t qHash(const Diagnostic &diagnostic);
|
||||
|
||||
QString name;
|
||||
QString description;
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
|
||||
private:
|
||||
const int m_iconType;
|
||||
const Utils::QHashValueType m_hash; // precalculated hash value - to speed up qHash
|
||||
const size_t m_hash; // precalculated hash value - to speed up qHash
|
||||
const QString m_name; // symbol name (e.g. SymbolInformation)
|
||||
const QString m_type; // symbol type (e.g. (int char))
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
inline const QString &fileName() const { return m_fileName; }
|
||||
inline int line() const { return m_line; }
|
||||
inline int column() const { return m_column; }
|
||||
inline Utils::QHashValueType hash() const { return m_hash; }
|
||||
inline size_t hash() const { return m_hash; }
|
||||
inline bool operator==(const SymbolLocation &other) const
|
||||
{
|
||||
return hash() == other.hash() && line() == other.line() && column() == other.column()
|
||||
@@ -56,11 +56,11 @@ private:
|
||||
const QString m_fileName;
|
||||
const int m_line;
|
||||
const int m_column;
|
||||
const Utils::QHashValueType m_hash; // precalculated hash value - to speed up qHash
|
||||
const size_t m_hash; // precalculated hash value - to speed up qHash
|
||||
};
|
||||
|
||||
//! qHash overload for QHash/QSet
|
||||
inline Utils::QHashValueType qHash(const ClassView::Internal::SymbolLocation &location)
|
||||
inline size_t qHash(const ClassView::Internal::SymbolLocation &location)
|
||||
{
|
||||
return location.hash();
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ bool CMakeConfigItem::operator==(const CMakeConfigItem &o) const
|
||||
return o.key == key && o.value == value && o.isUnset == isUnset && o.isInitial == isInitial;
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const CMakeConfigItem &it)
|
||||
size_t qHash(const CMakeConfigItem &it)
|
||||
{
|
||||
return ::qHash(it.key) ^ ::qHash(it.value) ^ ::qHash(it.isUnset) ^ ::qHash(it.isInitial);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
QString toCMakeSetLine(const Utils::MacroExpander *expander = nullptr) const;
|
||||
|
||||
bool operator==(const CMakeConfigItem &o) const;
|
||||
friend Utils::QHashValueType qHash(const CMakeConfigItem &it); // needed for MSVC
|
||||
friend size_t qHash(const CMakeConfigItem &it); // needed for MSVC
|
||||
|
||||
QByteArray key;
|
||||
Type type = STRING;
|
||||
|
||||
@@ -164,7 +164,7 @@ bool FancyTabBar::event(QEvent *event)
|
||||
}
|
||||
|
||||
// Resets hover animation on mouse enter
|
||||
void FancyTabBar::enterEvent(EnterEvent *event)
|
||||
void FancyTabBar::enterEvent(QEnterEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
m_hoverRect = QRect();
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
void paintTab(QPainter *painter, int tabIndex) const;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void enterEvent(Utils::EnterEvent *event) override;
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
bool validIndex(int index) const { return index >= 0 && index < m_tabs.count(); }
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ void WelcomePageButton::mousePressEvent(QMouseEvent *)
|
||||
d->onClicked();
|
||||
}
|
||||
|
||||
void WelcomePageButton::enterEvent(EnterEvent *)
|
||||
void WelcomePageButton::enterEvent(QEnterEvent *)
|
||||
{
|
||||
d->doUpdate(true);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
~WelcomePageButton() override;
|
||||
|
||||
void mousePressEvent(QMouseEvent *) override;
|
||||
void enterEvent(Utils::EnterEvent *) override;
|
||||
void enterEvent(QEnterEvent *) override;
|
||||
void leaveEvent(QEvent *) override;
|
||||
|
||||
void setText(const QString &text);
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <QRegularExpression>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
Utils::QHashValueType qHash(const QPointer<QAction> &p, Utils::QHashValueType seed)
|
||||
size_t qHash(const QPointer<QAction> &p, size_t seed)
|
||||
{
|
||||
return qHash(p.data(), seed);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ bool Diagnostic::operator==(const Diagnostic &r) const
|
||||
== std::tie(r.severity, r.message, r.fileName, r.lineNumber);
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const Diagnostic &diagnostic)
|
||||
size_t qHash(const Diagnostic &diagnostic)
|
||||
{
|
||||
return qHash(diagnostic.message) ^ qHash(diagnostic.fileName) ^ diagnostic.lineNumber;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
int lineNumber = 0;
|
||||
};
|
||||
|
||||
Utils::QHashValueType qHash(const Diagnostic &diagnostic);
|
||||
size_t qHash(const Diagnostic &diagnostic);
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Cppcheck
|
||||
|
||||
@@ -456,7 +456,7 @@ public:
|
||||
|
||||
void closeEvent(QCloseEvent *) override { DEBUG("CLOSE DEBUGGERTOOLTIP WIDGET"); }
|
||||
|
||||
void enterEvent(EnterEvent *) override { DEBUG("ENTER DEBUGGERTOOLTIP WIDGET"); }
|
||||
void enterEvent(QEnterEvent *) override { DEBUG("ENTER DEBUGGERTOOLTIP WIDGET"); }
|
||||
|
||||
void leaveEvent(QEvent *) override
|
||||
{
|
||||
|
||||
@@ -560,7 +560,7 @@ QString DiffUtils::makePatch(const QList<FileData> &fileDataList, unsigned forma
|
||||
return diffText;
|
||||
}
|
||||
|
||||
static QList<RowData> readLines(StringView patch, bool lastChunk, bool *lastChunkAtTheEndOfFile, bool *ok)
|
||||
static QList<RowData> readLines(QStringView patch, bool lastChunk, bool *lastChunkAtTheEndOfFile, bool *ok)
|
||||
{
|
||||
QList<Diff> diffList;
|
||||
|
||||
@@ -574,10 +574,10 @@ static QList<RowData> readLines(StringView patch, bool lastChunk, bool *lastChun
|
||||
int noNewLineInDelete = -1;
|
||||
int noNewLineInInsert = -1;
|
||||
|
||||
const QVector<StringView> lines = patch.split(newLine);
|
||||
const QVector<QStringView> lines = patch.split(newLine);
|
||||
int i;
|
||||
for (i = 0; i < lines.size(); i++) {
|
||||
StringView line = lines.at(i);
|
||||
QStringView line = lines.at(i);
|
||||
if (line.isEmpty()) { // need to have at least one character (1 column)
|
||||
if (lastChunk)
|
||||
i = lines.size(); // pretend as we've read all the lines (we just ignore the rest)
|
||||
@@ -730,13 +730,13 @@ static QList<RowData> readLines(StringView patch, bool lastChunk, bool *lastChun
|
||||
outputRightDiffList).rows;
|
||||
}
|
||||
|
||||
static StringView readLine(StringView text, StringView *remainingText, bool *hasNewLine)
|
||||
static QStringView readLine(QStringView text, QStringView *remainingText, bool *hasNewLine)
|
||||
{
|
||||
const QChar newLine('\n');
|
||||
const int indexOfFirstNewLine = text.indexOf(newLine);
|
||||
if (indexOfFirstNewLine < 0) {
|
||||
if (remainingText)
|
||||
*remainingText = StringView();
|
||||
*remainingText = QStringView();
|
||||
if (hasNewLine)
|
||||
*hasNewLine = false;
|
||||
return text;
|
||||
@@ -751,10 +751,10 @@ static StringView readLine(StringView text, StringView *remainingText, bool *has
|
||||
return text.left(indexOfFirstNewLine);
|
||||
}
|
||||
|
||||
static bool detectChunkData(StringView chunkDiff, ChunkData *chunkData, StringView *remainingPatch)
|
||||
static bool detectChunkData(QStringView chunkDiff, ChunkData *chunkData, QStringView *remainingPatch)
|
||||
{
|
||||
bool hasNewLine;
|
||||
const StringView chunkLine = readLine(chunkDiff, remainingPatch, &hasNewLine);
|
||||
const QStringView chunkLine = readLine(chunkDiff, remainingPatch, &hasNewLine);
|
||||
|
||||
const QLatin1String leftPosMarker("@@ -");
|
||||
const QLatin1String rightPosMarker(" +");
|
||||
@@ -774,15 +774,15 @@ static bool detectChunkData(StringView chunkDiff, ChunkData *chunkData, StringVi
|
||||
|
||||
const int leftPosStart = leftPosIndex + leftPosMarker.size();
|
||||
const int leftPosLength = rightPosIndex - leftPosStart;
|
||||
StringView leftPos = chunkLine.mid(leftPosStart, leftPosLength);
|
||||
QStringView leftPos = chunkLine.mid(leftPosStart, leftPosLength);
|
||||
|
||||
const int rightPosStart = rightPosIndex + rightPosMarker.size();
|
||||
const int rightPosLength = optionalHintIndex - rightPosStart;
|
||||
StringView rightPos = chunkLine.mid(rightPosStart, rightPosLength);
|
||||
QStringView rightPos = chunkLine.mid(rightPosStart, rightPosLength);
|
||||
|
||||
const int optionalHintStart = optionalHintIndex + optionalHintMarker.size();
|
||||
const int optionalHintLength = chunkLine.size() - optionalHintStart;
|
||||
const StringView optionalHint = chunkLine.mid(optionalHintStart, optionalHintLength);
|
||||
const QStringView optionalHint = chunkLine.mid(optionalHintStart, optionalHintLength);
|
||||
|
||||
const QChar comma(',');
|
||||
bool ok;
|
||||
@@ -808,7 +808,7 @@ static bool detectChunkData(StringView chunkDiff, ChunkData *chunkData, StringVi
|
||||
return true;
|
||||
}
|
||||
|
||||
static QList<ChunkData> readChunks(StringView patch, bool *lastChunkAtTheEndOfFile, bool *ok)
|
||||
static QList<ChunkData> readChunks(QStringView patch, bool *lastChunkAtTheEndOfFile, bool *ok)
|
||||
{
|
||||
QList<ChunkData> chunkDataList;
|
||||
int position = -1;
|
||||
@@ -834,10 +834,10 @@ static QList<ChunkData> readChunks(StringView patch, bool *lastChunkAtTheEndOfFi
|
||||
: patch.size());
|
||||
|
||||
// extract just one chunk
|
||||
const StringView chunkDiff = patch.mid(chunkStart, chunkEnd - chunkStart);
|
||||
const QStringView chunkDiff = patch.mid(chunkStart, chunkEnd - chunkStart);
|
||||
|
||||
ChunkData chunkData;
|
||||
StringView lines;
|
||||
QStringView lines;
|
||||
readOk = detectChunkData(chunkDiff, &chunkData, &lines);
|
||||
|
||||
if (!readOk)
|
||||
@@ -857,9 +857,9 @@ static QList<ChunkData> readChunks(StringView patch, bool *lastChunkAtTheEndOfFi
|
||||
return chunkDataList;
|
||||
}
|
||||
|
||||
static FileData readDiffHeaderAndChunks(StringView headerAndChunks, bool *ok)
|
||||
static FileData readDiffHeaderAndChunks(QStringView headerAndChunks, bool *ok)
|
||||
{
|
||||
StringView patch = headerAndChunks;
|
||||
QStringView patch = headerAndChunks;
|
||||
FileData fileData;
|
||||
bool readOk = false;
|
||||
|
||||
@@ -911,7 +911,7 @@ static FileData readDiffHeaderAndChunks(StringView headerAndChunks, bool *ok)
|
||||
|
||||
}
|
||||
|
||||
static QList<FileData> readDiffPatch(StringView patch, bool *ok, QFutureInterfaceBase *jobController)
|
||||
static QList<FileData> readDiffPatch(QStringView patch, bool *ok, QFutureInterfaceBase *jobController)
|
||||
{
|
||||
const QRegularExpression diffRegExp("(?:\\n|^)" // new line of the beginning of a patch
|
||||
"(" // either
|
||||
@@ -943,7 +943,7 @@ static QList<FileData> readDiffPatch(StringView patch, bool *ok, QFutureInterfac
|
||||
|
||||
int pos = diffMatch.capturedStart();
|
||||
if (lastPos >= 0) {
|
||||
StringView headerAndChunks = patch.mid(lastPos, pos - lastPos);
|
||||
QStringView headerAndChunks = patch.mid(lastPos, pos - lastPos);
|
||||
|
||||
const FileData fileData = readDiffHeaderAndChunks(headerAndChunks,
|
||||
&readOk);
|
||||
@@ -959,7 +959,7 @@ static QList<FileData> readDiffPatch(StringView patch, bool *ok, QFutureInterfac
|
||||
} while (diffMatch.hasMatch());
|
||||
|
||||
if (readOk) {
|
||||
StringView headerAndChunks = patch.mid(lastPos, patch.size() - lastPos - 1);
|
||||
QStringView headerAndChunks = patch.mid(lastPos, patch.size() - lastPos - 1);
|
||||
|
||||
const FileData fileData = readDiffHeaderAndChunks(headerAndChunks,
|
||||
&readOk);
|
||||
@@ -1009,7 +1009,7 @@ static QList<FileData> readDiffPatch(StringView patch, bool *ok, QFutureInterfac
|
||||
// +++ [rightFileNameOrDevNull]\n
|
||||
// <Chunks>
|
||||
|
||||
static bool detectIndexAndBinary(StringView patch, FileData *fileData, StringView *remainingPatch)
|
||||
static bool detectIndexAndBinary(QStringView patch, FileData *fileData, QStringView *remainingPatch)
|
||||
{
|
||||
bool hasNewLine;
|
||||
*remainingPatch = patch;
|
||||
@@ -1026,14 +1026,14 @@ static bool detectIndexAndBinary(StringView patch, FileData *fileData, StringVie
|
||||
}
|
||||
}
|
||||
|
||||
StringView afterNextLine;
|
||||
QStringView afterNextLine;
|
||||
// index [leftIndexSha]..[rightIndexSha] <optionally: octalNumber>
|
||||
const StringView nextLine = readLine(patch, &afterNextLine, &hasNewLine);
|
||||
const QStringView nextLine = readLine(patch, &afterNextLine, &hasNewLine);
|
||||
|
||||
const QLatin1String indexHeader("index ");
|
||||
|
||||
if (nextLine.startsWith(indexHeader)) {
|
||||
const StringView indices = nextLine.mid(indexHeader.size());
|
||||
const QStringView indices = nextLine.mid(indexHeader.size());
|
||||
const int dotsPosition = indices.indexOf(QStringLiteral(".."));
|
||||
if (dotsPosition < 0)
|
||||
return false;
|
||||
@@ -1069,14 +1069,14 @@ static bool detectIndexAndBinary(StringView patch, FileData *fileData, StringVie
|
||||
|
||||
if (*remainingPatch == binaryLine) {
|
||||
fileData->binaryFiles = true;
|
||||
*remainingPatch = StringView();
|
||||
*remainingPatch = QStringView();
|
||||
return true;
|
||||
}
|
||||
|
||||
const QString leftStart = "--- " + leftFileName;
|
||||
StringView afterMinuses;
|
||||
QStringView afterMinuses;
|
||||
// --- leftFileName
|
||||
const StringView minuses = readLine(*remainingPatch, &afterMinuses, &hasNewLine);
|
||||
const QStringView minuses = readLine(*remainingPatch, &afterMinuses, &hasNewLine);
|
||||
if (!hasNewLine)
|
||||
return false; // we need to have at least one more line
|
||||
|
||||
@@ -1084,9 +1084,9 @@ static bool detectIndexAndBinary(StringView patch, FileData *fileData, StringVie
|
||||
return false;
|
||||
|
||||
const QString rightStart = "+++ " + rightFileName;
|
||||
StringView afterPluses;
|
||||
QStringView afterPluses;
|
||||
// +++ rightFileName
|
||||
const StringView pluses = readLine(afterMinuses, &afterPluses, &hasNewLine);
|
||||
const QStringView pluses = readLine(afterMinuses, &afterPluses, &hasNewLine);
|
||||
if (!hasNewLine)
|
||||
return false; // we need to have at least one more line
|
||||
|
||||
@@ -1097,7 +1097,7 @@ static bool detectIndexAndBinary(StringView patch, FileData *fileData, StringVie
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool extractCommonFileName(StringView fileNames, StringView *fileName)
|
||||
static bool extractCommonFileName(QStringView fileNames, QStringView *fileName)
|
||||
{
|
||||
// we should have 1 space between filenames
|
||||
if (fileNames.size() % 2 == 0)
|
||||
@@ -1112,10 +1112,10 @@ static bool extractCommonFileName(StringView fileNames, StringView *fileName)
|
||||
return false;
|
||||
|
||||
// drop "a/"
|
||||
const StringView leftFileName = fileNames.mid(2, fileNameSize - 2);
|
||||
const QStringView leftFileName = fileNames.mid(2, fileNameSize - 2);
|
||||
|
||||
// drop the first filename + " b/"
|
||||
const StringView rightFileName = fileNames.mid(fileNameSize + 3, fileNameSize - 2);
|
||||
const QStringView rightFileName = fileNames.mid(fileNameSize + 3, fileNameSize - 2);
|
||||
|
||||
if (leftFileName != rightFileName)
|
||||
return false;
|
||||
@@ -1124,27 +1124,27 @@ static bool extractCommonFileName(StringView fileNames, StringView *fileName)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool detectFileData(StringView patch, FileData *fileData, StringView *remainingPatch)
|
||||
static bool detectFileData(QStringView patch, FileData *fileData, QStringView *remainingPatch)
|
||||
{
|
||||
bool hasNewLine;
|
||||
|
||||
StringView afterDiffGit;
|
||||
QStringView afterDiffGit;
|
||||
// diff --git a/leftFileName b/rightFileName
|
||||
const StringView diffGit = readLine(patch, &afterDiffGit, &hasNewLine);
|
||||
const QStringView diffGit = readLine(patch, &afterDiffGit, &hasNewLine);
|
||||
if (!hasNewLine)
|
||||
return false; // we need to have at least one more line
|
||||
|
||||
const QLatin1String gitHeader("diff --git ");
|
||||
const StringView fileNames = diffGit.mid(gitHeader.size());
|
||||
StringView commonFileName;
|
||||
const QStringView fileNames = diffGit.mid(gitHeader.size());
|
||||
QStringView commonFileName;
|
||||
if (extractCommonFileName(fileNames, &commonFileName)) {
|
||||
// change / new / delete
|
||||
|
||||
fileData->fileOperation = FileData::ChangeFile;
|
||||
fileData->leftFileInfo.fileName = fileData->rightFileInfo.fileName = commonFileName.toString();
|
||||
|
||||
StringView afterSecondLine;
|
||||
const StringView secondLine = readLine(afterDiffGit, &afterSecondLine, &hasNewLine);
|
||||
QStringView afterSecondLine;
|
||||
const QStringView secondLine = readLine(afterDiffGit, &afterSecondLine, &hasNewLine);
|
||||
|
||||
if (secondLine.startsWith(QStringLiteral("new file mode "))) {
|
||||
fileData->fileOperation = FileData::NewFile;
|
||||
@@ -1153,7 +1153,7 @@ static bool detectFileData(StringView patch, FileData *fileData, StringView *rem
|
||||
fileData->fileOperation = FileData::DeleteFile;
|
||||
*remainingPatch = afterSecondLine;
|
||||
} else if (secondLine.startsWith(QStringLiteral("old mode "))) {
|
||||
StringView afterThirdLine;
|
||||
QStringView afterThirdLine;
|
||||
// new mode
|
||||
readLine(afterSecondLine, &afterThirdLine, &hasNewLine);
|
||||
if (!hasNewLine)
|
||||
@@ -1167,9 +1167,9 @@ static bool detectFileData(StringView patch, FileData *fileData, StringView *rem
|
||||
|
||||
} else {
|
||||
// copy / rename
|
||||
StringView afterModeOrSimilarity;
|
||||
StringView afterSimilarity;
|
||||
const StringView secondLine = readLine(afterDiffGit, &afterModeOrSimilarity, &hasNewLine);
|
||||
QStringView afterModeOrSimilarity;
|
||||
QStringView afterSimilarity;
|
||||
const QStringView secondLine = readLine(afterDiffGit, &afterModeOrSimilarity, &hasNewLine);
|
||||
if (secondLine.startsWith(QLatin1String("old mode "))) {
|
||||
if (!hasNewLine)
|
||||
return false;
|
||||
@@ -1187,9 +1187,9 @@ static bool detectFileData(StringView patch, FileData *fileData, StringView *rem
|
||||
|
||||
// TODO: validate similarity line
|
||||
|
||||
StringView afterCopyRenameFrom;
|
||||
QStringView afterCopyRenameFrom;
|
||||
// [copy / rename] from leftFileName
|
||||
const StringView copyRenameFrom = readLine(afterSimilarity, &afterCopyRenameFrom, &hasNewLine);
|
||||
const QStringView copyRenameFrom = readLine(afterSimilarity, &afterCopyRenameFrom, &hasNewLine);
|
||||
if (!hasNewLine)
|
||||
return false; // we need to have at least one more line
|
||||
|
||||
@@ -1205,9 +1205,9 @@ static bool detectFileData(StringView patch, FileData *fileData, StringView *rem
|
||||
return false;
|
||||
}
|
||||
|
||||
StringView afterCopyRenameTo;
|
||||
QStringView afterCopyRenameTo;
|
||||
// [copy / rename] to rightFileName
|
||||
const StringView copyRenameTo = readLine(afterCopyRenameFrom, &afterCopyRenameTo, &hasNewLine);
|
||||
const QStringView copyRenameTo = readLine(afterCopyRenameFrom, &afterCopyRenameTo, &hasNewLine);
|
||||
|
||||
// if (dis)similarity index is 100% we don't have more lines
|
||||
|
||||
@@ -1226,7 +1226,7 @@ static bool detectFileData(StringView patch, FileData *fileData, StringView *rem
|
||||
return detectIndexAndBinary(*remainingPatch, fileData, remainingPatch);
|
||||
}
|
||||
|
||||
static QList<FileData> readGitPatch(StringView patch, bool *ok, QFutureInterfaceBase *jobController)
|
||||
static QList<FileData> readGitPatch(QStringView patch, bool *ok, QFutureInterfaceBase *jobController)
|
||||
{
|
||||
int position = -1;
|
||||
|
||||
@@ -1239,7 +1239,7 @@ static QList<FileData> readGitPatch(StringView patch, bool *ok, QFutureInterface
|
||||
|
||||
class PatchInfo {
|
||||
public:
|
||||
StringView patch;
|
||||
QStringView patch;
|
||||
FileData fileData;
|
||||
};
|
||||
|
||||
@@ -1261,10 +1261,10 @@ static QList<FileData> readGitPatch(StringView patch, bool *ok, QFutureInterface
|
||||
: patch.size());
|
||||
|
||||
// extract the patch for just one file
|
||||
const StringView fileDiff = patch.mid(diffStart, diffEnd - diffStart);
|
||||
const QStringView fileDiff = patch.mid(diffStart, diffEnd - diffStart);
|
||||
|
||||
FileData fileData;
|
||||
StringView remainingFileDiff;
|
||||
QStringView remainingFileDiff;
|
||||
readOk = detectFileData(fileDiff, &fileData, &remainingFileDiff);
|
||||
|
||||
if (!readOk)
|
||||
@@ -1324,7 +1324,7 @@ QList<FileData> DiffUtils::readPatch(const QString &patch, bool *ok,
|
||||
jobController->setProgressRange(0, 1);
|
||||
jobController->setProgressValue(0);
|
||||
}
|
||||
StringView croppedPatch = make_stringview(patch);
|
||||
QStringView croppedPatch = QStringView(patch);
|
||||
// Crop e.g. "-- \n2.10.2.windows.1\n\n" at end of file
|
||||
const QRegularExpression formatPatchEndingRegExp("(\\n-- \\n\\S*\\n\\n$)");
|
||||
const QRegularExpressionMatch match = formatPatchEndingRegExp.match(croppedPatch);
|
||||
|
||||
@@ -294,7 +294,7 @@ QString SideDiffEditorWidget::plainTextFromSelection(const QTextCursor &cursor)
|
||||
if (textInserted)
|
||||
text += '\n';
|
||||
if (block == endBlock)
|
||||
text += make_stringview(block.text()).left(endPosition - block.position());
|
||||
text += QStringView(block.text()).left(endPosition - block.position());
|
||||
else
|
||||
text += block.text();
|
||||
}
|
||||
|
||||
@@ -159,12 +159,12 @@ bool XcodePlatform::operator==(const XcodePlatform &other) const
|
||||
return developerPath == other.developerPath;
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const XcodePlatform &platform)
|
||||
size_t qHash(const XcodePlatform &platform)
|
||||
{
|
||||
return qHash(platform.developerPath);
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const XcodePlatform::ToolchainTarget &target)
|
||||
size_t qHash(const XcodePlatform::ToolchainTarget &target)
|
||||
{
|
||||
return qHash(target.name);
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ public:
|
||||
bool operator==(const XcodePlatform &other) const;
|
||||
};
|
||||
|
||||
Utils::QHashValueType qHash(const XcodePlatform &platform);
|
||||
Utils::QHashValueType qHash(const XcodePlatform::ToolchainTarget &target);
|
||||
size_t qHash(const XcodePlatform &platform);
|
||||
size_t qHash(const XcodePlatform::ToolchainTarget &target);
|
||||
|
||||
class XcodeProbe
|
||||
{
|
||||
|
||||
@@ -120,7 +120,7 @@ void DragTool::paintEvent(QPaintEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void DragTool::enterEvent(Utils::EnterEvent *event)
|
||||
void DragTool::enterEvent(QEnterEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
update();
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void enterEvent(Utils::EnterEvent *event) override;
|
||||
void enterEvent(QEnterEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Internal {
|
||||
|
||||
class ModelIndexer::QueuedFile
|
||||
{
|
||||
friend Utils::QHashValueType qHash(const ModelIndexer::QueuedFile &queuedFile);
|
||||
friend size_t qHash(const ModelIndexer::QueuedFile &queuedFile);
|
||||
friend bool operator==(const ModelIndexer::QueuedFile &lhs,
|
||||
const ModelIndexer::QueuedFile &rhs);
|
||||
|
||||
@@ -99,7 +99,7 @@ bool operator==(const ModelIndexer::QueuedFile &lhs, const ModelIndexer::QueuedF
|
||||
return lhs.m_file == rhs.m_file && lhs.m_project == rhs.m_project;
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const ModelIndexer::QueuedFile &queuedFile)
|
||||
size_t qHash(const ModelIndexer::QueuedFile &queuedFile)
|
||||
{
|
||||
return qHash(queuedFile.m_project) + qHash(queuedFile.m_project);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class ModelIndexer :
|
||||
class DiagramsCollectorVisitor;
|
||||
class ModelIndexerPrivate;
|
||||
|
||||
friend Utils::QHashValueType qHash(const ModelIndexer::QueuedFile &queuedFile);
|
||||
friend size_t qHash(const ModelIndexer::QueuedFile &queuedFile);
|
||||
friend bool operator==(const ModelIndexer::QueuedFile &lhs,
|
||||
const ModelIndexer::QueuedFile &rhs);
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
bool isQtcRunnable = true;
|
||||
bool usesTerminal = false;
|
||||
|
||||
Utils::QHashValueType runEnvModifierHash = 0; // Make sure to update this when runEnvModifier changes!
|
||||
size_t runEnvModifierHash = 0; // Make sure to update this when runEnvModifier changes!
|
||||
|
||||
std::function<void(Utils::Environment &, bool)> runEnvModifier;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ bool DeployableFile::isExecutable() const
|
||||
return m_type == TypeExecutable;
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const DeployableFile &d)
|
||||
size_t qHash(const DeployableFile &d)
|
||||
{
|
||||
return qHash(qMakePair(d.localFilePath().toString(), d.remoteDirectory()));
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
{
|
||||
return !(d1 == d2);
|
||||
}
|
||||
friend PROJECTEXPLORER_EXPORT Utils::QHashValueType qHash(const DeployableFile &d);
|
||||
friend PROJECTEXPLORER_EXPORT size_t qHash(const DeployableFile &d);
|
||||
|
||||
private:
|
||||
Utils::FilePath m_localFilePath;
|
||||
|
||||
@@ -50,7 +50,7 @@ QVariant ExpandData::toSettings() const
|
||||
return QVariant::fromValue(QStringList({path, displayName}));
|
||||
}
|
||||
|
||||
Utils::QHashValueType ProjectExplorer::Internal::qHash(const ExpandData &data)
|
||||
size_t ProjectExplorer::Internal::qHash(const ExpandData &data)
|
||||
{
|
||||
return qHash(data.path) ^ qHash(data.displayName);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
QString displayName;
|
||||
};
|
||||
|
||||
Utils::QHashValueType qHash(const ExpandData &data);
|
||||
size_t qHash(const ExpandData &data);
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -171,7 +171,7 @@ bool operator<(const Task &a, const Task &b)
|
||||
}
|
||||
|
||||
|
||||
Utils::QHashValueType qHash(const Task &task)
|
||||
size_t qHash(const Task &task)
|
||||
{
|
||||
return task.taskId;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
|
||||
friend PROJECTEXPLORER_EXPORT bool operator==(const Task &t1, const Task &t2);
|
||||
friend PROJECTEXPLORER_EXPORT bool operator<(const Task &a, const Task &b);
|
||||
friend PROJECTEXPLORER_EXPORT Utils::QHashValueType qHash(const Task &task);
|
||||
friend PROJECTEXPLORER_EXPORT size_t qHash(const Task &task);
|
||||
|
||||
unsigned int taskId = 0;
|
||||
TaskType type = Unknown;
|
||||
|
||||
@@ -69,8 +69,8 @@ namespace QmakeProjectManager {
|
||||
|
||||
static Q_LOGGING_CATEGORY(qmakeParse, "qtc.qmake.parsing", QtWarningMsg);
|
||||
|
||||
Utils::QHashValueType qHash(Variable key, uint seed) { return ::qHash(static_cast<int>(key), seed); }
|
||||
Utils::QHashValueType qHash(FileOrigin fo) { return ::qHash(int(fo)); }
|
||||
size_t qHash(Variable key, uint seed) { return ::qHash(static_cast<int>(key), seed); }
|
||||
size_t qHash(FileOrigin fo) { return ::qHash(int(fo)); }
|
||||
|
||||
namespace Internal {
|
||||
|
||||
@@ -781,7 +781,7 @@ QPair<ProFile *, QStringList> QmakePriFile::readProFile()
|
||||
QMakeVfs vfs;
|
||||
QtSupport::ProMessageHandler handler;
|
||||
QMakeParser parser(nullptr, &vfs, &handler);
|
||||
includeFile = parser.parsedProBlock(Utils::make_stringview(contents),
|
||||
includeFile = parser.parsedProBlock(QStringView(contents),
|
||||
0,
|
||||
filePath().toString(),
|
||||
1);
|
||||
@@ -828,7 +828,7 @@ bool QmakePriFile::renameFile(const FilePath &oldFilePath, const FilePath &newFi
|
||||
|
||||
// Reparse necessary due to changed contents.
|
||||
QMakeParser parser(nullptr, nullptr, nullptr);
|
||||
ProFile *const proFile = parser.parsedProBlock(Utils::make_stringview(currentContents),
|
||||
ProFile *const proFile = parser.parsedProBlock(QStringView(currentContents),
|
||||
0,
|
||||
filePath().toString(),
|
||||
1,
|
||||
|
||||
@@ -110,7 +110,7 @@ enum class Variable {
|
||||
QmakeCc,
|
||||
QmakeCxx
|
||||
};
|
||||
Utils::QHashValueType qHash(Variable key, uint seed = 0);
|
||||
size_t qHash(Variable key, uint seed = 0);
|
||||
|
||||
namespace Internal {
|
||||
Q_DECLARE_LOGGING_CATEGORY(qmakeNodesLog)
|
||||
@@ -123,7 +123,7 @@ class QmakePriFileEvalResult;
|
||||
class InstallsList;
|
||||
|
||||
enum class FileOrigin { ExactParse, CumulativeParse };
|
||||
Utils::QHashValueType qHash(FileOrigin fo);
|
||||
size_t qHash(FileOrigin fo);
|
||||
using SourceFile = QPair<Utils::FilePath, FileOrigin>;
|
||||
using SourceFiles = QSet<SourceFile>;
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
QStringList m_importPathList;
|
||||
};
|
||||
|
||||
QMLDESIGNERCORE_EXPORT Utils::QHashValueType qHash(const Import &import);
|
||||
QMLDESIGNERCORE_EXPORT size_t qHash(const Import &import);
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ int Import::majorFromVersion(const QString &version)
|
||||
return version.split('.').first().toInt();
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const Import &import)
|
||||
size_t qHash(const Import &import)
|
||||
{
|
||||
return ::qHash(import.url()) ^ ::qHash(import.file()) ^ ::qHash(import.version()) ^ ::qHash(import.alias());
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ bool InternalNode::hasId() const
|
||||
}
|
||||
|
||||
|
||||
Utils::QHashValueType qHash(const InternalNodePointer& node)
|
||||
size_t qHash(const InternalNodePointer& node)
|
||||
{
|
||||
if (node.isNull())
|
||||
return ::qHash(-1);
|
||||
|
||||
@@ -153,7 +153,7 @@ private:
|
||||
int m_nodeSourceType = 0;
|
||||
};
|
||||
|
||||
Utils::QHashValueType qHash(const InternalNodePointer& node);
|
||||
size_t qHash(const InternalNodePointer& node);
|
||||
bool operator <(const InternalNodePointer &firstNode, const InternalNodePointer &secondNode);
|
||||
} // Internal
|
||||
} // QtQmlDesigner
|
||||
|
||||
@@ -73,7 +73,7 @@ void ColorThemeItem::openColorDialog()
|
||||
}
|
||||
}
|
||||
|
||||
void ColorThemeItem::enterEvent(Utils::EnterEvent *e)
|
||||
void ColorThemeItem::enterEvent(QEnterEvent *e)
|
||||
{
|
||||
m_pen.setWidth(isEnabled() ? 3 : 1);
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ signals:
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void enterEvent(Utils::EnterEvent *e) override;
|
||||
void enterEvent(QEnterEvent *e) override;
|
||||
void leaveEvent(QEvent *e) override;
|
||||
void mousePressEvent(QMouseEvent *e) override;
|
||||
|
||||
|
||||
@@ -8622,7 +8622,7 @@ IEditor *BaseTextEditor::duplicate()
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Utils::QHashValueType qHash(const QColor &color)
|
||||
size_t qHash(const QColor &color)
|
||||
{
|
||||
return color.rgba();
|
||||
}
|
||||
|
||||
@@ -690,6 +690,6 @@ private:
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Utils::QHashValueType qHash(const QColor &color);
|
||||
size_t qHash(const QColor &color);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -1576,7 +1576,7 @@ QSet<QString> VcsBaseEditorWidget::annotationChanges() const
|
||||
{
|
||||
QSet<QString> changes;
|
||||
const QString text = toPlainText();
|
||||
StringView txt = make_stringview(text);
|
||||
QStringView txt = QStringView(text);
|
||||
if (txt.isEmpty())
|
||||
return changes;
|
||||
if (!d->m_annotationSeparatorPattern.pattern().isEmpty()) {
|
||||
|
||||
@@ -215,7 +215,7 @@ ProFileEvaluator::TemplateType ProFileEvaluator::templateType() const
|
||||
if (!t.compare(QLatin1String("app"), Qt::CaseInsensitive))
|
||||
return TT_Application;
|
||||
if (!t.compare(QLatin1String("lib"), Qt::CaseInsensitive))
|
||||
return d->isActiveConfig(Utils::make_stringview(str_staticlib)) ? TT_StaticLibrary : TT_SharedLibrary;
|
||||
return d->isActiveConfig(QStringView(str_staticlib)) ? TT_StaticLibrary : TT_SharedLibrary;
|
||||
if (!t.compare(QLatin1String("script"), Qt::CaseInsensitive))
|
||||
return TT_Script;
|
||||
if (!t.compare(QLatin1String("aux"), Qt::CaseInsensitive))
|
||||
@@ -249,7 +249,7 @@ bool ProFileEvaluator::accept(ProFile *pro, QMakeEvaluator::LoadFlags flags)
|
||||
|
||||
ProStringList &incpath = d->valuesRef(ProKey("INCLUDEPATH"));
|
||||
incpath += d->values(ProKey("QMAKE_INCDIR"));
|
||||
if (!d->isActiveConfig(Utils::make_stringview(str_no_include_pwd))) {
|
||||
if (!d->isActiveConfig(QStringView(str_no_include_pwd))) {
|
||||
incpath.prepend(ProString(pro->directoryName()));
|
||||
// It's pretty stupid that this is appended - it should be the second entry.
|
||||
if (pro->directoryName() != d->m_outputDir)
|
||||
@@ -266,8 +266,8 @@ bool ProFileEvaluator::accept(ProFile *pro, QMakeEvaluator::LoadFlags flags)
|
||||
break;
|
||||
case TT_SharedLibrary:
|
||||
{
|
||||
bool plugin = d->isActiveConfig(Utils::make_stringview(str_plugin));
|
||||
if (!plugin || !d->isActiveConfig(Utils::make_stringview(str_plugin_no_share_shlib_cflags)))
|
||||
bool plugin = d->isActiveConfig(QStringView(str_plugin));
|
||||
if (!plugin || !d->isActiveConfig(QStringView(str_plugin_no_share_shlib_cflags)))
|
||||
cxxflags += d->values(ProKey("QMAKE_CXXFLAGS_SHLIB"));
|
||||
if (plugin)
|
||||
cxxflags += d->values(ProKey("QMAKE_CXXFLAGS_PLUGIN"));
|
||||
|
||||
@@ -72,7 +72,7 @@ ProString::ProString(const QString &str) :
|
||||
{
|
||||
}
|
||||
|
||||
ProString::ProString(Utils::StringView str) :
|
||||
ProString::ProString(QStringView str) :
|
||||
m_string(str.toString()), m_offset(0), m_length(str.size()), m_file(0), m_hash(0x80000000)
|
||||
{
|
||||
}
|
||||
@@ -114,7 +114,7 @@ uint ProString::updatedHash() const
|
||||
return (m_hash = hash(m_string.constData() + m_offset, m_length));
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const ProString &str)
|
||||
size_t qHash(const ProString &str)
|
||||
{
|
||||
if (!(str.m_hash & 0x80000000))
|
||||
return str.m_hash;
|
||||
@@ -449,7 +449,7 @@ bool ProStringList::contains(const ProString &str, Qt::CaseSensitivity cs) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ProStringList::contains(Utils::StringView str, Qt::CaseSensitivity cs) const
|
||||
bool ProStringList::contains(QStringView str, Qt::CaseSensitivity cs) const
|
||||
{
|
||||
for (int i = 0; i < size(); i++)
|
||||
if (!at(i).toStringView().compare(str, cs))
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include <qvector.h>
|
||||
#include <qhash.h>
|
||||
|
||||
#include <utils/porting.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QTextStream;
|
||||
@@ -70,7 +68,7 @@ public:
|
||||
ProString &operator=(const QStringBuilder<A, B> &str)
|
||||
{ return *this = QString(str); }
|
||||
ProString(const QString &str);
|
||||
PROITEM_EXPLICIT ProString(Utils::StringView str);
|
||||
PROITEM_EXPLICIT ProString(QStringView str);
|
||||
PROITEM_EXPLICIT ProString(const char *str);
|
||||
template<typename A, typename B>
|
||||
ProString(const QStringBuilder<A, B> &str)
|
||||
@@ -105,7 +103,7 @@ public:
|
||||
|
||||
bool operator==(const ProString &other) const { return toStringView() == other.toStringView(); }
|
||||
bool operator==(const QString &other) const { return toStringView() == other; }
|
||||
bool operator==(Utils::StringView other) const { return toStringView() == other; }
|
||||
bool operator==(QStringView other) const { return toStringView() == other; }
|
||||
bool operator==(QLatin1String other) const { return toStringView() == other; }
|
||||
bool operator==(const char *other) const { return toStringView() == QLatin1String(other); }
|
||||
bool operator!=(const ProString &other) const { return !(*this == other); }
|
||||
@@ -154,7 +152,7 @@ public:
|
||||
uint hash() const { return m_hash; }
|
||||
static uint hash(const QChar *p, int n);
|
||||
|
||||
ALWAYS_INLINE Utils::StringView toStringView() const { return Utils::make_stringview(m_string).mid(m_offset, m_length); }
|
||||
ALWAYS_INLINE QStringView toStringView() const { return QStringView(m_string).mid(m_offset, m_length); }
|
||||
|
||||
ALWAYS_INLINE ProKey &toKey() { return *(ProKey *)this; }
|
||||
ALWAYS_INLINE const ProKey &toKey() const { return *(const ProKey *)this; }
|
||||
@@ -184,7 +182,7 @@ private:
|
||||
int m_file;
|
||||
mutable uint m_hash;
|
||||
uint updatedHash() const;
|
||||
friend Utils::QHashValueType qHash(const ProString &str);
|
||||
friend size_t qHash(const ProString &str);
|
||||
friend QString operator+(const ProString &one, const ProString &two);
|
||||
friend class ProKey;
|
||||
};
|
||||
@@ -255,7 +253,7 @@ template <> struct QConcatenable<ProKey> : private QAbstractConcatenable
|
||||
};
|
||||
|
||||
|
||||
Utils::QHashValueType qHash(const ProString &str);
|
||||
size_t qHash(const ProString &str);
|
||||
|
||||
inline QString &operator+=(QString &that, const ProString &other)
|
||||
{ return that += other.toStringView(); }
|
||||
@@ -340,7 +338,7 @@ public:
|
||||
void removeDuplicates();
|
||||
|
||||
bool contains(const ProString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
bool contains(Utils::StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
bool contains(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
|
||||
{ return contains(ProString(str), cs); }
|
||||
bool contains(const char *str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
|
||||
@@ -181,7 +181,7 @@ QString ProWriter::compileScope(const QString &scope)
|
||||
if (scope.isEmpty())
|
||||
return QString();
|
||||
QMakeParser parser(nullptr, nullptr, nullptr);
|
||||
ProFile *includeFile = parser.parsedProBlock(Utils::make_stringview(scope), 0, "no-file", 1);
|
||||
ProFile *includeFile = parser.parsedProBlock(QStringView(scope), 0, "no-file", 1);
|
||||
if (!includeFile)
|
||||
return QString();
|
||||
const QString result = includeFile->items();
|
||||
|
||||
@@ -885,7 +885,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
|
||||
ret += ProString(stream.readLine());
|
||||
} else {
|
||||
const QString &line = stream.readLine();
|
||||
ret += split_value_list(Utils::make_stringview(line).trimmed());
|
||||
ret += split_value_list(QStringView(line).trimmed());
|
||||
if (!singleLine)
|
||||
ret += ProString("\n");
|
||||
}
|
||||
@@ -972,7 +972,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
|
||||
output.replace(QLatin1Char('\t'), QLatin1Char(' '));
|
||||
if (singleLine)
|
||||
output.replace(QLatin1Char('\n'), QLatin1Char(' '));
|
||||
ret += split_value_list(Utils::make_stringview(output));
|
||||
ret += split_value_list(QStringView(output));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1145,7 +1145,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
|
||||
evalError(fL1S("Unexpected EOF."));
|
||||
return ReturnError;
|
||||
}
|
||||
ret = split_value_list(Utils::make_stringview(line));
|
||||
ret = split_value_list(QStringView(line));
|
||||
}
|
||||
}
|
||||
break; }
|
||||
@@ -1503,7 +1503,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
|
||||
case T_EVAL: {
|
||||
VisitReturn ret = ReturnFalse;
|
||||
QString contents = args.join(statics.field_sep);
|
||||
ProFile *pro = m_parser->parsedProBlock(Utils::make_stringview(contents),
|
||||
ProFile *pro = m_parser->parsedProBlock(QStringView(contents),
|
||||
0, m_current.pro->fileName(), m_current.line);
|
||||
if (m_cumulative || pro->isOk()) {
|
||||
m_locationStack.push(m_current);
|
||||
|
||||
@@ -104,7 +104,7 @@ QMakeBaseKey::QMakeBaseKey(const QString &_root, const QString &_stash, bool _ho
|
||||
{
|
||||
}
|
||||
|
||||
Utils::QHashValueType qHash(const QMakeBaseKey &key)
|
||||
size_t qHash(const QMakeBaseKey &key)
|
||||
{
|
||||
return qHash(key.root) ^ qHash(key.stash) ^ (uint)key.hostBuild;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ void QMakeEvaluator::skipHashStr(const ushort *&tokPtr)
|
||||
|
||||
// FIXME: this should not build new strings for direct sections.
|
||||
// Note that the E_SPRINTF and E_LIST implementations rely on the deep copy.
|
||||
ProStringList QMakeEvaluator::split_value_list(Utils::StringView vals, int source)
|
||||
ProStringList QMakeEvaluator::split_value_list(QStringView vals, int source)
|
||||
{
|
||||
QString build;
|
||||
ProStringList ret;
|
||||
@@ -1310,7 +1310,7 @@ void QMakeEvaluator::setupProject()
|
||||
void QMakeEvaluator::evaluateCommand(const QString &cmds, const QString &where)
|
||||
{
|
||||
if (!cmds.isEmpty()) {
|
||||
ProFile *pro = m_parser->parsedProBlock(Utils::make_stringview(cmds), 0, where, -1);
|
||||
ProFile *pro = m_parser->parsedProBlock(QStringView(cmds), 0, where, -1);
|
||||
if (pro->isOk()) {
|
||||
m_locationStack.push(m_current);
|
||||
visitProBlock(pro, pro->tokPtr());
|
||||
@@ -1618,7 +1618,7 @@ QString QMakeEvaluator::currentDirectory() const
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool QMakeEvaluator::isActiveConfig(Utils::StringView config, bool regex)
|
||||
bool QMakeEvaluator::isActiveConfig(QStringView config, bool regex)
|
||||
{
|
||||
// magic types for easy flipping
|
||||
if (config == statics.strtrue)
|
||||
@@ -1812,7 +1812,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateExpandFunction(
|
||||
}
|
||||
|
||||
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditional(
|
||||
Utils::StringView cond, const QString &where, int line)
|
||||
QStringView cond, const QString &where, int line)
|
||||
{
|
||||
VisitReturn ret = ReturnFalse;
|
||||
ProFile *pro = m_parser->parsedProBlock(cond, 0, where, line, QMakeParser::TestGrammar);
|
||||
|
||||
@@ -174,7 +174,7 @@ public:
|
||||
|
||||
void setTemplate();
|
||||
|
||||
ProStringList split_value_list(Utils::StringView vals, int source = 0);
|
||||
ProStringList split_value_list(QStringView vals, int source = 0);
|
||||
VisitReturn expandVariableReferences(const ushort *&tokPtr, int sizeHint, ProStringList *ret, bool joined);
|
||||
|
||||
QString currentFileName() const;
|
||||
@@ -214,7 +214,7 @@ public:
|
||||
VisitReturn evaluateBuiltinExpand(int func_t, const ProKey &function, const ProStringList &args, ProStringList &ret);
|
||||
VisitReturn evaluateBuiltinConditional(int func_t, const ProKey &function, const ProStringList &args);
|
||||
|
||||
VisitReturn evaluateConditional(Utils::StringView cond, const QString &where, int line = -1);
|
||||
VisitReturn evaluateConditional(QStringView cond, const QString &where, int line = -1);
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
VisitReturn checkRequirements(const ProStringList &deps);
|
||||
#endif
|
||||
@@ -222,7 +222,7 @@ public:
|
||||
void updateMkspecPaths();
|
||||
void updateFeaturePaths();
|
||||
|
||||
bool isActiveConfig(Utils::StringView config, bool regex = false);
|
||||
bool isActiveConfig(QStringView config, bool regex = false);
|
||||
|
||||
void populateDeps(
|
||||
const ProStringList &deps, const ProString &prefix, const ProStringList &suffixes,
|
||||
|
||||
@@ -54,7 +54,7 @@ class QMakeBaseKey
|
||||
public:
|
||||
QMakeBaseKey(const QString &_root, const QString &_stash, bool _hostBuild);
|
||||
|
||||
friend Utils::QHashValueType qHash(const QMakeBaseKey &key);
|
||||
friend size_t qHash(const QMakeBaseKey &key);
|
||||
friend bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two);
|
||||
|
||||
QString root;
|
||||
|
||||
@@ -282,7 +282,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
|
||||
#endif
|
||||
QString contents;
|
||||
if (readFile(id, flags, &contents)) {
|
||||
pro = parsedProBlock(Utils::make_stringview(contents), id, fileName, 1, FullGrammar);
|
||||
pro = parsedProBlock(QStringView(contents), id, fileName, 1, FullGrammar);
|
||||
pro->itemsRef()->squeeze();
|
||||
pro->ref();
|
||||
} else {
|
||||
@@ -309,7 +309,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
|
||||
} else {
|
||||
QString contents;
|
||||
if (readFile(id, flags, &contents))
|
||||
pro = parsedProBlock(Utils::make_stringview(contents), id, fileName, 1, FullGrammar);
|
||||
pro = parsedProBlock(QStringView(contents), id, fileName, 1, FullGrammar);
|
||||
else
|
||||
pro = 0;
|
||||
}
|
||||
@@ -317,7 +317,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
|
||||
}
|
||||
|
||||
ProFile *QMakeParser::parsedProBlock(
|
||||
Utils::StringView contents, int id, const QString &name, int line, SubGrammar grammar)
|
||||
QStringView contents, int id, const QString &name, int line, SubGrammar grammar)
|
||||
{
|
||||
ProFile *pro = new ProFile(id, name);
|
||||
read(pro, contents, line, grammar);
|
||||
@@ -381,7 +381,7 @@ void QMakeParser::finalizeHashStr(ushort *buf, uint len)
|
||||
buf[-2] = (ushort)(hash >> 16);
|
||||
}
|
||||
|
||||
void QMakeParser::read(ProFile *pro, Utils::StringView in, int line, SubGrammar grammar)
|
||||
void QMakeParser::read(ProFile *pro, QStringView in, int line, SubGrammar grammar)
|
||||
{
|
||||
m_proFile = pro;
|
||||
m_lineNo = line;
|
||||
@@ -1331,7 +1331,7 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg
|
||||
bool QMakeParser::resolveVariable(ushort *xprPtr, int tlen, int needSep, ushort **ptr,
|
||||
ushort **buf, QString *xprBuff,
|
||||
ushort **tokPtr, QString *tokBuff,
|
||||
const ushort *cur, Utils::StringView in)
|
||||
const ushort *cur, QStringView in)
|
||||
{
|
||||
QString out;
|
||||
m_tmp.setRawData((const QChar *)xprPtr, tlen);
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
enum SubGrammar { FullGrammar, TestGrammar, ValueGrammar };
|
||||
// fileName is expected to be absolute and cleanPath()ed.
|
||||
ProFile *parsedProFile(const QString &fileName, ParseFlags flags = ParseDefault);
|
||||
ProFile *parsedProBlock(Utils::StringView contents, int id, const QString &name, int line = 0,
|
||||
ProFile *parsedProBlock(QStringView contents, int id, const QString &name, int line = 0,
|
||||
SubGrammar grammar = FullGrammar);
|
||||
|
||||
void discardFileFromCache(int id);
|
||||
@@ -132,7 +132,7 @@ private:
|
||||
};
|
||||
|
||||
bool readFile(int id, QMakeParser::ParseFlags flags, QString *contents);
|
||||
void read(ProFile *pro, Utils::StringView content, int line, SubGrammar grammar);
|
||||
void read(ProFile *pro, QStringView content, int line, SubGrammar grammar);
|
||||
|
||||
ALWAYS_INLINE void putTok(ushort *&tokPtr, ushort tok);
|
||||
ALWAYS_INLINE void putBlockLen(ushort *&tokPtr, uint len);
|
||||
@@ -143,7 +143,7 @@ private:
|
||||
ALWAYS_INLINE bool resolveVariable(ushort *xprPtr, int tlen, int needSep, ushort **ptr,
|
||||
ushort **buf, QString *xprBuff,
|
||||
ushort **tokPtr, QString *tokBuff,
|
||||
const ushort *cur, Utils::StringView in);
|
||||
const ushort *cur, QStringView in);
|
||||
void finalizeCond(ushort *&tokPtr, ushort *uc, ushort *ptr, int wordCount);
|
||||
void finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int argc);
|
||||
void warnOperator(const char *msg);
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
// initializer_list related code on the templates inside algorithm.h
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
#include <utils/porting.h>
|
||||
|
||||
class tst_Algorithm : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -114,8 +112,8 @@ void tst_Algorithm::transform()
|
||||
QCOMPARE(i1, QList<int>({1, 3, 132}));
|
||||
const QList<int> i2 = Utils::transform(strings, stringToInt);
|
||||
QCOMPARE(i2, QList<int>({1, 3, 132}));
|
||||
const QList<Utils::QtSizeType> i3 = Utils::transform(strings, &QString::size);
|
||||
QCOMPARE(i3, QList<Utils::QtSizeType>({1, 1, 3}));
|
||||
const QList<qsizetype> i3 = Utils::transform(strings, &QString::size);
|
||||
QCOMPARE(i3, QList<qsizetype>({1, 1, 3}));
|
||||
}
|
||||
{
|
||||
// QStringList
|
||||
@@ -124,8 +122,8 @@ void tst_Algorithm::transform()
|
||||
QCOMPARE(i1, QList<int>({1, 3, 132}));
|
||||
const QList<int> i2 = Utils::transform(strings, stringToInt);
|
||||
QCOMPARE(i2, QList<int>({1, 3, 132}));
|
||||
const QList<Utils::QtSizeType> i3 = Utils::transform(strings, &QString::size);
|
||||
QCOMPARE(i3, QList<Utils::QtSizeType>({1, 1, 3}));
|
||||
const QList<qsizetype> i3 = Utils::transform(strings, &QString::size);
|
||||
QCOMPARE(i3, QList<qsizetype>({1, 1, 3}));
|
||||
}
|
||||
{
|
||||
// QSet internally needs special inserter
|
||||
@@ -134,8 +132,8 @@ void tst_Algorithm::transform()
|
||||
QCOMPARE(i1, QSet<int>({1, 3, 132}));
|
||||
const QSet<int> i2 = Utils::transform(strings, stringToInt);
|
||||
QCOMPARE(i2, QSet<int>({1, 3, 132}));
|
||||
const QSet<Utils::QtSizeType> i3 = Utils::transform(strings, &QString::size);
|
||||
QCOMPARE(i3, QSet<Utils::QtSizeType>({1, 3}));
|
||||
const QSet<qsizetype> i3 = Utils::transform(strings, &QString::size);
|
||||
QCOMPARE(i3, QSet<qsizetype>({1, 3}));
|
||||
}
|
||||
|
||||
// different container types
|
||||
@@ -146,8 +144,8 @@ void tst_Algorithm::transform()
|
||||
QCOMPARE(i1, QSet<int>({1, 3, 132}));
|
||||
const QSet<int> i2 = Utils::transform<QSet>(strings, stringToInt);
|
||||
QCOMPARE(i2, QSet<int>({1, 3, 132}));
|
||||
const QSet<Utils::QtSizeType> i3 = Utils::transform<QSet>(strings, &QString::size);
|
||||
QCOMPARE(i3, QSet<Utils::QtSizeType>({1, 3}));
|
||||
const QSet<qsizetype> i3 = Utils::transform<QSet>(strings, &QString::size);
|
||||
QCOMPARE(i3, QSet<qsizetype>({1, 3}));
|
||||
}
|
||||
{
|
||||
// QStringList to QSet
|
||||
@@ -156,8 +154,8 @@ void tst_Algorithm::transform()
|
||||
QCOMPARE(i1, QSet<int>({1, 3, 132}));
|
||||
const QSet<int> i2 = Utils::transform<QSet>(strings, stringToInt);
|
||||
QCOMPARE(i2, QSet<int>({1, 3, 132}));
|
||||
const QSet<Utils::QtSizeType> i3 = Utils::transform<QSet>(strings, &QString::size);
|
||||
QCOMPARE(i3, QSet<Utils::QtSizeType>({1, 3}));
|
||||
const QSet<qsizetype> i3 = Utils::transform<QSet>(strings, &QString::size);
|
||||
QCOMPARE(i3, QSet<qsizetype>({1, 3}));
|
||||
}
|
||||
{
|
||||
// QSet to QList
|
||||
@@ -168,9 +166,9 @@ void tst_Algorithm::transform()
|
||||
QList<int> i2 = Utils::transform<QList>(strings, stringToInt);
|
||||
Utils::sort(i2);
|
||||
QCOMPARE(i2, QList<int>({1, 3, 132}));
|
||||
QList<Utils::QtSizeType> i3 = Utils::transform<QList>(strings, &QString::size);
|
||||
QList<qsizetype> i3 = Utils::transform<QList>(strings, &QString::size);
|
||||
Utils::sort(i3);
|
||||
QCOMPARE(i3, QList<Utils::QtSizeType>({1, 1, 3}));
|
||||
QCOMPARE(i3, QList<qsizetype>({1, 1, 3}));
|
||||
}
|
||||
{
|
||||
const QList<Struct> list({4, 3, 2, 1, 2});
|
||||
|
||||
@@ -273,23 +273,23 @@ void tst_MapReduce::map()
|
||||
|
||||
// blocking map = mapped
|
||||
{
|
||||
const QSet<Utils::QtSizeType> sizes = Utils::mapped<QSet>(
|
||||
const QSet<qsizetype> sizes = Utils::mapped<QSet>(
|
||||
QStringList({QLatin1String("foo"), QLatin1String("bar"), QLatin1String("blah")}),
|
||||
[](const QString &s) { return s.size(); });
|
||||
QList<Utils::QtSizeType> vals = sizes.values();
|
||||
QList<qsizetype> vals = sizes.values();
|
||||
Utils::sort(vals);
|
||||
QCOMPARE(vals, QList<Utils::QtSizeType>({3, 4}));
|
||||
QCOMPARE(vals, QList<qsizetype>({3, 4}));
|
||||
}
|
||||
{
|
||||
const QStringList list({QLatin1String("foo"), QLatin1String("bar"), QLatin1String("blah")});
|
||||
const QSet<Utils::QtSizeType> sizes = Utils::mapped<QSet>(list.cbegin(),
|
||||
const QSet<qsizetype> sizes = Utils::mapped<QSet>(list.cbegin(),
|
||||
list.cend(),
|
||||
[](const QString &s) {
|
||||
return s.size();
|
||||
});
|
||||
QList<Utils::QtSizeType> vals = sizes.values();
|
||||
QList<qsizetype> vals = sizes.values();
|
||||
Utils::sort(vals);
|
||||
QCOMPARE(vals, QList<Utils::QtSizeType>({3, 4}));
|
||||
QCOMPARE(vals, QList<qsizetype>({3, 4}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -476,7 +476,7 @@ void tst_ProFileWriter::adds()
|
||||
|
||||
QMakeVfs vfs;
|
||||
QMakeParser parser(0, &vfs, &parseHandler);
|
||||
ProFile *proFile = parser.parsedProBlock(Utils::make_stringview(input),
|
||||
ProFile *proFile = parser.parsedProBlock(QStringView(input),
|
||||
0,
|
||||
QLatin1String(BASE_DIR "/test.pro"),
|
||||
1);
|
||||
@@ -650,7 +650,7 @@ void tst_ProFileWriter::removes()
|
||||
|
||||
QMakeVfs vfs;
|
||||
QMakeParser parser(0, &vfs, &parseHandler);
|
||||
ProFile *proFile = parser.parsedProBlock(Utils::make_stringview(input),
|
||||
ProFile *proFile = parser.parsedProBlock(QStringView(input),
|
||||
0,
|
||||
QLatin1String(BASE_DIR "/test.pro"),
|
||||
1);
|
||||
@@ -682,7 +682,7 @@ void tst_ProFileWriter::multiVar()
|
||||
|
||||
QMakeVfs vfs;
|
||||
QMakeParser parser(0, &vfs, &parseHandler);
|
||||
ProFile *proFile = parser.parsedProBlock(Utils::make_stringview(input),
|
||||
ProFile *proFile = parser.parsedProBlock(QStringView(input),
|
||||
0,
|
||||
QLatin1String(BASE_DIR "/test.pro"),
|
||||
1);
|
||||
@@ -705,7 +705,7 @@ void tst_ProFileWriter::addFiles()
|
||||
|
||||
QMakeVfs vfs;
|
||||
QMakeParser parser(0, &vfs, &parseHandler);
|
||||
ProFile *proFile = parser.parsedProBlock(Utils::make_stringview(input),
|
||||
ProFile *proFile = parser.parsedProBlock(QStringView(input),
|
||||
0,
|
||||
BASE_DIR "/test.pro",
|
||||
1);
|
||||
@@ -731,7 +731,7 @@ void tst_ProFileWriter::removeFiles()
|
||||
|
||||
QMakeVfs vfs;
|
||||
QMakeParser parser(0, &vfs, &parseHandler);
|
||||
ProFile *proFile = parser.parsedProBlock(Utils::make_stringview(input),
|
||||
ProFile *proFile = parser.parsedProBlock(QStringView(input),
|
||||
0,
|
||||
QLatin1String(BASE_DIR "/test.pro"),
|
||||
1);
|
||||
|
||||
Reference in New Issue
Block a user