File indexing completed on 2025-02-09 04:28:40
0001 /* 0002 This file is part of the KTextTemplate library 0003 0004 SPDX-FileCopyrightText: 2011 Stephen Kelly <steveire@gmail.com> 0005 0006 SPDX-License-Identifier: LGPL-2.1-or-later 0007 0008 */ 0009 0010 #include "textprocessingmachine_p.h" 0011 0012 using namespace KTextTemplate; 0013 0014 void TextProcessingMachine::processCharacter(QString::const_iterator character) 0015 { 0016 auto s = currentState(); 0017 while (s) { 0018 if (!doProcessCharacter(character, s)) { 0019 s = s->parent(); 0020 } else { 0021 return; 0022 } 0023 } 0024 } 0025 0026 bool TextProcessingMachine::doProcessCharacter(QString::const_iterator character, State<CharTransitionInterface> *state) 0027 { 0028 const auto transitions = state->transitions(); 0029 auto it = transitions.constBegin(); 0030 const auto end = transitions.constEnd(); 0031 for (; it != end; ++it) { 0032 if ((*it)->characterTest(character)) { 0033 executeTransition(state, *it); 0034 return true; 0035 } 0036 } 0037 return false; 0038 }