searchindex.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * $Id: searchindex.h,v 1.7 2001/03/19 19:27:41 root Exp $
00004  *
00005  * Copyright (C) 1997-2008 by Dimitri van Heesch.
00006  *
00007  * Permission to use, copy, modify, and distribute this software and its
00008  * documentation under the terms of the GNU General Public License is hereby 
00009  * granted. No representations are made about the suitability of this software 
00010  * for any purpose. It is provided "as is" without express or implied warranty.
00011  * See the GNU General Public License for more details.
00012  *
00013  * Documents produced by Doxygen are derivative works derived from the
00014  * input used in their production; they are not affected by this license.
00015  *
00016  */
00017 
00018 #ifndef _SEARCHINDEX_H
00019 #define _SEARCHINDEX_H
00020 
00021 #include "qtbc.h"
00022 #include <qintdict.h>
00023 #include <qlist.h>
00024 #include <qdict.h>
00025 #include <qintdict.h>
00026 #include <qvector.h>
00027 
00028 struct URL
00029 {
00030   URL(const char *n,const char *u) : name(n), url(u) {} 
00031   QCString name;
00032   QCString url;
00033 };
00034 
00035 
00036 struct URLInfo
00037 {
00038   URLInfo(int idx,int f) : urlIdx(idx), freq(f) {}
00039   int urlIdx;
00040   int freq;
00041 };
00042 
00043 class IndexWord
00044 {
00045   public:
00046     IndexWord(const char *word);
00047     void addUrlIndex(int,bool);
00048     const QIntDict<URLInfo> &urls() const { return m_urls; }
00049     QCString word() const { return m_word; }
00050 
00051   private:
00052     QCString    m_word;
00053     QIntDict<URLInfo> m_urls;
00054 };
00055 
00056 class SearchIndex
00057 {
00058   public:
00059     SearchIndex();
00060     void setCurrentDoc(const char *name,const char *baseName,const char *anchor=0);
00061     void addWord(const char *word,bool hiPriority);
00062     void write(const char *file);
00063   private:
00064     QDict<IndexWord> m_words;
00065     QVector< QList<IndexWord> > m_index;
00066     QIntDict<URL>  m_urls;
00067     int m_urlIndex;
00068 };
00069 
00070 
00071 #endif



Generated on Mon Mar 31 10:58:43 2008 by  doxygen 1.5.1