LibKEduVocDocument

keduvockvtmlreader.h
1/*
2 * read a KEduVocDocument from a KVTML file
3
4 * SPDX-FileCopyrightText: 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
5 * SPDX-FileCopyrightText: 2005 Eric Pignet <eric at erixpage.com>
6 * SPDX-FileCopyrightText: 2007 Peter Hedlund <peter.hedlund@kdemail.net>
7 * SPDX-FileCopyrightText: 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
8 * SPDX-License-Identifier: GPL-2.0-or-later
9*/
10
11#ifndef KEDUVOCKVTMLREADER_H
12#define KEDUVOCKVTMLREADER_H
13
14#include <QDomDocument>
15#include <QList>
16
17#include "keduvocarticle.h"
18#include "keduvocdocument.h"
19#include "keduvocexpression.h"
21#include "keduvocmultiplechoice.h"
22#include "keduvocpersonalpronoun.h"
23#include "readerbase.h"
24
25class QIODevice;
26class KEduVocDocument;
27
28/** @brief Reader for KVTML 1.0
29@author Eric Pignet
30*/
32{
34public:
35 /** constructor
36 @param file an open device
37 */
38 explicit KEduVocKvtmlReader(QIODevice &file);
39 /**destructor*/
40 ~KEduVocKvtmlReader() override{};
41
42 /** @brief Can this reader parse this file
43 *
44 Read a small portion of the header of the file
45 and decide if it is a suitable type.
46 @return true if parsable
47 */
48 virtual bool isParsable();
49
50 /** @brief Parse file and write into doc
51 @param doc to be written
52 @return error status of the read.*/
54
55 /** an error message.
56 @return the error message
57 */
58 virtual QString errorMessage() const
59 {
60 return m_errorMessage;
61 }
62
63 /**
64 * Attempt to add a language/locale. Language/locale are set to the same value.
65 * No error if already there with the same value.
66 * @param languageId identifier number
67 * @param language name
68 * @return true if successful
69 */
70 bool addLanguage(int languageId, const QString &language);
71
72 bool readLesson(QDomElement &domElementParent);
73 bool readArticle(QDomElement &domElementParent);
74 bool readPersonalPronouns(QDomElement &domElementParent, KEduVocPersonalPronoun &pronouns);
75 bool readConjugation(QDomElement &domElementParent, KEduVocConjugation &conjugation);
76 bool readTranslationConjugations(QDomElement &domElementParent, KEduVocTranslation *translation);
77 bool readType(QDomElement &domElementParent);
78 bool readTense(QDomElement &domElementParent);
79 bool readUsage(QDomElement &domElementParent);
80 bool readComparison(QDomElement &domElementParent, KEduVocTranslation *translation);
81 bool readMultipleChoice(QDomElement &domElementParent, KEduVocTranslation *translation);
82 bool readExpressionChildAttributes(QDomElement &domElementExpressionChild,
83 QString &lang,
84 grade_t &grade,
85 grade_t &rev_grade,
86 int &count,
87 int &rev_count,
88 QDateTime &date,
89 QDateTime &rev_date,
90 QString &remark,
91 int &bcount,
92 int &rev_bcount,
93 QString &query_id,
94 QString &pronunciation,
95 int &width,
96 QString &type,
97 QString &faux_ami_f,
98 QString &faux_ami_t,
99 QString &synonym,
100 QString &example,
101 QString &antonym,
102 QSet<QString> &usage,
103 QString &paraphrase);
104 bool readExpression(QDomElement &domElementParent);
105 bool readBody(QDomElement &domElementParent);
106
107private:
108 QIODevice *m_inputFile; ///< input device
109 KEduVocDocument *m_doc; ///< output doc
110 QString m_errorMessage; ///< error message
111 int m_cols;
112 int m_lines;
113 QStringList m_oldSelfDefinedTypes;
114
115 KEduVocKvtmlCompability m_compability;
116};
117
118#endif
The conjugation of a verb.
The primary entry point to the hierarchy of objects describing vocabularies.
ErrorCode
the return code when opening/saving
Reader for KVTML 1.0.
virtual bool isParsable()
Can this reader parse this file.
virtual QString errorMessage() const
an error message.
bool readExpression(QDomElement &domElementParent)
KEduVocKvtmlReader(QIODevice &file)
constructor
virtual KEduVocDocument::ErrorCode read(KEduVocDocument &doc)
Parse file and write into doc.
~KEduVocKvtmlReader() override
destructor
bool addLanguage(int languageId, const QString &language)
Attempt to add a language/locale.
The conjugation of a verb.
contains defines and constants necessary for reading kvtml files prior to KDE4.
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:55:29 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.