itom
Loading...
Searching...
No Matches
indentFoldDetector.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom.
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 itom is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17 General Public Licence for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with itom. If not, see <http://www.gnu.org/licenses/>.
21
22 Further hints:
23 ------------------------
24
25 This file belongs to the code editor of itom. The code editor is
26 in major parts a fork / rewritten version of the python-based source
27 code editor PyQode from Colin Duquesnoy and others
28 (see https://github.com/pyQode). PyQode itself is licensed under
29 the MIT License (MIT).
30
31 Some parts of the code editor of itom are also inspired by the
32 source code editor of the Spyder IDE (https://github.com/spyder-ide),
33 also licensed under the MIT License and developed by the Spyder Project
34 Contributors.
35
36*********************************************************************** */
37
38#ifndef INDENTFOLDDETECTOR_H
39#define INDENTFOLDDETECTOR_H
40
41#include "foldDetector.h"
42
43#include <qregularexpression.h>
44
45namespace ito {
46
47/*
48This module contains the code folding API.
49*/
50
51
52/*
53Simple fold detector based on the line indentation level
54*/
56{
57 Q_OBJECT
58public:
59 IndentFoldDetector(QObject *parent = NULL);
60
61 virtual ~IndentFoldDetector();
62
63 /*
64 Detects the block fold level.
65
66 The default implementation is based on the block **indentation**.
67
68 .. note:: Blocks fold level must be contiguous, there cannot be
69 a difference greater than 1 between two successive block fold
70 levels.
71
72 :param prev_block: first previous **non-blank** block or None if this
73 is the first line of the document
74 :param block: The block to process.
75 :return: Fold level
76 */
77 virtual int detectFoldLevel(const QTextBlock &previousBlock, const QTextBlock &block);
78private:
79
80 QRegularExpression m_reContinuationLine;
81 QRegularExpression m_lastSignatureLine;
82};
83
84} //end namespace ito
85
86
87#endif
Definition foldDetector.h:67
Definition indentFoldDetector.h:56
Definition apiFunctionsGraph.cpp:40