Cute Chess 0.1
pgntoken.h
1/*
2 This file is part of Cute Chess.
3 Copyright (C) 2008-2018 Cute Chess authors
4
5 Cute Chess is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Cute Chess is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef PGNTOKEN_H
20#define PGNTOKEN_H
21
22#include <QString>
23#include <QTextCursor>
24#include <QTextCharFormat>
25
30{
31 public:
33 PgnToken();
35 virtual ~PgnToken();
36
41 bool isEmpty() const;
43 int length() const;
45 virtual QString toString() const = 0;
50 void insert(QTextCursor& cursor);
52 void select(QTextCursor& cursor);
54 void move(int diff);
56 void mergeCharFormat(QTextCursor& cursor,
57 const QTextCharFormat& format);
58
59 protected:
64 virtual void vInsert(QTextCursor& cursor) = 0;
65
66 private:
67 int m_begin;
68 int m_end;
69};
70
71#endif // PGNTOKEN_H
void move(int diff)
Definition pgntoken.cpp:65
virtual ~PgnToken()
Definition pgntoken.cpp:28
int length() const
Definition pgntoken.cpp:37
void mergeCharFormat(QTextCursor &cursor, const QTextCharFormat &format)
Definition pgntoken.cpp:74
void insert(QTextCursor &cursor)
Definition pgntoken.cpp:42
virtual void vInsert(QTextCursor &cursor)=0
void select(QTextCursor &cursor)
Definition pgntoken.cpp:56
virtual QString toString() const =0
PgnToken()
Definition pgntoken.cpp:22
bool isEmpty() const
Definition pgntoken.cpp:32