File indexing completed on 2024-05-05 04:38:47

0001 /*
0002     SPDX-FileCopyrightText: 2015 Maciej Cencora
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_TEXTEDITORHELPERS_H
0008 #define KDEVPLATFORM_TEXTEDITORHELPERS_H
0009 
0010 #include <QRect>
0011 #include <KTextEditor/Range>
0012 
0013 #include "utilexport.h"
0014 
0015 namespace KTextEditor {
0016 class View;
0017 }
0018 
0019 namespace KDevelop {
0020 
0021 namespace KTextEditorHelpers {
0022 
0023 /// @return Item's bounding rect in global screen coordinates
0024 QRect KDEVPLATFORMUTIL_EXPORT itemBoundingRect(const KTextEditor::View* view, const KTextEditor::Range& itemRange);
0025 
0026 /**
0027  * @brief Try parsing a string such as "path_to_file:line_num:column_num".
0028  *
0029  * Both line_num and column_num may be empty. Thus, other valid inputs are: "path_to_file", "path_to_file:line_num"
0030  * @param input Source string
0031  * @param pathLength Set to the length of the "path_to_file" string, you can use this to extract the raw path from the input string
0032  * @return Cursor representing line_num and column_num
0033  * */
0034 KTextEditor::Cursor KDEVPLATFORMUTIL_EXPORT extractCursor(const QString& input, int* pathLength = nullptr);
0035 
0036 }
0037 
0038 }
0039 
0040 #endif // KDEVPLATFORM_TEXTEDITORHELPERS_H