*******************************************************************************/
-//Created by Mateusz Półrola
+/*!
+ \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ */
#ifndef STARDICTREADER_H
#define STARDICTREADER_H
#include <QObject>
+/*!
+ Abstract class used for reading stardict dict and idx files.
+ It allows to read all necessary data types used in parsing stardict files.
+ */
class StarDictReader : public QObject {
Q_OBJECT
public:
StarDictReader(QObject *parent = 0) : QObject(parent) {}
virtual ~StarDictReader() {}
+ /*!
+ Reads translations text from dict file.
+ \param offset 32-bit offset of translation in file, readed from idx file
+ \param len length of translation, readed from idx file too
+ */
virtual QString readString(qint32 offset, qint32 len)=0;
+
+ /*!
+ Reads translations text from dict file.
+ \param offset 64-bit offset of translation in file, readed from idx file
+ \param len length of translation, readed from idx file too
+ */
virtual QString readString(qint64 offset, qint32 len)=0;
- virtual QChar readChar()=0;
+
+ /*!
+ Reads 32-bits integer value from file and convert it from BigEndian
+ to Little Endian
+ */
virtual qint32 readInt32BigEndian()=0;
+
+ /*!
+ Reads 64-bits integer value from file and convert it from BigEndian
+ to Little Endian
+ */
virtual qint64 readInt64BigEndian()=0;
+
+ /*!
+ Reads single string from file, end of string is marked as '\0' in file.
+ */
virtual QString readKeyword()=0;
- virtual bool open(QString file)=0;
+
+
+ /*!
+ Closing file;
+ */
virtual void close()=0;
+
+protected:
+ /*!
+ Opens file
+ \returns true if file is opened or false otherwise
+ */
+ virtual bool open(QString file)=0;
+
+ /*!
+ Reads single char from file.
+ */
+ virtual QChar readChar()=0;
+
};
#endif // STARDICTREADER_H