summaryrefslogtreecommitdiffstats
path: root/src/definition.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2001-01-21 19:05:35 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2001-01-21 19:05:35 (GMT)
commit41e1827f53fa1b9ef018b378f8aca4e4fec6750a (patch)
treec28a8c29b3e53508bef2ee53a06b7c4ac6925fe9 /src/definition.cpp
parent583cc3299ac171f473e4221b0b535ea616e4db03 (diff)
downloadDoxygen-41e1827f53fa1b9ef018b378f8aca4e4fec6750a.zip
Doxygen-41e1827f53fa1b9ef018b378f8aca4e4fec6750a.tar.gz
Doxygen-41e1827f53fa1b9ef018b378f8aca4e4fec6750a.tar.bz2
Release-1.2.4-20010121
Diffstat (limited to 'src/definition.cpp')
-rw-r--r--src/definition.cpp69
1 files changed, 45 insertions, 24 deletions
diff --git a/src/definition.cpp b/src/definition.cpp
index 4805638..eb8b905 100644
--- a/src/definition.cpp
+++ b/src/definition.cpp
@@ -35,7 +35,7 @@ Definition::Definition(const char *df,int dl,
n=name;
brief=b;
doc=d;
- sectionList=0,
+ sectionDict=0,
startBodyLine=endBodyLine=-1,
bodyDef=0;
sourceRefList=0;
@@ -46,7 +46,7 @@ Definition::Definition(const char *df,int dl,
Definition::~Definition()
{
- delete sectionList;
+ delete sectionDict;
delete sourceRefList;
delete sourceRefDict;
}
@@ -90,18 +90,39 @@ void Definition::addSectionsToDefinition(QList<QCString> *anchorList)
while (s)
{
SectionInfo *si=0;
- if (!s->isEmpty() && (si=sectionDict[*s]))
+ if (!s->isEmpty() && (si=Doxygen::sectionDict[*s]))
{
//printf("Add section `%s' to definition `%s'\n",
// si->label.data(),n.data());
- if (sectionList==0) sectionList = new SectionList;
- sectionList->append(si);
+ if (sectionDict==0)
+ {
+ sectionDict = new SectionDict(17);
+ }
+ if (sectionDict->find(*s)==0)
+ {
+ sectionDict->insert(*s,si);
+ }
si->definition = this;
}
s=anchorList->next();
}
}
+void Definition::writeDocAnchorsToTagFile()
+{
+ if (!Config::genTagFile.isEmpty() && sectionDict)
+ {
+ QDictIterator<SectionInfo> sdi(*sectionDict);
+ SectionInfo *si;
+ for (;(si=sdi.current());++sdi)
+ {
+ if (definitionType()==TypeMember) Doxygen::tagFile << " ";
+ Doxygen::tagFile << " <docanchor>" << si->label << "</docanchor>" << endl;
+ }
+ }
+}
+
+
void Definition::setBriefDescription(const char *b)
{
brief=QCString(b).stripWhiteSpace();
@@ -177,32 +198,34 @@ static bool readCodeFragment(const char *fileName,
}
if (found)
{
- // full the line with spaces until the right column
- int i;
- for (i=0;i<col;i++) result+=' ';
+ // fill the line with spaces until the right column
+ QCString spaces;
+ spaces.fill(' ',col);
+ result+=spaces;
// copy until end of line
result+=c;
if (c==':') result+=cn;
startLine=lineNr;
const int maxLineLength=4096;
char lineStr[maxLineLength];
- char *p=lineStr;
- while ((c=f.getch())!='\n' && c!=-1) *p++=c;
- //printf("First line str=`%s' atEnd=%d lineNr=%d endLine=%d\n",lineStr.data(),f.atEnd(),lineNr,endLine);
- *p++='\n';
- *p++='\0';
- while (lineNr<endLine && !f.atEnd())
+ do
{
- //printf("adding line=`%s' lineNr=%d\n",lineStr.data(),lineNr);
- result+=lineStr;
- f.readLine(lineStr,maxLineLength);
+ int size_read;
+ do {
+ // read up to maxLineLength-1 bytes, the last byte being zero
+ size_read = f.readLine(lineStr, maxLineLength);
+ result+=lineStr;
+ } while (size_read == (maxLineLength-1));
+
lineNr++;
+ } while (lineNr<endLine && !f.atEnd());
+
+ int charIndex = result.findRev('}');
+ if (charIndex > 0)
+ {
+ result.truncate(charIndex+1);
+ result+='\n';
}
- p=lineStr+strlen(lineStr);
- while (--p>=lineStr && *p!='}') /* skip */;
- *(++p)='\n';
- *(++p)='\0';
- result+=lineStr;
endLine=lineNr;
return TRUE;
}
@@ -395,8 +418,6 @@ void Definition::writeSourceRefs(OutputList &ol,const char *scopeName)
ol.popGeneratorState();
}
-
-
bool Definition::hasDocumentation()
{
return !doc.isEmpty() || // has detailed docs