From 69af1c8a96c30da8ac4f1d4a14c3b2fe2ef8e0e9 Mon Sep 17 00:00:00 2001
From: Dimitri van Heesch <dimitri@stack.nl>
Date: Tue, 6 Aug 2013 20:18:02 +0200
Subject: Brief description did not appear in the page index, when a page did
 not have any details.

---
 src/commentscan.l  |  3 ++-
 src/definition.cpp | 18 +++++++++++++-----
 src/definition.h   |  2 +-
 src/ftvhelp.cpp    |  1 +
 4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/commentscan.l b/src/commentscan.l
index 386a1d5..ff766f1 100644
--- a/src/commentscan.l
+++ b/src/commentscan.l
@@ -2848,7 +2848,8 @@ bool parseCommentBlock(/* in */     ParserInterface *parser,
   if (parseMore) position=inputPosition; else position=0;
 
   lineNr = yyLineNr;
-  //printf("position=%d parseMore=%d\n",position,parseMore);
+  //printf("position=%d parseMore=%d newEntryNeeded=%d\n",
+  //  position,parseMore,newEntryNeeded);
 
   return parseMore;
 }
diff --git a/src/definition.cpp b/src/definition.cpp
index b55eed5..c5d812f 100644
--- a/src/definition.cpp
+++ b/src/definition.cpp
@@ -67,6 +67,7 @@ class DefinitionImpl
     DocInfo   *inbodyDocs; // not exported
     BriefInfo *brief;      // not exported
     BodyInfo  *body;       // not exported
+    QCString   briefSignatures;
     QCString   docSignatures;
 
     QCString localName;      // local (unqualified) name of the definition
@@ -536,7 +537,7 @@ void Definition::writeDocAnchorsToTagFile()
   }
 }
 
-bool Definition::_docsAlreadyAdded(const QCString &doc)
+bool Definition::_docsAlreadyAdded(const QCString &doc,QCString &sigList)
 {
   uchar md5_sig[16];
   QCString sigStr(33);
@@ -545,9 +546,11 @@ bool Definition::_docsAlreadyAdded(const QCString &doc)
   QCString docStr = doc.simplifyWhiteSpace();
   MD5Buffer((const unsigned char *)docStr.data(),docStr.length(),md5_sig);
   MD5SigToString(md5_sig,sigStr.data(),33);
-  if (m_impl->docSignatures.find(sigStr)==-1) // new docs, add signature to prevent re-adding it
+  //printf("%s:_docsAlreadyAdded doc='%s' sig='%s' docSigs='%s'\n",
+  //    name().data(),doc.data(),sigStr.data(),sigList.data());
+  if (sigList.find(sigStr)==-1) // new docs, add signature to prevent re-adding it
   {
-    m_impl->docSignatures+=":"+sigStr;
+    sigList+=":"+sigStr;
     return FALSE;
   }
   else
@@ -570,7 +573,7 @@ void Definition::_setDocumentation(const char *d,const char *docFile,int docLine
   {
     doc=d;
   }
-  if (!_docsAlreadyAdded(doc))
+  if (!_docsAlreadyAdded(doc,m_impl->docSignatures))
   {
     //printf("setting docs for %s: `%s'\n",name().data(),m_doc.data());
     if (m_impl->details==0)
@@ -649,7 +652,7 @@ void Definition::_setBriefDescription(const char *b,const char *briefFile,int br
       //printf("adding to details\n");
       _setDocumentation(brief,briefFile,briefLine,FALSE,TRUE);
   }
-  else if (!_docsAlreadyAdded(brief))
+  else if (!_docsAlreadyAdded(brief,m_impl->briefSignatures))
   {
     //fprintf(stderr,"Definition::setBriefDescription(%s,%s,%d)\n",b,briefFile,briefLine);
     if (m_impl->brief==0)
@@ -668,6 +671,10 @@ void Definition::_setBriefDescription(const char *b,const char *briefFile,int br
       m_impl->brief->line = 1;
     }
   }
+  else
+  {
+    //printf("do nothing!\n");
+  }
 }
 
 void Definition::setBriefDescription(const char *b,const char *briefFile,int briefLine) 
@@ -1694,6 +1701,7 @@ QCString abbreviate(const char *s,const char *name)
 
 QCString Definition::briefDescription(bool abbr) const 
 { 
+  //printf("%s::briefDescription(%d)='%s'\n",name().data(),abbr,m_impl->brief?m_impl->brief->doc.data():"<none>");
   return m_impl->brief ? 
          (abbr ? abbreviate(m_impl->brief->doc,displayName()) : m_impl->brief->doc) :
          QCString(""); 
diff --git a/src/definition.h b/src/definition.h
index 645edbb..6b6e1d7 100644
--- a/src/definition.h
+++ b/src/definition.h
@@ -352,7 +352,7 @@ class Definition : public DefinitionIntf
     void _setBriefDescription(const char *b,const char *briefFile,int briefLine);
     void _setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace,bool atTop);
     void _setInbodyDocumentation(const char *d,const char *docFile,int docLine);
-    bool _docsAlreadyAdded(const QCString &doc);
+    bool _docsAlreadyAdded(const QCString &doc,QCString &sigList);
     DefinitionImpl *m_impl; // internal structure holding all private data
     QCString m_name;
     bool m_isSymbol;
diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp
index dd3c3d1..c0ea2bd 100644
--- a/src/ftvhelp.cpp
+++ b/src/ftvhelp.cpp
@@ -883,6 +883,7 @@ void FTVHelp::generateLink(FTextStream &t,FTVNode *n)
 static void generateBriefDoc(FTextStream &t,Definition *def)
 {
   QCString brief = def->briefDescription(TRUE);
+  //printf("*** %p: generateBriefDoc(%s)='%s'\n",def,def->name().data(),brief.data());
   if (!brief.isEmpty())
   {
     DocNode *root = validatingParseDoc(def->briefFile(),def->briefLine(),
-- 
cgit v0.12

