1 /***************************************************************************
2 phrasebookparser.cpp - description
4 begin : Don Sep 12 2002
5 copyright : (C) 2002 by Gunnar Schmi Dt
6 email : kmouth@schmi-dt.de
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
18 #include "phrasebookparser.h"
20 PhraseBookParser::PhraseBookParser() {
23 PhraseBookParser::~PhraseBookParser() {
26 bool PhraseBookParser::warning (const QXmlParseException
&) {
30 bool PhraseBookParser::error (const QXmlParseException
&) {
34 bool PhraseBookParser::fatalError (const QXmlParseException
&) {
38 QString
PhraseBookParser::errorString() const {
42 bool PhraseBookParser::startDocument() {
51 bool PhraseBookParser::startElement (const QString
&, const QString
&,
53 const QXmlAttributes
&attributes
)
55 if (name
== "phrase") {
60 phrase
.shortcut
= attributes
.value("shortcut");
63 else if (name
== "phrasebook") {
67 phrase
.phrase
= attributes
.value("name");
69 if ((phrase
.phrase
.isNull() || phrase
.phrase
.isEmpty()) && starting
)
72 list
+= PhraseBookEntry (phrase
, level
, false);
80 bool PhraseBookParser::characters (const QString
&ch
) {
85 bool PhraseBookParser::ignorableWhitespace (const QString
&ch
) {
90 bool PhraseBookParser::endElement (const QString
&, const QString
&,
93 if (name
== "phrase") {
94 list
+= PhraseBookEntry (phrase
, level
, true);
97 else if (name
== "phrasebook") {
106 bool PhraseBookParser::endDocument() {
107 return (level
== offset
);
110 PhraseBookEntryList
PhraseBookParser::getPhraseList() {