| 1 | /* |
| 2 | This file is part of the KDE Baloo project. |
| 3 | SPDX-FileCopyrightText: 2014-2015 Vishesh Handa <vhanda@kde.org> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.1-or-later |
| 6 | */ |
| 7 | |
| 8 | #ifndef BALOO_TERMGENERATOR_H |
| 9 | #define BALOO_TERMGENERATOR_H |
| 10 | |
| 11 | #include <QByteArray> |
| 12 | #include <QString> |
| 13 | #include "engine_export.h" |
| 14 | #include "document.h" |
| 15 | |
| 16 | namespace Baloo { |
| 17 | |
| 18 | class BALOO_ENGINE_EXPORT TermGenerator |
| 19 | { |
| 20 | public: |
| 21 | explicit TermGenerator(Document& doc); |
| 22 | |
| 23 | void setDocument(Document& doc) { |
| 24 | m_doc = doc; |
| 25 | } |
| 26 | |
| 27 | void indexText(const QString& text); |
| 28 | void indexText(const QString& text, const QByteArray& prefix); |
| 29 | |
| 30 | void indexXattrText(const QString& text, const QByteArray& prefix); |
| 31 | void indexFileNameText(const QString& text); |
| 32 | |
| 33 | void setPosition(int position); |
| 34 | int position() const; |
| 35 | |
| 36 | static QByteArrayList termList(const QString& text); |
| 37 | |
| 38 | // Trim all terms to this size |
| 39 | const static int maxTermSize = 25; |
| 40 | private: |
| 41 | Document& m_doc; |
| 42 | int m_position; |
| 43 | }; |
| 44 | } |
| 45 | |
| 46 | #endif // BALOO_TERMGENERATOR_H |
| 47 | |