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

0001 /*
0002  * SPDX-FileCopyrightText: 2014 Andreas Xavier <andxav at zoho dot com>
0003  * SPDX-License-Identifier: GPL-2.0-or-later
0004  */
0005 
0006 #ifndef READERBASE_H
0007 #define READERBASE_H
0008 
0009 #include "keduvocdocument.h"
0010 
0011 #include <QDebug>
0012 
0013 class KEduVocDocument;
0014 
0015 /**
0016  * @brief a base class for readers of various lexicon formats
0017  *
0018  * */
0019 class ReaderBase
0020 {
0021 public:
0022     /** destructor */
0023     virtual ~ReaderBase(){};
0024 
0025     /** @brief Can this reader parse the file
0026      *
0027      * Read a small portion of the header of the file
0028      * and decide if it is a suitable type.
0029      * @return true if parsable
0030      */
0031     virtual bool isParsable() = 0;
0032 
0033     /** @brief returns the KEduVocDocument::FileType that this reader handles
0034         @return KEduVocDocument::FileType handled
0035      */
0036     virtual KEduVocDocument::FileType fileTypeHandled() = 0;
0037 
0038     /**  @brief Parse file and write into doc
0039      @param doc to be written
0040      @return error status of the read.*/
0041     virtual KEduVocDocument::ErrorCode read(KEduVocDocument &doc) = 0;
0042 
0043     /** an error message.
0044         @return the error message
0045     */
0046     virtual QString errorMessage() const = 0;
0047 };
0048 
0049 #endif // READERBASE_H