Diffstat (limited to 'noncore/net/mailit/textparser.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mailit/textparser.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/net/mailit/textparser.cpp b/noncore/net/mailit/textparser.cpp index 3fa5f6e..e5c9f7c 100644 --- a/noncore/net/mailit/textparser.cpp +++ b/noncore/net/mailit/textparser.cpp @@ -1,110 +1,110 @@ /********************************************************************** ** Copyright (C) 2001 Trolltech AS. All rights reserved. ** ** This file is part of Qt Palmtop Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "textparser.h" -TextParser::TextParser(QString in, QString lineBreak) +TextParser::TextParser(const QString &in, const QString &lineBreak) { data = in; lineSep = lineBreak; init(); createSeparators(); split(); } -TextParser::TextParser(QString in, QString lineBreak, QString sep) +TextParser::TextParser(const QString &in, const QString &lineBreak, const QString &sep) { data = in; lineSep = lineBreak; init(); separators = sep; split(); } void TextParser::init() { lineCount = 0; linePos = 0; totalElmCount = 0; separatorPos = -1; //not initialized wordPos = -1; //not initialized sepAtLine = 0; sepAtPosElm = -1; //such that nextSep equals 0 wordAtLine = 0; wordAtPosElm = -1; //such that nextWord equals 0 atLine = 0; atPosElm = 0; } void TextParser::createSeparators() { separators = " @#,.:;<>*/(){}|'?-+=_"; } /* Returns pos of given search criteria, -1 if not found */ -int TextParser::find(QString target, QChar sep, int pos, bool upperCase) +int TextParser::find(const QString &target, QChar sep, int pos, bool upperCase) { t_splitElm parsstr; - QString pString; - + QString pString, pTarget; + pTarget = target; int atLine = 0, atPosElm = 0; getLineReference(pos,&atLine,&atPosElm); for (int x = pos; x < totalElmCount; x++) { parsstr=splitDone[atLine].elm[atPosElm++]; if (upperCase) { pString=parsstr.str.upper(); - target=target.upper(); + pTarget=pTarget.upper(); } else { pString=parsstr.str; } - if ((pString == target) && (parsstr.separator == sep)) + if ((pString == pTarget) && (parsstr.separator == sep)) { return x; } if (atPosElm >= splitDone[atLine].elmCount) { //new Line atLine++; atPosElm = 0; } } return -1; } int TextParser::elmCount() { return totalElmCount; } QChar TextParser::separatorAt(int pos) { if (getLineReference(pos, &sepAtLine, &sepAtPosElm) == -1) return QChar::null; separatorPos = pos; return splitDone[sepAtLine].elm[sepAtPosElm].separator; |