File indexing completed on 2024-04-21 03:48:19

0001 /*
0002  * read a KEduVocDocument from a WQL file
0003  * SPDX-FileCopyrightText: 2004, 2007 Peter Hedlund <peter.hedlund@kdemail.net>
0004  * SPDX-FileCopyrightText: 2005 Eric Pignet
0005  * SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef KEDUVOCWQLREADER_H
0009 #define KEDUVOCWQLREADER_H
0010 
0011 #include "keduvocdocument.h"
0012 #include "readerbase.h"
0013 #include <QString>
0014 
0015 class QIODevice;
0016 class KEduVocDocument;
0017 
0018 /**@brief Reader for WordQuiz files*/
0019 class KEduVocWqlReader : public ReaderBase
0020 {
0021 public:
0022     /** constructor
0023         @param file an open device
0024     */
0025     explicit KEduVocWqlReader(QIODevice &file);
0026     /**destructor*/
0027     ~KEduVocWqlReader() override{};
0028 
0029     /** @brief Can this reader parse this file
0030      *
0031      Read a small portion of the header of the file
0032      and decide if it is a suitable type.
0033      @return true if parsable
0034      */
0035     bool isParsable() Q_DECL_OVERRIDE;
0036 
0037     /** @brief returns the KEduVocDocument::FileType that this reader handles
0038         @return KEduVocDocument::FileType handled
0039      */
0040     KEduVocDocument::FileType fileTypeHandled() Q_DECL_OVERRIDE;
0041 
0042     /**  @brief Parse file and write into doc
0043      @param doc to be written
0044      @return error status of the read.*/
0045     KEduVocDocument::ErrorCode read(KEduVocDocument &doc) Q_DECL_OVERRIDE;
0046 
0047     /** an error message.
0048         @return the error message
0049     */
0050     QString errorMessage() const Q_DECL_OVERRIDE
0051     {
0052         return m_errorMessage;
0053     }
0054 
0055 private:
0056     QIODevice *m_inputFile; ///< input device
0057     KEduVocDocument *m_doc; ///< output doc
0058     QString m_errorMessage; ///< error message
0059 };
0060 
0061 #endif