diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/classdef.cpp | 7 | ||||
-rw-r--r-- | src/definition.cpp | 20 | ||||
-rw-r--r-- | src/filedef.cpp | 7 | ||||
-rw-r--r-- | src/groupdef.cpp | 7 | ||||
-rw-r--r-- | src/memberdef.cpp | 9 | ||||
-rw-r--r-- | src/namespacedef.cpp | 7 | ||||
-rw-r--r-- | src/searchindex.h | 49 | ||||
-rw-r--r-- | src/translator_de.h | 72 | ||||
-rw-r--r-- | src/translator_it.h | 2 | ||||
-rw-r--r-- | src/translator_ru.h | 119 | ||||
-rw-r--r-- | src/xmlgen.cpp | 4 |
11 files changed, 244 insertions, 59 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 315e7aa..8ea85c2 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -35,6 +35,7 @@ #include "defargs.h" #include "debug.h" #include "docparser.h" +#include "searchindex.h" // constructs a new class definition @@ -850,6 +851,12 @@ void ClassDef::writeDocumentation(OutputList &ol) addGroupListToTitle(ol,this); endTitle(ol,getOutputFileBase(),name()); + if (Config_getBool("SEARCHENGINE")) + { + Doxygen::searchIndex->setCurrentDoc(pageTitle,getOutputFileBase()); + Doxygen::searchIndex->addWord(localName().lower()); + } + ol.startTextBlock(); //printf("Class %s brief=`%s' doc=`%s'\n",name().data(),briefDescription().data(),documentation().data()); diff --git a/src/definition.cpp b/src/definition.cpp index c94c7c5..e0841ef 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -252,7 +252,7 @@ static bool readCodeFragment(const char *fileName, // skip until the startLine has reached while (lineNr<startLine && !feof(f)) { - while ((c=fgetc(f))!='\n' && c==EOF) /* skip */; + while ((c=fgetc(f))!='\n' && c!=EOF) /* skip */; lineNr++; } if (!feof(f)) @@ -263,6 +263,7 @@ static bool readCodeFragment(const char *fileName, { while ((c=fgetc(f))!='{' && c!=':' && c!=EOF) { + //printf("parsing char `%c'\n",c); if (c=='\n') { lineNr++,col=0; @@ -286,6 +287,7 @@ static bool readCodeFragment(const char *fileName, found=TRUE; } } + //printf(" -> readCodeFragment(%s,%d,%d) lineNr=%d\n",fileName,startLine,endLine,lineNr); if (found) { // For code with more than one line, @@ -305,11 +307,21 @@ static bool readCodeFragment(const char *fileName, char lineStr[maxLineLength]; do { + //printf("reading line %d in range %d-%d\n",lineNr,startLine,endLine); int size_read; - do { + do + { // read up to maxLineLength-1 bytes, the last byte being zero char *p = fgets(lineStr, maxLineLength,f); - if (p) size_read=qstrlen(p); else size_read=-1; + //printf(" read %s",p); + if (p) + { + size_read=qstrlen(p); + } + else + { + size_read=-1; + } result+=lineStr; } while (size_read == (maxLineLength-1)); @@ -432,7 +444,7 @@ void Definition::writeInlineCode(OutputList &ol,const char *scopeName) { ol.pushGeneratorState(); //printf("Source Fragment %s: %d-%d bodyDef=%p\n",name().data(), - // startBodyLine,endBodyLine,bodyDef); + // m_startBodyLine,m_endBodyLine,m_bodyDef); if (Config_getBool("INLINE_SOURCES") && m_startBodyLine!=-1 && m_endBodyLine>=m_startBodyLine && m_bodyDef) { diff --git a/src/filedef.cpp b/src/filedef.cpp index 2a94da2..161d1fc 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -31,6 +31,7 @@ #include "code.h" #include "docparser.h" #include "ftvhelp.h" +#include "searchindex.h" //#include "xml.h" class DevNullCodeDocInterface : public BaseCodeDocInterface @@ -220,6 +221,12 @@ void FileDef::writeDocumentation(OutputList &ol) endTitle(ol,getOutputFileBase(),docName()); //ol.newParagraph(); + if (Config_getBool("SEARCHENGINE")) + { + Doxygen::searchIndex->setCurrentDoc(pageTitle,getOutputFileBase()); + Doxygen::searchIndex->addWord(localName().lower()); + } + if (!Config_getString("GENERATE_TAGFILE").isEmpty()) { Doxygen::tagFile << " <compound kind=\"file\">" << endl; diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 28e21db..999f032 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -31,6 +31,7 @@ #include "doxygen.h" #include "pagedef.h" #include "docparser.h" +#include "searchindex.h" GroupDef::GroupDef(const char *df,int dl,const char *na,const char *t, const char *refFileName) : Definition(df,dl,na) @@ -413,6 +414,12 @@ void GroupDef::writeDocumentation(OutputList &ol) addGroupListToTitle(ol,this); endTitle(ol,getOutputFileBase(),title); + if (Config_getBool("SEARCHENGINE")) + { + Doxygen::searchIndex->setCurrentDoc(title,getOutputFileBase()); + Doxygen::searchIndex->addWord(localName().lower()); + } + if (Config_getBool("DETAILS_AT_TOP")) { writeDetailedDocumentation(ol); diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 7f6dd61..92e9024 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -32,6 +32,7 @@ #include "defargs.h" #include "docparser.h" #include "dot.h" +#include "searchindex.h" //#include "xml.h" @@ -723,6 +724,14 @@ void MemberDef::writeDeclaration(OutputList &ol, // differs from the cname. if (getOuterScope()) osname=getOuterScope()->name(); + if (Config_getBool("SEARCHENGINE")) + { + Doxygen::searchIndex->setCurrentDoc(qualifiedName(),getOutputFileBase()+Config_getString("HTML_FILE_EXTENSION")+"#"+anchor()); + Doxygen::searchIndex->addWord(localName().lower()); + Doxygen::searchIndex->addWord(qualifiedName().lower()); + } + + HtmlHelp *htmlHelp=0; bool hasHtmlHelp = Config_getBool("GENERATE_HTML") && Config_getBool("GENERATE_HTMLHELP"); diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 1146924..c2aa94a 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -26,6 +26,7 @@ #include "doxygen.h" #include "message.h" #include "docparser.h" +#include "searchindex.h" NamespaceDef::NamespaceDef(const char *df,int dl, const char *name,const char *lref) : @@ -260,6 +261,12 @@ void NamespaceDef::writeDocumentation(OutputList &ol) addGroupListToTitle(ol,this); endTitle(ol,getOutputFileBase(),displayName()); + if (Config_getBool("SEARCHENGINE")) + { + Doxygen::searchIndex->setCurrentDoc(pageTitle,getOutputFileBase()); + Doxygen::searchIndex->addWord(localName().lower()); + } + if (!Config_getString("GENERATE_TAGFILE").isEmpty()) { Doxygen::tagFile << " <compound kind=\"namespace\">" << endl; diff --git a/src/searchindex.h b/src/searchindex.h index f9d9c2f..87fcd70 100644 --- a/src/searchindex.h +++ b/src/searchindex.h @@ -25,55 +25,6 @@ #include <qintdict.h> #include <qvector.h> - -#if 0 // old version -#include "suffixtree.h" -//class IndexTree; -class SuffixTree; - -class DocRef -{ - public: - DocRef(int index,const char *name,const char *url) - { i=index; n=name; u=url; } - ~DocRef() {} - void setOffset(int offset) { o=offset; } - const char *name() const { return n; } - const char *url() const { return u; } - int index() const { return i; } - int offset() const { return o; } - - private: - QCString n; - QCString u; - int i; - int o; -}; - -typedef QList<DocRef> DocRefList; -typedef QDict<DocRef> DocRefDict; - -class SearchIndex -{ - public: - SearchIndex(); - ~SearchIndex(); - void addReference(const char *key,const char *ref); - bool addWord(const char *key,const char *word,bool special); - bool saveIndex(const char *fileName); - void dump() { suffixTree->dump(); } - - private: - //IndexTree *indexTree; - SuffixTree *suffixTree; - DocRefList refList; - DocRefDict refDict; - QIntDict<DocRef> nameIndex; - int indexCount; -}; - -#endif - struct URL { URL(const char *n,const char *u) : name(n), url(u) {} diff --git a/src/translator_de.h b/src/translator_de.h index 9ba91e1..3a7880f 100644 --- a/src/translator_de.h +++ b/src/translator_de.h @@ -77,13 +77,16 @@ // - Updated for "new since 1.3" version // - translated Java package to Paket // +// 2003/09/11 Jens Seidel (jensseidel@users.sourceforge.net) +// - Updated for "new since 1.3.1" version +// // Todo: // - see FIXME #ifndef TRANSLATOR_DE_H #define TRANSLATOR_DE_H -class TranslatorGerman : public TranslatorAdapter_1_3_1 +class TranslatorGerman : public Translator { public: @@ -1523,7 +1526,74 @@ class TranslatorGerman : public TranslatorAdapter_1_3_1 { return "Statische Paketattribute"; } + +////////////////////////////////////////////////////////////////////////// +// new since 1.3.1 +////////////////////////////////////////////////////////////////////////// + /*! Used in the quick index of a class/file/namespace member list page + * to link to the unfiltered list of all members. + */ + virtual QCString trAll() + { + return "Alle"; + } + /*! Put in front of the call graph for a function. */ + virtual QCString trCallGraph() + { + return "Hier ist der Graph aller Aufrufe fЭr diese Funktion:"; + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.3.3 +////////////////////////////////////////////////////////////////////////// + + /*! When the search engine is enabled this text is put in the header + * of each page before the field where one can enter the text to search + * for. + */ + virtual QCString trSearchForIndex() + { + return "Suchen nach"; + } + /*! This string is used as the title for the page listing the search + * results. + */ + virtual QCString trSearchResultsTitle() + { + return "Suchergebnisse"; + } + /*! This string is put just before listing the search results. The + * text can be different depending on the number of documents found. + * Inside the text you can put the special marker $num to insert + * the number representing the actual number of search results. + * The @a numDocuments parameter can be either 0, 1 or 2, where the + * value 2 represents 2 or more matches. HTML markup is allowed inside + * the returned string. + */ + virtual QCString trSearchResults(int numDocuments) + { + if (numDocuments==0) + { + return "Es wurden keine Dokumente zu Ihrer Suchanfrage gefunden."; + } + else if (numDocuments==1) + { + return "Es wurde <b>1</b> Dokument zu Ihrer Suchanfrage gefunden."; + } + else + { + return "Es wurden <b>$num</b> Dokumente zu Ihrer Suchanfrage " + "gefunden. Die besten Treffer werden zuerst angezeigt."; + } + } + /*! This string is put before the list of matched words, for each search + * result. What follows is the list of words that matched the query. + */ + virtual QCString trSearchMatches() + { + return "Treffer:"; + } }; #endif diff --git a/src/translator_it.h b/src/translator_it.h index 9346593..1a43a17 100644 --- a/src/translator_it.h +++ b/src/translator_it.h @@ -70,7 +70,7 @@ #ifndef TRANSLATOR_IT_H #define TRANSLATOR_IT_H -class TranslatorItalian : public TranslatorAdapter_1_3_3 +class TranslatorItalian : public Translator { public: diff --git a/src/translator_ru.h b/src/translator_ru.h index 39fd1a3..a7ef03c 100644 --- a/src/translator_ru.h +++ b/src/translator_ru.h @@ -18,7 +18,7 @@ * * Nickolay Semyonov * Andrey V. Stolyarov released Feb 14, 2001 - * Alexandr V. Chelpanov <cav@cryptopro.ru> released Apr 21, 2001 + * Alexandr V. Chelpanov <cav@cryptopro.ru> released Sep 16, 2003 * * При переводе заголовков слова list и documentation убраны. * @@ -48,7 +48,7 @@ #ifndef TRANSLATOR_RU_H #define TRANSLATOR_RU_H -class TranslatorRussian : public TranslatorAdapter_1_3 +class TranslatorRussian : public Translator { private: /*! The Decode() inline assumes the source written in the @@ -1445,6 +1445,121 @@ class TranslatorRussian : public TranslatorAdapter_1_3 { return decode( "Cобытия" ); } + +////////////////////////////////////////////////////////////////////////// +// new since 1.3 +////////////////////////////////////////////////////////////////////////// + + /*! Used as a heading for a list of Java class types with package scope. + */ + virtual QCString trPackageTypes() + { + return decode( "Типы с областью видимости пакета" ); + } + /*! Used as a heading for a list of Java class functions with package + * scope. + */ + virtual QCString trPackageMembers() + { + return decode( "Функции с областью видимости пакета" ); + } + /*! Used as a heading for a list of static Java class functions with + * package scope. + */ + virtual QCString trStaticPackageMembers() + { + return decode( "Статические функции с областью видимости пакета" ); + } + /*! Used as a heading for a list of Java class variables with package + * scope. + */ + virtual QCString trPackageAttribs() + { + return decode( "Переменные с областью видимости пакета" ); + } + /*! Used as a heading for a list of static Java class variables with + * package scope. + */ + virtual QCString trStaticPackageAttribs() + { + return decode( "Статические переменные с областью видимости пакета" ); + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.3.1 +////////////////////////////////////////////////////////////////////////// + + /*! Used in the quick index of a class/file/namespace member list page + * to link to the unfiltered list of all members. + */ + virtual QCString trAll() + { + return decode( "Указатель" ); + } + /*! Put in front of the call graph for a function. */ + virtual QCString trCallGraph() + { + return decode( "Граф вызовов:" ); + } + +////////////////////////////////////////////////////////////////////////// +// new since 1.3.3 +////////////////////////////////////////////////////////////////////////// + + /*! When the search engine is enabled this text is put in the header + * of each page before the field where one can enter the text to search + * for. + */ + virtual QCString trSearchForIndex() + { + return decode( "Поиск" ); + } + /*! This string is used as the title for the page listing the search + * results. + */ + virtual QCString trSearchResultsTitle() + { + return decode( "Результаты поиска" ); + } + /*! This string is put just before listing the search results. The + * text can be different depending on the number of documents found. + * Inside the text you can put the special marker $num to insert + * the number representing the actual number of search results. + * The @a numDocuments parameter can be either 0, 1 or 2, where the + * value 2 represents 2 or more matches. HTML markup is allowed inside + * the returned string. + */ + virtual QCString trSearchResults(int numDocuments) + { + if (numDocuments==0) + { + return decode( "К сожалению, по Вашему запросу ничего не найдено." ); + } + else if( numDocuments == 1 ) + { + return decode( "Найдено <b>$num</b> документ" ) + as_documents( numDocuments ) + + "."; + } + else + { + return decode( "Найдено <b>$num</b> документ" ) + as_documents( numDocuments ) + + decode( ". Документы отсортированы по релевантности." ); + } + } + /*! This string is put before the list of matched words, for each search + * result. What follows is the list of words that matched the query. + */ + virtual QCString trSearchMatches() + { + return decode( "Найдено:" ); + } + + QCString as_documents( int num ) + { + if( num % 10 == 1 ) return ""; + if( (num % 10) >= 2 && (num % 10) <= 4 ) return decode( "а" ); + return decode( "ов" ); + } }; #endif diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 757e035..1ba6fe1 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -220,7 +220,7 @@ class XMLCodeGenerator : public BaseCodeDocInterface writeXMLCodeString(m_t,text); } void writeCodeLink(const char *ref,const char *file, - const char *anchor,const char *text) + const char *anchor,const char *name) { XML_DB(("(writeCodeLink)\n")); if (m_insideCodeLine && !m_insideSpecialHL && m_normalHLNeedStartTag) @@ -228,7 +228,7 @@ class XMLCodeGenerator : public BaseCodeDocInterface m_t << "<highlight class=\"normal\">"; m_normalHLNeedStartTag=FALSE; } - writeXMLLink(m_t,ref,file,anchor,text); + writeXMLLink(m_t,ref,file,anchor,name); } void startCodeLine() { |