From 2decb53d90293118d01edcf415090517fc98ee63 Mon Sep 17 00:00:00 2001 From: Reto Zingg Date: Sat, 15 Dec 2012 19:28:48 +0200 Subject: [PATCH] adapt qmvockvtml2reader.h for querymee --- qmvockvtml2reader.h | 63 +++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/qmvockvtml2reader.h b/qmvockvtml2reader.h index 39545f3..9376ee0 100644 --- a/qmvockvtml2reader.h +++ b/qmvockvtml2reader.h @@ -1,8 +1,14 @@ /*************************************************************************** - read a KEduVocDocument from a KVTML2 file +* this file is from kdeedu project. Filename: keduvockvtml2reader.h +***************************************************************************/ + +/*************************************************************************** + read a QmVocDocument from a KVTML2 file ----------------------------------------------------------------------- copyright : (C) 2007 Jeremy Whiting Copyright 2007-2008 Frederik Gladhorn + Copyright 2010, 2012 Reto Zingg + ***************************************************************************/ /*************************************************************************** @@ -14,38 +20,39 @@ * * ***************************************************************************/ -#ifndef KEDUVOCKVTML2READER_H -#define KEDUVOCKVTML2READER_H +#ifndef QMVOCKVTML2READER_H +#define QMVOCKVTML2READER_H #include #include +#include -#include "keduvocexpression.h" -#include "keduvocpersonalpronoun.h" -#include "keduvocarticle.h" -#include "keduvocmultiplechoice.h" +#include "qmvocexpression.h" +#include "qmvocpersonalpronoun.h" +#include "qmvocarticle.h" +#include "qmvocmultiplechoice.h" class QIODevice; -class KEduVocDocument; -class KEduVocWordType; +class QmVocDocument; +class QmVocWordType; /** -* @brief class to read kvtml2 data files into keduvocdocument +* @brief class to read kvtml2 data files into qmvocdocument * @author Jeremy Whiting */ -class KEduVocKvtml2Reader : public QObject +class QmVocKvtml2Reader : public QObject { Q_OBJECT public: /** default constructor * @param file file to read from */ - KEduVocKvtml2Reader( QIODevice *file ); + QmVocKvtml2Reader( QFile *file ); /** read the document * @param doc document object to store the data in */ - bool readDoc( KEduVocDocument *doc ); + bool readDoc( QmVocDocument *doc ); /** get the errormessage string * @returns the errormessage string @@ -75,25 +82,25 @@ private: */ bool readArticle( QDomElement &articleElement, int identifierNum ); - bool readPersonalPronoun( QDomElement &conjugElement, KEduVocPersonalPronoun &pronoun ); + bool readPersonalPronoun( QDomElement &conjugElement, QmVocPersonalPronoun &pronoun ); - bool readPersonalPronounChild(QDomElement & personElement, KEduVocPersonalPronoun &pronoun, KEduVocWordFlags flags); + bool readPersonalPronounChild(QDomElement & personElement, QmVocPersonalPronoun &pronoun, QmVocWordFlags flags); /** read the types * @param typesElement QDomElement for the types group */ - bool readWordType( KEduVocWordType* parentContainer, QDomElement &typesElement ); + bool readWordType( QmVocWordType* parentContainer, QDomElement &typesElement ); /** * Read a leitner box container. * This is a grading system where the vocabulary are kept in boxes and promoted/demoted during the learning. * Be aware that leitner boxes are a list only and no sub boxes will ever be read or written. - * While reusing the lesson class is quite easy for this a proper subclass of KEduVocContainer would be the better solution. + * While reusing the lesson class is quite easy for this a proper subclass of QmVocContainer would be the better solution. * @param parentContainer the parent to append the new leitner container to * @param leitnerElement the element in the dom * @return success */ - bool readLeitner( KEduVocLeitnerBox* parentContainer, QDomElement &leitnerElement ); + bool readLeitner( QmVocLeitnerBox* parentContainer, QDomElement &leitnerElement ); /** * Read all tags within a word type definition. @@ -101,7 +108,7 @@ private: * @param lessonElement * @return */ - bool readChildWordTypes( KEduVocWordType* parentContainer, QDomElement &lessonElement ); + bool readChildWordTypes( QmVocWordType* parentContainer, QDomElement &lessonElement ); /** read the tenses * @param tensesElement QDomElement for the tenses group @@ -121,19 +128,19 @@ private: /** read a translation * @param translationElement QDomElement for the translation to read */ - bool readTranslation( QDomElement &translationElement, KEduVocExpression *expr, int index ); + bool readTranslation( QDomElement &translationElement, QmVocExpression *expr, int index ); /** read a comparison * @param comparisonElement comparison group element * @param comp comparison object to read into */ - bool readComparison( QDomElement &comparisonElement, KEduVocTranslation *translation ); + bool readComparison( QDomElement &comparisonElement, QmVocTranslation *translation ); /** read a multiple choice group * @param multipleChoiceElement element to read from - * @param mc KEduVocMultipleChoice object to read to + * @param mc QmVocMultipleChoice object to read to */ - bool readMultipleChoice( QDomElement &multipleChoiceElement, KEduVocTranslation* translation ); + bool readMultipleChoice( QDomElement &multipleChoiceElement, QmVocTranslation* translation ); /** * Read tags. @@ -141,24 +148,24 @@ private: * @param lessonElement * @return */ - bool readChildLessons( KEduVocLesson* parentLesson, QDomElement &lessonElement ); + bool readChildLessons( QmVocLesson* parentLesson, QDomElement &lessonElement ); /** read a lesson, and append it to the document * @param lessonElement element to read from */ - bool readLesson( KEduVocLesson* parentLesson, QDomElement &lessonElement ); + bool readLesson( QmVocLesson* parentLesson, QDomElement &lessonElement ); bool readSynonymsAntonymsFalseFriends( QDomElement &rootElement ); /** pre-opened QIODevice to read from */ QIODevice *m_inputFile; - /** KEduVocDocument to read to */ - KEduVocDocument *m_doc; + /** QmVocDocument to read to */ + QmVocDocument *m_doc; /** because we read the entries first, we store them here temporarily. * later we read the lessons and put the entries there based on the key (their id) */ - QMap m_allEntries; + QMap m_allEntries; /** error message */ QString m_errorMessage; -- 2.47.3