blob: 6fda23bac47c4bb47a6f18b118d97bab2ba646bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#ifndef SCRIPTING_INTERNAL_MARK_H
#define SCRIPTING_INTERNAL_MARK_H
#include <QObject>
#include <QPointer>
#include <QMetaType>
namespace Scripting {
namespace Internal {
class BaseTextEditor;
/**
* @brief Keep track of a possition in a file
* This class helps you track a logical possition in a file. It's line and column properties will change as text are deleted or inserted before the mark.
*/
class Mark : public QObject
{
Q_OBJECT
Q_PROPERTY(QString fileName READ fileName)
Q_PROPERTY(int line READ line)
Q_PROPERTY(int column READ column)
public:
static Mark *create(BaseTextEditor*, int line, int column );
QString fileName() const;
int line() const;
int column() const;
private slots:
void update(int from, int charsRemoved, int charsAdded);
private:
Mark(BaseTextEditor* editor, int line, int column);
int convertPosition(int line,int column);
int m_pos;
QPointer<BaseTextEditor> m_editor;
};
} // namespace Internal
} // namespace Scripting
Q_DECLARE_METATYPE(Scripting::Internal::Mark*)
#endif // SCRIPTING_INTERNAL_MARK_H
|