forked from qt-creator/qt-creator
Utils: Remove Utils::optional
Since we are now requiring macOS 10.14 we can remove our local implementation of optional and use std::optional for macOS too. Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
18
README.md
18
README.md
@@ -324,24 +324,6 @@ we thank the authors who made this possible:
|
||||
|
||||
With backported/additional patches from https://code.qt.io/cgit/clang/llvm-project.git
|
||||
|
||||
### Optional
|
||||
|
||||
A single-header header-only library for representing optional (nullable)
|
||||
objects for C++14 (and C++11 to some extent) and passing them by value.
|
||||
|
||||
https://github.com/akrzemi1/Optional
|
||||
|
||||
QtCreator/src/libs/3rdparty/optional
|
||||
|
||||
Copyright (C) 2011-2012 Andrzej Krzemienski
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0
|
||||
(see accompanying file LICENSE_1_0.txt or a copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
The idea and interface is based on Boost.Optional library
|
||||
authored by Fernando Luis Cacciola Carballal
|
||||
|
||||
### std::span implementation for C++11 and later
|
||||
|
||||
A single-header implementation of C++20's std::span, conforming to the C++20
|
||||
|
@@ -362,29 +362,6 @@
|
||||
\li \l{https://code.qt.io/cgit/clang/llvm-project.git}
|
||||
\endlist
|
||||
|
||||
\li \b{Optional}
|
||||
|
||||
A single-header header-only library for representing optional
|
||||
(nullable) objects for C++14 (and C++11 to some extent) and passing
|
||||
them by value.
|
||||
|
||||
Copyright (C) 2011-2012 Andrzej Krzemienski
|
||||
|
||||
Distributed under the \l {http://boost.org/LICENSE_1_0.txt}
|
||||
{Boost Software License, Version 1.0}.
|
||||
(See accompanying file LICENSE_1_0.txt)
|
||||
|
||||
The idea and interface is based on Boost.Optional library
|
||||
authored by Fernando Luis Cacciola Carballal
|
||||
|
||||
The source code of std::experimental::optional can be found
|
||||
here:
|
||||
\list
|
||||
\li \l{https://github.com/akrzemi1/Optional}
|
||||
\li QtCreator/src/libs/3rdparty/optional
|
||||
\li \l{https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/src/libs/3rdparty/optional}
|
||||
\endlist
|
||||
|
||||
\li \b{std::span implementation for C++11 and later}
|
||||
|
||||
A single-header implementation of C++20's std::span, conforming to
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/fsengine/fsengine.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/optional.h>
|
||||
#include <utils/qtcsettings.h>
|
||||
#include <utils/singleton.h>
|
||||
#include <utils/temporarydirectory.h>
|
||||
@@ -47,9 +46,10 @@
|
||||
#include <QTemporaryDir>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include <iterator>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
|
||||
#ifdef ENABLE_QT_BREAKPAD
|
||||
#include <qtsystemexceptionhandler.h>
|
||||
@@ -295,7 +295,7 @@ struct Options
|
||||
QStringList preAppArguments;
|
||||
// list of arguments to be passed to the application or plugin manager
|
||||
std::vector<char *> appArguments;
|
||||
Utils::optional<QString> userLibraryPath;
|
||||
std::optional<QString> userLibraryPath;
|
||||
bool hasTestOption = false;
|
||||
bool wantsCleanSettings = false;
|
||||
};
|
||||
|
11
src/libs/3rdparty/optional/CMakeLists.txt
vendored
11
src/libs/3rdparty/optional/CMakeLists.txt
vendored
@@ -1,11 +0,0 @@
|
||||
project(optional)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
enable_testing()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wextra")
|
||||
|
||||
add_executable(test_optional test_optional.cpp)
|
||||
add_executable(test_type_traits test_type_traits.cpp)
|
||||
|
||||
add_test(test_optional test_optional)
|
||||
add_test(test_type_traits test_type_traits)
|
23
src/libs/3rdparty/optional/LICENSE_1_0.txt
vendored
23
src/libs/3rdparty/optional/LICENSE_1_0.txt
vendored
@@ -1,23 +0,0 @@
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
39
src/libs/3rdparty/optional/README.md
vendored
39
src/libs/3rdparty/optional/README.md
vendored
@@ -1,39 +0,0 @@
|
||||
Optional
|
||||
========
|
||||
|
||||
A single-header header-only library for representing optional (nullable) objects for C++14 (and C++11 to some extent) and passing them by value. This is the reference implementation of proposal N3793 (see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3793.html). Optional is now accepted into Library Fundamentals Technical Specification (see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3848.html). The interface is based on Fernando Cacciola's Boost.Optional library (see http://www.boost.org/doc/libs/1_52_0/libs/optional/doc/html/index.html)
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
```cpp
|
||||
optional<int> readInt(); // this function may return int or a not-an-int
|
||||
|
||||
if (optional<int> oi = readInt()) // did I get a real int
|
||||
cout << "my int is: " << *oi; // use my int
|
||||
else
|
||||
cout << "I have no int";
|
||||
```
|
||||
|
||||
For more usage examples and the overview see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3527.html
|
||||
|
||||
|
||||
Supported compilers
|
||||
-------------------
|
||||
|
||||
Clang 3.2, Clang 3.4, G++ 4.7.2, G++ 4.8.1. Tested only with libstdc++, versions 20130531, 20120920, 20110428. Others have reported it also works with libc++.
|
||||
|
||||
|
||||
|
||||
Known Issues
|
||||
------------
|
||||
|
||||
- Currently, the reference (and the only known) implementation of certain pieces of functionality explore what C++11 identifies as undefined behavior (see national body comment FI 15: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3770.html#FI15). This is mostly why Optional was removed from C++14 and put into Library Fundamentals TS. Luckily what the Standard identifies as UB is well defined on all known platforms. We expect that the C++14 wil fix this problem, so that our trick becomes well-defined.
|
||||
- In libstdc++ versions below 20130531 the constructor taking `initializer_list` argument is not `constexpr`. This is because `initializer_list` operations are not `constexpr` in C++11. This works however in version 20130531. It is also not enabled for libc++ because I do not have access to it and do nto know if it provides `constexpr` `initializer_list`.
|
||||
- In G++ 4.7.2 and 4.8.0 member function `value_or` does not have rvalue reference overload. These compilers do not support rvalue overloding on `*this`.
|
||||
- In order for the library to work with slightly older compilers, we emulate some missing type traits. On some platforms we cannot correctly detect the available features, and attempts at workarounds for missing type trait definitions can cause compile-time errors. Define macro `TR2_OPTIONAL_DISABLE_EMULATION_OF_TYPE_TRAITS` if you know that all the necessary type traits are defined, and no emulation is required.
|
||||
|
||||
License
|
||||
-------
|
||||
Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
|
10
src/libs/3rdparty/optional/copyright.txt
vendored
10
src/libs/3rdparty/optional/copyright.txt
vendored
@@ -1,10 +0,0 @@
|
||||
Copyright (C) 2011-2012 Andrzej Krzemienski
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0
|
||||
(see accompanying file LICENSE_1_0.txt or a copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
The idea and interface is based on Boost.Optional library
|
||||
authored by Fernando Luis Cacciola Carballal
|
||||
|
||||
Home at https://github.com/akrzemi1/Optional
|
1046
src/libs/3rdparty/optional/optional.hpp
vendored
1046
src/libs/3rdparty/optional/optional.hpp
vendored
File diff suppressed because it is too large
Load Diff
1459
src/libs/3rdparty/optional/test_optional.cpp
vendored
1459
src/libs/3rdparty/optional/test_optional.cpp
vendored
File diff suppressed because it is too large
Load Diff
66
src/libs/3rdparty/optional/test_type_traits.cpp
vendored
66
src/libs/3rdparty/optional/test_type_traits.cpp
vendored
@@ -1,66 +0,0 @@
|
||||
// Copyright (C) 2011 - 2012 Andrzej Krzemienski.
|
||||
//
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if (defined __clang__)
|
||||
namespace std { class type_info; }
|
||||
#endif
|
||||
|
||||
# include "optional.hpp"
|
||||
|
||||
namespace std { namespace experimental {
|
||||
|
||||
struct Val
|
||||
{
|
||||
Val(){}
|
||||
Val( Val const & ){}
|
||||
Val( Val && ) noexcept {}
|
||||
|
||||
Val & operator=( Val const & ) = delete;
|
||||
Val & operator=( Val && ) noexcept = delete;
|
||||
};
|
||||
|
||||
struct Safe
|
||||
{
|
||||
Safe(){}
|
||||
Safe( Safe const & ){}
|
||||
Safe( Safe && ) noexcept {}
|
||||
|
||||
Safe & operator=( Safe const & ){ return *this; }
|
||||
Safe & operator=( Safe && ) noexcept { return *this; }
|
||||
};
|
||||
|
||||
struct Unsafe
|
||||
{
|
||||
Unsafe(){}
|
||||
Unsafe( Unsafe const & ){}
|
||||
Unsafe( Unsafe && ){}
|
||||
|
||||
Unsafe & operator=( Unsafe const & ){ return *this; }
|
||||
Unsafe & operator=( Unsafe && ) { return *this; }
|
||||
};
|
||||
|
||||
struct VoidNothrowBoth
|
||||
{
|
||||
VoidNothrowBoth(VoidNothrowBoth&&) noexcept(true) {};
|
||||
void operator=(VoidNothrowBoth&&) noexcept(true) {}; // note void return type
|
||||
};
|
||||
|
||||
|
||||
static_assert(is_nothrow_move_constructible<Safe>::value, "WTF!");
|
||||
static_assert(!is_nothrow_move_constructible<Unsafe>::value, "WTF!");
|
||||
|
||||
static_assert(is_assignable<Safe&, Safe&&>::value, "WTF!");
|
||||
static_assert(!is_assignable<Val&, Val&&>::value, "WTF!");
|
||||
|
||||
static_assert(is_nothrow_move_assignable<Safe>::value, "WTF!");
|
||||
static_assert(!is_nothrow_move_assignable<Unsafe>::value, "WTF!");
|
||||
|
||||
static_assert(is_nothrow_move_constructible<VoidNothrowBoth>::value, "WTF!");
|
||||
static_assert(is_nothrow_move_assignable<VoidNothrowBoth>::value, "WTF!");
|
||||
|
||||
}} // namespace std::experimental
|
||||
|
||||
int main() { }
|
@@ -16,10 +16,9 @@
|
||||
#include <cplusplus/TranslationUnit.h>
|
||||
#include <cplusplus/TypeOfExpression.h>
|
||||
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <optional>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
|
||||
@@ -189,8 +188,8 @@ public:
|
||||
if (const auto binExpr = (*it)->asBinaryExpression()) {
|
||||
if (binExpr->left_expression == *(it - 1) && isAssignment(binExpr->binary_op_token))
|
||||
return checkPotentialWrite(Usage::Type::Write, it + 1);
|
||||
const Utils::optional<LookupItem> item = getTypeOfExpr(binExpr->left_expression,
|
||||
it + 1);
|
||||
const std::optional<LookupItem> item = getTypeOfExpr(binExpr->left_expression,
|
||||
it + 1);
|
||||
if (!item)
|
||||
return Usage::Type::Other;
|
||||
return checkPotentialWrite(getUsageTypeFromLhsAndRhs(
|
||||
@@ -349,12 +348,12 @@ private:
|
||||
return m_findUsages->typeofExpression(expr, m_findUsages->_doc, scope);
|
||||
}
|
||||
|
||||
Utils::optional<LookupItem> getTypeOfExpr(ExpressionAST *expr, Iterator scopeSearchPos) const
|
||||
std::optional<LookupItem> getTypeOfExpr(ExpressionAST *expr, Iterator scopeSearchPos) const
|
||||
{
|
||||
const QList<LookupItem> items = getTypesOfExpr(expr, scopeSearchPos);
|
||||
if (items.isEmpty())
|
||||
return {};
|
||||
return Utils::optional<LookupItem>(items.first());
|
||||
return std::optional<LookupItem>(items.first());
|
||||
}
|
||||
|
||||
Usage::Type getUsageTypeFromLhsAndRhs(const FullySpecifiedType &lhsType, ExpressionAST *rhs,
|
||||
@@ -365,7 +364,7 @@ private:
|
||||
return usageType;
|
||||
|
||||
// If the lhs has type auto, we use the RHS type.
|
||||
const Utils::optional<LookupItem> item = getTypeOfExpr(rhs, scopeSearchPos);
|
||||
const std::optional<LookupItem> item = getTypeOfExpr(rhs, scopeSearchPos);
|
||||
if (!item)
|
||||
return Usage::Type::Other;
|
||||
return getUsageTypeFromDataType(item->type());
|
||||
@@ -385,8 +384,8 @@ private:
|
||||
continue;
|
||||
if (memberAccess->member_name == *(it - 1))
|
||||
return Usage::Type::Other;
|
||||
const Utils::optional<LookupItem> item
|
||||
= getTypeOfExpr(memberAccess->base_expression, it);
|
||||
const std::optional<LookupItem> item = getTypeOfExpr(memberAccess->base_expression,
|
||||
it);
|
||||
if (!item)
|
||||
return Usage::Type::Other;
|
||||
FullySpecifiedType baseExprType = item->type();
|
||||
|
@@ -13,7 +13,8 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include <optional>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
|
||||
@@ -157,7 +158,7 @@ static bool isCursorAtEndOfLineButMaybeBeforeComment(const QTextCursor &cursor)
|
||||
return Utils::allOf(tokens, [](const Token &token) { return token.isComment(); });
|
||||
}
|
||||
|
||||
using TokenIndexResult = Utils::optional<int>;
|
||||
using TokenIndexResult = std::optional<int>;
|
||||
|
||||
// 10.6.1 Attribute syntax and semantics
|
||||
// This does not handle alignas() since it is not needed for the namespace case.
|
||||
|
@@ -1467,7 +1467,7 @@ public:
|
||||
+ ".lock";
|
||||
}
|
||||
|
||||
static Utils::optional<QString> lockedPluginName(PluginManagerPrivate *pm)
|
||||
static std::optional<QString> lockedPluginName(PluginManagerPrivate *pm)
|
||||
{
|
||||
const QString lockFilePath = LockFile::filePath(pm);
|
||||
if (QFile::exists(lockFilePath)) {
|
||||
@@ -1507,7 +1507,7 @@ void PluginManagerPrivate::checkForProblematicPlugins()
|
||||
{
|
||||
if (!enableCrashCheck)
|
||||
return;
|
||||
const Utils::optional<QString> pluginName = LockFile::lockedPluginName(this);
|
||||
const std::optional<QString> pluginName = LockFile::lockedPluginName(this);
|
||||
if (pluginName) {
|
||||
PluginSpec *spec = pluginByName(*pluginName);
|
||||
if (spec && !spec->isRequired()) {
|
||||
|
@@ -6,8 +6,6 @@
|
||||
#include "pluginspec.h"
|
||||
#include "iplugin.h"
|
||||
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QObject>
|
||||
#include <QPluginLoader>
|
||||
@@ -16,6 +14,8 @@
|
||||
#include <QVector>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace ExtensionSystem {
|
||||
|
||||
class IPlugin;
|
||||
@@ -47,8 +47,8 @@ public:
|
||||
void setForceEnabled(bool value);
|
||||
void setForceDisabled(bool value);
|
||||
|
||||
Utils::optional<QPluginLoader> loader;
|
||||
Utils::optional<QStaticPlugin> staticPlugin;
|
||||
std::optional<QPluginLoader> loader;
|
||||
std::optional<QStaticPlugin> staticPlugin;
|
||||
|
||||
QString name;
|
||||
QString version;
|
||||
|
@@ -5,14 +5,13 @@
|
||||
|
||||
namespace LanguageServerProtocol {
|
||||
|
||||
Utils::optional<QList<SymbolKind> > SymbolCapabilities::SymbolKindCapabilities::valueSet() const
|
||||
std::optional<QList<SymbolKind>> SymbolCapabilities::SymbolKindCapabilities::valueSet() const
|
||||
{
|
||||
if (Utils::optional<QList<int>> array = optionalArray<int>(valueSetKey)) {
|
||||
return Utils::make_optional(Utils::transform(*array, [] (int value) {
|
||||
return static_cast<SymbolKind>(value);
|
||||
}));
|
||||
if (std::optional<QList<int>> array = optionalArray<int>(valueSetKey)) {
|
||||
return std::make_optional(
|
||||
Utils::transform(*array, [](int value) { return static_cast<SymbolKind>(value); }));
|
||||
}
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void SymbolCapabilities::SymbolKindCapabilities::setValueSet(const QList<SymbolKind> &valueSet)
|
||||
@@ -25,7 +24,7 @@ WorkspaceClientCapabilities::WorkspaceClientCapabilities()
|
||||
setWorkspaceFolders(true);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, QJsonObject>> SemanticTokensClientCapabilities::Requests::range()
|
||||
std::optional<std::variant<bool, QJsonObject>> SemanticTokensClientCapabilities::Requests::range()
|
||||
const
|
||||
{
|
||||
using RetType = std::variant<bool, QJsonObject>;
|
||||
@@ -34,7 +33,7 @@ Utils::optional<std::variant<bool, QJsonObject>> SemanticTokensClientCapabilitie
|
||||
return RetType(rangeOptions.toBool());
|
||||
if (rangeOptions.isObject())
|
||||
return RetType(rangeOptions.toObject());
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void SemanticTokensClientCapabilities::Requests::setRange(
|
||||
@@ -43,7 +42,7 @@ void SemanticTokensClientCapabilities::Requests::setRange(
|
||||
insertVariant<bool, QJsonObject>(rangeKey, range);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, FullSemanticTokenOptions>>
|
||||
std::optional<std::variant<bool, FullSemanticTokenOptions>>
|
||||
SemanticTokensClientCapabilities::Requests::full() const
|
||||
{
|
||||
using RetType = std::variant<bool, FullSemanticTokenOptions>;
|
||||
@@ -52,7 +51,7 @@ SemanticTokensClientCapabilities::Requests::full() const
|
||||
return RetType(fullOptions.toBool());
|
||||
if (fullOptions.isObject())
|
||||
return RetType(FullSemanticTokenOptions(fullOptions.toObject()));
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void SemanticTokensClientCapabilities::Requests::setFull(
|
||||
@@ -61,8 +60,7 @@ void SemanticTokensClientCapabilities::Requests::setFull(
|
||||
insertVariant<bool, FullSemanticTokenOptions>(fullKey, full);
|
||||
}
|
||||
|
||||
Utils::optional<SemanticTokensClientCapabilities> TextDocumentClientCapabilities::semanticTokens()
|
||||
const
|
||||
std::optional<SemanticTokensClientCapabilities> TextDocumentClientCapabilities::semanticTokens() const
|
||||
{
|
||||
return optionalValue<SemanticTokensClientCapabilities>(semanticTokensKey);
|
||||
}
|
||||
|
@@ -14,7 +14,10 @@ class LANGUAGESERVERPROTOCOL_EXPORT DynamicRegistrationCapabilities : public Jso
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
Utils::optional<bool> dynamicRegistration() const { return optionalValue<bool>(dynamicRegistrationKey); }
|
||||
std::optional<bool> dynamicRegistration() const
|
||||
{
|
||||
return optionalValue<bool>(dynamicRegistrationKey);
|
||||
}
|
||||
void setDynamicRegistration(bool dynamicRegistration) { insert(dynamicRegistrationKey, dynamicRegistration); }
|
||||
void clearDynamicRegistration() { remove(dynamicRegistrationKey); }
|
||||
};
|
||||
@@ -28,7 +31,7 @@ public:
|
||||
* The client will send the `textDocument/semanticTokens/full/delta`
|
||||
* request if the server provides a corresponding handler.
|
||||
*/
|
||||
Utils::optional<bool> delta() const { return optionalValue<bool>(deltaKey); }
|
||||
std::optional<bool> delta() const { return optionalValue<bool>(deltaKey); }
|
||||
void setDelta(bool delta) { insert(deltaKey, delta); }
|
||||
void clearDelta() { remove(deltaKey); }
|
||||
};
|
||||
@@ -56,7 +59,7 @@ public:
|
||||
* The client will send the `textDocument/semanticTokens/range` request
|
||||
* if the server provides a corresponding handler.
|
||||
*/
|
||||
Utils::optional<std::variant<bool, QJsonObject>> range() const;
|
||||
std::optional<std::variant<bool, QJsonObject>> range() const;
|
||||
void setRange(const std::variant<bool, QJsonObject> &range);
|
||||
void clearRange() { remove(rangeKey); }
|
||||
|
||||
@@ -64,7 +67,7 @@ public:
|
||||
* The client will send the `textDocument/semanticTokens/full` request
|
||||
* if the server provides a corresponding handler.
|
||||
*/
|
||||
Utils::optional<std::variant<bool, FullSemanticTokenOptions>> full() const;
|
||||
std::optional<std::variant<bool, FullSemanticTokenOptions>> full() const;
|
||||
void setFull(const std::variant<bool, FullSemanticTokenOptions> &full);
|
||||
void clearFull() { remove(fullKey); }
|
||||
};
|
||||
@@ -85,12 +88,18 @@ public:
|
||||
void setFormats(const QList<QString> &value) { insertArray(formatsKey, value); }
|
||||
|
||||
/// Whether the client supports tokens that can overlap each other.
|
||||
Utils::optional<bool> overlappingTokenSupport() const { return optionalValue<bool>(overlappingTokenSupportKey); }
|
||||
std::optional<bool> overlappingTokenSupport() const
|
||||
{
|
||||
return optionalValue<bool>(overlappingTokenSupportKey);
|
||||
}
|
||||
void setOverlappingTokenSupport(bool overlappingTokenSupport) { insert(overlappingTokenSupportKey, overlappingTokenSupport); }
|
||||
void clearOverlappingTokenSupport() { remove(overlappingTokenSupportKey); }
|
||||
|
||||
/// Whether the client supports tokens that can span multiple lines.
|
||||
Utils::optional<bool> multiLineTokenSupport() const { return optionalValue<bool>(multiLineTokenSupportKey); }
|
||||
std::optional<bool> multiLineTokenSupport() const
|
||||
{
|
||||
return optionalValue<bool>(multiLineTokenSupportKey);
|
||||
}
|
||||
void setMultiLineTokenSupport(bool multiLineTokenSupport) { insert(multiLineTokenSupportKey, multiLineTokenSupport); }
|
||||
void clearMultiLineTokenSupport() { remove(multiLineTokenSupportKey); }
|
||||
|
||||
@@ -117,18 +126,18 @@ public:
|
||||
* the symbol kinds from `File` to `Array` as defined in
|
||||
* the initial version of the protocol.
|
||||
*/
|
||||
Utils::optional<QList<SymbolKind>> valueSet() const;
|
||||
std::optional<QList<SymbolKind>> valueSet() const;
|
||||
void setValueSet(const QList<SymbolKind> &valueSet);
|
||||
void clearValueSet() { remove(valueSetKey); }
|
||||
};
|
||||
|
||||
// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
|
||||
Utils::optional<SymbolKindCapabilities> symbolKind() const
|
||||
std::optional<SymbolKindCapabilities> symbolKind() const
|
||||
{ return optionalValue<SymbolKindCapabilities>(symbolKindKey); }
|
||||
void setSymbolKind(const SymbolKindCapabilities &symbolKind) { insert(symbolKindKey, symbolKind); }
|
||||
void clearSymbolKind() { remove(symbolKindKey); }
|
||||
|
||||
Utils::optional<bool> hierarchicalDocumentSymbolSupport() const
|
||||
std::optional<bool> hierarchicalDocumentSymbolSupport() const
|
||||
{ return optionalValue<bool>(hierarchicalDocumentSymbolSupportKey); }
|
||||
void setHierarchicalDocumentSymbolSupport(bool hierarchicalDocumentSymbolSupport)
|
||||
{ insert(hierarchicalDocumentSymbolSupportKey, hierarchicalDocumentSymbolSupport); }
|
||||
@@ -146,7 +155,7 @@ public:
|
||||
using DynamicRegistrationCapabilities::DynamicRegistrationCapabilities;
|
||||
|
||||
// The client supports sending will save notifications.
|
||||
Utils::optional<bool> willSave() const { return optionalValue<bool>(willSaveKey); }
|
||||
std::optional<bool> willSave() const { return optionalValue<bool>(willSaveKey); }
|
||||
void setWillSave(bool willSave) { insert(willSaveKey, willSave); }
|
||||
void clearWillSave() { remove(willSaveKey); }
|
||||
|
||||
@@ -155,19 +164,19 @@ public:
|
||||
* waits for a response providing text edits which will
|
||||
* be applied to the document before it is saved.
|
||||
*/
|
||||
Utils::optional<bool> willSaveWaitUntil() const
|
||||
std::optional<bool> willSaveWaitUntil() const
|
||||
{ return optionalValue<bool>(willSaveWaitUntilKey); }
|
||||
void setWillSaveWaitUntil(bool willSaveWaitUntil)
|
||||
{ insert(willSaveWaitUntilKey, willSaveWaitUntil); }
|
||||
void clearWillSaveWaitUntil() { remove(willSaveWaitUntilKey); }
|
||||
|
||||
// The client supports did save notifications.
|
||||
Utils::optional<bool> didSave() const { return optionalValue<bool>(didSaveKey); }
|
||||
std::optional<bool> didSave() const { return optionalValue<bool>(didSaveKey); }
|
||||
void setDidSave(bool didSave) { insert(didSaveKey, didSave); }
|
||||
void clearDidSave() { remove(didSaveKey); }
|
||||
};
|
||||
|
||||
Utils::optional<SynchronizationCapabilities> synchronization() const
|
||||
std::optional<SynchronizationCapabilities> synchronization() const
|
||||
{ return optionalValue<SynchronizationCapabilities>(synchronizationKey); }
|
||||
void setSynchronization(const SynchronizationCapabilities &synchronization)
|
||||
{ insert(synchronizationKey, synchronization); }
|
||||
@@ -191,14 +200,14 @@ public:
|
||||
* the end of the snippet. Placeholders with equal identifiers are linked,
|
||||
* that is typing in one will update others too.
|
||||
*/
|
||||
Utils::optional<bool> snippetSupport() const
|
||||
std::optional<bool> snippetSupport() const
|
||||
{ return optionalValue<bool>(snippetSupportKey); }
|
||||
void setSnippetSupport(bool snippetSupport)
|
||||
{ insert(snippetSupportKey, snippetSupport); }
|
||||
void clearSnippetSupport() { remove(snippetSupportKey); }
|
||||
|
||||
// Client supports commit characters on a completion item.
|
||||
Utils::optional<bool> commitCharacterSupport() const
|
||||
std::optional<bool> commitCharacterSupport() const
|
||||
{ return optionalValue<bool>(commitCharacterSupportKey); }
|
||||
void setCommitCharacterSupport(bool commitCharacterSupport)
|
||||
{ insert(commitCharacterSupportKey, commitCharacterSupport); }
|
||||
@@ -208,13 +217,13 @@ public:
|
||||
* Client supports the follow content formats for the documentation
|
||||
* property. The order describes the preferred format of the client.
|
||||
*/
|
||||
Utils::optional<QList<MarkupKind>> documentationFormat() const;
|
||||
std::optional<QList<MarkupKind>> documentationFormat() const;
|
||||
void setDocumentationFormat(const QList<MarkupKind> &documentationFormat);
|
||||
void clearDocumentationFormat() { remove(documentationFormatKey); }
|
||||
};
|
||||
|
||||
// The client supports the following `CompletionItem` specific capabilities.
|
||||
Utils::optional<CompletionItemCapbilities> completionItem() const
|
||||
std::optional<CompletionItemCapbilities> completionItem() const
|
||||
{ return optionalValue<CompletionItemCapbilities>(completionItemKey); }
|
||||
void setCompletionItem(const CompletionItemCapbilities &completionItem)
|
||||
{ insert(completionItemKey, completionItem); }
|
||||
@@ -235,12 +244,12 @@ public:
|
||||
* the completion items kinds from `Text` to `Reference` as defined in
|
||||
* the initial version of the protocol.
|
||||
*/
|
||||
Utils::optional<QList<CompletionItemKind::Kind>> valueSet() const;
|
||||
std::optional<QList<CompletionItemKind::Kind>> valueSet() const;
|
||||
void setValueSet(const QList<CompletionItemKind::Kind> &valueSet);
|
||||
void clearValueSet() { remove(valueSetKey); }
|
||||
};
|
||||
|
||||
Utils::optional<CompletionItemKindCapabilities> completionItemKind() const
|
||||
std::optional<CompletionItemKindCapabilities> completionItemKind() const
|
||||
{ return optionalValue<CompletionItemKindCapabilities>(completionItemKindKey); }
|
||||
void setCompletionItemKind(const CompletionItemKindCapabilities &completionItemKind)
|
||||
{ insert(completionItemKindKey, completionItemKind); }
|
||||
@@ -250,13 +259,16 @@ public:
|
||||
* The client supports to send additional context information for a
|
||||
* `textDocument/completion` request.
|
||||
*/
|
||||
Utils::optional<bool> contextSupport() const { return optionalValue<bool>(contextSupportKey); }
|
||||
std::optional<bool> contextSupport() const
|
||||
{
|
||||
return optionalValue<bool>(contextSupportKey);
|
||||
}
|
||||
void setContextSupport(bool contextSupport) { insert(contextSupportKey, contextSupport); }
|
||||
void clearContextSupport() { remove(contextSupportKey); }
|
||||
};
|
||||
|
||||
// Capabilities specific to the `textDocument/completion`
|
||||
Utils::optional<CompletionCapabilities> completion() const
|
||||
std::optional<CompletionCapabilities> completion() const
|
||||
{ return optionalValue<CompletionCapabilities>(completionKey); }
|
||||
void setCompletion(const CompletionCapabilities &completion)
|
||||
{ insert(completionKey, completion); }
|
||||
@@ -270,12 +282,15 @@ public:
|
||||
* Client supports the follow content formats for the content
|
||||
* property. The order describes the preferred format of the client.
|
||||
*/
|
||||
Utils::optional<QList<MarkupKind>> contentFormat() const;
|
||||
std::optional<QList<MarkupKind>> contentFormat() const;
|
||||
void setContentFormat(const QList<MarkupKind> &contentFormat);
|
||||
void clearContentFormat() { remove(contentFormatKey); }
|
||||
};
|
||||
|
||||
Utils::optional<HoverCapabilities> hover() const { return optionalValue<HoverCapabilities>(hoverKey); }
|
||||
std::optional<HoverCapabilities> hover() const
|
||||
{
|
||||
return optionalValue<HoverCapabilities>(hoverKey);
|
||||
}
|
||||
void setHover(const HoverCapabilities &hover) { insert(hoverKey, hover); }
|
||||
void clearHover() { remove(hoverKey); }
|
||||
|
||||
@@ -292,11 +307,11 @@ public:
|
||||
* Client supports the follow content formats for the documentation
|
||||
* property. The order describes the preferred format of the client.
|
||||
*/
|
||||
Utils::optional<QList<MarkupKind>> documentationFormat() const;
|
||||
std::optional<QList<MarkupKind>> documentationFormat() const;
|
||||
void setDocumentationFormat(const QList<MarkupKind> &documentationFormat);
|
||||
void clearDocumentationFormat() { remove(documentationFormatKey); }
|
||||
|
||||
Utils::optional<bool> activeParameterSupport() const
|
||||
std::optional<bool> activeParameterSupport() const
|
||||
{ return optionalValue<bool>(activeParameterSupportKey); }
|
||||
void setActiveParameterSupport(bool activeParameterSupport)
|
||||
{ insert(activeParameterSupportKey, activeParameterSupport); }
|
||||
@@ -304,7 +319,7 @@ public:
|
||||
};
|
||||
|
||||
// The client supports the following `SignatureInformation` specific properties.
|
||||
Utils::optional<SignatureInformationCapabilities> signatureInformation() const
|
||||
std::optional<SignatureInformationCapabilities> signatureInformation() const
|
||||
{ return optionalValue<SignatureInformationCapabilities>(signatureInformationKey); }
|
||||
void setSignatureInformation(const SignatureInformationCapabilities &signatureInformation)
|
||||
{ insert(signatureInformationKey, signatureInformation); }
|
||||
@@ -312,56 +327,56 @@ public:
|
||||
};
|
||||
|
||||
// Capabilities specific to the `textDocument/signatureHelp`
|
||||
Utils::optional<SignatureHelpCapabilities> signatureHelp() const
|
||||
std::optional<SignatureHelpCapabilities> signatureHelp() const
|
||||
{ return optionalValue<SignatureHelpCapabilities>(signatureHelpKey); }
|
||||
void setSignatureHelp(const SignatureHelpCapabilities &signatureHelp)
|
||||
{ insert(signatureHelpKey, signatureHelp); }
|
||||
void clearSignatureHelp() { remove(signatureHelpKey); }
|
||||
|
||||
// Whether references supports dynamic registration.
|
||||
Utils::optional<DynamicRegistrationCapabilities> references() const
|
||||
std::optional<DynamicRegistrationCapabilities> references() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(referencesKey); }
|
||||
void setReferences(const DynamicRegistrationCapabilities &references)
|
||||
{ insert(referencesKey, references); }
|
||||
void clearReferences() { remove(referencesKey); }
|
||||
|
||||
// Whether document highlight supports dynamic registration.
|
||||
Utils::optional<DynamicRegistrationCapabilities> documentHighlight() const
|
||||
std::optional<DynamicRegistrationCapabilities> documentHighlight() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(documentHighlightKey); }
|
||||
void setDocumentHighlight(const DynamicRegistrationCapabilities &documentHighlight)
|
||||
{ insert(documentHighlightKey, documentHighlight); }
|
||||
void clearDocumentHighlight() { remove(documentHighlightKey); }
|
||||
|
||||
// Capabilities specific to the `textDocument/documentSymbol`
|
||||
Utils::optional<SymbolCapabilities> documentSymbol() const
|
||||
std::optional<SymbolCapabilities> documentSymbol() const
|
||||
{ return optionalValue<SymbolCapabilities>(documentSymbolKey); }
|
||||
void setDocumentSymbol(const SymbolCapabilities &documentSymbol)
|
||||
{ insert(documentSymbolKey, documentSymbol); }
|
||||
void clearDocumentSymbol() { remove(documentSymbolKey); }
|
||||
|
||||
// Whether formatting supports dynamic registration.
|
||||
Utils::optional<DynamicRegistrationCapabilities> formatting() const
|
||||
std::optional<DynamicRegistrationCapabilities> formatting() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(formattingKey); }
|
||||
void setFormatting(const DynamicRegistrationCapabilities &formatting)
|
||||
{ insert(formattingKey, formatting); }
|
||||
void clearFormatting() { remove(formattingKey); }
|
||||
|
||||
// Whether range formatting supports dynamic registration.
|
||||
Utils::optional<DynamicRegistrationCapabilities> rangeFormatting() const
|
||||
std::optional<DynamicRegistrationCapabilities> rangeFormatting() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(rangeFormattingKey); }
|
||||
void setRangeFormatting(const DynamicRegistrationCapabilities &rangeFormatting)
|
||||
{ insert(rangeFormattingKey, rangeFormatting); }
|
||||
void clearRangeFormatting() { remove(rangeFormattingKey); }
|
||||
|
||||
// Whether on type formatting supports dynamic registration.
|
||||
Utils::optional<DynamicRegistrationCapabilities> onTypeFormatting() const
|
||||
std::optional<DynamicRegistrationCapabilities> onTypeFormatting() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(onTypeFormattingKey); }
|
||||
void setOnTypeFormatting(const DynamicRegistrationCapabilities &onTypeFormatting)
|
||||
{ insert(onTypeFormattingKey, onTypeFormatting); }
|
||||
void clearOnTypeFormatting() { remove(onTypeFormattingKey); }
|
||||
|
||||
// Whether definition supports dynamic registration.
|
||||
Utils::optional<DynamicRegistrationCapabilities> definition() const
|
||||
std::optional<DynamicRegistrationCapabilities> definition() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(definitionKey); }
|
||||
void setDefinition(const DynamicRegistrationCapabilities &definition)
|
||||
{ insert(definitionKey, definition); }
|
||||
@@ -372,7 +387,7 @@ public:
|
||||
* the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
|
||||
* return value for the corresponding server capability as well.
|
||||
*/
|
||||
Utils::optional<DynamicRegistrationCapabilities> typeDefinition() const
|
||||
std::optional<DynamicRegistrationCapabilities> typeDefinition() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(typeDefinitionKey); }
|
||||
void setTypeDefinition(const DynamicRegistrationCapabilities &typeDefinition)
|
||||
{ insert(typeDefinitionKey, typeDefinition); }
|
||||
@@ -383,7 +398,7 @@ public:
|
||||
* the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
|
||||
* return value for the corresponding server capability as well.
|
||||
*/
|
||||
Utils::optional<DynamicRegistrationCapabilities> implementation() const
|
||||
std::optional<DynamicRegistrationCapabilities> implementation() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(implementationKey); }
|
||||
void setImplementation(const DynamicRegistrationCapabilities &implementation)
|
||||
{ insert(implementationKey, implementation); }
|
||||
@@ -421,7 +436,7 @@ public:
|
||||
bool isValid() const override { return contains(codeActionKindKey); }
|
||||
};
|
||||
|
||||
Utils::optional<CodeActionLiteralSupport> codeActionLiteralSupport() const
|
||||
std::optional<CodeActionLiteralSupport> codeActionLiteralSupport() const
|
||||
{ return optionalValue<CodeActionLiteralSupport>(codeActionLiteralSupportKey); }
|
||||
void setCodeActionLiteralSupport(const CodeActionLiteralSupport &codeActionLiteralSupport)
|
||||
{ insert(codeActionLiteralSupportKey, codeActionLiteralSupport); }
|
||||
@@ -429,21 +444,21 @@ public:
|
||||
};
|
||||
|
||||
// Whether code action supports dynamic registration.
|
||||
Utils::optional<CodeActionCapabilities> codeAction() const
|
||||
std::optional<CodeActionCapabilities> codeAction() const
|
||||
{ return optionalValue<CodeActionCapabilities>(codeActionKey); }
|
||||
void setCodeAction(const CodeActionCapabilities &codeAction)
|
||||
{ insert(codeActionKey, codeAction); }
|
||||
void clearCodeAction() { remove(codeActionKey); }
|
||||
|
||||
// Whether code lens supports dynamic registration.
|
||||
Utils::optional<DynamicRegistrationCapabilities> codeLens() const
|
||||
std::optional<DynamicRegistrationCapabilities> codeLens() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(codeLensKey); }
|
||||
void setCodeLens(const DynamicRegistrationCapabilities &codeLens)
|
||||
{ insert(codeLensKey, codeLens); }
|
||||
void clearCodeLens() { remove(codeLensKey); }
|
||||
|
||||
// Whether document link supports dynamic registration.
|
||||
Utils::optional<DynamicRegistrationCapabilities> documentLink() const
|
||||
std::optional<DynamicRegistrationCapabilities> documentLink() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(documentLinkKey); }
|
||||
void setDocumentLink(const DynamicRegistrationCapabilities &documentLink)
|
||||
{ insert(documentLinkKey, documentLink); }
|
||||
@@ -454,7 +469,7 @@ public:
|
||||
* the client supports the new `(ColorProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
|
||||
* return value for the corresponding server capability as well.
|
||||
*/
|
||||
Utils::optional<DynamicRegistrationCapabilities> colorProvider() const
|
||||
std::optional<DynamicRegistrationCapabilities> colorProvider() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(colorProviderKey); }
|
||||
void setColorProvider(const DynamicRegistrationCapabilities &colorProvider)
|
||||
{ insert(colorProviderKey, colorProvider); }
|
||||
@@ -471,19 +486,22 @@ public:
|
||||
* @since version 3.12.0
|
||||
*/
|
||||
|
||||
Utils::optional<bool> prepareSupport() const { return optionalValue<bool>(prepareSupportKey); }
|
||||
std::optional<bool> prepareSupport() const
|
||||
{
|
||||
return optionalValue<bool>(prepareSupportKey);
|
||||
}
|
||||
void setPrepareSupport(bool prepareSupport) { insert(prepareSupportKey, prepareSupport); }
|
||||
void clearPrepareSupport() { remove(prepareSupportKey); }
|
||||
};
|
||||
|
||||
// Whether rename supports dynamic registration.
|
||||
Utils::optional<RenameClientCapabilities> rename() const
|
||||
std::optional<RenameClientCapabilities> rename() const
|
||||
{ return optionalValue<RenameClientCapabilities>(renameKey); }
|
||||
void setRename(const RenameClientCapabilities &rename)
|
||||
{ insert(renameKey, rename); }
|
||||
void clearRename() { remove(renameKey); }
|
||||
|
||||
Utils::optional<SemanticTokensClientCapabilities> semanticTokens() const;
|
||||
std::optional<SemanticTokensClientCapabilities> semanticTokens() const;
|
||||
void setSemanticTokens(const SemanticTokensClientCapabilities &semanticTokens);
|
||||
void clearSemanticTokens() { remove(semanticTokensKey); }
|
||||
};
|
||||
@@ -501,7 +519,7 @@ public:
|
||||
* and is useful for situation where a server for example detect a project
|
||||
* wide change that requires such a calculation.
|
||||
*/
|
||||
Utils::optional<bool> refreshSupport() const { return optionalValue<bool>(refreshSupportKey); }
|
||||
std::optional<bool> refreshSupport() const { return optionalValue<bool>(refreshSupportKey); }
|
||||
void setRefreshSupport(bool refreshSupport) { insert(refreshSupportKey, refreshSupport); }
|
||||
void clearRefreshSupport() { remove(refreshSupportKey); }
|
||||
};
|
||||
@@ -516,7 +534,7 @@ public:
|
||||
* The client supports applying batch edits to the workspace by supporting the request
|
||||
* 'workspace/applyEdit'
|
||||
*/
|
||||
Utils::optional<bool> applyEdit() const { return optionalValue<bool>(applyEditKey); }
|
||||
std::optional<bool> applyEdit() const { return optionalValue<bool>(applyEditKey); }
|
||||
void setApplyEdit(bool applyEdit) { insert(applyEditKey, applyEdit); }
|
||||
void clearApplyEdit() { remove(applyEditKey); }
|
||||
|
||||
@@ -526,7 +544,7 @@ public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
// The client supports versioned document changes in `WorkspaceEdit`s
|
||||
Utils::optional<bool> documentChanges() const
|
||||
std::optional<bool> documentChanges() const
|
||||
{ return optionalValue<bool>(documentChangesKey); }
|
||||
void setDocumentChanges(bool documentChanges)
|
||||
{ insert(documentChangesKey, documentChanges); }
|
||||
@@ -534,52 +552,52 @@ public:
|
||||
};
|
||||
|
||||
// Capabilities specific to `WorkspaceEdit`s
|
||||
Utils::optional<WorkspaceEditCapabilities> workspaceEdit() const
|
||||
std::optional<WorkspaceEditCapabilities> workspaceEdit() const
|
||||
{ return optionalValue<WorkspaceEditCapabilities>(workspaceEditKey); }
|
||||
void setWorkspaceEdit(const WorkspaceEditCapabilities &workspaceEdit)
|
||||
{ insert(workspaceEditKey, workspaceEdit); }
|
||||
void clearWorkspaceEdit() { remove(workspaceEditKey); }
|
||||
|
||||
// Capabilities specific to the `workspace/didChangeConfiguration` notification.
|
||||
Utils::optional<DynamicRegistrationCapabilities> didChangeConfiguration() const
|
||||
std::optional<DynamicRegistrationCapabilities> didChangeConfiguration() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(didChangeConfigurationKey); }
|
||||
void setDidChangeConfiguration(const DynamicRegistrationCapabilities &didChangeConfiguration)
|
||||
{ insert(didChangeConfigurationKey, didChangeConfiguration); }
|
||||
void clearDidChangeConfiguration() { remove(didChangeConfigurationKey); }
|
||||
|
||||
// Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
|
||||
Utils::optional<DynamicRegistrationCapabilities> didChangeWatchedFiles() const
|
||||
std::optional<DynamicRegistrationCapabilities> didChangeWatchedFiles() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(didChangeWatchedFilesKey); }
|
||||
void setDidChangeWatchedFiles(const DynamicRegistrationCapabilities &didChangeWatchedFiles)
|
||||
{ insert(didChangeWatchedFilesKey, didChangeWatchedFiles); }
|
||||
void clearDidChangeWatchedFiles() { remove(didChangeWatchedFilesKey); }
|
||||
|
||||
// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
|
||||
Utils::optional<SymbolCapabilities> symbol() const
|
||||
std::optional<SymbolCapabilities> symbol() const
|
||||
{ return optionalValue<SymbolCapabilities>(symbolKey); }
|
||||
void setSymbol(const SymbolCapabilities &symbol) { insert(symbolKey, symbol); }
|
||||
void clearSymbol() { remove(symbolKey); }
|
||||
|
||||
// Capabilities specific to the `workspace/executeCommand` request.
|
||||
Utils::optional<DynamicRegistrationCapabilities> executeCommand() const
|
||||
std::optional<DynamicRegistrationCapabilities> executeCommand() const
|
||||
{ return optionalValue<DynamicRegistrationCapabilities>(executeCommandKey); }
|
||||
void setExecuteCommand(const DynamicRegistrationCapabilities &executeCommand)
|
||||
{ insert(executeCommandKey, executeCommand); }
|
||||
void clearExecuteCommand() { remove(executeCommandKey); }
|
||||
|
||||
// The client has support for workspace folders. Since 3.6.0
|
||||
Utils::optional<bool> workspaceFolders() const
|
||||
std::optional<bool> workspaceFolders() const
|
||||
{ return optionalValue<bool>(workspaceFoldersKey); }
|
||||
void setWorkspaceFolders(bool workspaceFolders)
|
||||
{ insert(workspaceFoldersKey, workspaceFolders); }
|
||||
void clearWorkspaceFolders() { remove(workspaceFoldersKey); }
|
||||
|
||||
// The client supports `workspace/configuration` requests. Since 3.6.0
|
||||
Utils::optional<bool> configuration() const { return optionalValue<bool>(configurationKey); }
|
||||
std::optional<bool> configuration() const { return optionalValue<bool>(configurationKey); }
|
||||
void setConfiguration(bool configuration) { insert(configurationKey, configuration); }
|
||||
void clearConfiguration() { remove(configurationKey); }
|
||||
|
||||
Utils::optional<SemanticTokensWorkspaceClientCapabilities> semanticTokens() const
|
||||
std::optional<SemanticTokensWorkspaceClientCapabilities> semanticTokens() const
|
||||
{ return optionalValue<SemanticTokensWorkspaceClientCapabilities>(semanticTokensKey); }
|
||||
void setSemanticTokens(const SemanticTokensWorkspaceClientCapabilities &semanticTokens)
|
||||
{ insert(semanticTokensKey, semanticTokens); }
|
||||
@@ -597,7 +615,7 @@ public:
|
||||
* in the request specific server capabilities.
|
||||
*
|
||||
*/
|
||||
Utils::optional<bool> workDoneProgress() const
|
||||
std::optional<bool> workDoneProgress() const
|
||||
{ return optionalValue<bool>(workDoneProgressKey); }
|
||||
void setWorkDoneProgress(bool workDoneProgress)
|
||||
{ insert(workDoneProgressKey, workDoneProgress); }
|
||||
@@ -613,21 +631,21 @@ public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
// Workspace specific client capabilities.
|
||||
Utils::optional<WorkspaceClientCapabilities> workspace() const
|
||||
std::optional<WorkspaceClientCapabilities> workspace() const
|
||||
{ return optionalValue<WorkspaceClientCapabilities>(workspaceKey); }
|
||||
void setWorkspace(const WorkspaceClientCapabilities &workspace)
|
||||
{ insert(workspaceKey, workspace); }
|
||||
void clearWorkspace() { remove(workspaceKey); }
|
||||
|
||||
// Text document specific client capabilities.
|
||||
Utils::optional<TextDocumentClientCapabilities> textDocument() const
|
||||
std::optional<TextDocumentClientCapabilities> textDocument() const
|
||||
{ return optionalValue<TextDocumentClientCapabilities>(textDocumentKey); }
|
||||
void setTextDocument(const TextDocumentClientCapabilities &textDocument)
|
||||
{ insert(textDocumentKey, textDocument); }
|
||||
void clearTextDocument() { remove(textDocumentKey); }
|
||||
|
||||
// Window specific client capabilities.
|
||||
Utils::optional<WindowClientClientCapabilities> window() const
|
||||
std::optional<WindowClientClientCapabilities> window() const
|
||||
{ return optionalValue<WindowClientClientCapabilities>(windowKey); }
|
||||
void setWindow(const WindowClientClientCapabilities &window)
|
||||
{ insert(windowKey, window); }
|
||||
|
@@ -12,22 +12,22 @@ CompletionRequest::CompletionRequest(const CompletionParams ¶ms)
|
||||
: Request(methodName, params)
|
||||
{ }
|
||||
|
||||
Utils::optional<MarkupOrString> CompletionItem::documentation() const
|
||||
std::optional<MarkupOrString> CompletionItem::documentation() const
|
||||
{
|
||||
QJsonValue documentation = value(documentationKey);
|
||||
if (documentation.isUndefined())
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
return MarkupOrString(documentation);
|
||||
}
|
||||
|
||||
Utils::optional<CompletionItem::InsertTextFormat> CompletionItem::insertTextFormat() const
|
||||
std::optional<CompletionItem::InsertTextFormat> CompletionItem::insertTextFormat() const
|
||||
{
|
||||
if (Utils::optional<int> value = optionalValue<int>(insertTextFormatKey))
|
||||
return Utils::make_optional(CompletionItem::InsertTextFormat(*value));
|
||||
return Utils::nullopt;
|
||||
if (std::optional<int> value = optionalValue<int>(insertTextFormatKey))
|
||||
return std::make_optional(CompletionItem::InsertTextFormat(*value));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Utils::optional<QList<CompletionItem::CompletionItemTag>> CompletionItem::tags() const
|
||||
std::optional<QList<CompletionItem::CompletionItemTag>> CompletionItem::tags() const
|
||||
{
|
||||
if (const auto value = optionalValue<QJsonArray>(tagsKey)) {
|
||||
QList<CompletionItemTag> tags;
|
||||
|
@@ -43,7 +43,7 @@ public:
|
||||
* The trigger character (a single character) that has trigger code complete.
|
||||
* Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
|
||||
*/
|
||||
Utils::optional<QString> triggerCharacter() const
|
||||
std::optional<QString> triggerCharacter() const
|
||||
{ return optionalValue<QString>(triggerCharacterKey); }
|
||||
void setTriggerCharacter(const QString &triggerCharacter)
|
||||
{ insert(triggerCharacterKey, triggerCharacter); }
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
* The completion context. This is only available it the client specifies
|
||||
* to send this using `ClientCapabilities.textDocument.completion.contextSupport === true`
|
||||
*/
|
||||
Utils::optional<CompletionContext> context() const
|
||||
std::optional<CompletionContext> context() const
|
||||
{ return optionalValue<CompletionContext>(contextKey); }
|
||||
void setContext(const CompletionContext &context)
|
||||
{ insert(contextKey, context); }
|
||||
@@ -79,30 +79,30 @@ public:
|
||||
void setLabel(const QString &label) { insert(labelKey, label); }
|
||||
|
||||
/// The kind of this completion item. Based of the kind an icon is chosen by the editor.
|
||||
Utils::optional<int> kind() const { return optionalValue<int>(kindKey); }
|
||||
std::optional<int> kind() const { return optionalValue<int>(kindKey); }
|
||||
void setKind(int kind) { insert(kindKey, kind); }
|
||||
void clearKind() { remove(kindKey); }
|
||||
|
||||
/// A human-readable string with additional information about this item, like type information.
|
||||
Utils::optional<QString> detail() const { return optionalValue<QString>(detailKey); }
|
||||
std::optional<QString> detail() const { return optionalValue<QString>(detailKey); }
|
||||
void setDetail(const QString &detail) { insert(detailKey, detail); }
|
||||
void clearDetail() { remove(detailKey); }
|
||||
|
||||
/// A human-readable string that represents a doc-comment.
|
||||
Utils::optional<MarkupOrString> documentation() const;
|
||||
std::optional<MarkupOrString> documentation() const;
|
||||
void setDocumentation(const MarkupOrString &documentation)
|
||||
{ insert(documentationKey, documentation.toJson()); }
|
||||
void cleatDocumentation() { remove(documentationKey); }
|
||||
|
||||
/// A string that should be used when comparing this item
|
||||
/// with other items. When `falsy` the label is used.
|
||||
Utils::optional<QString> sortText() const { return optionalValue<QString>(sortTextKey); }
|
||||
std::optional<QString> sortText() const { return optionalValue<QString>(sortTextKey); }
|
||||
void setSortText(const QString &sortText) { insert(sortTextKey, sortText); }
|
||||
void clearSortText() { remove(sortTextKey); }
|
||||
|
||||
/// A string that should be used when filtering a set of
|
||||
/// completion items. When `falsy` the label is used.
|
||||
Utils::optional<QString> filterText() const { return optionalValue<QString>(filterTextKey); }
|
||||
std::optional<QString> filterText() const { return optionalValue<QString>(filterTextKey); }
|
||||
void setFilterText(const QString &filterText) { insert(filterTextKey, filterText); }
|
||||
void clearFilterText() { remove(filterTextKey); }
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
*
|
||||
* @deprecated Use textEdit instead.
|
||||
*/
|
||||
Utils::optional<QString> insertText() const { return optionalValue<QString>(insertTextKey); }
|
||||
std::optional<QString> insertText() const { return optionalValue<QString>(insertTextKey); }
|
||||
void setInsertText(const QString &insertText) { insert(insertTextKey, insertText); }
|
||||
void clearInsertText() { remove(insertTextKey); }
|
||||
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
|
||||
/// The format of the insert text. The format applies to both the `insertText` property
|
||||
/// and the `newText` property of a provided `textEdit`.
|
||||
Utils::optional<InsertTextFormat> insertTextFormat() const;
|
||||
std::optional<InsertTextFormat> insertTextFormat() const;
|
||||
void setInsertTextFormat(const InsertTextFormat &insertTextFormat)
|
||||
{ insert(insertTextFormatKey, insertTextFormat); }
|
||||
void clearInsertTextFormat() { remove(insertTextFormatKey); }
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
* *Note:* The range of the edit must be a single line range and it must contain the position at which completion
|
||||
* has been requested.
|
||||
*/
|
||||
Utils::optional<TextEdit> textEdit() const { return optionalValue<TextEdit>(textEditKey); }
|
||||
std::optional<TextEdit> textEdit() const { return optionalValue<TextEdit>(textEditKey); }
|
||||
void setTextEdit(const TextEdit &textEdit) { insert(textEditKey, textEdit); }
|
||||
void clearTextEdit() { remove(textEditKey); }
|
||||
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
* selecting this completion. Edits must not overlap with the main edit
|
||||
* nor with themselves.
|
||||
*/
|
||||
Utils::optional<QList<TextEdit>> additionalTextEdits() const
|
||||
std::optional<QList<TextEdit>> additionalTextEdits() const
|
||||
{ return optionalArray<TextEdit>(additionalTextEditsKey); }
|
||||
void setAdditionalTextEdits(const QList<TextEdit> &additionalTextEdits)
|
||||
{ insertArray(additionalTextEditsKey, additionalTextEdits); }
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
* then type that character. *Note* that all commit characters should have `length=1` and that superfluous
|
||||
* characters will be ignored.
|
||||
*/
|
||||
Utils::optional<QList<QString>> commitCharacters() const
|
||||
std::optional<QList<QString>> commitCharacters() const
|
||||
{ return optionalArray<QString>(commitCharactersKey); }
|
||||
void setCommitCharacters(const QList<QString> &commitCharacters)
|
||||
{ insertArray(commitCharactersKey, commitCharacters); }
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
* additional modifications to the current document should be described with the
|
||||
* additionalTextEdits-property.
|
||||
*/
|
||||
Utils::optional<Command> command() const { return optionalValue<Command>(commandKey); }
|
||||
std::optional<Command> command() const { return optionalValue<Command>(commandKey); }
|
||||
void setCommand(const Command &command) { insert(commandKey, command); }
|
||||
void clearCommand() { remove(commandKey); }
|
||||
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
* An data entry field that is preserved on a completion item between
|
||||
* a completion and a completion resolve request.
|
||||
*/
|
||||
Utils::optional<QJsonValue> data() const { return optionalValue<QJsonValue>(dataKey); }
|
||||
std::optional<QJsonValue> data() const { return optionalValue<QJsonValue>(dataKey); }
|
||||
void setData(const QJsonValue &data) { insert(dataKey, data); }
|
||||
void clearData() { remove(dataKey); }
|
||||
|
||||
@@ -208,13 +208,13 @@ public:
|
||||
* Tags for this completion item.
|
||||
* @since 3.15.0
|
||||
*/
|
||||
Utils::optional<QList<CompletionItemTag>> tags() const;
|
||||
std::optional<QList<CompletionItemTag>> tags() const;
|
||||
|
||||
/**
|
||||
* Indicates if this item is deprecated.
|
||||
* @deprecated Use `tags` instead if supported.
|
||||
*/
|
||||
Utils::optional<bool> deprecated() const { return optionalValue<bool>(deprecatedKey); }
|
||||
std::optional<bool> deprecated() const { return optionalValue<bool>(deprecatedKey); }
|
||||
|
||||
bool isValid() const override { return contains(labelKey); }
|
||||
};
|
||||
@@ -232,7 +232,7 @@ public:
|
||||
void setIsIncomplete(bool isIncomplete) { insert(isIncompleteKey, isIncomplete); }
|
||||
|
||||
/// The completion items.
|
||||
Utils::optional<QList<CompletionItem>> items() const { return array<CompletionItem>(itemsKey); }
|
||||
std::optional<QList<CompletionItem>> items() const { return array<CompletionItem>(itemsKey); }
|
||||
void setItems(const QList<CompletionItem> &items) { insertArray(itemsKey, items); }
|
||||
void clearItems() { remove(itemsKey); }
|
||||
|
||||
|
@@ -20,7 +20,7 @@ public:
|
||||
void setDiagnostics(const QList<Diagnostic> &diagnostics)
|
||||
{ insertArray(diagnosticsKey, diagnostics); }
|
||||
|
||||
Utils::optional<int> version() const { return optionalValue<int>(versionKey); }
|
||||
std::optional<int> version() const { return optionalValue<int>(versionKey); }
|
||||
void setVersion(int version) { insert(versionKey, version); }
|
||||
void clearVersion() { remove(versionKey); }
|
||||
|
||||
|
@@ -32,7 +32,7 @@ QString Trace::toString() const
|
||||
}
|
||||
#undef RETURN_CASE
|
||||
|
||||
Utils::optional<QList<MarkupKind>>
|
||||
std::optional<QList<MarkupKind>>
|
||||
TextDocumentClientCapabilities::CompletionCapabilities::CompletionItemCapbilities::
|
||||
documentationFormat() const
|
||||
{
|
||||
@@ -59,16 +59,16 @@ TextDocumentClientCapabilities::CompletionCapabilities::CompletionItemKindCapabi
|
||||
CompletionItemKind::TypeParameter});
|
||||
}
|
||||
|
||||
Utils::optional<QList<CompletionItemKind::Kind>>
|
||||
std::optional<QList<CompletionItemKind::Kind>>
|
||||
TextDocumentClientCapabilities::CompletionCapabilities::CompletionItemKindCapabilities::
|
||||
valueSet() const
|
||||
{
|
||||
if (Utils::optional<QList<int>> array = optionalArray<int>(valueSetKey)) {
|
||||
return Utils::make_optional(Utils::transform(*array, [] (int value) {
|
||||
if (std::optional<QList<int>> array = optionalArray<int>(valueSetKey)) {
|
||||
return std::make_optional(Utils::transform(*array, [](int value) {
|
||||
return static_cast<CompletionItemKind::Kind>(value);
|
||||
}));
|
||||
}
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -78,7 +78,7 @@ setValueSet(const QList<CompletionItemKind::Kind> &valueSet)
|
||||
insert(valueSetKey, enumArrayToJsonArray<CompletionItemKind::Kind>(valueSet));
|
||||
}
|
||||
|
||||
Utils::optional<QList<MarkupKind> > TextDocumentClientCapabilities::HoverCapabilities::contentFormat() const
|
||||
std::optional<QList<MarkupKind> > TextDocumentClientCapabilities::HoverCapabilities::contentFormat() const
|
||||
{
|
||||
return optionalArray<MarkupKind>(contentFormatKey);
|
||||
}
|
||||
@@ -88,7 +88,7 @@ void TextDocumentClientCapabilities::HoverCapabilities::setContentFormat(const Q
|
||||
insertArray(contentFormatKey, contentFormat);
|
||||
}
|
||||
|
||||
Utils::optional<QList<MarkupKind>>
|
||||
std::optional<QList<MarkupKind>>
|
||||
TextDocumentClientCapabilities::SignatureHelpCapabilities::SignatureInformationCapabilities::
|
||||
documentationFormat() const
|
||||
{
|
||||
@@ -110,20 +110,20 @@ InitializeParams::InitializeParams()
|
||||
setTrace(s_trace);
|
||||
}
|
||||
|
||||
Utils::optional<QJsonObject> InitializeParams::initializationOptions() const
|
||||
std::optional<QJsonObject> InitializeParams::initializationOptions() const
|
||||
{
|
||||
const QJsonValue &optionsValue = value(initializationOptionsKey);
|
||||
if (optionsValue.isObject())
|
||||
return optionsValue.toObject();
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Utils::optional<Trace> InitializeParams::trace() const
|
||||
std::optional<Trace> InitializeParams::trace() const
|
||||
{
|
||||
const QJsonValue &traceValue = value(traceKey);
|
||||
if (traceValue.isUndefined())
|
||||
return Utils::nullopt;
|
||||
return Utils::make_optional(Trace(traceValue.toString()));
|
||||
return std::nullopt;
|
||||
return std::make_optional(Trace(traceValue.toString()));
|
||||
}
|
||||
|
||||
InitializeRequest::InitializeRequest(const InitializeParams ¶ms)
|
||||
|
@@ -39,7 +39,7 @@ public:
|
||||
QString name() const { return typedValue<QString>(nameKey); }
|
||||
void setName(const QString &name) { insert(nameKey, name); }
|
||||
|
||||
Utils::optional<QString> version() const { return optionalValue<QString>(versionKey); }
|
||||
std::optional<QString> version() const { return optionalValue<QString>(versionKey); }
|
||||
void setVersion(const QString &version) { insert(versionKey, version); }
|
||||
void clearVersion() { remove(versionKey); }
|
||||
};
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
*
|
||||
* @deprecated in favor of rootUri.
|
||||
*/
|
||||
Utils::optional<LanguageClientValue<QString>> rootPath() const
|
||||
std::optional<LanguageClientValue<QString>> rootPath() const
|
||||
{ return optionalClientValue<QString>(rootPathKey); }
|
||||
void setRootPath(const LanguageClientValue<QString> &path)
|
||||
{ insert(rootPathKey, path); }
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
{ insert(rootUriKey, uri); }
|
||||
|
||||
// User provided initialization options.
|
||||
Utils::optional<QJsonObject> initializationOptions() const;
|
||||
std::optional<QJsonObject> initializationOptions() const;
|
||||
void setInitializationOptions(const QJsonObject &options)
|
||||
{ insert(initializationOptionsKey, options); }
|
||||
void clearInitializationOptions() { remove(initializationOptionsKey); }
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
{ insert(capabilitiesKey, capabilities); }
|
||||
|
||||
// The initial trace setting. If omitted trace is disabled ('off').
|
||||
Utils::optional<Trace> trace() const;
|
||||
std::optional<Trace> trace() const;
|
||||
void setTrace(Trace trace) { insert(traceKey, trace.toString()); }
|
||||
void clearTrace() { remove(traceKey); }
|
||||
|
||||
@@ -105,13 +105,13 @@ public:
|
||||
*
|
||||
* Since 3.6.0
|
||||
*/
|
||||
Utils::optional<LanguageClientArray<WorkSpaceFolder>> workspaceFolders() const
|
||||
std::optional<LanguageClientArray<WorkSpaceFolder>> workspaceFolders() const
|
||||
{ return optionalClientArray<WorkSpaceFolder>(workspaceFoldersKey); }
|
||||
void setWorkSpaceFolders(const LanguageClientArray<WorkSpaceFolder> &folders)
|
||||
{ insert(workspaceFoldersKey, folders.toJson()); }
|
||||
void clearWorkSpaceFolders() { remove(workspaceFoldersKey); }
|
||||
|
||||
Utils::optional<ClientInfo> clientInfo() const { return optionalValue<ClientInfo>(clientInfoKey); }
|
||||
std::optional<ClientInfo> clientInfo() const { return optionalValue<ClientInfo>(clientInfoKey); }
|
||||
void setClientInfo(const ClientInfo &clientInfo) { insert(clientInfoKey, clientInfo); }
|
||||
void clearClientInfo() { remove(clientInfoKey); }
|
||||
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
QString name() const { return typedValue<QString>(nameKey); }
|
||||
Utils::optional<QString> version() const { return optionalValue<QString>(versionKey); }
|
||||
std::optional<QString> version() const { return optionalValue<QString>(versionKey); }
|
||||
|
||||
bool isValid() const override { return contains(nameKey); }
|
||||
};
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
void setCapabilities(const ServerCapabilities &capabilities)
|
||||
{ insert(capabilitiesKey, capabilities); }
|
||||
|
||||
Utils::optional<ServerInfo> serverInfo() const
|
||||
std::optional<ServerInfo> serverInfo() const
|
||||
{ return optionalValue<ServerInfo>(serverInfoKey); }
|
||||
|
||||
bool isValid() const override { return contains(capabilitiesKey); }
|
||||
|
@@ -65,19 +65,19 @@ protected:
|
||||
template<typename T>
|
||||
T typedValue(const QStringView key) const;
|
||||
template<typename T>
|
||||
Utils::optional<T> optionalValue(const QStringView key) const;
|
||||
std::optional<T> optionalValue(const QStringView key) const;
|
||||
template<typename T>
|
||||
LanguageClientValue<T> clientValue(const QStringView key) const;
|
||||
template<typename T>
|
||||
Utils::optional<LanguageClientValue<T>> optionalClientValue(const QStringView key) const;
|
||||
std::optional<LanguageClientValue<T>> optionalClientValue(const QStringView key) const;
|
||||
template<typename T>
|
||||
QList<T> array(const QStringView key) const;
|
||||
template<typename T>
|
||||
Utils::optional<QList<T>> optionalArray(const QStringView key) const;
|
||||
std::optional<QList<T>> optionalArray(const QStringView key) const;
|
||||
template<typename T>
|
||||
LanguageClientArray<T> clientArray(const QStringView key) const;
|
||||
template<typename T>
|
||||
Utils::optional<LanguageClientArray<T>> optionalClientArray(const QStringView key) const;
|
||||
std::optional<LanguageClientArray<T>> optionalClientArray(const QStringView key) const;
|
||||
template<typename T>
|
||||
void insertArray(const QStringView key, const QList<T> &array);
|
||||
template<typename>
|
||||
@@ -107,10 +107,10 @@ T JsonObject::typedValue(const QStringView key) const
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Utils::optional<T> JsonObject::optionalValue(const QStringView key) const
|
||||
std::optional<T> JsonObject::optionalValue(const QStringView key) const
|
||||
{
|
||||
const QJsonValue &val = value(key);
|
||||
return val.isUndefined() ? Utils::nullopt : Utils::make_optional(fromJsonValue<T>(val));
|
||||
return val.isUndefined() ? std::nullopt : std::make_optional(fromJsonValue<T>(val));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -120,26 +120,26 @@ LanguageClientValue<T> JsonObject::clientValue(const QStringView key) const
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Utils::optional<LanguageClientValue<T>> JsonObject::optionalClientValue(const QStringView key) const
|
||||
std::optional<LanguageClientValue<T>> JsonObject::optionalClientValue(const QStringView key) const
|
||||
{
|
||||
return contains(key) ? Utils::make_optional(clientValue<T>(key)) : Utils::nullopt;
|
||||
return contains(key) ? std::make_optional(clientValue<T>(key)) : std::nullopt;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
QList<T> JsonObject::array(const QStringView key) const
|
||||
{
|
||||
if (const Utils::optional<QList<T>> &array = optionalArray<T>(key))
|
||||
if (const std::optional<QList<T>> &array = optionalArray<T>(key))
|
||||
return *array;
|
||||
qCDebug(conversionLog) << QString("Expected array under %1 in:").arg(key) << *this;
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Utils::optional<QList<T>> JsonObject::optionalArray(const QStringView key) const
|
||||
std::optional<QList<T>> JsonObject::optionalArray(const QStringView key) const
|
||||
{
|
||||
const QJsonValue &jsonValue = value(key);
|
||||
if (jsonValue.isUndefined())
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
return Utils::transform<QList<T>>(jsonValue.toArray(), &fromJsonValue<T>);
|
||||
}
|
||||
|
||||
@@ -150,11 +150,11 @@ LanguageClientArray<T> JsonObject::clientArray(const QStringView key) const
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Utils::optional<LanguageClientArray<T>> JsonObject::optionalClientArray(const QStringView key) const
|
||||
std::optional<LanguageClientArray<T>> JsonObject::optionalClientArray(const QStringView key) const
|
||||
{
|
||||
const QJsonValue &val = value(key);
|
||||
return !val.isUndefined() ? Utils::make_optional(LanguageClientArray<T>(value(key)))
|
||||
: Utils::nullopt;
|
||||
return !val.isUndefined() ? std::make_optional(LanguageClientArray<T>(value(key)))
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#include "lsptypes.h"
|
||||
#include "jsonkeys.h"
|
||||
|
||||
#include <utils/optional.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDebug>
|
||||
@@ -18,6 +17,7 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QUuid>
|
||||
|
||||
#include <optional>
|
||||
#include <variant>
|
||||
|
||||
namespace LanguageServerProtocol {
|
||||
@@ -112,8 +112,7 @@ public:
|
||||
|
||||
const QString parseError() { return m_parseError; }
|
||||
|
||||
virtual Utils::optional<ResponseHandler> responseHandler() const
|
||||
{ return Utils::nullopt; }
|
||||
virtual std::optional<ResponseHandler> responseHandler() const { return std::nullopt; }
|
||||
|
||||
BaseMessage toBaseMessage() const
|
||||
{ return BaseMessage(jsonRpcMimeType(), toRawData()); }
|
||||
@@ -143,10 +142,10 @@ public:
|
||||
void setMethod(const QString &method)
|
||||
{ m_jsonObject.insert(methodKey, method); }
|
||||
|
||||
Utils::optional<Params> params() const
|
||||
std::optional<Params> params() const
|
||||
{
|
||||
const QJsonValue ¶ms = m_jsonObject.value(paramsKey);
|
||||
return params.isUndefined() ? Utils::nullopt : Utils::make_optional(Params(params));
|
||||
return params.isUndefined() ? std::nullopt : std::make_optional(Params(params));
|
||||
}
|
||||
void setParams(const Params ¶ms)
|
||||
{ m_jsonObject.insert(paramsKey, QJsonValue(params)); }
|
||||
@@ -187,7 +186,7 @@ public:
|
||||
void setMethod(const QString &method)
|
||||
{ m_jsonObject.insert(methodKey, method); }
|
||||
|
||||
Utils::optional<std::nullptr_t> params() const
|
||||
std::optional<std::nullptr_t> params() const
|
||||
{ return nullptr; }
|
||||
void setParams(const std::nullptr_t &/*params*/)
|
||||
{ m_jsonObject.insert(paramsKey, QJsonValue::Null); }
|
||||
@@ -216,7 +215,7 @@ public:
|
||||
QString message() const { return typedValue<QString>(messageKey); }
|
||||
void setMessage(const QString &message) { insert(messageKey, message); }
|
||||
|
||||
Utils::optional<Error> data() const { return optionalValue<Error>(dataKey); }
|
||||
std::optional<Error> data() const { return optionalValue<Error>(dataKey); }
|
||||
void setData(const Error &data) { insert(dataKey, data); }
|
||||
void clearData() { remove(dataKey); }
|
||||
|
||||
@@ -275,22 +274,21 @@ public:
|
||||
void setId(MessageId id)
|
||||
{ this->m_jsonObject.insert(idKey, id); }
|
||||
|
||||
Utils::optional<Result> result() const
|
||||
std::optional<Result> result() const
|
||||
{
|
||||
const QJsonValue &result = m_jsonObject.value(resultKey);
|
||||
if (result.isUndefined())
|
||||
return Utils::nullopt;
|
||||
return Utils::make_optional(Result(result));
|
||||
return std::nullopt;
|
||||
return std::make_optional(Result(result));
|
||||
}
|
||||
void setResult(const Result &result) { m_jsonObject.insert(resultKey, QJsonValue(result)); }
|
||||
void clearResult() { m_jsonObject.remove(resultKey); }
|
||||
|
||||
using Error = ResponseError<ErrorDataType>;
|
||||
Utils::optional<Error> error() const
|
||||
std::optional<Error> error() const
|
||||
{
|
||||
const QJsonValue &val = m_jsonObject.value(errorKey);
|
||||
return val.isUndefined() ? Utils::nullopt
|
||||
: Utils::make_optional(fromJsonValue<Error>(val));
|
||||
return val.isUndefined() ? std::nullopt : std::make_optional(fromJsonValue<Error>(val));
|
||||
}
|
||||
void setError(const Error &error)
|
||||
{ m_jsonObject.insert(errorKey, QJsonValue(error)); }
|
||||
@@ -312,20 +310,18 @@ public:
|
||||
void setId(MessageId id)
|
||||
{ this->m_jsonObject.insert(idKey, id); }
|
||||
|
||||
Utils::optional<std::nullptr_t> result() const
|
||||
std::optional<std::nullptr_t> result() const
|
||||
{
|
||||
return m_jsonObject.value(resultKey).isNull() ? Utils::make_optional(nullptr)
|
||||
: Utils::nullopt;
|
||||
return m_jsonObject.value(resultKey).isNull() ? std::make_optional(nullptr) : std::nullopt;
|
||||
}
|
||||
void setResult(const std::nullptr_t &) { m_jsonObject.insert(resultKey, QJsonValue::Null); }
|
||||
void clearResult() { m_jsonObject.remove(resultKey); }
|
||||
|
||||
using Error = ResponseError<ErrorDataType>;
|
||||
Utils::optional<Error> error() const
|
||||
std::optional<Error> error() const
|
||||
{
|
||||
const QJsonValue &val = m_jsonObject.value(errorKey);
|
||||
return val.isUndefined() ? Utils::nullopt
|
||||
: Utils::make_optional(fromJsonValue<Error>(val));
|
||||
return val.isUndefined() ? std::nullopt : std::make_optional(fromJsonValue<Error>(val));
|
||||
}
|
||||
void setError(const Error &error)
|
||||
{ m_jsonObject.insert(errorKey, QJsonValue(error)); }
|
||||
@@ -357,7 +353,7 @@ public:
|
||||
void setResponseCallback(const ResponseCallback &callback)
|
||||
{ m_callBack = callback; }
|
||||
|
||||
Utils::optional<ResponseHandler> responseHandler() const final
|
||||
std::optional<ResponseHandler> responseHandler() const final
|
||||
{
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
@@ -369,7 +365,7 @@ public:
|
||||
|
||||
callback(Response(message.toJsonObject()));
|
||||
};
|
||||
return Utils::make_optional(ResponseHandler{id(), callback});
|
||||
return std::make_optional(ResponseHandler{id(), callback});
|
||||
}
|
||||
|
||||
bool isValid(QString *errorMessage) const override
|
||||
|
@@ -49,11 +49,11 @@ HoverRequest::HoverRequest(const TextDocumentPositionParams ¶ms)
|
||||
: Request(methodName, params)
|
||||
{ }
|
||||
|
||||
Utils::optional<MarkupOrString> ParameterInformation::documentation() const
|
||||
std::optional<MarkupOrString> ParameterInformation::documentation() const
|
||||
{
|
||||
QJsonValue documentation = value(documentationKey);
|
||||
if (documentation.isUndefined())
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
return MarkupOrString(documentation);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ DocumentSymbolsRequest::DocumentSymbolsRequest(const DocumentSymbolParams ¶m
|
||||
: Request(methodName, params)
|
||||
{ }
|
||||
|
||||
Utils::optional<QList<CodeActionKind> > CodeActionParams::CodeActionContext::only() const
|
||||
std::optional<QList<CodeActionKind> > CodeActionParams::CodeActionContext::only() const
|
||||
{
|
||||
return optionalArray<CodeActionKind>(onlyKey);
|
||||
}
|
||||
@@ -180,16 +180,16 @@ RenameRequest::RenameRequest(const RenameParams ¶ms)
|
||||
: Request(methodName, params)
|
||||
{ }
|
||||
|
||||
Utils::optional<DocumentUri> DocumentLink::target() const
|
||||
std::optional<DocumentUri> DocumentLink::target() const
|
||||
{
|
||||
if (Utils::optional<QString> optionalTarget = optionalValue<QString>(targetKey))
|
||||
return Utils::make_optional(DocumentUri::fromProtocol(*optionalTarget));
|
||||
return Utils::nullopt;
|
||||
if (std::optional<QString> optionalTarget = optionalValue<QString>(targetKey))
|
||||
return std::make_optional(DocumentUri::fromProtocol(*optionalTarget));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Utils::optional<QJsonValue> DocumentLink::data() const
|
||||
std::optional<QJsonValue> DocumentLink::data() const
|
||||
{
|
||||
return contains(dataKey) ? Utils::make_optional(value(dataKey)) : Utils::nullopt;
|
||||
return contains(dataKey) ? std::make_optional(value(dataKey)) : std::nullopt;
|
||||
}
|
||||
|
||||
TextDocumentParams::TextDocumentParams()
|
||||
@@ -376,9 +376,9 @@ PrepareRenameResult::PrepareRenameResult(const QJsonValue &val)
|
||||
}
|
||||
}
|
||||
|
||||
Utils::optional<QJsonValue> CodeLens::data() const
|
||||
std::optional<QJsonValue> CodeLens::data() const
|
||||
{
|
||||
return contains(dataKey) ? Utils::make_optional(value(dataKey)) : Utils::nullopt;
|
||||
return contains(dataKey) ? std::make_optional(value(dataKey)) : std::nullopt;
|
||||
}
|
||||
|
||||
HoverResult::HoverResult(const QJsonValue &value)
|
||||
|
@@ -72,7 +72,7 @@ public:
|
||||
HoverContent content() const;
|
||||
void setContent(const HoverContent &content);
|
||||
|
||||
Utils::optional<Range> range() const { return optionalValue<Range>(rangeKey); }
|
||||
std::optional<Range> range() const { return optionalValue<Range>(rangeKey); }
|
||||
void setRange(const Range &range) { insert(rangeKey, range); }
|
||||
void clearRange() { remove(rangeKey); }
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
QString label() const { return typedValue<QString>(labelKey); }
|
||||
void setLabel(const QString &label) { insert(labelKey, label); }
|
||||
|
||||
Utils::optional<MarkupOrString> documentation() const;
|
||||
std::optional<MarkupOrString> documentation() const;
|
||||
void setDocumentation(const MarkupOrString &documentation)
|
||||
{ insert(documentationKey, documentation.toJson()); }
|
||||
void clearDocumentation() { remove(documentationKey); }
|
||||
@@ -127,13 +127,13 @@ class LANGUAGESERVERPROTOCOL_EXPORT SignatureInformation : public ParameterInfor
|
||||
public:
|
||||
using ParameterInformation::ParameterInformation;
|
||||
|
||||
Utils::optional<QList<ParameterInformation>> parameters() const
|
||||
std::optional<QList<ParameterInformation>> parameters() const
|
||||
{ return optionalArray<ParameterInformation>(parametersKey); }
|
||||
void setParameters(const QList<ParameterInformation> ¶meters)
|
||||
{ insertArray(parametersKey, parameters); }
|
||||
void clearParameters() { remove(parametersKey); }
|
||||
|
||||
Utils::optional<int> activeParameter() const { return optionalValue<int>(activeParameterKey); }
|
||||
std::optional<int> activeParameter() const { return optionalValue<int>(activeParameterKey); }
|
||||
void setActiveParameter(int activeParameter) { insert(activeParameterKey, activeParameter); }
|
||||
void clearActiveParameter() { remove(activeParameterKey); }
|
||||
};
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
* In future version of the protocol this property might become
|
||||
* mandatory to better express this.
|
||||
*/
|
||||
Utils::optional<int> activeSignature() const { return optionalValue<int>(activeSignatureKey); }
|
||||
std::optional<int> activeSignature() const { return optionalValue<int>(activeSignatureKey); }
|
||||
void setActiveSignature(int activeSignature) { insert(activeSignatureKey, activeSignature); }
|
||||
void clearActiveSignature() { remove(activeSignatureKey); }
|
||||
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
* mandatory to better express the active parameter if the
|
||||
* active signature does have any.
|
||||
*/
|
||||
Utils::optional<int> activeParameter() const { return optionalValue<int>(activeParameterKey); }
|
||||
std::optional<int> activeParameter() const { return optionalValue<int>(activeParameterKey); }
|
||||
void setActiveParameter(int activeParameter) { insert(activeParameterKey, activeParameter); }
|
||||
void clearActiveParameter() { remove(activeParameterKey); }
|
||||
|
||||
@@ -277,7 +277,7 @@ public:
|
||||
Range range() const { return typedValue<Range>(rangeKey); }
|
||||
void setRange(const Range &range) { insert(rangeKey, range); }
|
||||
|
||||
Utils::optional<int> kind() const { return optionalValue<int>(kindKey); }
|
||||
std::optional<int> kind() const { return optionalValue<int>(kindKey); }
|
||||
void setKind(int kind) { insert(kindKey, kind); }
|
||||
void clearKind() { remove(kindKey); }
|
||||
|
||||
@@ -394,7 +394,7 @@ public:
|
||||
void setDiagnostics(const QList<Diagnostic> &diagnostics)
|
||||
{ insertArray(diagnosticsKey, diagnostics); }
|
||||
|
||||
Utils::optional<QList<CodeActionKind>> only() const;
|
||||
std::optional<QList<CodeActionKind>> only() const;
|
||||
void setOnly(const QList<CodeActionKind> &only);
|
||||
void clearOnly() { remove(onlyKey); }
|
||||
|
||||
@@ -424,21 +424,21 @@ public:
|
||||
QString title() const { return typedValue<QString>(titleKey); }
|
||||
void setTitle(QString title) { insert(titleKey, title); }
|
||||
|
||||
Utils::optional<CodeActionKind> kind() const { return optionalValue<CodeActionKind>(kindKey); }
|
||||
std::optional<CodeActionKind> kind() const { return optionalValue<CodeActionKind>(kindKey); }
|
||||
void setKind(const CodeActionKind &kind) { insert(kindKey, kind); }
|
||||
void clearKind() { remove(kindKey); }
|
||||
|
||||
Utils::optional<QList<Diagnostic>> diagnostics() const
|
||||
std::optional<QList<Diagnostic>> diagnostics() const
|
||||
{ return optionalArray<Diagnostic>(diagnosticsKey); }
|
||||
void setDiagnostics(const QList<Diagnostic> &diagnostics)
|
||||
{ insertArray(diagnosticsKey, diagnostics); }
|
||||
void clearDiagnostics() { remove(diagnosticsKey); }
|
||||
|
||||
Utils::optional<WorkspaceEdit> edit() const { return optionalValue<WorkspaceEdit>(editKey); }
|
||||
std::optional<WorkspaceEdit> edit() const { return optionalValue<WorkspaceEdit>(editKey); }
|
||||
void setEdit(const WorkspaceEdit &edit) { insert(editKey, edit); }
|
||||
void clearEdit() { remove(editKey); }
|
||||
|
||||
Utils::optional<Command> command() const { return optionalValue<Command>(commandKey); }
|
||||
std::optional<Command> command() const { return optionalValue<Command>(commandKey); }
|
||||
void setCommand(const Command &command) { insert(commandKey, command); }
|
||||
void clearCommand() { remove(commandKey); }
|
||||
|
||||
@@ -472,11 +472,11 @@ public:
|
||||
Range range() const { return typedValue<Range>(rangeKey); }
|
||||
void setRange(const Range &range) { insert(rangeKey, range); }
|
||||
|
||||
Utils::optional<Command> command() const { return optionalValue<Command>(commandKey); }
|
||||
std::optional<Command> command() const { return optionalValue<Command>(commandKey); }
|
||||
void setCommand(const Command &command) { insert(commandKey, command); }
|
||||
void clearCommand() { remove(commandKey); }
|
||||
|
||||
Utils::optional<QJsonValue> data() const;
|
||||
std::optional<QJsonValue> data() const;
|
||||
void setData(const QJsonValue &data) { insert(dataKey, data); }
|
||||
void clearData() { remove(dataKey); }
|
||||
|
||||
@@ -509,11 +509,11 @@ public:
|
||||
Range range() const { return typedValue<Range>(rangeKey); }
|
||||
void setRange(const Range &range) { insert(rangeKey, range); }
|
||||
|
||||
Utils::optional<DocumentUri> target() const;
|
||||
std::optional<DocumentUri> target() const;
|
||||
void setTarget(const DocumentUri &target) { insert(targetKey, target.toString()); }
|
||||
void clearTarget() { remove(targetKey); }
|
||||
|
||||
Utils::optional<QJsonValue> data() const;
|
||||
std::optional<QJsonValue> data() const;
|
||||
void setData(const QJsonValue &data) { insert(dataKey, data); }
|
||||
void clearData() { remove(dataKey); }
|
||||
|
||||
@@ -614,11 +614,11 @@ public:
|
||||
QString label() const { return typedValue<QString>(labelKey); }
|
||||
void setLabel(const QString &label) { insert(labelKey, label); }
|
||||
|
||||
Utils::optional<TextEdit> textEdit() const { return optionalValue<TextEdit>(textEditKey); }
|
||||
std::optional<TextEdit> textEdit() const { return optionalValue<TextEdit>(textEditKey); }
|
||||
void setTextEdit(const TextEdit &textEdit) { insert(textEditKey, textEdit); }
|
||||
void clearTextEdit() { remove(textEditKey); }
|
||||
|
||||
Utils::optional<QList<TextEdit>> additionalTextEdits() const
|
||||
std::optional<QList<TextEdit>> additionalTextEdits() const
|
||||
{ return optionalArray<TextEdit>(additionalTextEditsKey); }
|
||||
void setAdditionalTextEdits(const QList<TextEdit> &additionalTextEdits)
|
||||
{ insertArray(additionalTextEditsKey, additionalTextEdits); }
|
||||
@@ -659,19 +659,19 @@ public:
|
||||
bool insertSpace() const { return typedValue<bool>(insertSpaceKey); }
|
||||
void setInsertSpace(bool insertSpace) { insert(insertSpaceKey, insertSpace); }
|
||||
|
||||
Utils::optional<bool> trimTrailingWhitespace() const
|
||||
std::optional<bool> trimTrailingWhitespace() const
|
||||
{ return optionalValue<bool>(trimTrailingWhitespaceKey); }
|
||||
void setTrimTrailingWhitespace(bool trimTrailingWhitespace)
|
||||
{ insert(trimTrailingWhitespaceKey, trimTrailingWhitespace); }
|
||||
void clearTrimTrailingWhitespace() { remove(trimTrailingWhitespaceKey); }
|
||||
|
||||
Utils::optional<bool> insertFinalNewline() const
|
||||
std::optional<bool> insertFinalNewline() const
|
||||
{ return optionalValue<bool>(insertFinalNewlineKey); }
|
||||
void setInsertFinalNewline(bool insertFinalNewline)
|
||||
{ insert(insertFinalNewlineKey, insertFinalNewline); }
|
||||
void clearInsertFinalNewline() { remove(insertFinalNewlineKey); }
|
||||
|
||||
Utils::optional<bool> trimFinalNewlines() const
|
||||
std::optional<bool> trimFinalNewlines() const
|
||||
{ return optionalValue<bool>(trimFinalNewlinesKey); }
|
||||
void setTrimFinalNewlines(bool trimFinalNewlines)
|
||||
{ insert(trimFinalNewlinesKey, trimFinalNewlines); }
|
||||
|
@@ -17,24 +17,24 @@
|
||||
|
||||
namespace LanguageServerProtocol {
|
||||
|
||||
Utils::optional<DiagnosticSeverity> Diagnostic::severity() const
|
||||
std::optional<DiagnosticSeverity> Diagnostic::severity() const
|
||||
{
|
||||
if (auto val = optionalValue<int>(severityKey))
|
||||
return Utils::make_optional(static_cast<DiagnosticSeverity>(*val));
|
||||
return Utils::nullopt;
|
||||
return std::make_optional(static_cast<DiagnosticSeverity>(*val));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Utils::optional<Diagnostic::Code> Diagnostic::code() const
|
||||
std::optional<Diagnostic::Code> Diagnostic::code() const
|
||||
{
|
||||
QJsonValue codeValue = value(codeKey);
|
||||
auto it = find(codeKey);
|
||||
if (codeValue.isUndefined())
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
QJsonValue::Type type = it.value().type();
|
||||
if (type != QJsonValue::String && type != QJsonValue::Double)
|
||||
return Utils::make_optional(Code(QString()));
|
||||
return Utils::make_optional(codeValue.isDouble() ? Code(codeValue.toInt())
|
||||
: Code(codeValue.toString()));
|
||||
return std::make_optional(Code(QString()));
|
||||
return std::make_optional(codeValue.isDouble() ? Code(codeValue.toInt())
|
||||
: Code(codeValue.toString()));
|
||||
}
|
||||
|
||||
void Diagnostic::setCode(const Diagnostic::Code &code)
|
||||
@@ -42,16 +42,16 @@ void Diagnostic::setCode(const Diagnostic::Code &code)
|
||||
insertVariant<int, QString>(codeKey, code);
|
||||
}
|
||||
|
||||
Utils::optional<WorkspaceEdit::Changes> WorkspaceEdit::changes() const
|
||||
std::optional<WorkspaceEdit::Changes> WorkspaceEdit::changes() const
|
||||
{
|
||||
auto it = find(changesKey);
|
||||
if (it == end())
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
const QJsonObject &changesObject = it.value().toObject();
|
||||
Changes changesResult;
|
||||
for (const QString &key : changesObject.keys())
|
||||
changesResult[DocumentUri::fromProtocol(key)] = LanguageClientArray<TextEdit>(changesObject.value(key)).toList();
|
||||
return Utils::make_optional(changesResult);
|
||||
return std::make_optional(changesResult);
|
||||
}
|
||||
|
||||
void WorkspaceEdit::setChanges(const Changes &changes)
|
||||
@@ -325,7 +325,7 @@ QString expressionForGlob(QString globPattern)
|
||||
|
||||
bool DocumentFilter::applies(const Utils::FilePath &fileName, const Utils::MimeType &mimeType) const
|
||||
{
|
||||
if (Utils::optional<QString> _pattern = pattern()) {
|
||||
if (std::optional<QString> _pattern = pattern()) {
|
||||
QRegularExpression::PatternOption option = QRegularExpression::NoPatternOption;
|
||||
if (fileName.caseSensitivity() == Qt::CaseInsensitive)
|
||||
option = QRegularExpression::CaseInsensitiveOption;
|
||||
@@ -333,7 +333,7 @@ bool DocumentFilter::applies(const Utils::FilePath &fileName, const Utils::MimeT
|
||||
if (regexp.isValid() && regexp.match(fileName.toString()).hasMatch())
|
||||
return true;
|
||||
}
|
||||
if (Utils::optional<QString> _lang = language()) {
|
||||
if (std::optional<QString> _lang = language()) {
|
||||
auto match = [&_lang](const Utils::MimeType &mimeType){
|
||||
return *_lang == TextDocumentItem::mimeTypeToLanguageId(mimeType);
|
||||
};
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/link.h>
|
||||
#include <utils/mimeutils.h>
|
||||
#include <utils/optional.h>
|
||||
#include <utils/textutils.h>
|
||||
|
||||
#include <QTextCursor>
|
||||
@@ -19,6 +18,7 @@
|
||||
#include <QList>
|
||||
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <variant>
|
||||
|
||||
namespace LanguageServerProtocol {
|
||||
@@ -162,20 +162,20 @@ public:
|
||||
|
||||
// The diagnostic's severity. Can be omitted. If omitted it is up to the
|
||||
// client to interpret diagnostics as error, warning, info or hint.
|
||||
Utils::optional<DiagnosticSeverity> severity() const;
|
||||
std::optional<DiagnosticSeverity> severity() const;
|
||||
void setSeverity(const DiagnosticSeverity &severity)
|
||||
{ insert(severityKey, static_cast<int>(severity)); }
|
||||
void clearSeverity() { remove(severityKey); }
|
||||
|
||||
// The diagnostic's code, which might appear in the user interface.
|
||||
using Code = std::variant<int, QString>;
|
||||
Utils::optional<Code> code() const;
|
||||
std::optional<Code> code() const;
|
||||
void setCode(const Code &code);
|
||||
void clearCode() { remove(codeKey); }
|
||||
|
||||
// A human-readable string describing the source of this
|
||||
// diagnostic, e.g. 'typescript' or 'super lint'.
|
||||
Utils::optional<QString> source() const
|
||||
std::optional<QString> source() const
|
||||
{ return optionalValue<QString>(sourceKey); }
|
||||
void setSource(const QString &source) { insert(sourceKey, source); }
|
||||
void clearSource() { remove(sourceKey); }
|
||||
@@ -204,7 +204,7 @@ public:
|
||||
void clearCommand() { remove(commandKey); }
|
||||
|
||||
// Arguments that the command handler should be invoked with.
|
||||
Utils::optional<QJsonArray> arguments() const { return typedValue<QJsonArray>(argumentsKey); }
|
||||
std::optional<QJsonArray> arguments() const { return typedValue<QJsonArray>(argumentsKey); }
|
||||
void setArguments(const QJsonArray &arguments) { insert(argumentsKey, arguments); }
|
||||
void clearArguments() { remove(argumentsKey); }
|
||||
|
||||
@@ -291,7 +291,7 @@ public:
|
||||
|
||||
// Holds changes to existing resources.
|
||||
using Changes = QMap<DocumentUri, QList<TextEdit>>;
|
||||
Utils::optional<Changes> changes() const;
|
||||
std::optional<Changes> changes() const;
|
||||
void setChanges(const Changes &changes);
|
||||
|
||||
/*
|
||||
@@ -303,7 +303,7 @@ public:
|
||||
* Note: If the client can handle versioned document edits and if documentChanges are present,
|
||||
* the latter are preferred over changes.
|
||||
*/
|
||||
Utils::optional<QList<TextDocumentEdit>> documentChanges() const
|
||||
std::optional<QList<TextDocumentEdit>> documentChanges() const
|
||||
{ return optionalArray<TextDocumentEdit>(documentChangesKey); }
|
||||
void setDocumentChanges(const QList<TextDocumentEdit> &changes)
|
||||
{ insertArray(documentChangesKey, changes); }
|
||||
@@ -363,12 +363,12 @@ public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
// A language id, like `typescript`.
|
||||
Utils::optional<QString> language() const { return optionalValue<QString>(languageKey); }
|
||||
std::optional<QString> language() const { return optionalValue<QString>(languageKey); }
|
||||
void setLanguage(const QString &language) { insert(languageKey, language); }
|
||||
void clearLanguage() { remove(languageKey); }
|
||||
|
||||
// A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
|
||||
Utils::optional<QString> scheme() const { return optionalValue<QString>(schemeKey); }
|
||||
std::optional<QString> scheme() const { return optionalValue<QString>(schemeKey); }
|
||||
void setScheme(const QString &scheme) { insert(schemeKey, scheme); }
|
||||
void clearScheme() { remove(schemeKey); }
|
||||
|
||||
@@ -387,7 +387,7 @@ public:
|
||||
* (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but
|
||||
* not `example.0`)
|
||||
*/
|
||||
Utils::optional<QString> pattern() const { return optionalValue<QString>(patternKey); }
|
||||
std::optional<QString> pattern() const { return optionalValue<QString>(patternKey); }
|
||||
void setPattern(const QString &pattern) { insert(patternKey, pattern); }
|
||||
void clearPattern() { remove(patternKey); }
|
||||
|
||||
@@ -478,14 +478,14 @@ public:
|
||||
int kind() const { return typedValue<int>(kindKey); }
|
||||
void setKind(int kind) { insert(kindKey, kind); }
|
||||
|
||||
Utils::optional<bool> deprecated() const { return optionalValue<bool>(deprecatedKey); }
|
||||
std::optional<bool> deprecated() const { return optionalValue<bool>(deprecatedKey); }
|
||||
void setDeprecated(bool deprecated) { insert(deprecatedKey, deprecated); }
|
||||
void clearDeprecated() { remove(deprecatedKey); }
|
||||
|
||||
Location location() const { return typedValue<Location>(locationKey); }
|
||||
void setLocation(const Location &location) { insert(locationKey, location); }
|
||||
|
||||
Utils::optional<QString> containerName() const
|
||||
std::optional<QString> containerName() const
|
||||
{ return optionalValue<QString>(containerNameKey); }
|
||||
void setContainerName(const QString &containerName) { insert(containerNameKey, containerName); }
|
||||
void clearContainerName() { remove(containerNameKey); }
|
||||
@@ -502,14 +502,14 @@ public:
|
||||
QString name() const { return typedValue<QString>(nameKey); }
|
||||
void setName(const QString &name) { insert(nameKey, name); }
|
||||
|
||||
Utils::optional<QString> detail() const { return optionalValue<QString>(detailKey); }
|
||||
std::optional<QString> detail() const { return optionalValue<QString>(detailKey); }
|
||||
void setDetail(const QString &detail) { insert(detailKey, detail); }
|
||||
void clearDetail() { remove(detailKey); }
|
||||
|
||||
int kind() const { return typedValue<int>(kindKey); }
|
||||
void setKind(int kind) { insert(kindKey, kind); }
|
||||
|
||||
Utils::optional<bool> deprecated() const { return optionalValue<bool>(deprecatedKey); }
|
||||
std::optional<bool> deprecated() const { return optionalValue<bool>(deprecatedKey); }
|
||||
void setDeprecated(bool deprecated) { insert(deprecatedKey, deprecated); }
|
||||
void clearDeprecated() { remove(deprecatedKey); }
|
||||
|
||||
@@ -519,7 +519,7 @@ public:
|
||||
Range selectionRange() const { return typedValue<Range>(selectionRangeKey); }
|
||||
void setSelectionRange(Range selectionRange) { insert(selectionRangeKey, selectionRange); }
|
||||
|
||||
Utils::optional<QList<DocumentSymbol>> children() const
|
||||
std::optional<QList<DocumentSymbol>> children() const
|
||||
{ return optionalArray<DocumentSymbol>(childrenKey); }
|
||||
void setChildren(QList<DocumentSymbol> children) { insertArray(childrenKey, children); }
|
||||
void clearChildren() { remove(childrenKey); }
|
||||
|
@@ -6,13 +6,13 @@
|
||||
#include "languageserverprotocol_global.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/optional.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
#include <optional>
|
||||
#include <variant>
|
||||
|
||||
namespace LanguageServerProtocol {
|
||||
|
@@ -55,7 +55,7 @@ class LANGUAGESERVERPROTOCOL_EXPORT ShowMessageRequestParams : public ShowMessag
|
||||
public:
|
||||
using ShowMessageParams::ShowMessageParams;
|
||||
|
||||
Utils::optional<QList<MessageActionItem>> actions() const
|
||||
std::optional<QList<MessageActionItem>> actions() const
|
||||
{ return optionalArray<MessageActionItem>(actionsKey); }
|
||||
void setActions(const QList<MessageActionItem> &actions) { insertArray(actionsKey, actions); }
|
||||
void clearActions() { remove(actionsKey); }
|
||||
|
@@ -31,7 +31,7 @@ public:
|
||||
* long running operation.
|
||||
* Clients that don't support cancellation can ignore the setting.
|
||||
*/
|
||||
Utils::optional<bool> cancellable() const { return optionalValue<bool>(cancellableKey); }
|
||||
std::optional<bool> cancellable() const { return optionalValue<bool>(cancellableKey); }
|
||||
void setCancellable(bool cancellable) { insert(cancellableKey, cancellable); }
|
||||
void clearCancellable() { remove(cancellableKey); }
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
* Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
|
||||
* If unset, the previous progress message (if any) is still valid.
|
||||
*/
|
||||
Utils::optional<QString> message() const { return optionalValue<QString>(messageKey); }
|
||||
std::optional<QString> message() const { return optionalValue<QString>(messageKey); }
|
||||
void setMessage(const QString &message) { insert(messageKey, message); }
|
||||
void clearMessage() { remove(messageKey); }
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
// Allthough percentage is defined as an uint by the protocol some server
|
||||
// return a double here. Be less strict and also use a double.
|
||||
// CAUTION: the range is still 0 - 100 and not 0 - 1
|
||||
Utils::optional<double> percentage() const { return optionalValue<double>(percentageKey); }
|
||||
std::optional<double> percentage() const { return optionalValue<double>(percentageKey); }
|
||||
void setPercentage(double percentage) { insert(percentageKey, percentage); }
|
||||
void clearPercentage() { remove(percentageKey); }
|
||||
};
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
* Optional, a final message indicating to for example indicate the outcome
|
||||
* of the operation.
|
||||
*/
|
||||
Utils::optional<QString> message() const { return optionalValue<QString>(messageKey); }
|
||||
std::optional<QString> message() const { return optionalValue<QString>(messageKey); }
|
||||
void setMessage(const QString &message) { insert(messageKey, message); }
|
||||
void clearMessage() { remove(messageKey); }
|
||||
};
|
||||
|
@@ -125,7 +125,7 @@ public:
|
||||
* A server can then instead of computing all semantic tokens again simply
|
||||
* send a delta.
|
||||
*/
|
||||
Utils::optional<QString> resultId() const { return optionalValue<QString>(resultIdKey); }
|
||||
std::optional<QString> resultId() const { return optionalValue<QString>(resultIdKey); }
|
||||
void setResultId(const QString &resultId) { insert(resultIdKey, resultId); }
|
||||
void clearResultId() { remove(resultIdKey); }
|
||||
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
int deleteCount() const { return typedValue<int>(deleteCountKey); }
|
||||
void setDeleteCount(int deleteCount) { insert(deleteCountKey, deleteCount); }
|
||||
|
||||
Utils::optional<QList<int>> data() const { return optionalArray<int>(dataKey); }
|
||||
std::optional<QList<int>> data() const { return optionalArray<int>(dataKey); }
|
||||
void setData(const QList<int> &value) { insertArray(dataKey, value); }
|
||||
void clearData() { remove(dataKey); }
|
||||
|
||||
|
@@ -5,13 +5,14 @@
|
||||
|
||||
namespace LanguageServerProtocol {
|
||||
|
||||
Utils::optional<ServerCapabilities::TextDocumentSync> ServerCapabilities::textDocumentSync() const
|
||||
std::optional<ServerCapabilities::TextDocumentSync> ServerCapabilities::textDocumentSync() const
|
||||
{
|
||||
const QJsonValue &sync = value(textDocumentSyncKey);
|
||||
if (sync.isUndefined())
|
||||
return Utils::nullopt;
|
||||
return Utils::make_optional(sync.isDouble() ? TextDocumentSync(sync.toInt())
|
||||
: TextDocumentSync(TextDocumentSyncOptions(sync.toObject())));
|
||||
return std::nullopt;
|
||||
return std::make_optional(sync.isDouble()
|
||||
? TextDocumentSync(sync.toInt())
|
||||
: TextDocumentSync(TextDocumentSyncOptions(sync.toObject())));
|
||||
}
|
||||
|
||||
void ServerCapabilities::setTextDocumentSync(const ServerCapabilities::TextDocumentSync &textDocumentSync)
|
||||
@@ -21,27 +22,27 @@ void ServerCapabilities::setTextDocumentSync(const ServerCapabilities::TextDocum
|
||||
|
||||
TextDocumentSyncKind ServerCapabilities::textDocumentSyncKindHelper()
|
||||
{
|
||||
if (Utils::optional<TextDocumentSync> sync = textDocumentSync()) {
|
||||
if (std::optional<TextDocumentSync> sync = textDocumentSync()) {
|
||||
if (auto kind = std::get_if<int>(&*sync))
|
||||
return static_cast<TextDocumentSyncKind>(*kind);
|
||||
if (auto options = std::get_if<TextDocumentSyncOptions>(&*sync)) {
|
||||
if (const Utils::optional<int> &change = options->change())
|
||||
if (const std::optional<int> &change = options->change())
|
||||
return static_cast<TextDocumentSyncKind>(*change);
|
||||
}
|
||||
}
|
||||
return TextDocumentSyncKind::None;
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>> ServerCapabilities::hoverProvider()
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>> ServerCapabilities::hoverProvider()
|
||||
const
|
||||
{
|
||||
using RetType = std::variant<bool, WorkDoneProgressOptions>;
|
||||
const QJsonValue &provider = value(hoverProviderKey);
|
||||
if (provider.isBool())
|
||||
return Utils::make_optional(RetType(provider.toBool()));
|
||||
return std::make_optional(RetType(provider.toBool()));
|
||||
if (provider.isObject())
|
||||
return Utils::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return Utils::nullopt;
|
||||
return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void ServerCapabilities::setHoverProvider(
|
||||
@@ -50,15 +51,16 @@ void ServerCapabilities::setHoverProvider(
|
||||
insertVariant<bool, WorkDoneProgressOptions>(hoverProviderKey, hoverProvider);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, ServerCapabilities::RegistrationOptions>>
|
||||
std::optional<std::variant<bool, ServerCapabilities::RegistrationOptions>>
|
||||
ServerCapabilities::typeDefinitionProvider() const
|
||||
{
|
||||
using RetType = std::variant<bool, ServerCapabilities::RegistrationOptions>;
|
||||
const QJsonValue &provider = value(typeDefinitionProviderKey);
|
||||
if (provider.isUndefined() || !(provider.isBool() || provider.isObject()))
|
||||
return Utils::nullopt;
|
||||
return Utils::make_optional(provider.isBool() ? RetType(provider.toBool())
|
||||
: RetType(RegistrationOptions(provider.toObject())));
|
||||
return std::nullopt;
|
||||
return std::make_optional(provider.isBool()
|
||||
? RetType(provider.toBool())
|
||||
: RetType(RegistrationOptions(provider.toObject())));
|
||||
}
|
||||
|
||||
void ServerCapabilities::setTypeDefinitionProvider(
|
||||
@@ -68,15 +70,16 @@ void ServerCapabilities::setTypeDefinitionProvider(
|
||||
typeDefinitionProvider);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, ServerCapabilities::RegistrationOptions>>
|
||||
std::optional<std::variant<bool, ServerCapabilities::RegistrationOptions>>
|
||||
ServerCapabilities::implementationProvider() const
|
||||
{
|
||||
using RetType = std::variant<bool, ServerCapabilities::RegistrationOptions>;
|
||||
const QJsonValue &provider = value(implementationProviderKey);
|
||||
if (provider.isUndefined() || !(provider.isBool() || provider.isObject()))
|
||||
return Utils::nullopt;
|
||||
return Utils::make_optional(provider.isBool() ? RetType(provider.toBool())
|
||||
: RetType(RegistrationOptions(provider.toObject())));
|
||||
return std::nullopt;
|
||||
return std::make_optional(provider.isBool()
|
||||
? RetType(provider.toBool())
|
||||
: RetType(RegistrationOptions(provider.toObject())));
|
||||
}
|
||||
|
||||
void ServerCapabilities::setImplementationProvider(
|
||||
@@ -85,16 +88,16 @@ void ServerCapabilities::setImplementationProvider(
|
||||
insertVariant<bool, RegistrationOptions>(implementationProviderKey, implementationProvider);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>>
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>>
|
||||
ServerCapabilities::referencesProvider() const
|
||||
{
|
||||
using RetType = std::variant<bool, WorkDoneProgressOptions>;
|
||||
const QJsonValue &provider = value(referencesProviderKey);
|
||||
if (provider.isBool())
|
||||
return Utils::make_optional(RetType(provider.toBool()));
|
||||
return std::make_optional(RetType(provider.toBool()));
|
||||
if (provider.isObject())
|
||||
return Utils::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return Utils::nullopt;
|
||||
return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void ServerCapabilities::setReferencesProvider(
|
||||
@@ -104,16 +107,16 @@ void ServerCapabilities::setReferencesProvider(
|
||||
referencesProvider);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>>
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>>
|
||||
ServerCapabilities::documentHighlightProvider() const
|
||||
{
|
||||
using RetType = std::variant<bool, WorkDoneProgressOptions>;
|
||||
const QJsonValue &provider = value(documentHighlightProviderKey);
|
||||
if (provider.isBool())
|
||||
return Utils::make_optional(RetType(provider.toBool()));
|
||||
return std::make_optional(RetType(provider.toBool()));
|
||||
if (provider.isObject())
|
||||
return Utils::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return Utils::nullopt;
|
||||
return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void ServerCapabilities::setDocumentHighlightProvider(
|
||||
@@ -123,16 +126,16 @@ void ServerCapabilities::setDocumentHighlightProvider(
|
||||
documentHighlightProvider);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>>
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>>
|
||||
ServerCapabilities::documentSymbolProvider() const
|
||||
{
|
||||
using RetType = std::variant<bool, WorkDoneProgressOptions>;
|
||||
const QJsonValue &provider = value(documentSymbolProviderKey);
|
||||
if (provider.isBool())
|
||||
return Utils::make_optional(RetType(provider.toBool()));
|
||||
return std::make_optional(RetType(provider.toBool()));
|
||||
if (provider.isObject())
|
||||
return Utils::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return Utils::nullopt;
|
||||
return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void ServerCapabilities::setDocumentSymbolProvider(
|
||||
@@ -142,7 +145,7 @@ void ServerCapabilities::setDocumentSymbolProvider(
|
||||
documentSymbolProvider);
|
||||
}
|
||||
|
||||
Utils::optional<SemanticTokensOptions> ServerCapabilities::semanticTokensProvider() const
|
||||
std::optional<SemanticTokensOptions> ServerCapabilities::semanticTokensProvider() const
|
||||
{
|
||||
return optionalValue<SemanticTokensOptions>(semanticTokensProviderKey);
|
||||
}
|
||||
@@ -153,16 +156,16 @@ void ServerCapabilities::setSemanticTokensProvider(
|
||||
insert(semanticTokensProviderKey, semanticTokensProvider);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>>
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>>
|
||||
ServerCapabilities::workspaceSymbolProvider() const
|
||||
{
|
||||
using RetType = std::variant<bool, WorkDoneProgressOptions>;
|
||||
const QJsonValue &provider = value(workspaceSymbolProviderKey);
|
||||
if (provider.isBool())
|
||||
return Utils::make_optional(RetType(provider.toBool()));
|
||||
return std::make_optional(RetType(provider.toBool()));
|
||||
if (provider.isObject())
|
||||
return Utils::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return Utils::nullopt;
|
||||
return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void ServerCapabilities::setWorkspaceSymbolProvider(
|
||||
@@ -172,29 +175,29 @@ void ServerCapabilities::setWorkspaceSymbolProvider(
|
||||
workspaceSymbolProvider);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, CodeActionOptions>> ServerCapabilities::codeActionProvider() const
|
||||
std::optional<std::variant<bool, CodeActionOptions>> ServerCapabilities::codeActionProvider() const
|
||||
{
|
||||
const QJsonValue &provider = value(codeActionProviderKey);
|
||||
if (provider.isBool())
|
||||
return Utils::make_optional(std::variant<bool, CodeActionOptions>(provider.toBool()));
|
||||
return std::make_optional(std::variant<bool, CodeActionOptions>(provider.toBool()));
|
||||
if (provider.isObject()) {
|
||||
CodeActionOptions options(provider);
|
||||
if (options.isValid())
|
||||
return Utils::make_optional(std::variant<bool, CodeActionOptions>(options));
|
||||
return std::make_optional(std::variant<bool, CodeActionOptions>(options));
|
||||
}
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>>
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>>
|
||||
ServerCapabilities::documentFormattingProvider() const
|
||||
{
|
||||
using RetType = std::variant<bool, WorkDoneProgressOptions>;
|
||||
const QJsonValue &provider = value(documentFormattingProviderKey);
|
||||
if (provider.isBool())
|
||||
return Utils::make_optional(RetType(provider.toBool()));
|
||||
return std::make_optional(RetType(provider.toBool()));
|
||||
if (provider.isObject())
|
||||
return Utils::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return Utils::nullopt;
|
||||
return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void ServerCapabilities::setDocumentFormattingProvider(
|
||||
@@ -204,16 +207,16 @@ void ServerCapabilities::setDocumentFormattingProvider(
|
||||
documentFormattingProvider);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>>
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>>
|
||||
ServerCapabilities::documentRangeFormattingProvider() const
|
||||
{
|
||||
using RetType = std::variant<bool, WorkDoneProgressOptions>;
|
||||
const QJsonValue &provider = value(documentRangeFormattingProviderKey);
|
||||
if (provider.isBool())
|
||||
return Utils::make_optional(RetType(provider.toBool()));
|
||||
return std::make_optional(RetType(provider.toBool()));
|
||||
if (provider.isObject())
|
||||
return Utils::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return Utils::nullopt;
|
||||
return std::make_optional(RetType(WorkDoneProgressOptions(provider.toObject())));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void ServerCapabilities::setDocumentRangeFormattingProvider(
|
||||
@@ -223,7 +226,7 @@ void ServerCapabilities::setDocumentRangeFormattingProvider(
|
||||
documentRangeFormattingProvider);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<ServerCapabilities::RenameOptions, bool>> ServerCapabilities::renameProvider() const
|
||||
std::optional<std::variant<ServerCapabilities::RenameOptions, bool>> ServerCapabilities::renameProvider() const
|
||||
{
|
||||
using RetType = std::variant<ServerCapabilities::RenameOptions, bool>;
|
||||
const QJsonValue &localValue = value(renameProviderKey);
|
||||
@@ -231,7 +234,7 @@ Utils::optional<std::variant<ServerCapabilities::RenameOptions, bool>> ServerCap
|
||||
return RetType(localValue.toBool());
|
||||
if (localValue.isObject())
|
||||
return RetType(RenameOptions(localValue.toObject()));
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void ServerCapabilities::setRenameProvider(std::variant<ServerCapabilities::RenameOptions, bool> renameProvider)
|
||||
@@ -239,7 +242,7 @@ void ServerCapabilities::setRenameProvider(std::variant<ServerCapabilities::Rena
|
||||
insertVariant<RenameOptions, bool>(renameProviderKey, renameProvider);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, JsonObject>> ServerCapabilities::colorProvider() const
|
||||
std::optional<std::variant<bool, JsonObject>> ServerCapabilities::colorProvider() const
|
||||
{
|
||||
using RetType = std::variant<bool, JsonObject>;
|
||||
const QJsonValue &localValue = value(colorProviderKey);
|
||||
@@ -247,7 +250,7 @@ Utils::optional<std::variant<bool, JsonObject>> ServerCapabilities::colorProvide
|
||||
return RetType(localValue.toBool());
|
||||
if (localValue.isObject())
|
||||
return RetType(JsonObject(localValue.toObject()));
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void ServerCapabilities::setColorProvider(std::variant<bool, JsonObject> colorProvider)
|
||||
@@ -255,15 +258,15 @@ void ServerCapabilities::setColorProvider(std::variant<bool, JsonObject> colorPr
|
||||
insertVariant<bool, JsonObject>(renameProviderKey, colorProvider);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<QString, bool> >
|
||||
std::optional<std::variant<QString, bool> >
|
||||
ServerCapabilities::WorkspaceServerCapabilities::WorkspaceFoldersCapabilities::changeNotifications() const
|
||||
{
|
||||
using RetType = std::variant<QString, bool>;
|
||||
const QJsonValue &change = value(changeNotificationsKey);
|
||||
if (change.isUndefined())
|
||||
return Utils::nullopt;
|
||||
return Utils::make_optional(change.isBool() ? RetType(change.toBool())
|
||||
: RetType(change.toString()));
|
||||
return std::nullopt;
|
||||
return std::make_optional(change.isBool() ? RetType(change.toBool())
|
||||
: RetType(change.toString()));
|
||||
}
|
||||
|
||||
void ServerCapabilities::WorkspaceServerCapabilities::WorkspaceFoldersCapabilities::setChangeNotifications(
|
||||
@@ -293,7 +296,7 @@ bool CodeActionOptions::isValid() const
|
||||
return WorkDoneProgressOptions::isValid() && contains(codeActionKindsKey);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, QJsonObject>> SemanticTokensOptions::range() const
|
||||
std::optional<std::variant<bool, QJsonObject>> SemanticTokensOptions::range() const
|
||||
{
|
||||
using RetType = std::variant<bool, QJsonObject>;
|
||||
const QJsonValue &rangeOptions = value(rangeKey);
|
||||
@@ -301,7 +304,7 @@ Utils::optional<std::variant<bool, QJsonObject>> SemanticTokensOptions::range()
|
||||
return RetType(rangeOptions.toBool());
|
||||
if (rangeOptions.isObject())
|
||||
return RetType(rangeOptions.toObject());
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void SemanticTokensOptions::setRange(const std::variant<bool, QJsonObject> &range)
|
||||
@@ -309,7 +312,7 @@ void SemanticTokensOptions::setRange(const std::variant<bool, QJsonObject> &rang
|
||||
insertVariant<bool, QJsonObject>(rangeKey, range);
|
||||
}
|
||||
|
||||
Utils::optional<std::variant<bool, SemanticTokensOptions::FullSemanticTokenOptions>>
|
||||
std::optional<std::variant<bool, SemanticTokensOptions::FullSemanticTokenOptions>>
|
||||
SemanticTokensOptions::full() const
|
||||
{
|
||||
using RetType = std::variant<bool, SemanticTokensOptions::FullSemanticTokenOptions>;
|
||||
@@ -318,7 +321,7 @@ SemanticTokensOptions::full() const
|
||||
return RetType(fullOptions.toBool());
|
||||
if (fullOptions.isObject())
|
||||
return RetType(FullSemanticTokenOptions(fullOptions.toObject()));
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void SemanticTokensOptions::setFull(
|
||||
|
@@ -13,7 +13,7 @@ class LANGUAGESERVERPROTOCOL_EXPORT WorkDoneProgressOptions : public JsonObject
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
Utils::optional<bool> workDoneProgress() const { return optionalValue<bool>(workDoneProgressKey); }
|
||||
std::optional<bool> workDoneProgress() const { return optionalValue<bool>(workDoneProgressKey); }
|
||||
void setWorkDoneProgress(bool workDoneProgress) { insert(workDoneProgressKey, workDoneProgress); }
|
||||
void clearWorkDoneProgress() { remove(workDoneProgressKey); }
|
||||
};
|
||||
@@ -23,7 +23,7 @@ class LANGUAGESERVERPROTOCOL_EXPORT ResolveProviderOption : public JsonObject
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
Utils::optional<bool> resolveProvider() const { return optionalValue<bool>(resolveProviderKey); }
|
||||
std::optional<bool> resolveProvider() const { return optionalValue<bool>(resolveProviderKey); }
|
||||
void setResolveProvider(bool resolveProvider) { insert(resolveProviderKey, resolveProvider); }
|
||||
void clearResolveProvider() { remove(resolveProviderKey); }
|
||||
};
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
// The client is supposed to include the content on save.
|
||||
Utils::optional<bool> includeText() const { return optionalValue<bool>(includeTextKey); }
|
||||
std::optional<bool> includeText() const { return optionalValue<bool>(includeTextKey); }
|
||||
void setIncludeText(bool includeText) { insert(includeTextKey, includeText); }
|
||||
void clearIncludeText() { remove(includeTextKey); }
|
||||
};
|
||||
@@ -61,30 +61,30 @@ public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
// Open and close notifications are sent to the server.
|
||||
Utils::optional<bool> openClose() const { return optionalValue<bool>(openCloseKey); }
|
||||
std::optional<bool> openClose() const { return optionalValue<bool>(openCloseKey); }
|
||||
void setOpenClose(bool openClose) { insert(openCloseKey, openClose); }
|
||||
void clearOpenClose() { remove(openCloseKey); }
|
||||
|
||||
// Change notifications are sent to the server. See TextDocumentSyncKind.None,
|
||||
// TextDocumentSyncKind.Full and TextDocumentSyncKind.Incremental.
|
||||
Utils::optional<int> change() const { return optionalValue<int>(changeKey); }
|
||||
std::optional<int> change() const { return optionalValue<int>(changeKey); }
|
||||
void setChange(int change) { insert(changeKey, change); }
|
||||
void clearChange() { remove(changeKey); }
|
||||
|
||||
// Will save notifications are sent to the server.
|
||||
Utils::optional<bool> willSave() const { return optionalValue<bool>(willSaveKey); }
|
||||
std::optional<bool> willSave() const { return optionalValue<bool>(willSaveKey); }
|
||||
void setWillSave(bool willSave) { insert(willSaveKey, willSave); }
|
||||
void clearWillSave() { remove(willSaveKey); }
|
||||
|
||||
// Will save wait until requests are sent to the server.
|
||||
Utils::optional<bool> willSaveWaitUntil() const
|
||||
std::optional<bool> willSaveWaitUntil() const
|
||||
{ return optionalValue<bool>(willSaveWaitUntilKey); }
|
||||
void setWillSaveWaitUntil(bool willSaveWaitUntil)
|
||||
{ insert(willSaveWaitUntilKey, willSaveWaitUntil); }
|
||||
void clearWillSaveWaitUntil() { remove(willSaveWaitUntilKey); }
|
||||
|
||||
// Save notifications are sent to the server.
|
||||
Utils::optional<SaveOptions> save() const { return optionalValue<SaveOptions>(saveKey); }
|
||||
std::optional<SaveOptions> save() const { return optionalValue<SaveOptions>(saveKey); }
|
||||
void setSave(const SaveOptions &save) { insert(saveKey, save); }
|
||||
void clearSave() { remove(saveKey); }
|
||||
};
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
void setLegend(const SemanticTokensLegend &legend) { insert(legendKey, legend); }
|
||||
|
||||
/// Server supports providing semantic tokens for a specific range of a document.
|
||||
Utils::optional<std::variant<bool, QJsonObject>> range() const;
|
||||
std::optional<std::variant<bool, QJsonObject>> range() const;
|
||||
void setRange(const std::variant<bool, QJsonObject> &range);
|
||||
void clearRange() { remove(rangeKey); }
|
||||
|
||||
@@ -140,13 +140,13 @@ public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
/// The server supports deltas for full documents.
|
||||
Utils::optional<bool> delta() const { return optionalValue<bool>(deltaKey); }
|
||||
std::optional<bool> delta() const { return optionalValue<bool>(deltaKey); }
|
||||
void setDelta(bool delta) { insert(deltaKey, delta); }
|
||||
void clearDelta() { remove(deltaKey); }
|
||||
};
|
||||
|
||||
/// Server supports providing semantic tokens for a full document.
|
||||
Utils::optional<std::variant<bool, FullSemanticTokenOptions>> full() const;
|
||||
std::optional<std::variant<bool, FullSemanticTokenOptions>> full() const;
|
||||
void setFull(const std::variant<bool, FullSemanticTokenOptions> &full);
|
||||
void clearFull() { remove(fullKey); }
|
||||
|
||||
@@ -168,13 +168,13 @@ public:
|
||||
using WorkDoneProgressOptions::WorkDoneProgressOptions;
|
||||
|
||||
// The characters that trigger completion automatically.
|
||||
Utils::optional<QList<QString>> triggerCharacters() const
|
||||
std::optional<QList<QString>> triggerCharacters() const
|
||||
{ return optionalArray<QString>(triggerCharactersKey); }
|
||||
void setTriggerCharacters(const QList<QString> &triggerCharacters)
|
||||
{ insertArray(triggerCharactersKey, triggerCharacters); }
|
||||
void clearTriggerCharacters() { remove(triggerCharactersKey); }
|
||||
|
||||
Utils::optional<bool> resolveProvider() const { return optionalValue<bool>(resolveProviderKey); }
|
||||
std::optional<bool> resolveProvider() const { return optionalValue<bool>(resolveProviderKey); }
|
||||
void setResolveProvider(bool resolveProvider) { insert(resolveProviderKey, resolveProvider); }
|
||||
void clearResolveProvider() { remove(resolveProviderKey); }
|
||||
};
|
||||
@@ -185,7 +185,7 @@ public:
|
||||
using WorkDoneProgressOptions::WorkDoneProgressOptions;
|
||||
|
||||
// The characters that trigger signature help automatically.
|
||||
Utils::optional<QList<QString>> triggerCharacters() const
|
||||
std::optional<QList<QString>> triggerCharacters() const
|
||||
{ return optionalArray<QString>(triggerCharactersKey); }
|
||||
void setTriggerCharacters(const QList<QString> &triggerCharacters)
|
||||
{ insertArray(triggerCharactersKey, triggerCharacters); }
|
||||
@@ -205,7 +205,7 @@ public:
|
||||
{ insert(firstTriggerCharacterKey, firstTriggerCharacter); }
|
||||
|
||||
// More trigger characters.
|
||||
Utils::optional<QList<QString>> moreTriggerCharacter() const
|
||||
std::optional<QList<QString>> moreTriggerCharacter() const
|
||||
{ return optionalArray<QString>(moreTriggerCharacterKey); }
|
||||
void setMoreTriggerCharacter(const QList<QString> &moreTriggerCharacter)
|
||||
{ insertArray(moreTriggerCharacterKey, moreTriggerCharacter); }
|
||||
@@ -236,7 +236,7 @@ public:
|
||||
|
||||
// The id used to register the request. The id can be used to deregister
|
||||
// the request again. See also Registration#id.
|
||||
Utils::optional<QString> id() const { return optionalValue<QString>(idKey); }
|
||||
std::optional<QString> id() const { return optionalValue<QString>(idKey); }
|
||||
void setId(const QString &id) { insert(idKey, id); }
|
||||
void clearId() { remove(idKey); }
|
||||
};
|
||||
@@ -244,33 +244,33 @@ public:
|
||||
// Defines how text documents are synced. Is either a detailed structure defining each
|
||||
// notification or for backwards compatibility the TextDocumentSyncKind number.
|
||||
using TextDocumentSync = std::variant<TextDocumentSyncOptions, int>;
|
||||
Utils::optional<TextDocumentSync> textDocumentSync() const;
|
||||
std::optional<TextDocumentSync> textDocumentSync() const;
|
||||
void setTextDocumentSync(const TextDocumentSync &textDocumentSync);
|
||||
void clearTextDocumentSync() { remove(textDocumentSyncKey); }
|
||||
|
||||
TextDocumentSyncKind textDocumentSyncKindHelper();
|
||||
|
||||
// The server provides hover support.
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>> hoverProvider() const;
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>> hoverProvider() const;
|
||||
void setHoverProvider(const std::variant<bool, WorkDoneProgressOptions> &hoverProvider);
|
||||
void clearHoverProvider() { remove(hoverProviderKey); }
|
||||
|
||||
// The server provides completion support.
|
||||
Utils::optional<CompletionOptions> completionProvider() const
|
||||
std::optional<CompletionOptions> completionProvider() const
|
||||
{ return optionalValue<CompletionOptions>(completionProviderKey); }
|
||||
void setCompletionProvider(const CompletionOptions &completionProvider)
|
||||
{ insert(completionProviderKey, completionProvider); }
|
||||
void clearCompletionProvider() { remove(completionProviderKey); }
|
||||
|
||||
// The server provides signature help support.
|
||||
Utils::optional<SignatureHelpOptions> signatureHelpProvider() const
|
||||
std::optional<SignatureHelpOptions> signatureHelpProvider() const
|
||||
{ return optionalValue<SignatureHelpOptions>(signatureHelpProviderKey); }
|
||||
void setSignatureHelpProvider(const SignatureHelpOptions &signatureHelpProvider)
|
||||
{ insert(signatureHelpProviderKey, signatureHelpProvider); }
|
||||
void clearSignatureHelpProvider() { remove(signatureHelpProviderKey); }
|
||||
|
||||
// The server provides goto definition support.
|
||||
Utils::optional<bool> definitionProvider() const
|
||||
std::optional<bool> definitionProvider() const
|
||||
{ return optionalValue<bool>(definitionProviderKey); }
|
||||
void setDefinitionProvider(bool definitionProvider)
|
||||
{ insert(definitionProviderKey, definitionProvider); }
|
||||
@@ -291,7 +291,7 @@ public:
|
||||
|
||||
// The id used to register the request. The id can be used to deregister
|
||||
// the request again. See also Registration#id.
|
||||
Utils::optional<QString> id() const { return optionalValue<QString>(idKey); }
|
||||
std::optional<QString> id() const { return optionalValue<QString>(idKey); }
|
||||
void setId(const QString &id) { insert(idKey, id); }
|
||||
void clearId() { remove(idKey); }
|
||||
|
||||
@@ -299,42 +299,42 @@ public:
|
||||
};
|
||||
|
||||
// The server provides Goto Type Definition support.
|
||||
Utils::optional<std::variant<bool, RegistrationOptions>> typeDefinitionProvider() const;
|
||||
std::optional<std::variant<bool, RegistrationOptions>> typeDefinitionProvider() const;
|
||||
void setTypeDefinitionProvider(const std::variant<bool, RegistrationOptions> &typeDefinitionProvider);
|
||||
void clearTypeDefinitionProvider() { remove(typeDefinitionProviderKey); }
|
||||
|
||||
// The server provides Goto Implementation support.
|
||||
Utils::optional<std::variant<bool, RegistrationOptions>> implementationProvider() const;
|
||||
std::optional<std::variant<bool, RegistrationOptions>> implementationProvider() const;
|
||||
void setImplementationProvider(const std::variant<bool, RegistrationOptions> &implementationProvider);
|
||||
void clearImplementationProvider() { remove(implementationProviderKey); }
|
||||
|
||||
// The server provides find references support.
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>> referencesProvider() const;
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>> referencesProvider() const;
|
||||
void setReferencesProvider(const std::variant<bool, WorkDoneProgressOptions> &referencesProvider);
|
||||
void clearReferencesProvider() { remove(referencesProviderKey); }
|
||||
|
||||
// The server provides document highlight support.
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>> documentHighlightProvider() const;
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>> documentHighlightProvider() const;
|
||||
void setDocumentHighlightProvider(
|
||||
const std::variant<bool, WorkDoneProgressOptions> &documentHighlightProvider);
|
||||
void clearDocumentHighlightProvider() { remove(documentHighlightProviderKey); }
|
||||
|
||||
// The server provides document symbol support.
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>> documentSymbolProvider() const;
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>> documentSymbolProvider() const;
|
||||
void setDocumentSymbolProvider(std::variant<bool, WorkDoneProgressOptions> documentSymbolProvider);
|
||||
void clearDocumentSymbolProvider() { remove(documentSymbolProviderKey); }
|
||||
|
||||
Utils::optional<SemanticTokensOptions> semanticTokensProvider() const;
|
||||
std::optional<SemanticTokensOptions> semanticTokensProvider() const;
|
||||
void setSemanticTokensProvider(const SemanticTokensOptions &semanticTokensProvider);
|
||||
void clearSemanticTokensProvider() { remove(semanticTokensProviderKey); }
|
||||
|
||||
// The server provides workspace symbol support.
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>> workspaceSymbolProvider() const;
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>> workspaceSymbolProvider() const;
|
||||
void setWorkspaceSymbolProvider(std::variant<bool, WorkDoneProgressOptions> workspaceSymbolProvider);
|
||||
void clearWorkspaceSymbolProvider() { remove(workspaceSymbolProviderKey); }
|
||||
|
||||
// The server provides code actions.
|
||||
Utils::optional<std::variant<bool, CodeActionOptions>> codeActionProvider() const;
|
||||
std::optional<std::variant<bool, CodeActionOptions>> codeActionProvider() const;
|
||||
void setCodeActionProvider(bool codeActionProvider)
|
||||
{ insert(codeActionProviderKey, codeActionProvider); }
|
||||
void setCodeActionProvider(CodeActionOptions options)
|
||||
@@ -342,20 +342,20 @@ public:
|
||||
void clearCodeActionProvider() { remove(codeActionProviderKey); }
|
||||
|
||||
// The server provides code lens.
|
||||
Utils::optional<CodeLensOptions> codeLensProvider() const
|
||||
std::optional<CodeLensOptions> codeLensProvider() const
|
||||
{ return optionalValue<CodeLensOptions>(codeLensProviderKey); }
|
||||
void setCodeLensProvider(CodeLensOptions codeLensProvider)
|
||||
{ insert(codeLensProviderKey, codeLensProvider); }
|
||||
void clearCodeLensProvider() { remove(codeLensProviderKey); }
|
||||
|
||||
// The server provides document formatting.
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>> documentFormattingProvider() const;
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>> documentFormattingProvider() const;
|
||||
void setDocumentFormattingProvider(
|
||||
const std::variant<bool, WorkDoneProgressOptions> &documentFormattingProvider);
|
||||
void clearDocumentFormattingProvider() { remove(documentFormattingProviderKey); }
|
||||
|
||||
// The server provides document formatting on typing.
|
||||
Utils::optional<std::variant<bool, WorkDoneProgressOptions>> documentRangeFormattingProvider() const;
|
||||
std::optional<std::variant<bool, WorkDoneProgressOptions>> documentRangeFormattingProvider() const;
|
||||
void setDocumentRangeFormattingProvider(std::variant<bool, WorkDoneProgressOptions> documentRangeFormattingProvider);
|
||||
void clearDocumentRangeFormattingProvider() { remove(documentRangeFormattingProviderKey); }
|
||||
|
||||
@@ -365,30 +365,30 @@ public:
|
||||
using WorkDoneProgressOptions::WorkDoneProgressOptions;
|
||||
|
||||
// Renames should be checked and tested before being executed.
|
||||
Utils::optional<bool> prepareProvider() const { return optionalValue<bool>(prepareProviderKey); }
|
||||
std::optional<bool> prepareProvider() const { return optionalValue<bool>(prepareProviderKey); }
|
||||
void setPrepareProvider(bool prepareProvider) { insert(prepareProviderKey, prepareProvider); }
|
||||
void clearPrepareProvider() { remove(prepareProviderKey); }
|
||||
};
|
||||
|
||||
// The server provides rename support.
|
||||
Utils::optional<std::variant<RenameOptions, bool>> renameProvider() const;
|
||||
std::optional<std::variant<RenameOptions, bool>> renameProvider() const;
|
||||
void setRenameProvider(std::variant<RenameOptions,bool> renameProvider);
|
||||
void clearRenameProvider() { remove(renameProviderKey); }
|
||||
|
||||
// The server provides document link support.
|
||||
Utils::optional<DocumentLinkOptions> documentLinkProvider() const
|
||||
std::optional<DocumentLinkOptions> documentLinkProvider() const
|
||||
{ return optionalValue<DocumentLinkOptions>(documentLinkProviderKey); }
|
||||
void setDocumentLinkProvider(const DocumentLinkOptions &documentLinkProvider)
|
||||
{ insert(documentLinkProviderKey, documentLinkProvider); }
|
||||
void clearDocumentLinkProvider() { remove(documentLinkProviderKey); }
|
||||
|
||||
// The server provides color provider support.
|
||||
Utils::optional<std::variant<bool, JsonObject>> colorProvider() const;
|
||||
std::optional<std::variant<bool, JsonObject>> colorProvider() const;
|
||||
void setColorProvider(std::variant<bool, JsonObject> colorProvider);
|
||||
void clearColorProvider() { remove(colorProviderKey); }
|
||||
|
||||
// The server provides execute command support.
|
||||
Utils::optional<ExecuteCommandOptions> executeCommandProvider() const
|
||||
std::optional<ExecuteCommandOptions> executeCommandProvider() const
|
||||
{ return optionalValue<ExecuteCommandOptions>(executeCommandProviderKey); }
|
||||
void setExecuteCommandProvider(ExecuteCommandOptions executeCommandProvider)
|
||||
{ insert(executeCommandProviderKey, executeCommandProvider); }
|
||||
@@ -405,29 +405,29 @@ public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
// The server has support for workspace folders
|
||||
Utils::optional<bool> supported() const { return optionalValue<bool>(supportedKey); }
|
||||
std::optional<bool> supported() const { return optionalValue<bool>(supportedKey); }
|
||||
void setSupported(bool supported) { insert(supportedKey, supported); }
|
||||
void clearSupported() { remove(supportedKey); }
|
||||
|
||||
Utils::optional<std::variant<QString, bool>> changeNotifications() const;
|
||||
std::optional<std::variant<QString, bool>> changeNotifications() const;
|
||||
void setChangeNotifications(std::variant<QString, bool> changeNotifications);
|
||||
void clearChangeNotifications() { remove(changeNotificationsKey); }
|
||||
};
|
||||
|
||||
Utils::optional<WorkspaceFoldersCapabilities> workspaceFolders() const
|
||||
std::optional<WorkspaceFoldersCapabilities> workspaceFolders() const
|
||||
{ return optionalValue<WorkspaceFoldersCapabilities>(workspaceFoldersKey); }
|
||||
void setWorkspaceFolders(const WorkspaceFoldersCapabilities &workspaceFolders)
|
||||
{ insert(workspaceFoldersKey, workspaceFolders); }
|
||||
void clearWorkspaceFolders() { remove(workspaceFoldersKey); }
|
||||
};
|
||||
|
||||
Utils::optional<WorkspaceServerCapabilities> workspace() const
|
||||
std::optional<WorkspaceServerCapabilities> workspace() const
|
||||
{ return optionalValue<WorkspaceServerCapabilities>(workspaceKey); }
|
||||
void setWorkspace(const WorkspaceServerCapabilities &workspace)
|
||||
{ insert(workspaceKey, workspace); }
|
||||
void clearWorkspace() { remove(workspaceKey); }
|
||||
|
||||
Utils::optional<JsonObject> experimental() const { return optionalValue<JsonObject>(experimentalKey); }
|
||||
std::optional<JsonObject> experimental() const { return optionalValue<JsonObject>(experimentalKey); }
|
||||
void setExperimental(const JsonObject &experimental) { insert(experimentalKey, experimental); }
|
||||
void clearExperimental() { remove(experimentalKey); }
|
||||
};
|
||||
|
@@ -70,12 +70,12 @@ public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
// The range of the document that changed.
|
||||
Utils::optional<Range> range() const { return optionalValue<Range>(rangeKey); }
|
||||
std::optional<Range> range() const { return optionalValue<Range>(rangeKey); }
|
||||
void setRange(Range range) { insert(rangeKey, range); }
|
||||
void clearRange() { remove(rangeKey); }
|
||||
|
||||
// The length of the range that got replaced.
|
||||
Utils::optional<int> rangeLength() const { return optionalValue<int>(rangeLengthKey); }
|
||||
std::optional<int> rangeLength() const { return optionalValue<int>(rangeLengthKey); }
|
||||
void setRangeLength(int rangeLength) { insert(rangeLengthKey, rangeLength); }
|
||||
void clearRangeLength() { remove(rangeLengthKey); }
|
||||
|
||||
@@ -155,7 +155,7 @@ class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentSaveRegistrationOptions
|
||||
public:
|
||||
using TextDocumentRegistrationOptions::TextDocumentRegistrationOptions;
|
||||
|
||||
Utils::optional<bool> includeText() const { return optionalValue<bool>(includeTextKey); }
|
||||
std::optional<bool> includeText() const { return optionalValue<bool>(includeTextKey); }
|
||||
void setIncludeText(bool includeText) { insert(includeTextKey, includeText); }
|
||||
void clearIncludeText() { remove(includeTextKey); }
|
||||
};
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
void setTextDocument(TextDocumentIdentifier textDocument)
|
||||
{ insert(textDocumentKey, textDocument); }
|
||||
|
||||
Utils::optional<QString> text() const { return optionalValue<QString>(textKey); }
|
||||
std::optional<QString> text() const { return optionalValue<QString>(textKey); }
|
||||
void setText(const QString &text) { insert(textKey, text); }
|
||||
void clearText() { remove(textKey); }
|
||||
|
||||
|
@@ -92,11 +92,11 @@ public:
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
Utils::optional<QString> scopeUri() const { return optionalValue<QString>(scopeUriKey); }
|
||||
std::optional<QString> scopeUri() const { return optionalValue<QString>(scopeUriKey); }
|
||||
void setScopeUri(const QString &scopeUri) { insert(scopeUriKey, scopeUri); }
|
||||
void clearScopeUri() { remove(scopeUriKey); }
|
||||
|
||||
Utils::optional<QString> section() const { return optionalValue<QString>(sectionKey); }
|
||||
std::optional<QString> section() const { return optionalValue<QString>(sectionKey); }
|
||||
void setSection(const QString §ion) { insert(sectionKey, section); }
|
||||
void clearSection() { remove(sectionKey); }
|
||||
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
void setCommand(const QString &command) { insert(commandKey, command); }
|
||||
void clearCommand() { remove(commandKey); }
|
||||
|
||||
Utils::optional<QJsonArray> arguments() const { return typedValue<QJsonArray>(argumentsKey); }
|
||||
std::optional<QJsonArray> arguments() const { return typedValue<QJsonArray>(argumentsKey); }
|
||||
void setArguments(const QJsonArray &arguments) { insert(argumentsKey, arguments); }
|
||||
void clearArguments() { remove(argumentsKey); }
|
||||
|
||||
@@ -212,7 +212,7 @@ class LANGUAGESERVERPROTOCOL_EXPORT ApplyWorkspaceEditParams : public JsonObject
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
Utils::optional<QString> label() const { return optionalValue<QString>(labelKey); }
|
||||
std::optional<QString> label() const { return optionalValue<QString>(labelKey); }
|
||||
void setLabel(const QString &label) { insert(labelKey, label); }
|
||||
void clearLabel() { remove(labelKey); }
|
||||
|
||||
|
@@ -3,9 +3,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/optional.h>
|
||||
#include <utils/smallstringview.h>
|
||||
|
||||
#include <optional>
|
||||
#include <type_traits>
|
||||
|
||||
namespace Sqlite {
|
||||
@@ -34,7 +34,7 @@ void insertUpdateDelete(SqliteRange &&sqliteRange,
|
||||
auto endSqliteIterator = sqliteRange.end();
|
||||
auto currentValueIterator = values.begin();
|
||||
auto endValueIterator = values.end();
|
||||
Utils::optional<std::decay_t<decltype(*currentValueIterator)>> lastValue;
|
||||
std::optional<std::decay_t<decltype(*currentValueIterator)>> lastValue;
|
||||
|
||||
while (true) {
|
||||
bool hasMoreValues = currentValueIterator != endValueIterator;
|
||||
|
@@ -14,13 +14,13 @@
|
||||
|
||||
#include <utils/smallstringvector.h>
|
||||
|
||||
#include <utils/optional.h>
|
||||
#include <utils/span.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <exception>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -225,12 +225,12 @@ public:
|
||||
auto optionalValue(const QueryTypes &...queryValues)
|
||||
{
|
||||
Resetter resetter{this};
|
||||
Utils::optional<ResultType> resultValue;
|
||||
std::optional<ResultType> resultValue;
|
||||
|
||||
bindValues(queryValues...);
|
||||
|
||||
if (BaseStatement::next())
|
||||
resultValue = createOptionalValue<Utils::optional<ResultType>>();
|
||||
resultValue = createOptionalValue<std::optional<ResultType>>();
|
||||
|
||||
return resultValue;
|
||||
}
|
||||
@@ -495,7 +495,7 @@ private:
|
||||
template<typename ResultOptionalType, int... ColumnIndices>
|
||||
ResultOptionalType createOptionalValue(std::integer_sequence<int, ColumnIndices...>)
|
||||
{
|
||||
return ResultOptionalType(Utils::in_place, ValueGetter(*this, ColumnIndices)...);
|
||||
return ResultOptionalType(std::in_place, ValueGetter(*this, ColumnIndices)...);
|
||||
}
|
||||
|
||||
template<typename ResultOptionalType>
|
||||
|
@@ -4,7 +4,6 @@ add_qtc_library(Utils
|
||||
Qt5::Concurrent Qt5::Core Qt5::Network Qt5::Gui Qt5::Widgets
|
||||
Qt6Core5Compat
|
||||
SOURCES
|
||||
../3rdparty/optional/optional.hpp
|
||||
../3rdparty/span/span.hpp
|
||||
QtConcurrentTools
|
||||
algorithm.h
|
||||
@@ -103,7 +102,6 @@ add_qtc_library(Utils
|
||||
namevaluevalidator.cpp namevaluevalidator.h
|
||||
navigationtreeview.cpp navigationtreeview.h
|
||||
networkaccessmanager.cpp networkaccessmanager.h
|
||||
optional.h
|
||||
osspecificaspects.h
|
||||
outputformat.h
|
||||
outputformatter.cpp outputformatter.h
|
||||
|
@@ -4,7 +4,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "predicates.h"
|
||||
#include "optional.h"
|
||||
|
||||
#include <qcompilerdetection.h> // for Q_REQUIRED_RESULT
|
||||
|
||||
@@ -22,6 +21,7 @@
|
||||
#include <QStringList>
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <type_traits>
|
||||
|
||||
namespace Utils
|
||||
@@ -187,7 +187,7 @@ auto toConstReferences(const SourceContainer &sources);
|
||||
// take
|
||||
/////////////////////////
|
||||
template<class C, typename P>
|
||||
Q_REQUIRED_RESULT optional<typename C::value_type> take(C &container, P predicate);
|
||||
Q_REQUIRED_RESULT std::optional<typename C::value_type> take(C &container, P predicate);
|
||||
template<typename C, typename R, typename S>
|
||||
Q_REQUIRED_RESULT decltype(auto) take(C &container, R S::*member);
|
||||
template<typename C, typename R, typename S>
|
||||
@@ -1066,15 +1066,15 @@ auto toConstReferences(const SourceContainer &sources)
|
||||
/////////////////
|
||||
|
||||
template<class C, typename P>
|
||||
Q_REQUIRED_RESULT optional<typename C::value_type> take(C &container, P predicate)
|
||||
Q_REQUIRED_RESULT std::optional<typename C::value_type> take(C &container, P predicate)
|
||||
{
|
||||
const auto end = std::end(container);
|
||||
|
||||
const auto it = std::find_if(std::begin(container), end, predicate);
|
||||
if (it == end)
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
|
||||
optional<typename C::value_type> result = Utils::make_optional(std::move(*it));
|
||||
std::optional<typename C::value_type> result = std::make_optional(std::move(*it));
|
||||
container.erase(it);
|
||||
return result;
|
||||
}
|
||||
|
@@ -89,20 +89,20 @@ static QVector<Tool> toolsForFilePath(const FilePath &fp)
|
||||
return toolsForMimeType(mimeTypeForFile(fp));
|
||||
}
|
||||
|
||||
static Utils::optional<Tool> resolveTool(const Tool &tool)
|
||||
static std::optional<Tool> resolveTool(const Tool &tool)
|
||||
{
|
||||
const FilePath executable =
|
||||
tool.command.executable().withExecutableSuffix().searchInPath(tool.additionalSearchDirs);
|
||||
Tool resolvedTool = tool;
|
||||
resolvedTool.command.setExecutable(executable);
|
||||
return executable.isEmpty() ? Utils::nullopt : Utils::make_optional(resolvedTool);
|
||||
return executable.isEmpty() ? std::nullopt : std::make_optional(resolvedTool);
|
||||
}
|
||||
|
||||
static Utils::optional<Tool> unzipTool(const FilePath &src, const FilePath &dest)
|
||||
static std::optional<Tool> unzipTool(const FilePath &src, const FilePath &dest)
|
||||
{
|
||||
const QVector<Tool> tools = toolsForFilePath(src);
|
||||
for (const Tool &tool : tools) {
|
||||
const Utils::optional<Tool> resolvedTool = resolveTool(tool);
|
||||
const std::optional<Tool> resolvedTool = resolveTool(tool);
|
||||
if (resolvedTool) {
|
||||
Tool result = *resolvedTool;
|
||||
const QString srcStr = src.toString();
|
||||
@@ -138,7 +138,7 @@ bool Archive::supportsFile(const FilePath &filePath, QString *reason)
|
||||
|
||||
Archive::Archive(const FilePath &src, const FilePath &dest)
|
||||
{
|
||||
const Utils::optional<Tool> tool = unzipTool(src, dest);
|
||||
const std::optional<Tool> tool = unzipTool(src, dest);
|
||||
if (!tool)
|
||||
return;
|
||||
m_commandLine = tool->command;
|
||||
|
@@ -656,8 +656,8 @@ public:
|
||||
class IntegerAspectPrivate
|
||||
{
|
||||
public:
|
||||
Utils::optional<qint64> m_minimumValue;
|
||||
Utils::optional<qint64> m_maximumValue;
|
||||
std::optional<qint64> m_minimumValue;
|
||||
std::optional<qint64> m_maximumValue;
|
||||
int m_displayIntegerBase = 10;
|
||||
qint64 m_displayScaleFactor = 1;
|
||||
QString m_prefix;
|
||||
@@ -670,8 +670,8 @@ public:
|
||||
class DoubleAspectPrivate
|
||||
{
|
||||
public:
|
||||
Utils::optional<double> m_minimumValue;
|
||||
Utils::optional<double> m_maximumValue;
|
||||
std::optional<double> m_minimumValue;
|
||||
std::optional<double> m_maximumValue;
|
||||
QString m_prefix;
|
||||
QString m_suffix;
|
||||
QString m_specialValueText;
|
||||
@@ -784,7 +784,7 @@ void StringAspect::setValue(const QString &val)
|
||||
|
||||
QString processedValue = val;
|
||||
if (d->m_valueAcceptor) {
|
||||
const Utils::optional<QString> tmp = d->m_valueAcceptor(value(), val);
|
||||
const std::optional<QString> tmp = d->m_valueAcceptor(value(), val);
|
||||
if (!tmp) {
|
||||
update(); // Make sure the original value is retained in the UI
|
||||
return;
|
||||
|
@@ -7,11 +7,11 @@
|
||||
#include "id.h"
|
||||
#include "infolabel.h"
|
||||
#include "macroexpander.h"
|
||||
#include "optional.h"
|
||||
#include "pathchooser.h"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
@@ -337,7 +337,7 @@ public:
|
||||
void emitChangedValue() override;
|
||||
|
||||
// Hook between UI and StringAspect:
|
||||
using ValueAcceptor = std::function<Utils::optional<QString>(const QString &, const QString &)>;
|
||||
using ValueAcceptor = std::function<std::optional<QString>(const QString &, const QString &)>;
|
||||
void setValueAcceptor(ValueAcceptor &&acceptor);
|
||||
QString value() const;
|
||||
void setValue(const QString &val);
|
||||
|
@@ -406,12 +406,12 @@ const QVector<EnvironmentProvider> EnvironmentProvider::providers()
|
||||
return *environmentProviders;
|
||||
}
|
||||
|
||||
optional<EnvironmentProvider> EnvironmentProvider::provider(const QByteArray &id)
|
||||
std::optional<EnvironmentProvider> EnvironmentProvider::provider(const QByteArray &id)
|
||||
{
|
||||
const int index = indexOf(*environmentProviders, equal(&EnvironmentProvider::id, id));
|
||||
if (index >= 0)
|
||||
return make_optional(environmentProviders->at(index));
|
||||
return nullopt;
|
||||
return std::make_optional(environmentProviders->at(index));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void EnvironmentChange::addSetValue(const QString &key, const QString &value)
|
||||
|
@@ -8,9 +8,9 @@
|
||||
#include "environmentfwd.h"
|
||||
#include "filepath.h"
|
||||
#include "namevaluedictionary.h"
|
||||
#include "optional.h"
|
||||
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QProcessEnvironment;
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
|
||||
static void addProvider(EnvironmentProvider &&provider);
|
||||
static const QVector<EnvironmentProvider> providers();
|
||||
static optional<EnvironmentProvider> provider(const QByteArray &id);
|
||||
static std::optional<EnvironmentProvider> provider(const QByteArray &id);
|
||||
};
|
||||
|
||||
QTCREATOR_UTILS_EXPORT QString qtcEnvironmentVariable(const QString &key);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace Utils {
|
||||
|
||||
Utils::optional<EnvironmentItems> EnvironmentDialog::getEnvironmentItems(
|
||||
std::optional<EnvironmentItems> EnvironmentDialog::getEnvironmentItems(
|
||||
QWidget *parent, const EnvironmentItems &initial, const QString &placeholderText, Polisher polisher)
|
||||
{
|
||||
return getNameValueItems(
|
||||
|
@@ -15,7 +15,7 @@ class QTCREATOR_UTILS_EXPORT EnvironmentDialog : public NameValuesDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static Utils::optional<EnvironmentItems> getEnvironmentItems(QWidget *parent = nullptr,
|
||||
static std::optional<EnvironmentItems> getEnvironmentItems(QWidget *parent = nullptr,
|
||||
const EnvironmentItems &initial = {},
|
||||
const QString &placeholderText = {},
|
||||
Polisher polish = {});
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#include "execmenu.h"
|
||||
#include "historycompleter.h"
|
||||
#include "hostosinfo.h"
|
||||
#include "optional.h"
|
||||
#include "qtcassert.h"
|
||||
#include "utilsicons.h"
|
||||
|
||||
@@ -22,6 +21,8 @@
|
||||
#include <QValidator>
|
||||
#include <QWindow>
|
||||
|
||||
#include <optional>
|
||||
|
||||
/*!
|
||||
\class Utils::FancyLineEdit
|
||||
|
||||
@@ -202,7 +203,7 @@ FancyLineEdit::~FancyLineEdit()
|
||||
|
||||
void FancyLineEdit::setTextKeepingActiveCursor(const QString &text)
|
||||
{
|
||||
optional<int> cursor = hasFocus() ? make_optional(cursorPosition()) : nullopt;
|
||||
std::optional<int> cursor = hasFocus() ? std::make_optional(cursorPosition()) : std::nullopt;
|
||||
setText(text);
|
||||
if (cursor)
|
||||
setCursorPosition(*cursor);
|
||||
|
@@ -767,7 +767,7 @@ bool isWindowsDriveLetter(QChar ch) {
|
||||
|
||||
using RootAndPath = QPair<QStringView, QStringView>;
|
||||
|
||||
optional<RootAndPath> windowsRootAndPath(const QStringView path)
|
||||
std::optional<RootAndPath> windowsRootAndPath(const QStringView path)
|
||||
{
|
||||
const QChar slash('/');
|
||||
QStringView workPath = path;
|
||||
@@ -799,7 +799,9 @@ optional<RootAndPath> windowsRootAndPath(const QStringView path)
|
||||
|
||||
void FilePath::setRootAndPath(QStringView path, OsType osType)
|
||||
{
|
||||
optional<RootAndPath> windowsDriveAndPath = osType == OsType::OsTypeWindows ? windowsRootAndPath(path) : nullopt;
|
||||
std::optional<RootAndPath> windowsDriveAndPath = osType == OsType::OsTypeWindows
|
||||
? windowsRootAndPath(path)
|
||||
: std::nullopt;
|
||||
|
||||
if (path.startsWith(QLatin1String("/./"))) {
|
||||
m_root = "";
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/mimeutils.h>
|
||||
#include <utils/optional.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QApplication>
|
||||
@@ -20,6 +19,7 @@
|
||||
#include <QIcon>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
#include <optional>
|
||||
#include <variant>
|
||||
|
||||
using namespace Utils;
|
||||
@@ -49,7 +49,7 @@ using Item = std::variant<QIcon, QString>; // icon or filename for the icon
|
||||
namespace Utils {
|
||||
namespace FileIconProvider {
|
||||
|
||||
static Utils::optional<QIcon> getIcon(QHash<QString, Item> &cache, const QString &key)
|
||||
static std::optional<QIcon> getIcon(QHash<QString, Item> &cache, const QString &key)
|
||||
{
|
||||
auto it = cache.constFind(key);
|
||||
if (it == cache.constEnd())
|
||||
@@ -188,14 +188,14 @@ QIcon FileIconProviderImplementation::icon(const FilePath &filePath) const
|
||||
// Check for cached overlay icons by file suffix.
|
||||
const QString filename = !isDir ? filePath.fileName() : QString();
|
||||
if (!filename.isEmpty()) {
|
||||
const Utils::optional<QIcon> icon = getIcon(m_filenameCache, filename);
|
||||
const std::optional<QIcon> icon = getIcon(m_filenameCache, filename);
|
||||
if (icon)
|
||||
return *icon;
|
||||
}
|
||||
|
||||
const QString suffix = !isDir ? filePath.suffix() : QString();
|
||||
if (!suffix.isEmpty()) {
|
||||
const Utils::optional<QIcon> icon = getIcon(m_suffixCache, suffix);
|
||||
const std::optional<QIcon> icon = getIcon(m_suffixCache, suffix);
|
||||
if (icon)
|
||||
return *icon;
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ bool HostOsInfo::canCreateOpenGLContext(QString *errorMessage)
|
||||
#endif
|
||||
}
|
||||
|
||||
optional<quint64> HostOsInfo::totalMemoryInstalledInBytes()
|
||||
std::optional<quint64> HostOsInfo::totalMemoryInstalledInBytes()
|
||||
{
|
||||
#ifdef Q_OS_LINUX
|
||||
struct sysinfo info;
|
||||
|
@@ -5,9 +5,10 @@
|
||||
|
||||
#include "utils_global.h"
|
||||
|
||||
#include "optional.h"
|
||||
#include "osspecificaspects.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QString;
|
||||
QT_END_NAMESPACE
|
||||
@@ -83,7 +84,7 @@ public:
|
||||
|
||||
static bool canCreateOpenGLContext(QString *errorMessage);
|
||||
|
||||
static optional<quint64> totalMemoryInstalledInBytes();
|
||||
static std::optional<quint64> totalMemoryInstalledInBytes();
|
||||
|
||||
private:
|
||||
static Qt::CaseSensitivity m_overrideFileNameCaseSensitivity;
|
||||
|
@@ -5,12 +5,13 @@
|
||||
|
||||
#include "utils_global.h"
|
||||
|
||||
#include "optional.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
|
||||
#include <optional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLayout;
|
||||
class QWidget;
|
||||
@@ -143,7 +144,7 @@ protected:
|
||||
|
||||
LayoutItems m_items;
|
||||
LayoutType m_layoutType;
|
||||
Utils::optional<int> m_spacing;
|
||||
std::optional<int> m_spacing;
|
||||
};
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT LayoutExtender : public LayoutBuilder
|
||||
|
@@ -5,10 +5,10 @@
|
||||
|
||||
#include "utils_global.h"
|
||||
|
||||
#include "optional.h"
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace Utils {
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT LineColumn
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
int column = -1;
|
||||
};
|
||||
|
||||
using OptionalLineColumn = optional<LineColumn>;
|
||||
using OptionalLineColumn = std::optional<LineColumn>;
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
|
@@ -106,7 +106,7 @@ void NameValuesDialog::setPlaceholderText(const QString &text)
|
||||
m_editor->setPlaceholderText(text);
|
||||
}
|
||||
|
||||
Utils::optional<NameValueItems> NameValuesDialog::getNameValueItems(QWidget *parent,
|
||||
std::optional<NameValueItems> NameValuesDialog::getNameValueItems(QWidget *parent,
|
||||
const NameValueItems &initial,
|
||||
const QString &placeholderText,
|
||||
Polisher polisher,
|
||||
|
@@ -6,12 +6,12 @@
|
||||
#include "utils_global.h"
|
||||
|
||||
#include "namevalueitem.h"
|
||||
#include "optional.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPlainTextEdit;
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
void setPlaceholderText(const QString &text);
|
||||
|
||||
using Polisher = std::function<void(QWidget *)>;
|
||||
static Utils::optional<NameValueItems> getNameValueItems(QWidget *parent = nullptr,
|
||||
static std::optional<NameValueItems> getNameValueItems(QWidget *parent = nullptr,
|
||||
const NameValueItems &initial = {},
|
||||
const QString &placeholderText = {},
|
||||
Polisher polish = {},
|
||||
|
@@ -1,77 +0,0 @@
|
||||
// Copyright (C) 2017 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
optional<T>
|
||||
make_optional(t)
|
||||
|
||||
See std(::experimental)::optional.
|
||||
*/
|
||||
|
||||
// std::optional from Apple's Clang supports methods that throw std::bad_optional_access only
|
||||
// with deployment target >= macOS 10.14
|
||||
// TODO: Use std::optional everywhere when we can require macOS 10.14
|
||||
#if !defined(__apple_build_version__)
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace Utils {
|
||||
|
||||
using std::optional;
|
||||
using std::nullopt;
|
||||
using std::nullopt_t;
|
||||
using std::in_place;
|
||||
|
||||
// make_optional is a copy, since there is no sensible way to import functions in C++
|
||||
template<class T>
|
||||
constexpr optional<std::decay_t<T>> make_optional(T &&v)
|
||||
{
|
||||
return optional<std::decay_t<T>>(std::forward<T>(v));
|
||||
}
|
||||
|
||||
template<class T, class... Args>
|
||||
optional<T> make_optional(Args &&... args)
|
||||
{
|
||||
return optional<T>(in_place, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<class T, class Up, class... Args>
|
||||
constexpr optional<T> make_optional(std::initializer_list<Up> il, Args &&... args)
|
||||
{
|
||||
return optional<T>(in_place, il, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
#else
|
||||
|
||||
#include <3rdparty/optional/optional.hpp>
|
||||
|
||||
namespace Utils {
|
||||
|
||||
// --> Utils::optional
|
||||
using std::experimental::optional;
|
||||
// --> Utils::nullopt
|
||||
using std::experimental::nullopt;
|
||||
using std::experimental::nullopt_t;
|
||||
// --> Utils::in_place
|
||||
using std::experimental::in_place;
|
||||
|
||||
// TODO: make_optional is a copy, since there is no sensible way to import functions in C++
|
||||
template <class T>
|
||||
constexpr optional<typename std::decay<T>::type> make_optional(T&& v)
|
||||
{
|
||||
return optional<typename std::decay<T>::type>(std::experimental::constexpr_forward<T>(v));
|
||||
}
|
||||
|
||||
template <class X>
|
||||
constexpr optional<X&> make_optional(std::reference_wrapper<X> v)
|
||||
{
|
||||
return optional<X&>(v.get());
|
||||
}
|
||||
|
||||
} // Utils
|
||||
|
||||
#endif
|
@@ -197,7 +197,7 @@ public:
|
||||
QTextCursor cursor;
|
||||
AnsiEscapeCodeHandler escapeCodeHandler;
|
||||
QPair<QString, OutputFormat> incompleteLine;
|
||||
optional<QTextCharFormat> formatOverride;
|
||||
std::optional<QTextCharFormat> formatOverride;
|
||||
QList<OutputLineParser *> lineParsers;
|
||||
OutputLineParser *nextParser = nullptr;
|
||||
FileInProjectFinder fileFinder;
|
||||
|
@@ -6,12 +6,12 @@
|
||||
#include "utils_global.h"
|
||||
|
||||
#include "filepath.h"
|
||||
#include "optional.h"
|
||||
#include "outputformat.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPlainTextEdit;
|
||||
@@ -44,13 +44,19 @@ public:
|
||||
using LinkSpecs = QList<LinkSpec>;
|
||||
class Result {
|
||||
public:
|
||||
Result(Status s, const LinkSpecs &l = {}, const optional<QString> &c = {},
|
||||
const optional<OutputFormat> &f = {})
|
||||
: status(s), linkSpecs(l), newContent(c), formatOverride(f) {}
|
||||
Result(Status s,
|
||||
const LinkSpecs &l = {},
|
||||
const std::optional<QString> &c = {},
|
||||
const std::optional<OutputFormat> &f = {})
|
||||
: status(s)
|
||||
, linkSpecs(l)
|
||||
, newContent(c)
|
||||
, formatOverride(f)
|
||||
{}
|
||||
Status status;
|
||||
LinkSpecs linkSpecs;
|
||||
optional<QString> newContent; // Hard content override. Only to be used in extreme cases.
|
||||
optional<OutputFormat> formatOverride;
|
||||
std::optional<QString> newContent; // Hard content override. Only to be used in extreme cases.
|
||||
std::optional<OutputFormat> formatOverride;
|
||||
};
|
||||
|
||||
static bool isLinkTarget(const QString &target);
|
||||
|
@@ -253,13 +253,13 @@ auto toRawPointer(const SourceContainer &sources)
|
||||
// take:
|
||||
/////////////////
|
||||
template<typename C>
|
||||
Q_REQUIRED_RESULT optional<ValueType<C>> take(C &container, PointerType<C> p)
|
||||
Q_REQUIRED_RESULT std::optional<ValueType<C>> take(C &container, PointerType<C> p)
|
||||
{
|
||||
return take(container, [p](const ValueType<C> &v) { return v.get() == p; });
|
||||
}
|
||||
|
||||
template <typename C>
|
||||
Q_REQUIRED_RESULT optional<ValueType<C>> take(C &container, std::nullptr_t)
|
||||
template<typename C>
|
||||
Q_REQUIRED_RESULT std::optional<ValueType<C>> take(C &container, std::nullptr_t)
|
||||
{
|
||||
return take(container, static_cast<PointerType<C>>(nullptr));
|
||||
}
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#include "utils_global.h"
|
||||
|
||||
#include "functiontraits.h"
|
||||
#include "optional.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QFuture>
|
||||
@@ -17,6 +16,7 @@
|
||||
#include <QThreadPool>
|
||||
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
|
||||
// hasCallOperator & Co must be outside of any namespace
|
||||
// because of internal compiler error with MSVC2015 Update 2
|
||||
@@ -38,7 +38,7 @@ struct hasCallOperator
|
||||
|
||||
namespace Utils {
|
||||
|
||||
using StackSizeInBytes = optional<uint>;
|
||||
using StackSizeInBytes = std::optional<uint>;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
|
@@ -68,7 +68,7 @@ QVariantMap SettingsAccessor::restoreSettings(QWidget *parent) const
|
||||
*/
|
||||
bool SettingsAccessor::saveSettings(const QVariantMap &data, QWidget *parent) const
|
||||
{
|
||||
const optional<Issue> result = writeData(m_baseFilePath, data, parent);
|
||||
const std::optional<Issue> result = writeData(m_baseFilePath, data, parent);
|
||||
|
||||
const ProceedInfo pi = result ? reportIssues(result.value(), m_baseFilePath, parent) : ProceedInfo::Continue;
|
||||
return pi == ProceedInfo::Continue;
|
||||
@@ -89,8 +89,9 @@ SettingsAccessor::RestoreData SettingsAccessor::readData(const FilePath &path, Q
|
||||
/*!
|
||||
* Store the \a data in \a path on disk. Do all the necessary preprocessing of the data.
|
||||
*/
|
||||
optional<SettingsAccessor::Issue>
|
||||
SettingsAccessor::writeData(const FilePath &path, const QVariantMap &data, QWidget *parent) const
|
||||
std::optional<SettingsAccessor::Issue> SettingsAccessor::writeData(const FilePath &path,
|
||||
const QVariantMap &data,
|
||||
QWidget *parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
return writeFile(path, prepareToWriteSettings(data));
|
||||
@@ -134,8 +135,8 @@ SettingsAccessor::RestoreData SettingsAccessor::readFile(const FilePath &path) c
|
||||
*
|
||||
* This method does not do *any* processing of the file contents.
|
||||
*/
|
||||
optional<SettingsAccessor::Issue>
|
||||
SettingsAccessor::writeFile(const FilePath &path, const QVariantMap &data) const
|
||||
std::optional<SettingsAccessor::Issue> SettingsAccessor::writeFile(const FilePath &path,
|
||||
const QVariantMap &data) const
|
||||
{
|
||||
if (data.isEmpty()) {
|
||||
return Issue(QCoreApplication::translate("Utils::SettingsAccessor", "Failed to Write File"),
|
||||
@@ -216,11 +217,12 @@ int BackUpStrategy::compare(const SettingsAccessor::RestoreData &data1,
|
||||
return 0;
|
||||
}
|
||||
|
||||
optional<FilePath>
|
||||
BackUpStrategy::backupName(const QVariantMap &oldData, const FilePath &path, const QVariantMap &data) const
|
||||
std::optional<FilePath> BackUpStrategy::backupName(const QVariantMap &oldData,
|
||||
const FilePath &path,
|
||||
const QVariantMap &data) const
|
||||
{
|
||||
if (oldData == data)
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
return path.stringAppended(".bak");
|
||||
}
|
||||
|
||||
@@ -266,9 +268,9 @@ BackingUpSettingsAccessor::readData(const FilePath &path, QWidget *parent) const
|
||||
return result;
|
||||
}
|
||||
|
||||
optional<SettingsAccessor::Issue>
|
||||
BackingUpSettingsAccessor::writeData(const FilePath &path, const QVariantMap &data,
|
||||
QWidget *parent) const
|
||||
std::optional<SettingsAccessor::Issue> BackingUpSettingsAccessor::writeData(const FilePath &path,
|
||||
const QVariantMap &data,
|
||||
QWidget *parent) const
|
||||
{
|
||||
if (data.isEmpty())
|
||||
return {};
|
||||
@@ -307,8 +309,11 @@ void BackingUpSettingsAccessor::backupFile(const FilePath &path, const QVariantM
|
||||
return;
|
||||
|
||||
// Do we need to do a backup?
|
||||
if (optional<FilePath> backupFileName = m_strategy->backupName(oldSettings.data, path, data))
|
||||
if (std::optional<FilePath> backupFileName = m_strategy->backupName(oldSettings.data,
|
||||
path,
|
||||
data)) {
|
||||
path.copyFile(backupFileName.value());
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -337,8 +342,9 @@ int VersionedBackUpStrategy::compare(const SettingsAccessor::RestoreData &data1,
|
||||
return -1;
|
||||
}
|
||||
|
||||
optional<FilePath>
|
||||
VersionedBackUpStrategy::backupName(const QVariantMap &oldData, const FilePath &path, const QVariantMap &data) const
|
||||
std::optional<FilePath> VersionedBackUpStrategy::backupName(const QVariantMap &oldData,
|
||||
const FilePath &path,
|
||||
const QVariantMap &data) const
|
||||
{
|
||||
Q_UNUSED(data)
|
||||
FilePath backupName = path;
|
||||
@@ -356,7 +362,7 @@ VersionedBackUpStrategy::backupName(const QVariantMap &oldData, const FilePath &
|
||||
backupName = backupName.stringAppended('.' + QString::number(oldVersion));
|
||||
}
|
||||
if (backupName == path)
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
return backupName;
|
||||
}
|
||||
|
||||
@@ -590,7 +596,7 @@ SettingsAccessor::RestoreData MergingSettingsAccessor::readData(const FilePath &
|
||||
if (mainData.hasIssue()) {
|
||||
if (reportIssues(mainData.issue.value(), mainData.path, parent) == DiscardAndContinue)
|
||||
mainData.data.clear();
|
||||
mainData.issue = nullopt;
|
||||
mainData.issue = std::nullopt;
|
||||
}
|
||||
|
||||
RestoreData secondaryData
|
||||
@@ -628,7 +634,7 @@ SettingsAccessor::RestoreData MergingSettingsAccessor::readData(const FilePath &
|
||||
if (secondaryData.hasIssue()) {
|
||||
if (reportIssues(secondaryData.issue.value(), secondaryData.path, parent) == DiscardAndContinue)
|
||||
secondaryData.data.clear();
|
||||
secondaryData.issue = nullopt;
|
||||
secondaryData.issue = std::nullopt;
|
||||
}
|
||||
|
||||
if (!secondaryData.data.isEmpty())
|
||||
@@ -736,7 +742,7 @@ static QVariant mergeQVariantMapsRecursion(const QVariantMap &mainTree, const QV
|
||||
global.key = keyPrefix + key;
|
||||
local.key = key;
|
||||
|
||||
optional<QPair<QString, QVariant>> mergeResult = merge(global, local);
|
||||
std::optional<QPair<QString, QVariant>> mergeResult = merge(global, local);
|
||||
if (!mergeResult)
|
||||
continue;
|
||||
|
||||
|
@@ -6,13 +6,13 @@
|
||||
#include "utils_global.h"
|
||||
|
||||
#include "filepath.h"
|
||||
#include "optional.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QMessageBox>
|
||||
#include <QVariantMap>
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace Utils {
|
||||
|
||||
@@ -41,7 +41,7 @@ QTCREATOR_UTILS_EXPORT void setOriginalVersionInMap(QVariantMap &data, int versi
|
||||
QTCREATOR_UTILS_EXPORT void setSettingsIdInMap(QVariantMap &data, const QByteArray &id);
|
||||
|
||||
class PersistentSettingsWriter;
|
||||
using SettingsMergeResult = optional<QPair<QString, QVariant>>;
|
||||
using SettingsMergeResult = std::optional<QPair<QString, QVariant>>;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// SettingsAccessor:
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
|
||||
FilePath path;
|
||||
QVariantMap data;
|
||||
optional<Issue> issue;
|
||||
std::optional<Issue> issue;
|
||||
};
|
||||
|
||||
QVariantMap restoreSettings(QWidget *parent) const;
|
||||
@@ -104,7 +104,9 @@ public:
|
||||
FilePath baseFilePath() const { return m_baseFilePath; }
|
||||
|
||||
virtual RestoreData readData(const FilePath &path, QWidget *parent) const;
|
||||
virtual optional<Issue> writeData(const FilePath &path, const QVariantMap &data, QWidget *parent) const;
|
||||
virtual std::optional<Issue> writeData(const FilePath &path,
|
||||
const QVariantMap &data,
|
||||
QWidget *parent) const;
|
||||
|
||||
protected:
|
||||
// Report errors:
|
||||
@@ -115,7 +117,7 @@ protected:
|
||||
virtual QVariantMap prepareToWriteSettings(const QVariantMap &data) const;
|
||||
|
||||
virtual RestoreData readFile(const FilePath &path) const;
|
||||
virtual optional<Issue> writeFile(const FilePath &path, const QVariantMap &data) const;
|
||||
virtual std::optional<Issue> writeFile(const FilePath &path, const QVariantMap &data) const;
|
||||
|
||||
private:
|
||||
FilePath m_baseFilePath;
|
||||
@@ -138,8 +140,9 @@ public:
|
||||
virtual int compare(const SettingsAccessor::RestoreData &data1,
|
||||
const SettingsAccessor::RestoreData &data2) const;
|
||||
|
||||
virtual optional<FilePath>
|
||||
backupName(const QVariantMap &oldData, const FilePath &path, const QVariantMap &data) const;
|
||||
virtual std::optional<FilePath> backupName(const QVariantMap &oldData,
|
||||
const FilePath &path,
|
||||
const QVariantMap &data) const;
|
||||
};
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT BackingUpSettingsAccessor : public SettingsAccessor
|
||||
@@ -151,8 +154,9 @@ public:
|
||||
const QString &displayName, const QString &applicationDisplayName);
|
||||
|
||||
RestoreData readData(const FilePath &path, QWidget *parent) const override;
|
||||
optional<Issue> writeData(const FilePath &path, const QVariantMap &data,
|
||||
QWidget *parent) const override;
|
||||
std::optional<Issue> writeData(const FilePath &path,
|
||||
const QVariantMap &data,
|
||||
QWidget *parent) const override;
|
||||
|
||||
BackUpStrategy *strategy() const { return m_strategy.get(); }
|
||||
|
||||
@@ -180,8 +184,9 @@ public:
|
||||
int compare(const SettingsAccessor::RestoreData &data1,
|
||||
const SettingsAccessor::RestoreData &data2) const override;
|
||||
|
||||
optional<FilePath>
|
||||
backupName(const QVariantMap &oldData, const FilePath &path, const QVariantMap &data) const override;
|
||||
std::optional<FilePath> backupName(const QVariantMap &oldData,
|
||||
const FilePath &path,
|
||||
const QVariantMap &data) const override;
|
||||
|
||||
const UpgradingSettingsAccessor *accessor() const { return m_accessor; }
|
||||
|
||||
|
@@ -202,8 +202,6 @@ Project {
|
||||
"navigationtreeview.h",
|
||||
"networkaccessmanager.cpp",
|
||||
"networkaccessmanager.h",
|
||||
"optional.h",
|
||||
"../3rdparty/optional/optional.hpp",
|
||||
"osspecificaspects.h",
|
||||
"outputformat.h",
|
||||
"outputformatter.cpp",
|
||||
|
@@ -6,13 +6,13 @@
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/optional.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
|
||||
#include <optional>
|
||||
#include <variant>
|
||||
|
||||
namespace {
|
||||
@@ -44,7 +44,7 @@ static bool valueForKey(QString key, const QString &line, QString *value = nullp
|
||||
return false;
|
||||
}
|
||||
|
||||
static Utils::optional<AndroidDeviceInfo> parseAvd(const QStringList &deviceInfo)
|
||||
static std::optional<AndroidDeviceInfo> parseAvd(const QStringList &deviceInfo)
|
||||
{
|
||||
AndroidDeviceInfo avd;
|
||||
for (const QString &line : deviceInfo) {
|
||||
@@ -100,7 +100,7 @@ AndroidDeviceInfoList parseAvdList(const QString &output, QStringList *avdErrorP
|
||||
if (valueForKey(avdInfoPathKey, line, &value))
|
||||
return AvdResult(value); // error path
|
||||
}
|
||||
} else if (Utils::optional<AndroidDeviceInfo> avd = parseAvd(avdInfo)) {
|
||||
} else if (std::optional<AndroidDeviceInfo> avd = parseAvd(avdInfo)) {
|
||||
// armeabi-v7a devices can also run armeabi code
|
||||
if (avd->cpuAbi.contains(Constants::ANDROID_ABI_ARMEABI_V7A))
|
||||
avd->cpuAbi << Constants::ANDROID_ABI_ARMEABI;
|
||||
|
@@ -6,11 +6,11 @@
|
||||
#include "itestframework.h"
|
||||
#include "testtreeitem.h"
|
||||
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QVariantHash>
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
@@ -35,13 +35,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
Utils::optional<T> get(ITestTreeItem *item)
|
||||
std::optional<T> get(ITestTreeItem *item)
|
||||
{
|
||||
auto entry = m_cache.find(item->cacheName());
|
||||
if (entry == m_cache.end())
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
entry->generation = 0;
|
||||
return Utils::make_optional(entry->value);
|
||||
return std::make_optional(entry->value);
|
||||
};
|
||||
|
||||
void clear() { m_cache.clear(); }
|
||||
|
@@ -314,7 +314,7 @@ bool QtTestParser::processDocument(QFutureInterface<TestParseResultPtr> &futureI
|
||||
for (const TestCase &testCase : testCaseList) {
|
||||
if (!testCase.name.isEmpty()) {
|
||||
TestCaseData data;
|
||||
Utils::optional<bool> earlyReturn = fillTestCaseData(testCase.name, doc, data);
|
||||
std::optional<bool> earlyReturn = fillTestCaseData(testCase.name, doc, data);
|
||||
if (earlyReturn.has_value() || !data.valid)
|
||||
continue;
|
||||
|
||||
@@ -333,7 +333,7 @@ bool QtTestParser::processDocument(QFutureInterface<TestParseResultPtr> &futureI
|
||||
return reported;
|
||||
}
|
||||
|
||||
Utils::optional<bool> QtTestParser::fillTestCaseData(
|
||||
std::optional<bool> QtTestParser::fillTestCaseData(
|
||||
const QString &testCaseName, const CPlusPlus::Document::Ptr &doc,
|
||||
TestCaseData &data) const
|
||||
{
|
||||
@@ -366,7 +366,7 @@ Utils::optional<bool> QtTestParser::fillTestCaseData(
|
||||
|
||||
data.fileName = Utils::FilePath::fromString(declaringDoc->fileName());
|
||||
data.valid = true;
|
||||
return Utils::optional<bool>();
|
||||
return std::optional<bool>();
|
||||
}
|
||||
|
||||
QtTestParseResult *QtTestParser::createParseResult(
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include "qttest_utils.h"
|
||||
#include "qttesttreeitem.h"
|
||||
|
||||
#include <utils/optional.h>
|
||||
#include <optional>
|
||||
|
||||
namespace CppEditor { class CppModelManager; }
|
||||
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
bool valid = false;
|
||||
};
|
||||
|
||||
Utils::optional<bool> fillTestCaseData(const QString &testCaseName,
|
||||
std::optional<bool> fillTestCaseData(const QString &testCaseName,
|
||||
const CPlusPlus::Document::Ptr &doc,
|
||||
TestCaseData &data) const;
|
||||
QtTestParseResult *createParseResult(const QString &testCaseName, const TestCaseData &data,
|
||||
|
@@ -318,7 +318,8 @@ void TestNavigationWidget::reapplyCachedExpandedState()
|
||||
using namespace Utils;
|
||||
for (TreeItem *rootNode : *m_model->rootItem()) {
|
||||
rootNode->forAllChildren([this](TreeItem *child) {
|
||||
optional<bool> cached = m_expandedStateCache.get(static_cast<ITestTreeItem *>(child));
|
||||
std::optional<bool> cached = m_expandedStateCache.get(
|
||||
static_cast<ITestTreeItem *>(child));
|
||||
if (cached.has_value()) {
|
||||
QModelIndex index = child->index();
|
||||
if (m_view->isExpanded(index) != cached.value())
|
||||
|
@@ -58,7 +58,7 @@ static QIcon testResultIcon(ResultType result) {
|
||||
return icons[int(result)];
|
||||
}
|
||||
|
||||
static QIcon testSummaryIcon(const Utils::optional<TestResultItem::SummaryEvaluation> &summary)
|
||||
static QIcon testSummaryIcon(const std::optional<TestResultItem::SummaryEvaluation> &summary)
|
||||
{
|
||||
if (!summary)
|
||||
return QIcon();
|
||||
@@ -114,7 +114,7 @@ static bool isSignificant(ResultType type)
|
||||
}
|
||||
|
||||
void TestResultItem::updateResult(bool &changed, ResultType addedChildType,
|
||||
const Utils::optional<SummaryEvaluation> &summary)
|
||||
const std::optional<SummaryEvaluation> &summary)
|
||||
{
|
||||
changed = false;
|
||||
if (m_testResult->result() != ResultType::TestStart)
|
||||
|
@@ -10,9 +10,10 @@
|
||||
#include <QSet>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include <utils/optional.h>
|
||||
#include <utils/treemodel.h>
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
@@ -36,16 +37,16 @@ public:
|
||||
};
|
||||
|
||||
void updateResult(bool &changed, ResultType addedChildType,
|
||||
const Utils::optional<SummaryEvaluation> &summary);
|
||||
const std::optional<SummaryEvaluation> &summary);
|
||||
|
||||
TestResultItem *intermediateFor(const TestResultItem *item) const;
|
||||
TestResultItem *createAndAddIntermediateFor(const TestResultItem *child);
|
||||
QString resultString() const;
|
||||
Utils::optional<SummaryEvaluation> summaryResult() const { return m_summaryResult; }
|
||||
std::optional<SummaryEvaluation> summaryResult() const { return m_summaryResult; }
|
||||
|
||||
private:
|
||||
TestResultPtr m_testResult;
|
||||
Utils::optional<SummaryEvaluation> m_summaryResult;
|
||||
std::optional<SummaryEvaluation> m_summaryResult;
|
||||
};
|
||||
|
||||
class TestResultModel : public Utils::TreeModel<TestResultItem>
|
||||
|
@@ -259,7 +259,7 @@ void TestTreeModel::onBuildSystemTestsUpdated()
|
||||
for (const auto &tci : bs->testcasesInfo()) {
|
||||
ITestTreeItem *item = testTool->createItemFromTestCaseInfo(tci);
|
||||
QTC_ASSERT(item, continue);
|
||||
if (Utils::optional<Qt::CheckState> cached = m_checkStateCache->get(item))
|
||||
if (std::optional<Qt::CheckState> cached = m_checkStateCache->get(item))
|
||||
item->setData(0, cached.value(), Qt::CheckStateRole);
|
||||
m_checkStateCache->insert(item, item->checked());
|
||||
rootNode->appendChild(item);
|
||||
@@ -393,7 +393,7 @@ void TestTreeModel::synchronizeTestTools()
|
||||
for (const auto &tci : bs->testcasesInfo()) {
|
||||
ITestTreeItem *item = testTool->createItemFromTestCaseInfo(tci);
|
||||
QTC_ASSERT(item, continue);
|
||||
if (Utils::optional<Qt::CheckState> cached = m_checkStateCache->get(item))
|
||||
if (std::optional<Qt::CheckState> cached = m_checkStateCache->get(item))
|
||||
item->setData(0, cached.value(), Qt::CheckStateRole);
|
||||
m_checkStateCache->insert(item, item->checked());
|
||||
rootNode->appendChild(item);
|
||||
@@ -592,13 +592,13 @@ void TestTreeModel::insertItemInParent(TestTreeItem *item, TestTreeItem *root, b
|
||||
delete item;
|
||||
} else {
|
||||
// restore former check state if available
|
||||
Utils::optional<Qt::CheckState> cached = m_checkStateCache->get(item);
|
||||
std::optional<Qt::CheckState> cached = m_checkStateCache->get(item);
|
||||
if (cached.has_value())
|
||||
item->setData(0, cached.value(), Qt::CheckStateRole);
|
||||
else
|
||||
applyParentCheckState(parentNode, item);
|
||||
// ..and the failed state if available
|
||||
Utils::optional<bool> failed = m_failedStateCache.get(item);
|
||||
std::optional<bool> failed = m_failedStateCache.get(item);
|
||||
if (failed.has_value())
|
||||
item->setData(0, *failed, FailedRole);
|
||||
parentNode->appendChild(item);
|
||||
@@ -717,10 +717,10 @@ void TestTreeModel::handleParseResult(const TestParseResult *result, TestTreeIte
|
||||
newItem->forAllChildItems([this](TestTreeItem *childItem) {
|
||||
if (!m_checkStateCache) // parse results may arrive after session switch / project close
|
||||
return;
|
||||
Utils::optional<Qt::CheckState> cached = m_checkStateCache->get(childItem);
|
||||
std::optional<Qt::CheckState> cached = m_checkStateCache->get(childItem);
|
||||
if (cached.has_value())
|
||||
childItem->setData(0, cached.value(), Qt::CheckStateRole);
|
||||
Utils::optional<bool> failed = m_failedStateCache.get(childItem);
|
||||
std::optional<bool> failed = m_failedStateCache.get(childItem);
|
||||
if (failed.has_value())
|
||||
childItem->setData(0, *failed, FailedRole);
|
||||
});
|
||||
|
@@ -536,12 +536,12 @@ QChar BinEditorWidget::displayChar(char ch) const
|
||||
return uc.at(0);
|
||||
}
|
||||
|
||||
Utils::optional<qint64> BinEditorWidget::posAt(const QPoint &pos, bool includeEmptyArea) const
|
||||
std::optional<qint64> BinEditorWidget::posAt(const QPoint &pos, bool includeEmptyArea) const
|
||||
{
|
||||
const int xoffset = horizontalScrollBar()->value();
|
||||
int x = xoffset + pos.x() - m_margin - m_labelWidth;
|
||||
if (!includeEmptyArea && x < 0)
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
int column = qMin(15, qMax(0,x) / m_columnWidth);
|
||||
const qint64 topLine = verticalScrollBar()->value();
|
||||
const qint64 line = topLine + pos.y() / m_lineHeight;
|
||||
@@ -559,12 +559,12 @@ Utils::optional<qint64> BinEditorWidget::posAt(const QPoint &pos, bool includeEm
|
||||
break;
|
||||
}
|
||||
if (!includeEmptyArea && x > 0) // right of the text area
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const qint64 bytePos = line * m_bytesPerLine + column;
|
||||
if (!includeEmptyArea && bytePos >= m_size)
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
return qMin(m_size - 1, bytePos);
|
||||
}
|
||||
|
||||
@@ -1163,7 +1163,7 @@ QString BinEditorWidget::toolTip(const QHelpEvent *helpEvent) const
|
||||
} while (startInLine <= selEnd);
|
||||
if (!insideSelection) {
|
||||
// show popup for byte under cursor
|
||||
Utils::optional<qint64> pos = posAt(helpEvent->pos(), /*includeEmptyArea*/false);
|
||||
std::optional<qint64> pos = posAt(helpEvent->pos(), /*includeEmptyArea*/false);
|
||||
if (!pos)
|
||||
return QString();
|
||||
selStart = pos.value();
|
||||
|
@@ -8,7 +8,6 @@
|
||||
#include "bineditorservice.h"
|
||||
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include <QAbstractScrollArea>
|
||||
#include <QBasicTimer>
|
||||
@@ -19,6 +18,8 @@
|
||||
#include <QTextDocument>
|
||||
#include <QTextFormat>
|
||||
|
||||
#include <optional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QHelpEvent;
|
||||
class QMenu;
|
||||
@@ -194,7 +195,7 @@ private:
|
||||
QBasicTimer m_cursorBlinkTimer;
|
||||
|
||||
void init();
|
||||
Utils::optional<qint64> posAt(const QPoint &pos, bool includeEmptyArea = true) const;
|
||||
std::optional<qint64> posAt(const QPoint &pos, bool includeEmptyArea = true) const;
|
||||
bool inTextArea(const QPoint &pos) const;
|
||||
QRect cursorRect() const;
|
||||
void updateLines();
|
||||
|
@@ -23,20 +23,26 @@ static constexpr char16_t arcanaKey[] = u"arcana";
|
||||
|
||||
QString ClangdAstNode::role() const { return typedValue<QString>(roleKey); }
|
||||
QString ClangdAstNode::kind() const { return typedValue<QString>(kindKey); }
|
||||
optional<QString> ClangdAstNode::detail() const { return optionalValue<QString>(detailKey); }
|
||||
optional<QString> ClangdAstNode::arcana() const { return optionalValue<QString>(arcanaKey); }
|
||||
std::optional<QString> ClangdAstNode::detail() const
|
||||
{
|
||||
return optionalValue<QString>(detailKey);
|
||||
}
|
||||
std::optional<QString> ClangdAstNode::arcana() const
|
||||
{
|
||||
return optionalValue<QString>(arcanaKey);
|
||||
}
|
||||
Range ClangdAstNode::range() const { return typedValue<Range>(rangeKey); }
|
||||
bool ClangdAstNode::hasRange() const { return contains(rangeKey); }
|
||||
bool ClangdAstNode::isValid() const { return contains(roleKey) && contains(kindKey); }
|
||||
|
||||
optional<QList<ClangdAstNode> > ClangdAstNode::children() const
|
||||
std::optional<QList<ClangdAstNode>> ClangdAstNode::children() const
|
||||
{
|
||||
return optionalArray<ClangdAstNode>(childrenKey);
|
||||
}
|
||||
|
||||
bool ClangdAstNode::arcanaContains(const QString &s) const
|
||||
{
|
||||
const optional<QString> arcanaString = arcana();
|
||||
const std::optional<QString> arcanaString = arcana();
|
||||
return arcanaString && arcanaString->contains(s);
|
||||
}
|
||||
|
||||
@@ -88,7 +94,7 @@ bool ClangdAstNode::isTemplateParameterDeclaration() const
|
||||
|
||||
QString ClangCodeModel::Internal::ClangdAstNode::type() const
|
||||
{
|
||||
const optional<QString> arcanaString = arcana();
|
||||
const std::optional<QString> arcanaString = arcana();
|
||||
if (!arcanaString)
|
||||
return {};
|
||||
return typeFromPos(*arcanaString, 0);
|
||||
@@ -156,7 +162,7 @@ bool ClangdAstNode::hasConstType() const
|
||||
|
||||
bool ClangdAstNode::childContainsRange(int index, const LanguageServerProtocol::Range &range) const
|
||||
{
|
||||
const optional<QList<ClangdAstNode>> childList = children();
|
||||
const std::optional<QList<ClangdAstNode>> childList = children();
|
||||
return childList && childList->size() > index && childList->at(index).range().contains(range);
|
||||
}
|
||||
|
||||
@@ -171,7 +177,7 @@ QString ClangdAstNode::operatorString() const
|
||||
if (kind() == "BinaryOperator")
|
||||
return detail().value_or(QString());
|
||||
QTC_ASSERT(kind() == "CXXOperatorCall", return {});
|
||||
const optional<QString> arcanaString = arcana();
|
||||
const std::optional<QString> arcanaString = arcana();
|
||||
if (!arcanaString)
|
||||
return {};
|
||||
const int closingQuoteOffset = arcanaString->lastIndexOf('\'');
|
||||
@@ -186,7 +192,7 @@ QString ClangdAstNode::operatorString() const
|
||||
|
||||
ClangdAstNode::FileStatus ClangdAstNode::fileStatus(const FilePath &thisFile) const
|
||||
{
|
||||
const optional<QString> arcanaString = arcana();
|
||||
const std::optional<QString> arcanaString = arcana();
|
||||
if (!arcanaString)
|
||||
return FileStatus::Unknown;
|
||||
|
||||
@@ -368,7 +374,7 @@ MessageId requestAst(Client *client, const FilePath &filePath, const Range range
|
||||
|
||||
// The region of the source code whose AST is fetched. The highest-level node that entirely
|
||||
// contains the range is returned.
|
||||
optional<Range> range() const { return optionalValue<Range>(rangeKey); }
|
||||
std::optional<Range> range() const { return optionalValue<Range>(rangeKey); }
|
||||
void setRange(const Range &range) { insert(rangeKey, range); }
|
||||
|
||||
bool isValid() const override { return contains(textDocumentKey); }
|
||||
|
@@ -40,11 +40,11 @@ public:
|
||||
QString kind() const;
|
||||
|
||||
// Brief additional details, such as ‘||’. Information present here depends on the node kind.
|
||||
Utils::optional<QString> detail() const;
|
||||
std::optional<QString> detail() const;
|
||||
|
||||
// One line dump of information, similar to that printed by clang -Xclang -ast-dump.
|
||||
// Only available for certain types of nodes.
|
||||
Utils::optional<QString> arcana() const;
|
||||
std::optional<QString> arcana() const;
|
||||
|
||||
// The part of the code that produced this node. Missing for implicit nodes, nodes produced
|
||||
// by macro expansion, etc.
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
// Descendants describing the internal structure. The tree of nodes is similar to that printed
|
||||
// by clang -Xclang -ast-dump, or that traversed by clang::RecursiveASTVisitor.
|
||||
Utils::optional<QList<ClangdAstNode>> children() const;
|
||||
std::optional<QList<ClangdAstNode>> children() const;
|
||||
|
||||
bool hasRange() const;
|
||||
bool arcanaContains(const QString &s) const;
|
||||
|
@@ -99,7 +99,7 @@ public:
|
||||
QString usr() const { return typedValue<QString>(usrKey); }
|
||||
|
||||
// the clangd-specific opaque symbol ID
|
||||
Utils::optional<QString> id() const { return optionalValue<QString>(idKey); }
|
||||
std::optional<QString> id() const { return optionalValue<QString>(idKey); }
|
||||
|
||||
bool isValid() const override
|
||||
{
|
||||
@@ -206,7 +206,7 @@ public:
|
||||
m_data.emplace(std::make_pair(doc, VersionedDocData(doc, data)));
|
||||
}
|
||||
void remove(const DocType &doc) { m_data.erase(doc); }
|
||||
Utils::optional<VersionedDocData<DocType, DataType>> take(const DocType &doc)
|
||||
std::optional<VersionedDocData<DocType, DataType>> take(const DocType &doc)
|
||||
{
|
||||
const auto it = m_data.find(doc);
|
||||
if (it == m_data.end())
|
||||
@@ -215,7 +215,7 @@ public:
|
||||
m_data.erase(it);
|
||||
return data;
|
||||
}
|
||||
Utils::optional<DataType> get(const DocType &doc)
|
||||
std::optional<DataType> get(const DocType &doc)
|
||||
{
|
||||
const auto it = m_data.find(doc);
|
||||
if (it == m_data.end())
|
||||
@@ -251,7 +251,7 @@ public:
|
||||
: q(q), settings(CppEditor::ClangdProjectSettings(project).settings()) {}
|
||||
|
||||
void findUsages(TextDocument *document, const QTextCursor &cursor,
|
||||
const QString &searchTerm, const Utils::optional<QString> &replacement,
|
||||
const QString &searchTerm, const std::optional<QString> &replacement,
|
||||
bool categorize);
|
||||
|
||||
void handleDeclDefSwitchReplies();
|
||||
@@ -275,7 +275,7 @@ public:
|
||||
ClangdFollowSymbol *followSymbol = nullptr;
|
||||
ClangdSwitchDeclDef *switchDeclDef = nullptr;
|
||||
ClangdFindLocalReferences *findLocalRefs = nullptr;
|
||||
Utils::optional<QVersionNumber> versionNumber;
|
||||
std::optional<QVersionNumber> versionNumber;
|
||||
|
||||
QHash<TextDocument *, HighlightingData> highlightingData;
|
||||
QHash<Utils::FilePath, CppEditor::BaseEditorDocumentParser::Configuration> parserConfigs;
|
||||
@@ -354,7 +354,7 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir)
|
||||
for (const Client *client : clients)
|
||||
qCWarning(clangdLog) << client->name() << client->stateString();
|
||||
ClientCapabilities caps = Client::defaultClientCapabilities();
|
||||
Utils::optional<TextDocumentClientCapabilities> textCaps = caps.textDocument();
|
||||
std::optional<TextDocumentClientCapabilities> textCaps = caps.textDocument();
|
||||
if (textCaps) {
|
||||
ClangdTextDocumentClientCapabilities clangdTextCaps(*textCaps);
|
||||
clangdTextCaps.clearDocumentHighlight();
|
||||
@@ -362,7 +362,7 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir)
|
||||
diagnostics.enableCategorySupport();
|
||||
diagnostics.enableCodeActionsInline();
|
||||
clangdTextCaps.setPublishDiagnostics(diagnostics);
|
||||
Utils::optional<TextDocumentClientCapabilities::CompletionCapabilities> completionCaps
|
||||
std::optional<TextDocumentClientCapabilities::CompletionCapabilities> completionCaps
|
||||
= textCaps->completion();
|
||||
if (completionCaps)
|
||||
clangdTextCaps.setCompletion(ClangdCompletionCapabilities(*completionCaps));
|
||||
@@ -441,7 +441,7 @@ void ClangdClient::closeExtraFile(const Utils::FilePath &filePath)
|
||||
}
|
||||
|
||||
void ClangdClient::findUsages(TextDocument *document, const QTextCursor &cursor,
|
||||
const Utils::optional<QString> &replacement)
|
||||
const std::optional<QString> &replacement)
|
||||
{
|
||||
// Quick check: Are we even on anything searchable?
|
||||
const QTextCursor adjustedCursor = d->adjustedCursor(cursor, document);
|
||||
@@ -615,7 +615,7 @@ CppEditor::ClangdSettings::Data ClangdClient::settingsData() const { return d->s
|
||||
|
||||
void ClangdClient::Private::findUsages(TextDocument *document,
|
||||
const QTextCursor &cursor, const QString &searchTerm,
|
||||
const Utils::optional<QString> &replacement, bool categorize)
|
||||
const std::optional<QString> &replacement, bool categorize)
|
||||
{
|
||||
const auto findRefs = new ClangdFindReferences(q, document, cursor, searchTerm, replacement,
|
||||
categorize);
|
||||
@@ -753,7 +753,7 @@ void ClangdClient::clearTasks(const Utils::FilePath &filePath)
|
||||
d->issuePaneEntries[filePath].clear();
|
||||
}
|
||||
|
||||
Utils::optional<bool> ClangdClient::hasVirtualFunctionAt(TextDocument *doc, int revision,
|
||||
std::optional<bool> ClangdClient::hasVirtualFunctionAt(TextDocument *doc, int revision,
|
||||
const Range &range)
|
||||
{
|
||||
const auto highlightingData = d->highlightingData.constFind(doc);
|
||||
@@ -860,7 +860,7 @@ void ClangdClient::switchHeaderSource(const Utils::FilePath &filePath, bool inNe
|
||||
};
|
||||
SwitchSourceHeaderRequest req(filePath);
|
||||
req.setResponseCallback([inNextSplit](const SwitchSourceHeaderRequest::Response &response) {
|
||||
if (const Utils::optional<QJsonValue> result = response.result()) {
|
||||
if (const std::optional<QJsonValue> result = response.result()) {
|
||||
const DocumentUri uri = DocumentUri::fromProtocol(result->toString());
|
||||
const Utils::FilePath filePath = uri.toFilePath();
|
||||
if (!filePath.isEmpty())
|
||||
@@ -900,7 +900,7 @@ void ClangdClient::findLocalUsages(TextDocument *document, const QTextCursor &cu
|
||||
void ClangdClient::gatherHelpItemForTooltip(const HoverRequest::Response &hoverResponse,
|
||||
const DocumentUri &uri)
|
||||
{
|
||||
if (const Utils::optional<HoverResult> result = hoverResponse.result()) {
|
||||
if (const std::optional<HoverResult> result = hoverResponse.result()) {
|
||||
if (auto hover = std::get_if<Hover>(&(*result))) {
|
||||
const HoverContent content = hover->content();
|
||||
const MarkupContent *const markup = std::get_if<MarkupContent>(&content);
|
||||
@@ -942,7 +942,7 @@ void ClangdClient::gatherHelpItemForTooltip(const HoverRequest::Response &hoverR
|
||||
const auto astHandler = [this, uri, hoverResponse](const ClangdAstNode &ast, const MessageId &) {
|
||||
const MessageId id = hoverResponse.id();
|
||||
Range range;
|
||||
if (const Utils::optional<HoverResult> result = hoverResponse.result()) {
|
||||
if (const std::optional<HoverResult> result = hoverResponse.result()) {
|
||||
if (auto hover = std::get_if<Hover>(&(*result)))
|
||||
range = hover->range().value_or(Range());
|
||||
}
|
||||
@@ -953,12 +953,12 @@ void ClangdClient::gatherHelpItemForTooltip(const HoverRequest::Response &hoverR
|
||||
}
|
||||
ClangdAstNode node = path.last();
|
||||
if (node.role() == "expression" && node.kind() == "ImplicitCast") {
|
||||
const Utils::optional<QList<ClangdAstNode>> children = node.children();
|
||||
const std::optional<QList<ClangdAstNode>> children = node.children();
|
||||
if (children && !children->isEmpty())
|
||||
node = children->first();
|
||||
}
|
||||
while (node.kind() == "Qualified") {
|
||||
const Utils::optional<QList<ClangdAstNode>> children = node.children();
|
||||
const std::optional<QList<ClangdAstNode>> children = node.children();
|
||||
if (children && !children->isEmpty())
|
||||
node = children->first();
|
||||
}
|
||||
@@ -1120,7 +1120,7 @@ QTextCursor ClangdClient::Private::adjustedCursor(const QTextCursor &cursor,
|
||||
case T_DOT:
|
||||
break;
|
||||
case T_ARROW: {
|
||||
const Utils::optional<ClangdAstNode> clangdAst = astCache.get(doc);
|
||||
const std::optional<ClangdAstNode> clangdAst = astCache.get(doc);
|
||||
if (!clangdAst)
|
||||
return cursor;
|
||||
const ClangdAstPath clangdAstPath = getAstPath(*clangdAst, Range(cursor));
|
||||
@@ -1289,7 +1289,7 @@ void ClangdClient::Private::handleSemanticTokens(TextDocument *doc,
|
||||
getAndHandleAst(doc, astHandler, AstCallbackMode::SyncIfPossible);
|
||||
}
|
||||
|
||||
Utils::optional<QList<CodeAction> > ClangdDiagnostic::codeActions() const
|
||||
std::optional<QList<CodeAction> > ClangdDiagnostic::codeActions() const
|
||||
{
|
||||
auto actions = optionalArray<LanguageServerProtocol::CodeAction>(u"codeActions");
|
||||
if (!actions)
|
||||
|
@@ -9,10 +9,11 @@
|
||||
#include <cppeditor/cursorineditor.h>
|
||||
#include <languageclient/client.h>
|
||||
#include <utils/link.h>
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include <QVersionNumber>
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace CppEditor { class CppEditorWidget; }
|
||||
namespace LanguageServerProtocol { class Range; }
|
||||
namespace ProjectExplorer {
|
||||
@@ -48,7 +49,7 @@ public:
|
||||
void closeExtraFile(const Utils::FilePath &filePath);
|
||||
|
||||
void findUsages(TextEditor::TextDocument *document, const QTextCursor &cursor,
|
||||
const Utils::optional<QString> &replacement);
|
||||
const std::optional<QString> &replacement);
|
||||
void followSymbol(TextEditor::TextDocument *document,
|
||||
const QTextCursor &cursor,
|
||||
CppEditor::CppEditorWidget *editorWidget,
|
||||
@@ -85,7 +86,7 @@ public:
|
||||
void switchIssuePaneEntries(const Utils::FilePath &filePath);
|
||||
void addTask(const ProjectExplorer::Task &task);
|
||||
void clearTasks(const Utils::FilePath &filePath);
|
||||
Utils::optional<bool> hasVirtualFunctionAt(TextEditor::TextDocument *doc, int revision,
|
||||
std::optional<bool> hasVirtualFunctionAt(TextEditor::TextDocument *doc, int revision,
|
||||
const LanguageServerProtocol::Range &range);
|
||||
|
||||
using TextDocOrFile = std::variant<const TextEditor::TextDocument *, Utils::FilePath>;
|
||||
@@ -136,7 +137,7 @@ class ClangdDiagnostic : public LanguageServerProtocol::Diagnostic
|
||||
{
|
||||
public:
|
||||
using Diagnostic::Diagnostic;
|
||||
Utils::optional<QList<LanguageServerProtocol::CodeAction>> codeActions() const;
|
||||
std::optional<QList<LanguageServerProtocol::CodeAction>> codeActions() const;
|
||||
QString category() const;
|
||||
};
|
||||
|
||||
|
@@ -336,7 +336,7 @@ void ClangdCompletionItem::apply(TextDocumentManipulatorInterface &manipulator,
|
||||
|
||||
ClangdCompletionItem::SpecialQtType ClangdCompletionItem::getQtType(const CompletionItem &item)
|
||||
{
|
||||
const Utils::optional<MarkupOrString> doc = item.documentation();
|
||||
const std::optional<MarkupOrString> doc = item.documentation();
|
||||
if (!doc)
|
||||
return SpecialQtType::None;
|
||||
QString docText;
|
||||
@@ -612,7 +612,7 @@ ClangdCompletionCapabilities::ClangdCompletionCapabilities(const JsonObject &obj
|
||||
: TextDocumentClientCapabilities::CompletionCapabilities(object)
|
||||
{
|
||||
insert(u"editsNearCursor", true); // For dot-to-arrow correction.
|
||||
if (Utils::optional<CompletionItemCapbilities> completionItemCaps = completionItem()) {
|
||||
if (std::optional<CompletionItemCapbilities> completionItemCaps = completionItem()) {
|
||||
completionItemCaps->setSnippetSupport(false);
|
||||
setCompletionItem(*completionItemCaps);
|
||||
}
|
||||
|
@@ -65,21 +65,21 @@ public:
|
||||
void finishSearch();
|
||||
void reportAllSearchResultsAndFinish();
|
||||
void addSearchResultsForFile(const FilePath &file, const ReferencesFileData &fileData);
|
||||
Utils::optional<QString> getContainingFunctionName(const ClangdAstPath &astPath,
|
||||
std::optional<QString> getContainingFunctionName(const ClangdAstPath &astPath,
|
||||
const Range& range);
|
||||
|
||||
ClangdFindReferences * const q;
|
||||
QMap<DocumentUri, ReferencesFileData> fileData;
|
||||
QList<MessageId> pendingAstRequests;
|
||||
QPointer<SearchResult> search;
|
||||
Utils::optional<ReplacementData> replacementData;
|
||||
std::optional<ReplacementData> replacementData;
|
||||
bool canceled = false;
|
||||
bool categorize = false;
|
||||
};
|
||||
|
||||
ClangdFindReferences::ClangdFindReferences(ClangdClient *client, TextDocument *document,
|
||||
const QTextCursor &cursor, const QString &searchTerm,
|
||||
const Utils::optional<QString> &replacement, bool categorize)
|
||||
const std::optional<QString> &replacement, bool categorize)
|
||||
: QObject(client), d(new ClangdFindReferences::Private(this))
|
||||
{
|
||||
d->categorize = categorize;
|
||||
@@ -121,7 +121,7 @@ ClangdFindReferences::ClangdFindReferences(ClangdClient *client, TextDocument *d
|
||||
});
|
||||
SearchResultWindow::instance()->popup(IOutputPane::ModeSwitch | IOutputPane::WithFocus);
|
||||
|
||||
const Utils::optional<MessageId> requestId = client->symbolSupport().findUsages(
|
||||
const std::optional<MessageId> requestId = client->symbolSupport().findUsages(
|
||||
document, cursor, [self = QPointer(this)](const QList<Location> &locations) {
|
||||
if (self)
|
||||
self->d->handleFindUsagesResult(locations);
|
||||
@@ -324,7 +324,7 @@ void ClangdFindReferences::Private::addSearchResultsForFile(const FilePath &file
|
||||
search->addResults(items, SearchResult::AddOrdered);
|
||||
}
|
||||
|
||||
Utils::optional<QString> ClangdFindReferences::Private::getContainingFunctionName(
|
||||
std::optional<QString> ClangdFindReferences::Private::getContainingFunctionName(
|
||||
const ClangdAstPath &astPath, const Range& range)
|
||||
{
|
||||
const ClangdAstNode* containingFuncNode{nullptr};
|
||||
@@ -344,7 +344,7 @@ Utils::optional<QString> ClangdFindReferences::Private::getContainingFunctionNam
|
||||
}
|
||||
|
||||
if (!containingFuncNode || !containingFuncNode->isValid())
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
|
||||
return containingFuncNode->detail();
|
||||
}
|
||||
|
@@ -5,10 +5,11 @@
|
||||
|
||||
#include <coreplugin/find/searchresultitem.h>
|
||||
#include <cppeditor/cursorineditor.h>
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <optional>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QTextCursor;
|
||||
QT_END_NAMESPACE
|
||||
@@ -24,7 +25,7 @@ class ClangdFindReferences : public QObject
|
||||
public:
|
||||
explicit ClangdFindReferences(ClangdClient *client, TextEditor::TextDocument *document,
|
||||
const QTextCursor &cursor, const QString &searchTerm,
|
||||
const Utils::optional<QString> &replacement, bool categorize);
|
||||
const std::optional<QString> &replacement, bool categorize);
|
||||
~ClangdFindReferences();
|
||||
|
||||
signals:
|
||||
|
@@ -107,7 +107,7 @@ public:
|
||||
Link defLink;
|
||||
Links allLinks;
|
||||
QHash<Link, Link> declDefMap;
|
||||
optional<ClangdAstNode> cursorNode;
|
||||
std::optional<ClangdAstNode> cursorNode;
|
||||
ClangdAstNode defLinkNode;
|
||||
SymbolDataList symbolsToDisplay;
|
||||
std::set<FilePath> openedFiles;
|
||||
@@ -375,7 +375,7 @@ void ClangdFollowSymbol::Private::handleGotoDefinitionResult()
|
||||
void ClangdFollowSymbol::Private::handleGotoImplementationResult(
|
||||
const GotoImplementationRequest::Response &response)
|
||||
{
|
||||
if (const optional<GotoResult> &result = response.result()) {
|
||||
if (const std::optional<GotoResult> &result = response.result()) {
|
||||
QList<Link> newLinks;
|
||||
if (const auto ploc = std::get_if<Location>(&*result))
|
||||
newLinks = {ploc->toLink()};
|
||||
@@ -451,7 +451,7 @@ void ClangdFollowSymbol::Private::handleGotoImplementationResult(
|
||||
if (!sentinel)
|
||||
return;
|
||||
Link newLink;
|
||||
if (optional<GotoResult> _result = response.result()) {
|
||||
if (std::optional<GotoResult> _result = response.result()) {
|
||||
const GotoResult result = _result.value();
|
||||
if (const auto ploc = std::get_if<Location>(&result)) {
|
||||
newLink = ploc->toLink();
|
||||
|
@@ -131,7 +131,7 @@ public:
|
||||
const QPointer<ClangdClient> client;
|
||||
MemoryTreeModel model;
|
||||
TreeView view;
|
||||
Utils::optional<MessageId> currentRequest;
|
||||
std::optional<MessageId> currentRequest;
|
||||
};
|
||||
|
||||
ClangdMemoryUsageWidget::ClangdMemoryUsageWidget(ClangdClient *client)
|
||||
|
@@ -65,7 +65,7 @@ private:
|
||||
auto toOperation =
|
||||
[=](const std::variant<Command, CodeAction> &item) -> QuickFixOperation * {
|
||||
if (auto action = std::get_if<CodeAction>(&item)) {
|
||||
const Utils::optional<QList<Diagnostic>> diagnostics = action->diagnostics();
|
||||
const std::optional<QList<Diagnostic>> diagnostics = action->diagnostics();
|
||||
if (!diagnostics.has_value() || diagnostics->isEmpty())
|
||||
return new CodeActionQuickFixOperation(*action, client());
|
||||
}
|
||||
|
@@ -10,12 +10,13 @@
|
||||
#include <languageclient/documentsymbolcache.h>
|
||||
#include <languageserverprotocol/lsptypes.h>
|
||||
#include <texteditor/textdocument.h>
|
||||
#include <utils/optional.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTextCursor>
|
||||
|
||||
#include <optional>
|
||||
|
||||
using namespace CppEditor;
|
||||
using namespace LanguageClient;
|
||||
using namespace LanguageServerProtocol;
|
||||
@@ -33,7 +34,7 @@ public:
|
||||
cursor(cursor), editorWidget(editorWidget), callback(callback)
|
||||
{}
|
||||
|
||||
optional<ClangdAstNode> getFunctionNode() const;
|
||||
std::optional<ClangdAstNode> getFunctionNode() const;
|
||||
QTextCursor cursorForFunctionName(const ClangdAstNode &functionNode) const;
|
||||
void handleDeclDefSwitchReplies();
|
||||
|
||||
@@ -44,8 +45,8 @@ public:
|
||||
const QTextCursor cursor;
|
||||
const QPointer<CppEditorWidget> editorWidget;
|
||||
const LinkHandler callback;
|
||||
optional<ClangdAstNode> ast;
|
||||
optional<DocumentSymbolsResult> docSymbols;
|
||||
std::optional<ClangdAstNode> ast;
|
||||
std::optional<DocumentSymbolsResult> docSymbols;
|
||||
bool done = false;
|
||||
};
|
||||
|
||||
@@ -110,7 +111,7 @@ void ClangdSwitchDeclDef::emitDone()
|
||||
emit done();
|
||||
}
|
||||
|
||||
optional<ClangdAstNode> ClangdSwitchDeclDef::Private::getFunctionNode() const
|
||||
std::optional<ClangdAstNode> ClangdSwitchDeclDef::Private::getFunctionNode() const
|
||||
{
|
||||
QTC_ASSERT(ast, return {});
|
||||
|
||||
@@ -157,7 +158,7 @@ void ClangdSwitchDeclDef::Private::handleDeclDefSwitchReplies()
|
||||
// on a function return type, or ...
|
||||
if (clangdLogAst().isDebugEnabled())
|
||||
ast->print(0);
|
||||
const Utils::optional<ClangdAstNode> functionNode = getFunctionNode();
|
||||
const std::optional<ClangdAstNode> functionNode = getFunctionNode();
|
||||
if (!functionNode) {
|
||||
q->emitDone();
|
||||
return;
|
||||
|
@@ -215,10 +215,10 @@ ClangDiagnostic convertDiagnostic(const ClangdDiagnostic &src, const FilePath &f
|
||||
if (codeString && codeString->startsWith("-W"))
|
||||
target.enableOption = *codeString;
|
||||
for (const CodeAction &codeAction : src.codeActions().value_or(QList<CodeAction>())) {
|
||||
const Utils::optional<WorkspaceEdit> edit = codeAction.edit();
|
||||
const std::optional<WorkspaceEdit> edit = codeAction.edit();
|
||||
if (!edit)
|
||||
continue;
|
||||
const Utils::optional<WorkspaceEdit::Changes> changes = edit->changes();
|
||||
const std::optional<WorkspaceEdit::Changes> changes = edit->changes();
|
||||
if (!changes)
|
||||
continue;
|
||||
ClangDiagnostic fixItDiag;
|
||||
|
@@ -706,7 +706,7 @@ bool ClangFormatBaseIndenter::isElectricCharacter(const QChar &ch) const
|
||||
return false;
|
||||
}
|
||||
|
||||
Utils::optional<int> ClangFormat::ClangFormatBaseIndenter::margin() const
|
||||
std::optional<int> ClangFormat::ClangFormatBaseIndenter::margin() const
|
||||
{
|
||||
return styleForFile().ColumnLimit;
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ public:
|
||||
|
||||
bool isElectricCharacter(const QChar &ch) const override;
|
||||
|
||||
Utils::optional<int> margin() const override;
|
||||
std::optional<int> margin() const override;
|
||||
|
||||
clang::format::FormatStyle styleForFile() const;
|
||||
|
||||
|
@@ -55,7 +55,7 @@ bool ClangFormatIndenter::formatCodeInsteadOfIndent() const
|
||||
return ClangFormatSettings::instance().mode() == ClangFormatSettings::Mode::Formatting;
|
||||
}
|
||||
|
||||
Utils::optional<TabSettings> ClangFormatIndenter::tabSettings() const
|
||||
std::optional<TabSettings> ClangFormatIndenter::tabSettings() const
|
||||
{
|
||||
FormatStyle style = styleForFile();
|
||||
TabSettings tabSettings;
|
||||
|
@@ -13,7 +13,7 @@ class ClangFormatIndenter final : public ClangFormatBaseIndenter
|
||||
{
|
||||
public:
|
||||
ClangFormatIndenter(QTextDocument *doc);
|
||||
Utils::optional<TextEditor::TabSettings> tabSettings() const override;
|
||||
std::optional<TextEditor::TabSettings> tabSettings() const override;
|
||||
bool formatOnSave() const override;
|
||||
|
||||
private:
|
||||
|
@@ -7,12 +7,13 @@
|
||||
|
||||
#include <texteditor/tabsettings.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include <QTextCursor>
|
||||
#include <QTextDocument>
|
||||
#include <QtTest>
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace ClangFormat::Internal {
|
||||
|
||||
class ClangFormatTestIndenter : public ClangFormatBaseIndenter
|
||||
@@ -21,7 +22,7 @@ public:
|
||||
ClangFormatTestIndenter(QTextDocument *doc) : ClangFormatBaseIndenter(doc) {}
|
||||
|
||||
private:
|
||||
Utils::optional<TextEditor::TabSettings> tabSettings() const override { return {}; }
|
||||
std::optional<TextEditor::TabSettings> tabSettings() const override { return {}; }
|
||||
};
|
||||
|
||||
class ClangFormatExtendedTestIndenter : public ClangFormatTestIndenter
|
||||
|
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <debugger/analyzer/detailederrorview.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/optional.h>
|
||||
#include <utils/treemodel.h>
|
||||
|
||||
#include <QFileSystemWatcher>
|
||||
@@ -21,6 +20,7 @@
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace ProjectExplorer { class Project; }
|
||||
|
||||
@@ -127,7 +127,7 @@ class FilterOptions {
|
||||
public:
|
||||
QSet<QString> checks;
|
||||
};
|
||||
using OptionalFilterOptions = Utils::optional<FilterOptions>;
|
||||
using OptionalFilterOptions = std::optional<FilterOptions>;
|
||||
|
||||
class DiagnosticFilterModel : public QSortFilterProxyModel
|
||||
{
|
||||
|
@@ -31,7 +31,7 @@ static bool checkFilePath(const Utils::FilePath &filePath, QString *errorMessage
|
||||
return true;
|
||||
}
|
||||
|
||||
Utils::optional<LineColumnInfo> byteOffsetInUtf8TextToLineColumn(const char *text,
|
||||
std::optional<LineColumnInfo> byteOffsetInUtf8TextToLineColumn(const char *text,
|
||||
int offset,
|
||||
int startLine)
|
||||
{
|
||||
|
@@ -3,10 +3,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include "clangtoolsdiagnostic.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace Utils { class FilePath; }
|
||||
|
||||
namespace ClangTools {
|
||||
@@ -27,7 +28,7 @@ struct LineColumnInfo {
|
||||
int column = 1; // 1-based
|
||||
int lineStartOffset = 0; // for optimiation/caching purposes
|
||||
};
|
||||
using OptionalLineColumnInfo = Utils::optional<LineColumnInfo>;
|
||||
using OptionalLineColumnInfo = std::optional<LineColumnInfo>;
|
||||
OptionalLineColumnInfo byteOffsetInUtf8TextToLineColumn(const char *text,
|
||||
int offset,
|
||||
int startLine = 1);
|
||||
|
@@ -54,7 +54,7 @@ static QString fixitStatus(FixitStatus status)
|
||||
|
||||
QString createDiagnosticToolTipString(
|
||||
const Diagnostic &diagnostic,
|
||||
Utils::optional<FixitStatus> status,
|
||||
std::optional<FixitStatus> status,
|
||||
bool showSteps)
|
||||
{
|
||||
using StringPair = QPair<QString, QString>;
|
||||
|
@@ -6,10 +6,11 @@
|
||||
#include <cppeditor/clangdiagnosticconfig.h>
|
||||
|
||||
#include <utils/id.h>
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace CppEditor { class ClangDiagnosticConfigsModel; }
|
||||
namespace Debugger { class DiagnosticLocation; }
|
||||
namespace Utils { class FilePath; }
|
||||
@@ -31,10 +32,9 @@ enum class FixitStatus {
|
||||
Invalidated,
|
||||
};
|
||||
|
||||
QString createDiagnosticToolTipString(
|
||||
const Diagnostic &diagnostic,
|
||||
Utils::optional<FixitStatus> status = Utils::nullopt,
|
||||
bool showSteps = true);
|
||||
QString createDiagnosticToolTipString(const Diagnostic &diagnostic,
|
||||
std::optional<FixitStatus> status = std::nullopt,
|
||||
bool showSteps = true);
|
||||
|
||||
CppEditor::ClangDiagnosticConfig builtinConfig();
|
||||
|
||||
|
@@ -30,7 +30,7 @@ DiagnosticMark::DiagnosticMark(const Diagnostic &diagnostic)
|
||||
setPriority(TextEditor::TextMark::HighPriority);
|
||||
QIcon markIcon = diagnostic.icon();
|
||||
setIcon(markIcon.isNull() ? Utils::Icons::CODEMODEL_WARNING.icon() : markIcon);
|
||||
setToolTip(createDiagnosticToolTipString(diagnostic, Utils::nullopt, true));
|
||||
setToolTip(createDiagnosticToolTipString(diagnostic, std::nullopt, true));
|
||||
setLineAnnotation(diagnostic.description);
|
||||
setActionsProvider([diagnostic] {
|
||||
// Copy to clipboard action
|
||||
|
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <debugger/analyzer/analyzericons.h>
|
||||
|
||||
#include <utils/optional.h>
|
||||
#include <optional>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
|
@@ -1188,7 +1188,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
||||
|
||||
const auto buildDirAspect = aspect<BuildDirectoryAspect>();
|
||||
buildDirAspect->setValueAcceptor(
|
||||
[](const QString &oldDir, const QString &newDir) -> Utils::optional<QString> {
|
||||
[](const QString &oldDir, const QString &newDir) -> std::optional<QString> {
|
||||
if (oldDir.isEmpty())
|
||||
return newDir;
|
||||
|
||||
@@ -1204,7 +1204,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
||||
== QMessageBox::Ok) {
|
||||
return newDir;
|
||||
}
|
||||
return Utils::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
return newDir;
|
||||
});
|
||||
|
@@ -166,7 +166,7 @@ QString CMakeConfigItem::typeToTypeString(const CMakeConfigItem::Type t)
|
||||
return {};
|
||||
}
|
||||
|
||||
Utils::optional<bool> CMakeConfigItem::toBool(const QString &value)
|
||||
std::optional<bool> CMakeConfigItem::toBool(const QString &value)
|
||||
{
|
||||
// Taken from CMakes if(<constant>) documentation:
|
||||
// "Named boolean constants are case-insensitive."
|
||||
|
@@ -5,11 +5,12 @@
|
||||
|
||||
#include "cmake_global.h"
|
||||
|
||||
#include <utils/optional.h>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QStringList>
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace Utils {
|
||||
class FilePath;
|
||||
class MacroExpander;
|
||||
@@ -33,7 +34,7 @@ public:
|
||||
static QStringList cmakeSplitValue(const QString &in, bool keepEmpty = false);
|
||||
static Type typeStringToType(const QByteArray &typeString);
|
||||
static QString typeToTypeString(const Type t);
|
||||
static Utils::optional<bool> toBool(const QString &value);
|
||||
static std::optional<bool> toBool(const QString &value);
|
||||
bool isNull() const { return key.isEmpty(); }
|
||||
|
||||
QString expandedValue(const ProjectExplorer::Kit *k) const;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user