forked from qt-creator/qt-creator
Utils: Remove function wrapper
This was an intentional, time-limited workaround that has served its purpose now that we require C++11. Change-Id: I96ece9c21bd405d281fd381bd9b87edc00c5ee84 Reviewed-by: Daniel Teske <daniel.teske@digia.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
@@ -32,7 +32,6 @@
|
|||||||
#include "qmljsqrcparser.h"
|
#include "qmljsqrcparser.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/function.h>
|
|
||||||
|
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
|
||||||
@@ -616,7 +615,7 @@ CoreImport ImportDependencies::coreImport(const QString &importId) const
|
|||||||
|
|
||||||
void ImportDependencies::iterateOnCandidateImports(
|
void ImportDependencies::iterateOnCandidateImports(
|
||||||
const ImportKey &key, const ViewerContext &vContext,
|
const ImportKey &key, const ViewerContext &vContext,
|
||||||
Utils::function<bool (const ImportMatchStrength &,const Export &,const CoreImport &)>
|
std::function<bool (const ImportMatchStrength &,const Export &,const CoreImport &)>
|
||||||
const &iterF) const
|
const &iterF) const
|
||||||
{
|
{
|
||||||
switch (key.type) {
|
switch (key.type) {
|
||||||
@@ -817,7 +816,7 @@ void ImportDependencies::removeExport(const QString &importId, const ImportKey &
|
|||||||
|
|
||||||
void ImportDependencies::iterateOnCoreImports(
|
void ImportDependencies::iterateOnCoreImports(
|
||||||
const ViewerContext &vContext,
|
const ViewerContext &vContext,
|
||||||
Utils::function<bool (const CoreImport &)> const &iterF) const
|
std::function<bool (const CoreImport &)> const &iterF) const
|
||||||
{
|
{
|
||||||
QMapIterator<QString, CoreImport> i(m_coreImports);
|
QMapIterator<QString, CoreImport> i(m_coreImports);
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
@@ -829,7 +828,7 @@ void ImportDependencies::iterateOnCoreImports(
|
|||||||
|
|
||||||
void ImportDependencies::iterateOnLibraryImports(
|
void ImportDependencies::iterateOnLibraryImports(
|
||||||
const ViewerContext &vContext,
|
const ViewerContext &vContext,
|
||||||
Utils::function<bool (const ImportMatchStrength &,
|
std::function<bool (const ImportMatchStrength &,
|
||||||
const Export &,
|
const Export &,
|
||||||
const CoreImport &)> const &iterF) const
|
const CoreImport &)> const &iterF) const
|
||||||
{
|
{
|
||||||
@@ -865,7 +864,7 @@ void ImportDependencies::iterateOnLibraryImports(
|
|||||||
void ImportDependencies::iterateOnSubImports(
|
void ImportDependencies::iterateOnSubImports(
|
||||||
const ImportKey &baseKey,
|
const ImportKey &baseKey,
|
||||||
const ViewerContext &vContext,
|
const ViewerContext &vContext,
|
||||||
Utils::function<bool (const ImportMatchStrength &,
|
std::function<bool (const ImportMatchStrength &,
|
||||||
const Export &,
|
const Export &,
|
||||||
const CoreImport &)> const &iterF) const
|
const CoreImport &)> const &iterF) const
|
||||||
{
|
{
|
||||||
|
@@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
#include <languageutils/componentversion.h>
|
#include <languageutils/componentversion.h>
|
||||||
#include <utils/qtcoverride.h>
|
#include <utils/qtcoverride.h>
|
||||||
#include <utils/function.h>
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@@ -44,6 +43,8 @@
|
|||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QCryptographicHash;
|
class QCryptographicHash;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
@@ -192,7 +193,7 @@ public:
|
|||||||
|
|
||||||
CoreImport coreImport(const QString &importId) const;
|
CoreImport coreImport(const QString &importId) const;
|
||||||
void iterateOnCandidateImports(const ImportKey &key, const ViewerContext &vContext,
|
void iterateOnCandidateImports(const ImportKey &key, const ViewerContext &vContext,
|
||||||
Utils::function<bool(const ImportMatchStrength &,
|
std::function<bool(const ImportMatchStrength &,
|
||||||
const Export &,
|
const Export &,
|
||||||
const CoreImport &)> const &iterF) const;
|
const CoreImport &)> const &iterF) const;
|
||||||
ImportElements candidateImports(const ImportKey &key, const ViewerContext &vContext) const;
|
ImportElements candidateImports(const ImportKey &key, const ViewerContext &vContext) const;
|
||||||
@@ -209,13 +210,13 @@ public:
|
|||||||
const QString &requiredPath);
|
const QString &requiredPath);
|
||||||
|
|
||||||
void iterateOnCoreImports(const ViewerContext &vContext,
|
void iterateOnCoreImports(const ViewerContext &vContext,
|
||||||
Utils::function<bool(const CoreImport &)> const &iterF) const;
|
std::function<bool(const CoreImport &)> const &iterF) const;
|
||||||
void iterateOnLibraryImports(const ViewerContext &vContext,
|
void iterateOnLibraryImports(const ViewerContext &vContext,
|
||||||
Utils::function<bool(const ImportMatchStrength &,
|
std::function<bool(const ImportMatchStrength &,
|
||||||
const Export &,
|
const Export &,
|
||||||
const CoreImport &)> const &iterF) const;
|
const CoreImport &)> const &iterF) const;
|
||||||
void iterateOnSubImports(const ImportKey &baseKey, const ViewerContext &vContext,
|
void iterateOnSubImports(const ImportKey &baseKey, const ViewerContext &vContext,
|
||||||
Utils::function<bool(const ImportMatchStrength &,
|
std::function<bool(const ImportMatchStrength &,
|
||||||
const Export &,
|
const Export &,
|
||||||
const CoreImport &)> const &iterF) const;
|
const CoreImport &)> const &iterF) const;
|
||||||
|
|
||||||
|
@@ -36,7 +36,6 @@
|
|||||||
#include "qmljstypedescriptionreader.h"
|
#include "qmljstypedescriptionreader.h"
|
||||||
|
|
||||||
#include <cplusplus/cppmodelmanagerbase.h>
|
#include <cplusplus/cppmodelmanagerbase.h>
|
||||||
#include <utils/function.h>
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/runextensions.h>
|
#include <utils/runextensions.h>
|
||||||
|
|
||||||
@@ -815,7 +814,7 @@ void ModelManagerInterface::parseLoop(QSet<QString> &scannedPaths,
|
|||||||
ModelManagerInterface *modelManager,
|
ModelManagerInterface *modelManager,
|
||||||
Language::Enum mainLanguage,
|
Language::Enum mainLanguage,
|
||||||
bool emitDocChangedOnDisk,
|
bool emitDocChangedOnDisk,
|
||||||
Utils::function<bool(qreal)> reportProgress)
|
std::function<bool(qreal)> reportProgress)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < files.size(); ++i) {
|
for (int i = 0; i < files.size(); ++i) {
|
||||||
if (!reportProgress(qreal(i) / files.size()))
|
if (!reportProgress(qreal(i) / files.size()))
|
||||||
|
@@ -229,7 +229,7 @@ protected:
|
|||||||
static void parseLoop(QSet<QString> &scannedPaths, QSet<QString> &newLibraries,
|
static void parseLoop(QSet<QString> &scannedPaths, QSet<QString> &newLibraries,
|
||||||
WorkingCopy workingCopyInternal, QStringList files, ModelManagerInterface *modelManager,
|
WorkingCopy workingCopyInternal, QStringList files, ModelManagerInterface *modelManager,
|
||||||
QmlJS::Language::Enum mainLanguage, bool emitDocChangedOnDisk,
|
QmlJS::Language::Enum mainLanguage, bool emitDocChangedOnDisk,
|
||||||
Utils::function<bool (qreal)> reportProgress);
|
std::function<bool (qreal)> reportProgress);
|
||||||
static void parse(QFutureInterface<void> &future,
|
static void parse(QFutureInterface<void> &future,
|
||||||
WorkingCopy workingCopyInternal,
|
WorkingCopy workingCopyInternal,
|
||||||
QStringList files,
|
QStringList files,
|
||||||
|
@@ -1,69 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "function.h"
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
// just compilation tests
|
|
||||||
|
|
||||||
void test();
|
|
||||||
|
|
||||||
void functionUser(Utils::function<int()> generator, Utils::function<void(int)> consumer)
|
|
||||||
{
|
|
||||||
consumer(generator());
|
|
||||||
}
|
|
||||||
|
|
||||||
struct GenFunctor
|
|
||||||
{
|
|
||||||
int operator()() { return 29; }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ConsumerFunctor
|
|
||||||
{
|
|
||||||
void operator()(int) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
int generatorF()
|
|
||||||
{
|
|
||||||
return 42;
|
|
||||||
}
|
|
||||||
|
|
||||||
void consumerF(int i)
|
|
||||||
{
|
|
||||||
if (i < 0)
|
|
||||||
test();
|
|
||||||
}
|
|
||||||
|
|
||||||
void test()
|
|
||||||
{
|
|
||||||
functionUser(GenFunctor(), ConsumerFunctor());
|
|
||||||
functionUser(&generatorF, &consumerF);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end namespace
|
|
@@ -1,48 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QTC_FUNCTION_H
|
|
||||||
#define QTC_FUNCTION_H
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#if !(__cplusplus > 199711L || __GXX_EXPERIMENTAL_CXX0X__ || _MSC_VER >= 1600 || defined( _LIBCPP_VERSION )) || \
|
|
||||||
(defined(__GNUC_LIBSTD__) && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402))
|
|
||||||
#define USE_TR1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_TR1
|
|
||||||
# ifdef __GNUC__
|
|
||||||
# include <tr1/functional>
|
|
||||||
# endif
|
|
||||||
namespace Utils { using std::tr1::function; }
|
|
||||||
#else
|
|
||||||
namespace Utils { using std::function; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // QTC_FUNCTION_H
|
|
@@ -82,7 +82,6 @@ SOURCES += $$PWD/environment.cpp \
|
|||||||
$$PWD/tooltip/tips.cpp \
|
$$PWD/tooltip/tips.cpp \
|
||||||
$$PWD/tooltip/tipcontents.cpp \
|
$$PWD/tooltip/tipcontents.cpp \
|
||||||
$$PWD/unixutils.cpp \
|
$$PWD/unixutils.cpp \
|
||||||
$$PWD/function.cpp \
|
|
||||||
$$PWD/ansiescapecodehandler.cpp \
|
$$PWD/ansiescapecodehandler.cpp \
|
||||||
$$PWD/execmenu.cpp \
|
$$PWD/execmenu.cpp \
|
||||||
$$PWD/completinglineedit.cpp \
|
$$PWD/completinglineedit.cpp \
|
||||||
@@ -173,7 +172,6 @@ HEADERS += \
|
|||||||
$$PWD/tooltip/effects.h \
|
$$PWD/tooltip/effects.h \
|
||||||
$$PWD/unixutils.h \
|
$$PWD/unixutils.h \
|
||||||
$$PWD/qtcoverride.h \
|
$$PWD/qtcoverride.h \
|
||||||
$$PWD/function.h \
|
|
||||||
$$PWD/ansiescapecodehandler.h \
|
$$PWD/ansiescapecodehandler.h \
|
||||||
$$PWD/execmenu.h \
|
$$PWD/execmenu.h \
|
||||||
$$PWD/completinglineedit.h \
|
$$PWD/completinglineedit.h \
|
||||||
|
@@ -89,8 +89,6 @@ QtcLibrary {
|
|||||||
"filewizardpage.ui",
|
"filewizardpage.ui",
|
||||||
"flowlayout.cpp",
|
"flowlayout.cpp",
|
||||||
"flowlayout.h",
|
"flowlayout.h",
|
||||||
"function.cpp",
|
|
||||||
"function.h",
|
|
||||||
"historycompleter.cpp",
|
"historycompleter.cpp",
|
||||||
"historycompleter.h",
|
"historycompleter.h",
|
||||||
"hostosinfo.h",
|
"hostosinfo.h",
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include <cplusplus/PreprocessorEnvironment.h>
|
#include <cplusplus/PreprocessorEnvironment.h>
|
||||||
#include <cplusplus/pp-engine.h>
|
#include <cplusplus/pp-engine.h>
|
||||||
#include <utils/function.h>
|
|
||||||
#include <utils/qtcoverride.h>
|
#include <utils/qtcoverride.h>
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
@@ -13,6 +12,8 @@
|
|||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QTextCodec;
|
class QTextCodec;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@@ -32,8 +32,6 @@
|
|||||||
|
|
||||||
#include "cpptools_global.h"
|
#include "cpptools_global.h"
|
||||||
|
|
||||||
#include <utils/function.h>
|
|
||||||
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
|
@@ -49,7 +49,6 @@
|
|||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qtsupport/qtkitinformation.h>
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
#include <texteditor/basetextdocument.h>
|
#include <texteditor/basetextdocument.h>
|
||||||
#include <utils/function.h>
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
Reference in New Issue
Block a user