File indexing completed on 2024-05-12 05:46:31

0001 /*
0002   This file is part of the KDE Help Center
0003 
0004   Copyright (c) 2016 Pino Toscano <pino@kde.org>
0005 
0006   This program is free software; you can redistribute it and/or modify
0007   it under the terms of the GNU General Public License as published by
0008   the Free Software Foundation; either version 2 of the License, or
0009   (at your option) any later version.
0010 
0011   This program is distributed in the hope that it will be useful,
0012   but WITHOUT ANY WARRANTY; without even the implied warranty of
0013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014   GNU General Public License for more details.
0015 
0016   You should have received a copy of the GNU General Public License
0017   along with this program; if not, write to the Free Software
0018   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
0019   MA  02110-1301, USA
0020 */
0021 
0022 #ifndef CACHEREADER_H
0023 #define CACHEREADER_H
0024 
0025 #include <QByteArray>
0026 #include <QMultiHash>
0027 #include <QPair>
0028 #include <QSet>
0029 #include <QString>
0030 
0031 class CacheReader
0032 {
0033   public:
0034     CacheReader();
0035     ~CacheReader();
0036 
0037     bool parse( const QString& file );
0038 
0039     QSet<QString> documents() const;
0040     QByteArray document( const QString& id ) const;
0041 
0042   private:
0043     typedef QPair<int, int> Range;
0044 
0045     QString mText;
0046     QMultiHash<QString, Range> mRanges;
0047 };
0048 
0049 #endif