1
/****************************************************************************
2
** rtparse.cpp - class for manipulating richtext
3
** Copyright (C) 2001, 2002 Justin Karneges
5
** This program is free software; you can redistribute it and/or
6
** modify it under the terms of the GNU General Public License
7
** as published by the Free Software Foundation; either version 2
8
** of the License, or (at your option) any later version.
10
** This program 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.
15
** You should have received a copy of the GNU General Public License
16
** along with this program; if not, write to the Free Software
17
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
19
****************************************************************************/
25
RTParse::RTParse(const QString &_in)
30
//printf("rtparse:\n");
33
const QString &RTParse::output() const
35
//printf("final: [%s]\n", out.latin1());
39
QString RTParse::next()
44
// if we're at a tag, append it to the output
45
if(in.at(v_at) == '<') {
47
int n = in.find('>', v_at);
53
s = in.mid(v_at, n-v_at);
59
// now find the next tag, and grab the text in between
61
int x = in.find('<', v_at);
67
s = in.mid(v_at, x-v_at);
70
//printf("chunk = '%s'\n", s.latin1());
71
s = resolveEntities(s);
72
//printf("resolved = '%s'\n", s.latin1());
76
bool RTParse::atEnd() const
81
void RTParse::putPlain(const QString &s)
83
//printf("got this: [%s]\n", s.latin1());
84
out += expandEntities(s);
85
//printf("changed to this: [%s]\n", expandEntities(s).latin1());
88
void RTParse::putRich(const QString &s)
91
//printf("+ '%s'\n", s.latin1());