File indexing completed on 2024-04-21 05:51:38
0001 /* 0002 * SPDX-FileCopyrightText: 2002-2003 Jesper K. Pedersen <blackie@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-only 0005 **/ 0006 0007 #include "positionregexp.h" 0008 0009 #include "errormap.h" 0010 0011 PositionRegExp::PositionRegExp(bool selected, PositionType tp) 0012 : RegExp(selected) 0013 { 0014 _tp = tp; 0015 } 0016 0017 bool PositionRegExp::check(ErrorMap &map, bool first, bool last) 0018 { 0019 if (_tp == BEGLINE && !first) { 0020 map.lineStartError(); 0021 } else if (_tp == ENDLINE && !last) { 0022 map.lineEndError(); 0023 } 0024 return true; 0025 } 0026 0027 QDomNode PositionRegExp::toXml(QDomDocument *doc) const 0028 { 0029 switch (_tp) { 0030 case BEGLINE: 0031 return doc->createElement(QStringLiteral("BegLine")); 0032 case ENDLINE: 0033 return doc->createElement(QStringLiteral("EndLine")); 0034 case WORDBOUNDARY: 0035 return doc->createElement(QStringLiteral("WordBoundary")); 0036 case NONWORDBOUNDARY: 0037 return doc->createElement(QStringLiteral("NonWordBoundary")); 0038 } 0039 return QDomNode(); 0040 } 0041 0042 bool PositionRegExp::load(const QDomElement & /* top */, const QString & /*version*/) 0043 { 0044 // Nothing to do. 0045 return true; 0046 }