2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2009-05-14 16:37:17 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2009-05-14 16:37:17 +02:00
|
|
|
|
|
|
|
|
#include "utils_global.h"
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QString>
|
2010-04-30 13:08:06 +02:00
|
|
|
|
2009-05-14 16:37:17 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QPlainTextEdit;
|
2022-05-24 13:45:35 +02:00
|
|
|
class QTextCursor;
|
2009-05-14 16:37:17 +02:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Utils {
|
|
|
|
|
|
2021-06-28 09:13:57 +02:00
|
|
|
class MultiTextCursor;
|
|
|
|
|
|
2010-04-30 13:08:06 +02:00
|
|
|
class QTCREATOR_UTILS_EXPORT CommentDefinition
|
|
|
|
|
{
|
|
|
|
|
public:
|
2017-04-24 16:01:14 +02:00
|
|
|
static CommentDefinition CppStyle;
|
|
|
|
|
static CommentDefinition HashStyle;
|
2010-04-30 13:08:06 +02:00
|
|
|
|
2017-04-24 16:01:14 +02:00
|
|
|
CommentDefinition();
|
|
|
|
|
CommentDefinition(const QString &single,
|
|
|
|
|
const QString &multiStart = QString(), const QString &multiEnd = QString());
|
2014-07-30 16:01:34 +02:00
|
|
|
|
|
|
|
|
bool isValid() const;
|
2010-04-30 13:08:06 +02:00
|
|
|
bool hasSingleLineStyle() const;
|
|
|
|
|
bool hasMultiLineStyle() const;
|
|
|
|
|
|
2013-05-25 00:42:44 +02:00
|
|
|
public:
|
2018-07-23 10:45:40 +02:00
|
|
|
bool isAfterWhiteSpaces = false;
|
2013-05-25 00:42:44 +02:00
|
|
|
QString singleLine;
|
|
|
|
|
QString multiLineStart;
|
|
|
|
|
QString multiLineEnd;
|
2010-04-30 13:08:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QTCREATOR_UTILS_EXPORT
|
2021-09-06 07:22:07 +02:00
|
|
|
QTextCursor unCommentSelection(const QTextCursor &cursor,
|
|
|
|
|
const CommentDefinition &definiton = CommentDefinition(),
|
|
|
|
|
bool preferSingleLine = false);
|
2009-05-14 16:37:17 +02:00
|
|
|
|
2021-06-28 09:13:57 +02:00
|
|
|
QTCREATOR_UTILS_EXPORT
|
|
|
|
|
MultiTextCursor unCommentSelection(const MultiTextCursor &cursor,
|
|
|
|
|
const CommentDefinition &definiton = CommentDefinition(),
|
|
|
|
|
bool preferSingleLine = false);
|
|
|
|
|
|
2011-02-04 09:52:39 +01:00
|
|
|
} // namespace Utils
|