KTextTemplate

textprocessingmachine.cpp
1/*
2 This file is part of the KTextTemplate library
3
4 SPDX-FileCopyrightText: 2011 Stephen Kelly <steveire@gmail.com>
5
6 SPDX-License-Identifier: LGPL-2.1-or-later
7
8*/
9
10#include "textprocessingmachine_p.h"
11
12using namespace KTextTemplate;
13
14void TextProcessingMachine::processCharacter(QString::const_iterator character)
15{
16 auto s = currentState();
17 while (s) {
18 if (!doProcessCharacter(character, s)) {
19 s = s->parent();
20 } else {
21 return;
22 }
23 }
24}
25
26bool TextProcessingMachine::doProcessCharacter(QString::const_iterator character, State<CharTransitionInterface> *state)
27{
28 const auto transitions = state->transitions();
29 auto it = transitions.constBegin();
30 const auto end = transitions.constEnd();
31 for (; it != end; ++it) {
32 if ((*it)->characterTest(character)) {
33 executeTransition(state, *it);
34 return true;
35 }
36 }
37 return false;
38}
const QList< QKeySequence > & end()
The KTextTemplate namespace holds all public KTextTemplate API.
Definition Mainpage.dox:8
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:17 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.