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

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