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 readComparison(QDomElement &domElementParent, KEduVocTranslation *translation);
80 bool readMultipleChoice(QDomElement &domElementParent, KEduVocTranslation *translation);
81 bool readExpressionChildAttributes(QDomElement &domElementExpressionChild,
82 QString &lang,
83 grade_t &grade,
84 grade_t &rev_grade,
85 int &count,
86 int &rev_count,
87 QDateTime &date,
88 QDateTime &rev_date,
89 QString &remark,
90 int &bcount,
91 int &rev_bcount,
92 QString &query_id,
93 QString &pronunciation,
94 int &width,
95 QString &type,
96 QString &faux_ami_f,
97 QString &faux_ami_t,
98 QString &synonym,
99 QString &example,
100 QString &antonym,
101 QSet<QString> &usage,
102 QString &paraphrase);
103 bool readExpression(QDomElement &domElementParent);
104 bool readBody(QDomElement &domElementParent);
105
106private:
107 QIODevice *m_inputFile; ///< input device
108 KEduVocDocument *m_doc; ///< output doc
109 QString m_errorMessage; ///< error message
110 int m_cols;
111 int m_lines;
112 QStringList m_oldSelfDefinedTypes;
113
114 KEduVocKvtmlCompability m_compability;
115};
116
117#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-2025 The KDE developers.
Generated on Fri Jan 3 2025 11:59:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.