• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

kiten/lib

indexedEDICTFile.h

Go to the documentation of this file.
00001 /* This file is part of Kiten, a KDE Japanese Reference Tool...
00002     Copyright (C) 2001 by Jason Katz-Brown
00003               (C) 2008 by Joseph Kerian  <jkerian@gmail.com>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KITEN_INDEXEDEDICTFILE_H
00022 #define KITEN_INDEXEDEDICTFILE_H
00023 
00024 #include <QtCore/QFile>
00025 #include <QtCore/QString>
00026 #include <QtCore/QByteArray>
00027 #include <QtCore/QVector>
00028 
00029 #ifdef HAVE_INTTYPES_H
00030 #include <inttypes.h>
00031 #else
00032 typedef unsigned int uint32_t;
00033 #endif
00034 
00037 class /* NO_EXPORT */ indexedEDICTFile {
00038     public:
00040     indexedEDICTFile();
00041     ~indexedEDICTFile();
00043     bool loadFile(const QString &);
00045     bool valid() const;
00047     QVector<QString> findMatches(const QString &) const;
00048 
00049     private:
00050     bool checkIndex() const;
00051     bool buildIndex();
00052     bool loadmmaps();
00053     uint32_t findFirstMatch(const QByteArray &) const;
00054 
00055     QByteArray lookupFullLine(uint32_t i) const;
00056     QByteArray lookupDictLine(uint32_t i) const;
00057     unsigned char lookupDictChar(uint32_t i) const;
00058     int equalOrSubstring(const char *, const char *) const;
00059     int findMatches(const char*, const char*) const;
00060 
00061 
00062     bool m_valid;
00063     QFile m_dictFile;
00064     unsigned char* m_dictPtr;
00065     mutable QFile m_indexFile;
00066     uint32_t* m_indexPtr;
00067     static const int indexFileVersion = 14;
00068 };
00069 
00070 #endif

kiten/lib

Skip menu "kiten/lib"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
  •   stepcore
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal