File indexing completed on 2024-04-14 03:40:38

0001 /*
0002     This file is part of Kiten, a KDE Japanese Reference Tool
0003     SPDX-FileCopyrightText: 2001 Jason Katz-Brown <jason@katzbrown.com>
0004     SPDX-FileCopyrightText: 2008 Joseph Kerian <jkerian@gmail.com>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef KITEN_LINEAREDICTFILE_H
0010 #define KITEN_LINEAREDICTFILE_H
0011 
0012 #include <QString>
0013 #include <QStringList>
0014 #include <QVector>
0015 
0016 /**
0017  * A class for managing the EDICT formatted dictionaries with their
0018  * dictionary files. This class is not really designed for subclassing.
0019  */
0020 class /* NO_EXPORT */ LinearEdictFile
0021 {
0022 public:
0023     /**
0024      * Create and initialize this object
0025      */
0026     LinearEdictFile();
0027     ~LinearEdictFile() = default;
0028 
0029     /**
0030      * Load a file, generate the index if it doesn't already exist
0031      */
0032     bool loadFile(const QString &filename);
0033 
0034     /**
0035      * Test if the file was properly loaded
0036      */
0037     bool valid() const;
0038 
0039     /**
0040      * Get everything that looks remotely like a given search string
0041      */
0042     QVector<QString> findMatches(const QString &searchString) const;
0043 
0044 private:
0045     QStringList m_edict;
0046     bool m_properlyLoaded;
0047 };
0048 
0049 #endif