"Fossies" - the Fresh Open Source Software Archive

Member "qt-creator-opensource-src-4.15.1/src/libs/languageserverprotocol/workspace.cpp" (8 Jun 2021, 4170 Bytes) of package /linux/misc/qt-creator-opensource-src-4.15.1.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "workspace.cpp" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: opensource-src-4.15.0_vs_opensource-src-4.15.1.

    1 /****************************************************************************
    2 **
    3 ** Copyright (C) 2018 The Qt Company Ltd.
    4 ** Contact: https://www.qt.io/licensing/
    5 **
    6 ** This file is part of Qt Creator.
    7 **
    8 ** Commercial License Usage
    9 ** Licensees holding valid commercial Qt licenses may use this file in
   10 ** accordance with the commercial license agreement provided with the
   11 ** Software or, alternatively, in accordance with the terms contained in
   12 ** a written agreement between you and The Qt Company. For licensing terms
   13 ** and conditions see https://www.qt.io/terms-conditions. For further
   14 ** information use the contact form at https://www.qt.io/contact-us.
   15 **
   16 ** GNU General Public License Usage
   17 ** Alternatively, this file may be used under the terms of the GNU
   18 ** General Public License version 3 as published by the Free Software
   19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
   20 ** included in the packaging of this file. Please review the following
   21 ** information to ensure the GNU General Public License requirements will
   22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
   23 **
   24 ****************************************************************************/
   25 
   26 #include "workspace.h"
   27 
   28 namespace LanguageServerProtocol {
   29 
   30 constexpr const char WorkSpaceFolderRequest::methodName[];
   31 constexpr const char DidChangeWorkspaceFoldersNotification::methodName[];
   32 constexpr const char DidChangeConfigurationNotification::methodName[];
   33 constexpr const char ConfigurationRequest::methodName[];
   34 constexpr const char WorkspaceSymbolRequest::methodName[];
   35 constexpr const char ExecuteCommandRequest::methodName[];
   36 constexpr const char ApplyWorkspaceEditRequest::methodName[];
   37 constexpr const char DidChangeWatchedFilesNotification::methodName[];
   38 
   39 WorkSpaceFolderRequest::WorkSpaceFolderRequest()
   40     : Request(methodName, nullptr)
   41 { }
   42 
   43 DidChangeWorkspaceFoldersNotification::DidChangeWorkspaceFoldersNotification(
   44         const DidChangeWorkspaceFoldersParams &params)
   45     : Notification(methodName, params)
   46 { }
   47 
   48 DidChangeConfigurationNotification::DidChangeConfigurationNotification(
   49         const DidChangeConfigurationParams &params)
   50     : Notification(methodName, params)
   51 { }
   52 
   53 ConfigurationRequest::ConfigurationRequest(const ConfigurationParams &params)
   54     : Request(methodName, params)
   55 { }
   56 
   57 WorkspaceSymbolRequest::WorkspaceSymbolRequest(const WorkspaceSymbolParams &params)
   58     : Request(methodName, params)
   59 { }
   60 
   61 ExecuteCommandRequest::ExecuteCommandRequest(const ExecuteCommandParams &params)
   62     : Request(methodName, params)
   63 { }
   64 
   65 ApplyWorkspaceEditRequest::ApplyWorkspaceEditRequest(const ApplyWorkspaceEditParams &params)
   66     : Request(methodName, params)
   67 { }
   68 
   69 WorkspaceFoldersChangeEvent::WorkspaceFoldersChangeEvent()
   70 {
   71     insert(addedKey, QJsonArray());
   72     insert(removedKey, QJsonArray());
   73 }
   74 
   75 bool WorkspaceFoldersChangeEvent::isValid(ErrorHierarchy *error) const
   76 {
   77     return checkArray<WorkSpaceFolder>(error, addedKey)
   78             && checkArray<WorkSpaceFolder>(error, removedKey);
   79 }
   80 
   81 bool ConfigurationParams::ConfigurationItem::isValid(ErrorHierarchy *error) const
   82 {
   83     return checkOptional<QString>(error, scopeUriKey)
   84             && checkOptional<QString>(error, sectionKey);
   85 }
   86 
   87 bool DidChangeConfigurationParams::isValid(ErrorHierarchy *error) const
   88 {
   89     if (contains(settingsKey))
   90         return true;
   91     if (error)
   92         error->prependMember(settingsKey);
   93     return false;
   94 }
   95 
   96 DidChangeWatchedFilesNotification::DidChangeWatchedFilesNotification(
   97         const DidChangeWatchedFilesParams &params)
   98     : Notification(methodName, params)
   99 { }
  100 
  101 ExecuteCommandParams::ExecuteCommandParams(const Command &command)
  102 {
  103     setCommand(command.command());
  104     if (command.arguments().has_value())
  105         setArguments(command.arguments().value());
  106 }
  107 
  108 LanguageServerProtocol::WorkSpaceFolderResult::operator const QJsonValue() const
  109 {
  110     if (!Utils::holds_alternative<QList<WorkSpaceFolder>>(*this))
  111         return QJsonValue::Null;
  112     QJsonArray array;
  113     for (const auto &folder : Utils::get<QList<WorkSpaceFolder>>(*this))
  114         array.append(QJsonValue(folder));
  115     return array;
  116 }
  117 
  118 } // namespace LanguageServerProtocol