2016-05-31 16:07:09 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2016-09-13 13:57:08 +02:00
|
|
|
#include "clangbackend_global.h"
|
2016-09-15 11:56:25 +02:00
|
|
|
#include "clangclock.h"
|
|
|
|
|
|
2016-05-31 16:07:09 +02:00
|
|
|
#include <utf8string.h>
|
2017-08-24 09:53:27 +02:00
|
|
|
#include <utf8stringvector.h>
|
2016-05-31 16:07:09 +02:00
|
|
|
|
|
|
|
|
#include <QFlags>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QVector>
|
|
|
|
|
|
2016-09-14 16:16:10 +02:00
|
|
|
#include <functional>
|
|
|
|
|
|
2016-05-31 16:07:09 +02:00
|
|
|
namespace ClangBackEnd {
|
|
|
|
|
|
2017-09-20 16:38:22 +02:00
|
|
|
class ClangCodeModelClientInterface;
|
2016-09-14 16:16:10 +02:00
|
|
|
class Document;
|
2017-09-20 16:38:22 +02:00
|
|
|
class IAsyncJob;
|
2016-09-14 16:16:10 +02:00
|
|
|
|
2016-05-31 16:07:09 +02:00
|
|
|
class JobRequest
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
enum class Type {
|
2017-09-20 17:12:06 +02:00
|
|
|
Invalid,
|
|
|
|
|
|
2016-05-31 16:07:09 +02:00
|
|
|
UpdateDocumentAnnotations,
|
|
|
|
|
CreateInitialDocumentPreamble,
|
2016-09-14 16:16:10 +02:00
|
|
|
|
|
|
|
|
ParseSupportiveTranslationUnit,
|
|
|
|
|
ReparseSupportiveTranslationUnit,
|
|
|
|
|
|
2016-05-31 16:07:09 +02:00
|
|
|
CompleteCode,
|
|
|
|
|
RequestDocumentAnnotations,
|
2017-06-09 12:19:09 +02:00
|
|
|
RequestReferences,
|
2017-07-27 10:58:05 +02:00
|
|
|
FollowSymbol,
|
2017-07-28 15:15:46 +02:00
|
|
|
|
|
|
|
|
SuspendDocument,
|
|
|
|
|
ResumeDocument,
|
2016-05-31 16:07:09 +02:00
|
|
|
};
|
|
|
|
|
|
2017-09-20 17:28:25 +02:00
|
|
|
enum class RunCondition {
|
2017-07-28 15:13:23 +02:00
|
|
|
NoCondition = 1 << 0,
|
|
|
|
|
DocumentVisible = 1 << 1,
|
|
|
|
|
DocumentNotVisible = 1 << 2,
|
2017-07-28 15:15:46 +02:00
|
|
|
DocumentSuspended = 1 << 3,
|
|
|
|
|
DocumentUnsuspended = 1 << 4,
|
|
|
|
|
CurrentDocumentRevision = 1 << 5,
|
2017-06-09 12:19:09 +02:00
|
|
|
};
|
2017-09-20 17:28:25 +02:00
|
|
|
Q_DECLARE_FLAGS(RunConditions, RunCondition)
|
2017-06-09 12:19:09 +02:00
|
|
|
|
2017-09-20 17:28:25 +02:00
|
|
|
enum class ExpirationCondition {
|
2017-06-01 16:18:58 +02:00
|
|
|
Never = 1 << 0,
|
|
|
|
|
|
|
|
|
|
DocumentClosed = 1 << 1,
|
|
|
|
|
DocumentRevisionChanged = 1 << 2, // Only effective if DocumentIsClosed is also set
|
|
|
|
|
UnsavedFilesChanged = 1 << 3,
|
|
|
|
|
ProjectChanged = 1 << 4,
|
|
|
|
|
|
|
|
|
|
AnythingChanged = DocumentClosed
|
|
|
|
|
| DocumentRevisionChanged
|
|
|
|
|
| UnsavedFilesChanged
|
|
|
|
|
| ProjectChanged,
|
2016-05-31 16:07:09 +02:00
|
|
|
};
|
2017-09-20 17:28:25 +02:00
|
|
|
Q_DECLARE_FLAGS(ExpirationConditions, ExpirationCondition)
|
2016-05-31 16:07:09 +02:00
|
|
|
|
|
|
|
|
public:
|
2017-09-20 17:12:06 +02:00
|
|
|
JobRequest(Type type = Type::Invalid);
|
2016-05-31 16:07:09 +02:00
|
|
|
|
2017-09-20 16:38:22 +02:00
|
|
|
IAsyncJob *createJob() const;
|
|
|
|
|
void cancelJob(ClangCodeModelClientInterface &client) const;
|
|
|
|
|
|
2016-10-06 12:54:22 +02:00
|
|
|
bool operator==(const JobRequest &other) const;
|
|
|
|
|
|
2016-05-31 16:07:09 +02:00
|
|
|
public:
|
|
|
|
|
quint64 id = 0;
|
|
|
|
|
Type type;
|
2017-09-20 17:28:25 +02:00
|
|
|
ExpirationConditions expirationConditions;
|
|
|
|
|
RunConditions runConditions;
|
2016-05-31 16:07:09 +02:00
|
|
|
|
|
|
|
|
// General
|
|
|
|
|
Utf8String filePath;
|
|
|
|
|
Utf8String projectPartId;
|
2016-09-15 11:56:25 +02:00
|
|
|
TimePoint unsavedFilesChangeTimePoint;
|
|
|
|
|
TimePoint projectChangeTimePoint;
|
2016-05-31 16:07:09 +02:00
|
|
|
uint documentRevision = 0;
|
2016-09-13 13:57:08 +02:00
|
|
|
PreferredTranslationUnit preferredTranslationUnit = PreferredTranslationUnit::RecentlyParsed;
|
2016-05-31 16:07:09 +02:00
|
|
|
|
2017-06-09 12:19:09 +02:00
|
|
|
// Specific to some jobs
|
2016-05-31 16:07:09 +02:00
|
|
|
quint32 line = 0;
|
|
|
|
|
quint32 column = 0;
|
2017-08-10 11:05:48 +02:00
|
|
|
qint32 funcNameStartLine = -1;
|
|
|
|
|
qint32 funcNameStartColumn = -1;
|
2016-05-31 16:07:09 +02:00
|
|
|
quint64 ticketNumber = 0;
|
2017-09-26 16:00:30 +02:00
|
|
|
bool localReferences = false;
|
2016-05-31 16:07:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using JobRequests = QVector<JobRequest>;
|
|
|
|
|
|
|
|
|
|
QDebug operator<<(QDebug debug, const JobRequest &jobRequest);
|
2017-08-23 09:14:54 +02:00
|
|
|
std::ostream &operator<<(std::ostream &os, JobRequest::Type type);
|
|
|
|
|
std::ostream &operator<<(std::ostream &os, PreferredTranslationUnit preferredTranslationUnit);
|
|
|
|
|
|
2016-05-31 16:07:09 +02:00
|
|
|
|
|
|
|
|
} // namespace ClangBackEnd
|