/***************************************************************************
- 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 <jpwhiting@kde.org>
Copyright 2007-2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
+ Copyright 2010, 2012 Reto Zingg <g.d0b3rm4n@gmail.com>
+
***************************************************************************/
/***************************************************************************
* *
***************************************************************************/
-#ifndef KEDUVOCKVTML2READER_H
-#define KEDUVOCKVTML2READER_H
+#ifndef QMVOCKVTML2READER_H
+#define QMVOCKVTML2READER_H
#include <QtXml/QDomDocument>
#include <QList>
+#include <QFile>
-#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
*/
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 <container> tags within a word type definition.
* @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
/** 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 <lesson> tags.
* @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<int, KEduVocExpression*> m_allEntries;
+ QMap<int, QmVocExpression*> m_allEntries;
/** error message */
QString m_errorMessage;