diff options
Diffstat (limited to 'src')
269 files changed, 13853 insertions, 10321 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 868cd04..1840648 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -224,6 +224,7 @@ add_library(doxymain STATIC classdef.cpp classlist.cpp cmdmapper.cpp + conceptdef.cpp condparser.cpp context.cpp cppvalue.cpp diff --git a/src/cite.cpp b/src/cite.cpp index 1773831..79b45da 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -35,13 +35,13 @@ const char *bibTmpDir = "bibTmpDir/"; class CiteInfoImpl : public CiteInfo { public: - CiteInfoImpl(const char *label, const char *text=0) + CiteInfoImpl(const QCString &label, const QCString &text=QCString()) : m_label(label), m_text(text) { } virtual QCString label() const { return m_label; } virtual QCString text() const { return m_text; } - void setText(const char *s) { m_text = s; } + void setText(const QCString &s) { m_text = s; } private: QCString m_label; @@ -63,18 +63,18 @@ CitationManager::CitationManager() : p(new Private) { } -void CitationManager::insert(const char *label) +void CitationManager::insert(const QCString &label) { p->entries.insert( std::make_pair( - std::string(label), + label.str(), std::make_unique<CiteInfoImpl>(label) )); } -const CiteInfo *CitationManager::find(const char *label) const +const CiteInfo *CitationManager::find(const QCString &label) const { - auto it = p->entries.find(label); + auto it = p->entries.find(label.str()); if (it!=p->entries.end()) { return it->second.get(); @@ -93,12 +93,12 @@ bool CitationManager::isEmpty() const return (numFiles==0 || p->entries.empty()); } -const char *CitationManager::fileName() const +QCString CitationManager::fileName() const { return "citelist"; } -const char *CitationManager::anchorPrefix() const +QCString CitationManager::anchorPrefix() const { return "CITEREF_"; } @@ -113,13 +113,13 @@ void CitationManager::insertCrossReferencesForBibFile(const QCString &bibFile) FileInfo fi(bibFile.str()); if (!fi.exists()) { - err("bib file %s not found!\n",bibFile.data()); + err("bib file %s not found!\n",qPrint(bibFile)); return; } std::ifstream f(bibFile.str(), std::ifstream::in); if (!f.is_open()) { - err("could not open file %s for reading\n",bibFile.data()); + err("could not open file %s for reading\n",qPrint(bibFile)); return; } @@ -130,7 +130,7 @@ void CitationManager::insertCrossReferencesForBibFile(const QCString &bibFile) while (getline(f,lineStr)) { int i; - QCString line = lineStr; + QCString line(lineStr); if (line.stripWhiteSpace().startsWith("@")) { // assumption entry like: "@book { name," or "@book { name" (spaces optional) @@ -168,7 +168,7 @@ void CitationManager::insertCrossReferencesForBibFile(const QCString &bibFile) } } } - //printf("citeName = #%s#\n",citeName.data()); + //printf("citeName = #%s#\n",qPrint(citeName)); } else if ((i=line.find("crossref"))!=-1 && !citeName.isEmpty()) /* assumption cross reference is on one line and the only item */ { @@ -179,8 +179,8 @@ void CitationManager::insertCrossReferencesForBibFile(const QCString &bibFile) QCString crossrefName = line.mid((uint)(j+1),(uint)(k-j-1)); // check if the reference with the cross reference is used // insert cross reference when cross reference has not yet been added. - if ((p->entries.find(citeName.data())!=p->entries.end()) && - (p->entries.find(crossrefName.data())==p->entries.end())) // not found yet + if ((p->entries.find(citeName.str())!=p->entries.end()) && + (p->entries.find(crossrefName.str())==p->entries.end())) // not found yet { insert(crossrefName); } @@ -214,7 +214,7 @@ void CitationManager::generatePage() std::ofstream t(citeListFile.str(),std::ofstream::out | std::ofstream::binary); if (!t.is_open()) { - err("could not open file %s for writing\n",citeListFile.data()); + err("could not open file %s for writing\n",qPrint(citeListFile)); } t << "<!-- BEGIN CITATIONS -->\n"; t << "<!--\n"; @@ -246,7 +246,7 @@ void CitationManager::generatePage() Dir thisDir; if (!thisDir.exists(bibOutputDir.str()) && !thisDir.mkdir(bibOutputDir.str())) { - err("Failed to create temporary output directory '%s', skipping citations\n",bibOutputDir.data()); + err("Failed to create temporary output directory '%s', skipping citations\n",qPrint(bibOutputDir)); return; } int i = 0; @@ -273,8 +273,9 @@ void CitationManager::generatePage() // bibliography in citelist.doc int exitCode; Portable::sysTimerStop(); - if ((exitCode=Portable::system("perl","\""+bib2xhtmlFile+"\" "+bibOutputFiles+" \""+ - citeListFile+"\"" + (citeDebug ? " -d" : ""))) != 0) + QCString perlArgs = "\""+bib2xhtmlFile+"\" "+bibOutputFiles+" \""+ citeListFile+"\""; + if (citeDebug) perlArgs+=" -d"; + if ((exitCode=Portable::system("perl",perlArgs)) != 0) { err("Problems running bibtex. Verify that the command 'perl --version' works from the command line. Exit code: %d\n", exitCode); @@ -289,16 +290,16 @@ void CitationManager::generatePage() std::ifstream f(citeListFile.str(),std::ifstream::in); if (!f.is_open()) { - err("could not open file %s for reading\n",citeListFile.data()); + err("could not open file %s for reading\n",qPrint(citeListFile)); } bool insideBib=FALSE; - //printf("input=[%s]\n",input.data()); + //printf("input=[%s]\n",qPrint(input)); std::string lineStr; while (getline(f,lineStr)) { - QCString line = lineStr; - //printf("pos=%d s=%d line=[%s]\n",pos,s,line.data()); + QCString line(lineStr); + //printf("pos=%d s=%d line=[%s]\n",pos,s,qPrint(line)); if (line.find("<!-- BEGIN BIBLIOGRAPHY")!=-1) insideBib=TRUE; else if (line.find("<!-- END BIBLIOGRAPH")!=-1) insideBib=FALSE; @@ -316,8 +317,8 @@ void CitationManager::generatePage() QCString number = line.mid(uj+2,uk-uj-1); label = substitute(substitute(label,"–","--"),"—","---"); line = line.left(ui+14) + label + line.right(line.length()-uj); - auto it = p->entries.find(label.data()); - //printf("label='%s' number='%s' => %p\n",label.data(),number.data(),it->second.get()); + auto it = p->entries.find(label.str()); + //printf("label='%s' number='%s' => %p\n",qPrint(label),qPrint(number),it->second.get()); if (it!=p->entries.end()) { it->second->setText(number); @@ -326,7 +327,7 @@ void CitationManager::generatePage() } if (insideBib) doc+=line+"\n"; } - //printf("doc=[%s]\n",doc.data()); + //printf("doc=[%s]\n",qPrint(doc)); } // 7. add it as a page @@ -357,7 +358,7 @@ void CitationManager::generatePage() } else { - err("bib file %s not found!\n",bibFile.data()); + err("bib file %s not found!\n",qPrint(bibFile)); } } } @@ -40,12 +40,12 @@ class CitationManager static CitationManager &instance(); /** Insert a citation identified by \a label into the database */ - void insert(const char *label); + void insert(const QCString &label); /** Return the citation info for a given \a label. * Ownership of the info stays with the manager. */ - const CiteInfo *find(const char *label) const; + const CiteInfo *find(const QCString &label) const; /** Generate the citations page */ void generatePage(); @@ -61,8 +61,8 @@ class CitationManager */ QCString latexBibFiles(); - const char *fileName() const; - const char *anchorPrefix() const; + QCString fileName() const; + QCString anchorPrefix() const; private: /** Create the database, with an expected maximum of \a size entries */ diff --git a/src/clangparser.cpp b/src/clangparser.cpp index 431215b..6646adf 100644 --- a/src/clangparser.cpp +++ b/src/clangparser.cpp @@ -92,7 +92,7 @@ static QCString detab(const QCString &s) return out.get(); } -static QCString keywordToType(const char *keyword) +static const char * keywordToType(const char *keyword) { static const StringUnorderedSet flowKeywords({ "break", "case", "catch", "continue", "default", "do", @@ -263,7 +263,7 @@ void ClangTUParser::parse() // provide the input and and its dependencies as unsaved files so we can // pass the filtered versions - argv[argc++]=qstrdup(fileName); + argv[argc++]=qstrdup(fileName.data()); } //printf("source %s ----------\n%s\n-------------\n\n", // fileName,p->source.data()); @@ -272,7 +272,7 @@ void ClangTUParser::parse() p->sources.resize(numUnsavedFiles); p->ufs.resize(numUnsavedFiles); p->sources[0] = detab(fileToString(fileName,filterSourceFiles,TRUE)); - p->ufs[0].Filename = qstrdup(fileName); + p->ufs[0].Filename = qstrdup(fileName.data()); p->ufs[0].Contents = p->sources[0].data(); p->ufs[0].Length = p->sources[0].length(); p->fileMapping.insert({fileName.data(),0}); @@ -355,7 +355,7 @@ void ClangTUParser::switchToFile(const FileDef *fd) p->tokens = 0; p->numTokens = 0; - CXFile f = clang_getFile(p->tu, fd->absFilePath()); + CXFile f = clang_getFile(p->tu, fd->absFilePath().data()); auto it = p->fileMapping.find(fd->absFilePath().data()); if (it!=p->fileMapping.end() && it->second < p->numFiles) { @@ -517,7 +517,7 @@ void ClangTUParser::writeLineNumber(CodeOutputInterface &ol,const FileDef *fd,ui } else // no link { - ol.writeLineNumber(0,0,0,line); + ol.writeLineNumber(QCString(),QCString(),QCString(),line); } // set search page target @@ -634,7 +634,7 @@ void ClangTUParser::linkInclude(CodeOutputInterface &ol,const FileDef *fd, } if (ifd) { - ol.writeCodeLink(ifd->getReference(),ifd->getOutputFileBase(),0,text,ifd->briefDescriptionAsTooltip()); + ol.writeCodeLink(ifd->getReference(),ifd->getOutputFileBase(),QCString(),text,ifd->briefDescriptionAsTooltip()); } else { diff --git a/src/classdef.cpp b/src/classdef.cpp index 17b9acb..152c316 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -57,7 +57,7 @@ static QCString makeQualifiedNameWithTemplateParameters(const ClassDef *cd, { //static bool optimizeOutputJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA); bool hideScopeNames = Config_getBool(HIDE_SCOPE_NAMES); - //printf("qualifiedNameWithTemplateParameters() localName=%s\n",localName().data()); + //printf("qualifiedNameWithTemplateParameters() localName=%s\n",qPrint(localName())); QCString scName; const Definition *d=cd->getOuterScope(); if (d) @@ -100,7 +100,7 @@ static QCString makeQualifiedNameWithTemplateParameters(const ClassDef *cd, } } } - //printf("qualifiedNameWithTemplateParameters: scope=%s qualifiedName=%s\n",name().data(),scName.data()); + //printf("qualifiedNameWithTemplateParameters: scope=%s qualifiedName=%s\n",qPrint(name()),qPrint(scName)); return scName; } @@ -142,7 +142,7 @@ static QCString makeDisplayName(const ClassDef *cd,bool includeScope) //{ // n = n.left(n.length()-2); //} - //printf("ClassDefImpl::displayName()=%s\n",n.data()); + //printf("ClassDefImpl::displayName()=%s\n",qPrint(n)); return n; } @@ -154,9 +154,9 @@ static QCString makeDisplayName(const ClassDef *cd,bool includeScope) class ClassDefImpl : public DefinitionMixin<ClassDefMutable> { public: - ClassDefImpl(const char *fileName,int startLine,int startColumn, - const char *name,CompoundType ct, - const char *ref=0,const char *fName=0, + ClassDefImpl(const QCString &fileName,int startLine,int startColumn, + const QCString &name,CompoundType ct, + const QCString &ref=QCString(),const QCString &fName=QCString(), bool isSymbol=TRUE,bool isJavaEnum=FALSE); /** Destroys a compound definition. */ ~ClassDefImpl(); @@ -177,9 +177,9 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable> virtual QCString displayName(bool includeScope=TRUE) const; virtual CompoundType compoundType() const; virtual QCString compoundTypeString() const; - virtual BaseClassList baseClasses() const; + virtual const BaseClassList &baseClasses() const; virtual void updateBaseClasses(const BaseClassList &bcd); - virtual BaseClassList subClasses() const; + virtual const BaseClassList &subClasses() const; virtual void updateSubClasses(const BaseClassList &bcd); virtual const MemberNameInfoLinkedMap &memberNameInfoLinkedMap() const; virtual Protection protection() const; @@ -188,7 +188,6 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable> virtual bool isVisibleInHierarchy() const; virtual bool visibleInParentsDeclList() const; virtual const ArgumentList &templateArguments() const; - virtual NamespaceDef *getNamespaceDef() const; virtual FileDef *getFileDef() const; virtual const MemberDef *getMemberByName(const QCString &) const; virtual bool isBaseClass(const ClassDef *bcd,bool followInstances,int level=0) const; @@ -202,7 +201,7 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable> virtual const UsesClassList &usedByImplementationClasses() const; virtual const ConstraintClassList &templateTypeConstraints() const; virtual bool isTemplateArgument() const; - virtual const Definition *findInnerCompound(const char *name) const; + virtual const Definition *findInnerCompound(const QCString &name) const; virtual ArgumentLists getTemplateParameterLists() const; virtual QCString qualifiedNameWithTemplateParameters( const ArgumentLists *actualParams=0,uint *actualParamIndex=0) const; @@ -239,39 +238,40 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable> virtual bool subGrouping() const; virtual bool isSliceLocal() const; virtual bool hasNonReferenceSuperClass() const; + virtual QCString requiresClause() const; virtual ClassDef *insertTemplateInstance(const QCString &fileName,int startLine,int startColumn, const QCString &templSpec,bool &freshInstance) const; - virtual void insertBaseClass(ClassDef *,const char *name,Protection p,Specifier s,const char *t=0); - virtual void insertSubClass(ClassDef *,Protection p,Specifier s,const char *t=0); - virtual void setIncludeFile(FileDef *fd,const char *incName,bool local,bool force); + virtual void insertBaseClass(ClassDef *,const QCString &name,Protection p,Specifier s,const QCString &t=QCString()); + virtual void insertSubClass(ClassDef *,Protection p,Specifier s,const QCString &t=QCString()); + virtual void setIncludeFile(FileDef *fd,const QCString &incName,bool local,bool force); virtual void insertMember(MemberDef *); virtual void insertUsedFile(const FileDef *); - virtual bool addExample(const char *anchor,const char *name, const char *file); + virtual bool addExample(const QCString &anchor,const QCString &name, const QCString &file); virtual void mergeCategory(ClassDef *category); - virtual void setNamespace(NamespaceDef *nd); + //virtual void setNamespace(NamespaceDef *nd); virtual void setFileDef(FileDef *fd); virtual void setSubGrouping(bool enabled); virtual void setProtection(Protection p); virtual void setGroupDefForAllMembers(GroupDef *g,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs); virtual void addInnerCompound(const Definition *d); - virtual void addUsedClass(ClassDef *cd,const char *accessName,Protection prot); - virtual void addUsedByClass(ClassDef *cd,const char *accessName,Protection prot); + virtual void addUsedClass(ClassDef *cd,const QCString &accessName,Protection prot); + virtual void addUsedByClass(ClassDef *cd,const QCString &accessName,Protection prot); virtual void setIsStatic(bool b); virtual void setCompoundType(CompoundType t); - virtual void setClassName(const char *name); + virtual void setClassName(const QCString &name); virtual void setClassSpecifier(uint64 spec); virtual void setTemplateArguments(const ArgumentList &al); virtual void setTemplateBaseClassNames(const TemplateNameMap &templateNames); virtual void setTemplateMaster(const ClassDef *tm); virtual void setTypeConstraints(const ArgumentList &al); - virtual void addMembersToTemplateInstance(const ClassDef *cd,const ArgumentList &templateArguments,const char *templSpec); + virtual void addMembersToTemplateInstance(const ClassDef *cd,const ArgumentList &templateArguments,const QCString &templSpec); virtual void makeTemplateArgument(bool b=TRUE); virtual void setCategoryOf(ClassDef *cd); virtual void setUsedOnly(bool b); virtual void setTagLessReference(const ClassDef *cd); - virtual void setName(const char *name); - virtual void setMetaData(const char *md); + virtual void setName(const QCString &name); + virtual void setMetaData(const QCString &md); virtual void findSectionsInDocumentation(); virtual void addMembersToMemberGroup(); virtual void addListReferences(); @@ -285,13 +285,13 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable> virtual void writeMemberPages(OutputList &ol) const; virtual void writeMemberList(OutputList &ol) const; virtual void writeDeclaration(OutputList &ol,const MemberDef *md,bool inGroup, - const ClassDef *inheritedFrom,const char *inheritId) const; + const ClassDef *inheritedFrom,const QCString &inheritId) const; virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *md) const; virtual void writeSummaryLinks(OutputList &ol) const; virtual void reclassifyMember(MemberDefMutable *md,MemberType t); virtual void writeInlineDocumentation(OutputList &ol) const; virtual void writeDeclarationLink(OutputList &ol,bool &found, - const char *header,bool localNames) const; + const QCString &header,bool localNames) const; virtual void removeMemberFromLists(MemberDef *md); virtual void setAnonymousEnumType(); virtual void countMembers(); @@ -299,7 +299,7 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable> virtual void addGroupedInheritedMembers(OutputList &ol,MemberListType lt, const ClassDef *inheritedFrom,const QCString &inheritId) const; - virtual void writeTagFile(std::ostream &); + virtual void writeTagFile(TextStream &); virtual int countMembersIncludingGrouped(MemberListType lt,const ClassDef *inheritedFrom,bool additional) const; virtual int countInheritanceNodes() const; @@ -307,11 +307,13 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable> int lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const; virtual void writeMemberDeclarations(OutputList &ol,ClassDefSet &visitedClasses, MemberListType lt,const QCString &title, - const char *subTitle=0,bool showInline=FALSE,const ClassDef *inheritedFrom=0, + const QCString &subTitle=QCString(), + bool showInline=FALSE,const ClassDef *inheritedFrom=0, int lt2=-1,bool invert=FALSE,bool showAlways=FALSE) const; + virtual void setRequiresClause(const QCString &req); private: - void addUsedInterfaceClasses(MemberDef *md,const char *typeStr); + void addUsedInterfaceClasses(MemberDef *md,const QCString &typeStr); void showUsedFiles(OutputList &ol) const; void writeDocumentationContents(OutputList &ol,const QCString &pageTitle) const; @@ -323,7 +325,7 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable> bool showAlways) const; void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title,bool showInline=FALSE) const; void writeSimpleMemberDocumentation(OutputList &ol,MemberListType lt) const; - void writePlainMemberDeclaration(OutputList &ol,MemberListType lt,bool inGroup,const ClassDef *inheritedFrom,const char *inheritId) const; + void writePlainMemberDeclaration(OutputList &ol,MemberListType lt,bool inGroup,const ClassDef *inheritedFrom,const QCString &inheritId) const; void writeBriefDescription(OutputList &ol,bool exampleFlag) const; void writeDetailedDescription(OutputList &ol,const QCString &pageType,bool exampleFlag, const QCString &title,const QCString &anchor=QCString()) const; @@ -353,6 +355,8 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable> QCString &title,QCString &subtitle) const; QCString includeStatement() const; void addTypeConstraint(const QCString &typeConstraint,const QCString &type); + void writeTemplateSpec(OutputList &ol,const Definition *d, + const QCString &type,SrcLangExt lang) const; // PIMPL idiom class IMPL; @@ -360,9 +364,9 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable> }; ClassDefMutable *createClassDef( - const char *fileName,int startLine,int startColumn, - const char *name,ClassDef::CompoundType ct, - const char *ref,const char *fName, + const QCString &fileName,int startLine,int startColumn, + const QCString &name,ClassDef::CompoundType ct, + const QCString &ref,const QCString &fName, bool isSymbol,bool isJavaEnum) { return new ClassDefImpl(fileName,startLine,startColumn,name,ct,ref,fName,isSymbol,isJavaEnum); @@ -408,9 +412,9 @@ class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef> { return getCdAlias()->compoundType(); } virtual QCString compoundTypeString() const { return getCdAlias()->compoundTypeString(); } - virtual BaseClassList baseClasses() const + virtual const BaseClassList &baseClasses() const { return getCdAlias()->baseClasses(); } - virtual BaseClassList subClasses() const + virtual const BaseClassList &subClasses() const { return getCdAlias()->subClasses(); } virtual const MemberNameInfoLinkedMap &memberNameInfoLinkedMap() const { return getCdAlias()->memberNameInfoLinkedMap(); } @@ -426,8 +430,8 @@ class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef> { return getCdAlias()->visibleInParentsDeclList(); } virtual const ArgumentList &templateArguments() const { return getCdAlias()->templateArguments(); } - virtual NamespaceDef *getNamespaceDef() const - { return getCdAlias()->getNamespaceDef(); } + //virtual NamespaceDef *getNamespaceDef() const + //{ return getCdAlias()->getNamespaceDef(); } virtual FileDef *getFileDef() const { return getCdAlias()->getFileDef(); } virtual const MemberDef *getMemberByName(const QCString &s) const @@ -454,7 +458,7 @@ class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef> { return getCdAlias()->templateTypeConstraints(); } virtual bool isTemplateArgument() const { return getCdAlias()->isTemplateArgument(); } - virtual const Definition *findInnerCompound(const char *name) const + virtual const Definition *findInnerCompound(const QCString &name) const { return getCdAlias()->findInnerCompound(name); } virtual ArgumentLists getTemplateParameterLists() const { return getCdAlias()->getTemplateParameterLists(); } @@ -527,6 +531,8 @@ class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef> { return getCdAlias()->isSliceLocal(); } virtual bool hasNonReferenceSuperClass() const { return getCdAlias()->hasNonReferenceSuperClass(); } + virtual QCString requiresClause() const + { return getCdAlias()->requiresClause(); } virtual int countMembersIncludingGrouped(MemberListType lt,const ClassDef *inheritedFrom,bool additional) const { return getCdAlias()->countMembersIncludingGrouped(lt,inheritedFrom,additional); } @@ -537,7 +543,7 @@ class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef> { return getCdAlias()->countMemberDeclarations(lt,inheritedFrom,lt2,invert,showAlways,visitedClasses); } virtual void writeDeclarationLink(OutputList &ol,bool &found, - const char *header,bool localNames) const + const QCString &header,bool localNames) const { getCdAlias()->writeDeclarationLink(ol,found,header,localNames); } virtual ClassDef *insertTemplateInstance(const QCString &fileName,int startLine,int startColumn, const QCString &templSpec,bool &freshInstance) const @@ -547,14 +553,12 @@ class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef> virtual void updateSubClasses(const BaseClassList &) {} }; - - ClassDef *createClassDefAlias(const Definition *newScope,const ClassDef *cd) { ClassDef *acd = new ClassDefAliasImpl(newScope,cd); //printf("cd name=%s localName=%s qualifiedName=%s qualifiedNameWith=%s displayName()=%s\n", - // acd->name().data(),acd->localName().data(),acd->qualifiedName().data(), - // acd->qualifiedNameWithTemplateParameters().data(),acd->displayName().data()); + // qPrint(acd->name()),qPrint(acd->localName()),qPrint(acd->qualifiedName()), + // qPrint(acd->qualifiedNameWithTemplateParameters()),qPrint(acd->displayName())); return acd; } @@ -566,8 +570,8 @@ class ClassDefImpl::IMPL public: IMPL(); ~IMPL(); - void init(const char *defFileName, const char *name, - const QCString &ctStr, const char *fName); + void init(const QCString &defFileName, const QCString &name, + const QCString &ctStr, const QCString &fName); /*! file name that forms the base for the output file containing the * class documentation. For compatibility with Qt (e.g. links via tag @@ -601,7 +605,7 @@ class ClassDefImpl::IMPL /*! Namespace this class is part of * (this is the inner most namespace in case of nested namespaces) */ - NamespaceDef *nspace = 0; + //NamespaceDef *nspace = 0; /*! File this class is defined in */ FileDef *fileDef = 0; @@ -704,12 +708,15 @@ class ClassDefImpl::IMPL uint64 spec = 0; QCString metaData; + + /** C++20 requires clause */ + QCString requiresClause; }; -void ClassDefImpl::IMPL::init(const char *defFileName, const char *name, - const QCString &ctStr, const char *fName) +void ClassDefImpl::IMPL::init(const QCString &defFileName, const QCString &name, + const QCString &ctStr, const QCString &fName) { - if (fName) + if (!fName.isEmpty()) { fileName=stripExtension(fName); } @@ -718,7 +725,7 @@ void ClassDefImpl::IMPL::init(const char *defFileName, const char *name, fileName=ctStr+name; } prot=Public; - nspace=0; + //nspace=0; fileDef=0; subGrouping=Config_getBool(SUBGROUPING); templateMaster =0; @@ -734,7 +741,7 @@ void ClassDefImpl::IMPL::init(const char *defFileName, const char *name, spec=0; //QCString ns; //extractNamespaceName(name,className,ns); - //printf("m_name=%s m_className=%s ns=%s\n",m_name.data(),m_className.data(),ns.data()); + //printf("m_name=%s m_className=%s ns=%s\n",qPrint(m_name),qPrint(m_className),qPrint(ns)); // we cannot use getLanguage at this point, as setLanguage has not been called. SrcLangExt lang = getLanguageFromFileName(defFileName); @@ -761,9 +768,9 @@ ClassDefImpl::IMPL::~IMPL() // constructs a new class definition ClassDefImpl::ClassDefImpl( - const char *defFileName,int defLine,int defColumn, - const char *nm,CompoundType ct, - const char *lref,const char *fName, + const QCString &defFileName,int defLine,int defColumn, + const QCString &nm,CompoundType ct, + const QCString &lref,const QCString &fName, bool isSymbol,bool isJavaEnum) : DefinitionMixin(defFileName,defLine,defColumn,removeRedundantWhiteSpace(nm),0,0,isSymbol) { @@ -775,7 +782,7 @@ ClassDefImpl::ClassDefImpl( m_impl->memberListFileName = convertNameToFile(compoundTypeString()+name()+"-members"); m_impl->collabFileName = convertNameToFile(m_impl->fileName+"_coll_graph"); m_impl->inheritFileName = convertNameToFile(m_impl->fileName+"_inherit_graph"); - if (!lref) + if (lref.isEmpty()) { m_impl->fileName = convertNameToFile(m_impl->fileName); } @@ -798,22 +805,22 @@ QCString ClassDefImpl::displayName(bool includeScope) const } // inserts a base/super class in the inheritance list -void ClassDefImpl::insertBaseClass(ClassDef *cd,const char *n,Protection p, - Specifier s,const char *t) +void ClassDefImpl::insertBaseClass(ClassDef *cd,const QCString &n,Protection p, + Specifier s,const QCString &t) { - //printf("*** insert base class %s into %s\n",cd->name().data(),name().data()); + //printf("*** insert base class %s into %s\n",qPrint(cd->name()),qPrint(name())); m_impl->inherits.push_back(BaseClassDef(cd,n,p,s,t)); m_impl->isSimple = FALSE; } // inserts a derived/sub class in the inherited-by list void ClassDefImpl::insertSubClass(ClassDef *cd,Protection p, - Specifier s,const char *t) + Specifier s,const QCString &t) { - //printf("*** insert sub class %s into %s\n",cd->name().data(),name().data()); + //printf("*** insert sub class %s into %s\n",qPrint(cd->name()),qPrint(name())); static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE); if (!extractPrivate && cd->protection()==Private) return; - m_impl->inheritedBy.push_back(BaseClassDef(cd,0,p,s,t)); + m_impl->inheritedBy.push_back(BaseClassDef(cd,QCString(),p,s,t)); m_impl->isSimple = FALSE; } @@ -832,7 +839,7 @@ void ClassDefImpl::addMembersToMemberGroup() { if (mg->allMembersInSameSection() && m_impl->subGrouping) { - //printf("addToDeclarationSection(%s)\n",mg->header().data()); + //printf("addToDeclarationSection(%s)\n",qPrint(mg->header())); mg->addToDeclarationSection(); } } @@ -844,7 +851,7 @@ void ClassDefImpl::internalInsertMember(const MemberDef *md, bool addToAllList ) { - //printf("insertInternalMember(%s) isHidden()=%d\n",md->name().data(),md->isHidden()); + //printf("insertInternalMember(%s) isHidden()=%d\n",qPrint(md->name()),md->isHidden()); if (md->isHidden()) return; if (getLanguage()==SrcLangExt_VHDL) @@ -1014,7 +1021,7 @@ void ClassDefImpl::internalInsertMember(const MemberDef *md, { m_impl->isSimple = FALSE; } - //printf("adding %s simple=%d total_simple=%d\n",name().data(),isSimple,m_impl->isSimple); + //printf("adding %s simple=%d total_simple=%d\n",qPrint(name()),isSimple,m_impl->isSimple); /*******************************************************/ /* insert member in the detailed documentation section */ @@ -1082,7 +1089,7 @@ void ClassDefImpl::internalInsertMember(const MemberDef *md, break; case MemberType_Define: warn(md->getDefFileName(),md->getDefLine()-1,"A define (%s) cannot be made a member of %s", - md->name().data(), this->name().data()); + qPrint(md->name()), qPrint(this->name())); break; default: err("Unexpected member type %d found!\n",md->memberType()); @@ -1119,7 +1126,7 @@ void ClassDefImpl::internalInsertMember(const MemberDef *md, QCString(md->typeString())=="friend struct" || QCString(md->typeString())=="friend union"))) { - //printf("=======> adding member %s to class %s\n",md->name().data(),name().data()); + //printf("=======> adding member %s to class %s\n",qPrint(md->name()),qPrint(name())); MemberNameInfo *mni = m_impl->allMemberNameInfoLinkedMap.add(md->name()); mni->push_back(std::make_unique<MemberInfo>(md,prot,md->virtualness(),FALSE)); @@ -1216,11 +1223,11 @@ static void writeInheritanceSpecifier(OutputList &ol,const BaseClassDef &bcd) } void ClassDefImpl::setIncludeFile(FileDef *fd, - const char *includeName,bool local, bool force) + const QCString &includeName,bool local, bool force) { //printf("ClassDefImpl::setIncludeFile(%p,%s,%d,%d)\n",fd,includeName,local,force); if (!m_impl->incInfo) m_impl->incInfo = std::make_unique<IncludeInfo>(); - if ((includeName && m_impl->incInfo->includeName.isEmpty()) || + if ((!includeName.isEmpty() && m_impl->incInfo->includeName.isEmpty()) || (fd!=0 && m_impl->incInfo->fileDef==0) ) { @@ -1229,7 +1236,7 @@ void ClassDefImpl::setIncludeFile(FileDef *fd, m_impl->incInfo->includeName = includeName; m_impl->incInfo->local = local; } - if (force && includeName) + if (force && !includeName.isEmpty()) { m_impl->incInfo->includeName = includeName; m_impl->incInfo->local = local; @@ -1289,15 +1296,15 @@ static void searchTemplateSpecs(/*in*/ const Definition *d, } } -static void writeTemplateSpec(OutputList &ol,const Definition *d, - const QCString &type,SrcLangExt lang) +void ClassDefImpl::writeTemplateSpec(OutputList &ol,const Definition *d, + const QCString &type,SrcLangExt lang) const { ArgumentLists specs; QCString name; searchTemplateSpecs(d,specs,name,lang); if (!specs.empty()) // class has template scope specifiers { - ol.startSubsubsection(); + ol.startCompoundTemplateParams(); for (const ArgumentList &al : specs) { ol.docify("template<"); @@ -1305,7 +1312,13 @@ static void writeTemplateSpec(OutputList &ol,const Definition *d, while (it!=al.end()) { Argument a = *it; - ol.docify(a.type); + linkifyText(TextGeneratorOLImpl(ol), // out + d, // scope + getFileDef(), // fileScope + this, // self + a.type, // text + FALSE // autoBreak + ); if (!a.name.isEmpty()) { ol.docify(" "); @@ -1322,9 +1335,20 @@ static void writeTemplateSpec(OutputList &ol,const Definition *d, ol.docify(">"); ol.lineBreak(); } + if (!m_impl->requiresClause.isEmpty()) + { + ol.docify("requires "); + linkifyText(TextGeneratorOLImpl(ol), // out + d, // scope + getFileDef(), // fileScope + this, // self + m_impl->requiresClause, // text + FALSE // autoBreak + ); + ol.lineBreak(); + } ol.docify(type.lower()+" "+name); - ol.endSubsubsection(); - ol.writeString("\n"); + ol.endCompoundTemplateParams(); } } @@ -1338,7 +1362,7 @@ void ClassDefImpl::writeBriefDescription(OutputList &ol,bool exampleFlag) const ol.writeString(" - "); ol.popGeneratorState(); ol.generateDoc(briefFile(),briefLine(),this,0, - briefDescription(),TRUE,FALSE,0, + briefDescription(),TRUE,FALSE,QCString(), TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.pushGeneratorState(); ol.disable(OutputGenerator::RTF); @@ -1371,7 +1395,7 @@ void ClassDefImpl::writeDetailedDocumentationBody(OutputList &ol) const if (!briefDescription().isEmpty() && repeatBrief) { ol.generateDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } if (!briefDescription().isEmpty() && repeatBrief && !documentation().isEmpty()) @@ -1385,7 +1409,7 @@ void ClassDefImpl::writeDetailedDocumentationBody(OutputList &ol) const if (!documentation().isEmpty()) { ol.generateDoc(docFile(),docLine(),this,0,documentation(),TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } // write type constraints writeTypeConstraints(ol,this,m_impl->typeConstraints); @@ -1428,7 +1452,7 @@ void ClassDefImpl::writeDetailedDescription(OutputList &ol, const QCString &/*pa ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - ol.writeAnchor(0,anchor.isEmpty() ? QCString("details") : anchor); + ol.writeAnchor(QCString(),anchor.isEmpty() ? QCString("details") : anchor); ol.popGeneratorState(); if (!anchor.isEmpty()) @@ -1528,12 +1552,11 @@ void ClassDefImpl::showUsedFiles(OutputList &ol) const ol.disableAllBut(OutputGenerator::Html); if (fd->generateSourceFile()) { - ol.writeObjectLink(0,fd->getSourceFileBase(),0,fname); + ol.writeObjectLink(QCString(),fd->getSourceFileBase(),QCString(),fname); } else if (fd->isLinkable()) { - ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0, - fname); + ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),QCString(),fname); } else { @@ -1546,8 +1569,7 @@ void ClassDefImpl::showUsedFiles(OutputList &ol) const ol.disable(OutputGenerator::Html); if (fd->isLinkable()) { - ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0, - fname); + ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),QCString(),fname); } else { @@ -1592,7 +1614,7 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const if (inheritanceGraph.isTooBig()) { warn_uncond("Inheritance graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", - name().data(), inheritanceGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); + qPrint(name()), inheritanceGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!inheritanceGraph.isTrivial()) { @@ -1763,7 +1785,7 @@ void ClassDefImpl::writeIncludeFilesForSlice(OutputList &ol) const if (nm.isEmpty()) { - nm = m_impl->incInfo->includeName.data(); + nm = m_impl->incInfo->includeName; } ol.startParagraph(); @@ -1772,7 +1794,7 @@ void ClassDefImpl::writeIncludeFilesForSlice(OutputList &ol) const ol.docify("<"); if (m_impl->incInfo->fileDef) { - ol.writeObjectLink(0,m_impl->incInfo->fileDef->includeName(),0,nm); + ol.writeObjectLink(QCString(),m_impl->incInfo->fileDef->includeName(),QCString(),nm); } else { @@ -1872,9 +1894,9 @@ void ClassDefImpl::writeIncludeFiles(OutputList &ol) const SrcLangExt lang = getLanguage(); QCString nm=m_impl->incInfo->includeName.isEmpty() ? (m_impl->incInfo->fileDef ? - m_impl->incInfo->fileDef->docName().data() : "" + m_impl->incInfo->fileDef->docName() : QCString() ) : - m_impl->incInfo->includeName.data(); + m_impl->incInfo->includeName; if (!nm.isEmpty()) { ol.startParagraph(); @@ -1892,7 +1914,7 @@ void ClassDefImpl::writeIncludeFiles(OutputList &ol) const ol.enable(OutputGenerator::Html); if (m_impl->incInfo->fileDef) { - ol.writeObjectLink(0,m_impl->incInfo->fileDef->includeName(),0,nm); + ol.writeObjectLink(QCString(),m_impl->incInfo->fileDef->includeName(),QCString(),nm); } else { @@ -1922,7 +1944,7 @@ void ClassDefImpl::writeMemberGroups(OutputList &ol,bool showInline) const } else // add this group to the corresponding member section { - //printf("addToDeclarationSection(%s)\n",mg->header().data()); + //printf("addToDeclarationSection(%s)\n",qPrint(mg->header())); //mg->addToDeclarationSection(); } } @@ -1941,7 +1963,7 @@ void ClassDefImpl::writeInlineClasses(OutputList &ol) const void ClassDefImpl::startMemberDocumentation(OutputList &ol) const { - //printf("%s: ClassDefImpl::startMemberDocumentation()\n",name().data()); + //printf("%s: ClassDefImpl::startMemberDocumentation()\n",qPrint(name())); if (Config_getBool(SEPARATE_MEMBER_PAGES)) { ol.disable(OutputGenerator::Html); @@ -1951,7 +1973,7 @@ void ClassDefImpl::startMemberDocumentation(OutputList &ol) const void ClassDefImpl::endMemberDocumentation(OutputList &ol) const { - //printf("%s: ClassDefImpl::endMemberDocumentation()\n",name().data()); + //printf("%s: ClassDefImpl::endMemberDocumentation()\n",qPrint(name())); if (Config_getBool(SEPARATE_MEMBER_PAGES)) { ol.enable(OutputGenerator::Html); @@ -1961,13 +1983,13 @@ void ClassDefImpl::endMemberDocumentation(OutputList &ol) const void ClassDefImpl::startMemberDeclarations(OutputList &ol) const { - //printf("%s: ClassDefImpl::startMemberDeclarations()\n",name().data()); + //printf("%s: ClassDefImpl::startMemberDeclarations()\n",qPrint(name())); ol.startMemberSections(); } void ClassDefImpl::endMemberDeclarations(OutputList &ol) const { - //printf("%s: ClassDefImpl::endMemberDeclarations()\n",name().data()); + //printf("%s: ClassDefImpl::endMemberDeclarations()\n",qPrint(name())); static bool inlineInheritedMembers = Config_getBool(INLINE_INHERITED_MEMB); if (!inlineInheritedMembers && countAdditionalInheritedMembers()>0) { @@ -2008,7 +2030,7 @@ void ClassDefImpl::writeSummaryLinks(OutputList &ol) const ) { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); - ol.writeSummaryLink(0,"nested-classes",ls->title(lang),first); + ol.writeSummaryLink(QCString(),"nested-classes",ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::ClassAllMembersLink && @@ -2025,7 +2047,7 @@ void ClassDefImpl::writeSummaryLinks(OutputList &ol) const MemberList * ml = getMemberList(lmd->type); if (ml && ml->declVisible()) { - ol.writeSummaryLink(0,MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first); + ol.writeSummaryLink(QCString(),MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first); first=FALSE; } } @@ -2035,7 +2057,7 @@ void ClassDefImpl::writeSummaryLinks(OutputList &ol) const { for (const auto &s : m_impl->vhdlSummaryTitles) { - ol.writeSummaryLink(0,convertToId(s.c_str()),s.c_str(),first); + ol.writeSummaryLink(QCString(),convertToId(QCString(s)),QCString(s),first); first=FALSE; } } @@ -2046,7 +2068,7 @@ void ClassDefImpl::writeSummaryLinks(OutputList &ol) const ol.popGeneratorState(); } -void ClassDefImpl::writeTagFile(std::ostream &tagFile) +void ClassDefImpl::writeTagFile(TextStream &tagFile) { if (!isLinkableInProject() || isArtificial()) return; tagFile << " <compound kind=\""; @@ -2151,8 +2173,8 @@ void ClassDefImpl::writeInlineDocumentation(OutputList &ol) const { bool isSimple = m_impl->isSimple; - ol.addIndexItem(name(),0); - //printf("ClassDefImpl::writeInlineDocumentation(%s)\n",name().data()); + ol.addIndexItem(name(),QCString()); + //printf("ClassDefImpl::writeInlineDocumentation(%s)\n",qPrint(name())); // part 1: anchor and title QCString s = compoundTypeString()+" "+name(); @@ -2161,8 +2183,8 @@ void ClassDefImpl::writeInlineDocumentation(OutputList &ol) const ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); { // only HTML only - ol.writeAnchor(0,anchor()); - ol.startMemberDoc(0,0,anchor(),name(),1,1,FALSE); + ol.writeAnchor(QCString(),anchor()); + ol.startMemberDoc(QCString(),QCString(),anchor(),name(),1,1,FALSE); ol.startMemberDocName(FALSE); ol.parseText(s); ol.endMemberDocName(); @@ -2318,7 +2340,7 @@ bool ClassDefImpl::visibleInParentsDeclList() const ); } -void ClassDefImpl::writeDeclarationLink(OutputList &ol,bool &found,const char *header,bool localNames) const +void ClassDefImpl::writeDeclarationLink(OutputList &ol,bool &found,const QCString &header,bool localNames) const { //static bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); //static bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); @@ -2351,7 +2373,7 @@ void ClassDefImpl::writeDeclarationLink(OutputList &ol,bool &found,const char *h { ol.startMemberHeader("nested-classes"); } - if (header) + if (!header.isEmpty()) { ol.parseText(header); } @@ -2411,7 +2433,7 @@ void ClassDefImpl::writeDeclarationLink(OutputList &ol,bool &found,const char *h { DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0, briefDescription(),FALSE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); if (rootNode && !rootNode->isEmpty()) { ol.startMemberDescription(anchor()); @@ -2424,7 +2446,7 @@ void ClassDefImpl::writeDeclarationLink(OutputList &ol,bool &found,const char *h } delete rootNode; } - ol.endMemberDeclaration(anchor(),0); + ol.endMemberDeclaration(anchor(),QCString()); } } @@ -2550,11 +2572,14 @@ void ClassDefImpl::writeDocumentationContents(OutputList &ol,const QCString & /* case LayoutDocEntry::NamespaceNestedNamespaces: case LayoutDocEntry::NamespaceNestedConstantGroups: case LayoutDocEntry::NamespaceClasses: + case LayoutDocEntry::NamespaceConcepts: case LayoutDocEntry::NamespaceInterfaces: case LayoutDocEntry::NamespaceStructs: case LayoutDocEntry::NamespaceExceptions: case LayoutDocEntry::NamespaceInlineClasses: + case LayoutDocEntry::ConceptDefinition: case LayoutDocEntry::FileClasses: + case LayoutDocEntry::FileConcepts: case LayoutDocEntry::FileInterfaces: case LayoutDocEntry::FileStructs: case LayoutDocEntry::FileExceptions: @@ -2566,6 +2591,7 @@ void ClassDefImpl::writeDocumentationContents(OutputList &ol,const QCString & /* case LayoutDocEntry::FileSourceLink: case LayoutDocEntry::FileInlineClasses: case LayoutDocEntry::GroupClasses: + case LayoutDocEntry::GroupConcepts: case LayoutDocEntry::GroupInlineClasses: case LayoutDocEntry::GroupNamespaces: case LayoutDocEntry::GroupDirs: @@ -2827,9 +2853,9 @@ void ClassDefImpl::writeMemberList(OutputList &ol) const } ol.endQuickIndices(); } - startTitle(ol,0); + startTitle(ol,QCString()); ol.parseText(displayName()+" "+theTranslator->trMemberList()); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); ol.startParagraph(); ol.parseText(theTranslator->trThisIsTheListOfAllMembers()); @@ -2851,7 +2877,7 @@ void ClassDefImpl::writeMemberList(OutputList &ol) const Specifier virt=md->virtualness(); //printf("%s: Member %s of class %s md->protection()=%d mi->prot=%d prot=%d inherited=%d\n", - // name().data(),md->name().data(),cd->name().data(),md->protection(),mi->prot,prot,mi->inherited); + // qPrint(name()),qPrint(md->name()),qPrint(cd->name()),md->protection(),mi->prot,prot,mi->inherited); if (cd && !md->name().isEmpty() && !md->isAnonymous()) { @@ -2897,7 +2923,7 @@ void ClassDefImpl::writeMemberList(OutputList &ol) const md->anchor(),name); if ( md->isFunction() || md->isSignal() || md->isSlot() || - (md->isFriend() && md->argsString())) + (md->isFriend() && md->argsString().isEmpty())) ol.docify(md->argsString()); else if (md->isEnumerate()) ol.parseText(" "+theTranslator->trEnumName()); @@ -2905,7 +2931,7 @@ void ClassDefImpl::writeMemberList(OutputList &ol) const ol.parseText(" "+theTranslator->trEnumValue()); else if (md->isTypedef()) ol.docify(" typedef"); - else if (md->isFriend() && !qstrcmp(md->typeString(),"friend class")) + else if (md->isFriend() && md->typeString()=="friend class") ol.docify(" class"); //ol.writeString("\n"); } @@ -3066,7 +3092,7 @@ void ClassDefImpl::writeMemberList(OutputList &ol) const } // add a reference to an example -bool ClassDefImpl::addExample(const char *anchor,const char *nameStr, const char *file) +bool ClassDefImpl::addExample(const QCString &anchor,const QCString &nameStr, const QCString &file) { return m_impl->examples.inSort(Example(anchor,nameStr,file)); } @@ -3079,7 +3105,7 @@ bool ClassDefImpl::hasExamples() const void ClassDefImpl::addTypeConstraint(const QCString &typeConstraint,const QCString &type) { - //printf("addTypeConstraint(%s,%s)\n",type.data(),typeConstraint.data()); + //printf("addTypeConstraint(%s,%s)\n",qPrint(type),qPrint(typeConstraint)); static bool hideUndocRelation = Config_getBool(HIDE_UNDOC_RELATIONS); if (typeConstraint.isEmpty() || type.isEmpty()) return; SymbolResolver resolver(getFileDef()); @@ -3099,7 +3125,7 @@ void ClassDefImpl::addTypeConstraint(const QCString &typeConstraint,const QCStri cd->setUsedOnly(TRUE); cd->setLanguage(getLanguage()); //printf("Adding undocumented constraint '%s' to class %s on type %s\n", - // typeConstraint.data(),name().data(),type.data()); + // qPrint(typeConstraint),qPrint(name()),qPrint(type)); } } if (cd) @@ -3115,7 +3141,7 @@ void ClassDefImpl::addTypeConstraint(const QCString &typeConstraint,const QCStri } (*it).addAccessor(type); //printf("Adding constraint '%s' to class %s on type %s\n", - // typeConstraint.data(),name().data(),type.data()); + // qPrint(typeConstraint),qPrint(name()),qPrint(type)); } } @@ -3184,13 +3210,23 @@ bool ClassDefImpl::hasNonReferenceSuperClass() const return found; } +QCString ClassDefImpl::requiresClause() const +{ + return m_impl->requiresClause; +} + +void ClassDefImpl::setRequiresClause(const QCString &req) +{ + m_impl->requiresClause = req; +} + /*! called from MemberDef::writeDeclaration() to (recursively) write the * definition of an anonymous struct, union or class. */ void ClassDefImpl::writeDeclaration(OutputList &ol,const MemberDef *md,bool inGroup, - const ClassDef *inheritedFrom,const char *inheritId) const + const ClassDef *inheritedFrom,const QCString &inheritId) const { - //printf("ClassName='%s' inGroup=%d\n",name().data(),inGroup); + //printf("ClassName='%s' inGroup=%d\n",qPrint(name()),inGroup); ol.docify(compoundTypeString()); QCString cn = displayName(FALSE); @@ -3199,7 +3235,7 @@ void ClassDefImpl::writeDeclaration(OutputList &ol,const MemberDef *md,bool inGr ol.docify(" "); if (md && isLinkable()) { - ol.writeObjectLink(0,0,md->anchor(),cn); + ol.writeObjectLink(QCString(),QCString(),md->anchor(),cn); } else { @@ -3300,7 +3336,7 @@ bool ClassDefImpl::hasDocumentation() const bool ClassDefImpl::isBaseClass(const ClassDef *bcd, bool followInstances,int level) const { bool found=FALSE; - //printf("isBaseClass(cd=%s) looking for %s\n",name().data(),bcd->name().data()); + //printf("isBaseClass(cd=%s) looking for %s\n",qPrint(name()),qPrint(bcd->name())); if (level>256) { err("Possible recursive class relation while inside %s and looking for base class %s\n",qPrint(name()),qPrint(bcd->name())); @@ -3360,7 +3396,7 @@ void ClassDefImpl::mergeMembers() uint sepLen = sep.length(); m_impl->membersMerged=TRUE; - //printf(" mergeMembers for %s\n",name().data()); + //printf(" mergeMembers for %s\n",qPrint(name())); static bool inlineInheritedMembers = Config_getBool(INLINE_INHERITED_MEMB); static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE); for (const auto &bcd : baseClasses()) @@ -3397,7 +3433,7 @@ void ClassDefImpl::mergeMembers() if (srcMd!=dstMd) // different members { const ClassDef *dstCd = dstMd->getClassDef(); - //printf(" Is %s a base class of %s?\n",srcCd->name().data(),dstCd->name().data()); + //printf(" Is %s a base class of %s?\n",qPrint(srcCd->name()),qPrint(dstCd->name())); if (srcCd==dstCd || dstCd->isBaseClass(srcCd,TRUE)) // member is in the same or a base class { @@ -3409,8 +3445,8 @@ void ClassDefImpl::mergeMembers() TRUE ); //printf(" Yes, matching (%s<->%s): %d\n", - // argListToString(srcMd->argumentList()).data(), - // argListToString(dstMd->argumentList()).data(), + // qPrint(argListToString(srcMd->argumentList())), + // qPrint(argListToString(dstMd->argumentList())), // found); hidden = hidden || !found; } @@ -3418,9 +3454,9 @@ void ClassDefImpl::mergeMembers() // using the same base class. { //printf("$$ Existing member %s %s add scope %s\n", - // dstMi->ambiguityResolutionScope.data(), - // dstMd->name().data(), - // dstMi->scopePath.left(dstMi->scopePath.find("::")+2).data()); + // qPrint(dstMi->ambiguityResolutionScope), + // qPrint(dstMd->name()), + // qPrint(dstMi->scopePath.left(dstMi->scopePath.find("::")+2)); QCString scope=dstMi->scopePath().left((uint)dstMi->scopePath().find(sep)+sepLen); if (scope!=dstMi->ambiguityResolutionScope().left(scope.length())) @@ -3447,9 +3483,9 @@ void ClassDefImpl::mergeMembers() // inheritance tree { //printf("$$ Existing member %s %s add scope %s\n", - // dstMi->ambiguityResolutionScope.data(), - // dstMd->name().data(), - // dstMi->scopePath.left(dstMi->scopePath.find("::")+2).data()); + // qPrint(dstMi->ambiguityResolutionScope), + // qPrint(dstMd->name()), + // qPrint(dstMi->scopePath.left(dstMi->scopePath.find("::")+2)); QCString scope=dstMi->scopePath().left((uint)dstMi->scopePath().find(sep)+sepLen); if (scope!=dstMi->ambiguityResolutionScope().left(scope.length())) @@ -3462,7 +3498,7 @@ void ClassDefImpl::mergeMembers() if (found) break; } //printf("member %s::%s hidden %d ambiguous %d srcMi->ambigClass=%p\n", - // srcCd->name().data(),srcMd->name().data(),hidden,ambiguous,srcMi->ambigClass); + // qPrint(srcCd->name()),qPrint(srcMd->name()),hidden,ambiguous,srcMi->ambigClass); // TODO: fix the case where a member is hidden by inheritance // of a member with the same name but with another prototype, @@ -3481,7 +3517,7 @@ void ClassDefImpl::mergeMembers() { if (!isStandardFunc(srcMd)) { - //printf(" insertMember '%s'\n",srcMd->name().data()); + //printf(" insertMember '%s'\n",qPrint(srcMd->name())); internalInsertMember(srcMd,prot,FALSE); } } @@ -3494,9 +3530,9 @@ void ClassDefImpl::mergeMembers() if (ambiguous) { //printf("$$ New member %s %s add scope %s::\n", - // srcMi->ambiguityResolutionScope.data(), - // srcMd->name().data(), - // bClass->name().data()); + // qPrint(srcMi->ambiguityResolutionScope), + // qPrint(srcMd->name()), + // qPrint(bClass->name())); QCString scope=bClass->name()+sep; if (scope!=srcMi->ambiguityResolutionScope().left(scope.length())) @@ -3542,7 +3578,7 @@ void ClassDefImpl::mergeMembers() prot=Private; } //printf("%s::%s: prot=%d bcd.prot=%d result=%d\n", - // name().data(),mi->memberDef->name().data(),mi->prot, + // qPrint(name()),qPrint(mi->memberDef->name()),mi->prot, // bcd.prot,prot); if (prot!=Private || extractPrivate) @@ -3554,7 +3590,7 @@ void ClassDefImpl::mergeMembers() { if (!isStandardFunc(mi->memberDef())) { - //printf(" insertMember '%s'\n",mi->memberDef->name().data()); + //printf(" insertMember '%s'\n",qPrint(mi->memberDef->name())); internalInsertMember(mi->memberDef(),prot,FALSE); } } @@ -3613,7 +3649,7 @@ void ClassDefImpl::mergeCategory(ClassDef *cat) } } // make methods private for categories defined in the .m file - //printf("%s::mergeCategory makePrivate=%d\n",name().data(),makePrivate); + //printf("%s::mergeCategory makePrivate=%d\n",qPrint(name()),makePrivate); const MemberNameInfoLinkedMap &srcMnd = category->memberNameInfoLinkedMap(); MemberNameInfoLinkedMap &dstMnd = m_impl->allMemberNameInfoLinkedMap; @@ -3648,13 +3684,13 @@ void ClassDefImpl::mergeCategory(ClassDef *cat) // copy the member(s) from the category to this class for (auto &mi : *srcMni) { - //printf("Adding '%s'\n",mi->memberDef->name().data()); + //printf("Adding '%s'\n",qPrint(mi->memberDef->name())); Protection prot = mi->prot(); //if (makePrivate) prot = Private; std::unique_ptr<MemberDefMutable> newMd { toMemberDefMutable(mi->memberDef()->deepCopy()) }; if (newMd) { - //printf("Copying member %s\n",mi->memberDef->name().data()); + //printf("Copying member %s\n",qPrint(mi->memberDef->name())); newMd->moveTo(this); std::unique_ptr<MemberInfo> newMi=std::make_unique<MemberInfo>(newMd.get(),prot,mi->virt(),mi->inherited()); @@ -3693,13 +3729,13 @@ void ClassDefImpl::mergeCategory(ClassDef *cat) //---------------------------------------------------------------------------- -void ClassDefImpl::addUsedClass(ClassDef *cd,const char *accessName, +void ClassDefImpl::addUsedClass(ClassDef *cd,const QCString &accessName, Protection prot) { static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE); static bool umlLook = Config_getBool(UML_LOOK); if (prot==Private && !extractPrivate) return; - //printf("%s::addUsedClass(%s,%s)\n",name().data(),cd->name().data(),accessName); + //printf("%s::addUsedClass(%s,%s)\n",qPrint(name()),qPrint(cd->name()),accessName); auto it = std::find_if(m_impl->usesImplClassList.begin(), m_impl->usesImplClassList.end(), @@ -3708,7 +3744,7 @@ void ClassDefImpl::addUsedClass(ClassDef *cd,const char *accessName, { m_impl->usesImplClassList.emplace_back(cd); //printf("Adding used class %s to class %s via accessor %s\n", - // cd->name().data(),name().data(),accessName); + // qPrint(cd->name()),qPrint(name()),accessName); it = m_impl->usesImplClassList.end()-1; } QCString acc = accessName; @@ -3725,13 +3761,13 @@ void ClassDefImpl::addUsedClass(ClassDef *cd,const char *accessName, (*it).addAccessor(acc); } -void ClassDefImpl::addUsedByClass(ClassDef *cd,const char *accessName, +void ClassDefImpl::addUsedByClass(ClassDef *cd,const QCString &accessName, Protection prot) { static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE); static bool umlLook = Config_getBool(UML_LOOK); if (prot==Private && !extractPrivate) return; - //printf("%s::addUsedByClass(%s,%s)\n",name().data(),cd->name().data(),accessName); + //printf("%s::addUsedByClass(%s,%s)\n",qPrint(name()),qPrint(cd->name()),accessName); // auto it = std::find_if(m_impl->usedByImplClassList.begin(), m_impl->usedByImplClassList.end(), @@ -3740,7 +3776,7 @@ void ClassDefImpl::addUsedByClass(ClassDef *cd,const char *accessName, { m_impl->usedByImplClassList.emplace_back(cd); //printf("Adding used by class %s to class %s\n", - // cd->name().data(),name().data()); + // qPrint(cd->name()),qPrint(name())); it = m_impl->usedByImplClassList.end()-1; } QCString acc = accessName; @@ -3849,7 +3885,7 @@ QCString ClassDefImpl::getSourceFileBase() const void ClassDefImpl::setGroupDefForAllMembers(GroupDef *gd,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs) { gd->addClass(this); - //printf("ClassDefImpl::setGroupDefForAllMembers(%s)\n",gd->name().data()); + //printf("ClassDefImpl::setGroupDefForAllMembers(%s)\n",qPrint(gd->name())); for (auto &mni : m_impl->allMemberNameInfoLinkedMap) { for (auto &mi : *mni) @@ -3868,7 +3904,7 @@ void ClassDefImpl::setGroupDefForAllMembers(GroupDef *gd,Grouping::GroupPri_t pr void ClassDefImpl::addInnerCompound(const Definition *d) { - //printf("**** %s::addInnerCompound(%s)\n",name().data(),d->name().data()); + //printf("**** %s::addInnerCompound(%s)\n",qPrint(name()),qPrint(d->name())); if (d->definitionType()==Definition::TypeClass) // only classes can be // nested in classes. { @@ -3876,7 +3912,7 @@ void ClassDefImpl::addInnerCompound(const Definition *d) } } -const Definition *ClassDefImpl::findInnerCompound(const char *name) const +const Definition *ClassDefImpl::findInnerCompound(const QCString &name) const { return m_impl->innerClasses.find(name); } @@ -3949,9 +3985,9 @@ const TemplateNameMap &ClassDefImpl::getTemplateBaseClassNames() const return m_impl->templBaseClassNames; } -void ClassDefImpl::addMembersToTemplateInstance(const ClassDef *cd,const ArgumentList &templateArguments,const char *templSpec) +void ClassDefImpl::addMembersToTemplateInstance(const ClassDef *cd,const ArgumentList &templateArguments,const QCString &templSpec) { - //printf("%s::addMembersToTemplateInstance(%s,%s)\n",name().data(),cd->name().data(),templSpec); + //printf("%s::addMembersToTemplateInstance(%s,%s)\n",qPrint(name()),qPrint(cd->name()),templSpec); for (const auto &mni : cd->memberNameInfoLinkedMap()) { for (const auto &mi : *mni) @@ -3960,7 +3996,7 @@ void ClassDefImpl::addMembersToTemplateInstance(const ClassDef *cd,const Argumen const MemberDef *md = mi->memberDef(); std::unique_ptr<MemberDefMutable> imd { md->createTemplateInstanceMember( templateArguments,actualArguments_p) }; - //printf("%s->setMemberClass(%p)\n",imd->name().data(),this); + //printf("%s->setMemberClass(%p)\n",qPrint(imd->name()),this); imd->setMemberClass(this); imd->setTemplateMaster(md); imd->setDocumentation(md->documentation(),md->docFile(),md->docLine()); @@ -3970,10 +4006,10 @@ void ClassDefImpl::addMembersToTemplateInstance(const ClassDef *cd,const Argumen imd->setMemberGroupId(md->getMemberGroupId()); insertMember(imd.get()); //printf("Adding member=%s %s%s to class %s templSpec %s\n", - // imd->typeString(),imd->name().data(),imd->argsString(), - // imd->getClassDef()->name().data(),templSpec); + // imd->typeString(),qPrint(imd->name()),imd->argsString(), + // qPrint(imd->getClassDef()->name()),templSpec); // insert imd in the list of all members - //printf("Adding member=%s class=%s\n",imd->name().data(),name().data()); + //printf("Adding member=%s class=%s\n",qPrint(imd->name()),qPrint(name())); MemberName *mn = Doxygen::memberNameLinkedMap->add(imd->name()); mn->push_back(std::move(imd)); } @@ -4047,7 +4083,7 @@ QCString ClassDefImpl::className() const } } -void ClassDefImpl::setClassName(const char *name) +void ClassDefImpl::setClassName(const QCString &name) { m_impl->className = name; } @@ -4056,7 +4092,7 @@ void ClassDefImpl::addListReferences() { SrcLangExt lang = getLanguage(); if (!isLinkableInProject()) return; - //printf("ClassDef(%s)::addListReferences()\n",name().data()); + //printf("ClassDef(%s)::addListReferences()\n",qPrint(name())); { const RefItemVector &xrefItems = xrefListItems(); addRefItem(xrefItems, @@ -4065,7 +4101,7 @@ void ClassDefImpl::addListReferences() : theTranslator->trClass(TRUE,TRUE), getOutputFileBase(), displayName(), - 0, + QCString(), this ); } @@ -4095,7 +4131,7 @@ const MemberDef *ClassDefImpl::getMemberByName(const QCString &name) const const ClassDef *mcd=mi->memberDef()->getClassDef(); int m=minClassDistance(this,mcd); //printf("found member in %s linkable=%d m=%d\n", - // mcd->name().data(),mcd->isLinkable(),m); + // qPrint(mcd->name()),mcd->isLinkable(),m); if (m<mdist && mcd->isLinkable()) { mdist=m; @@ -4103,7 +4139,7 @@ const MemberDef *ClassDefImpl::getMemberByName(const QCString &name) const } } } - //printf("getMemberByName(%s)=%p\n",name.data(),xmd); + //printf("getMemberByName(%s)=%p\n",qPrint(name),xmd); return xmd; } @@ -4162,7 +4198,7 @@ void ClassDefImpl::sortMemberLists() int ClassDefImpl::countMemberDeclarations(MemberListType lt,const ClassDef *inheritedFrom, int lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const { - //printf("%s: countMemberDeclarations for %d and %d\n",name().data(),lt,lt2); + //printf("%s: countMemberDeclarations for %d and %d\n",qPrint(name()),lt,lt2); int count=0; MemberList * ml = getMemberList(lt); MemberList * ml2 = getMemberList((MemberListType)lt2); @@ -4242,7 +4278,7 @@ int ClassDefImpl::countInheritedDecMembers(MemberListType lt, int count = countMembersIncludingGrouped(lt,inheritedFrom,FALSE); bool process = count>0; //printf("%s: countInheritedDecMembers: lt=%d process=%d count=%d invert=%d\n", - // name().data(),lt,process,count,invert); + // qPrint(name()),lt,process,count,invert); if ((process^invert) || showAlways) { for (const auto &ibcd : m_impl->inherits) @@ -4253,7 +4289,7 @@ int ClassDefImpl::countInheritedDecMembers(MemberListType lt, { convertProtectionLevel(lt,ibcd.prot,<1,<2); //printf("%s: convert %d->(%d,%d) prot=%d\n", - // icd->name().data(),lt,lt1,lt2,ibcd->prot); + // qPrint(icd->name()),lt,lt1,lt2,ibcd->prot); if (visitedClasses.find(icd)==visitedClasses.end()) { visitedClasses.insert(icd); // guard for multiple virtual inheritance @@ -4334,7 +4370,7 @@ int ClassDefImpl::countMembersIncludingGrouped(MemberListType lt, { count=ml->countInheritableMembers(inheritedFrom); } - //printf("%s:countMembersIncludingGrouped: count=%d\n",name().data(),count); + //printf("%s:countMembersIncludingGrouped: count=%d\n",qPrint(name()),count); for (const auto &mg : m_impl->memberGroups) { bool hasOwnSection = !mg->allMembersInSameSection() || @@ -4345,7 +4381,7 @@ int ClassDefImpl::countMembersIncludingGrouped(MemberListType lt, } } //printf("%s:countMembersIncludingGrouped(lt=%d,%s)=%d\n", - // name().data(),lt,ml?ml->listTypeAsString(ml->listType()).data():"<none>",count); + // qPrint(name()),lt,ml?qPrint(ml->listTypeAsString(ml->listType())):"<none>",count); return count; } @@ -4359,7 +4395,7 @@ void ClassDefImpl::writeInheritedMemberDeclarations(OutputList &ol,ClassDefSet & int count = countMembersIncludingGrouped(lt,inheritedFrom,FALSE); bool process = count>0; //printf("%s: writeInheritedMemberDec: lt=%d process=%d invert=%d always=%d\n", - // name().data(),lt,process,invert,showAlways); + // qPrint(name()),lt,process,invert,showAlways); if ((process^invert) || showAlways) { for (const auto &ibcd : m_impl->inherits) @@ -4373,7 +4409,7 @@ void ClassDefImpl::writeInheritedMemberDeclarations(OutputList &ol,ClassDefSet & { lt2=lt3; } - //printf("%s:convert %d->(%d,%d) prot=%d\n",icd->name().data(),lt,lt1,lt2,ibcd->prot); + //printf("%s:convert %d->(%d,%d) prot=%d\n",qPrint(icd->name()),lt,lt1,lt2,ibcd->prot); if (visitedClasses.find(icd)==visitedClasses.end()) { visitedClasses.insert(icd); // guard for multiple virtual inheritance @@ -4385,7 +4421,7 @@ void ClassDefImpl::writeInheritedMemberDeclarations(OutputList &ol,ClassDefSet & } else { - //printf("%s: class already visited!\n",icd->name().data()); + //printf("%s: class already visited!\n",qPrint(icd->name())); } } } @@ -4395,10 +4431,10 @@ void ClassDefImpl::writeInheritedMemberDeclarations(OutputList &ol,ClassDefSet & void ClassDefImpl::writeMemberDeclarations(OutputList &ol,ClassDefSet &visitedClasses, MemberListType lt,const QCString &title, - const char *subTitle,bool showInline,const ClassDef *inheritedFrom,int lt2, + const QCString &subTitle,bool showInline,const ClassDef *inheritedFrom,int lt2, bool invert,bool showAlways) const { - //printf("%s: ClassDefImpl::writeMemberDeclarations lt=%d lt2=%d\n",name().data(),lt,lt2); + //printf("%s: ClassDefImpl::writeMemberDeclarations lt=%d lt2=%d\n",qPrint(name()),lt,lt2); MemberList * ml = getMemberList(lt); MemberList * ml2 = getMemberList((MemberListType)lt2); if (getLanguage()==SrcLangExt_VHDL) // use specific declarations function @@ -4416,7 +4452,7 @@ void ClassDefImpl::writeMemberDeclarations(OutputList &ol,ClassDefSet &visitedCl } else { - //printf("%s::writeMemberDeclarations(%s) ml=%p ml2=%p\n",name().data(),title.data(),ml,ml2); + //printf("%s::writeMemberDeclarations(%s) ml=%p ml2=%p\n",qPrint(name()),qPrint(title),ml,ml2); QCString tt = title, st = subTitle; if (ml) { @@ -4443,7 +4479,7 @@ void ClassDefImpl::writeMemberDeclarations(OutputList &ol,ClassDefSet &visitedCl void ClassDefImpl::addGroupedInheritedMembers(OutputList &ol,MemberListType lt, const ClassDef *inheritedFrom,const QCString &inheritId) const { - //printf("** %s::addGroupedInheritedMembers(%p) inheritId=%s\n",name().data(),m_impl->memberGroupSDict,inheritId.data()); + //printf("** %s::addGroupedInheritedMembers(%p) inheritId=%s\n",qPrint(name()),m_impl->memberGroupSDict,qPrint(inheritId)); for (const auto &mg : m_impl->memberGroups) { if (!mg->allMembersInSameSection() || !m_impl->subGrouping) // group is in its own section @@ -4455,23 +4491,23 @@ void ClassDefImpl::addGroupedInheritedMembers(OutputList &ol,MemberListType lt, void ClassDefImpl::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title,bool showInline) const { - //printf("%s: ClassDefImpl::writeMemberDocumentation()\n",name().data()); + //printf("%s: ClassDefImpl::writeMemberDocumentation()\n",qPrint(name())); MemberList * ml = getMemberList(lt); if (ml) ml->writeDocumentation(ol,displayName(),this,title,FALSE,showInline); } void ClassDefImpl::writeSimpleMemberDocumentation(OutputList &ol,MemberListType lt) const { - //printf("%s: ClassDefImpl::writeSimpleMemberDocumentation()\n",name().data()); + //printf("%s: ClassDefImpl::writeSimpleMemberDocumentation()\n",qPrint(name())); MemberList * ml = getMemberList(lt); if (ml) ml->writeSimpleDocumentation(ol,this); } void ClassDefImpl::writePlainMemberDeclaration(OutputList &ol, MemberListType lt,bool inGroup, - const ClassDef *inheritedFrom,const char *inheritId) const + const ClassDef *inheritedFrom,const QCString &inheritId) const { - //printf("%s: ClassDefImpl::writePlainMemberDeclaration()\n",name().data()); + //printf("%s: ClassDefImpl::writePlainMemberDeclaration()\n",qPrint(name())); MemberList * ml = getMemberList(lt); if (ml) { @@ -4495,7 +4531,7 @@ ClassDefImpl::CompoundType ClassDefImpl::compoundType() const return m_impl->compType; } -BaseClassList ClassDefImpl::baseClasses() const +const BaseClassList &ClassDefImpl::baseClasses() const { return m_impl->inherits; } @@ -4505,7 +4541,7 @@ void ClassDefImpl::updateBaseClasses(const BaseClassList &bcd) m_impl->inherits = bcd; } -BaseClassList ClassDefImpl::subClasses() const +const BaseClassList &ClassDefImpl::subClasses() const { return m_impl->inheritedBy; } @@ -4540,10 +4576,10 @@ const ArgumentList &ClassDefImpl::templateArguments() const return m_impl->tempArgs; } -NamespaceDef *ClassDefImpl::getNamespaceDef() const -{ - return m_impl->nspace; -} +//NamespaceDef *ClassDefImpl::getNamespaceDef() const +//{ +// return m_impl->nspace; +//} FileDef *ClassDefImpl::getFileDef() const { @@ -4650,11 +4686,6 @@ const MemberGroupList &ClassDefImpl::getMemberGroups() const return m_impl->memberGroups; } -void ClassDefImpl::setNamespace(NamespaceDef *nd) -{ - m_impl->nspace = nd; -} - void ClassDefImpl::setFileDef(FileDef *fd) { m_impl->fileDef=fd; @@ -4768,8 +4799,8 @@ bool ClassDefImpl::isEmbeddedInOuterScope() const //printf("%s::isEmbeddedInOuterScope(): inlineGroupedClasses=%d " // "inlineSimpleClasses=%d partOfGroups()=%p m_impl->isSimple=%d " // "getOuterScope()=%s b1=%d b2=%d\n", - // name().data(),inlineGroupedClasses,inlineSimpleClasses, - // partOfGroups().pointer(),m_impl->isSimple,getOuterScope()?getOuterScope()->name().data():"<none>",b1,b2); + // qPrint(name()),inlineGroupedClasses,inlineSimpleClasses, + // partOfGroups().pointer(),m_impl->isSimple,getOuterScope()?qPrint(getOuterScope()->name()):"<none>",b1,b2); return b1 || b2; // either reason will do } @@ -4835,12 +4866,12 @@ bool ClassDefImpl::isSliceLocal() const return m_impl->spec&Entry::Local; } -void ClassDefImpl::setName(const char *name) +void ClassDefImpl::setName(const QCString &name) { DefinitionMixin::setName(name); } -void ClassDefImpl::setMetaData(const char *md) +void ClassDefImpl::setMetaData(const QCString &md) { m_impl->metaData = md; } diff --git a/src/classdef.h b/src/classdef.h index b1582be..2c8f870 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -53,7 +53,7 @@ class MemberGroupList; */ struct BaseClassDef { - BaseClassDef(ClassDef *cd,const char *n,Protection p, Specifier v,const char *t) : + BaseClassDef(ClassDef *cd,const QCString &n,Protection p, Specifier v,const QCString &t) : classDef(cd), usedName(n), prot(p), virt(v), templSpecifiers(t) {} /** Class definition that this relation inherits from. */ @@ -167,14 +167,14 @@ class ClassDef : public Definition /** Returns the list of base classes from which this class directly * inherits. */ - virtual BaseClassList baseClasses() const = 0; + virtual const BaseClassList &baseClasses() const = 0; /** Update the list of base classes to the one passed */ virtual void updateBaseClasses(const BaseClassList &bcd) = 0; /** Returns the list of sub classes that directly derive from this class */ - virtual BaseClassList subClasses() const = 0; + virtual const BaseClassList &subClasses() const = 0; /** Update the list of sub classes to the one passed */ virtual void updateSubClasses(const BaseClassList &bcd) = 0; @@ -211,7 +211,7 @@ class ClassDef : public Definition /** Returns the namespace this compound is in, or 0 if it has a global * scope. */ - virtual NamespaceDef *getNamespaceDef() const = 0; + //virtual NamespaceDef *getNamespaceDef() const = 0; /** Returns the file in which this compound's definition can be found. * Should not return 0 (but it might be a good idea to check anyway). @@ -266,7 +266,7 @@ class ClassDef : public Definition * available, or 0 otherwise. * @param name The name of the nested compound */ - virtual const Definition *findInnerCompound(const char *name) const = 0; + virtual const Definition *findInnerCompound(const QCString &name) const = 0; /** Returns the template parameter lists that form the template * declaration of this class. @@ -358,6 +358,8 @@ class ClassDef : public Definition virtual bool isSliceLocal() const = 0; virtual bool hasNonReferenceSuperClass() const = 0; + virtual QCString requiresClause() const = 0; + //----------------------------------------------------------------------------------- // --- count members ---- //----------------------------------------------------------------------------------- @@ -375,7 +377,7 @@ class ClassDef : public Definition virtual ClassDef *insertTemplateInstance(const QCString &fileName,int startLine,int startColumn, const QCString &templSpec,bool &freshInstance) const = 0; virtual void writeDeclarationLink(OutputList &ol,bool &found, - const char *header,bool localNames) const = 0; + const QCString &header,bool localNames) const = 0; }; @@ -386,15 +388,14 @@ class ClassDefMutable : public DefinitionMutable, public ClassDef // --- setters ---- //----------------------------------------------------------------------------------- - virtual void setIncludeFile(FileDef *fd,const char *incName,bool local,bool force) = 0; - virtual void setNamespace(NamespaceDef *nd) = 0; + virtual void setIncludeFile(FileDef *fd,const QCString &incName,bool local,bool force) = 0; virtual void setFileDef(FileDef *fd) = 0; virtual void setSubGrouping(bool enabled) = 0; virtual void setProtection(Protection p) = 0; virtual void setGroupDefForAllMembers(GroupDef *g,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs) = 0; virtual void setIsStatic(bool b) = 0; virtual void setCompoundType(CompoundType t) = 0; - virtual void setClassName(const char *name) = 0; + virtual void setClassName(const QCString &name) = 0; virtual void setClassSpecifier(uint64 spec) = 0; virtual void setTemplateArguments(const ArgumentList &al) = 0; virtual void setTemplateBaseClassNames(const TemplateNameMap &templateNames) = 0; @@ -403,22 +404,23 @@ class ClassDefMutable : public DefinitionMutable, public ClassDef virtual void setCategoryOf(ClassDef *cd) = 0; virtual void setUsedOnly(bool b) = 0; virtual void setTagLessReference(const ClassDef *cd) = 0; - virtual void setName(const char *name) = 0; - virtual void setMetaData(const char *md) = 0; + virtual void setName(const QCString &name) = 0; + virtual void setMetaData(const QCString &md) = 0; + virtual void setRequiresClause(const QCString &req) = 0; //----------------------------------------------------------------------------------- // --- actions ---- //----------------------------------------------------------------------------------- - virtual void insertBaseClass(ClassDef *,const char *name,Protection p,Specifier s,const char *t=0) = 0; - virtual void insertSubClass(ClassDef *,Protection p,Specifier s,const char *t=0) = 0; + virtual void insertBaseClass(ClassDef *,const QCString &name,Protection p,Specifier s,const QCString &t=QCString()) = 0; + virtual void insertSubClass(ClassDef *,Protection p,Specifier s,const QCString &t=QCString()) = 0; virtual void insertMember(MemberDef *) = 0; virtual void insertUsedFile(const FileDef *) = 0; - virtual void addMembersToTemplateInstance(const ClassDef *cd,const ArgumentList &templateArguments,const char *templSpec) = 0; + virtual void addMembersToTemplateInstance(const ClassDef *cd,const ArgumentList &templateArguments,const QCString &templSpec) = 0; virtual void addInnerCompound(const Definition *d) = 0; - virtual bool addExample(const char *anchor,const char *name, const char *file) = 0; - virtual void addUsedClass(ClassDef *cd,const char *accessName,Protection prot) = 0; - virtual void addUsedByClass(ClassDef *cd,const char *accessName,Protection prot) = 0; + virtual bool addExample(const QCString &anchor,const QCString &name, const QCString &file) = 0; + virtual void addUsedClass(ClassDef *cd,const QCString &accessName,Protection prot) = 0; + virtual void addUsedByClass(ClassDef *cd,const QCString &accessName,Protection prot) = 0; virtual void makeTemplateArgument(bool b=TRUE) = 0; virtual void mergeCategory(ClassDef *category) = 0; virtual void findSectionsInDocumentation() = 0; @@ -444,14 +446,15 @@ class ClassDefMutable : public DefinitionMutable, public ClassDef virtual void writeMemberPages(OutputList &ol) const = 0; virtual void writeMemberList(OutputList &ol) const = 0; virtual void writeDeclaration(OutputList &ol,const MemberDef *md,bool inGroup, - const ClassDef *inheritedFrom,const char *inheritId) const = 0; + const ClassDef *inheritedFrom,const QCString &inheritId) const = 0; virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *md) const = 0; virtual void writeSummaryLinks(OutputList &ol) const = 0; virtual void writeInlineDocumentation(OutputList &ol) const = 0; - virtual void writeTagFile(std::ostream &) = 0; + virtual void writeTagFile(TextStream &) = 0; virtual void writeMemberDeclarations(OutputList &ol,ClassDefSet &visitedClasses, MemberListType lt,const QCString &title, - const char *subTitle=0,bool showInline=FALSE,const ClassDef *inheritedFrom=0, + const QCString &subTitle=QCString(), + bool showInline=FALSE,const ClassDef *inheritedFrom=0, int lt2=-1,bool invert=FALSE,bool showAlways=FALSE) const = 0; virtual void addGroupedInheritedMembers(OutputList &ol,MemberListType lt, const ClassDef *inheritedFrom,const QCString &inheritId) const = 0; @@ -461,9 +464,9 @@ class ClassDefMutable : public DefinitionMutable, public ClassDef /** Factory method to create a new ClassDef object */ ClassDefMutable *createClassDef( - const char *fileName,int startLine,int startColumn, - const char *name,ClassDef::CompoundType ct, - const char *ref=0,const char *fName=0, + const QCString &fileName,int startLine,int startColumn, + const QCString &name,ClassDef::CompoundType ct, + const QCString &ref=QCString(),const QCString &fName=QCString(), bool isSymbol=TRUE,bool isJavaEnum=FALSE); ClassDef *createClassDefAlias(const Definition *newScope,const ClassDef *cd); @@ -488,11 +491,11 @@ struct UsesClassDef ~UsesClassDef() { } - void addAccessor(const char *s) + void addAccessor(const QCString &s) { - if (accessors.find(s)==accessors.end()) + if (accessors.find(s.str())==accessors.end()) { - accessors.insert(s); + accessors.insert(s.str()); } } /** Class definition that this relation uses. */ @@ -525,11 +528,11 @@ struct ConstraintClassDef ~ConstraintClassDef() { } - void addAccessor(const char *s) + void addAccessor(const QCString &s) { - if (accessors.find(s)==accessors.end()) + if (accessors.find(s.str())==accessors.end()) { - accessors.insert(s); + accessors.insert(s.str()); } } /** Class definition that this relation uses. */ diff --git a/src/classlist.cpp b/src/classlist.cpp index af64478..b4c2412 100644 --- a/src/classlist.cpp +++ b/src/classlist.cpp @@ -51,7 +51,7 @@ bool ClassLinkedRefMap::declVisible(const ClassDef::CompoundType *filter) const } void ClassLinkedRefMap::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter, - const char *header,bool localNames) const + const QCString &header,bool localNames) const { static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE); bool found=FALSE; diff --git a/src/classlist.h b/src/classlist.h index 709412b..75bc713 100644 --- a/src/classlist.h +++ b/src/classlist.h @@ -31,7 +31,7 @@ class ClassLinkedRefMap : public LinkedRefMap<const ClassDef> { public: bool declVisible(const ClassDef::CompoundType *filter=0) const; - void writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter,const char *header,bool localNames) const; + void writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter,const QCString &header,bool localNames) const; void writeDocumentation(OutputList &ol,const Definition * container=0) const; }; diff --git a/src/cmdmapper.cpp b/src/cmdmapper.cpp index 264a74b..bc8719a 100644 --- a/src/cmdmapper.cpp +++ b/src/cmdmapper.cpp @@ -233,10 +233,10 @@ CommandMap htmlTagMap[] = Mapper *Mappers::cmdMapper = new Mapper(cmdMap,true); Mapper *Mappers::htmlTagMapper = new Mapper(htmlTagMap,false); -int Mapper::map(const char *n) +int Mapper::map(const QCString &n) { - QCString name=n; - if (name.isEmpty()) return 0; + if (n.isEmpty()) return 0; + QCString name = n; if (!m_cs) name=name.lower(); auto it = m_map.find(name.str()); return it!=m_map.end() ? it->second : 0; diff --git a/src/cmdmapper.h b/src/cmdmapper.h index 1675e76..17e17e9 100644 --- a/src/cmdmapper.h +++ b/src/cmdmapper.h @@ -218,7 +218,7 @@ enum HtmlTagType class Mapper { public: - int map(const char *n); + int map(const QCString &n); QCString find(const int n); Mapper(const CommandMap *cm,bool caseSensitive); private: @@ -1,12 +1,12 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -31,11 +31,11 @@ class CCodeParser : public CodeParserInterface CCodeParser(); virtual ~CCodeParser(); void parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt lang, bool isExampleBlock, - const char *exampleName=0, + const QCString &exampleName=QCString(), FileDef *fileDef=0, int startLine=-1, int endLine=-1, @@ -75,11 +75,10 @@ // context for an Objective-C method call struct ObjCCallCtx { - ObjCCallCtx() : comment(std::ios_base::ate) {} int id; QCString methodName; QCString objectTypeOrName; - std::ostringstream comment; + TextStream comment; const ClassDef *objectType; const MemberDef *objectVar; const MemberDef *method; @@ -184,7 +183,7 @@ struct codeYY_state SymbolResolver symbolResolver; }; -static bool isCastKeyword(const QCString &s); +static bool isCastKeyword(const char *s); //------------------------------------------------------------------- #if USE_STATE2STRING @@ -194,9 +193,10 @@ static const char *stateToString(yyscan_t yyscanner,int state); static void saveObjCContext(yyscan_t yyscanner); static void restoreObjCContext(yyscan_t yyscanner); static void addUsingDirective(yyscan_t yyscanner,const char *name); -static void pushScope(yyscan_t yyscanner,const char *s); +static void pushScope(yyscan_t yyscanner,const QCString &s); static void popScope(yyscan_t yyscanner); static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor); +static void addToSearchIndex(yyscan_t yyscanner,const QCString &text); static void addToSearchIndex(yyscan_t yyscanner,const char *text); static void setClassScope(yyscan_t yyscanner,const QCString &name); static void startCodeLine(yyscan_t yyscanner); @@ -204,37 +204,41 @@ static void endCodeLine(yyscan_t yyscanner); static void nextCodeLine(yyscan_t yyscanner); static void startFontClass(yyscan_t yyscanner,const char *s); static void endFontClass(yyscan_t yyscanner); +static void codifyLines(yyscan_t yyscanner,const QCString &text); static void codifyLines(yyscan_t yyscanner,const char *text); static void incrementFlowKeyWordCount(yyscan_t yyscanner); static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, const Definition *d, - const char *text); + const QCString &text); static void addType(yyscan_t yyscanner); static void addParmType(yyscan_t yyscanner); static void addUsingDirective(yyscan_t yyscanner,const char *name); static void setParameterList(yyscan_t yyscanner,const MemberDef *md); -static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,const Definition *d); +static const ClassDef *stripClassName(yyscan_t yyscanner,const QCString &s,const Definition *d); static const MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &name); static void updateCallContextForSmartPointer(yyscan_t yyscanner); static bool getLinkInScope(yyscan_t yyscanner,const QCString &c, // scope const QCString &m, // member - const char *memberText, // exact text + const QCString &memberText, // exact text CodeOutputInterface &ol, - const char *text, + const QCString &text, bool varOnly=FALSE ); -static bool getLink(yyscan_t yyscanner,const char *className, - const char *memberName, +static bool getLink(yyscan_t yyscanner,const QCString &className, + const QCString &memberName, CodeOutputInterface &ol, - const char *text=0, + const QCString &text=QCString(), bool varOnly=FALSE); +static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol,const QCString &clName, + bool typeOnly=FALSE,bool varOnly=FALSE); static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *clName, bool typeOnly=FALSE,bool varOnly=FALSE); -static bool generateClassMemberLink(yyscan_t yyscanner,CodeOutputInterface &ol,const MemberDef *xmd,const char *memName); -static bool generateClassMemberLink(yyscan_t yyscanner,CodeOutputInterface &ol,const Definition *def,const char *memName); +static bool generateClassMemberLink(yyscan_t yyscanner,CodeOutputInterface &ol,const MemberDef *xmd,const QCString &memName); +static bool generateClassMemberLink(yyscan_t yyscanner,CodeOutputInterface &ol,const Definition *def,const QCString &memName); static void generateMemberLink(yyscan_t yyscanner,CodeOutputInterface &ol,const QCString &varName, - const char *memName); + const QCString &memName); static void generatePHPVariableLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *varName); +static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,const QCString &funcName); static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *funcName); static int countLines(yyscan_t yyscanner); static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx); @@ -242,9 +246,10 @@ static QCString escapeName(yyscan_t yyscanner,const char *s); static QCString escapeObject(yyscan_t yyscanner,const char *s); static QCString escapeWord(yyscan_t yyscanner,const char *s); static QCString escapeComment(yyscan_t yyscanner,const char *s); -static bool skipLanguageSpecificKeyword(yyscan_t yyscanner,const QCString &kw); +static bool skipLanguageSpecificKeyword(yyscan_t yyscanner,const char *kw); static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); static void addVariable(yyscan_t yyscanner,QCString type,QCString name); +static bool startsWithKeyword(const QCString &str,const QCString &kw); //------------------------------------------------------------------- @@ -271,7 +276,7 @@ TEMPLIST "<"[^\"\}\{\(\)\/\n\>]*">" SCOPETNAME (((({ID}{TEMPLIST}?){BN}*)?{SEP}{BN}*)*)((~{BN}*)?{ID}) SCOPEPREFIX ({ID}{TEMPLIST}?{BN}*{SEP}{BN}*)+ KEYWORD_OBJC ("@public"|"@private"|"@protected"|"@class"|"@implementation"|"@interface"|"@end"|"@selector"|"@protocol"|"@optional"|"@required"|"@throw"|"@synthesize"|"@property") -KEYWORD ("asm"|"__assume"|"auto"|"class"|"const"|"delete"|"enum"|"explicit"|"extern"|"false"|"friend"|"gcnew"|"gcroot"|"set"|"get"|"inline"|"internal"|"mutable"|"namespace"|"new"|"null"|"nullptr"|"override"|"operator"|"pin_ptr"|"private"|"protected"|"public"|"raise"|"register"|"remove"|"self"|"sizeof"|"static"|"struct"|"__super"|"function"|"template"|"generic"|"this"|"true"|"typedef"|"typeid"|"typename"|"union"|"using"|"virtual"|"volatile"|"abstract"|"final"|"import"|"synchronized"|"transient"|"alignas"|"alignof"|{KEYWORD_OBJC}) +KEYWORD ("asm"|"__assume"|"auto"|"class"|"const"|"delete"|"enum"|"explicit"|"extern"|"false"|"friend"|"gcnew"|"gcroot"|"set"|"get"|"inline"|"internal"|"mutable"|"namespace"|"new"|"null"|"nullptr"|"override"|"operator"|"pin_ptr"|"private"|"protected"|"public"|"raise"|"register"|"remove"|"self"|"sizeof"|"static"|"struct"|"__super"|"function"|"template"|"generic"|"this"|"true"|"typedef"|"typeid"|"typename"|"union"|"using"|"virtual"|"volatile"|"abstract"|"final"|"import"|"synchronized"|"transient"|"alignas"|"alignof"|"concept"|"requires"|{KEYWORD_OBJC}) FLOWKW ("break"|"catch"|"continue"|"default"|"do"|"else"|"finally"|"return"|"switch"|"throw"|"throws"|"@catch"|"@finally") FLOWCONDITION ("case"|"for"|"foreach"|"for each"|"goto"|"if"|"try"|"while"|"@try") TYPEKW ("bool"|"byte"|"char"|"double"|"float"|"int"|"long"|"object"|"short"|"signed"|"unsigned"|"void"|"wchar_t"|"size_t"|"boolean"|"id"|"SEL"|"string"|"nullptr") @@ -363,6 +368,7 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale %x ObjCSkipStr %x ObjCCallComment %x OldStyleArgs +%x ConceptName %x UsingName %x RawString %x InlineInit @@ -493,13 +499,13 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale bool found=FALSE; const FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,yytext,ambig); - //printf("looking for include %s -> %s fd=%p\n",yytext,absPath.data(),fd); + //printf("looking for include %s -> %s fd=%p\n",yytext,qPrint(absPath),fd); if (fd && fd->isLinkable()) { if (ambig) // multiple input files match the name { DBG_CTX((stderr,"===== yes %s is ambiguous\n",yytext)); - QCString name = Dir::cleanDirPath(yytext); + QCString name(Dir::cleanDirPath(yytext)); if (!name.isEmpty() && yyextra->sourceFileDef) { const FileName *fn = Doxygen::inputNameLinkedMap->find(name); @@ -520,7 +526,7 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale found = TRUE; } } - DBG_CTX((stderr," include file %s found=%d\n",fd ? fd->absFilePath().data() : "<none>",found)); + DBG_CTX((stderr," include file %s found=%d\n",fd ? qPrint(fd->absFilePath()) : "<none>",found)); if (found) { writeMultiLineCodeLink(yyscanner,*yyextra->code,fd,yytext); @@ -608,7 +614,7 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale BEGIN(Body); } <Body,ClassVar>"@end" { - DBG_CTX((stderr,"End of objc scope fd=%s\n",yyextra->sourceFileDef->name().data())); + DBG_CTX((stderr,"End of objc scope fd=%s\n",qPrint(yyextra->sourceFileDef->name()))); if (yyextra->sourceFileDef) { const FileDef *fd=yyextra->sourceFileDef; @@ -652,7 +658,7 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale BEGIN( Body ); } <ClassName,ClassVar>[*&^%]+ { - yyextra->type=yyextra->curClassName.copy(); + yyextra->type=yyextra->curClassName; yyextra->name.resize(0); yyextra->code->codify(yytext); BEGIN( Body ); // variable of type struct * @@ -723,7 +729,7 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale } <PackageName>{ID}("."{ID})* { yyextra->curClassName=substitute(yytext,".","::"); - DBG_CTX((stderr,"found package: %s\n",yyextra->curClassName.data())); + DBG_CTX((stderr,"found package: %s\n",qPrint(yyextra->curClassName))); addType(yyscanner); codifyLines(yyscanner,yytext); } @@ -739,14 +745,14 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale BEGIN( Bases ); } <ClassVar>("sealed"|"abstract")/{BN}*(":"|"{") { - DBG_CTX((stderr,"***** C++/CLI modifier %s on yyextra->curClassName=%s\n",yytext,yyextra->curClassName.data())); + DBG_CTX((stderr,"***** C++/CLI modifier %s on yyextra->curClassName=%s\n",yytext,qPrint(yyextra->curClassName))); startFontClass(yyscanner,"keyword"); codifyLines(yyscanner,yytext); endFontClass(yyscanner); BEGIN( CppCliTypeModifierFollowup ); } <ClassVar>{ID} { - yyextra->type = yyextra->curClassName.copy(); + yyextra->type = yyextra->curClassName; yyextra->name = yytext; if (yyextra->insideBody) { @@ -766,7 +772,7 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale yyextra->code->codify(yytext); if (YY_START==ClassVar && yyextra->curClassName.isEmpty()) { - yyextra->curClassName = yyextra->name.copy(); + yyextra->curClassName = yyextra->name; } if (yyextra->searchingForBody) { @@ -779,10 +785,10 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale DBG_CTX((stderr,"** scope stack push CLASSBLOCK\n")); yyextra->scopeStack.push(CLASSBLOCK); pushScope(yyscanner,yyextra->curClassName); - DBG_CTX((stderr,"***** yyextra->curClassName=%s\n",yyextra->curClassName.data())); + DBG_CTX((stderr,"***** yyextra->curClassName=%s\n",qPrint(yyextra->curClassName))); if (yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->curClassName)==0) { - DBG_CTX((stderr,"Adding new class %s\n",yyextra->curClassName.data())); + DBG_CTX((stderr,"Adding new class %s\n",qPrint(yyextra->curClassName))); ScopedTypeVariant var(yyextra->curClassName); // insert base classes. for (const auto &s : yyextra->curClassBases) @@ -793,7 +799,7 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale { bcd = toClassDef(it->second.globalDef()); } - if (bcd==0) bcd=yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,s.c_str()); + if (bcd==0) bcd=yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,QCString(s)); if (bcd && bcd->name()!=yyextra->curClassName) { var.localDef()->insertBaseClass(bcd->name()); @@ -818,7 +824,7 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale endFontClass(yyscanner); } <Bases>{SEP}?({ID}{SEP})*{ID} { - DBG_CTX((stderr,"%s:addBase(%s)\n",yyextra->curClassName.data(),yytext)); + DBG_CTX((stderr,"%s:addBase(%s)\n",qPrint(yyextra->curClassName),yytext)); yyextra->curClassBases.push_back(yytext); generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); } @@ -909,12 +915,23 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale yyextra->insideTemplate=TRUE; yyextra->sharpCount=0; } +<Body>"concept"{BN}+ { + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + BEGIN(ConceptName); + } <Body>"using"{BN}+"namespace"{BN}+ { startFontClass(yyscanner,"keyword"); codifyLines(yyscanner,yytext); endFontClass(yyscanner); BEGIN(UsingName); } +<ConceptName>{ID}("::"{ID})* { + addUsingDirective(yyscanner,yytext); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + } +<ConceptName>"=" { codifyLines(yyscanner,yytext); BEGIN(Body); } <UsingName>{ID}("::"{ID})* { addUsingDirective(yyscanner,yytext); generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); @@ -1119,13 +1136,14 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale yyextra->name+=yytext; } <Body>{SCOPENAME}/{BN}*[:;,)\]] { // "int var;" or "var, var2" or "debug(f) macro" , or int var : 5; + if (startsWithKeyword(yytext,"typedef")) REJECT; addType(yyscanner); // changed this to generateFunctionLink, see bug 624514 - //generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,FALSE,TRUE); generateFunctionLink(yyscanner,*yyextra->code,yytext); yyextra->name+=yytext; } <Body>{SCOPENAME}/{B}* { // p->func() + if (startsWithKeyword(yytext,"typedef")) REJECT; addType(yyscanner); generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); yyextra->name+=yytext; @@ -1152,11 +1170,11 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale BEGIN( FuncCall ); } <FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{RAWBEGIN} { - QCString text=yytext; + QCString text(yytext); uint i=(uint)text.find('R'); yyextra->code->codify(text.left(i+1)); startFontClass(yyscanner,"stringliteral"); - yyextra->code->codify(yytext+i+1); + yyextra->code->codify(QCString(yytext+i+1)); yyextra->lastStringContext=YY_START; yyextra->inForEachExpression = FALSE; yyextra->delimiter = yytext+i+2; @@ -1205,7 +1223,7 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale } <RawString>{RAWEND} { yyextra->code->codify(yytext); - QCString delimiter = yytext+1; + QCString delimiter(yytext+1); delimiter=delimiter.left(delimiter.length()-1); if (delimiter==yyextra->delimiter) { @@ -1272,14 +1290,14 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale { if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getScope().globalDef(),yytext)) { - yyextra->code->codify(yytext); + codifyLines(yyscanner,yytext); addToSearchIndex(yyscanner,yytext); } yyextra->name.resize(0); } else { - yyextra->code->codify(yytext); + codifyLines(yyscanner,yytext); addToSearchIndex(yyscanner,yytext); yyextra->name.resize(0); } @@ -1296,10 +1314,10 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale <MemberCall>{SCOPENAME}/{B}* { if (yyextra->theCallContext.getScope().globalDef()) { - DBG_CTX((stderr,"yyextra->theCallContext.getClass()=%p\n",yyextra->theCallContext.getScope().globalDef())); + DBG_CTX((stderr,"yyextra->theCallContext.getClass()=%p\n",(void*)yyextra->theCallContext.getScope().globalDef())); if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getScope().globalDef(),yytext)) { - yyextra->code->codify(yytext); + codifyLines(yyscanner,yytext); addToSearchIndex(yyscanner,yytext); } yyextra->name.resize(0); @@ -1307,7 +1325,7 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale else { DBG_CTX((stderr,"no class context!\n")); - yyextra->code->codify(yytext); + codifyLines(yyscanner,yytext); addToSearchIndex(yyscanner,yytext); yyextra->name.resize(0); } @@ -1335,15 +1353,15 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale else { yyextra->code->codify(yytext); - yyextra->saveName = yyextra->name.copy(); - yyextra->saveType = yyextra->type.copy(); + yyextra->saveName = yyextra->name; + yyextra->saveType = yyextra->type; if (*yytext!='[' && !yyextra->type.isEmpty()) { //printf("yyextra->scopeStack.bottom()=%p\n",yyextra->scopeStack.bottom()); //if (yyextra->scopeStack.top()!=CLASSBLOCK) // commented out for bug731363 { //printf("AddVariable: '%s' '%s' context=%d\n", - // yyextra->type.data(),yyextra->name.data(),yyextra->theVarContext.count()); + // qPrint(yyextra->type),qPrint(yyextra->name),yyextra->theVarContext.count()); addVariable(yyscanner,yyextra->type,yyextra->name); } yyextra->name.resize(0); @@ -1362,52 +1380,6 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale yyextra->parmName.resize(0); } } - /* -<ObjCMemberCall>{ID} { - if (qstrcmp(yytext,"self")==0 || qstrcmp(yytext,"super")==0) - { - // TODO: get proper base class for "super" - yyextra->theCallContext.setClass(getClass(yyextra->curClassName)); - startFontClass(yyscanner,"keyword"); - yyextra->code->codify(yytext); - endFontClass(yyscanner); - } - else - { - generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); - } - yyextra->name.resize(0); - BEGIN(ObjCMemberCall2); - } -<ObjCMemberCall>"[" { - yyextra->code->codify(yytext); - yyextra->theCallContext.pushScope(yyscanner,yyextra->name, yyextra->type); - } -<ObjCMemberCall2>{ID}":"? { - yyextra->name+=yytext; - if (yyextra->theCallContext.getClass()) - { - DBG_CTX((stderr,"Calling method %s\n",yyextra->name.data())); - if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getClass(),yyextra->name)) - { - yyextra->code->codify(yytext); - addToSearchIndex(yyscanner,yyextra->name); - } - } - else - { - yyextra->code->codify(yytext); - addToSearchIndex(yyscanner,yyextra->name); - } - yyextra->name.resize(0); - BEGIN(ObjCMemberCall3); - } -<ObjCMemberCall2,ObjCMemberCall3>"]" { - yyextra->theCallContext.popScope(yyextra->name, yyextra->type); - yyextra->code->codify(yytext); - BEGIN(Body); - } - */ <ObjCCall,ObjCMName>"["|"{" { saveObjCContext(yyscanner); yyextra->currentCtx->format+=*yytext; @@ -1455,7 +1427,7 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale if (yyextra->braceCount==0) { yyextra->currentCtx->objectTypeOrName=yytext; - DBG_CTX((stderr,"new type=%s\n",yyextra->currentCtx->objectTypeOrName.data())); + DBG_CTX((stderr,"new type=%s\n",qPrint(yyextra->currentCtx->objectTypeOrName))); BEGIN(ObjCMName); } } @@ -1503,8 +1475,8 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale yyextra->theCallContext.popScope(yyextra->name, yyextra->type); yyextra->code->codify(yytext); // TODO: nested arrays like: a[b[0]->func()]->func() - yyextra->name = yyextra->saveName.copy(); - yyextra->type = yyextra->saveType.copy(); + yyextra->name = yyextra->saveName; + yyextra->type = yyextra->saveType; } <Body>[0-9]+ { yyextra->code->codify(yytext); @@ -1628,7 +1600,7 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale <MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" { if (yytext[0]==')') // no a pointer cast { - DBG_CTX((stderr,"addVariable(%s,%s)\n",yyextra->parmType.data(),yyextra->parmName.data())); + DBG_CTX((stderr,"addVariable(%s,%s)\n",qPrint(yyextra->parmType),qPrint(yyextra->parmName))); if (yyextra->parmType.isEmpty()) { yyextra->parmType=yyextra->parmName; @@ -1668,7 +1640,7 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale if (*yytext==';') yyextra->searchingForBody=FALSE; if (!yyextra->type.isEmpty()) { - DBG_CTX((stderr,"add variable yyextra->type=%s yyextra->name=%s)\n",yyextra->type.data(),yyextra->name.data())); + DBG_CTX((stderr,"add variable yyextra->type=%s yyextra->name=%s)\n",qPrint(yyextra->type),qPrint(yyextra->name))); addVariable(yyscanner,yyextra->type,yyextra->name); } yyextra->parmType.resize(0);yyextra->parmName.resize(0); @@ -1702,11 +1674,11 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale //yyextra->theCallContext.popScope(yyextra->name, yyextra->type); yyextra->parmType.resize(0);yyextra->parmName.resize(0); int index = yyextra->name.findRev("::"); - DBG_CTX((stderr,"yyextra->name=%s\n",yyextra->name.data())); + DBG_CTX((stderr,"yyextra->name=%s\n",qPrint(yyextra->name))); if (index!=-1) { QCString scope = yyextra->name.left((uint)index); - if (!yyextra->classScope.isEmpty()) scope.prepend(yyextra->classScope+"::"); + if (!yyextra->classScope.isEmpty()) scope.prepend((yyextra->classScope+"::")); const ClassDef *cd=yyextra->symbolResolver.resolveClass(Doxygen::globalScope,scope); if (cd) { @@ -1754,6 +1726,11 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale endFontClass(yyscanner); yyextra->inFunctionTryBlock=TRUE; } +<CallEnd>"requires" { // function-try-block + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + } <CallEnd>{ID} { if (yyextra->insideBody || !yyextra->parmType.isEmpty()) { @@ -1820,12 +1797,12 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale BEGIN( Body ); } <SkipInits>{ID}{B}*"{" { - QCString text = yytext; + QCString text(yytext); int bracketPos = text.find('{'); int spacePos = text.find(' '); int len = spacePos==-1 ? bracketPos : spacePos; generateClassOrGlobalLink(yyscanner,*yyextra->code,text.left(len)); - yyextra->code->codify(yytext+len); + yyextra->code->codify(QCString(yytext+len)); } <SkipInits>{ID} { generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); @@ -2194,10 +2171,17 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale /*@ ---------------------------------------------------------------------------- */ +static bool startsWithKeyword(const QCString &str,const QCString &kw) +{ + if (str.length()<kw.length()) return false; // string too short to match + return str==kw || // exact match + (str.startsWith(kw) && !isId(str.at(kw.length()))); // match that is not a substring +} + static void addVariable(yyscan_t yyscanner,QCString type,QCString name) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - DBG_CTX((stderr,"VariableContext::addVariable(%s,%s)\n",type.data(),name.data())); + DBG_CTX((stderr,"VariableContext::addVariable(%s,%s)\n",qPrint(type),qPrint(name))); QCString ltype = type.simplifyWhiteSpace(); QCString lname = name.simplifyWhiteSpace(); if (ltype.left(7)=="struct ") @@ -2210,11 +2194,11 @@ static void addVariable(yyscan_t yyscanner,QCString type,QCString name) } if (ltype.isEmpty() || lname.isEmpty()) return; DBG_CTX((stderr,"** addVariable trying: type='%s' name='%s' currentDefinition=%s\n", - ltype.data(),lname.data(),yyextra->currentDefinition?yyextra->currentDefinition->name().data():"<none>")); + qPrint(ltype),qPrint(lname),yyextra->currentDefinition?qPrint(yyextra->currentDefinition->name()):"<none>")); auto it = yyextra->codeClassMap.find(ltype.str()); if (it!=yyextra->codeClassMap.end()) // look for class definitions inside the code block { - DBG_CTX((stderr,"** addVariable type='%s' name='%s'\n",ltype.data(),lname.data())); + DBG_CTX((stderr,"** addVariable type='%s' name='%s'\n",qPrint(ltype),qPrint(lname))); yyextra->theVarContext.addVariable(lname,std::move(it->second)); // add it to a list } else @@ -2223,7 +2207,7 @@ static void addVariable(yyscan_t yyscanner,QCString type,QCString name) int i=0; if (varDef) { - DBG_CTX((stderr,"** addVariable type='%s' name='%s'\n",ltype.data(),lname.data())); + DBG_CTX((stderr,"** addVariable type='%s' name='%s'\n",qPrint(ltype),qPrint(lname))); yyextra->theVarContext.addVariable(lname,ScopedTypeVariant(varDef)); // add it to a list } else if ((i=ltype.find('<'))!=-1) @@ -2238,7 +2222,7 @@ static void addVariable(yyscan_t yyscanner,QCString type,QCString name) // is hidden to avoid false links to global variables with the same name // TODO: make this work for namespaces as well! { - DBG_CTX((stderr,"** addVariable: dummy context for '%s'\n",lname.data())); + DBG_CTX((stderr,"** addVariable: dummy context for '%s'\n",qPrint(lname))); yyextra->theVarContext.addVariable(lname,ScopedTypeVariant()); } else @@ -2252,7 +2236,7 @@ static void addVariable(yyscan_t yyscanner,QCString type,QCString name) //------------------------------------------------------------------- /*! add class/namespace name s to the scope */ -static void pushScope(yyscan_t yyscanner,const char *s) +static void pushScope(yyscan_t yyscanner,const QCString &s) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->classScopeLengthStack.push(int(yyextra->classScope.length())); @@ -2265,7 +2249,7 @@ static void pushScope(yyscan_t yyscanner,const char *s) yyextra->classScope += "::"; yyextra->classScope += s; } - DBG_CTX((stderr,"pushScope(%s) result: '%s'\n",s,yyextra->classScope.data())); + DBG_CTX((stderr,"pushScope(%s) result: '%s'\n",qPrint(s),qPrint(yyextra->classScope))); } @@ -2283,7 +2267,7 @@ static void popScope(yyscan_t yyscanner) { //err("Too many end of scopes found!\n"); } - DBG_CTX((stderr,"popScope() result: '%s'\n",yyextra->classScope.data())); + DBG_CTX((stderr,"popScope() result: '%s'\n",qPrint(yyextra->classScope))); } static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor) @@ -2303,7 +2287,7 @@ static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor) } } -static void addToSearchIndex(yyscan_t yyscanner,const char *text) +static void addToSearchIndex(yyscan_t yyscanner,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (Doxygen::searchIndex) @@ -2313,10 +2297,16 @@ static void addToSearchIndex(yyscan_t yyscanner,const char *text) } } +static void addToSearchIndex(yyscan_t yyscanner,const char *text) +{ + addToSearchIndex(yyscanner,QCString(text)); +} + + static void setClassScope(yyscan_t yyscanner,const QCString &name) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - DBG_CTX((stderr,"setClassScope(%s)\n",name.data())); + DBG_CTX((stderr,"setClassScope(%s)\n",qPrint(name))); QCString n=name; n=n.simplifyWhiteSpace(); int ts=n.find('<'); // start of template @@ -2339,7 +2329,7 @@ static void setClassScope(yyscan_t yyscanner,const QCString &name) n = n.mid(i+2); } pushScope(yyscanner,n); - DBG_CTX((stderr,"--->New class scope '%s'\n",yyextra->classScope.data())); + DBG_CTX((stderr,"--->New class scope '%s'\n",qPrint(yyextra->classScope))); } /*! start a new line of code, inserting a line number if yyextra->sourceFileDef @@ -2357,7 +2347,7 @@ static void startCodeLine(yyscan_t yyscanner) //lineAnchor.sprintf("l%05d",yyextra->yyLineNr); const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr); - DBG_CTX((stderr,"%s:startCodeLine(%d)=%p\n",yyextra->sourceFileDef->name().data(),yyextra->yyLineNr,d)); + DBG_CTX((stderr,"%s:startCodeLine(%d)=%p\n",qPrint(yyextra->sourceFileDef->name()),yyextra->yyLineNr,(void*)d)); if (!yyextra->includeCodeFragment && d) { yyextra->currentDefinition = d; @@ -2371,7 +2361,7 @@ static void startCodeLine(yyscan_t yyscanner) yyextra->args.resize(0); yyextra->parmType.resize(0); yyextra->parmName.resize(0); - DBG_CTX((stderr,"Real scope: '%s'\n",yyextra->realScope.data())); + DBG_CTX((stderr,"Real scope: '%s'\n",qPrint(yyextra->realScope))); yyextra->bodyCurlyCount = 0; QCString lineAnchor; lineAnchor.sprintf("l%05d",yyextra->yyLineNr); @@ -2379,27 +2369,28 @@ static void startCodeLine(yyscan_t yyscanner) { yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(), yyextra->currentMemberDef->getOutputFileBase(), - yyextra->currentMemberDef->anchor(),yyextra->yyLineNr); + yyextra->currentMemberDef->anchor(), + yyextra->yyLineNr); setCurrentDoc(yyscanner,lineAnchor); } else if (d->isLinkableInProject()) { yyextra->code->writeLineNumber(d->getReference(), d->getOutputFileBase(), - 0,yyextra->yyLineNr); + QCString(),yyextra->yyLineNr); setCurrentDoc(yyscanner,lineAnchor); } } else { - yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr); + yyextra->code->writeLineNumber(QCString(),QCString(),QCString(),yyextra->yyLineNr); } } DBG_CTX((stderr,"startCodeLine(%d)\n",yyextra->yyLineNr)); yyextra->code->startCodeLine(yyextra->sourceFileDef && yyextra->lineNumbers); if (yyextra->currentFontClass) { - yyextra->code->startFontClass(yyextra->currentFontClass); + yyextra->code->startFontClass(QCString(yyextra->currentFontClass)); } } @@ -2428,11 +2419,12 @@ static void nextCodeLine(yyscan_t yyscanner) /*! write a code fragment 'text' that may span multiple lines, inserting * line numbers for each line. */ -static void codifyLines(yyscan_t yyscanner,const char *text) +static void codifyLines(yyscan_t yyscanner,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - DBG_CTX((stderr,"codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,text)); - const char *p=text,*sp=p; + DBG_CTX((stderr,"codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,qPrint(text))); + if (text.isEmpty()) return; + const char *p=text.data(),*sp=p; char c; bool done=FALSE; while (!done) @@ -2447,18 +2439,23 @@ static void codifyLines(yyscan_t yyscanner,const char *text) char *tmp = (char*)malloc(l+1); memcpy(tmp,sp,l); tmp[l]='\0'; - yyextra->code->codify(tmp); + yyextra->code->codify(QCString(tmp)); free(tmp); nextCodeLine(yyscanner); } else { - yyextra->code->codify(sp); + yyextra->code->codify(QCString(sp)); done=TRUE; } } } +static void codifyLines(yyscan_t yyscanner,const char *text) +{ + codifyLines(yyscanner,QCString(text)); +} + static void incrementFlowKeyWordCount(yyscan_t yyscanner) { std::lock_guard<std::mutex> lock(g_countFlowKeywordsMutex); @@ -2479,7 +2476,7 @@ static void incrementFlowKeyWordCount(yyscan_t yyscanner) */ static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, const Definition *d, - const char *text) + const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS); @@ -2493,24 +2490,23 @@ static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, tooltip = d->briefDescriptionAsTooltip(); } bool done=FALSE; - char *p=(char *)text; + const char *p=text.data(); while (!done) { - char *sp=p; + const char *sp=p; char c; while ((c=*p++) && c!='\n') { } if (c=='\n') { yyextra->yyLineNr++; - *(p-1)='\0'; - DBG_CTX((stderr,"writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp)); - ol.writeCodeLink(ref,file,anchor,sp,tooltip); + DBG_CTX((stderr,"writeCodeLink(%s,%s,%s,%s)\n",qPrint(ref),qPrint(file),qPrint(anchor),qPrint(QCString(sp,p-sp-1)))); + ol.writeCodeLink(ref,file,anchor,QCString(sp,p-sp-1),tooltip); nextCodeLine(yyscanner); } else { - DBG_CTX((stderr,"writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp)); - ol.writeCodeLink(ref,file,anchor,sp,tooltip); + DBG_CTX((stderr,"writeCodeLink(%s,%s,%s,%s)\n",qPrint(ref),qPrint(file),qPrint(anchor),sp)); + ol.writeCodeLink(ref,file,anchor,QCString(sp),tooltip); done=TRUE; } } @@ -2553,7 +2549,7 @@ static void addUsingDirective(yyscan_t yyscanner,const char *name) static void setParameterList(yyscan_t yyscanner,const MemberDef *md) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - yyextra->classScope = md->getClassDef() ? md->getClassDef()->name().data() : ""; + yyextra->classScope = md->getClassDef() ? md->getClassDef()->name() : QCString(); for (const Argument &a : md->argumentList()) { yyextra->parmName = a.name; @@ -2568,7 +2564,7 @@ static void setParameterList(yyscan_t yyscanner,const MemberDef *md) } } -static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,const Definition *d) +static const ClassDef *stripClassName(yyscan_t yyscanner,const QCString &s,const Definition *d) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; int pos=0; @@ -2587,7 +2583,7 @@ static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,const Def { cd=yyextra->symbolResolver.resolveClass(d,clName); } - DBG_CTX((stderr,"stripClass trying '%s' = %p\n",clName.data(),cd)); + DBG_CTX((stderr,"stripClass trying '%s' = %p\n",qPrint(clName),(void*)cd)); if (cd) { return cd; @@ -2601,21 +2597,21 @@ static const MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString & { if (name.isEmpty()) return 0; struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - DBG_CTX((stderr,"setCallContextForVar(%s) yyextra->classScope=%s\n",name.data(),yyextra->classScope.data())); + DBG_CTX((stderr,"setCallContextForVar(%s) yyextra->classScope=%s\n",qPrint(name),qPrint(yyextra->classScope))); int scopeEnd = name.findRev("::"); if (scopeEnd!=-1) // name with explicit scope { QCString scope = name.left(scopeEnd); QCString locName = name.right(name.length()-scopeEnd-2); - DBG_CTX((stderr,"explicit scope: name=%s scope=%s\n",locName.data(),scope.data())); + DBG_CTX((stderr,"explicit scope: name=%s scope=%s\n",qPrint(locName),qPrint(scope))); const ClassDef *mcd = getClass(scope); if (mcd && !locName.isEmpty()) { const MemberDef *md=mcd->getMemberByName(locName); if (md) { - DBG_CTX((stderr,"name=%s scope=%s\n",locName.data(),scope.data())); + DBG_CTX((stderr,"name=%s scope=%s\n",qPrint(locName),qPrint(scope))); yyextra->theCallContext.setScope(ScopedTypeVariant(stripClassName(yyscanner,md->typeString(),md->getOuterScope()))); return md; } @@ -2628,7 +2624,7 @@ static const MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString & const MemberDef *md=mnd->getMemberByName(locName); if (md) { - DBG_CTX((stderr,"name=%s scope=%s\n",locName.data(),scope.data())); + DBG_CTX((stderr,"name=%s scope=%s\n",qPrint(locName),qPrint(scope))); yyextra->theCallContext.setScope(ScopedTypeVariant(stripClassName(yyscanner,md->typeString(),md->getOuterScope()))); return md; } @@ -2643,25 +2639,25 @@ static const MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString & DBG_CTX((stderr,"local variable?\n")); if (mcv->type()!=ScopedTypeVariant::Dummy) // locally found variable { - DBG_CTX((stderr,"local var '%s' mcd=%s\n",name.data(),mcv->name().data())); + DBG_CTX((stderr,"local var '%s' mcd=%s\n",qPrint(name),qPrint(mcv->name()))); yyextra->theCallContext.setScope(*mcv); } } else { - DBG_CTX((stderr,"class member? scope=%s\n",yyextra->classScope.data())); + DBG_CTX((stderr,"class member? scope=%s\n",qPrint(yyextra->classScope))); // look for a class member const ClassDef *mcd = getClass(yyextra->classScope); if (mcd) { - DBG_CTX((stderr,"Inside class %s\n",mcd->name().data())); + DBG_CTX((stderr,"Inside class %s\n",qPrint(mcd->name()))); const MemberDef *md=mcd->getMemberByName(name); if (md) { - DBG_CTX((stderr,"Found member %s\n",md->name().data())); + DBG_CTX((stderr,"Found member %s\n",qPrint(md->name()))); if (yyextra->scopeStack.empty() || yyextra->scopeStack.top()!=CLASSBLOCK) { - DBG_CTX((stderr,"class member '%s' mcd=%s\n",name.data(),mcd->name().data())); + DBG_CTX((stderr,"class member '%s' mcd=%s\n",qPrint(name),qPrint(mcd->name()))); yyextra->theCallContext.setScope(ScopedTypeVariant(stripClassName(yyscanner,md->typeString(),md->getOuterScope()))); } return md; @@ -2672,7 +2668,7 @@ static const MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString & // look for a global member if ((mn=Doxygen::functionNameLinkedMap->find(name))) { - DBG_CTX((stderr,"global var '%s'\n",name.data())); + DBG_CTX((stderr,"global var '%s'\n",qPrint(name))); if (mn->size()==1) // global defined only once { const std::unique_ptr<MemberDef> &md=mn->front(); @@ -2697,7 +2693,7 @@ static const MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString & if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef) { yyextra->theCallContext.setScope(ScopedTypeVariant(stripClassName(yyscanner,md->typeString(),md->getOuterScope()))); - DBG_CTX((stderr,"returning member %s in source file %s\n",md->name().data(),yyextra->sourceFileDef->name().data())); + DBG_CTX((stderr,"returning member %s in source file %s\n",qPrint(md->name()),qPrint(yyextra->sourceFileDef->name()))); return md.get(); } } @@ -2711,7 +2707,7 @@ static void updateCallContextForSmartPointer(yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; const Definition *d = yyextra->theCallContext.getScope().globalDef(); - //printf("updateCallContextForSmartPointer() cd=%s\n",cd ? d->name().data() : "<none>"); + //printf("updateCallContextForSmartPointer() cd=%s\n",cd ? qPrint(d->name()) : "<none>"); const MemberDef *md; if (d && d->definitionType()==Definition::TypeClass && (md=(toClassDef(d))->isSmartPointer())) { @@ -2719,7 +2715,7 @@ static void updateCallContextForSmartPointer(yyscan_t yyscanner) if (ncd) { yyextra->theCallContext.setScope(ScopedTypeVariant(ncd)); - //printf("Found smart pointer call %s->%s!\n",cd->name().data(),ncd->name().data()); + //printf("Found smart pointer call %s->%s!\n",qPrint(cd->name()),qPrint(ncd->name())); } } } @@ -2727,9 +2723,9 @@ static void updateCallContextForSmartPointer(yyscan_t yyscanner) static bool getLinkInScope(yyscan_t yyscanner, const QCString &c, // scope const QCString &m, // member - const char *memberText, // exact text + const QCString &memberText, // exact text CodeOutputInterface &ol, - const char *text, + const QCString &text, bool varOnly ) { @@ -2739,20 +2735,20 @@ static bool getLinkInScope(yyscan_t yyscanner, const FileDef *fd = 0; const NamespaceDef *nd = 0; const GroupDef *gd = 0; - DBG_CTX((stderr,"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",c.data(),m.data(),varOnly)); + DBG_CTX((stderr,"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",qPrint(c),qPrint(m),varOnly)); if (getDefs(c,m,"()",md,cd,fd,nd,gd,FALSE,yyextra->sourceFileDef,FALSE) && (!varOnly || md->isVariable())) { if (md->isLinkable()) { - DBG_CTX((stderr,"found it %s!\n",md->qualifiedName().data())); + DBG_CTX((stderr,"found it %s!\n",qPrint(md->qualifiedName()))); if (yyextra->exampleBlock) { std::lock_guard<std::mutex> lock(g_addExampleMutex); QCString anchor; anchor.sprintf("a%d",yyextra->anchorCount); - DBG_CTX((stderr,"addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(), - yyextra->exampleFile.data())); + DBG_CTX((stderr,"addExampleFile(%s,%s,%s)\n",qPrint(anchor),qPrint(yyextra->exampleName), + qPrint(yyextra->exampleFile))); MemberDefMutable *mdm = toMemberDefMutable(md); if (mdm && mdm->addExample(anchor,yyextra->exampleName,yyextra->exampleFile)) { @@ -2768,7 +2764,7 @@ static bool getLinkInScope(yyscan_t yyscanner, { yyextra->theCallContext.setScope(ScopedTypeVariant(stripClassName(yyscanner,md->typeString(),md->getOuterScope()))); DBG_CTX((stderr,"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p yyextra->insideBody=%d\n", - yyextra->currentDefinition,yyextra->currentMemberDef,yyextra->insideBody)); + (void*)yyextra->currentDefinition,(void*)yyextra->currentMemberDef,yyextra->insideBody)); if (yyextra->currentDefinition && yyextra->currentMemberDef && md!=yyextra->currentMemberDef && yyextra->insideBody && yyextra->collectXRefs) @@ -2776,17 +2772,17 @@ static bool getLinkInScope(yyscan_t yyscanner, std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex); addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md)); } - DBG_CTX((stderr,"d->getReference()='%s' d->getOutputBase()='%s' name='%s' member name='%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data())); + DBG_CTX((stderr,"d->getReference()='%s' d->getOutputBase()='%s' name='%s' member name='%s'\n",qPrint(d->getReference()),qPrint(d->getOutputFileBase()),qPrint(d->name()),qPrint(md->name()))); - writeMultiLineCodeLink(yyscanner,ol,md, text ? text : memberText); - addToSearchIndex(yyscanner,text ? text : memberText); + writeMultiLineCodeLink(yyscanner,ol,md, !text.isEmpty() ? text : memberText); + addToSearchIndex(yyscanner,!text.isEmpty() ? text : memberText); return TRUE; } } else // found member, but it is not linkable, so make sure content inside is not assigned // to the previous member, see bug762760 { - DBG_CTX((stderr,"unlinkable member %s\n",md->name().data())); + DBG_CTX((stderr,"unlinkable member %s\n",qPrint(md->name()))); yyextra->currentMemberDef = 0; } } @@ -2794,14 +2790,15 @@ static bool getLinkInScope(yyscan_t yyscanner, } static bool getLink(yyscan_t yyscanner, - const char *className, - const char *memberName, + const QCString &className, + const QCString &memberName, CodeOutputInterface &ol, - const char *text, + const QCString &text, bool varOnly) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - DBG_CTX((stderr,"getLink(%s,%s) yyextra->curClassName=%s\n",className,memberName,yyextra->curClassName.data())); + DBG_CTX((stderr,"getLink(%s,%s) yyextra->curClassName=%s\n", + qPrint(className),qPrint(memberName),qPrint(yyextra->curClassName))); QCString m=removeRedundantWhiteSpace(memberName); QCString c=className; if (!getLinkInScope(yyscanner,c,m,memberName,ol,text,varOnly)) @@ -2819,18 +2816,18 @@ static bool getLink(yyscan_t yyscanner, static void generateClassOrGlobalLink(yyscan_t yyscanner, CodeOutputInterface &ol, - const char *clName, + const QCString &clName, bool typeOnly, bool varOnly) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; int i=0; - if (*clName=='~') // correct for matching negated values i.s.o. destructors. + QCString className=clName; + if (!className.isEmpty() && className[0]=='~') // correct for matching negated values i.s.o. destructors. { yyextra->code->codify("~"); - clName++; + className=className.mid(1); } - QCString className=clName; if (className.isEmpty()) return; if (yyextra->insideProtocolList) // for Obj-C { @@ -2849,20 +2846,22 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner, const MemberDef *md=0; bool isLocal=FALSE; - DBG_CTX((stderr,"generateClassOrGlobalLink(className=%s)\n",className.data())); + DBG_CTX((stderr,"generateClassOrGlobalLink(className=%s)\n",qPrint(className))); if (!yyextra->isPrefixedWithThis || (lcd=yyextra->theVarContext.findVariable(className))==0) // not a local variable { const Definition *d = yyextra->currentDefinition; - DBG_CTX((stderr,"d=%s yyextra->sourceFileDef=%s\n",d?d->name().data():"<none>",yyextra->sourceFileDef?yyextra->sourceFileDef->name().data():"<none>")); + DBG_CTX((stderr,"d=%s yyextra->sourceFileDef=%s\n",d?qPrint(d->name()):"<none>",yyextra->sourceFileDef?qPrint(yyextra->sourceFileDef->name()):"<none>")); cd = yyextra->symbolResolver.resolveClass(d,className); md = yyextra->symbolResolver.getTypedef(); DBG_CTX((stderr,"non-local variable name=%s cd=%s md=%s!\n", - className.data(),cd?cd->name().data():"<none>", - md?md->name().data():"<none>")); - if (cd==0 && md==0 && (i=className.find('<'))!=-1) + qPrint(className),cd?qPrint(cd->name()):"<none>", + md?qPrint(md->name()):"<none>")); + i=className.find('<'); + QCString bareName = className; + if (i!=-1) bareName = bareName.left(i); + if (cd==0 && md==0 && i!=-1) { - QCString bareName = className.left(i); //stripTemplateSpecifiersFromScope(className); - DBG_CTX((stderr,"bareName=%s\n",bareName.data())); + DBG_CTX((stderr,"bareName=%s\n",qPrint(bareName))); if (bareName!=className) { cd = yyextra->symbolResolver.resolveClass(d,bareName); // try unspecialized version @@ -2877,10 +2876,18 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner, writeMultiLineCodeLink(yyscanner,*yyextra->code,nd,clName); return; } - DBG_CTX((stderr,"md=%s\n",md?md->name().data():"<none>")); + const ConceptDef *conceptDef = getResolvedConcept(d,bareName); + if (conceptDef && conceptDef->isLinkable()) + { + yyextra->theCallContext.setScope(ScopedTypeVariant(conceptDef)); + addToSearchIndex(yyscanner,className); + writeMultiLineCodeLink(yyscanner,*yyextra->code,conceptDef,clName); + return; + } + DBG_CTX((stderr,"md=%s\n",md?qPrint(md->name()):"<none>")); DBG_CTX((stderr,"is found as a type cd=%s nd=%s\n", - cd?cd->name().data():"<null>", - nd?nd->name().data():"<null>")); + cd?qPrint(cd->name()):"<null>", + nd?qPrint(nd->name()):"<null>")); if (cd==0 && md==0) // also see if it is variable or enum or enum value { if (getLink(yyscanner,yyextra->classScope,clName,ol,clName,varOnly)) @@ -2894,7 +2901,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner, DBG_CTX((stderr,"local variable!\n")); if (lcd->type()!=ScopedTypeVariant::Dummy) { - DBG_CTX((stderr,"non-dummy context lcd=%s!\n",lcd->name().data())); + DBG_CTX((stderr,"non-dummy context lcd=%s!\n",qPrint(lcd->name()))); yyextra->theCallContext.setScope(*lcd); // to following is needed for links to a global variable, but is @@ -2906,20 +2913,20 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner, //} } isLocal=TRUE; - DBG_CTX((stderr,"is a local variable cd=%p!\n",cd)); + DBG_CTX((stderr,"is a local variable cd=%p!\n",(void*)cd)); } yyextra->isPrefixedWithThis = FALSE; // discard the "this" prefix for the next calls if (cd && cd->isLinkable()) // is it a linkable class { - DBG_CTX((stderr,"is linkable class %s\n",clName)); + DBG_CTX((stderr,"is linkable class %s\n",qPrint(clName))); if (yyextra->exampleBlock) { std::lock_guard<std::mutex> lock(g_addExampleMutex); QCString anchor; anchor.sprintf("_a%d",yyextra->anchorCount); - DBG_CTX((stderr,"addExampleClass(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(), - yyextra->exampleFile.data())); + DBG_CTX((stderr,"addExampleClass(%s,%s,%s)\n",qPrint(anchor),qPrint(yyextra->exampleName), + qPrint(yyextra->exampleFile))); ClassDefMutable *cdm = toClassDefMutable(const_cast<ClassDef*>(cd)); if (cdm && cdm->addExample(anchor,yyextra->exampleName,yyextra->exampleFile)) { @@ -2945,19 +2952,19 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner, } else // not a class, maybe a global member { - DBG_CTX((stderr,"class %s not linkable! cd=%p md=%p typeOnly=%d\n",clName,cd,md,typeOnly)); + DBG_CTX((stderr,"class %s not linkable! cd=%p md=%p typeOnly=%d\n",qPrint(clName),(void*)cd,(void*)md,typeOnly)); if (!isLocal && (md!=0 || (cd==0 && !typeOnly))) // not a class, see if it is a global enum/variable/typedef. { if (md==0) // not found as a typedef { md = setCallContextForVar(yyscanner,clName); - DBG_CTX((stderr,"setCallContextForVar(%s) md=%p yyextra->currentDefinition=%p\n",clName,md,yyextra->currentDefinition)); + DBG_CTX((stderr,"setCallContextForVar(%s) md=%p yyextra->currentDefinition=%p\n",qPrint(clName),(void*)md,(void*)yyextra->currentDefinition)); if (md && yyextra->currentDefinition) { DBG_CTX((stderr,"%s accessible from %s? %d md->getOuterScope=%s\n", - md->name().data(),yyextra->currentDefinition->name().data(), + qPrint(md->name()),qPrint(yyextra->currentDefinition->name()), yyextra->symbolResolver.isAccessibleFrom(yyextra->currentDefinition,md), - md->getOuterScope()->name().data())); + qPrint(md->getOuterScope()->name()))); } if (md && yyextra->currentDefinition && @@ -2968,7 +2975,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner, } if (md && (!varOnly || md->isVariable())) { - DBG_CTX((stderr,"is a global md=%p yyextra->currentDefinition=%s linkable=%d\n",md,yyextra->currentDefinition?yyextra->currentDefinition->name().data():"<none>",md->isLinkable())); + DBG_CTX((stderr,"is a global md=%p yyextra->currentDefinition=%s linkable=%d\n",(void*)md,yyextra->currentDefinition?qPrint(yyextra->currentDefinition->name()):"<none>",md->isLinkable())); if (md->isLinkable()) { QCString text=clName; @@ -2991,26 +2998,32 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner, } } +static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *clName, + bool typeOnly,bool varOnly) +{ + generateClassOrGlobalLink(yyscanner,ol,QCString(clName),typeOnly,varOnly); +} + static bool generateClassMemberLink(yyscan_t yyscanner, CodeOutputInterface &ol, const MemberDef *xmd, - const char *memName) + const QCString &memName) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; // extract class definition of the return type in order to resolve // a->b()->c() like call chains DBG_CTX((stderr,"type='%s' args='%s' class=%s\n", - xmd->typeString(),xmd->argsString(), - xmd->getClassDef()->name().data())); + qPrint(xmd->typeString()),qPrint(xmd->argsString()), + qPrint(xmd->getClassDef()->name()))); if (yyextra->exampleBlock) { std::lock_guard<std::mutex> lock(g_addExampleMutex); QCString anchor; anchor.sprintf("a%d",yyextra->anchorCount); - DBG_CTX((stderr,"addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(), - yyextra->exampleFile.data())); + DBG_CTX((stderr,"addExampleFile(%s,%s,%s)\n",qPrint(anchor),qPrint(yyextra->exampleName), + qPrint(yyextra->exampleFile))); MemberDefMutable *mdm = toMemberDefMutable(xmd); if (mdm && mdm->addExample(anchor,yyextra->exampleName,yyextra->exampleFile)) { @@ -3020,7 +3033,7 @@ static bool generateClassMemberLink(yyscan_t yyscanner, } const ClassDef *typeClass = stripClassName(yyscanner,removeAnonymousScopes(xmd->typeString()),xmd->getOuterScope()); - DBG_CTX((stderr,"%s -> typeName=%p\n",xmd->typeString(),typeClass)); + DBG_CTX((stderr,"%s -> typeName=%p\n",qPrint(xmd->typeString()),(void*)typeClass)); yyextra->theCallContext.setScope(ScopedTypeVariant(typeClass)); const Definition *xd = xmd->getOuterScope()==Doxygen::globalScope ? @@ -3029,7 +3042,8 @@ static bool generateClassMemberLink(yyscan_t yyscanner, if (xd && xd->isLinkable()) { - DBG_CTX((stderr,"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p xmd=%p yyextra->insideBody=%d\n",yyextra->currentDefinition,yyextra->currentMemberDef,xmd,yyextra->insideBody)); + DBG_CTX((stderr,"yyextra->currentDefinition=%p yyextra->currentMemberDef=%p xmd=%p yyextra->insideBody=%d\n", + (void*)yyextra->currentDefinition,(void*)yyextra->currentMemberDef,(void*)xmd,yyextra->insideBody)); if (xmd->templateMaster()) xmd = xmd->templateMaster(); @@ -3056,14 +3070,14 @@ static bool generateClassMemberLink(yyscan_t yyscanner, static bool generateClassMemberLink(yyscan_t yyscanner, CodeOutputInterface &ol, const Definition *def, - const char *memName) + const QCString &memName) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (def && def->definitionType()==Definition::TypeClass) { const ClassDef *cd = toClassDef(def); const MemberDef *xmd = cd->getMemberByName(memName); - DBG_CTX((stderr,"generateClassMemberLink(class=%s,member=%s)=%p\n",def->name().data(),memName,xmd)); + DBG_CTX((stderr,"generateClassMemberLink(class=%s,member=%s)=%p\n",qPrint(def->name()),qPrint(memName),(void*)xmd)); if (xmd) { return generateClassMemberLink(yyscanner,ol,xmd,memName); @@ -3083,7 +3097,7 @@ static bool generateClassMemberLink(yyscan_t yyscanner, else if (def && def->definitionType()==Definition::TypeNamespace) { const NamespaceDef *nd = toNamespaceDef(def); - DBG_CTX((stderr,"Looking for %s inside namespace %s\n",memName,nd->name().data())); + DBG_CTX((stderr,"Looking for %s inside namespace %s\n",qPrint(memName),qPrint(nd->name()))); const Definition *innerDef = nd->findInnerCompound(memName); if (innerDef) { @@ -3099,11 +3113,11 @@ static bool generateClassMemberLink(yyscan_t yyscanner, static void generateMemberLink(yyscan_t yyscanner, CodeOutputInterface &ol, const QCString &varName, - const char *memName) + const QCString &memName) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; DBG_CTX((stderr,"generateMemberLink(object=%s,mem=%s) classScope=%s\n", - varName.data(),memName,yyextra->classScope.data())); + qPrint(varName),qPrint(memName),qPrint(yyextra->classScope))); if (varName.isEmpty()) return; @@ -3137,7 +3151,7 @@ static void generateMemberLink(yyscan_t yyscanner, const ClassDef *vcd = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->classScope); if (vcd && vcd->isLinkable()) { - DBG_CTX((stderr,"Found class %s for variable '%s'\n",yyextra->classScope.data(),varName.data())); + DBG_CTX((stderr,"Found class %s for variable '%s'\n",qPrint(yyextra->classScope),qPrint(varName))); MemberName *vmn=Doxygen::memberNameLinkedMap->find(varName); if (vmn==0) { @@ -3148,14 +3162,14 @@ static void generateMemberLink(yyscan_t yyscanner, const ClassDef *jcd = getClass(vn.left(vi)); vn=vn.right(vn.length()-vi-2); vmn=Doxygen::memberNameLinkedMap->find(vn); - //printf("Trying name '%s' scope=%s\n",vn.data(),scope.data()); + //printf("Trying name '%s' scope=%s\n",qPrint(vn),qPrint(scope)); if (vmn) { for (const auto &vmd : *vmn) { if (vmd->getClassDef()==jcd) { - DBG_CTX((stderr,"Found variable type=%s\n",vmd->typeString())); + DBG_CTX((stderr,"Found variable type=%s\n",qPrint(vmd->typeString()))); const ClassDef *mcd=stripClassName(yyscanner,vmd->typeString(),vmd->getOuterScope()); if (mcd && mcd->isLinkable()) { @@ -3168,12 +3182,12 @@ static void generateMemberLink(yyscan_t yyscanner, } if (vmn) { - DBG_CTX((stderr,"There is a variable with name '%s'\n",varName)); + DBG_CTX((stderr,"There is a variable with name '%s'\n",qPrint(varName))); for (const auto &vmd : *vmn) { if (vmd->getClassDef()==vcd) { - DBG_CTX((stderr,"Found variable type=%s\n",vmd->typeString())); + DBG_CTX((stderr,"Found variable type=%s\n",qPrint(vmd->typeString()))); const ClassDef *mcd=stripClassName(yyscanner,vmd->typeString(),vmd->getOuterScope()); if (mcd && mcd->isLinkable()) { @@ -3193,16 +3207,16 @@ static void generateMemberLink(yyscan_t yyscanner, static void generatePHPVariableLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *varName) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - QCString name = varName+7; // strip $this-> + QCString name(varName+7); // strip $this-> name.prepend("$"); - DBG_CTX((stderr,"generatePHPVariableLink(%s) name=%s scope=%s\n",varName,name.data(),yyextra->classScope.data())); - if (!getLink(yyscanner,yyextra->classScope,name,ol,varName)) + DBG_CTX((stderr,"generatePHPVariableLink(%s) name=%s scope=%s\n",varName,qPrint(name),qPrint(yyextra->classScope))); + if (!getLink(yyscanner,yyextra->classScope,name,ol,QCString(varName))) { codifyLines(yyscanner,varName); } } -static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *funcName) +static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,const QCString &funcName) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //CodeClassDef *ccd=0; @@ -3213,7 +3227,7 @@ static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,cons QCString funcWithScope=locFunc; QCString funcWithFullScope=locFunc; QCString fullScope=locScope; - DBG_CTX((stdout,"*** locScope=%s locFunc=%s\n",locScope.data(),locFunc.data())); + DBG_CTX((stdout,"*** locScope=%s locFunc=%s\n",qPrint(locScope),qPrint(locFunc))); int len=2; int i=locFunc.findRev("::"); if (yyextra->currentMemberDef && yyextra->currentMemberDef->resolveAlias()->getClassDef() && @@ -3311,6 +3325,11 @@ exit: return; } +static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *funcName) +{ + generateFunctionLink(yyscanner,ol,QCString(funcName)); +} + /*! counts the number of lines in the input */ static int countLines(yyscan_t yyscanner) { @@ -3346,7 +3365,7 @@ static void startFontClass(yyscan_t yyscanner,const char *s) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; endFontClass(yyscanner); - yyextra->code->startFontClass(s); + yyextra->code->startFontClass(QCString(s)); yyextra->currentFontClass=s; } @@ -3358,15 +3377,14 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx) if (ctx==0) return; struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; char c; - const char *p = ctx->format.data(); if (!ctx->methodName.isEmpty()) { DBG_CTX((stderr,"writeObjCMethodCall(%s) obj=%s method=%s\n", - ctx->format.data(),ctx->objectTypeOrName.data(),ctx->methodName.data())); + qPrint(ctx->format),qPrint(ctx->objectTypeOrName),qPrint(ctx->methodName))); if (!ctx->objectTypeOrName.isEmpty() && ctx->objectTypeOrName.at(0)!='$') { - DBG_CTX((stderr,"Looking for object=%s method=%s\n",ctx->objectTypeOrName.data(), - ctx->methodName.data())); + DBG_CTX((stderr,"Looking for object=%s method=%s\n",qPrint(ctx->objectTypeOrName), + qPrint(ctx->methodName))); const ScopedTypeVariant *stv = yyextra->theVarContext.findVariable(ctx->objectTypeOrName); if (stv==0) // not a local variable { @@ -3383,29 +3401,29 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx) ctx->objectType = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,ctx->objectTypeOrName); ctx->method = yyextra->symbolResolver.getTypedef(); } - DBG_CTX((stderr," object is class? %p\n",ctx->objectType)); + DBG_CTX((stderr," object is class? %p\n",(void*)ctx->objectType)); if (ctx->objectType) // found class { ctx->method = ctx->objectType->getMemberByName(ctx->methodName); - DBG_CTX((stderr," yes->method=%s\n",ctx->method?ctx->method->name().data():"<none>")); + DBG_CTX((stderr," yes->method=%s\n",ctx->method?qPrint(ctx->method->name()):"<none>")); } else if (ctx->method==0) // search for class variable with the same name { DBG_CTX((stderr," no\n")); - DBG_CTX((stderr,"yyextra->currentDefinition=%p\n",yyextra->currentDefinition)); + DBG_CTX((stderr,"yyextra->currentDefinition=%p\n",(void*)yyextra->currentDefinition)); if (yyextra->currentDefinition && yyextra->currentDefinition->definitionType()==Definition::TypeClass) { ctx->objectVar = (toClassDef(yyextra->currentDefinition))->getMemberByName(ctx->objectTypeOrName); - DBG_CTX((stderr," ctx->objectVar=%p\n",ctx->objectVar)); + DBG_CTX((stderr," ctx->objectVar=%p\n",(void*)ctx->objectVar)); if (ctx->objectVar) { ctx->objectType = stripClassName(yyscanner,ctx->objectVar->typeString(),yyextra->currentDefinition); - DBG_CTX((stderr," ctx->objectType=%p\n",ctx->objectType)); + DBG_CTX((stderr," ctx->objectType=%p\n",(void*)ctx->objectType)); if (ctx->objectType && !ctx->methodName.isEmpty()) { ctx->method = ctx->objectType->getMemberByName(ctx->methodName); - DBG_CTX((stderr," ctx->method=%p\n",ctx->method)); + DBG_CTX((stderr," ctx->method=%p\n",(void*)ctx->method)); } } } @@ -3421,236 +3439,240 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx) { ctx->method = cd->getMemberByName(ctx->methodName); } - DBG_CTX((stderr," class=%p method=%p\n",cd,ctx->method)); + DBG_CTX((stderr," class=%p method=%p\n",(void*)cd,(void*)ctx->method)); } } } } DBG_CTX((stderr,"[")); - while ((c=*p++)) // for each character in ctx->format + if (!ctx->format.isEmpty()) { - if (c=='$') + const char *p = ctx->format.data(); + while ((c=*p++)) // for each character in ctx->format { - char nc=*p++; - if (nc=='$') // escaped $ + if (c=='$') { - yyextra->code->codify("$"); - } - else // name fragment or reference to a nested call - { - if (nc=='n') // name fragment + char nc=*p++; + if (nc=='$') // escaped $ + { + yyextra->code->codify("$"); + } + else // name fragment or reference to a nested call { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - auto it = yyextra->nameMap.find(refId); - if (it!=yyextra->nameMap.end()) + if (nc=='n') // name fragment { - QCString name = it->second; - if (ctx->method && ctx->method->isLinkable()) + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + auto it = yyextra->nameMap.find(refId); + if (it!=yyextra->nameMap.end()) { - writeMultiLineCodeLink(yyscanner,*yyextra->code,ctx->method,name); - if (yyextra->currentMemberDef && yyextra->collectXRefs) + QCString name = it->second; + if (ctx->method && ctx->method->isLinkable()) + { + writeMultiLineCodeLink(yyscanner,*yyextra->code,ctx->method,name); + if (yyextra->currentMemberDef && yyextra->collectXRefs) + { + std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex); + addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(ctx->method)); + } + } + else { - std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex); - addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(ctx->method)); + codifyLines(yyscanner,name); } } else { - codifyLines(yyscanner,name); + DBG_CTX((stderr,"Invalid name: id=%d\n",refId)); } } - else + else if (nc=='o') // reference to potential object name { - DBG_CTX((stderr,"Invalid name: id=%d\n",refId)); - } - } - else if (nc=='o') // reference to potential object name - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - auto it = yyextra->objectMap.find(refId); - if (it!=yyextra->objectMap.end()) - { - QCString object = it->second; - if (object=="self") + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + auto it = yyextra->objectMap.find(refId); + if (it!=yyextra->objectMap.end()) { - if (yyextra->currentDefinition && - yyextra->currentDefinition->definitionType()==Definition::TypeClass) + QCString object = it->second; + if (object=="self") { - ctx->objectType = toClassDef(yyextra->currentDefinition); - if (ctx->objectType->categoryOf()) + if (yyextra->currentDefinition && + yyextra->currentDefinition->definitionType()==Definition::TypeClass) { - ctx->objectType = ctx->objectType->categoryOf(); - } - if (ctx->objectType && !ctx->methodName.isEmpty()) - { - ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + ctx->objectType = toClassDef(yyextra->currentDefinition); + if (ctx->objectType->categoryOf()) + { + ctx->objectType = ctx->objectType->categoryOf(); + } + if (ctx->objectType && !ctx->methodName.isEmpty()) + { + ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + } } + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,object); + endFontClass(yyscanner); } - startFontClass(yyscanner,"keyword"); - codifyLines(yyscanner,object); - endFontClass(yyscanner); - } - else if (object=="super") - { - if (yyextra->currentDefinition && - yyextra->currentDefinition->definitionType()==Definition::TypeClass) + else if (object=="super") { - const ClassDef *cd = toClassDef(yyextra->currentDefinition); - if (cd->categoryOf()) - { - cd = cd->categoryOf(); - } - for (const auto &bclass : cd->baseClasses()) + if (yyextra->currentDefinition && + yyextra->currentDefinition->definitionType()==Definition::TypeClass) { - if (bclass.classDef->compoundType()!=ClassDef::Protocol) + const ClassDef *cd = toClassDef(yyextra->currentDefinition); + if (cd->categoryOf()) { - ctx->objectType = bclass.classDef; - if (ctx->objectType && !ctx->methodName.isEmpty()) + cd = cd->categoryOf(); + } + for (const auto &bclass : cd->baseClasses()) + { + if (bclass.classDef->compoundType()!=ClassDef::Protocol) { - ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + ctx->objectType = bclass.classDef; + if (ctx->objectType && !ctx->methodName.isEmpty()) + { + ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + } } } } + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,object); + endFontClass(yyscanner); } - startFontClass(yyscanner,"keyword"); - codifyLines(yyscanner,object); - endFontClass(yyscanner); - } - else if (ctx->objectVar && ctx->objectVar->isLinkable()) // object is class variable - { - writeMultiLineCodeLink(yyscanner,*yyextra->code,ctx->objectVar,object); - if (yyextra->currentMemberDef && yyextra->collectXRefs) + else if (ctx->objectVar && ctx->objectVar->isLinkable()) // object is class variable { - std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex); - addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(ctx->objectVar)); + writeMultiLineCodeLink(yyscanner,*yyextra->code,ctx->objectVar,object); + if (yyextra->currentMemberDef && yyextra->collectXRefs) + { + std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex); + addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(ctx->objectVar)); + } } - } - else if (ctx->objectType && - ctx->objectType->isLinkable() - ) // object is class name - { - const ClassDef *cd = ctx->objectType; - writeMultiLineCodeLink(yyscanner,*yyextra->code,cd,object); - } - else // object still needs to be resolved - { - const ClassDef *cd = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition, object); - if (cd && cd->isLinkable()) + else if (ctx->objectType && + ctx->objectType->isLinkable() + ) // object is class name { - if (ctx->objectType==0) ctx->objectType=cd; + const ClassDef *cd = ctx->objectType; writeMultiLineCodeLink(yyscanner,*yyextra->code,cd,object); } - else + else // object still needs to be resolved { - codifyLines(yyscanner,object); + const ClassDef *cd = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition, object); + if (cd && cd->isLinkable()) + { + if (ctx->objectType==0) ctx->objectType=cd; + writeMultiLineCodeLink(yyscanner,*yyextra->code,cd,object); + } + else + { + codifyLines(yyscanner,object); + } } } + else + { + DBG_CTX((stderr,"Invalid object: id=%d\n",refId)); + } } - else + else if (nc=='c') // reference to nested call { - DBG_CTX((stderr,"Invalid object: id=%d\n",refId)); - } - } - else if (nc=='c') // reference to nested call - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - auto it = yyextra->contextMap.find(refId); - if (it!=yyextra->contextMap.end()) // recurse into nested call - { - ObjCCallCtx *ictx = it->second.get(); - writeObjCMethodCall(yyscanner,ictx); - if (ictx->method) // link to nested call successfully + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + auto it = yyextra->contextMap.find(refId); + if (it!=yyextra->contextMap.end()) // recurse into nested call { - // get the ClassDef representing the method's return type - if (QCString(ictx->method->typeString())=="id") + ObjCCallCtx *ictx = it->second.get(); + writeObjCMethodCall(yyscanner,ictx); + if (ictx->method) // link to nested call successfully { - // see if the method name is unique, if so we link to it - MemberName *mn=Doxygen::memberNameLinkedMap->find(ctx->methodName); - //printf("mn->count=%d ictx->method=%s ctx->methodName=%s\n", - // mn==0?-1:(int)mn->count(), - // ictx->method->name().data(), - // ctx->methodName.data()); - if (mn && mn->size()==1) // member name unique + // get the ClassDef representing the method's return type + if (QCString(ictx->method->typeString())=="id") { - ctx->method = mn->front().get(); + // see if the method name is unique, if so we link to it + MemberName *mn=Doxygen::memberNameLinkedMap->find(ctx->methodName); + //printf("mn->count=%d ictx->method=%s ctx->methodName=%s\n", + // mn==0?-1:(int)mn->count(), + // qPrint(ictx->method->name()), + // qPrint(ctx->methodName)); + if (mn && mn->size()==1) // member name unique + { + ctx->method = mn->front().get(); + } } - } - else - { - ctx->objectType = stripClassName(yyscanner,ictx->method->typeString(),yyextra->currentDefinition); - if (ctx->objectType && !ctx->methodName.isEmpty()) + else { - ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + ctx->objectType = stripClassName(yyscanner,ictx->method->typeString(),yyextra->currentDefinition); + if (ctx->objectType && !ctx->methodName.isEmpty()) + { + ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + } } + DBG_CTX((stderr," ***** method=%s -> object=%p\n",qPrint(ictx->method->name()),(void*)ctx->objectType)); } - DBG_CTX((stderr," ***** method=%s -> object=%p\n",ictx->method->name().data(),ctx->objectType)); + } + else + { + DBG_CTX((stderr,"Invalid context: id=%d\n",refId)); } } - else + else if (nc=='w') // some word { - DBG_CTX((stderr,"Invalid context: id=%d\n",refId)); + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + auto it = yyextra->wordMap.find(refId); + if (it!=yyextra->wordMap.end()) + { + QCString word = it->second; + codifyLines(yyscanner,word); + } } - } - else if (nc=='w') // some word - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - auto it = yyextra->wordMap.find(refId); - if (it!=yyextra->wordMap.end()) + else if (nc=='d') // comment block { - QCString word = it->second; - codifyLines(yyscanner,word); + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + auto it = yyextra->commentMap.find(refId); + if (it!=yyextra->commentMap.end()) + { + QCString comment = it->second; + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,comment); + endFontClass(yyscanner); + } } - } - else if (nc=='d') // comment block - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - auto it = yyextra->commentMap.find(refId); - if (it!=yyextra->commentMap.end()) + else // illegal marker { - QCString comment = it->second; - startFontClass(yyscanner,"comment"); - codifyLines(yyscanner,comment); - endFontClass(yyscanner); + ASSERT("invalid escape sequence"==0); } } - else // illegal marker - { - ASSERT("invalid escape sequence"==0); - } } - } - else // normal non-marker character - { - char s[2]; - s[0]=c;s[1]=0; - codifyLines(yyscanner,s); + else // normal non-marker character + { + char s[2]; + s[0]=c;s[1]=0; + codifyLines(yyscanner,s); + } } } - DBG_CTX((stderr,"%s %s]\n",ctx->objectTypeOrName.data(),ctx->methodName.data())); + DBG_CTX((stderr,"%s %s]\n",qPrint(ctx->objectTypeOrName),qPrint(ctx->methodName))); DBG_CTX((stderr,"}=(type='%s',name='%s')", - ctx->objectTypeOrName.data(), - ctx->methodName.data())); + qPrint(ctx->objectTypeOrName), + qPrint(ctx->methodName))); } // Replaces an Objective-C method name fragment s by a marker of the form @@ -3696,14 +3718,16 @@ static QCString escapeComment(yyscan_t yyscanner,const char *s) return result; } -static bool skipLanguageSpecificKeyword(yyscan_t yyscanner,const QCString &kw) +static bool skipLanguageSpecificKeyword(yyscan_t yyscanner,const char *keyword) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + QCString kw(keyword); return yyextra->lang==SrcLangExt_Cpp && (kw == "remove" || kw == "set" || kw == "get"); } -static bool isCastKeyword(const QCString &s) +static bool isCastKeyword(const char *keyword) { + QCString s(keyword); int i=s.find('<'); if (i==-1) return FALSE; QCString kw = s.left(i).stripWhiteSpace(); @@ -3735,7 +3759,7 @@ static void saveObjCContext(yyscan_t yyscanner) if (yyextra->braceCount==0 && YY_START==ObjCCall) { yyextra->currentCtx->objectTypeOrName=yyextra->currentCtx->format.mid(1); - DBG_CTX((stderr,"new type=%s\n",yyextra->currentCtx->objectTypeOrName.data())); + DBG_CTX((stderr,"new type=%s\n",qPrint(yyextra->currentCtx->objectTypeOrName))); } yyextra->contextStack.push(yyextra->currentCtx); } @@ -3812,8 +3836,8 @@ void CCodeParser::setStartCodeLine(const bool inp) yyextra->beginCodeLine = inp; } -void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const QCString &s, - SrcLangExt lang,bool exBlock, const char *exName,FileDef *fd, +void CCodeParser::parseCode(CodeOutputInterface &od,const QCString &className,const QCString &s, + SrcLangExt lang,bool exBlock, const QCString &exName,FileDef *fd, int startLine,int endLine,bool inlineFragment, const MemberDef *memberDef,bool showLineNumbers,const Definition *searchCtx, bool collectXRefs) @@ -3821,14 +3845,14 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const yyscan_t yyscanner = p->yyscanner; struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; DBG_CTX((stderr,"***parseCode() exBlock=%d exName=%s fd=%p className=%s searchCtx=%s\n", - exBlock,exName,fd,className,searchCtx?searchCtx->name().data():"<none>")); + exBlock,qPrint(exName),(void*)fd,qPrint(className),searchCtx?qPrint(searchCtx->name()):"<none>")); if (s.isEmpty()) return; - printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL); + printlex(yy_flex_debug, TRUE, __FILE__, fd ? qPrint(fd->fileName()): NULL); yyextra->code = &od; - yyextra->inputString = s; + yyextra->inputString = s.data(); yyextra->inputPosition = 0; codeYYrestart(0,yyscanner); yyextra->currentFontClass = 0; @@ -3856,7 +3880,7 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const yyextra->theCallContext.clear(); while (!yyextra->scopeStack.empty()) yyextra->scopeStack.pop(); yyextra->classScope = className; - DBG_CTX((stderr,"parseCCode %s\n",className)); + DBG_CTX((stderr,"parseCCode %s\n",qPrint(className))); yyextra->exampleBlock = exBlock; yyextra->exampleName = exName; yyextra->sourceFileDef = fd; @@ -3865,7 +3889,7 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const if (fd==0) { // create a dummy filedef for the example - yyextra->sourceFileDef = createFileDef("",(exName?exName:"generated")); + yyextra->sourceFileDef = createFileDef(QCString(),(!exName.isEmpty()?exName:"generated")); cleanupSourceDef = TRUE; } yyextra->lang = lang; @@ -3874,7 +3898,7 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const { setCurrentDoc(yyscanner,"l00001"); } - yyextra->currentDefinition = 0; + yyextra->currentDefinition = getResolvedNamespace(className); yyextra->currentMemberDef = 0; yyextra->searchingForBody = exBlock; yyextra->insideBody = FALSE; @@ -3882,10 +3906,10 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const if (!yyextra->exampleName.isEmpty()) { yyextra->exampleFile = convertNameToFile(yyextra->exampleName+"-example",FALSE,TRUE); - DBG_CTX((stderr,"yyextra->exampleFile=%s\n",yyextra->exampleFile.data())); + DBG_CTX((stderr,"yyextra->exampleFile=%s\n",qPrint(yyextra->exampleFile))); } yyextra->includeCodeFragment = inlineFragment; - DBG_CTX((stderr,"** exBlock=%d exName=%s include=%d\n",exBlock,exName,inlineFragment)); + DBG_CTX((stderr,"** exBlock=%d exName=%s include=%d\n",exBlock,qPrint(exName),inlineFragment)); if (yyextra->beginCodeLine) startCodeLine(yyscanner); yyextra->type.resize(0); yyextra->name.resize(0); @@ -3911,7 +3935,7 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const // write the tooltips TooltipManager::instance().writeTooltips(od); - printlex(yy_flex_debug, FALSE, __FILE__, fd ? fd->fileName().data(): NULL); + printlex(yy_flex_debug, FALSE, __FILE__, fd ? qPrint(fd->fileName()): NULL); return; } diff --git a/src/commentcnv.h b/src/commentcnv.h index a45d29c..973a602 100644 --- a/src/commentcnv.h +++ b/src/commentcnv.h @@ -1,12 +1,12 @@ /***************************************************************************** * - * + * * * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -19,9 +19,10 @@ #define _COMMENTCNV_H class BufStr; +class QCString; extern void convertCppComments(BufStr *inBuf,BufStr *outBuf, - const char *fileName); + const QCString &fileName); #endif diff --git a/src/commentcnv.l b/src/commentcnv.l index 2d0a4aa..23611a9 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -108,10 +108,10 @@ static inline int computeIndent(const char *s); static void replaceCommentMarker(yyscan_t yyscanner,const char *s,int len); static inline void copyToOutput(yyscan_t yyscanner,const char *s,int len); -static void startCondSection(yyscan_t yyscanner,const char *sectId); +static void startCondSection(yyscan_t yyscanner,const QCString §Id); static void endCondSection(yyscan_t yyscanner); static void handleCondSectionId(yyscan_t yyscanner,const char *expression); -static void replaceAliases(yyscan_t yyscanner,const char *s); +static void replaceAliases(yyscan_t yyscanner,const QCString &s); static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); static void replaceComment(yyscan_t yyscanner,int offset); static void clearCommentStack(yyscan_t yyscanner); @@ -306,7 +306,7 @@ SLASHopt [/]* } yyextra->blockHeadCol=yyextra->col; copyToOutput(yyscanner,"/**",3); - replaceAliases(yyscanner,yytext+i); + replaceAliases(yyscanner,QCString(yytext+i)); yyextra->inSpecialComment=TRUE; //BEGIN(SComment); yyextra->readLineCtx=SComment; @@ -318,7 +318,7 @@ SLASHopt [/]* int i=17; //=strlen("//##Documentation"); yyextra->blockHeadCol=yyextra->col; copyToOutput(yyscanner,"/**",3); - replaceAliases(yyscanner,yytext+i); + replaceAliases(yyscanner,QCString(yytext+i)); yyextra->inRoseComment=TRUE; BEGIN(SComment); } @@ -873,7 +873,7 @@ SLASHopt [/]* if (*yytext=='\n') yyextra->lineNr++; } <CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9]* { // expand alias without arguments - replaceAliases(yyscanner,yytext); + replaceAliases(yyscanner,QCString(yytext)); } <CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9]*"{" { // expand alias with arguments yyextra->lastBlockContext=YY_START; @@ -891,7 +891,7 @@ SLASHopt [/]* } else // abort the alias, restart scanning { - copyToOutput(yyscanner,yyextra->aliasString,yyextra->aliasString.length()); + copyToOutput(yyscanner,yyextra->aliasString.data(),yyextra->aliasString.length()); copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } @@ -1043,7 +1043,7 @@ static void clearCommentStack(yyscan_t yyscanner) while (!yyextra->commentStack.empty()) yyextra->commentStack.pop(); } -static void startCondSection(yyscan_t yyscanner,const char *sectId) +static void startCondSection(yyscan_t yyscanner,const QCString §Id) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("startCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); @@ -1077,7 +1077,7 @@ static void handleCondSectionId(yyscan_t yyscanner,const char *expression) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool oldSkip=yyextra->skip; - startCondSection(yyscanner,expression); + startCondSection(yyscanner,QCString(expression)); if ((yyextra->condCtx==CComment || yyextra->readLineCtx==SComment) && !oldSkip && yyextra->skip) { @@ -1103,11 +1103,11 @@ static void handleCondSectionId(yyscan_t yyscanner,const char *expression) /** copies string \a s with length \a len to the output, while * replacing any alias commands found in the string. */ -static void replaceAliases(yyscan_t yyscanner,const char *s) +static void replaceAliases(yyscan_t yyscanner,const QCString &s) { QCString result = resolveAliasCmd(s); //printf("replaceAliases(%s)->'%s'\n",s,result.data()); - copyToOutput(yyscanner,result,result.length()); + copyToOutput(yyscanner,result.data(),result.length()); } @@ -1152,7 +1152,7 @@ static void replaceComment(yyscan_t yyscanner,int offset) * -# It replaces aliases with their definition (see ALIASES) * -# It handles conditional sections (cond...endcond blocks) */ -void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) +void convertCppComments(BufStr *inBuf,BufStr *outBuf,const QCString &fileName) { yyscan_t yyscanner; commentcnvYY_state extra; @@ -1176,12 +1176,12 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) clearCommentStack(yyscanner); yyextra->vhdl = FALSE; - printlex(yy_flex_debug, TRUE, __FILE__, fileName); + printlex(yy_flex_debug, TRUE, __FILE__, qPrint(fileName)); yyextra->isFixedForm = FALSE; if (yyextra->lang==SrcLangExt_Fortran) { FortranFormat fmt = convertFileNameFortranParserCode(fileName); - yyextra->isFixedForm = recognizeFixedForm(inBuf->data(),fmt); + yyextra->isFixedForm = recognizeFixedForm(QCString(inBuf->data()),fmt); } if (yyextra->lang==SrcLangExt_Markdown) @@ -1198,7 +1198,7 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) while (!yyextra->condStack.empty()) { const CondCtx &ctx = yyextra->condStack.top(); - QCString sectionInfo = " "; + QCString sectionInfo(" "); if (ctx.sectionId!=" ") sectionInfo.sprintf(" with label '%s' ",ctx.sectionId.stripWhiteSpace().data()); warn(yyextra->fileName,ctx.lineNr,"Conditional section%sdoes not have " "a corresponding \\endcond command within this file.",sectionInfo.data()); @@ -1206,7 +1206,7 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) } if (yyextra->nestingCount>0 && yyextra->lang!=SrcLangExt_Markdown && yyextra->lang!=SrcLangExt_Fortran) { - QCString tmp= "(probable line reference: "; + QCString tmp("(probable line reference: "); bool first = TRUE; while (!yyextra->commentStack.empty()) { @@ -1225,10 +1225,10 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) { yyextra->outBuf->at(yyextra->outBuf->curPos())='\0'; Debug::print(Debug::CommentCnv,0,"-----------\nCommentCnv: %s\n" - "output=[\n%s]\n-----------\n",fileName,yyextra->outBuf->data() + "output=[\n%s]\n-----------\n",qPrint(fileName),yyextra->outBuf->data() ); } - printlex(yy_flex_debug, FALSE, __FILE__, fileName); + printlex(yy_flex_debug, FALSE, __FILE__, qPrint(fileName)); commentcnvYYlex_destroy(yyscanner); } diff --git a/src/commentscan.h b/src/commentscan.h index a111352..d9910d7 100644 --- a/src/commentscan.h +++ b/src/commentscan.h @@ -81,12 +81,12 @@ class CommentScanner bool markdownEnabled ); void initGroupInfo(Entry *entry); - void enterFile(const char *fileName,int lineNr); - void leaveFile(const char *fileName,int lineNr); - void enterCompound(const char *fileName,int line,const char *name); - void leaveCompound(const char *fileName,int line,const char *name); - void open(Entry *e,const char *fileName,int line,bool implicit=false); - void close(Entry *e,const char *fileName,int line,bool foundInline,bool implicit=false); + void enterFile(const QCString &fileName,int lineNr); + void leaveFile(const QCString &fileName,int lineNr); + void enterCompound(const QCString &fileName,int line,const QCString &name); + void leaveCompound(const QCString &fileName,int line,const QCString &name); + void open(Entry *e,const QCString &fileName,int line,bool implicit=false); + void close(Entry *e,const QCString &fileName,int line,bool foundInline,bool implicit=false); private: struct Private; std::unique_ptr<Private> p; diff --git a/src/commentscan.l b/src/commentscan.l index de359b6..399f5fb 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -68,6 +68,7 @@ static bool handleAddToGroup(yyscan_t yyscanner,const QCString &, const StringVe static bool handleWeakGroup(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleNamespace(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handlePackage(yyscan_t yyscanner,const QCString &, const StringVector &); +static bool handleConcept(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleClass(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleHeaderFile(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleProtocol(yyscan_t yyscanner,const QCString &, const StringVector &); @@ -176,6 +177,7 @@ static const std::map< std::string, DocCmdMap > docCmdMap = { "cite", { &handleCite, CommandSpacing::Inline }}, { "class", { &handleClass, CommandSpacing::Invisible }}, { "code", { &handleFormatBlock, CommandSpacing::Block }}, + { "concept", { &handleConcept, CommandSpacing::Invisible }}, { "copybrief", { &handleCopyBrief, CommandSpacing::Invisible }}, { "copydetails", { &handleCopyDetails, CommandSpacing::Block }}, { "copydoc", { &handleCopyDoc, CommandSpacing::Block }}, @@ -423,14 +425,15 @@ static void initParser(yyscan_t yyscanner); static bool makeStructuralIndicator(yyscan_t yyscanner,Entry::Sections s); static void lineCount(yyscan_t yyscanner); static void addXRefItem(yyscan_t yyscanner, - const char *listName,const char *itemTitle, - const char *listTitle,bool append); + const QCString &listName,const QCString &itemTitle, + const QCString &listTitle,bool append); static QCString addFormula(yyscan_t yyscanner); static void checkFormula(yyscan_t yyscanner); static void addSection(yyscan_t yyscanner); static inline void setOutput(yyscan_t yyscanner,OutputContext ctx); -static void addAnchor(yyscan_t yyscanner,const char *anchor); +static void addAnchor(yyscan_t yyscanner,const QCString &anchor); static inline void addOutput(yyscan_t yyscanner,const char *s); +static inline void addOutput(yyscan_t yyscanner,const QCString &s); static inline void addOutput(yyscan_t yyscanner,char c); static void endBrief(yyscan_t yyscanner,bool addToOutput=TRUE); static void handleGuard(yyscan_t yyscanner,const QCString &expr); @@ -518,6 +521,7 @@ STopt [^\n@\\]* %x EnumDocArg1 %x NameSpaceDocArg1 %x PackageDocArg1 +%x ConceptDocArg1 %x GroupDocArg1 %x GroupDocArg2 %x SectionLabel @@ -611,7 +615,7 @@ STopt [^\n@\\]* addOutput(yyscanner,yytext); } <Comment>"<"{CAPTION}{ATTR}">" { - QCString tag=yytext; + QCString tag(yytext); int s=tag.find("id="); if (s!=-1) // command has id attribute { @@ -669,16 +673,16 @@ STopt [^\n@\\]* StringVector optList; if (idx == -1) // no options { - cmdName = QCString(yytext).stripWhiteSpace().data()+1; // to remove {CMD} + cmdName = QCString(yytext).stripWhiteSpace().mid(1); // to remove {CMD} } else // options present { - cmdName = fullMatch.left(idx).stripWhiteSpace().data()+1; // to remove {CMD} + cmdName = fullMatch.left(idx).stripWhiteSpace().mid(1); // to remove {CMD} QCString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace(); optList = split(optStr.str(),","); } - auto it = docCmdMap.find(cmdName.data()); - //printf("lookup command '%s' found=%d\n",cmdName.data(),it!=docCmdMap.end()); + auto it = docCmdMap.find(cmdName.str()); + //printf("lookup command '%s' found=%d\n",qPrint(cmdName),it!=docCmdMap.end()); if (it!=docCmdMap.end()) // special action is required { int i=0; @@ -725,9 +729,9 @@ STopt [^\n@\\]* addOutput(yyscanner,yytext); } <Comment>{B}*{CMD}"~"[a-z_A-Z-]* { // language switch command - QCString langId = QCString(yytext).stripWhiteSpace().data()+2; + QCString langId = QCString(yytext).stripWhiteSpace().mid(2); if (!langId.isEmpty() && - qstricmp(Config_getEnum(OUTPUT_LANGUAGE),langId)!=0) + qstricmp(Config_getEnum(OUTPUT_LANGUAGE).data(),langId.data())!=0) { // enable language specific section BEGIN(SkipLang); } @@ -735,7 +739,7 @@ STopt [^\n@\\]* <Comment>{B}*{CMD}"f{"[^}\n]+"}"("{"?) { // start of a formula with custom environment setOutput(yyscanner,OutputDoc); yyextra->formulaText="\\begin"; - yyextra->formulaEnv=QCString(yytext).stripWhiteSpace().data()+2; + yyextra->formulaEnv=QCString(yytext).stripWhiteSpace().mid(2); if (yyextra->formulaEnv.at(yyextra->formulaEnv.length()-1)=='{') { // remove trailing open brace @@ -981,7 +985,7 @@ STopt [^\n@\\]* /* ------------ handle argument of namespace command --------------- */ <NameSpaceDocArg1>{SCOPENAME} { // handle argument - yyextra->current->name = substitute(yytext,".","::"); + yyextra->current->name = substitute(QCString(yytext),QCString("."),QCString("::")); BEGIN( Comment ); } <NameSpaceDocArg1>{LC} { // line continuation @@ -1024,14 +1028,36 @@ STopt [^\n@\\]* <PackageDocArg1>. { // ignore other stuff } + /* ------------ handle argument of concept command --------------- */ + +<ConceptDocArg1>{SCOPEID} { // handle argument + yyextra->current->name = yytext; + BEGIN( Comment ); + } +<ConceptDocArg1>{LC} { // line continuation + yyextra->lineNr++; + addOutput(yyscanner,'\n'); + } +<ConceptDocArg1>{DOCNL} { // missing argument + warn(yyextra->fileName,yyextra->lineNr, + "missing argument after " + "\\concept." + ); + unput_string(yytext,yyleng); + BEGIN( Comment ); + } +<ConceptDocArg1>. { // ignore other stuff + } + + /* ------ handle argument of class/struct/union command --------------- */ <ClassDocArg1>{SCOPENAME}{TMPLSPEC} { - yyextra->current->name = substitute(removeRedundantWhiteSpace(yytext),".","::"); + yyextra->current->name = substitute(removeRedundantWhiteSpace(QCString(yytext)),".","::"); BEGIN( ClassDocArg2 ); } <ClassDocArg1>{SCOPENAME} { // first argument - yyextra->current->name = substitute(yytext,".","::"); + yyextra->current->name = substitute(QCString(yytext),".","::"); if (yyextra->current->section==Entry::PROTOCOLDOC_SEC) { yyextra->current->name+="-p"; @@ -1040,7 +1066,7 @@ STopt [^\n@\\]* BEGIN( ClassDocArg2 ); } <CategoryDocArg1>{SCOPENAME}{B}*"("[^\)]+")" { - yyextra->current->name = substitute(yytext,".","::"); + yyextra->current->name = substitute(QCString(yytext),".","::"); BEGIN( ClassDocArg2 ); } <ClassDocArg1,CategoryDocArg1>{LC} { // line continuation @@ -1050,7 +1076,7 @@ STopt [^\n@\\]* <ClassDocArg1,CategoryDocArg1>{DOCNL} { warn(yyextra->fileName,yyextra->lineNr, "missing argument after " - "'\\%s'.",yyextra->currentCmd.data() + "'\\%s'.",qPrint(yyextra->currentCmd) ); //addOutput(yyscanner,'\n'); //if (*yytext=='\n') yyextra->lineNr++; @@ -1138,7 +1164,7 @@ STopt [^\n@\\]* { warn(yyextra->fileName,yyextra->lineNr, "missing title after " - "\\defgroup %s", yyextra->current->name.data() + "\\defgroup %s", qPrint(yyextra->current->name) ); } unput_string(yytext,yyleng); @@ -1181,7 +1207,7 @@ STopt [^\n@\\]* } <PageDocArg2>{CMD}[<>] { // bug 748927 - QCString tmp = yytext; + QCString tmp(yytext); tmp = substitute(substitute(tmp,"@<","<"),"@>",">"); tmp = substitute(substitute(tmp,"\\<","<"),"\\>",">"); yyextra->current->args += tmp; @@ -1196,6 +1222,10 @@ STopt [^\n@\\]* <ParamArg1>"," { addOutput(yyscanner," , "); } +<ParamArg1>{DOCNL} { + if (*yytext=='\n') yyextra->lineNr++; + addOutput(yyscanner," "); + } <ParamArg1>{ID} { addOutput(yyscanner,yytext); BEGIN( Comment ); @@ -1304,7 +1334,7 @@ STopt [^\n@\\]* } <RelatesParam1>{DOCNL} { // missing argument warn(yyextra->fileName,yyextra->lineNr, - "Missing argument of '\\%s' command",yyextra->currentCmd.data() + "Missing argument of '\\%s' command",qPrint(yyextra->currentCmd) ); unput_string(yytext,yyleng); //if (*yytext=='\n') yyextra->lineNr++; @@ -1390,7 +1420,7 @@ STopt [^\n@\\]* addOutput(yyscanner,yytext); // we add subpage labels as a kind of "inheritance" relation to prevent // needing to add another list to the Entry class. - yyextra->current->extends.push_back(BaseInfo(yytext,Public,Normal)); + yyextra->current->extends.push_back(BaseInfo(QCString(yytext),Public,Normal)); BEGIN(SubpageTitle); } <SubpageLabel>{DOCNL} { // missing argument @@ -1417,7 +1447,7 @@ STopt [^\n@\\]* /* ----- handle arguments of the anchor command ------- */ <AnchorLabel>{LABELID} { // found argument - addAnchor(yyscanner,yytext); + addAnchor(yyscanner,QCString(yytext)); addOutput(yyscanner,yytext); BEGIN( Comment ); } @@ -1472,7 +1502,7 @@ STopt [^\n@\\]* if (yyextra->commentCount<0) { warn(yyextra->fileName,yyextra->lineNr, - "found */ without matching /* while inside a \\%s block! Perhaps a missing \\end%s?\n",yyextra->blockName.data(),yyextra->blockName.data()); + "found */ without matching /* while inside a \\%s block! Perhaps a missing \\end%s?\n",qPrint(yyextra->blockName),qPrint(yyextra->blockName)); } } } @@ -1484,7 +1514,7 @@ STopt [^\n@\\]* if (yyextra->blockName=="startuml") endTag="enduml"; warn(yyextra->fileName,yyextra->lineNr, "reached end of comment while inside a \\%s block; check for missing \\%s tag!", - yyextra->blockName.data(),endTag.data() + qPrint(yyextra->blockName),qPrint(endTag) ); yyterminate(); } @@ -1513,12 +1543,12 @@ STopt [^\n@\\]* } <GuardExpr>\n { warn(yyextra->fileName,yyextra->lineNr, - "invalid expression '%s' for yyextra->guards",yyextra->guardExpr.data()); + "invalid expression '%s' for yyextra->guards",qPrint(yyextra->guardExpr)); unput(*yytext); BEGIN(GuardParam); } <GuardParam>{B}*[a-z_A-Z0-9.\-]+ { // parameter of if/ifnot yyextra->guards - handleGuard(yyscanner,yytext); + handleGuard(yyscanner,QCString(yytext)); } <GuardParam>{DOCNL} { // end of argument if (*yytext=='\n') yyextra->lineNr++; @@ -1709,7 +1739,7 @@ STopt [^\n@\\]* <InGroupParam>{LABELID} { // group id yyextra->current->groups.push_back( - Grouping(yytext, Grouping::GROUPING_INGROUP) + Grouping(QCString(yytext), Grouping::GROUPING_INGROUP) ); yyextra->inGroupParamFound=TRUE; } @@ -1794,7 +1824,7 @@ STopt [^\n@\\]* <InheritParam>({ID}("::"|"."))*{ID} { // found argument yyextra->current->extends.push_back( - BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal) + BaseInfo(removeRedundantWhiteSpace(QCString(yytext)),Public,Normal) ); BEGIN( Comment ); } @@ -1817,13 +1847,13 @@ STopt [^\n@\\]* <ExtendsParam>({ID}("::"|"."))*{ID} { // found argument yyextra->current->extends.push_back( - BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal) + BaseInfo(removeRedundantWhiteSpace(QCString(yytext)),Public,Normal) ); BEGIN( Comment ); } <ExtendsParam>{DOCNL} { // missing argument warn(yyextra->fileName,yyextra->lineNr, - "'\\%s' command has no argument",yyextra->currentCmd.data() + "'\\%s' command has no argument",qPrint(yyextra->currentCmd) ); //if (*yytext=='\n') yyextra->lineNr++; //addOutput(yyscanner,'\n'); @@ -1836,9 +1866,9 @@ STopt [^\n@\\]* /* ----- handle language specific sections ------- */ <SkipLang>[\\@]"~"[a-zA-Z-]* { /* language switch */ - QCString langId = &yytext[2]; + QCString langId(&yytext[2]); if (langId.isEmpty() || - qstricmp(Config_getEnum(OUTPUT_LANGUAGE),langId)==0) + qstricmp(Config_getEnum(OUTPUT_LANGUAGE).data(),langId.data())==0) { // enable language specific section BEGIN(Comment); } @@ -1895,6 +1925,10 @@ STopt [^\n@\\]* addOutput(yyscanner,yytext); } + /* +<*>. { fprintf(stderr,"Lex scanner %s %sdefault rule for state %s: #%s#\n", __FILE__,yyextra->fileName ? ("(" + yyextra->fileName +") ").data(): "",stateToString(YY_START),yytext);} +<*>\n { fprintf(stderr,"Lex scanner %s %sdefault rule newline for state %s.\n", __FILE__, yyextra->fileName ? ("(" + yyextra->fileName +") ").data(): "",stateToString(YY_START));} + */ %% @@ -1994,6 +2028,15 @@ static bool handleClass(yyscan_t yyscanner,const QCString &cmd, const StringVect return stop; } +static bool handleConcept(yyscan_t yyscanner,const QCString &cmd, const StringVector &) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + bool stop=makeStructuralIndicator(yyscanner,Entry::CONCEPTDOC_SEC); + yyextra->currentCmd = cmd; + BEGIN( ConceptDocArg1 ); + return stop; +} + static bool handleHeaderFile(yyscan_t yyscanner,const QCString &, const StringVector &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; @@ -2361,9 +2404,9 @@ static bool handleFormatBlock(yyscan_t yyscanner,const QCString &s, const String } else { - addOutput(yyscanner,"@"+s+"{"+join(optList,",")+"} "); + addOutput(yyscanner,"@"+s+"{"+QCString(join(optList,","))+"} "); } - //printf("handleFormatBlock(%s) with option(%s)\n",s.data(),opt.data()); + //printf("handleFormatBlock(%s) with option(%s)\n",qPrint(s),qPrint(opt)); yyextra->blockName=s; yyextra->commentCount=0; BEGIN(FormatBlock); @@ -2633,7 +2676,7 @@ static bool handleToc(yyscan_t yyscanner,const QCString &, const StringVector &o { if (sscanf(opt.right(opt.length() - i - 1).data(),"%d%c",&level,&dum) != 1) { - warn(yyextra->fileName,yyextra->lineNr,"Unknown option:level specified with \\tableofcontents: '%s'", QCString(opt_).stripWhiteSpace().data()); + warn(yyextra->fileName,yyextra->lineNr,"Unknown option:level specified with \\tableofcontents: '%s'", qPrint(QCString(opt_).stripWhiteSpace())); opt = ""; } else @@ -2663,7 +2706,7 @@ static bool handleToc(yyscan_t yyscanner,const QCString &, const StringVector &o } else { - warn(yyextra->fileName,yyextra->lineNr,"Unknown option specified with \\tableofcontents: '%s'", QCString(opt_).stripWhiteSpace().data()); + warn(yyextra->fileName,yyextra->lineNr,"Unknown option specified with \\tableofcontents: '%s'", qPrint(QCString(opt_).stripWhiteSpace())); } } } @@ -2774,6 +2817,7 @@ static bool getDocSectionName(int s) case Entry::DIRDOC_SEC: case Entry::EXAMPLE_SEC: case Entry::MEMBERGRP_SEC: + case Entry::CONCEPTDOC_SEC: return TRUE; default: return FALSE; @@ -2827,11 +2871,11 @@ static QCString stripQuotes(const char *s) //----------------------------------------------------------------- static void addXRefItem(yyscan_t yyscanner, - const char *listName,const char *itemTitle, - const char *listTitle,bool append) + const QCString &listName,const QCString &itemTitle, + const QCString &listTitle,bool append) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - if (listName==0) return; + if (listName.isEmpty()) return; //printf("addXRefItem(%s,%s,%s,%d)\n",listName,itemTitle,listTitle,append); std::unique_lock<std::mutex> lock(g_sectionMutex); @@ -2841,9 +2885,9 @@ static void addXRefItem(yyscan_t yyscanner, for (auto it = yyextra->current->sli.rbegin(); it != yyextra->current->sli.rend(); ++it) { RefItem *i = *it; - if (i && qstrcmp(i->list()->listName(),listName)==0) + if (i && i->list()->listName()==listName) { - //printf("found %s lii->type=%s\n",listName,i->list()->listName().data()); + //printf("found %s lii->type=%s\n",listName,qPrint(i->list()->listName())); item = i; break; } @@ -2852,7 +2896,7 @@ static void addXRefItem(yyscan_t yyscanner, { //printf("listName=%s item id = %d existing\n",listName,item->id()); item->setText(item->text() + " <p>" + yyextra->outputXRef); - //printf("%s: text +=%s\n",listName,item->text.data()); + //printf("%s: text +=%s\n",listName,qPrint(item->text)); } else // new item { @@ -2862,12 +2906,12 @@ static void addXRefItem(yyscan_t yyscanner, item = refList->add(); //printf("listName=%s item id = %d new yyextra->current=%p\n",listName,item->id(),yyextra->current); QCString anchorLabel; - anchorLabel.sprintf("_%s%06d",listName,item->id()); + anchorLabel.sprintf("_%s%06d",listName.data(),item->id()); item->setText(yyextra->outputXRef); item->setAnchor(anchorLabel); yyextra->current->sli.push_back(item); QCString cmdString; - cmdString.sprintf(" \\xrefitem %s %d.",listName,item->id()); + cmdString.sprintf(" \\xrefitem %s %d.",qPrint(listName),item->id()); if (yyextra->inBody) { yyextra->current->inbodyDocs += cmdString; @@ -2884,11 +2928,11 @@ static void addXRefItem(yyscan_t yyscanner, { if (si->lineNr() != -1) { - warn(listName,yyextra->lineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",anchorLabel.data(),si->fileName().data(),si->lineNr()); + warn(listName,yyextra->lineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",qPrint(anchorLabel),qPrint(si->fileName()),si->lineNr()); } else { - warn(listName,yyextra->lineNr,"multiple use of section label '%s', (first occurrence: %s)",anchorLabel.data(),si->fileName().data()); + warn(listName,yyextra->lineNr,"multiple use of section label '%s', (first occurrence: %s)",qPrint(anchorLabel),qPrint(si->fileName())); } } else @@ -2939,11 +2983,11 @@ static void addSection(yyscan_t yyscanner) { if (si->lineNr() != -1) { - warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '%s' while adding section, (first occurrence: %s, line %d)",yyextra->sectionLabel.data(),si->fileName().data(),si->lineNr()); + warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '%s' while adding section, (first occurrence: %s, line %d)",qPrint(yyextra->sectionLabel),qPrint(si->fileName()),si->lineNr()); } else { - warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '%s' while adding section, (first occurrence: %s)",yyextra->sectionLabel.data(),si->fileName().data()); + warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '%s' while adding section, (first occurrence: %s)",qPrint(yyextra->sectionLabel),qPrint(si->fileName())); } } else @@ -2966,13 +3010,13 @@ static void addCite(yyscan_t yyscanner) { std::unique_lock<std::mutex> lock(g_citeMutex); struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - QCString name=yytext; + QCString name(yytext); if (yytext[0] =='"') { name=yytext+1; name=name.left((int)yyleng-2); } - CitationManager::instance().insert(name.data()); + CitationManager::instance().insert(name); } //----------------------------------------------------------------------------- @@ -2999,7 +3043,7 @@ static void stripTrailingWhiteSpace(QCString &s) break; } } - //printf("stripTrailingWhitespace(%s) i=%d len=%d\n",s.data(),i,len); + //printf("stripTrailingWhitespace(%s) i=%d len=%d\n",qPrint(s),i,len); if (i!=(int)len-1) { s.resize(i+2); // string up to and including char at pos i and \0 terminator @@ -3035,28 +3079,28 @@ static inline void setOutput(yyscan_t yyscanner,OutputContext ctx) switch(yyextra->xrefKind) { case XRef_Todo: - addXRefItem(yyscanner,"todo", + addXRefItem(yyscanner,QCString("todo"), theTranslator->trTodo(), theTranslator->trTodoList(), xrefAppendToPrev ); break; case XRef_Test: - addXRefItem(yyscanner,"test", + addXRefItem(yyscanner,QCString("test"), theTranslator->trTest(), theTranslator->trTestList(), xrefAppendToPrev ); break; case XRef_Bug: - addXRefItem(yyscanner,"bug", + addXRefItem(yyscanner,QCString("bug"), theTranslator->trBug(), theTranslator->trBugList(), xrefAppendToPrev ); break; case XRef_Deprecated: - addXRefItem(yyscanner,"deprecated", + addXRefItem(yyscanner,QCString("deprecated"), theTranslator->trDeprecated(), theTranslator->trDeprecatedList(), xrefAppendToPrev @@ -3130,7 +3174,7 @@ static inline void setOutput(yyscan_t yyscanner,OutputContext ctx) } -static void addAnchor(yyscan_t yyscanner,const char *anchor) +static void addAnchor(yyscan_t yyscanner,const QCString &anchor) { std::unique_lock<std::mutex> lock(g_sectionMutex); struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; @@ -3140,16 +3184,19 @@ static void addAnchor(yyscan_t yyscanner,const char *anchor) { if (si->lineNr() != -1) { - warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '%s' while adding anchor, (first occurrence: %s, line %d)",anchor,si->fileName().data(),si->lineNr()); + warn(yyextra->fileName,yyextra->lineNr, + "multiple use of section label '%s' while adding anchor, (first occurrence: %s, line %d)", + qPrint(anchor),qPrint(si->fileName()),si->lineNr()); } else { - warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '%s' while adding anchor, (first occurrence: %s)",anchor,si->fileName().data()); + warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '%s' while adding anchor, (first occurrence: %s)", + qPrint(anchor),qPrint(si->fileName())); } } else { - si = sm.add(anchor,yyextra->fileName,yyextra->lineNr,nullptr,SectionType::Anchor,0); + si = sm.add(anchor,yyextra->fileName,yyextra->lineNr,QCString(),SectionType::Anchor,0); yyextra->current->anchors.push_back(si); } } @@ -3162,6 +3209,14 @@ static inline void addOutput(yyscan_t yyscanner,const char *s) *yyextra->pOutputString+=s; } +// add a string to the output +static inline void addOutput(yyscan_t yyscanner,const QCString &s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("addOutput(yyscanner,%s)\n",s); + *yyextra->pOutputString+=s; +} + // add a character to the output static inline void addOutput(yyscan_t yyscanner,char c) { @@ -3277,7 +3332,7 @@ bool CommentScanner::parseCommentBlock(/* in */ OutlineParserInterface *pars yyextra->spaceBeforeCmd.resize(0); yyextra->spaceBeforeIf.resize(0); - printlex(yy_flex_debug, TRUE, __FILE__, fileName ? fileName.data(): NULL); + printlex(yy_flex_debug, TRUE, __FILE__, !fileName.isEmpty() ? qPrint(fileName): NULL); if (!yyextra->current->inbodyDocs.isEmpty() && isInbody) // separate in body fragments { yyextra->current->inbodyDocs+="\n\n"; @@ -3348,7 +3403,7 @@ bool CommentScanner::parseCommentBlock(/* in */ OutlineParserInterface *pars //printf("position=%d yyextra->parseMore=%d newEntryNeeded=%d\n", // position,yyextra->parseMore,newEntryNeeded); - printlex(yy_flex_debug, FALSE, __FILE__, fileName ? fileName.data(): NULL); + printlex(yy_flex_debug, FALSE, __FILE__, !fileName.isEmpty() ? qPrint(fileName): NULL); return yyextra->parseMore; } @@ -3392,37 +3447,37 @@ void CommentScanner::initGroupInfo(Entry *entry) yyextra->docGroup.initGroupInfo(entry); } -void CommentScanner::enterFile(const char *fileName,int lineNr) +void CommentScanner::enterFile(const QCString &fileName,int lineNr) { struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; yyextra->docGroup.enterFile(fileName,lineNr); } -void CommentScanner::leaveFile(const char *fileName,int lineNr) +void CommentScanner::leaveFile(const QCString &fileName,int lineNr) { struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; yyextra->docGroup.leaveFile(fileName,lineNr); } -void CommentScanner::enterCompound(const char *fileName,int lineNr,const char *name) +void CommentScanner::enterCompound(const QCString &fileName,int lineNr,const QCString &name) { struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; yyextra->docGroup.enterCompound(fileName,lineNr,name); } -void CommentScanner::leaveCompound(const char *fileName,int lineNr,const char *name) +void CommentScanner::leaveCompound(const QCString &fileName,int lineNr,const QCString &name) { struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; yyextra->docGroup.leaveCompound(fileName,lineNr,name); } -void CommentScanner::open(Entry *e,const char *fileName,int lineNr,bool implicit) +void CommentScanner::open(Entry *e,const QCString &fileName,int lineNr,bool implicit) { struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; yyextra->docGroup.open(e,fileName,lineNr,implicit); } -void CommentScanner::close(Entry *e,const char *fileName,int lineNr,bool foundInline,bool implicit) +void CommentScanner::close(Entry *e,const QCString &fileName,int lineNr,bool foundInline,bool implicit) { struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; yyextra->docGroup.close(e,fileName,lineNr,foundInline,implicit); diff --git a/src/conceptdef.cpp b/src/conceptdef.cpp new file mode 100644 index 0000000..b9dd085 --- /dev/null +++ b/src/conceptdef.cpp @@ -0,0 +1,733 @@ +/****************************************************************************** + * + * Copyright (C) 1997-2021 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#include "conceptdef.h" +#include "definitionimpl.h" +#include "util.h" +#include "config.h" +#include "doxygen.h" +#include "language.h" +#include "outputlist.h" +#include "searchindex.h" +#include "message.h" +#include "parserintf.h" + +//------------------------------------------------------------------------------------ + +class ConceptDefImpl : public DefinitionMixin<ConceptDefMutable> +{ + public: + ConceptDefImpl(const QCString &fileName,int startLine,int startColumn, + const QCString &name,const QCString &tagRef=QCString(),const QCString &tagFile=QCString()); + ~ConceptDefImpl(); + + virtual ConceptDef *resolveAlias() { return this; } + + //---------- ConceptDef + virtual DefType definitionType() const; + virtual QCString getOutputFileBase() const; + virtual bool hasDetailedDescription() const; + virtual QCString displayName(bool includeScope=true) const; + virtual const IncludeInfo *includeInfo() const; + virtual ArgumentList getTemplateParameterList() const; + virtual QCString anchor() const; + virtual bool isLinkableInProject() const; + virtual bool isLinkable() const; + virtual QCString initializer() const; + virtual void writeDeclarationLink(OutputList &ol,bool &found, + const QCString &header,bool localNames) const; + virtual const NamespaceDef *getNamespaceDef() const; + virtual const FileDef *getFileDef() const; + + //---------- ConceptDefMutable + virtual void setIncludeFile(FileDef *fd,const QCString &incName,bool local,bool force); + virtual void setTemplateArguments(const ArgumentList &al); + virtual void setNamespace(NamespaceDef *nd); + virtual void setFileDef(FileDef *fd); + virtual void writeTagFile(TextStream &); + virtual void writeDocumentation(OutputList &); + virtual void setInitializer(const QCString &init); + virtual void findSectionsInDocumentation(); + + //---------- Helpers + void writeBriefDescription(OutputList &) const; + void writeAuthorSection(OutputList &ol) const; + void writeIncludeFiles(OutputList &ol) const; + void writeDetailedDescription(OutputList &ol,const QCString &title) const; + void writeDefinition(OutputList &ol,const QCString &title) const; + + private: + QCString m_fileName; + std::unique_ptr<IncludeInfo> m_incInfo; + NamespaceDef *m_nspace = 0; + FileDef *m_fileDef = 0; + ArgumentList m_tArgList; + QCString m_initializer; +}; + +ConceptDefMutable *createConceptDef( + const QCString &fileName,int startLine,int startColumn, + const QCString &name, const QCString &tagRef,const QCString &tagFile) +{ + return new ConceptDefImpl(fileName,startLine,startColumn,name,tagRef,tagFile); +} + +//------------------------------------------------------------------------------------ + +class ConceptDefAliasImpl : public DefinitionAliasMixin<ConceptDef> +{ + public: + ConceptDefAliasImpl(const Definition *newScope,const ConceptDef *cd) + : DefinitionAliasMixin(newScope,cd) { init(); } + virtual ~ConceptDefAliasImpl() { deinit(); } + + const ConceptDef *getCdAlias() const { return toConceptDef(getAlias()); } + virtual ConceptDef *resolveAlias() { return const_cast<ConceptDef*>(getCdAlias()); } + + virtual DefType definitionType() const { return TypeConcept; } + virtual QCString getOutputFileBase() const + { return getCdAlias()->getOutputFileBase(); } + virtual QCString getReference() const + { return getCdAlias()->getReference(); } + virtual bool isReference() const + { return getCdAlias()->isReference(); } + virtual bool hasDetailedDescription() const + { return getCdAlias()->hasDetailedDescription(); } + virtual QCString displayName(bool includeScope=true) const + { return getCdAlias()->displayName(includeScope); } + virtual const IncludeInfo *includeInfo() const + { return getCdAlias()->includeInfo(); } + virtual ArgumentList getTemplateParameterList() const + { return getCdAlias()->getTemplateParameterList(); } + virtual QCString anchor() const + { return getCdAlias()->anchor(); } + virtual bool isLinkableInProject() const + { return getCdAlias()->isLinkableInProject(); } + virtual bool isLinkable() const + { return getCdAlias()->isLinkable(); } + virtual QCString initializer() const + { return getCdAlias()->initializer(); } + virtual const NamespaceDef *getNamespaceDef() const + { return getCdAlias()->getNamespaceDef(); } + virtual const FileDef *getFileDef() const + { return getCdAlias()->getFileDef(); } + virtual void writeDeclarationLink(OutputList &ol,bool &found, + const QCString &header,bool localNames) const + { getCdAlias()->writeDeclarationLink(ol,found,header,localNames); } +}; + +ConceptDef *createConceptDefAlias(const Definition *newScope,const ConceptDef *cd) +{ + ConceptDef *acd = new ConceptDefAliasImpl(newScope,cd); + return acd; +} + +//------------------------------------------------------------------------------------ + +ConceptDefImpl::ConceptDefImpl(const QCString &fileName,int startLine,int startColumn, + const QCString &name,const QCString &tagRef,const QCString &tagFile) : DefinitionMixin(fileName,startLine,startColumn,name) +{ + if (!tagFile.isEmpty()) + { + if (!tagRef.isEmpty()) + { + m_fileName = stripExtension(tagFile); + } + else + { + m_fileName = convertNameToFile(stripExtension(tagFile)); + } + } + else + { + m_fileName = convertNameToFile(QCString("concept")+name); + } + setReference(tagRef); +} + +ConceptDefImpl::~ConceptDefImpl() +{ +} + +Definition::DefType ConceptDefImpl::definitionType() const +{ + return TypeConcept; +} + +QCString ConceptDefImpl::getOutputFileBase() const +{ + return m_fileName; +} + +bool ConceptDefImpl::hasDetailedDescription() const +{ + bool repeatBrief = Config_getBool(REPEAT_BRIEF); + bool sourceBrowser = Config_getBool(SOURCE_BROWSER); + return ((!briefDescription().isEmpty() && repeatBrief) || + !documentation().isEmpty() || + (sourceBrowser && getStartBodyLine()!=-1 && getBodyDef())); +} + +QCString ConceptDefImpl::anchor() const +{ + return ""; +} + +QCString ConceptDefImpl::displayName(bool includeScope) const +{ + return includeScope ? name() : localName(); +} + +const IncludeInfo *ConceptDefImpl::includeInfo() const +{ + return m_incInfo.get(); +} + +ArgumentList ConceptDefImpl::getTemplateParameterList() const +{ + return m_tArgList; +} + +bool ConceptDefImpl::isLinkableInProject() const +{ + return hasDocumentation() && !isReference() && !isHidden(); +} + +bool ConceptDefImpl::isLinkable() const +{ + return isLinkableInProject() || isReference(); +} + +void ConceptDefImpl::setIncludeFile(FileDef *fd,const QCString &incName,bool local,bool force) +{ + if (!m_incInfo) m_incInfo = std::make_unique<IncludeInfo>(); + if ((!incName.isEmpty() && m_incInfo->includeName.isEmpty()) || + (fd!=0 && m_incInfo->fileDef==0) + ) + { + m_incInfo->fileDef = fd; + m_incInfo->includeName = incName; + m_incInfo->local = local; + } + if (force && !incName.isEmpty()) + { + m_incInfo->includeName = incName; + m_incInfo->local = local; + } +} + +void ConceptDefImpl::setTemplateArguments(const ArgumentList &al) +{ + m_tArgList = al; +} + +void ConceptDefImpl::setNamespace(NamespaceDef *nd) +{ + m_nspace = nd; +} + +const NamespaceDef *ConceptDefImpl::getNamespaceDef() const +{ + return m_nspace; +} + +void ConceptDefImpl::setFileDef(FileDef *fd) +{ + m_fileDef=fd; +} + +const FileDef *ConceptDefImpl::getFileDef() const +{ + return m_fileDef; +} + +void ConceptDefImpl::setInitializer(const QCString &init) +{ + m_initializer = init; +} + +QCString ConceptDefImpl::initializer() const +{ + return m_initializer; +} + +void ConceptDefImpl::writeTagFile(TextStream &tagFile) +{ + tagFile << " <compound kind=\"concept\">\n"; + tagFile << " <name>" << convertToXML(name()) << "</name>\n"; + tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>\n"; + QCString idStr = id(); + if (!idStr.isEmpty()) + { + tagFile << " <clangid>" << convertToXML(idStr) << "</clangid>\n"; + } + writeDocAnchorsToTagFile(tagFile); + tagFile << " </compound>\n"; +} + +void ConceptDefImpl::writeBriefDescription(OutputList &ol) const +{ + if (hasBriefDescription()) + { + DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0, + briefDescription(),TRUE,FALSE, + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + if (rootNode && !rootNode->isEmpty()) + { + ol.startParagraph(); + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Man); + ol.writeString(" - "); + ol.popGeneratorState(); + ol.writeDoc(rootNode,this,0); + ol.pushGeneratorState(); + ol.disable(OutputGenerator::RTF); + ol.writeString(" \n"); + ol.enable(OutputGenerator::RTF); + + if (hasDetailedDescription()) + { + ol.disableAllBut(OutputGenerator::Html); + ol.startTextLink(getOutputFileBase(),"details"); + ol.parseText(theTranslator->trMore()); + ol.endTextLink(); + } + ol.popGeneratorState(); + ol.endParagraph(); + } + delete rootNode; + } + ol.writeSynopsis(); +} + +void ConceptDefImpl::writeIncludeFiles(OutputList &ol) const +{ + if (m_incInfo) + { + QCString nm=m_incInfo->includeName.isEmpty() ? + (m_incInfo->fileDef ? + m_incInfo->fileDef->docName() : QCString() + ) : + m_incInfo->includeName; + if (!nm.isEmpty()) + { + ol.startParagraph(); + ol.startTypewriter(); + ol.docify("#include "); + if (m_incInfo->local) + ol.docify("\""); + else + ol.docify("<"); + ol.pushGeneratorState(); + ol.disable(OutputGenerator::Html); + ol.docify(nm); + ol.disableAllBut(OutputGenerator::Html); + ol.enable(OutputGenerator::Html); + if (m_incInfo->fileDef) + { + ol.writeObjectLink(QCString(),m_incInfo->fileDef->includeName(),QCString(),nm); + } + else + { + ol.docify(nm); + } + ol.popGeneratorState(); + if (m_incInfo->local) + ol.docify("\""); + else + ol.docify(">"); + ol.endTypewriter(); + ol.endParagraph(); + } + } +} + +static QCString templateSpec(const ArgumentList &al) +{ + TextStream t; + t << "template<"; + bool first=true; + for (const auto &a : al) + { + if (!first) t << ", "; + t << a.type; + if (!a.name.isEmpty()) + { + t << " " << a.name; + } + if (a.defval.length()!=0) + { + t << " " << a.defval; + } + first=false; + } + t << ">"; + return t.str(); +} + +void ConceptDefImpl::writeDefinition(OutputList &ol,const QCString &title) const +{ + ol.startGroupHeader(); + ol.parseText(title); + ol.endGroupHeader(); + + auto intf = Doxygen::parserManager->getCodeParser(".cpp"); + intf->resetCodeParserState(); + ol.startCodeFragment("DoxyCode"); + QCString scopeName; + if (getOuterScope()!=Doxygen::globalScope) scopeName=getOuterScope()->name(); + TextStream conceptDef; + conceptDef << templateSpec(m_tArgList); + conceptDef << "\nconcept "; + conceptDef << name(); + conceptDef << " = "; + conceptDef << m_initializer; + intf->parseCode(ol,scopeName,conceptDef.str(),SrcLangExt_Cpp,false,QCString(), + m_fileDef, -1,-1,true,0,false,this); + ol.endCodeFragment("DoxyCode"); +} + +void ConceptDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) const +{ + static bool repeatBrief = Config_getBool(REPEAT_BRIEF); + if (hasDetailedDescription()) + { + ol.pushGeneratorState(); + ol.disable(OutputGenerator::Html); + ol.writeRuler(); + ol.popGeneratorState(); + + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Html); + ol.writeAnchor(QCString(),"details"); + ol.popGeneratorState(); + + ol.startGroupHeader(); + ol.parseText(title); + ol.endGroupHeader(); + + ol.startTextBlock(); + // repeat brief description + if (!briefDescription().isEmpty() && repeatBrief) + { + ol.generateDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE, + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + } + if (!briefDescription().isEmpty() && repeatBrief && + !documentation().isEmpty()) + { + ol.pushGeneratorState(); + ol.disable(OutputGenerator::Html); + ol.writeString("\n\n"); + ol.popGeneratorState(); + } + + // write documentation + if (!documentation().isEmpty()) + { + ol.generateDoc(docFile(),docLine(),this,0,documentation(),TRUE,FALSE, + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + } + + writeSourceDef(ol,name()); + ol.endTextBlock(); + } +} + +void ConceptDefImpl::writeAuthorSection(OutputList &ol) const +{ + // write Author section (Man only) + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Man); + ol.startGroupHeader(); + ol.parseText(theTranslator->trAuthor(TRUE,TRUE)); + ol.endGroupHeader(); + ol.parseText(theTranslator->trGeneratedAutomatically(Config_getString(PROJECT_NAME))); + ol.popGeneratorState(); +} + +void ConceptDefImpl::writeDocumentation(OutputList &ol) +{ + static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); + QCString pageTitle = theTranslator->trConceptReference(displayName()); + startFile(ol,getOutputFileBase(),name(),pageTitle,HLI_ConceptVisible,!generateTreeView); + + // ---- navigation part + if (!generateTreeView) + { + if (getOuterScope()!=Doxygen::globalScope) + { + writeNavigationPath(ol); + } + ol.endQuickIndices(); + } + + // ---- title part + startTitle(ol,getOutputFileBase(),this); + ol.parseText(pageTitle); + endTitle(ol,getOutputFileBase(),displayName()); + + // ---- contents part + + ol.startContents(); + + if (Doxygen::searchIndex) + { + Doxygen::searchIndex->setCurrentDoc(this,anchor(),FALSE); + Doxygen::searchIndex->addWord(localName(),TRUE); + } + + Doxygen::indexList->addIndexItem(this,0); + //---------------------------------------- start flexible part ------------------------------- + + for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Concept)) + { + switch (lde->kind()) + { + case LayoutDocEntry::BriefDesc: + writeBriefDescription(ol); + break; + case LayoutDocEntry::ConceptDefinition: + { + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); + writeDefinition(ol,ls->title(getLanguage())); + } + break; + case LayoutDocEntry::DetailedDesc: + { + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); + writeDetailedDescription(ol,ls->title(getLanguage())); + } + break; + case LayoutDocEntry::AuthorSection: + writeAuthorSection(ol); + break; + case LayoutDocEntry::ClassIncludes: + writeIncludeFiles(ol); + break; + case LayoutDocEntry::MemberDeclStart: + case LayoutDocEntry::NamespaceClasses: + case LayoutDocEntry::NamespaceInterfaces: + case LayoutDocEntry::NamespaceStructs: + case LayoutDocEntry::NamespaceExceptions: + case LayoutDocEntry::NamespaceConcepts: + case LayoutDocEntry::NamespaceNestedNamespaces: + case LayoutDocEntry::NamespaceNestedConstantGroups: + case LayoutDocEntry::MemberGroups: + case LayoutDocEntry::MemberDecl: + case LayoutDocEntry::MemberDeclEnd: + case LayoutDocEntry::MemberDefStart: + case LayoutDocEntry::NamespaceInlineClasses: + case LayoutDocEntry::MemberDef: + case LayoutDocEntry::MemberDefEnd: + case LayoutDocEntry::ClassInheritanceGraph: + case LayoutDocEntry::ClassNestedClasses: + case LayoutDocEntry::ClassCollaborationGraph: + case LayoutDocEntry::ClassAllMembersLink: + case LayoutDocEntry::ClassUsedFiles: + case LayoutDocEntry::ClassInlineClasses: + case LayoutDocEntry::FileClasses: + case LayoutDocEntry::FileConcepts: + case LayoutDocEntry::FileInterfaces: + case LayoutDocEntry::FileStructs: + case LayoutDocEntry::FileExceptions: + case LayoutDocEntry::FileNamespaces: + case LayoutDocEntry::FileConstantGroups: + case LayoutDocEntry::FileIncludes: + case LayoutDocEntry::FileIncludeGraph: + case LayoutDocEntry::FileIncludedByGraph: + case LayoutDocEntry::FileInlineClasses: + case LayoutDocEntry::FileSourceLink: + case LayoutDocEntry::GroupClasses: + case LayoutDocEntry::GroupConcepts: + case LayoutDocEntry::GroupInlineClasses: + case LayoutDocEntry::GroupNamespaces: + case LayoutDocEntry::GroupDirs: + case LayoutDocEntry::GroupNestedGroups: + case LayoutDocEntry::GroupFiles: + case LayoutDocEntry::GroupGraph: + case LayoutDocEntry::GroupPageDocs: + case LayoutDocEntry::DirSubDirs: + case LayoutDocEntry::DirFiles: + case LayoutDocEntry::DirGraph: + err("Internal inconsistency: member %d should not be part of " + "LayoutDocManager::Namespace entry list\n",lde->kind()); + break; + } + } + + //---------------------------------------- end flexible part ------------------------------- + + ol.endContents(); + + endFileWithNavPath(this,ol); +} + +void ConceptDefImpl::writeDeclarationLink(OutputList &ol,bool &found,const QCString &header,bool localNames) const +{ + if (isLinkable()) + { + if (!found) // first concept + { + ol.startMemberHeader("concepts"); + if (!header.isEmpty()) + { + ol.parseText(header); + } + else + { + theTranslator->trConcept(true,false); + } + ol.endMemberHeader(); + ol.startMemberList(); + found=TRUE; + } + ol.startMemberDeclaration(); + ol.startMemberItem(anchor(),FALSE); + ol.writeString("concept "); + QCString cname = displayName(!localNames); + ol.insertMemberAlign(); + if (isLinkable()) + { + ol.writeObjectLink(getReference(), + getOutputFileBase(), + anchor(), + cname + ); + } + else + { + ol.startBold(); + ol.docify(cname); + ol.endBold(); + } + ol.endMemberItem(); + // add the brief description if available + if (!briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) + { + DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0, + briefDescription(),FALSE,FALSE, + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + if (rootNode && !rootNode->isEmpty()) + { + ol.startMemberDescription(anchor()); + ol.writeDoc(rootNode,this,0); + ol.endMemberDescription(); + } + delete rootNode; + } + ol.endMemberDeclaration(anchor(),QCString()); + } +} + +void ConceptDefImpl::findSectionsInDocumentation() +{ + docFindSections(briefDescription(),this,docFile()); + docFindSections(documentation(),this,docFile()); +} + +//------------------------------------------------------------------------------------ + +bool ConceptLinkedRefMap::declVisible() const +{ + bool hideUndocClasses = Config_getBool(HIDE_UNDOC_CLASSES); + for (const auto &cd : *this) + { + bool isLink = cd->isLinkable(); + if (isLink || !hideUndocClasses) + { + return true; + } + } + return false; +} + +void ConceptLinkedRefMap::writeDeclaration(OutputList &ol,const QCString &header,bool localNames) const +{ + bool found=FALSE; + for (const auto &cd : *this) + { + cd->writeDeclarationLink(ol,found,header,localNames); + } + if (found) ol.endMemberList(); +} + +//------------------------------------------------------------------------------------ + +// --- Cast functions +// +ConceptDef *toConceptDef(Definition *d) +{ + if (d && (typeid(*d)==typeid(ConceptDefImpl) || typeid(*d)==typeid(ConceptDefAliasImpl))) + { + return static_cast<ConceptDef*>(d); + } + else + { + return 0; + } +} + +ConceptDef *toConceptDef(DefinitionMutable *md) +{ + Definition *d = toDefinition(md); + if (d && typeid(*d)==typeid(ConceptDefImpl)) + { + return static_cast<ConceptDef*>(d); + } + else + { + return 0; + } +} + +const ConceptDef *toConceptDef(const Definition *d) +{ + if (d && (typeid(*d)==typeid(ConceptDefImpl) || typeid(*d)==typeid(ConceptDefAliasImpl))) + { + return static_cast<const ConceptDef*>(d); + } + else + { + return 0; + } +} + +ConceptDefMutable *toConceptDefMutable(Definition *d) +{ + if (d && typeid(*d)==typeid(ConceptDefImpl)) + { + return static_cast<ConceptDefMutable*>(d); + } + else + { + return 0; + } +} + +ConceptDefMutable *toConceptDefMutable(const Definition *d) +{ + if (d && typeid(*d)==typeid(ConceptDefImpl)) + { + return const_cast<ConceptDefMutable*>(static_cast<const ConceptDefMutable*>(d)); + } + else + { + return 0; + } +} + + + diff --git a/src/conceptdef.h b/src/conceptdef.h new file mode 100644 index 0000000..9a2075c --- /dev/null +++ b/src/conceptdef.h @@ -0,0 +1,82 @@ +/****************************************************************************** + * + * Copyright (C) 1997-2021 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#ifndef CONCEPTDEF_H +#define CONCEPTDEF_H + +#include "definition.h" +#include "filedef.h" + +class ConceptDef : public Definition +{ + public: + virtual DefType definitionType() const = 0; + virtual QCString getOutputFileBase() const = 0; + virtual bool hasDetailedDescription() const = 0; + virtual QCString displayName(bool includeScope=true) const = 0; + virtual const IncludeInfo *includeInfo() const = 0; + virtual ArgumentList getTemplateParameterList() const = 0; + virtual QCString anchor() const = 0; + virtual bool isLinkableInProject() const = 0; + virtual bool isLinkable() const = 0; + virtual QCString initializer() const = 0; + virtual void writeDeclarationLink(OutputList &ol,bool &found, + const QCString &header,bool localNames) const = 0; + virtual const NamespaceDef *getNamespaceDef() const = 0; + virtual const FileDef *getFileDef() const = 0; +}; + +class ConceptDefMutable : public DefinitionMutable, public ConceptDef +{ + public: + virtual void setIncludeFile(FileDef *fd,const QCString &incName,bool local,bool force) = 0; + virtual void setTemplateArguments(const ArgumentList &al) = 0; + virtual void setNamespace(NamespaceDef *nd) = 0; + virtual void setFileDef(FileDef *fd) = 0; + virtual void writeTagFile(TextStream &) = 0; + virtual void writeDocumentation(OutputList &ol) = 0; + virtual void setInitializer(const QCString &init) = 0; + virtual void findSectionsInDocumentation() = 0; +}; + +ConceptDefMutable *createConceptDef( + const QCString &fileName,int startLine,int startColumn,const QCString &name, + const QCString &tagRef=QCString(),const QCString &tagFile=QCString()); + +ConceptDef *createConceptDefAlias(const Definition *newScope,const ConceptDef *cd); + +// ---- Map + +class ConceptLinkedMap : public LinkedMap<ConceptDef> +{ +}; + +class ConceptLinkedRefMap : public LinkedRefMap<const ConceptDef> +{ + public: + bool declVisible() const; + void writeDeclaration(OutputList &ol,const QCString &header,bool localNames) const; + void writeDocumentation(OutputList &ol,const Definition * container=0) const; +}; + +// ---- Cast functions + +ConceptDef *toConceptDef(Definition *d); +ConceptDef *toConceptDef(DefinitionMutable *d); +const ConceptDef *toConceptDef(const Definition *d); +ConceptDefMutable *toConceptDefMutable(Definition *d); +ConceptDefMutable *toConceptDefMutable(const Definition *d); + +#endif diff --git a/src/condparser.cpp b/src/condparser.cpp index ac6ff61..b968878 100644 --- a/src/condparser.cpp +++ b/src/condparser.cpp @@ -33,15 +33,16 @@ * - On error, an error message is returned. * - On success, the result of the expression is either "1" or "0". */ -bool CondParser::parse(const char *fileName,int lineNr,const char *expr) +bool CondParser::parse(const QCString &fileName,int lineNr,const QCString &expr) { + if (expr.isEmpty()) return false; m_expr = expr; m_tokenType = NOTHING; // initialize all variables - m_e = m_expr; // let m_e point to the start of the expression + m_e = m_expr.data(); // let m_e point to the start of the expression - bool answer=FALSE; + bool answer=false; getToken(); if (m_tokenType==DELIMITER && m_token.isEmpty()) { @@ -50,35 +51,11 @@ bool CondParser::parse(const char *fileName,int lineNr,const char *expr) else if (m_err.isEmpty()) { answer = parseLevel1(); - -#if 0 - // check for garbage at the end of the expression - // an expression ends with a character '\0' and token_type = delimiter - if (m_tokenType!=DELIMITER || !m_token.isEmpty()) - { - if (m_tokenType == DELIMITER) - { - if (m_token=="(" || m_token==")") - { - m_err=QCString("Unexpected parenthesis ")+m_token+"'"; - } - else - { - // user entered a not existing operator like "//" - m_err=QCString("Unexpected operator ")+m_token+"'"; - } - } - else - { - m_err=QCString("Unexpected part '")+m_token+"'"; - } - } -#endif } - if (m_err) + if (!m_err.isEmpty()) { warn(fileName,lineNr,"problem evaluating expression '%s': %s", - expr,m_err.data()); + qPrint(expr),qPrint(m_err)); } //printf("expr='%s' answer=%d\n",expr,answer); return answer; @@ -303,9 +280,9 @@ bool CondParser::evalOperator(int opId, bool lhs, bool rhs) /** * evaluate a variable */ -bool CondParser::evalVariable(const char *varName) +bool CondParser::evalVariable(const QCString &varName) { const StringVector &list = Config_getList(ENABLED_SECTIONS); - return std::find(list.begin(),list.end(),varName)!=list.end(); + return std::find(list.begin(),list.end(),varName.str())!=list.end(); } diff --git a/src/condparser.h b/src/condparser.h index 692793c..a2f806e 100644 --- a/src/condparser.h +++ b/src/condparser.h @@ -29,7 +29,7 @@ class CondParser // public functions public: CondParser() : m_e(0), m_tokenType(NOTHING) {} - bool parse(const char *fileName,int lineNr,const char *expr); + bool parse(const QCString &fileName,int lineNr,const QCString &expr); // enumerations private: @@ -68,7 +68,7 @@ class CondParser bool parseVar(); bool evalOperator(const int opId, bool lhs, bool rhs); - bool evalVariable(const char *varName); + bool evalVariable(const QCString &varName); int getOperatorId(const QCString &opName); }; diff --git a/src/config.h b/src/config.h index 6d74817..1858897 100644 --- a/src/config.h +++ b/src/config.h @@ -16,8 +16,6 @@ #ifndef CONFIG_H #define CONFIG_H -#include <ostream> - // note: this header file is generated from config.xml #include "configvalues.h" @@ -44,6 +42,8 @@ //#endif //! @} +class TextStream; + /** \brief Public function to deal with the configuration file. */ namespace Config { @@ -54,23 +54,23 @@ namespace Config * is \c TRUE the description of each configuration option will * be omitted. */ - void writeTemplate(std::ostream &t,bool shortList,bool updateOnly=FALSE); + void writeTemplate(TextStream &t,bool shortList,bool updateOnly=FALSE); /*! Writes a the differences between the current configuration and the * template configuration to stream \a t. */ - void compareDoxyfile(std::ostream &t); + void compareDoxyfile(TextStream &t); /*! Writes a the used settings of the current configuartion as XML format * to stream \a t. */ - void writeXMLDoxyfile(std::ostream &t); + void writeXMLDoxyfile(TextStream &t); /*! Parses a configuration file with name \a fn. * \returns TRUE if successful, FALSE if the file could not be * opened or read. */ - bool parse(const char *fileName,bool update=FALSE); + bool parse(const QCString &fileName,bool update=FALSE); /*! Post processed the parsed data. Replaces raw string values by the actual values. * and replaces environment variables. diff --git a/src/config.xml b/src/config.xml index 080230c..f3f4e5c 100644 --- a/src/config.xml +++ b/src/config.xml @@ -819,7 +819,7 @@ Go to the <a href="commands.html">next</a> section or return to the to get more control over the balance between CPU load and processing speed. At this moment only the input processing can be done using multiple threads. Since this is still an experimental feature the default is set to 1, - which efficively disables parallel processing. Please report any issues you + which effectively disables parallel processing. Please report any issues you encounter. Generating dot graphs in parallel is controlled by the \c DOT_NUM_THREADS setting. ]]> @@ -2048,7 +2048,7 @@ hr.footer { <![CDATA[ The \c HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen will adjust the colors in the style sheet and background images - according to this color. Hue is specified as an angle on a colorwheel, + according to this color. Hue is specified as an angle on a color-wheel, see https://en.wikipedia.org/wiki/Hue for more information. For instance the value 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 purple, and 360 is red again. @@ -2060,7 +2060,7 @@ hr.footer { <![CDATA[ The \c HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors in the HTML output. For a value of 0 the output will use - grayscales only. A value of 255 will produce the most vivid colors. + gray-scales only. A value of 255 will produce the most vivid colors. ]]> </docs> </option> @@ -2184,7 +2184,7 @@ The \c DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. project file that can be read by Microsoft's HTML Help Workshop on Windows. In the beginning of 2021 Microsoft took the original page, with a.o. the download links, - offline the HTML help workshop was already many years in maintenance mode). + offline the HTML help workshop was already many years in maintenance mode). You can download the HTML help workshop from the web archives at <a href="http://web.archive.org/web/20160201063255/http://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe">Installation executable</a>. <br> @@ -2475,20 +2475,33 @@ The \c DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. ]]> </docs> </option> + <option type='enum' id='MATHJAX_VERSION' defval='MathJax_2' depends='USE_MATHJAX'> + <docs> +<![CDATA[ + With \c MATHJAX_VERSION it is possible to specify the MathJax version to be used. + Note that the different versions of MathJax have different requirements with regards to + the different settings, so it is possible that also other MathJax settings have to be changed + when switching between the different MathJax versions. +]]> + </docs> + <value name="MathJax_2"/> + <value name="MathJax_3"/> + </option> <option type='enum' id='MATHJAX_FORMAT' defval='HTML-CSS' depends='USE_MATHJAX'> <docs> <![CDATA[ When MathJax is enabled you can set the default output format to be used for the MathJax output. - See <a href="http://docs.mathjax.org/en/v2.7-latest/output.html">the MathJax site</a> - for more details. + For more details about the output format see <a href="http://docs.mathjax.org/en/v2.7-latest/output.html">MathJax version 2</a> + and <a href="http://docs.mathjax.org/en/latest/web/components/output.html">MathJax version 3</a>. ]]> </docs> - <value name="HTML-CSS" desc="(which is slower, but has the best compatibility)"/> - <value name="NativeMML" desc="(i.e. MathML)"/> + <value name="HTML-CSS" desc="(which is slower, but has the best compatibility. This is the name for Mathjax version 2, for MathJax version 3 this will be translated into \c chtml)"/> + <value name="NativeMML" desc="(i.e. MathML. Only supported for NathJax 2. For MathJax version 3 \c chtml will be used instead.)"/> + <value name="chtml" desc="(This is the name for Mathjax version 3, for MathJax version 2 this will be translated into \c HTML-CSS)"/> <value name="SVG"/> </option> - <option type='string' id='MATHJAX_RELPATH' format='string' defval='https://cdn.jsdelivr.net/npm/mathjax@2' depends='USE_MATHJAX'> + <option type='string' id='MATHJAX_RELPATH' format='string' depends='USE_MATHJAX'> <docs> <![CDATA[ When MathJax is enabled you need to specify the location relative to the @@ -2499,6 +2512,10 @@ The \c DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. the MathJax Content Delivery Network so you can quickly see the result without installing MathJax. However, it is strongly recommended to install a local copy of MathJax from https://www.mathjax.org before deployment. + + The default value is: + - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 + - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 ]]> </docs> </option> @@ -2506,10 +2523,15 @@ The \c DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. <docs> <![CDATA[ The \c MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax extension - names that should be enabled during MathJax rendering. For example + names that should be enabled during MathJax rendering. For example for MathJax version 2 + (see https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): \verbatim MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols \endverbatim +For example for MathJax version 3 (see http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +\verbatim +MATHJAX_EXTENSIONS = ams +\endverbatim ]]> </docs> </option> diff --git a/src/configgen.py b/src/configgen.py index 0d18e84..d3b9137 100755 --- a/src/configgen.py +++ b/src/configgen.py @@ -720,7 +720,7 @@ def main(): print(" StringVector ConfigValues::*l;"); print(" } value;"); print(" };"); - print(" const Info *get(const char *tag) const;"); + print(" const Info *get(const QCString &tag) const;"); print(" private:") for n in elem.childNodes: if n.nodeType == Node.ELEMENT_NODE: @@ -738,7 +738,7 @@ def main(): print("#include \"configimpl.h\"") print("#include <unordered_map>") print("") - print("const ConfigValues::Info *ConfigValues::get(const char *tag) const"); + print("const ConfigValues::Info *ConfigValues::get(const QCString &tag) const"); print("{"); print(" static const std::unordered_map< std::string, Info > configMap ="); print(" {"); @@ -747,7 +747,7 @@ def main(): if (n.nodeName == "group"): parseGroupMapInit(n) print(" };"); - print(" auto it = configMap.find(tag);"); + print(" auto it = configMap.find(tag.str());"); print(" return it!=configMap.end() ? &it->second : nullptr;"); print("}"); print("") diff --git a/src/configimpl.h b/src/configimpl.h index cfebcee..0cf909b 100644 --- a/src/configimpl.h +++ b/src/configimpl.h @@ -28,6 +28,7 @@ #include "containers.h" #include "qcstring.h" +class TextStream; /** Abstract base class for any configuration option. */ @@ -75,19 +76,19 @@ class ConfigOption void setUserComment(const QCString &u) { m_userComment += u; } protected: - virtual void writeTemplate(std::ostream &t,bool sl,bool upd) = 0; - virtual void compareDoxyfile(std::ostream &t) = 0; - virtual void writeXMLDoxyfile(std::ostream &t) = 0; + virtual void writeTemplate(TextStream &t,bool sl,bool upd) = 0; + virtual void compareDoxyfile(TextStream &t) = 0; + virtual void writeXMLDoxyfile(TextStream &t) = 0; virtual void convertStrToVal() {} virtual void emptyValueToDefault() {} virtual void substEnvVars() = 0; virtual void init() {} - virtual bool isDefault() {return true;} + virtual bool isDefault() { return true; } - void writeBoolValue(std::ostream &t,bool v,bool initSpace = true); - void writeIntValue(std::ostream &t,int i,bool initSpace = true); - void writeStringValue(std::ostream &t,const QCString &s,bool initSpace = true); - void writeStringList(std::ostream &t,const StringVector &l); + void writeBoolValue(TextStream &t,bool v,bool initSpace = true); + void writeIntValue(TextStream &t,int i,bool initSpace = true); + void writeStringValue(TextStream &t,const QCString &s,bool initSpace = true); + void writeStringList(TextStream &t,const StringVector &l); QCString m_spaces; QCString m_name; @@ -109,9 +110,9 @@ class ConfigInfo : public ConfigOption m_name = name; m_doc = doc; } - void writeTemplate(std::ostream &t, bool sl,bool); - void compareDoxyfile(std::ostream &){}; - void writeXMLDoxyfile(std::ostream &) {}; + void writeTemplate(TextStream &t, bool sl,bool); + void compareDoxyfile(TextStream &) {} + void writeXMLDoxyfile(TextStream &) {} void substEnvVars() {} }; @@ -133,9 +134,9 @@ class ConfigList : public ConfigOption WidgetType widgetType() const { return m_widgetType; } StringVector *valueRef() { return &m_value; } StringVector getDefault() { return m_defaultValue; } - void writeTemplate(std::ostream &t,bool sl,bool); - void compareDoxyfile(std::ostream &t); - void writeXMLDoxyfile(std::ostream &t); + void writeTemplate(TextStream &t,bool sl,bool); + void compareDoxyfile(TextStream &t); + void writeXMLDoxyfile(TextStream &t); void substEnvVars(); void init() { m_value = m_defaultValue; } bool isDefault(); @@ -162,12 +163,12 @@ class ConfigEnum : public ConfigOption const std::vector<QCString> &values() const { return m_valueRange; } QCString *valueRef() { return &m_value; } void substEnvVars(); - void writeTemplate(std::ostream &t,bool sl,bool); + void writeTemplate(TextStream &t,bool sl,bool); void convertStrToVal(); - void compareDoxyfile(std::ostream &t); - void writeXMLDoxyfile(std::ostream &t); - void init() { m_value = m_defValue.copy(); } - bool isDefault() { return (m_value == m_defValue); } + void compareDoxyfile(TextStream &t); + void writeXMLDoxyfile(TextStream &t); + void init() { m_value = m_defValue; } + bool isDefault() { return m_value == m_defValue; } private: std::vector<QCString> m_valueRange; @@ -195,13 +196,13 @@ class ConfigString : public ConfigOption WidgetType widgetType() const { return m_widgetType; } void setDefaultValue(const char *v) { m_defValue = v; } QCString *valueRef() { return &m_value; } - void writeTemplate(std::ostream &t,bool sl,bool); - void compareDoxyfile(std::ostream &t); - void writeXMLDoxyfile(std::ostream &t); + void writeTemplate(TextStream &t,bool sl,bool); + void compareDoxyfile(TextStream &t); + void writeXMLDoxyfile(TextStream &t); void substEnvVars(); - void init() { m_value = m_defValue.copy(); } - void emptyValueToDefault() { if(m_value.isEmpty()) m_value=m_defValue; }; - bool isDefault() { return (m_value.stripWhiteSpace() == m_defValue.stripWhiteSpace()); } + void init() { m_value = m_defValue; } + void emptyValueToDefault() { if (m_value.isEmpty()) m_value=m_defValue; }; + bool isDefault() { return m_value.stripWhiteSpace() == m_defValue.stripWhiteSpace(); } private: QCString m_value; @@ -230,11 +231,11 @@ class ConfigInt : public ConfigOption int maxVal() const { return m_maxVal; } void convertStrToVal(); void substEnvVars(); - void writeTemplate(std::ostream &t,bool sl,bool upd); - void compareDoxyfile(std::ostream &t); - void writeXMLDoxyfile(std::ostream &t); + void writeTemplate(TextStream &t,bool sl,bool upd); + void compareDoxyfile(TextStream &t); + void writeXMLDoxyfile(TextStream &t); void init() { m_value = m_defValue; } - bool isDefault() { return (m_value == m_defValue); } + bool isDefault() { return m_value == m_defValue; } private: int m_value; int m_defValue; @@ -261,11 +262,11 @@ class ConfigBool : public ConfigOption void convertStrToVal(); void substEnvVars(); void setValueString(const QCString &v) { m_valueString = v; } - void writeTemplate(std::ostream &t,bool sl,bool upd); - void compareDoxyfile(std::ostream &t); - void writeXMLDoxyfile(std::ostream &t); + void writeTemplate(TextStream &t,bool sl,bool upd); + void compareDoxyfile(TextStream &t); + void writeXMLDoxyfile(TextStream &t); void init() { m_value = m_defValue; } - bool isDefault() { return (m_value == m_defValue); } + bool isDefault() { return m_value == m_defValue; } private: bool m_value; bool m_defValue; @@ -279,9 +280,9 @@ class ConfigObsolete : public ConfigOption public: ConfigObsolete(const char *name) : ConfigOption(O_Obsolete) { m_name = name; } - void writeTemplate(std::ostream &,bool,bool); - void compareDoxyfile(std::ostream &) {} - void writeXMLDoxyfile(std::ostream &) {}; + void writeTemplate(TextStream &,bool,bool); + void compareDoxyfile(TextStream &) {} + void writeXMLDoxyfile(TextStream &) {} void substEnvVars() {} }; @@ -292,9 +293,9 @@ class ConfigDisabled : public ConfigOption public: ConfigDisabled(const char *name) : ConfigOption(O_Disabled) { m_name = name; } - void writeTemplate(std::ostream &,bool,bool); - void compareDoxyfile(std::ostream &) {} - void writeXMLDoxyfile(std::ostream &) {}; + void writeTemplate(TextStream &,bool,bool); + void compareDoxyfile(TextStream &) {} + void writeXMLDoxyfile(TextStream &) {} void substEnvVars() {} }; @@ -378,9 +379,9 @@ class ConfigImpl /*! Returns the ConfigOption corresponding with \a name or 0 if * the option is not supported. */ - ConfigOption *get(const char *name) const + ConfigOption *get(const QCString &name) const { - auto it = m_dict.find(name); + auto it = m_dict.find(name.str()); return it!=m_dict.end() ? it->second : nullptr; } /* @} */ @@ -488,17 +489,17 @@ class ConfigImpl * is \c TRUE the description of each configuration option will * be omitted. */ - void writeTemplate(std::ostream &t,bool shortIndex,bool updateOnly); + void writeTemplate(TextStream &t,bool shortIndex,bool updateOnly); /*! Writes a the differences between the current configuration and the * template configuration to stream \a t. */ - void compareDoxyfile(std::ostream &t); + void compareDoxyfile(TextStream &t); /*! Writes a the used settings of the current configuartion as XML format * to stream \a t. */ - void writeXMLDoxyfile(std::ostream &t); + void writeXMLDoxyfile(TextStream &t); void setHeader(const char *header) { m_header = header; } @@ -527,14 +528,13 @@ class ConfigImpl * \returns TRUE if successful, or FALSE if the string could not be * parsed. */ - //bool parseString(const char *fn,const char *str); - bool parseString(const char *fn,const char *str,bool upd = FALSE); + bool parseString(const QCString &fn,const QCString &str,bool upd = FALSE); /*! Parse a configuration file with name \a fn. * \returns TRUE if successful, FALSE if the file could not be * opened or read. */ - bool parse(const char *fn,bool upd = FALSE); + bool parse(const QCString &fn,bool upd = FALSE); /*! Called from the constructor, will add doxygen's default options * to the configuration object diff --git a/src/configimpl.l b/src/configimpl.l index 2e3b5e7..98b1f5b 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -41,6 +41,7 @@ #include "configoptions.h" #include "fileinfo.h" #include "dir.h" +#include "textstream.h" #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 @@ -58,14 +59,14 @@ void config_err(const char *fmt, ...) { va_list args; va_start(args, fmt); - vfprintf(stderr, (QCString(error_str) + fmt).data(), args); + vfprintf(stderr, qPrint(QCString(error_str) + fmt), args); va_end(args); } void config_term(const char *fmt, ...) { va_list args; va_start(args, fmt); - vfprintf(stderr, (QCString(error_str) + fmt).data(), args); + vfprintf(stderr, qPrint(QCString(error_str) + fmt), args); va_end(args); fprintf(stderr, "%s\n", "Exiting..."); exit(1); @@ -75,14 +76,14 @@ void config_warn(const char *fmt, ...) { va_list args; va_start(args, fmt); - vfprintf(stderr, (QCString(warning_str) + fmt).data(), args); + vfprintf(stderr, qPrint(QCString(warning_str) + fmt), args); va_end(args); } static QCString configStringRecode( const QCString &str, - const char *fromEncoding, - const char *toEncoding); + const QCString &fromEncoding, + const QCString &toEncoding); #define MAX_INCLUDE_DEPTH 10 #define YY_NEVER_INTERACTIVE 1 @@ -91,7 +92,7 @@ static QCString configStringRecode( */ static QCString convertToComment(const QCString &s, const QCString &u) { - //printf("convertToComment(%s)=%s\n",s.data(),u.data()); + //printf("convertToComment(%s)=%s\n",qPrint(s),qPrint(u)); QCString result; if (!s.isEmpty()) { @@ -128,24 +129,25 @@ static QCString convertToComment(const QCString &s, const QCString &u) return result; } -void ConfigOption::writeBoolValue(std::ostream &t,bool v,bool initSpace) +void ConfigOption::writeBoolValue(TextStream &t,bool v,bool initSpace) { if (initSpace) t << " "; if (v) t << "YES"; else t << "NO"; } -void ConfigOption::writeIntValue(std::ostream &t,int i,bool initSpace) +void ConfigOption::writeIntValue(TextStream &t,int i,bool initSpace) { if (initSpace) t << " "; t << i; } -void ConfigOption::writeStringValue(std::ostream &t,const QCString &s,bool initSpace) +void ConfigOption::writeStringValue(TextStream &t,const QCString &s,bool initSpace) { char c; bool needsEscaping=FALSE; // convert the string back to it original g_encoding QCString se = configStringRecode(s,"UTF-8",m_encoding); + if (se.isEmpty()) return; const char *p=se.data(); if (p) { @@ -171,7 +173,7 @@ void ConfigOption::writeStringValue(std::ostream &t,const QCString &s,bool initS } } -void ConfigOption::writeStringList(std::ostream &t,const StringVector &l) +void ConfigOption::writeStringList(TextStream &t,const StringVector &l) { bool first=TRUE; for (const auto &p : l) @@ -199,7 +201,7 @@ void ConfigInt::convertStrToVal() if (!ok || val<m_minVal || val>m_maxVal) { config_warn("argument '%s' for option %s is not a valid number in the range [%d..%d]!\n" - "Using the default: %d!\n",m_valueString.data(),m_name.data(),m_minVal,m_maxVal,m_value); + "Using the default: %d!\n",qPrint(m_valueString),qPrint(m_name),m_minVal,m_maxVal,m_value); } else { @@ -224,7 +226,7 @@ void ConfigBool::convertStrToVal() else { config_warn("argument '%s' for option %s is not a valid boolean value\n" - "Using the default: %s!\n",m_valueString.data(),m_name.data(),m_value?"YES":"NO"); + "Using the default: %s!\n",qPrint(m_valueString),qPrint(m_name),m_value?"YES":"NO"); } } } @@ -247,7 +249,7 @@ void ConfigEnum::convertStrToVal() } config_warn("argument '%s' for option %s is not a valid enum value\n" - "Using the default: %s!\n",m_value.data(),m_name.data(),m_defValue.data()); + "Using the default: %s!\n",qPrint(m_value),qPrint(m_name),qPrint(m_defValue)); m_value = m_defValue; } @@ -323,7 +325,7 @@ bool &ConfigImpl::getBool(const char *fileName,int num,const char *name) const /* ------------------------------------------ */ -void ConfigInfo::writeTemplate(std::ostream &t, bool sl,bool) +void ConfigInfo::writeTemplate(TextStream &t, bool sl,bool) { if (!sl) { @@ -334,7 +336,7 @@ void ConfigInfo::writeTemplate(std::ostream &t, bool sl,bool) t << "#---------------------------------------------------------------------------\n"; } -void ConfigList::writeTemplate(std::ostream &t,bool sl,bool) +void ConfigList::writeTemplate(TextStream &t,bool sl,bool) { if (!sl) { @@ -355,8 +357,8 @@ bool ConfigList::isDefault() { auto get_stripped = [](std::string s) { return QCString(s.c_str()).stripWhiteSpace(); }; auto is_not_empty = [get_stripped](std::string s) { return !get_stripped(s).isEmpty(); }; - int defCnt = std::count_if( m_value.begin(), m_value.end(),is_not_empty); - int valCnt = std::count_if(m_defaultValue.begin(),m_defaultValue.end(),is_not_empty); + size_t defCnt = std::count_if( m_value.begin(), m_value.end(),is_not_empty); + size_t valCnt = std::count_if(m_defaultValue.begin(),m_defaultValue.end(),is_not_empty); if ( valCnt != defCnt) { return false; @@ -383,12 +385,12 @@ bool ConfigList::isDefault() return true; } -void ConfigList::compareDoxyfile(std::ostream &t) +void ConfigList::compareDoxyfile(TextStream &t) { if (!isDefault()) writeTemplate(t,TRUE,TRUE); } -void ConfigList::writeXMLDoxyfile(std::ostream &t) +void ConfigList::writeXMLDoxyfile(TextStream &t) { t << " <option id='" << m_name << "'"; t << " default='" << (isDefault() ? "yes" : "no") << "'"; @@ -407,7 +409,7 @@ void ConfigList::writeXMLDoxyfile(std::ostream &t) t << " </option>\n"; } -void ConfigEnum::writeTemplate(std::ostream &t,bool sl,bool) +void ConfigEnum::writeTemplate(TextStream &t,bool sl,bool) { if (!sl) { @@ -424,12 +426,12 @@ void ConfigEnum::writeTemplate(std::ostream &t,bool sl,bool) t << "\n"; } -void ConfigEnum::compareDoxyfile(std::ostream &t) +void ConfigEnum::compareDoxyfile(TextStream &t) { if (!isDefault()) writeTemplate(t,TRUE,TRUE); } -void ConfigEnum::writeXMLDoxyfile(std::ostream &t) +void ConfigEnum::writeXMLDoxyfile(TextStream &t) { t << " <option id='" << m_name << "'"; t << " default='" << (isDefault() ? "yes" : "no") << "'"; @@ -441,7 +443,7 @@ void ConfigEnum::writeXMLDoxyfile(std::ostream &t) t << "</option>\n"; } -void ConfigString::writeTemplate(std::ostream &t,bool sl,bool) +void ConfigString::writeTemplate(TextStream &t,bool sl,bool) { if (!sl) { @@ -458,12 +460,12 @@ void ConfigString::writeTemplate(std::ostream &t,bool sl,bool) t << "\n"; } -void ConfigString::compareDoxyfile(std::ostream &t) +void ConfigString::compareDoxyfile(TextStream &t) { if (!isDefault()) writeTemplate(t,TRUE,TRUE); } -void ConfigString::writeXMLDoxyfile(std::ostream &t) +void ConfigString::writeXMLDoxyfile(TextStream &t) { t << " <option id='" << m_name << "'"; t << " default='" << (isDefault() ? "yes" : "no") << "'"; @@ -477,7 +479,7 @@ void ConfigString::writeXMLDoxyfile(std::ostream &t) t << "</option>\n"; } -void ConfigInt::writeTemplate(std::ostream &t,bool sl,bool upd) +void ConfigInt::writeTemplate(TextStream &t,bool sl,bool upd) { if (!sl) { @@ -501,12 +503,12 @@ void ConfigInt::writeTemplate(std::ostream &t,bool sl,bool upd) t << "\n"; } -void ConfigInt::compareDoxyfile(std::ostream &t) +void ConfigInt::compareDoxyfile(TextStream &t) { if (!isDefault()) writeTemplate(t,TRUE,TRUE); } -void ConfigInt::writeXMLDoxyfile(std::ostream &t) +void ConfigInt::writeXMLDoxyfile(TextStream &t) { t << " <option id='" << m_name << "'"; t << " default='" << (isDefault() ? "yes" : "no") << "'"; @@ -518,8 +520,7 @@ void ConfigInt::writeXMLDoxyfile(std::ostream &t) t << "</option>\n"; } - -void ConfigBool::writeTemplate(std::ostream &t,bool sl,bool upd) +void ConfigBool::writeTemplate(TextStream &t,bool sl,bool upd) { if (!sl) { @@ -544,12 +545,12 @@ void ConfigBool::writeTemplate(std::ostream &t,bool sl,bool upd) t << "\n"; } -void ConfigBool::compareDoxyfile(std::ostream &t) +void ConfigBool::compareDoxyfile(TextStream &t) { if (!isDefault()) writeTemplate(t,TRUE,TRUE); } -void ConfigBool::writeXMLDoxyfile(std::ostream &t) +void ConfigBool::writeXMLDoxyfile(TextStream &t) { t << " <option id='" << m_name << "'"; t << " default='" << (isDefault() ? "yes" : "no") << "'"; @@ -561,9 +562,8 @@ void ConfigBool::writeXMLDoxyfile(std::ostream &t) t << "</option>\n"; } - -void ConfigObsolete::writeTemplate(std::ostream &,bool,bool) {} -void ConfigDisabled::writeTemplate(std::ostream &,bool,bool) {} +void ConfigObsolete::writeTemplate(TextStream &,bool,bool) {} +void ConfigDisabled::writeTemplate(TextStream &,bool,bool) {} /* ----------------------------------------------------------------- * @@ -622,36 +622,34 @@ static yy_size_t yyread(char *buf,yy_size_t max_size) static QCString configStringRecode( const QCString &str, - const char *fromEncoding, - const char *toEncoding) + const QCString &inputEncoding, + const QCString &outputEncoding) { - QCString inputEncoding = fromEncoding; - QCString outputEncoding = toEncoding; if (inputEncoding.isEmpty() || outputEncoding.isEmpty() || inputEncoding==outputEncoding) return str; int inputSize=str.length(); int outputSize=inputSize*4+1; QCString output(outputSize); - void *cd = portable_iconv_open(outputEncoding,inputEncoding); + void *cd = portable_iconv_open(outputEncoding.data(),inputEncoding.data()); if (cd==(void *)(-1)) { config_term("Error: unsupported character conversion: '%s'->'%s'\n", - inputEncoding.data(),outputEncoding.data()); + qPrint(inputEncoding),qPrint(outputEncoding)); } size_t iLeft=(size_t)inputSize; size_t oLeft=(size_t)outputSize; - char *inputPtr = str.rawData(); + const char *inputPtr = str.data(); char *outputPtr = output.rawData(); if (!portable_iconv(cd, &inputPtr, &iLeft, &outputPtr, &oLeft)) { outputSize-=(int)oLeft; output.resize(outputSize+1); output.at(outputSize)='\0'; - //printf("iconv: input size=%d output size=%d\n[%s]\n",size,newSize,srcBuf.data()); + //printf("iconv: input size=%d output size=%d\n[%s]\n",size,newSize,qPrint(srcBuf)); } else { config_term("Error: failed to translate characters from %s to %s: %s\n", - inputEncoding.data(),outputEncoding.data(),strerror(errno)); + qPrint(inputEncoding),qPrint(outputEncoding),strerror(errno)); } portable_iconv_close(cd); return output; @@ -732,7 +730,7 @@ static void processString() if (!warned) { config_warn("Invalid value for '%s' tag at line %d, file %s: Value '%s' is not properly quoted\n", - g_cmd.data(),g_yyLineNr,g_yyFileName.data(),g_string->stripWhiteSpace().data()); + qPrint(g_cmd),g_yyLineNr,qPrint(g_yyFileName),qPrint(g_string->stripWhiteSpace())); } warned=true; } @@ -748,14 +746,14 @@ static void processString() // update encoding checkEncoding(); - //printf("Processed string '%s'\n",g_string->data()); + //printf("Processed string '%s'\n",qPrint(g_string)); } static void processList() { bool allowCommaAsSeparator = g_cmd!="PREDEFINED"; - const QCString s = stripComment(g_listStr.stripWhiteSpace()); + QCString s = stripComment(g_listStr.stripWhiteSpace()); int l = s.length(); QCString elemStr; @@ -766,7 +764,7 @@ static void processList() if (!elemStr.isEmpty()) { QCString e = configStringRecode(elemStr,g_encoding,"UTF-8"); - //printf("Processed list element '%s'\n",e.data()); + //printf("Processed list element '%s'\n",qPrint(e)); g_list->push_back(e.str()); elemStr=""; } @@ -818,7 +816,7 @@ static void processList() if (!warned) { config_warn("Invalid value for '%s' tag at line %d, file %s: Values in list '%s' are not properly space %sseparated\n", - g_cmd.data(),g_yyLineNr,g_yyFileName.data(),g_listStr.stripWhiteSpace().data(),allowCommaAsSeparator?"or comma ":""); + qPrint(g_cmd),g_yyLineNr,qPrint(g_yyFileName),qPrint(g_listStr.stripWhiteSpace()),allowCommaAsSeparator?"or comma ":""); warned=true; } needsSeparator=false; @@ -836,18 +834,18 @@ static void processList() if (insideQuote) { config_warn("Invalid value for '%s' tag at line %d, file %s: Values in list '%s' are not properly quoted\n", - g_cmd.data(),g_yyLineNr,g_yyFileName.data(),g_listStr.stripWhiteSpace().data()); + qPrint(g_cmd),g_yyLineNr,qPrint(g_yyFileName),qPrint(g_listStr.stripWhiteSpace())); } } -static FILE *tryPath(const char *path,const char *fileName) +static FILE *tryPath(const QCString &path,const QCString &fileName) { - QCString absName=(path ? (QCString)path+"/"+fileName : (QCString)fileName); + QCString absName=(!path.isEmpty() ? path+"/"+fileName : fileName); FileInfo fi(absName.str()); if (fi.exists() && fi.isFile()) { FILE *f=Portable::fopen(absName,"r"); - if (!f) config_err("could not open file %s for reading\n",absName.data()); + if (!f) config_err("could not open file %s for reading\n",qPrint(absName)); return f; } return 0; @@ -856,15 +854,15 @@ static FILE *tryPath(const char *path,const char *fileName) static void substEnvVarsInStrList(StringVector &sl); static void substEnvVarsInString(QCString &s); -static FILE *findFile(const char *fileName) +static FILE *findFile(const QCString &fileName) { - if (fileName==0) + if (fileName.isEmpty()) { return 0; } if (Portable::isAbsolutePath(fileName)) { - return tryPath(NULL, fileName); + return tryPath(QCString(), fileName); } substEnvVarsInStrList(g_includePathList); for (const auto &s : g_includePathList) @@ -876,11 +874,11 @@ static FILE *findFile(const char *fileName) return tryPath(".",fileName); } -static void readIncludeFile(const char *incName) +static void readIncludeFile(const QCString &incName) { if (g_includeStack.size()==MAX_INCLUDE_DEPTH) { config_term("maximum include depth (%d) reached, %s is not included. Aborting...\n", - MAX_INCLUDE_DEPTH,incName); + MAX_INCLUDE_DEPTH,qPrint(incName)); } QCString inc = incName; @@ -899,7 +897,7 @@ static void readIncludeFile(const char *incName) // For debugging #if SHOW_INCLUDES for (size_t i=0;i<g_includeStack.size();i++) msg(" "); - msg("@INCLUDE = %s: parsing...\n",inc.data()); + msg("@INCLUDE = %s: parsing...\n",qPrint(inc)); #endif // store the state of the old file @@ -917,7 +915,7 @@ static void readIncludeFile(const char *incName) } else { - config_term("@INCLUDE = %s: not found!\n",inc.data()); + config_term("@INCLUDE = %s: not found!\n",qPrint(inc)); } } @@ -955,7 +953,7 @@ static void readIncludeFile(const char *incName) if (option==0) // oops not known { config_warn("ignoring unsupported tag '%s' at line %d, file %s\n", - g_cmd.data(),g_yyLineNr,g_yyFileName.data()); + qPrint(g_cmd),g_yyLineNr,qPrint(g_yyFileName)); BEGIN(SkipInvalid); } else // known tag @@ -998,13 +996,13 @@ static void readIncludeFile(const char *incName) if (g_configUpdate) { config_warn("Tag '%s' at line %d of file '%s' has become obsolete.\n" - " This tag has been removed.\n", g_cmd.data(),g_yyLineNr,g_yyFileName.data()); + " This tag has been removed.\n", qPrint(g_cmd),g_yyLineNr,qPrint(g_yyFileName)); } else { config_warn("Tag '%s' at line %d of file '%s' has become obsolete.\n" " To avoid this warning please remove this line from your configuration " - "file or upgrade it using \"doxygen -u\"\n", g_cmd.data(),g_yyLineNr,g_yyFileName.data()); + "file or upgrade it using \"doxygen -u\"\n", qPrint(g_cmd),g_yyLineNr,qPrint(g_yyFileName)); } BEGIN(SkipInvalid); break; @@ -1012,13 +1010,13 @@ static void readIncludeFile(const char *incName) if (g_configUpdate) { config_warn("Tag '%s' at line %d of file '%s' belongs to an option that was not enabled at compile time.\n" - " This tag has been removed.\n", g_cmd.data(),g_yyLineNr,g_yyFileName.data()); + " This tag has been removed.\n", qPrint(g_cmd),g_yyLineNr,qPrint(g_yyFileName)); } else { config_warn("Tag '%s' at line %d of file '%s' belongs to an option that was not enabled at compile time.\n" " To avoid this warning please remove this line from your configuration " - "file or upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", g_cmd.data(),g_yyLineNr,g_yyFileName.data()); + "file or upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", qPrint(g_cmd),g_yyLineNr,qPrint(g_yyFileName)); } BEGIN(SkipInvalid); break; @@ -1031,7 +1029,7 @@ static void readIncludeFile(const char *incName) if (option==0) // oops not known { config_warn("ignoring unsupported tag '%s' at line %d, file %s\n", - g_cmd.data(),g_yyLineNr,g_yyFileName.data()); + qPrint(g_cmd),g_yyLineNr,qPrint(g_yyFileName)); BEGIN(SkipInvalid); } else // known tag @@ -1053,19 +1051,19 @@ static void readIncludeFile(const char *incName) case ConfigOption::O_Int: case ConfigOption::O_Bool: config_warn("operator += not supported for '%s'. Ignoring line at line %d, file %s\n", - yytext,g_yyLineNr,g_yyFileName.data()); + yytext,g_yyLineNr,qPrint(g_yyFileName)); BEGIN(SkipInvalid); break; case ConfigOption::O_Obsolete: config_warn("Tag '%s' at line %d of file %s has become obsolete.\n" "To avoid this warning please update your configuration " - "file using \"doxygen -u\"\n", g_cmd.data(),g_yyLineNr,g_yyFileName.data()); + "file using \"doxygen -u\"\n", qPrint(g_cmd),g_yyLineNr,qPrint(g_yyFileName)); BEGIN(SkipInvalid); break; case ConfigOption::O_Disabled: config_warn("Tag '%s' at line %d of file %s belongs to an option that was not enabled at compile time.\n" "To avoid this warning please remove this line from your configuration " - "file, upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", g_cmd.data(),g_yyLineNr,g_yyFileName.data()); + "file, upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", qPrint(g_cmd),g_yyLineNr,qPrint(g_yyFileName)); BEGIN(SkipInvalid); break; } @@ -1102,7 +1100,7 @@ static void readIncludeFile(const char *incName) } } -<Start>[a-z_A-Z0-9]+ { config_warn("ignoring unknown tag '%s' at line %d, file %s\n",yytext,g_yyLineNr,g_yyFileName.data()); } +<Start>[a-z_A-Z0-9]+ { config_warn("ignoring unknown tag '%s' at line %d, file %s\n",yytext,g_yyLineNr,qPrint(g_yyFileName)); } /*-------------- GetString ---------------*/ <GetString>\n { processString(); @@ -1152,17 +1150,17 @@ static void readIncludeFile(const char *incName) <*>\\[ \r\t]*\n { g_yyLineNr++; } <*>[ \t\r] <*>\n { g_yyLineNr++ ; } -<*>. { config_warn("ignoring unknown character '%c' at line %d, file %s\n",yytext[0],g_yyLineNr,g_yyFileName.data()); } +<*>. { config_warn("ignoring unknown character '%c' at line %d, file %s\n",yytext[0],g_yyLineNr,qPrint(g_yyFileName)); } %% /*@ ---------------------------------------------------------------------------- */ -void ConfigImpl::writeTemplate(std::ostream &t,bool sl,bool upd) +void ConfigImpl::writeTemplate(TextStream &t,bool sl,bool upd) { /* print first lines of user comment that were at the beginning of the file, might have special meaning for editors */ - if (m_startComment) + if (!m_startComment.isEmpty()) { t << takeStartComment() << "\n"; } @@ -1176,14 +1174,14 @@ void ConfigImpl::writeTemplate(std::ostream &t,bool sl,bool upd) option->writeTemplate(t,sl,upd); } /* print last lines of user comment that were at the end of the file */ - if (m_userComment) + if (!m_userComment.isEmpty()) { t << "\n"; t << takeUserComment(); } } -void ConfigImpl::compareDoxyfile(std::ostream &t) +void ConfigImpl::compareDoxyfile(TextStream &t) { t << "# Difference with default Doxyfile " << getFullVersion(); t << "\n"; @@ -1194,7 +1192,7 @@ void ConfigImpl::compareDoxyfile(std::ostream &t) } } -void ConfigImpl::writeXMLDoxyfile(std::ostream &t) +void ConfigImpl::writeXMLDoxyfile(TextStream &t) { t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"; t << "<doxyfile xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"doxyfile.xsd\" version=\"" << getDoxygenVersion() << "\" xml:lang=\"" << theTranslator->trISOLang() << "\">\n"; @@ -1261,7 +1259,7 @@ static void substEnvVarsInStrList(StringVector &sl) // here we strip the quote again substEnvVarsInString(result); - //printf("Result %s was quoted=%d\n",result.data(),wasQuoted); + //printf("Result %s was quoted=%d\n",qPrint(result),wasQuoted); if (!wasQuoted) /* as a result of the expansion, a single string may have expanded into a list, which we'll @@ -1373,7 +1371,7 @@ void ConfigImpl::init() if (opt==0) { config_term("Config option '%s' has invalid depends relation on unknown option '%s'\n", - option->name().data(),depName.data()); + qPrint(option->name()),qPrint(depName)); } } } @@ -1386,41 +1384,41 @@ void ConfigImpl::create() addConfigOptions(this); } -static QCString configFileToString(const char *name) +static QCString configFileToString(const QCString &name) { - if (name==0 || name[0]==0) return 0; + if (name.isEmpty()) return QCString(); auto stream2string = [](std::istream &in) -> std::string { std::string ret; char buffer[4096]; while (in.read(buffer, sizeof(buffer))) ret.append(buffer, sizeof(buffer)); - ret.append(buffer, in.gcount()); + ret.append(buffer, static_cast<uint>(in.gcount())); if (!ret.empty() && ret[ret.length()-1]!='\n') ret+='\n'; // to help the scanner return ret; }; - if (name[0]=='-' && name[1]==0) // read from stdin + if (name=="-") // read from stdin { // read contents from stdin into contents string return stream2string(std::cin); } else // read from file { - std::ifstream f(name,std::istream::in); + std::ifstream f(name.str(),std::istream::in); if (!f.is_open()) { - config_term("file '%s' not found or could not be opened\n",name); + config_term("file '%s' not found or could not be opened\n",qPrint(name)); return ""; } return stream2string(f); } } -bool ConfigImpl::parseString(const char *fn,const char *str,bool update) +bool ConfigImpl::parseString(const QCString &fn,const QCString &str,bool update) { g_config = ConfigImpl::instance(); - g_inputString = str; + g_inputString = str.data(); g_inputPosition = 0; g_yyFileName = fn; g_yyLineNr = 1; @@ -1434,13 +1432,13 @@ bool ConfigImpl::parseString(const char *fn,const char *str,bool update) return TRUE; } -bool ConfigImpl::parse(const char *fn,bool update) +bool ConfigImpl::parse(const QCString &fn,bool update) { int retval; g_encoding = "UTF-8"; - printlex(yy_flex_debug, TRUE, __FILE__, fn); + printlex(yy_flex_debug, TRUE, __FILE__, qPrint(fn)); retval = parseString(fn,configFileToString(fn), update); - printlex(yy_flex_debug, FALSE, __FILE__, fn); + printlex(yy_flex_debug, FALSE, __FILE__, qPrint(fn)); return retval; } @@ -1471,7 +1469,7 @@ static bool checkFileName(const QCString &s,const char *optionName) if ((val=="yes" || val=="true" || val=="1" || val=="all") || (val=="no" || val=="false" || val=="0" || val=="none")) { - err("file name expected for option %s, got %s instead. Ignoring...\n",optionName,s.data()); + err("file name expected for option %s, got %s instead. Ignoring...\n",optionName,qPrint(s)); return false; } return true; @@ -1493,21 +1491,21 @@ static void checkList(const StringVector &list,const char *name, bool equalRequi int i=item.find('='); if (i==-1 && equalRequired) { - err("Illegal format for option %s, no equal sign ('=') specified for item '%s'\n",name,item.data()); + err("Illegal format for option %s, no equal sign ('=') specified for item '%s'\n",name,qPrint(item)); } if (i!=-1) { QCString myName=item.left(i).stripWhiteSpace(); if (myName.isEmpty()) { - err("Illegal format for option %s, no name specified for item '%s'\n",name,item.data()); + err("Illegal format for option %s, no name specified for item '%s'\n",name,qPrint(item)); } else if (valueRequired) { QCString myValue=item.right(item.length()-i-1).stripWhiteSpace(); if (myValue.isEmpty()) { - err("Illegal format for option %s, no value specified for item '%s'\n",name,item.data()); + err("Illegal format for option %s, no value specified for item '%s'\n",name,qPrint(item)); } } } @@ -1614,7 +1612,7 @@ void Config::checkAndCorrect() if (!fi.exists()) { config_term("tag HTML_HEADER: header file '%s' " - "does not exist\n",headerFile.data()); + "does not exist\n",qPrint(headerFile)); } } @@ -1627,7 +1625,7 @@ void Config::checkAndCorrect() if (!fi.exists()) { config_term("tag HTML_FOOTER: footer file '%s' " - "does not exist\n",footerFile.data()); + "does not exist\n",qPrint(footerFile)); } } @@ -1635,6 +1633,23 @@ void Config::checkAndCorrect() // Test to see if MathJax code file is valid if (Config_getBool(USE_MATHJAX)) { + QCString mathJaxFormat = Config_getEnum(MATHJAX_FORMAT); + QCString mathjaxVersion = Config_getEnum(MATHJAX_VERSION); + if (!mathJaxFormat.isEmpty()) + { + if (mathjaxVersion == "MathJax_2") + { + if (mathJaxFormat=="chtml") Config_updateEnum(MATHJAX_FORMAT,"HTML-CSS"); + } + else + { + if (mathJaxFormat=="HTML-CSS" || mathJaxFormat=="NativeMML") + { + Config_updateEnum(MATHJAX_FORMAT,"chtml"); + } + } + } + QCString mathJaxCodefile = Config_getString(MATHJAX_CODEFILE); if (!mathJaxCodefile.isEmpty()) { @@ -1642,11 +1657,23 @@ void Config::checkAndCorrect() if (!fi.exists()) { config_term("tag MATHJAX_CODEFILE file '%s' " - "does not exist\n",mathJaxCodefile.data()); + "does not exist\n",qPrint(mathJaxCodefile)); } } QCString path = Config_getString(MATHJAX_RELPATH); - if (!path.isEmpty() && path.at(path.length()-1)!='/') + if (path.isEmpty()) + { + if (mathjaxVersion == "MathJax_2") + { + path = "https://cdn.jsdelivr.net/npm/mathjax@2"; + } + else + { + path = "https://cdn.jsdelivr.net/npm/mathjax@3"; + } + } + + if (path.at(path.length()-1)!='/') { path+="/"; } @@ -1662,7 +1689,7 @@ void Config::checkAndCorrect() if (!fi.exists()) { config_term("tag LATEX_HEADER: header file '%s' " - "does not exist\n",latexHeaderFile.data()); + "does not exist\n",qPrint(latexHeaderFile)); } } @@ -1675,7 +1702,7 @@ void Config::checkAndCorrect() if (!fi.exists()) { config_term("tag LATEX_FOOTER: footer file '%s' " - "does not exist\n",latexFooterFile.data()); + "does not exist\n",qPrint(latexFooterFile)); } } @@ -1702,7 +1729,7 @@ void Config::checkAndCorrect() int i_obrace=predef.find('('); if ((i_obrace==0) || (i_equals==0) || (i_equals==1 && predef.at(i_equals-1)==':')) { - err("Illegal PREDEFINED format '%s', no define name specified\n",predef.data()); + err("Illegal PREDEFINED format '%s', no define name specified\n",qPrint(predef)); } } } @@ -1713,8 +1740,8 @@ void Config::checkAndCorrect() for (const auto &alias : aliasList) { // match aliases of the form re1='name=' and re2='name{2} =' - static const reg::Ex re1(R"(\a\w*\s*=)"); - static const reg::Ex re2(R"(\a\w*{\d+}\s*=)"); + static const reg::Ex re1(R"(^\a\w*\s*=)"); + static const reg::Ex re2(R"(^\a\w*{\d+}\s*=)"); if (!reg::search(alias,re1) && !reg::search(alias,re2)) { err("Illegal ALIASES format '%s'. Use \"name=value\" or \"name{n}=value\", where n is the number of arguments\n", @@ -1844,7 +1871,7 @@ void Config::checkAndCorrect() FileInfo dp(dotExe.str()); if (!dp.exists() || !dp.isFile()) { - warn_uncond("the dot tool could not be found at %s\n",dotPath.data()); + warn_uncond("the dot tool could not be found at %s\n",qPrint(dotPath)); dotPath=""; } else @@ -1880,7 +1907,7 @@ void Config::checkAndCorrect() else { err("Jar file plantuml.jar not found at location " - "specified via PLANTUML_JAR_PATH: '%s'\n",plantumlJarPath.data()); + "specified via PLANTUML_JAR_PATH: '%s'\n",qPrint(plantumlJarPath)); plantumlJarPath=""; } } @@ -1891,7 +1918,7 @@ void Config::checkAndCorrect() else { err("path specified via PLANTUML_JAR_PATH does not exist or not a directory: %s\n", - plantumlJarPath.data()); + qPrint(plantumlJarPath)); plantumlJarPath=""; } } @@ -1906,7 +1933,7 @@ void Config::checkAndCorrect() FileInfo dp(diaExe.str()); if (!dp.exists() || !dp.isFile()) { - warn_uncond("dia could not be found at %s\n",diaPath.data()); + warn_uncond("dia could not be found at %s\n",qPrint(diaPath)); diaPath=""; } else @@ -2062,15 +2089,6 @@ void Config::checkAndCorrect() Config_updateInt(HTML_COLORSTYLE_GAMMA,gamma); //------------------------ - QCString mathJaxFormat = Config_getEnum(MATHJAX_FORMAT); - if (!mathJaxFormat.isEmpty() && mathJaxFormat!="HTML-CSS" && - mathJaxFormat!="NativeMML" && mathJaxFormat!="SVG") - { - err("Unsupported value for MATHJAX_FORMAT: Should be one of HTML-CSS, NativeMML, or SVG\n"); - Config_updateEnum(MATHJAX_FORMAT,"HTML-CSS"); - } - - //------------------------ // add default words if needed const StringVector &annotationFromBrief = Config_getList(ABBREVIATE_BRIEF); if (annotationFromBrief.empty()) @@ -2139,7 +2157,7 @@ void Config::checkAndCorrect() { if (option->kind()==ConfigOption::O_Bool) { - printf("disabling option %s\n",option->name().data()); + printf("disabling option %s\n",qPrint(option->name())); ConfigImpl_getBool("option->name("))=FALSE; // also disable this option } } @@ -2150,25 +2168,32 @@ void Config::checkAndCorrect() } -void Config::writeTemplate(std::ostream &t,bool shortList,bool update) +void Config::writeTemplate(TextStream &t,bool shortList,bool update) { ConfigImpl::instance()->writeTemplate(t,shortList,update); } -void Config::compareDoxyfile(std::ostream &t) +void Config::compareDoxyfile(TextStream &t) { postProcess(FALSE, TRUE); ConfigImpl::instance()->compareDoxyfile(t); } -void Config::writeXMLDoxyfile(std::ostream &t) +void Config::writeXMLDoxyfile(TextStream &t) { ConfigImpl::instance()->writeXMLDoxyfile(t); } -bool Config::parse(const char *fileName,bool update) +bool Config::parse(const QCString &fileName,bool update) { - return ConfigImpl::instance()->parse(fileName,update); + bool parseRes = ConfigImpl::instance()->parse(fileName,update); + if (!parseRes) return parseRes; + + // Internally we use the default format UTF-8 and + // when updating etc. the output is in this format as well and not in the read format + ConfigString *option = (ConfigString*)g_config->get("DOXYFILE_ENCODING"); + option->init(); + return parseRes; } void Config::postProcess(bool clearHeaderAndFooter, bool compare) diff --git a/src/constexp.l b/src/constexp.l index acff1eb..889626c 100644 --- a/src/constexp.l +++ b/src/constexp.l @@ -90,6 +90,9 @@ CONSTSUFFIX ([uU][lL]?[lL]?)|([lL][lL]?[uU]?) (0x|0X)[0-9a-fA-F]+{CONSTSUFFIX}? { yyextra->strToken=yytext+2; return TOK_HEXADECIMALINT; } +(0b|0B)[01]+{CONSTSUFFIX}? { yyextra->strToken=yytext+2; + return TOK_BINARYINT; + } (([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+))([eE]([\-\+])?[0-9]+)?([fFlL])? { yyextra->strToken=yytext; return TOK_FLOAT; } @@ -147,7 +150,7 @@ bool ConstExpressionParser::parse(const char *fileName,int lineNr,const std::str constexpYYrestart( yyin, p->yyscanner ); printlex(yy_flex_debug, true, __FILE__, fileName); - //printf("Expression: '%s'\n",s.data()); + //printf("Expression: '%s'\n",qPrint(s)); constexpYYparse(p->yyscanner); diff --git a/src/constexp.y b/src/constexp.y index 560b3c3..4ebbc79 100644 --- a/src/constexp.y +++ b/src/constexp.y @@ -64,6 +64,7 @@ int constexpYYerror(yyscan_t yyscanner, const char *s) %token TOK_OCTALINT %token TOK_DECIMALINT %token TOK_HEXADECIMALINT +%token TOK_BINARYINT %token TOK_CHARACTER %token TOK_FLOAT @@ -276,6 +277,11 @@ constant: TOK_OCTALINT struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner); $$ = parseHexadecimal(yyextra->strToken); } + | TOK_BINARYINT + { + struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner); + $$ = parseBinary(yyextra->strToken); + } | TOK_CHARACTER { struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner); diff --git a/src/context.cpp b/src/context.cpp index dec48c9..2ae62a0 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -271,11 +271,11 @@ class PropertyMapper * @returns A variant representing the properties value or an * invalid variant if it was not found. */ - TemplateVariant get(const T *obj,const char *name) const + TemplateVariant get(const T *obj,const QCString &name) const { //printf("PropertyMapper::get(%s)\n",name); TemplateVariant result; - auto it = m_map.find(name); + auto it = m_map.find(name.str()); return it!=m_map.end() ? (*it->second)(obj) : TemplateVariant(); } @@ -326,10 +326,10 @@ ConfigContext::~ConfigContext() delete p; } -TemplateVariant ConfigContext::get(const char *name) const +TemplateVariant ConfigContext::get(const QCString &name) const { TemplateVariant result; - if (name) + if (!name.isEmpty()) { const ConfigValues::Info *option = ConfigValues::instance().get(name); if (option) @@ -397,7 +397,7 @@ class DoxygenContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -425,7 +425,7 @@ DoxygenContext::~DoxygenContext() delete p; } -TemplateVariant DoxygenContext::get(const char *n) const +TemplateVariant DoxygenContext::get(const QCString &n) const { return p->get(n); } @@ -1223,7 +1223,7 @@ class TranslateContext::Private m_vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); m_sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -1248,7 +1248,7 @@ TranslateContext::~TranslateContext() delete p; } -TemplateVariant TranslateContext::get(const char *n) const +TemplateVariant TranslateContext::get(const QCString &n) const { return p->get(n); } @@ -1258,8 +1258,8 @@ static TemplateVariant parseDoc(const Definition *def,const QCString &file,int l { TemplateVariant result; DocRoot *root = validatingParseDoc(file,line,def,0,docStr,TRUE,FALSE, - 0,isBrief,FALSE,Config_getBool(MARKDOWN_SUPPORT)); - std::ostringstream ts(std::ios_base::ate); + QCString(),isBrief,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + TextStream ts; switch (g_globals.outputFormat) { case ContextOutputFormat_Html: @@ -1281,12 +1281,11 @@ static TemplateVariant parseDoc(const Definition *def,const QCString &file,int l err("context.cpp: output format not yet supported\n"); break; } - std::string docs = ts.str(); bool isEmpty = root->isEmpty(); if (isEmpty) result = ""; else - result = TemplateVariant(docs.c_str(),TRUE); + result = TemplateVariant(ts.str().c_str(),TRUE); delete root; return result; } @@ -1296,20 +1295,20 @@ static TemplateVariant parseCode(MemberDef *md,const QCString &scopeName,const Q { auto intf = Doxygen::parserManager->getCodeParser(md->getDefFileExtension()); intf->resetCodeParserState(); - std::ostringstream t(std::ios_base::ate); + TextStream t; switch (g_globals.outputFormat) { case ContextOutputFormat_Html: { HtmlCodeGenerator codeGen(t,relPath); - intf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(), + intf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,QCString(),md->getBodyDef(), startLine,endLine,TRUE,md,showLineNumbers,md); } break; case ContextOutputFormat_Latex: { LatexCodeGenerator codeGen(t,relPath,md->docFile()); - intf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(), + intf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,QCString(),md->getBodyDef(), startLine,endLine,TRUE,md,showLineNumbers,md); } break; @@ -1318,8 +1317,7 @@ static TemplateVariant parseCode(MemberDef *md,const QCString &scopeName,const Q err("context.cpp: output format not yet supported\n"); break; } - QCString s = t.str(); - return TemplateVariant(s.data(),TRUE); + return TemplateVariant(t.str(),TRUE); } static TemplateVariant parseCode(const FileDef *fd,const QCString &relPath) @@ -1327,17 +1325,17 @@ static TemplateVariant parseCode(const FileDef *fd,const QCString &relPath) static bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES); auto intf = Doxygen::parserManager->getCodeParser(fd->getDefFileExtension()); intf->resetCodeParserState(); - std::ostringstream t(std::ios_base::ate); + TextStream t; switch (g_globals.outputFormat) { case ContextOutputFormat_Html: { HtmlCodeGenerator codeGen(t,relPath); - intf->parseCode(codeGen,0, + intf->parseCode(codeGen,QCString(), fileToString(fd->absFilePath(),filterSourceFiles,TRUE), // the sources fd->getLanguage(), // lang FALSE, // isExampleBlock - 0, // exampleName + QCString(), // exampleName const_cast<FileDef*>(fd), // fileDef, TODO: should be const -1, // startLine -1, // endLine @@ -1352,11 +1350,11 @@ static TemplateVariant parseCode(const FileDef *fd,const QCString &relPath) case ContextOutputFormat_Latex: { LatexCodeGenerator codeGen(t,relPath,fd->docFile()); - intf->parseCode(codeGen,0, + intf->parseCode(codeGen,QCString(), fileToString(fd->absFilePath(),filterSourceFiles,TRUE), // the sources fd->getLanguage(), // lang FALSE, // isExampleBlock - 0, // exampleName + QCString(), // exampleName const_cast<FileDef*>(fd), // fileDef, TODO: should be const -1, // startLine -1, // endLine @@ -1373,8 +1371,7 @@ static TemplateVariant parseCode(const FileDef *fd,const QCString &relPath) err("context.cpp: output format not yet supported\n"); break; } - QCString s = t.str(); - return TemplateVariant(s.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } //------------------------------------------------------------------------ @@ -1555,6 +1552,7 @@ class DefinitionContext case Definition::TypePackage: result="package"; break; case Definition::TypePage: result="page"; break; case Definition::TypeDir: result="dir"; break; + case Definition::TypeConcept: result="concept"; break; case Definition::TypeMember: break; } return result; @@ -1696,7 +1694,7 @@ class IncludeInfoContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -1747,7 +1745,7 @@ IncludeInfoContext::~IncludeInfoContext() delete p; } -TemplateVariant IncludeInfoContext::get(const char *n) const +TemplateVariant IncludeInfoContext::get(const QCString &n) const { return p->get(n); } @@ -1879,7 +1877,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> if (!cd->cookie()) { cd->setCookie(new ClassContext::Private::Cachable(cd)); } } virtual ~Private() {} - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -1949,7 +1947,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } TemplateVariant inheritanceDiagram() const { - std::ostringstream t(std::ios_base::ate); + TextStream t; static bool haveDot = Config_getBool(HAVE_DOT); static bool classDiagrams = Config_getBool(CLASS_DIAGRAMS); static bool classGraph = Config_getBool(CLASS_GRAPH); @@ -1990,13 +1988,13 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { case ContextOutputFormat_Html: { - std::ostringstream tt(std::ios_base::ate); + TextStream tt; QCString name = convertToHtml(m_classDef->displayName()); d.writeImage(tt,g_globals.outputDir, relPathAsString(), m_classDef->getOutputFileBase()); - if (tt.tellp()>0) + if (!tt.empty()) { t << "<div class=\"center\">\n"; t << " <img src=\""; @@ -2029,8 +2027,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } DotClassGraph *getCollaborationGraph() const { @@ -2049,7 +2046,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> TemplateVariant collaborationDiagram() const { static bool haveDot = Config_getBool(HAVE_DOT); - std::ostringstream t(std::ios_base::ate); + TextStream t; if (haveDot) { DotClassGraph *cg = getCollaborationGraph(); @@ -2080,8 +2077,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } TemplateVariant includeInfo() const @@ -2119,7 +2115,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> return cache.inheritedByList.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool=FALSE) const + MemberListType type,const QCString &title,bool=FALSE) const { if (!list) { @@ -2642,7 +2638,7 @@ PropertyMapper<ClassContext::Private> ClassContext::Private::s_inst; ClassContext::ClassContext(const ClassDef *cd) : RefCountedContext("ClassContext") { - //printf("ClassContext::ClassContext(%s)\n",cd?cd->name().data():"<none>"); + //printf("ClassContext::ClassContext(%s)\n",cd?qPrint(cd->name()):"<none>"); p = new Private(cd); } @@ -2651,7 +2647,7 @@ ClassContext::~ClassContext() delete p; } -TemplateVariant ClassContext::get(const char *n) const +TemplateVariant ClassContext::get(const QCString &n) const { return p->get(n); } @@ -2698,7 +2694,7 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri if (!nd->cookie()) { nd->setCookie(new NamespaceContext::Private::Cachable(nd)); } } virtual ~Private() {} - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -2781,7 +2777,7 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool=FALSE) const + MemberListType type,const QCString &title,bool=FALSE) const { if (!list) { @@ -2942,7 +2938,7 @@ NamespaceContext::~NamespaceContext() delete p; } -TemplateVariant NamespaceContext::get(const char *n) const +TemplateVariant NamespaceContext::get(const QCString &n) const { return p->get(n); } @@ -2999,7 +2995,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> if (!fd->cookie()) { fd->setCookie(new FileContext::Private::Cachable(fd)); } } virtual ~Private() {} - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -3054,7 +3050,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> TemplateVariant includeGraph() const { static bool haveDot = Config_getBool(HAVE_DOT); - std::ostringstream t(std::ios_base::ate); + TextStream t; if (haveDot) { DotInclDepGraph *cg = getIncludeGraph(); @@ -3085,8 +3081,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } DotInclDepGraph *getIncludedByGraph() const { @@ -3106,7 +3101,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> TemplateVariant includedByGraph() const { static bool haveDot = Config_getBool(HAVE_DOT); - std::ostringstream t(std::ios_base::ate); + TextStream t; if (haveDot) { DotInclDepGraph *cg = getIncludedByGraph(); @@ -3137,8 +3132,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } TemplateVariant hasDetails() const { @@ -3220,7 +3214,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool=FALSE) const + MemberListType type,const QCString &title,bool=FALSE) const { if (!list) { @@ -3396,7 +3390,7 @@ FileContext::~FileContext() delete p; } -TemplateVariant FileContext::get(const char *n) const +TemplateVariant FileContext::get(const QCString &n) const { return p->get(n); } @@ -3429,7 +3423,7 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> if (!dd->cookie()) { dd->setCookie(new DirContext::Private::Cachable(dd)); } } virtual ~Private() {} - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -3512,7 +3506,7 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> } TemplateVariant dirGraph() const { - std::ostringstream t(std::ios_base::ate); + TextStream t; static bool haveDot = Config_getBool(HAVE_DOT); static bool dirGraph = Config_getBool(DIRECTORY_GRAPH); if (haveDot && dirGraph) @@ -3551,8 +3545,7 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } private: @@ -3586,7 +3579,7 @@ DirContext::~DirContext() delete p; } -TemplateVariant DirContext::get(const char *n) const +TemplateVariant DirContext::get(const QCString &n) const { return p->get(n); } @@ -3615,7 +3608,7 @@ class PageContext::Private : public DefinitionContext<PageContext::Private> if (!pd->cookie()) { pd->setCookie(new PageContext::Private::Cachable(pd)); } } virtual ~Private() {} - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -3719,7 +3712,7 @@ PageContext::~PageContext() delete p; } -TemplateVariant PageContext::get(const char *n) const +TemplateVariant PageContext::get(const QCString &n) const { return p->get(n); } @@ -3729,15 +3722,15 @@ TemplateVariant PageContext::get(const char *n) const class TextGeneratorHtml : public TextGeneratorIntf { public: - TextGeneratorHtml(std::ostream &ts,const QCString &relPath) + TextGeneratorHtml(TextStream &ts,const QCString &relPath) : m_ts(ts), m_relPath(relPath) {} - void writeString(const char *s,bool keepSpaces) const + void writeString(const QCString &s,bool keepSpaces) const { static const char *hex="0123456789ABCDEF"; - if (s==0) return; + if (s.isEmpty()) return; if (keepSpaces) { - const char *p=s; + const char *p=s.data(); char c; while ((c=*p++)) { @@ -3780,11 +3773,11 @@ class TextGeneratorHtml : public TextGeneratorIntf } } - void writeLink(const char *ref,const char *f, - const char *anchor,const char *name + void writeLink(const QCString &ref,const QCString &f, + const QCString &anchor,const QCString &name ) const { - if (ref) + if (!ref.isEmpty()) { m_ts << "<a class=\"elRef\" "; m_ts << externalLinkTarget(); @@ -3795,15 +3788,15 @@ class TextGeneratorHtml : public TextGeneratorIntf } m_ts << "href=\""; m_ts << externalRef(m_relPath,ref,TRUE); - if (f) m_ts << f << Doxygen::htmlFileExtension; - if (anchor) m_ts << "#" << anchor; + if (!f.isEmpty()) m_ts << f << Doxygen::htmlFileExtension; + if (!anchor.isEmpty()) m_ts << "#" << anchor; m_ts << "\">"; m_ts << convertToHtml(name); m_ts << "</a>"; } private: - std::ostream &m_ts; + TextStream &m_ts; QCString m_relPath; }; @@ -3812,8 +3805,8 @@ class TextGeneratorHtml : public TextGeneratorIntf class TextGeneratorLatex : public TextGeneratorIntf { public: - TextGeneratorLatex(std::ostream &ts) : m_ts(ts) {} - void writeString(const char *s,bool keepSpaces) const + TextGeneratorLatex(TextStream &ts) : m_ts(ts) {} + void writeString(const QCString &s,bool keepSpaces) const { if (s==0) return; m_ts << convertToLaTeX(s,FALSE,keepSpaces); @@ -3826,17 +3819,17 @@ class TextGeneratorLatex : public TextGeneratorIntf m_ts << "~"; } } - void writeLink(const char *ref,const char *f, - const char *anchor,const char *text + void writeLink(const QCString &ref,const QCString &f, + const QCString &anchor,const QCString &text ) const { static bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS); - if (!ref && pdfHyperlinks) + if (ref.isEmpty() && pdfHyperlinks) { m_ts << "\\mbox{\\hyperlink{"; - if (f) m_ts << stripPath(f); - if (f && anchor) m_ts << "_"; - if (anchor) m_ts << anchor; + if (!f.isEmpty()) m_ts << stripPath(f); + if (!f.isEmpty() && !anchor.isEmpty()) m_ts << "_"; + if (!anchor.isEmpty()) m_ts << anchor; m_ts << "}{"; filterLatexString(m_ts,text, false, // insideTabbing @@ -3862,7 +3855,7 @@ class TextGeneratorLatex : public TextGeneratorIntf } private: - std::ostream &m_ts; + TextStream &m_ts; }; //------------------------------------------------------------------------ @@ -3876,7 +3869,7 @@ class TextGeneratorFactory if (instance==0) instance = new TextGeneratorFactory; return instance; } - TextGeneratorIntf *create(std::ostream &ts,const QCString &relPath) + TextGeneratorIntf *create(TextStream &ts,const QCString &relPath) { switch (g_globals.outputFormat) { @@ -3896,7 +3889,7 @@ class TextGeneratorFactory TemplateVariant createLinkedText(const Definition *def,const QCString &relPath,const QCString &text) { - std::ostringstream ts(std::ios_base::ate); + TextStream ts; TextGeneratorIntf *tg = TextGeneratorFactory::instance()->create(ts,relPath); if (tg) { @@ -4066,7 +4059,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } } virtual ~Private() {} - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -4937,7 +4930,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> if (hasCallGraph().toBool()) { DotCallGraph *cg = getCallGraph(); - std::ostringstream t(std::ios_base::ate); + TextStream t; switch (g_globals.outputFormat) { case ContextOutputFormat_Html: @@ -4964,8 +4957,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> break; } g_globals.dynSectionId++; - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } else { @@ -5009,7 +5001,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> if (hasCallerGraph().toBool()) { DotCallGraph *cg = getCallerGraph(); - std::ostringstream t(std::ios_base::ate); + TextStream t; switch (g_globals.outputFormat) { case ContextOutputFormat_Html: @@ -5036,8 +5028,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> break; } g_globals.dynSectionId++; - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } else { @@ -5168,7 +5159,7 @@ MemberContext::~MemberContext() delete p; } -TemplateVariant MemberContext::get(const char *n) const +TemplateVariant MemberContext::get(const QCString &n) const { return p->get(n); } @@ -5234,7 +5225,7 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> if (!gd->cookie()) { gd->setCookie(new ModuleContext::Private::Cachable(gd)); } } virtual ~Private() {} - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -5273,7 +5264,7 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } TemplateVariant groupGraph() const { - std::ostringstream t(std::ios_base::ate); + TextStream t; static bool haveDot = Config_getBool(HAVE_DOT); static bool groupGraphs = Config_getBool(GROUP_GRAPHS); if (haveDot && groupGraphs) @@ -5310,8 +5301,7 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } TemplateVariant hasDetails() const { @@ -5443,7 +5433,7 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool=FALSE) const + MemberListType type,const QCString &title,bool=FALSE) const { if (!list) { @@ -5680,7 +5670,7 @@ ModuleContext::~ModuleContext() delete p; } -TemplateVariant ModuleContext::get(const char *n) const +TemplateVariant ModuleContext::get(const QCString &n) const { return p->get(n); } @@ -5759,7 +5749,7 @@ class ClassIndexContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -5845,7 +5835,7 @@ ClassIndexContext::~ClassIndexContext() } // TemplateStructIntf -TemplateVariant ClassIndexContext::get(const char *n) const +TemplateVariant ClassIndexContext::get(const QCString &n) const { return p->get(n); } @@ -5951,7 +5941,7 @@ class ClassHierarchyContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -6058,7 +6048,7 @@ ClassHierarchyContext::~ClassHierarchyContext() delete p; } -TemplateVariant ClassHierarchyContext::get(const char *name) const +TemplateVariant ClassHierarchyContext::get(const QCString &name) const { return p->get(name); } @@ -6118,7 +6108,7 @@ class NestingNodeContext::Private addPages(visitedClasses); addModules(visitedClasses); } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -6380,7 +6370,7 @@ NestingNodeContext::~NestingNodeContext() delete p; } -TemplateVariant NestingNodeContext::get(const char *n) const +TemplateVariant NestingNodeContext::get(const QCString &n) const { return p->get(n); } @@ -6404,7 +6394,9 @@ class NestingContext::Private : public GenericNodeListContext if (!nd->isAnonymous() && (!rootOnly || nd->getOuterScope()==Doxygen::globalScope)) { - bool hasChildren = namespaceHasNestedNamespace(nd); + bool hasChildren = namespaceHasNestedNamespace(nd) || + namespaceHasNestedClass(nd,false,ClassDef::Class) || + namespaceHasNestedConcept(nd); bool isLinkable = nd->isLinkableInProject(); if (isLinkable || hasChildren) { @@ -6744,7 +6736,7 @@ class ClassTreeContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -6831,7 +6823,7 @@ ClassTreeContext::~ClassTreeContext() delete p; } -TemplateVariant ClassTreeContext::get(const char *name) const +TemplateVariant ClassTreeContext::get(const QCString &name) const { return p->get(name); } @@ -6908,7 +6900,7 @@ class NamespaceTreeContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -6997,7 +6989,7 @@ NamespaceTreeContext::~NamespaceTreeContext() delete p; } -TemplateVariant NamespaceTreeContext::get(const char *name) const +TemplateVariant NamespaceTreeContext::get(const QCString &name) const { return p->get(name); } @@ -7178,7 +7170,7 @@ class FileTreeContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -7252,7 +7244,7 @@ FileTreeContext::~FileTreeContext() delete p; } -TemplateVariant FileTreeContext::get(const char *name) const +TemplateVariant FileTreeContext::get(const QCString &name) const { return p->get(name); } @@ -7286,7 +7278,7 @@ class PageTreeContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -7360,7 +7352,7 @@ PageTreeContext::~PageTreeContext() delete p; } -TemplateVariant PageTreeContext::get(const char *name) const +TemplateVariant PageTreeContext::get(const QCString &name) const { return p->get(name); } @@ -7528,7 +7520,7 @@ class ModuleTreeContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -7602,7 +7594,7 @@ ModuleTreeContext::~ModuleTreeContext() delete p; } -TemplateVariant ModuleTreeContext::get(const char *name) const +TemplateVariant ModuleTreeContext::get(const QCString &name) const { return p->get(name); } @@ -7628,7 +7620,7 @@ class NavPathElemContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -7696,7 +7688,7 @@ NavPathElemContext::~NavPathElemContext() delete p; } -TemplateVariant NavPathElemContext::get(const char *name) const +TemplateVariant NavPathElemContext::get(const QCString &name) const { return p->get(name); } @@ -7730,7 +7722,7 @@ class ExampleTreeContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -7804,7 +7796,7 @@ ExampleTreeContext::~ExampleTreeContext() delete p; } -TemplateVariant ExampleTreeContext::get(const char *name) const +TemplateVariant ExampleTreeContext::get(const QCString &name) const { return p->get(name); } @@ -7839,7 +7831,7 @@ class GlobalsIndexContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -7957,7 +7949,7 @@ GlobalsIndexContext::~GlobalsIndexContext() delete p; } -TemplateVariant GlobalsIndexContext::get(const char *name) const +TemplateVariant GlobalsIndexContext::get(const QCString &name) const { return p->get(name); } @@ -7992,7 +7984,7 @@ class ClassMembersIndexContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -8112,7 +8104,7 @@ ClassMembersIndexContext::~ClassMembersIndexContext() delete p; } -TemplateVariant ClassMembersIndexContext::get(const char *name) const +TemplateVariant ClassMembersIndexContext::get(const QCString &name) const { return p->get(name); } @@ -8147,7 +8139,7 @@ class NamespaceMembersIndexContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -8264,7 +8256,7 @@ NamespaceMembersIndexContext::~NamespaceMembersIndexContext() delete p; } -TemplateVariant NamespaceMembersIndexContext::get(const char *name) const +TemplateVariant NamespaceMembersIndexContext::get(const QCString &name) const { return p->get(name); } @@ -8285,13 +8277,13 @@ class InheritanceGraphContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } TemplateVariant graph() const { - std::ostringstream t(std::ios_base::ate); + TextStream t; static bool haveDot = Config_getBool(HAVE_DOT); static bool graphicalHierarchy = Config_getBool(GRAPHICAL_HIERARCHY); if (haveDot && graphicalHierarchy) @@ -8303,8 +8295,7 @@ class InheritanceGraphContext::Private g_globals.outputDir+Portable::pathSeparator()+"inherits"+Doxygen::htmlFileExtension, m_id); } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } private: DotGfxHierarchyTable *m_hierarchy; @@ -8326,7 +8317,7 @@ InheritanceGraphContext::~InheritanceGraphContext() delete p; } -TemplateVariant InheritanceGraphContext::get(const char *name) const +TemplateVariant InheritanceGraphContext::get(const QCString &name) const { return p->get(name); } @@ -8349,7 +8340,7 @@ class InheritanceNodeContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -8385,7 +8376,7 @@ InheritanceNodeContext::~InheritanceNodeContext() delete p; } -TemplateVariant InheritanceNodeContext::get(const char *name) const +TemplateVariant InheritanceNodeContext::get(const QCString &name) const { return p->get(name); } @@ -8418,7 +8409,7 @@ InheritanceListContext::InheritanceListContext(const BaseClassList &list, bool b { name = cd->displayName(); } - //printf("InheritanceListContext: adding %s baseClass=%d\n",name.data(),baseClasses); + //printf("InheritanceListContext: adding %s baseClass=%d\n",qPrint(name),baseClasses); p->addClass(cd,name); } } @@ -8533,7 +8524,7 @@ class MemberInfoContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -8596,7 +8587,7 @@ MemberInfoContext::~MemberInfoContext() delete p; } -TemplateVariant MemberInfoContext::get(const char *name) const +TemplateVariant MemberInfoContext::get(const QCString &name) const { return p->get(name); } @@ -8685,7 +8676,7 @@ class MemberGroupInfoContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -8768,7 +8759,7 @@ MemberGroupInfoContext::~MemberGroupInfoContext() delete p; } -TemplateVariant MemberGroupInfoContext::get(const char *name) const +TemplateVariant MemberGroupInfoContext::get(const QCString &name) const { return p->get(name); } @@ -8859,7 +8850,7 @@ class MemberListInfoContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -8940,7 +8931,7 @@ MemberListInfoContext::~MemberListInfoContext() delete p; } -TemplateVariant MemberListInfoContext::get(const char *name) const +TemplateVariant MemberListInfoContext::get(const QCString &name) const { return p->get(name); } @@ -8966,7 +8957,7 @@ class InheritedMemberInfoContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -9034,7 +9025,7 @@ InheritedMemberInfoContext::~InheritedMemberInfoContext() delete p; } -TemplateVariant InheritedMemberInfoContext::get(const char *name) const +TemplateVariant InheritedMemberInfoContext::get(const QCString &name) const { return p->get(name); } @@ -9147,7 +9138,7 @@ void InheritedMemberInfoListContext::addMemberList( bool memberInSection = cd->countMembersIncludingGrouped(lt,cd,FALSE)>0; bool show = (additionalList && !memberInSection) || // inherited member to show in the additional inherited members list (!additionalList && memberInSection); // inherited member to show in a member list of the class - //printf("%s:%s show=%d\n",cd->name().data(),MemberList::listTypeAsString(lt).data(),show); + //printf("%s:%s show=%d\n",qPrint(cd->name()),qPrint(MemberList::listTypeAsString(lt)),show); if (show) { p->findInheritedMembers(cd,cd,lt,-1,title,additionalList,visited); @@ -9198,7 +9189,7 @@ class ArgumentContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -9275,7 +9266,7 @@ ArgumentContext::~ArgumentContext() delete p; } -TemplateVariant ArgumentContext::get(const char *name) const +TemplateVariant ArgumentContext::get(const QCString &name) const { return p->get(name); } @@ -9365,7 +9356,7 @@ class SymbolContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -9469,7 +9460,7 @@ SymbolContext::~SymbolContext() delete p; } -TemplateVariant SymbolContext::get(const char *name) const +TemplateVariant SymbolContext::get(const QCString &name) const { return p->get(name); } @@ -9542,7 +9533,7 @@ class SymbolGroupContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -9588,7 +9579,7 @@ SymbolGroupContext::~SymbolGroupContext() delete p; } -TemplateVariant SymbolGroupContext::get(const char *name) const +TemplateVariant SymbolGroupContext::get(const QCString &name) const { return p->get(name); } @@ -9669,7 +9660,7 @@ class SymbolIndexContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -9715,7 +9706,7 @@ SymbolIndexContext::~SymbolIndexContext() delete p; } -TemplateVariant SymbolIndexContext::get(const char *name) const +TemplateVariant SymbolIndexContext::get(const QCString &name) const { return p->get(name); } @@ -9780,7 +9771,7 @@ class SearchIndexContext::Private init=TRUE; } } - TemplateVariant get(const char *n) const + TemplateVariant get(const QCString &n) const { return s_inst.get(this,n); } @@ -9824,7 +9815,7 @@ SearchIndexContext::~SearchIndexContext() delete p; } -TemplateVariant SearchIndexContext::get(const char *name) const +TemplateVariant SearchIndexContext::get(const QCString &name) const { return p->get(name); } @@ -9892,7 +9883,8 @@ class LatexSpaceless : public TemplateSpacelessIntf void reset() { } QCString remove(const QCString &s) { - std::ostringstream result(std::ios_base::ate); + if (s.isEmpty()) return s; + TextStream result; const char *p = s.data(); char c; while ((c=*p++)) @@ -9925,7 +9917,8 @@ class HtmlSpaceless : public TemplateSpacelessIntf } QCString remove(const QCString &s) { - std::ostringstream result(std::ios_base::ate); + if (s.isEmpty()) return s; + TextStream result; const char *p = s.data(); char c; while ((c=*p++)) @@ -9975,7 +9968,7 @@ class HtmlSpaceless : public TemplateSpacelessIntf break; } } - //printf("HtmlSpaceless::remove({%s})={%s} m_insideTag=%d m_insideString=%c (%d) removeSpaces=%d\n",s.data(),result.data(), + //printf("HtmlSpaceless::remove({%s})={%s} m_insideTag=%d m_insideString=%c (%d) removeSpaces=%d\n",qPrint(s),qPrint(result), // m_insideTag,m_insideString,m_insideString,m_removeSpaces); return result.str(); } @@ -10115,7 +10108,7 @@ void generateOutputViaTemplate() HtmlSpaceless spl; ctx->setSpacelessIntf(&spl); ctx->setOutputDirectory(g_globals.outputDir); - std::ostringstream ts(std::ios_base::ate); + TextStream ts; tpl->render(ts,ctx); e.unload(tpl); } @@ -10140,7 +10133,7 @@ void generateOutputViaTemplate() LatexSpaceless spl; ctx->setSpacelessIntf(&spl); ctx->setOutputDirectory(g_globals.outputDir); - std::ostringstream ts(std::ios_base::ate); + TextStream ts; tpl->render(ts,ctx); e.unload(tpl); } @@ -10160,16 +10153,16 @@ void generateOutputViaTemplate() #endif } -void generateTemplateFiles(const char *templateDir) +void generateTemplateFiles(const QCString &templateDir) { - if (!templateDir) return; + if (templateDir.isEmpty()) return; Dir thisDir; - if (!thisDir.exists(templateDir) && !thisDir.mkdir(templateDir)) + if (!thisDir.exists(templateDir.str()) && !thisDir.mkdir(templateDir.str())) { - err("Failed to create output directory '%s'\n",templateDir); + err("Failed to create output directory '%s'\n",qPrint(templateDir)); return; } - std::string outDir = std::string(templateDir)+"/html"; + std::string outDir = templateDir.str()+"/html"; if (!thisDir.exists(outDir) && !thisDir.mkdir(outDir)) { err("Failed to create output directory '%s'\n",outDir.c_str()); diff --git a/src/context.h b/src/context.h index 9573643..1fb934e 100644 --- a/src/context.h +++ b/src/context.h @@ -80,13 +80,13 @@ class RefCountedContext int addRef() { ++s_totalCount; - printf("%p:%s::addRef()=%d\n",this,m_className.data(),m_refCount); + printf("%p:%s::addRef()=%d\n",this,qPrint(m_className),m_refCount); return ++m_refCount; } int release() { --s_totalCount; - printf("%p:%s::release()=%d\n",this,m_className.data(),m_refCount-1); + printf("%p:%s::release()=%d\n",this,qPrint(m_className),m_refCount-1); int count = --m_refCount; if (count<=0) { @@ -134,7 +134,7 @@ class ConfigContext : public RefCountedContext, public TemplateStructIntf static ConfigContext *alloc() { return new ConfigContext; } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -153,7 +153,7 @@ class DoxygenContext : public RefCountedContext, public TemplateStructIntf static DoxygenContext *alloc() { return new DoxygenContext; } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -172,7 +172,7 @@ class TranslateContext : public RefCountedContext, public TemplateStructIntf static TranslateContext *alloc() { return new TranslateContext; } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -216,7 +216,7 @@ class IncludeInfoContext : public RefCountedContext, public TemplateStructIntf { return new IncludeInfoContext(info,lang); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -258,7 +258,7 @@ class ClassContext : public RefCountedContext, public TemplateStructIntf static ClassContext *alloc(const ClassDef *cd) { return new ClassContext(cd); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -277,7 +277,7 @@ class NamespaceContext : public RefCountedContext, public TemplateStructIntf static NamespaceContext *alloc(const NamespaceDef *nd) { return new NamespaceContext(nd); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -296,7 +296,7 @@ class FileContext : public RefCountedContext, public TemplateStructIntf static FileContext *alloc(const FileDef *fd) { return new FileContext(fd); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -314,7 +314,7 @@ class DirContext : public RefCountedContext, public TemplateStructIntf static DirContext *alloc(const DirDef *dd) { return new DirContext(dd); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -334,7 +334,7 @@ class PageContext : public RefCountedContext, public TemplateStructIntf static PageContext *alloc(const PageDef *pd,bool isMainPage,bool isExample) { return new PageContext(pd,isMainPage,isExample); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -353,7 +353,7 @@ class MemberContext : public RefCountedContext, public TemplateStructIntf static MemberContext *alloc(const MemberDef *md) { return new MemberContext(md); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -373,7 +373,7 @@ class ModuleContext : public RefCountedContext, public TemplateStructIntf static ModuleContext *alloc(const GroupDef *gd) { return new ModuleContext(gd); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -413,7 +413,7 @@ class ClassIndexContext : public RefCountedContext, public TemplateStructIntf static ClassIndexContext *alloc() { return new ClassIndexContext; } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -433,7 +433,7 @@ class InheritanceGraphContext : public RefCountedContext, public TemplateStructI { return new InheritanceGraphContext(hierarchy,n,id); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -453,7 +453,7 @@ class ClassInheritanceNodeContext : public RefCountedContext, public TemplateStr { return new ClassInheritanceNodeContext(cd); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -495,7 +495,7 @@ class ClassHierarchyContext : public RefCountedContext, public TemplateStructInt static ClassHierarchyContext *alloc() { return new ClassHierarchyContext; } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -519,7 +519,7 @@ class NestingNodeContext : public RefCountedContext, public TemplateStructIntf QCString id() const; // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -578,7 +578,7 @@ class ClassTreeContext : public RefCountedContext, public TemplateStructIntf static ClassTreeContext *alloc() { return new ClassTreeContext; } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -618,7 +618,7 @@ class NamespaceTreeContext : public RefCountedContext, public TemplateStructIntf static NamespaceTreeContext *alloc() { return new NamespaceTreeContext; } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -679,7 +679,7 @@ class FileTreeContext : public RefCountedContext, public TemplateStructIntf static FileTreeContext *alloc() { return new FileTreeContext; } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -721,7 +721,7 @@ class PageTreeContext : public RefCountedContext, public TemplateStructIntf static PageTreeContext *alloc(const PageLinkedMap &pages) { return new PageTreeContext(pages); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -740,7 +740,7 @@ class ModuleNodeContext : public RefCountedContext, public TemplateStructIntf static ModuleNodeContext *alloc(const GroupDef *gd) { return new ModuleNodeContext(gd); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -783,7 +783,7 @@ class ModuleTreeContext : public RefCountedContext, public TemplateStructIntf static ModuleTreeContext *alloc() { return new ModuleTreeContext(); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -824,7 +824,7 @@ class ExampleTreeContext : public RefCountedContext, public TemplateStructIntf static ExampleTreeContext *alloc() { return new ExampleTreeContext; } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -843,7 +843,7 @@ class GlobalsIndexContext : public RefCountedContext, public TemplateStructIntf static GlobalsIndexContext *alloc() { return new GlobalsIndexContext(); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -862,7 +862,7 @@ class ClassMembersIndexContext : public RefCountedContext, public TemplateStruct static ClassMembersIndexContext *alloc() { return new ClassMembersIndexContext(); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -881,7 +881,7 @@ class NamespaceMembersIndexContext : public RefCountedContext, public TemplateSt static NamespaceMembersIndexContext *alloc() { return new NamespaceMembersIndexContext(); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -900,7 +900,7 @@ class NavPathElemContext : public RefCountedContext, public TemplateStructIntf static NavPathElemContext *alloc(const Definition *def) { return new NavPathElemContext(def); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -921,7 +921,7 @@ class InheritanceNodeContext : public RefCountedContext, public TemplateStructIn { return new InheritanceNodeContext(cd,name); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -991,7 +991,7 @@ class MemberGroupInfoContext : public RefCountedContext, public TemplateStructIn { return new MemberGroupInfoContext(def,relPath,mg); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1042,7 +1042,7 @@ class MemberListInfoContext : public RefCountedContext, public TemplateStructInt { return new MemberListInfoContext(def,relPath,ml,title,subtitle); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1063,7 +1063,7 @@ class MemberInfoContext : public RefCountedContext, public TemplateStructIntf static MemberInfoContext *alloc(const MemberInfo *mi) { return new MemberInfoContext(mi); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1083,7 +1083,7 @@ class InheritedMemberInfoContext : public RefCountedContext, public TemplateStru { return new InheritedMemberInfoContext(cd,ml,title); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1147,7 +1147,7 @@ class ArgumentContext : public RefCountedContext, public TemplateStructIntf { return new ArgumentContext(arg,def,relPath); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1191,7 +1191,7 @@ class SymbolContext : public RefCountedContext, public TemplateStructIntf { return new SymbolContext(def,prev,next); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1236,7 +1236,7 @@ class SymbolGroupContext : public RefCountedContext, public TemplateStructIntf { return new SymbolGroupContext(start,end); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1280,7 +1280,7 @@ class SymbolIndexContext : public RefCountedContext, public TemplateStructIntf { return new SymbolIndexContext(letter,sl,name); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1322,7 +1322,7 @@ class SearchIndexContext : public RefCountedContext, public TemplateStructIntf { return new SearchIndexContext(info); } // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1357,6 +1357,6 @@ class SearchIndicesContext : public RefCountedContext, public TemplateListIntf //---------------------------------------------------- void generateOutputViaTemplate(); -void generateTemplateFiles(const char *templateDir); +void generateTemplateFiles(const QCString &templateDir); #endif diff --git a/src/cppvalue.cpp b/src/cppvalue.cpp index 31f0ab5..8cd7c5c 100644 --- a/src/cppvalue.cpp +++ b/src/cppvalue.cpp @@ -47,7 +47,17 @@ CPPValue parseHexadecimal(const std::string& token) else if (*p >= 'a' && *p <= 'f') val = val * 16 + *p - 'a' + 10; else if (*p >= 'A' && *p <= 'F') val = val * 16 + *p - 'A' + 10; } - //printf("parseHexadecimal %s->%x\n",token.data(),val); + //printf("parseHexadecimal %s->%x\n",qPrint(token),val); + return CPPValue(val); +} + +CPPValue parseBinary(const std::string& token) +{ + long val = 0; + for (const char *p = token.c_str(); *p != 0; p++) + { + if (*p >= '0' && *p <= '1') val = val * 2 + *p - '0'; + } return CPPValue(val); } @@ -79,7 +89,7 @@ CPPValue parseCharacter(const std::string& token) // does not work for '\n' and return parseOctal(token); case 'x': case 'X': return parseHexadecimal(token); - default: printf("Invalid escape sequence %s found!\n",token.data()); + default: printf("Invalid escape sequence %s found!\n",token.c_str()); return CPPValue(0L); } } diff --git a/src/cppvalue.h b/src/cppvalue.h index 7732068..74fe4d7 100644 --- a/src/cppvalue.h +++ b/src/cppvalue.h @@ -52,6 +52,7 @@ class CPPValue extern CPPValue parseOctal(const std::string& token); extern CPPValue parseDecimal(const std::string& token); extern CPPValue parseHexadecimal(const std::string& token); +extern CPPValue parseBinary(const std::string& token); extern CPPValue parseCharacter(const std::string& token); extern CPPValue parseFloat(const std::string& token); diff --git a/src/debug.cpp b/src/debug.cpp index bc5abb2..ea6f272 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -22,6 +22,7 @@ #include "debug.h" #include "message.h" +#include "qcstring.h" //------------------------------------------------------------------------ @@ -69,22 +70,22 @@ static char asciiToLower(char in) { return in; } -static int labelToEnumValue(const char *l) +static int labelToEnumValue(const QCString &l) { - std::string s = l; + std::string s = l.str(); std::transform(s.begin(),s.end(),s.begin(),asciiToLower); auto it = s_labels.find(s); return (it!=s_labels.end()) ? it->second : 0; } -int Debug::setFlag(const char *lab) +int Debug::setFlag(const QCString &lab) { int retVal = labelToEnumValue(lab); curMask = (DebugMask)(curMask | retVal); return retVal; } -void Debug::clearFlag(const char *lab) +void Debug::clearFlag(const QCString &lab) { curMask = (DebugMask)(curMask & ~labelToEnumValue(lab)); } diff --git a/src/debug.h b/src/debug.h index 5d4717a..bc93011 100644 --- a/src/debug.h +++ b/src/debug.h @@ -16,6 +16,8 @@ #ifndef _DEBUG_H #define _DEBUG_H +class QCString; + /** Class containing a print function for diagnostics. */ class Debug { @@ -42,8 +44,8 @@ class Debug }; static void print(DebugMask mask,int prio,const char *fmt,...); - static int setFlag(const char *label); - static void clearFlag(const char *label); + static int setFlag(const QCString &label); + static void clearFlag(const QCString &label); static bool isFlagSet(DebugMask mask); static void printFlags(); static void setPriority(int p); diff --git a/src/declinfo.l b/src/declinfo.l index 9ed7738..e340df5 100644 --- a/src/declinfo.l +++ b/src/declinfo.l @@ -118,7 +118,7 @@ ID "$"?([a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*)|(@[0-9]+) REJECT; } addTypeName(yyscanner); - yyextra->name += removeRedundantWhiteSpace(yytext); + yyextra->name += removeRedundantWhiteSpace(QCString(yytext)); } <Start>([~!]{B}*)?{ID}/({B}*"["{B}*"]")* { // the []'s are for Java, // the / was add to deal with multi- @@ -126,7 +126,7 @@ ID "$"?([a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*)|(@[0-9]+) // the leading ~ is for a destructor // the leading ! is for a C++/CLI finalizer (see bug 456475 and 635198) addTypeName(yyscanner); - yyextra->name += removeRedundantWhiteSpace(yytext); + yyextra->name += removeRedundantWhiteSpace(QCString(yytext)); } <Start>{B}*"::"{B}* { // found a yyextra->scope specifier if (!yyextra->scope.isEmpty()) @@ -135,7 +135,7 @@ ID "$"?([a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*)|(@[0-9]+) } else { - yyextra->scope = yyextra->name.copy(); // yyextra->scope becomes yyextra->name + yyextra->scope = yyextra->name; // yyextra->scope becomes yyextra->name } yyextra->name.resize(0); } @@ -152,7 +152,7 @@ ID "$"?([a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*)|(@[0-9]+) <Start>{B}*"("({ID}"::")*{B}*[&*]({B}*("const"|"volatile"){B}+)? { if (yyextra->insidePHP) REJECT; addType(yyscanner); - QCString text=yytext; + QCString text(yytext); yyextra->type+=text.stripWhiteSpace(); } <Start>{B}*")" { @@ -220,7 +220,7 @@ static void addType(yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("addType() yyextra->type='%s' yyextra->scope='%s' yyextra->name='%s'\n", - // yyextra->type.data(),yyextra->scope.data(),yyextra->name.data()); + // qPrint(yyextra->type),qPrint(yyextra->scope),qPrint(yyextra->name)); if (yyextra->name.isEmpty() && yyextra->scope.isEmpty()) return; if (!yyextra->type.isEmpty()) yyextra->type+=" "; if (!yyextra->scope.isEmpty()) yyextra->type+=yyextra->scope+"::"; @@ -233,7 +233,7 @@ static void addTypeName(yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("addTypeName() yyextra->type='%s' yyextra->scope='%s' yyextra->name='%s'\n", - // yyextra->type.data(),yyextra->scope.data(),yyextra->name.data()); + // qPrint(yyextra->type),qPrint(yyextra->scope),qPrint(yyextra->name)); if (yyextra->name.isEmpty() || yyextra->name.at(yyextra->name.length()-1)==':') // end of Objective-C keyword => append to yyextra->name not yyextra->type { @@ -276,7 +276,7 @@ void parseFuncDecl(const QCString &decl,const SrcLangExt lang,QCString &cl,QCStr #endif printlex(yy_flex_debug, TRUE, __FILE__, NULL); - yyextra->inputString = decl; + yyextra->inputString = decl.data(); //printf("Input='%s'\n",yyextra->inputString); yyextra->inputPosition = 0; yyextra->classTempListFound = FALSE; @@ -297,7 +297,7 @@ void parseFuncDecl(const QCString &decl,const SrcLangExt lang,QCString &cl,QCStr declinfoYYlex(g_yyscanner); //printf("yyextra->type='%s' class='%s' yyextra->name='%s' yyextra->args='%s'\n", - // yyextra->type.data(),yyextra->scope.data(),yyextra->name.data(),yyextra->args.data()); + // qPrint(yyextra->type),qPrint(yyextra->scope),qPrint(yyextra->name),qPrint(yyextra->args)); int nb = yyextra->name.findRev('['); if (nb!=-1 && yyextra->args.isEmpty()) // correct for [] in yyextra->name ambiguity (due to Java return yyextra->type allowing []) @@ -350,7 +350,7 @@ void parseFuncDecl(const QCString &decl,const SrcLangExt lang,QCString &cl,QCStr t=t.left(t.length()-1); } //printf("yyextra->type='%s' class='%s' yyextra->name='%s' yyextra->args='%s'\n", - // t.data(),cl.data(),n.data(),a.data()); + // qPrint(t),qPrint(cl),qPrint(n),qPrint(a)); printlex(yy_flex_debug, FALSE, __FILE__, NULL); declinfoYYlex_destroy(g_yyscanner); @@ -370,8 +370,8 @@ void dumpDecl(const char *s) parseFuncDecl(s,yyextra->className,classTNames,yyextra->type,yyextra->name,yyextra->args,funcTNames); msg("yyextra->type='%s' class='%s' classTempl='%s' yyextra->name='%s' " "funcTemplateNames='%s' yyextra->args='%s'\n", - yyextra->type.data(),yyextra->className.data(),classTNames.data(), - yyextra->name.data(),funcTNames.data(),yyextra->args.data() + qPrint(yyextra->type),qPrint(yyextra->className),qPrint(classTNames), + qPrint(yyextra->name),qPrint(funcTNames),qPrint(yyextra->args) ); } diff --git a/src/defargs.h b/src/defargs.h index 589eb90..a988b0b 100644 --- a/src/defargs.h +++ b/src/defargs.h @@ -25,7 +25,7 @@ class ArgumentList; class QCString; std::unique_ptr<ArgumentList> stringToArgumentList(SrcLangExt lang, - const char *argsString, + const QCString &argsString, QCString *extraTypeChars=0); #endif diff --git a/src/defargs.l b/src/defargs.l index 528d44c..9385cc3 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -165,7 +165,7 @@ CPPC "/\/" <ReadFuncArgDef>"'"\\."'" { yyextra->curArgDefValue+=yytext; } <ReadFuncArgDef>"'"."'" { yyextra->curArgDefValue+=yytext; } <ReadFuncArgDef>{RAWBEGIN} { yyextra->curArgDefValue+=yytext; - QCString text=yytext; + QCString text(yytext); int i=text.find('"'); yyextra->delimiter = yytext+i+1; yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1); @@ -329,7 +329,7 @@ CPPC "/\/" } <CopyRawString>{RAWEND} { yyextra->curArgDefValue+=yytext; - QCString delimiter = yytext+1; + QCString delimiter(yytext+1); delimiter=delimiter.left(delimiter.length()-1); if (delimiter==yyextra->delimiter) { @@ -346,7 +346,7 @@ CPPC "/\/" <ReadFuncArgType,ReadFuncArgDef>[,)>]{B}*({CCS}[*!]|{CPPC}[/!])"<" { yyextra->lastDocContext=YY_START; yyextra->lastDocChar=*yytext; - QCString text=yytext; + QCString text(yytext); if (text.find("//")!=-1) BEGIN( ReadDocLine ); else @@ -362,7 +362,7 @@ CPPC "/\/" { yyextra->curArgTypeName=removeRedundantWhiteSpace(yyextra->curArgTypeName); yyextra->curArgDefValue=yyextra->curArgDefValue.stripWhiteSpace(); - //printf("curArgType='%s' curArgDefVal='%s'\n",yyextra->curArgTypeName.data(),yyextra->curArgDefValue.data()); + //printf("curArgType='%s' curArgDefVal='%s'\n",qPrint(yyextra->curArgTypeName),qPrint(yyextra->curArgDefValue)); int l=yyextra->curArgTypeName.length(); if (l>0) { @@ -370,10 +370,10 @@ CPPC "/\/" while (i>=0 && (isspace((uchar)yyextra->curArgTypeName.at(i)) || yyextra->curArgTypeName.at(i)=='.')) i--; while (i>=0 && (isId(yyextra->curArgTypeName.at(i)) || yyextra->curArgTypeName.at(i)=='$')) i--; Argument a; - a.attrib = yyextra->curArgAttrib.copy(); + a.attrib = yyextra->curArgAttrib; a.typeConstraint = yyextra->curTypeConstraint.stripWhiteSpace(); //printf("a->type=%s a->name=%s i=%d l=%d\n", - // a->type.data(),a->name.data(),i,l); + // qPrint(a->type),qPrint(a->name),i,l); a.array.resize(0); if (i==l-1 && yyextra->curArgTypeName.at(i)==')') // function argument { @@ -414,7 +414,7 @@ CPPC "/\/" a.type = a.type + " " + a.name; a.name.resize(0); } - //printf(" --> a->type='%s' a->name='%s'\n",a->type.data(),a->name.data()); + //printf(" --> a->type='%s' a->name='%s'\n",qPrint(a->type),qPrint(a->name)); } else // assume only the type was specified, try to determine name later { @@ -426,7 +426,7 @@ CPPC "/\/" a.type = ""; } a.array += removeRedundantWhiteSpace(yyextra->curArgArray); - //printf("array=%s\n",a->array.data()); + //printf("array=%s\n",qPrint(a->array)); int alen = a.array.length(); if (alen>2 && a.array.at(0)=='(' && a.array.at(alen-1)==')') // fix-up for int *(a[10]) @@ -439,10 +439,10 @@ CPPC "/\/" a.array = a.array.mid(i); } } - a.defval = yyextra->curArgDefValue.copy(); - //printf("a->type=%s a->name=%s a->defval=\"%s\"\n",a->type.data(),a->name.data(),a->defval.data()); + a.defval = yyextra->curArgDefValue; + //printf("a->type=%s a->name=%s a->defval=\"%s\"\n",qPrint(a->type),qPrint(a->name),qPrint(a->defval)); a.docs = yyextra->curArgDocs.stripWhiteSpace(); - //printf("Argument '%s' '%s' adding docs='%s'\n",a->type.data(),a->name.data(),a->docs.data()); + //printf("Argument '%s' '%s' adding docs='%s'\n",qPrint(a->type),qPrint(a->name),qPrint(a->docs)); yyextra->argList->push_back(a); } yyextra->curArgAttrib.resize(0); @@ -475,13 +475,13 @@ CPPC "/\/" } } <ReadFuncArgType,ReadFuncArgPtr>"$"?{ID} { - QCString name=yytext; //resolveDefines(yytext); + QCString name(yytext); if (YY_START==ReadFuncArgType && yyextra->curArgArray=="[]") // Java style array { yyextra->curArgTypeName+=" []"; yyextra->curArgArray.resize(0); } - //printf("resolveName '%s'->'%s'\n",yytext,name.data()); + //printf("resolveName '%s'->'%s'\n",yytext,qPrint(name)); yyextra->curArgTypeName+=name; } <ReadFuncArgType,ReadFuncArgPtr>. { @@ -495,8 +495,7 @@ CPPC "/\/" yyextra->curArgDefValue+=*yytext; } <CopyArgRound,CopyArgRound2,CopyArgSharp,CopyArgCurly>{ID} { - QCString name=yytext; //resolveDefines(yytext); - *yyextra->copyArgValue+=name; + *yyextra->copyArgValue+=yytext; } <CopyArgRound,CopyArgRound2,CopyArgSharp,CopyArgCurly>. { *yyextra->copyArgValue += *yytext; @@ -530,7 +529,7 @@ CPPC "/\/" BEGIN(FuncQual); } <FuncQual>"->" { // C++11 trailing return type - yyextra->argList->setTrailingReturnType(" -> "); + yyextra->argList->setTrailingReturnType(QCString(" -> ")); BEGIN(TrailingReturn); } <TrailingReturn>{B}/("final"|"override"){B}* { @@ -776,13 +775,13 @@ static bool nameIsActuallyPartOfType(QCString &name) * for complex types are written to */ -std::unique_ptr<ArgumentList> stringToArgumentList(SrcLangExt lang, const char *argsString,QCString *extraTypeChars) +std::unique_ptr<ArgumentList> stringToArgumentList(SrcLangExt lang, const QCString &argsString,QCString *extraTypeChars) { std::unique_ptr<ArgumentList> al = std::make_unique<ArgumentList>(); - if (argsString==0) return al; + if (argsString.isEmpty()) return al; yyscan_t yyscanner; - defargsYY_state extra(argsString,al,lang); + defargsYY_state extra(argsString.data(),al,lang); defargsYYlex_init_extra(&extra,&yyscanner); #ifdef FLEX_DEBUG defargsYYset_debug(1,yyscanner); @@ -798,7 +797,7 @@ std::unique_ptr<ArgumentList> stringToArgumentList(SrcLangExt lang, const char * yyextra->argList->setNoParameters(TRUE); } if (extraTypeChars) *extraTypeChars=yyextra->extraTypeChars; - //printf("stringToArgumentList(%s) result=%s\n",argsString,argListToString(*al).data()); + //printf("stringToArgumentList(%s) result=%s\n",argsString,qPrint(argListToString(*al))); printlex(yy_flex_debug, FALSE, __FILE__, NULL); defargsYYlex_destroy(yyscanner); return al; diff --git a/src/defgen.cpp b/src/defgen.cpp index 6e6e5f7..c99d59b 100644 --- a/src/defgen.cpp +++ b/src/defgen.cpp @@ -36,28 +36,31 @@ #include "filedef.h" #include "filename.h" #include "dir.h" +#include "textstream.h" #define DEF_DB(x) -static inline void writeDEFString(std::ofstream &t,const char *s) +static inline void writeDEFString(TextStream &t,const QCString &s) { - const char* p=s; - char c; - t << '\''; - while ((c = *(p++))) + if (!s.isEmpty()) { - if (c == '\'') - t << '\\'; - t << c; + const char* p=s.data(); + char c; + + while ((c = *(p++))) + { + if (c == '\'') t << '\\'; + t << c; + } } t << '\''; } static void generateDEFForMember(const MemberDef *md, - std::ofstream &t, + TextStream &t, const Definition *def, - const char* Prefix) + const QCString &prefix) { QCString memPrefix; @@ -80,9 +83,9 @@ static void generateDEFForMember(const MemberDef *md, else if (md->getNamespaceDef()) scopeName=md->getNamespaceDef()->name(); - t << " " << Prefix << "-member = {\n"; + t << " " << prefix << "-member = {\n"; memPrefix = " "; - memPrefix.append( Prefix ); + memPrefix.append( prefix ); memPrefix.append( "-mem-" ); QCString memType; @@ -290,14 +293,14 @@ static void generateDEFForMember(const MemberDef *md, } } - t << " }; /* " << Prefix << "-member */\n"; + t << " }; /* " << prefix << "-member */\n"; } static void generateDEFClassSection(const ClassDef *cd, - std::ofstream &t, + TextStream &t, const MemberList *ml, - const char *kind) + const QCString &kind) { if (cd && ml && !ml->empty()) { @@ -312,7 +315,7 @@ static void generateDEFClassSection(const ClassDef *cd, } } -static void generateDEFForClass(const ClassDef *cd,std::ofstream &t) +static void generateDEFForClass(const ClassDef *cd,TextStream &t) { // + brief description // + detailed description @@ -445,9 +448,9 @@ static void generateDEFForClass(const ClassDef *cd,std::ofstream &t) } static void generateDEFSection(const Definition *d, - std::ofstream &t, + TextStream &t, const MemberList *ml, - const char *kind) + const QCString &kind) { if (ml && !ml->empty()) { @@ -460,7 +463,7 @@ static void generateDEFSection(const Definition *d, } } -static void generateDEFForNamespace(const NamespaceDef *nd,std::ofstream &t) +static void generateDEFForNamespace(const NamespaceDef *nd,TextStream &t) { if (nd->isReference()) return; // skip external references t << " namespace = {\n"; @@ -488,7 +491,7 @@ static void generateDEFForNamespace(const NamespaceDef *nd,std::ofstream &t) t << " };\n"; } -static void generateDEFForFile(const FileDef *fd,std::ofstream &t) +static void generateDEFForFile(const FileDef *fd,TextStream &t) { if (fd->isReference()) return; // skip external references @@ -526,17 +529,18 @@ void generateDEF() Dir defDir(outputDirectory.str()); if (!defDir.exists() && !defDir.mkdir(outputDirectory.str())) { - err("Could not create def directory in %s\n",outputDirectory.data()); + err("Could not create def directory in %s\n",qPrint(outputDirectory)); return; } QCString fileName=outputDirectory+"/doxygen.def"; - std::ofstream t(fileName.str(),std::ostream::out | std::ostream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ostream::out | std::ostream::binary); + if (!f.is_open()) { - err("Cannot open file %s for writing!\n",fileName.data()); + err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } + TextStream t(&f); t << "AutoGen Definitions dummy;\n"; if (Doxygen::classLinkedMap->size()+ diff --git a/src/definition.cpp b/src/definition.cpp index 5ca1d87..a03a676 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -56,7 +56,7 @@ class DefinitionImpl::IMPL { public: ~IMPL(); - void init(const char *df, const char *n); + void init(const QCString &df, const QCString &n); void setDefFileName(const QCString &df); Definition *def = 0; @@ -121,7 +121,7 @@ void DefinitionImpl::IMPL::setDefFileName(const QCString &df) } } -void DefinitionImpl::IMPL::init(const char *df, const char *n) +void DefinitionImpl::IMPL::init(const QCString &df, const QCString &n) { setDefFileName(df); QCString lname = n; @@ -134,7 +134,7 @@ void DefinitionImpl::IMPL::init(const char *df, const char *n) { localName=n; } - //printf("m_localName=%s\n",m_localName.data()); + //printf("m_localName=%s\n",qPrint(m_localName)); brief = 0; details = 0; @@ -158,11 +158,11 @@ void DefinitionImpl::setDefFile(const QCString &df,int defLine,int defCol) //----------------------------------------------------------------------------------------- -static bool matchExcludedSymbols(const char *name) +static bool matchExcludedSymbols(const QCString &name) { const StringVector &exclSyms = Config_getList(EXCLUDE_SYMBOLS); if (exclSyms.empty()) return FALSE; // nothing specified - std::string symName = name; + std::string symName = name.str(); for (const auto &pat : exclSyms) { QCString pattern = pat.c_str(); @@ -185,14 +185,14 @@ static bool matchExcludedSymbols(const char *name) (ui+pl==sl || pattern.at(pattern.length()-1)=='*' || (!isId(symName.at(ui+pl)) && !forceEnd)) ) { - //printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i); + //printf("--> name=%s pattern=%s match at %d\n",qPrint(symName),qPrint(pattern),i); return TRUE; } } } else if (!pattern.isEmpty()) // match words { - size_t i = symName.find(pattern); + size_t i = symName.find(pattern.str()); if (i!=std::string::npos) // we have a match! { size_t ui=i; @@ -203,7 +203,7 @@ static bool matchExcludedSymbols(const char *name) (ui+pl==sl || (!isId(symName.at(ui+pl)) && !forceEnd)) ) { - //printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i); + //printf("--> name=%s pattern=%s match at %d\n",qPrint(symName),qPrint(pattern),i); return TRUE; } } @@ -213,7 +213,7 @@ static bool matchExcludedSymbols(const char *name) return FALSE; } -static void addToMap(const char *name,Definition *d) +static void addToMap(const QCString &name,Definition *d) { bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); QCString symbolName = name; @@ -227,14 +227,14 @@ static void addToMap(const char *name,Definition *d) } } -static void removeFromMap(const char *name,Definition *d) +static void removeFromMap(const QCString &name,Definition *d) { Doxygen::symbolMap.remove(name,d); } DefinitionImpl::DefinitionImpl(Definition *def, - const char *df,int dl,int dc, - const char *name,const char *b, + const QCString &df,int dl,int dc, + const QCString &name,const char *b, const char *d,bool isSymbol) { m_impl = new DefinitionImpl::IMPL; @@ -291,23 +291,23 @@ DefinitionImpl::~DefinitionImpl() m_impl=0; } -void DefinitionImpl::setName(const char *name) +void DefinitionImpl::setName(const QCString &name) { - if (name==0) return; + if (name.isEmpty()) return; m_impl->name = name; m_impl->isAnonymous = m_impl->name.isEmpty() || m_impl->name.at(0)=='@' || m_impl->name.find("::@")!=-1; } -void DefinitionImpl::setId(const char *id) +void DefinitionImpl::setId(const QCString &id) { - if (id==0) return; + if (id.isEmpty()) return; m_impl->id = id; if (Doxygen::clangUsrMap) { - //printf("DefinitionImpl::setId '%s'->'%s'\n",id,m_impl->name.data()); - Doxygen::clangUsrMap->insert(std::make_pair(id,m_impl->def)); + //printf("DefinitionImpl::setId '%s'->'%s'\n",id,qPrint(m_impl->name)); + Doxygen::clangUsrMap->insert(std::make_pair(id.str(),m_impl->def)); } } @@ -318,14 +318,14 @@ QCString DefinitionImpl::id() const void DefinitionImpl::addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList) { - //printf("%s: addSectionsToDefinition(%d)\n",name().data(),anchorList->count()); + //printf("%s: addSectionsToDefinition(%d)\n",qPrint(name()),anchorList->count()); for (const SectionInfo *si : anchorList) { //printf("Add section '%s' to definition '%s'\n", - // si->label().data(),name().data()); + // qPrint(si->label()),qPrint(name())); SectionManager &sm = SectionManager::instance(); SectionInfo *gsi=sm.find(si->label()); - //printf("===== label=%s gsi=%p\n",si->label.data(),gsi); + //printf("===== label=%s gsi=%p\n",qPrint(si->label),gsi); if (gsi==0) { gsi = sm.add(*si); @@ -340,7 +340,7 @@ void DefinitionImpl::addSectionsToDefinition(const std::vector<const SectionInfo bool DefinitionImpl::hasSections() const { - //printf("DefinitionImpl::hasSections(%s) #sections=%d\n",name().data(), + //printf("DefinitionImpl::hasSections(%s) #sections=%d\n",qPrint(name()), // m_impl->sectionRefs.size()); if (m_impl->sectionRefs.empty()) return FALSE; for (const SectionInfo *si : m_impl->sectionRefs) @@ -364,7 +364,7 @@ void DefinitionImpl::addSectionsToIndex() SectionType type = si->type(); if (isSection(type)) { - //printf(" level=%d title=%s\n",level,si->title.data()); + //printf(" level=%d title=%s\n",level,qPrint(si->title)); int nextLevel = (int)type; int i; if (nextLevel>level) @@ -403,11 +403,11 @@ void DefinitionImpl::addSectionsToIndex() } } -void DefinitionImpl::writeDocAnchorsToTagFile(std::ostream &tagFile) const +void DefinitionImpl::writeDocAnchorsToTagFile(TextStream &tagFile) const { if (!m_impl->sectionRefs.empty()) { - //printf("%s: writeDocAnchorsToTagFile(%d)\n",name().data(),m_impl->sectionRef.size()); + //printf("%s: writeDocAnchorsToTagFile(%d)\n",qPrint(name()),m_impl->sectionRef.size()); for (const SectionInfo *si : m_impl->sectionRefs) { if (!si->generated() && si->ref().isEmpty() && !si->label().startsWith("autotoc_md")) @@ -428,17 +428,17 @@ void DefinitionImpl::writeDocAnchorsToTagFile(std::ostream &tagFile) const bool DefinitionImpl::_docsAlreadyAdded(const QCString &doc,QCString &sigList) { uchar md5_sig[16]; - QCString sigStr(33); + char sigStr[33]; // to avoid mismatches due to differences in indenting, we first remove // double whitespaces... QCString docStr = doc.simplifyWhiteSpace(); MD5Buffer((const unsigned char *)docStr.data(),docStr.length(),md5_sig); - MD5SigToString(md5_sig,sigStr.rawData(),33); + MD5SigToString(md5_sig,sigStr); //printf("%s:_docsAlreadyAdded doc='%s' sig='%s' docSigs='%s'\n", - // name().data(),doc.data(),sigStr.data(),sigList.data()); + // qPrint(name()),qPrint(doc),qPrint(sigStr),qPrint(sigList)); if (sigList.find(sigStr)==-1) // new docs, add signature to prevent re-adding it { - sigList+=":"+sigStr; + sigList+=QCString(":")+sigStr; return FALSE; } else @@ -447,11 +447,11 @@ bool DefinitionImpl::_docsAlreadyAdded(const QCString &doc,QCString &sigList) } } -void DefinitionImpl::_setDocumentation(const char *d,const char *docFile,int docLine, +void DefinitionImpl::_setDocumentation(const QCString &d,const QCString &docFile,int docLine, bool stripWhiteSpace,bool atTop) { - //printf("%s::setDocumentation(%s,%s,%d,%d)\n",name().data(),d,docFile,docLine,stripWhiteSpace); - if (d==0) return; + //printf("%s::setDocumentation(%s,%s,%d,%d)\n",qPrint(name()),d,docFile,docLine,stripWhiteSpace); + if (d.isEmpty()) return; QCString doc = d; if (stripWhiteSpace) { @@ -463,7 +463,7 @@ void DefinitionImpl::_setDocumentation(const char *d,const char *docFile,int doc } if (!_docsAlreadyAdded(doc,m_impl->docSignatures)) { - //printf("setting docs for %s: '%s'\n",name().data(),m_doc.data()); + //printf("setting docs for %s: '%s'\n",qPrint(name()),qPrint(m_doc)); if (m_impl->details==0) { m_impl->details = new DocInfo; @@ -493,13 +493,13 @@ void DefinitionImpl::_setDocumentation(const char *d,const char *docFile,int doc } } -void DefinitionImpl::setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace) +void DefinitionImpl::setDocumentation(const QCString &d,const QCString &docFile,int docLine,bool stripWhiteSpace) { - if (d==0) return; + if (d.isEmpty()) return; _setDocumentation(d,docFile,docLine,stripWhiteSpace,FALSE); } -void DefinitionImpl::_setBriefDescription(const char *b,const char *briefFile,int briefLine) +void DefinitionImpl::_setBriefDescription(const QCString &b,const QCString &briefFile,int briefLine) { static QCString outputLanguage = Config_getEnum(OUTPUT_LANGUAGE); static bool needsDot = outputLanguage!="Japanese" && @@ -556,13 +556,13 @@ void DefinitionImpl::_setBriefDescription(const char *b,const char *briefFile,in } } -void DefinitionImpl::setBriefDescription(const char *b,const char *briefFile,int briefLine) +void DefinitionImpl::setBriefDescription(const QCString &b,const QCString &briefFile,int briefLine) { - if (b==0) return; + if (b.isEmpty()) return; _setBriefDescription(b,briefFile,briefLine); } -void DefinitionImpl::_setInbodyDocumentation(const char *doc,const char *inbodyFile,int inbodyLine) +void DefinitionImpl::_setInbodyDocumentation(const QCString &doc,const QCString &inbodyFile,int inbodyLine) { if (m_impl->inbodyDocs==0) { @@ -580,9 +580,9 @@ void DefinitionImpl::_setInbodyDocumentation(const char *doc,const char *inbodyF } } -void DefinitionImpl::setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine) +void DefinitionImpl::setInbodyDocumentation(const QCString &d,const QCString &inbodyFile,int inbodyLine) { - if (d==0) return; + if (d.isEmpty()) return; _setInbodyDocumentation(d,inbodyFile,inbodyLine); } @@ -729,7 +729,7 @@ static FilterCache g_filterCache; * The line actually containing the bracket is returned via endLine. * Note that for VHDL code the bracket search is not done. */ -bool readCodeFragment(const char *fileName, +bool readCodeFragment(const QCString &fileName, int &startLine,int &endLine,QCString &result) { //printf("readCodeFragment(%s,startLine=%d,endLine=%d)\n",fileName,startLine,endLine); @@ -865,7 +865,7 @@ bool readCodeFragment(const char *fileName, } result = transcodeCharacterStringToUTF8(result); if (!result.isEmpty() && result.at(result.length()-1)!='\n') result += "\n"; - //printf("readCodeFragment(%d-%d)=%s\n",startLine,endLine,result.data()); + //printf("readCodeFragment(%d-%d)=%s\n",startLine,endLine,qPrint(result)); return found; } @@ -902,7 +902,7 @@ QCString DefinitionImpl::getSourceAnchor() const } /*! Write a reference to the source code defining this definition */ -void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const +void DefinitionImpl::writeSourceDef(OutputList &ol,const QCString &) const { static bool latexSourceCode = Config_getBool(LATEX_SOURCE_CODE); static bool rtfSourceCode = Config_getBool(RTF_SOURCE_CODE); @@ -940,7 +940,7 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const ol.disable(OutputGenerator::RTF); } // write line link (HTML and optionally LaTeX, Docbook, RTF) - ol.writeObjectLink(0,fn,anchorStr,lineStr); + ol.writeObjectLink(QCString(),fn,anchorStr,lineStr); ol.enableAll(); ol.disable(OutputGenerator::Html); if (latexSourceCode) @@ -978,7 +978,7 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const ol.disable(OutputGenerator::RTF); } // write file link (HTML, LaTeX optionally, RTF optionally) - ol.writeObjectLink(0,fn,0,m_impl->body->fileDef->name()); + ol.writeObjectLink(QCString(),fn,QCString(),m_impl->body->fileDef->name()); ol.enableAll(); ol.disable(OutputGenerator::Html); if (latexSourceCode) @@ -1019,7 +1019,7 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const ol.disable(OutputGenerator::RTF); } // write file link (HTML only) - ol.writeObjectLink(0,fn,0,m_impl->body->fileDef->name()); + ol.writeObjectLink(QCString(),fn,QCString(),m_impl->body->fileDef->name()); ol.enableAll(); ol.disable(OutputGenerator::Html); if (latexSourceCode) @@ -1058,7 +1058,7 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const ol.enable(OutputGenerator::RTF); } // write line link (HTML only) - ol.writeObjectLink(0,fn,anchorStr,lineStr); + ol.writeObjectLink(QCString(),fn,anchorStr,lineStr); ol.enableAll(); ol.disable(OutputGenerator::Html); if (latexSourceCode) @@ -1092,7 +1092,7 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const void DefinitionImpl::setBodySegment(int defLine, int bls,int ble) { - //printf("setBodySegment(%d,%d) for %s\n",bls,ble,name().data()); + //printf("setBodySegment(%d,%d) for %s\n",bls,ble,qPrint(name())); if (m_impl->body==0) m_impl->body = new BodyInfo; m_impl->body->defLine = defLine; m_impl->body->startLine = bls; @@ -1113,11 +1113,11 @@ bool DefinitionImpl::hasSources() const } /*! Write code of this definition into the documentation */ -void DefinitionImpl::writeInlineCode(OutputList &ol,const char *scopeName) const +void DefinitionImpl::writeInlineCode(OutputList &ol,const QCString &scopeName) const { static bool inlineSources = Config_getBool(INLINE_SOURCES); ol.pushGeneratorState(); - //printf("Source Fragment %s: %d-%d bodyDef=%p\n",name().data(), + //printf("Source Fragment %s: %d-%d bodyDef=%p\n",qPrint(name()), // m_startBodyLine,m_endBodyLine,m_bodyDef); if (inlineSources && hasSources()) { @@ -1128,10 +1128,10 @@ void DefinitionImpl::writeInlineCode(OutputList &ol,const char *scopeName) const ) { //printf("Adding code fragment '%s' ext='%s'\n", - // codeFragment.data(),m_impl->defFileExt.data()); + // qPrint(codeFragment),qPrint(m_impl->defFileExt)); auto intf = Doxygen::parserManager->getCodeParser(m_impl->defFileExt); intf->resetCodeParserState(); - //printf("Read:\n'%s'\n\n",codeFragment.data()); + //printf("Read:\n'%s'\n\n",qPrint(codeFragment)); const MemberDef *thisMd = 0; if (m_impl->def->definitionType()==Definition::TypeMember) { @@ -1144,7 +1144,7 @@ void DefinitionImpl::writeInlineCode(OutputList &ol,const char *scopeName) const codeFragment, // input m_impl->lang, // lang FALSE, // isExample - 0, // exampleName + QCString(), // exampleName m_impl->body->fileDef, // fileDef actualStart, // startLine actualEnd, // endLine @@ -1176,7 +1176,7 @@ static inline std::vector<const MemberDef*> refMapToVector(const std::unordered_ /*! Write a reference to the source code fragments in which this * definition is used. */ -void DefinitionImpl::_writeSourceRefList(OutputList &ol,const char *scopeName, +void DefinitionImpl::_writeSourceRefList(OutputList &ol,const QCString &scopeName, const QCString &text,const std::unordered_map<std::string,const MemberDef *> &membersMap, bool /*funcOnly*/) const { @@ -1197,7 +1197,7 @@ void DefinitionImpl::_writeSourceRefList(OutputList &ol,const char *scopeName, { QCString scope=md->getScopeString(); QCString name=md->name(); - //printf("class=%p scope=%s scopeName=%s\n",md->getClassDef(),scope.data(),scopeName); + //printf("class=%p scope=%s scopeName=%s\n",md->getClassDef(),qPrint(scope),scopeName); if (!scope.isEmpty() && scope!=scopeName) { name.prepend(scope+getLanguageSpecificSeparator(m_impl->lang)); @@ -1239,8 +1239,8 @@ void DefinitionImpl::_writeSourceRefList(OutputList &ol,const char *scopeName, const int maxLineNrStr = 10; char anchorStr[maxLineNrStr]; qsnprintf(anchorStr,maxLineNrStr,"l%05d",md->getStartBodyLine()); - //printf("Write object link to %s\n",md->getBodyDef()->getSourceFileBase().data()); - ol.writeObjectLink(0,md->getBodyDef()->getSourceFileBase(),anchorStr,name); + //printf("Write object link to %s\n",qPrint(md->getBodyDef()->getSourceFileBase())); + ol.writeObjectLink(QCString(),md->getBodyDef()->getSourceFileBase(),anchorStr,name); ol.popGeneratorState(); // for the other output formats just mention the name @@ -1324,12 +1324,12 @@ void DefinitionImpl::_writeSourceRefList(OutputList &ol,const char *scopeName, ol.popGeneratorState(); } -void DefinitionImpl::writeSourceReffedBy(OutputList &ol,const char *scopeName) const +void DefinitionImpl::writeSourceReffedBy(OutputList &ol,const QCString &scopeName) const { _writeSourceRefList(ol,scopeName,theTranslator->trReferencedBy(),m_impl->sourceRefByDict,FALSE); } -void DefinitionImpl::writeSourceRefs(OutputList &ol,const char *scopeName) const +void DefinitionImpl::writeSourceRefs(OutputList &ol,const QCString &scopeName) const { _writeSourceRefList(ol,scopeName,theTranslator->trReferences(),m_impl->sourceRefsDict,TRUE); } @@ -1391,7 +1391,7 @@ void DefinitionImpl::addSourceReferences(const MemberDef *md) } } -const Definition *DefinitionImpl::findInnerCompound(const char *) const +const Definition *DefinitionImpl::findInnerCompound(const QCString &) const { return 0; } @@ -1411,7 +1411,7 @@ QCString DefinitionImpl::qualifiedName() const return m_impl->qualifiedName; } - //printf("start %s::qualifiedName() localName=%s\n",name().data(),m_impl->localName.data()); + //printf("start %s::qualifiedName() localName=%s\n",qPrint(name()),qPrint(m_impl->localName)); if (m_impl->outerScope==0) { if (m_impl->localName=="<globalScope>") @@ -1436,14 +1436,14 @@ QCString DefinitionImpl::qualifiedName() const getLanguageSpecificSeparator(getLanguage())+ m_impl->localName; } - //printf("end %s::qualifiedName()=%s\n",name().data(),m_impl->qualifiedName.data()); + //printf("end %s::qualifiedName()=%s\n",qPrint(name()),qPrint(m_impl->qualifiedName)); //count--; return m_impl->qualifiedName; } void DefinitionImpl::setOuterScope(Definition *d) { - //printf("%s::setOuterScope(%s)\n",name().data(),d?d->name().data():"<none>"); + //printf("%s::setOuterScope(%s)\n",qPrint(name()),d?qPrint(d->name()):"<none>"); Definition *p = m_impl->outerScope; bool found=false; // make sure that we are not creating a recursive scope relation. @@ -1489,7 +1489,7 @@ void DefinitionImpl::mergeRefItems(Definition *d) [](RefItem *left,RefItem *right) { return left->id() <right->id() || (left->id()==right->id() && - qstrcmp(left->list()->listName(),right->list()->listName())<0); + left->list()->listName() < right->list()->listName()); }); // filter out duplicates @@ -1501,7 +1501,7 @@ void DefinitionImpl::mergeRefItems(Definition *d) m_impl->xrefListItems.erase(last, m_impl->xrefListItems.end()); } -int DefinitionImpl::_getXRefListId(const char *listName) const +int DefinitionImpl::_getXRefListId(const QCString &listName) const { for (const RefItem *item : m_impl->xrefListItems) { @@ -1529,14 +1529,14 @@ QCString DefinitionImpl::pathFragment() const { if (!result.isEmpty()) result+="/"; if (m_impl->def->definitionType()==Definition::TypeGroup && - (toGroupDef(m_impl->def))->groupTitle()) + !toGroupDef(m_impl->def)->groupTitle().isEmpty()) { - result+=(toGroupDef(m_impl->def))->groupTitle(); + result+=toGroupDef(m_impl->def)->groupTitle(); } else if (m_impl->def->definitionType()==Definition::TypePage && - (toPageDef(m_impl->def))->hasTitle()) + toPageDef(m_impl->def)->hasTitle()) { - result+=(toPageDef(m_impl->def))->title(); + result+=toPageDef(m_impl->def)->title(); } else { @@ -1565,19 +1565,22 @@ QCString DefinitionImpl::navigationPathAsString() const { result+=outerScope->navigationPathAsString(); } - else if (m_impl->def->definitionType()==Definition::TypeFile && (toFileDef(m_impl->def))->getDirDef()) + else if (m_impl->def->definitionType()==Definition::TypeFile && + toFileDef(m_impl->def)->getDirDef()) { result+=(toFileDef(m_impl->def))->getDirDef()->navigationPathAsString(); } result+="<li class=\"navelem\">"; if (m_impl->def->isLinkable()) { - if (m_impl->def->definitionType()==Definition::TypeGroup && (toGroupDef(m_impl->def))->groupTitle()) + if (m_impl->def->definitionType()==Definition::TypeGroup && + !toGroupDef(m_impl->def)->groupTitle().isEmpty()) { result+="<a class=\"el\" href=\"$relpath^"+m_impl->def->getOutputFileBase()+Doxygen::htmlFileExtension+"\">"+ - convertToHtml((toGroupDef(m_impl->def))->groupTitle())+"</a>"; + convertToHtml(toGroupDef(m_impl->def)->groupTitle())+"</a>"; } - else if (m_impl->def->definitionType()==Definition::TypePage && (toPageDef(m_impl->def))->hasTitle()) + else if (m_impl->def->definitionType()==Definition::TypePage && + toPageDef(m_impl->def)->hasTitle()) { result+="<a class=\"el\" href=\"$relpath^"+m_impl->def->getOutputFileBase()+Doxygen::htmlFileExtension+"\">"+ convertToHtml((toPageDef(m_impl->def))->title())+"</a>"; @@ -1647,7 +1650,7 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const SectionType type = si->type(); if (isSection(type)) { - //printf(" level=%d title=%s\n",level,si->title.data()); + //printf(" level=%d title=%s\n",level,qPrint(si->title)); int nextLevel = (int)type; if (nextLevel>level) { @@ -1713,7 +1716,7 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const SectionType type = si->type(); if (isSection(type)) { - //printf(" level=%d title=%s\n",level,si->title.data()); + //printf(" level=%d title=%s\n",level,qPrint(si->title)); int nextLevel = (int)type; if (nextLevel>level) { @@ -1810,7 +1813,7 @@ static bool stripWord(QCString &s,QCString w) //---------------------------------------------------------------------------- // some quasi intelligent brief description abbreviator :^) -QCString abbreviate(const char *s,const char *name) +static QCString abbreviate(const QCString &s,const QCString &name) { QCString scopelessName=name; int i=scopelessName.findRev("::"); @@ -1845,7 +1848,7 @@ QCString abbreviate(const char *s,const char *name) QCString DefinitionImpl::briefDescription(bool abbr) const { - //printf("%s::briefDescription(%d)='%s'\n",name().data(),abbr,m_impl->brief?m_impl->brief->doc.data():"<none>"); + //printf("%s::briefDescription(%d)='%s'\n",qPrint(name()),abbr,m_impl->brief?qPrint(m_impl->brief->doc):"<none>"); return m_impl->brief ? (abbr ? abbreviate(m_impl->brief->doc,m_impl->def->displayName()) : m_impl->brief->doc) : QCString(""); @@ -2019,7 +2022,7 @@ void DefinitionImpl::mergeReferencedBy(const Definition *other) } -void DefinitionImpl::setReference(const char *r) +void DefinitionImpl::setReference(const QCString &r) { m_impl->ref=r; } @@ -2039,7 +2042,7 @@ void DefinitionImpl::setArtificial(bool b) m_impl->isArtificial = b; } -void DefinitionImpl::setLocalName(const QCString name) +void DefinitionImpl::setLocalName(const QCString &name) { m_impl->localName=name; } @@ -2074,7 +2077,7 @@ QCString DefinitionImpl::externalReference(const QCString &relPath) const auto it = Doxygen::tagDestinationMap.find(ref.str()); if (it!=Doxygen::tagDestinationMap.end()) { - QCString result = it->second; + QCString result(it->second); uint l = result.length(); if (!relPath.isEmpty() && l>0 && result.at(0)=='.') { // relative path -> prepend relPath. @@ -2151,7 +2154,7 @@ void DefinitionAliasImpl::deinit() QCString DefinitionAliasImpl::qualifiedName() const { - //printf("start %s::qualifiedName() localName=%s\n",name().data(),m_impl->localName.data()); + //printf("start %s::qualifiedName() localName=%s\n",qPrint(name()),qPrint(m_impl->localName)); if (m_scope==0) { return m_def->localName(); diff --git a/src/definition.h b/src/definition.h index 900bbb2..6a1edfa 100644 --- a/src/definition.h +++ b/src/definition.h @@ -19,7 +19,6 @@ #define DEFINITION_H #include <vector> -#include <iostream> #include "types.h" #include "reflist.h" @@ -40,6 +39,7 @@ class SectionInfo; class Definition; class DefinitionMutable; class DefinitionImpl; +class TextStream; /** Data associated with a detailed description. */ struct DocInfo @@ -90,7 +90,8 @@ class Definition TypeGroup = 4, TypePackage = 5, TypePage = 6, - TypeDir = 7 + TypeDir = 7, + TypeConcept = 8 }; @@ -263,7 +264,7 @@ class Definition virtual const RefItemVector &xrefListItems() const = 0; - virtual const Definition *findInnerCompound(const char *name) const = 0; + virtual const Definition *findInnerCompound(const QCString &name) const = 0; virtual Definition *getOuterScope() const = 0; virtual std::vector<const MemberDef *> getReferencesMembers() const = 0; @@ -316,30 +317,30 @@ class DefinitionMutable //----------------------------------------------------------------------------------- /*! Sets a new \a name for the definition */ - virtual void setName(const char *name) = 0; + virtual void setName(const QCString &name) = 0; /*! Sets a unique id for the symbol. Used for libclang integration. */ - virtual void setId(const char *name) = 0; + virtual void setId(const QCString &name) = 0; /*! Set a new file name and position */ virtual void setDefFile(const QCString& df,int defLine,int defColumn) = 0; /*! Sets the documentation of this definition to \a d. */ - virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE) = 0; + virtual void setDocumentation(const QCString &d,const QCString &docFile,int docLine,bool stripWhiteSpace=TRUE) = 0; /*! Sets the brief description of this definition to \a b. * A dot is added to the sentence if not available. */ - virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine) = 0; + virtual void setBriefDescription(const QCString &b,const QCString &briefFile,int briefLine) = 0; /*! Set the documentation that was found inside the body of an item. * If there was already some documentation set, the new documentation * will be appended. */ - virtual void setInbodyDocumentation(const char *d,const char *docFile,int docLine) = 0; + virtual void setInbodyDocumentation(const QCString &d,const QCString &docFile,int docLine) = 0; /*! Sets the tag file id via which this definition was imported. */ - virtual void setReference(const char *r) = 0; + virtual void setReference(const QCString &r) = 0; // source references virtual void setBodySegment(int defLine, int bls,int ble) = 0; @@ -352,7 +353,7 @@ class DefinitionMutable virtual void setArtificial(bool b) = 0; virtual void setLanguage(SrcLangExt lang) = 0; - virtual void setLocalName(const QCString name) = 0; + virtual void setLocalName(const QCString &name) = 0; //----------------------------------------------------------------------------------- // --- actions ---- @@ -376,14 +377,14 @@ class DefinitionMutable //----------------------------------------------------------------------------------- // --- writing output ---- //----------------------------------------------------------------------------------- - virtual void writeSourceDef(OutputList &ol,const char *scopeName) const = 0; - virtual void writeInlineCode(OutputList &ol,const char *scopeName) const = 0; - virtual void writeSourceRefs(OutputList &ol,const char *scopeName) const = 0; - virtual void writeSourceReffedBy(OutputList &ol,const char *scopeName) const = 0; + virtual void writeSourceDef(OutputList &ol,const QCString &scopeName) const = 0; + virtual void writeInlineCode(OutputList &ol,const QCString &scopeName) const = 0; + virtual void writeSourceRefs(OutputList &ol,const QCString &scopeName) const = 0; + virtual void writeSourceReffedBy(OutputList &ol,const QCString &scopeName) const = 0; virtual void writeNavigationPath(OutputList &ol) const = 0; virtual void writeQuickMemberLinks(OutputList &,const MemberDef *) const = 0; virtual void writeSummaryLinks(OutputList &) const = 0; - virtual void writeDocAnchorsToTagFile(std::ostream &) const = 0; + virtual void writeDocAnchorsToTagFile(TextStream &) const = 0; virtual void writeToc(OutputList &ol, const LocalToc <) const = 0; // --------------------------------- @@ -403,7 +404,7 @@ DefinitionMutable *toDefinitionMutable(const Definition *d); * via \a result. The function returns TRUE if successful and FALSE * in case of an error. */ -bool readCodeFragment(const char *fileName, +bool readCodeFragment(const QCString &fileName, int &startLine,int &endLine, QCString &result); #endif diff --git a/src/definitionimpl.h b/src/definitionimpl.h index 0ac394f..aeb3f8d 100644 --- a/src/definitionimpl.h +++ b/src/definitionimpl.h @@ -28,8 +28,8 @@ class DefinitionImpl public: DefinitionImpl( Definition *def, - const char *defFileName,int defLine,int defColumn, - const char *name,const char *b=0,const char *d=0, + const QCString &defFileName,int defLine,int defColumn, + const QCString &name,const char *b=0,const char *d=0, bool isSymbol=TRUE); virtual ~DefinitionImpl(); @@ -71,7 +71,7 @@ class DefinitionImpl const GroupList &partOfGroups() const; bool isLinkableViaGroup() const; const RefItemVector &xrefListItems() const; - const Definition *findInnerCompound(const char *name) const; + const Definition *findInnerCompound(const QCString &name) const; Definition *getOuterScope() const; std::vector<const MemberDef *> getReferencesMembers() const; std::vector<const MemberDef *> getReferencedByMembers() const; @@ -80,13 +80,13 @@ class DefinitionImpl bool hasBriefDescription() const; QCString id() const; const SectionRefs &getSectionRefs() const; - void setName(const char *name); - void setId(const char *name); + void setName(const QCString &name); + void setId(const QCString &name); void setDefFile(const QCString& df,int defLine,int defColumn); - void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE); - void setBriefDescription(const char *b,const char *briefFile,int briefLine); - void setInbodyDocumentation(const char *d,const char *docFile,int docLine); - void setReference(const char *r); + void setDocumentation(const QCString &d,const QCString &docFile,int docLine,bool stripWhiteSpace=TRUE); + void setBriefDescription(const QCString &b,const QCString &briefFile,int briefLine); + void setInbodyDocumentation(const QCString &d,const QCString &docFile,int docLine); + void setReference(const QCString &r); void addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList); void setBodySegment(int defLine,int bls,int ble); void setBodyDef(FileDef *fd); @@ -101,18 +101,18 @@ class DefinitionImpl void setHidden(bool b); void setArtificial(bool b); void setLanguage(SrcLangExt lang); - void writeSourceDef(OutputList &ol,const char *scopeName) const; - void writeInlineCode(OutputList &ol,const char *scopeName) const; - void writeSourceRefs(OutputList &ol,const char *scopeName) const; - void writeSourceReffedBy(OutputList &ol,const char *scopeName) const; + void writeSourceDef(OutputList &ol,const QCString &scopeName) const; + void writeInlineCode(OutputList &ol,const QCString &scopeName) const; + void writeSourceRefs(OutputList &ol,const QCString &scopeName) const; + void writeSourceReffedBy(OutputList &ol,const QCString &scopeName) const; void makePartOfGroup(const GroupDef *gd); void writeNavigationPath(OutputList &ol) const; QCString navigationPathAsString() const; void writeQuickMemberLinks(OutputList &,const MemberDef *) const; void writeSummaryLinks(OutputList &) const; QCString pathFragment() const; - void writeDocAnchorsToTagFile(std::ostream &) const; - void setLocalName(const QCString name); + void writeDocAnchorsToTagFile(TextStream &) const; + void setLocalName(const QCString &name); void addSectionsToIndex(); void writeToc(OutputList &ol, const LocalToc <) const; void setCookie(Definition::Cookie *cookie) const; @@ -125,12 +125,12 @@ class DefinitionImpl private: - int _getXRefListId(const char *listName) const; - void _writeSourceRefList(OutputList &ol,const char *scopeName,const QCString &text, + int _getXRefListId(const QCString &listName) const; + void _writeSourceRefList(OutputList &ol,const QCString &scopeName,const QCString &text, const std::unordered_map<std::string,const MemberDef *> &members,bool) const; - 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); + void _setBriefDescription(const QCString &b,const QCString &briefFile,int briefLine); + void _setDocumentation(const QCString &d,const QCString &docFile,int docLine,bool stripWhiteSpace,bool atTop); + void _setInbodyDocumentation(const QCString &d,const QCString &docFile,int docLine); bool _docsAlreadyAdded(const QCString &doc,QCString &sigList); // PIMPL idiom @@ -144,8 +144,8 @@ class DefinitionMixin : public Base public: /*! Create a new definition */ DefinitionMixin( - const char *defFileName,int defLine,int defColumn, - const char *name,const char *b=0,const char *d=0, + const QCString &defFileName,int defLine,int defColumn, + const QCString &name,const char *b=0,const char *d=0, bool isSymbol=TRUE) : m_impl(this,defFileName,defLine,defColumn,name,b,d,isSymbol) {} virtual ~DefinitionMixin() {} @@ -190,7 +190,7 @@ class DefinitionMixin : public Base virtual const GroupList &partOfGroups() const { return m_impl.partOfGroups(); } virtual bool isLinkableViaGroup() const { return m_impl.isLinkableViaGroup(); } virtual const RefItemVector &xrefListItems() const { return m_impl.xrefListItems(); } - virtual const Definition *findInnerCompound(const char *name) const { return m_impl.findInnerCompound(name); } + virtual const Definition *findInnerCompound(const QCString &name) const { return m_impl.findInnerCompound(name); } virtual Definition *getOuterScope() const { return m_impl.getOuterScope(); } virtual std::vector<const MemberDef *> getReferencesMembers() const { return m_impl.getReferencesMembers(); } virtual std::vector<const MemberDef *> getReferencedByMembers() const { return m_impl.getReferencedByMembers(); } @@ -201,17 +201,17 @@ class DefinitionMixin : public Base virtual const SectionRefs &getSectionRefs() const { return m_impl.getSectionRefs(); } //======== DefinitionMutable - virtual void setName(const char *name) { m_impl.setName(name); } - virtual void setId(const char *name) { m_impl.setId(name); } + virtual void setName(const QCString &name) { m_impl.setName(name); } + virtual void setId(const QCString &name) { m_impl.setId(name); } virtual void setDefFile(const QCString& df,int defLine,int defColumn) { m_impl.setDefFile(df,defLine,defColumn); } - virtual void setDocumentation(const char *doc,const char *docFile,int docLine,bool stripWhiteSpace=TRUE) + virtual void setDocumentation(const QCString &doc,const QCString &docFile,int docLine,bool stripWhiteSpace=TRUE) { m_impl.setDocumentation(doc,docFile,docLine,stripWhiteSpace); } - virtual void setBriefDescription(const char *brief,const char *briefFile,int briefLine) + virtual void setBriefDescription(const QCString &brief,const QCString &briefFile,int briefLine) { m_impl.setBriefDescription(brief,briefFile,briefLine); } - virtual void setInbodyDocumentation(const char *doc,const char *docFile,int docLine) + virtual void setInbodyDocumentation(const QCString &doc,const QCString &docFile,int docLine) { m_impl.setInbodyDocumentation(doc,docFile,docLine); } - virtual void setReference(const char *r) + virtual void setReference(const QCString &r) { m_impl.setReference(r); } virtual void addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList) { m_impl.addSectionsToDefinition(anchorList); } @@ -241,13 +241,13 @@ class DefinitionMixin : public Base { m_impl.setArtificial(b); } virtual void setLanguage(SrcLangExt lang) { m_impl.setLanguage(lang); } - virtual void writeSourceDef(OutputList &ol,const char *scopeName) const + virtual void writeSourceDef(OutputList &ol,const QCString &scopeName) const { m_impl.writeSourceDef(ol,scopeName); } - virtual void writeInlineCode(OutputList &ol,const char *scopeName) const + virtual void writeInlineCode(OutputList &ol,const QCString &scopeName) const { m_impl.writeInlineCode(ol,scopeName); } - virtual void writeSourceRefs(OutputList &ol,const char *scopeName) const + virtual void writeSourceRefs(OutputList &ol,const QCString &scopeName) const { m_impl.writeSourceRefs(ol,scopeName); } - virtual void writeSourceReffedBy(OutputList &ol,const char *scopeName) const + virtual void writeSourceReffedBy(OutputList &ol,const QCString &scopeName) const { m_impl.writeSourceReffedBy(ol,scopeName); } virtual void makePartOfGroup(const GroupDef *gd) { m_impl.makePartOfGroup(gd); } @@ -261,9 +261,9 @@ class DefinitionMixin : public Base { m_impl.writeSummaryLinks(ol); } virtual QCString pathFragment() const { return m_impl.pathFragment(); } - virtual void writeDocAnchorsToTagFile(std::ostream &fs) const + virtual void writeDocAnchorsToTagFile(TextStream &fs) const { m_impl.writeDocAnchorsToTagFile(fs); } - virtual void setLocalName(const QCString name) + virtual void setLocalName(const QCString &name) { m_impl.setLocalName(name); } virtual void addSectionsToIndex() { m_impl.addSectionsToIndex(); } @@ -399,7 +399,7 @@ class DefinitionAliasMixin : public Base { return m_alias->isLinkableViaGroup(); } virtual const RefItemVector &xrefListItems() const { return m_alias->xrefListItems(); } - virtual const Definition *findInnerCompound(const char *name) const + virtual const Definition *findInnerCompound(const QCString &name) const { return m_alias->findInnerCompound(name); } virtual Definition *getOuterScope() const { return const_cast<Definition*>(m_scope); } diff --git a/src/dia.cpp b/src/dia.cpp index 11c5270..13c1316 100644 --- a/src/dia.cpp +++ b/src/dia.cpp @@ -23,8 +23,8 @@ static const int maxCmdLine = 40960; -void writeDiaGraphFromFile(const char *inFile,const char *outDir, - const char *outFile,DiaOutputFormat format) +void writeDiaGraphFromFile(const QCString &inFile,const QCString &outDir, + const QCString &outFile,DiaOutputFormat format) { QCString absOutFile = outDir; absOutFile+=Portable::pathSeparator(); @@ -33,7 +33,7 @@ void writeDiaGraphFromFile(const char *inFile,const char *outDir, // chdir to the output dir, so dot can find the font file. std::string oldDir = Dir::currentDirPath(); // go to the html output directory (i.e. path) - Dir::setCurrent(outDir); + Dir::setCurrent(outDir.str()); //printf("Going to dir %s\n",Dir::currentDirPath().c_str()); QCString diaExe = Config_getString(DIA_PATH)+"dia"+Portable::commandExtension(); QCString diaArgs; @@ -59,12 +59,12 @@ void writeDiaGraphFromFile(const char *inFile,const char *outDir, diaArgs+="\""; int exitCode; - //printf("*** running: %s %s outDir:%s %s\n",diaExe.data(),diaArgs.data(),outDir,outFile); + //printf("*** running: %s %s outDir:%s %s\n",qPrint(diaExe),qPrint(diaArgs),outDir,outFile); Portable::sysTimerStart(); if ((exitCode=Portable::system(diaExe,diaArgs,FALSE))!=0) { err("Problems running %s. Check your installation or look typos in you dia file %s\n", - diaExe.data(),inFile); + qPrint(diaExe),qPrint(inFile)); Portable::sysTimerStop(); goto error; } @@ -73,7 +73,7 @@ void writeDiaGraphFromFile(const char *inFile,const char *outDir, { QCString epstopdfArgs(maxCmdLine); epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"", - outFile,outFile); + qPrint(outFile),qPrint(outFile)); Portable::sysTimerStart(); if (Portable::system("epstopdf",epstopdfArgs)!=0) { @@ -22,8 +22,8 @@ class QCString; enum DiaOutputFormat { DIA_BITMAP , DIA_EPS }; -void writeDiaGraphFromFile(const char *inFile,const char *outDir, - const char *outFile,DiaOutputFormat format); +void writeDiaGraphFromFile(const QCString &inFile,const QCString &outDir, + const QCString &outFile,DiaOutputFormat format); #endif diff --git a/src/diagram.cpp b/src/diagram.cpp index 365dd46..0f20636 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -28,6 +28,7 @@ #include "portable.h" #include "index.h" #include "classlist.h" +#include "textstream.h" //----------------------------------------------------------------------------- @@ -40,7 +41,7 @@ class DiagramItem { public: DiagramItem(DiagramItem *p,uint number,const ClassDef *cd, - Protection prot,Specifier virt,const char *ts); + Protection prot,Specifier virt,const QCString &ts); QCString label() const; QCString fileName() const; DiagramItem *parentItem() { return m_parent; } @@ -80,7 +81,7 @@ class DiagramRow using reverse_iterator = typename Vec::reverse_iterator; DiagramRow(TreeDiagram *d,uint l) : m_diagram(d), m_level(l) {} void insertClass(DiagramItem *parent,const ClassDef *cd,bool doBases, - Protection prot,Specifier virt,const char *ts); + Protection prot,Specifier virt,const QCString &ts); uint number() { return m_level; } DiagramItem *item(int index) { return m_items.at(index).get(); } @@ -107,13 +108,13 @@ class TreeDiagram uint computeRows(); void moveChildren(DiagramItem *root,int dx); void computeExtremes(uint *labelWidth,uint *xpos); - void drawBoxes(std::ostream &t,Image *image, + void drawBoxes(TextStream &t,Image *image, bool doBase,bool bitmap, uint baseRows,uint superRows, uint cellWidth,uint cellHeight, QCString relPath="", bool generateMap=TRUE); - void drawConnectors(std::ostream &t,Image *image, + void drawConnectors(TextStream &t,Image *image, bool doBase,bool bitmap, uint baseRows,uint superRows, uint cellWidth,uint cellheight); @@ -176,7 +177,7 @@ static QCString protToString(Protection p) case Protected: return "dashed"; case Private: return "dotted"; } - return 0; + return QCString(); } static uint virtToMask(Specifier p) @@ -232,7 +233,7 @@ static void writeBitmapBox(DiagramItem *di,Image *image, } } -static void writeVectorBox(std::ostream &t,DiagramItem *di, +static void writeVectorBox(TextStream &t,DiagramItem *di, float x,float y,bool children=FALSE) { if (di->virtualness()==Virtual) t << "dashed\n"; @@ -241,7 +242,7 @@ static void writeVectorBox(std::ostream &t,DiagramItem *di, if (di->virtualness()==Virtual) t << "solid\n"; } -static void writeMapArea(std::ostream &t,const ClassDef *cd,QCString relPath, +static void writeMapArea(TextStream &t,const ClassDef *cd,QCString relPath, uint x,uint y,uint w,uint h) { if (cd->isLinkable()) @@ -273,7 +274,7 @@ static void writeMapArea(std::ostream &t,const ClassDef *cd,QCString relPath, //----------------------------------------------------------------------------- DiagramItem::DiagramItem(DiagramItem *p,uint number,const ClassDef *cd, - Protection pr,Specifier vi,const char *ts) + Protection pr,Specifier vi,const QCString &ts) : m_parent(p), m_num(number), m_prot(pr), m_virt(vi), m_templSpec(ts), m_classDef(cd) { } @@ -332,7 +333,7 @@ void DiagramItem::addChild(DiagramItem *di) //--------------------------------------------------------------------------- void DiagramRow::insertClass(DiagramItem *parent,const ClassDef *cd,bool doBases, - Protection prot,Specifier virt,const char *ts) + Protection prot,Specifier virt,const QCString &ts) { auto di = std::make_unique<DiagramItem>(parent, m_diagram->row(m_level)->numItems(), cd,prot,virt,ts); @@ -365,7 +366,7 @@ void DiagramRow::insertClass(DiagramItem *parent,const ClassDef *cd,bool doBases { row->insertClass(di_ptr,ccd,doBases,bcd.prot, doBases?bcd.virt:Normal, - doBases?bcd.templSpecifiers.data():""); + doBases?bcd.templSpecifiers:QCString()); } } } @@ -378,7 +379,7 @@ TreeDiagram::TreeDiagram(const ClassDef *root,bool doBases) auto row = std::make_unique<DiagramRow>(this,0); DiagramRow *row_ptr = row.get(); m_rows.push_back(std::move(row)); - row_ptr->insertClass(0,root,doBases,Public,Normal,0); + row_ptr->insertClass(0,root,doBases,Public,Normal,QCString()); } void TreeDiagram::moveChildren(DiagramItem *root,int dx) @@ -393,7 +394,7 @@ void TreeDiagram::moveChildren(DiagramItem *root,int dx) bool TreeDiagram::layoutTree(DiagramItem *root,uint r) { bool moved=FALSE; - //printf("layoutTree(%s,%d)\n",root->label().data(),r); + //printf("layoutTree(%s,%d)\n",qPrint(root->label()),r); if (root->numChildren()>0) { @@ -564,7 +565,7 @@ class DualDirIterator typename C::reverse_iterator m_rit; }; -void TreeDiagram::drawBoxes(std::ostream &t,Image *image, +void TreeDiagram::drawBoxes(TextStream &t,Image *image, bool doBase,bool bitmap, uint baseRows,uint superRows, uint cellWidth,uint cellHeight, @@ -694,7 +695,7 @@ void TreeDiagram::drawBoxes(std::ostream &t,Image *image, } } -void TreeDiagram::drawConnectors(std::ostream &t,Image *image, +void TreeDiagram::drawConnectors(TextStream &t,Image *image, bool doBase,bool bitmap, uint baseRows,uint superRows, uint cellWidth,uint cellHeight) @@ -1043,8 +1044,8 @@ ClassDiagram::~ClassDiagram() { } -void ClassDiagram::writeFigure(std::ostream &output,const char *path, - const char *fileName) const +void ClassDiagram::writeFigure(TextStream &output,const QCString &path, + const QCString &fileName) const { uint baseRows=p->base.computeRows(); uint superRows=p->super.computeRows(); @@ -1086,242 +1087,247 @@ void ClassDiagram::writeFigure(std::ostream &output,const char *path, QCString epsBaseName=(QCString)path+"/"+fileName; QCString epsName=epsBaseName+".eps"; - std::ofstream t(epsName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(epsName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { - term("Could not open file %s for writing\n",epsName.data()); + term("Could not open file %s for writing\n",qPrint(epsName)); } - - //printf("writeEPS() rows=%d cols=%d\n",rows,cols); - - // generate EPS header and postscript variables and procedures - - t << "%!PS-Adobe-2.0 EPSF-2.0\n"; - t << "%%Title: ClassName\n"; - t << "%%Creator: Doxygen\n"; - t << "%%CreationDate: Time\n"; - t << "%%For: \n"; - t << "%Magnification: 1.00\n"; - t << "%%Orientation: Portrait\n"; - t << "%%BoundingBox: 0 0 500 " << estHeight*500.0f/(float)estWidth << "\n"; - t << "%%Pages: 0\n"; - t << "%%BeginSetup\n"; - t << "%%EndSetup\n"; - t << "%%EndComments\n"; - t << "\n"; - t << "% ----- variables -----\n"; - t << "\n"; - t << "/boxwidth 0 def\n"; - t << "/boxheight 40 def\n"; - t << "/fontheight 24 def\n"; - t << "/marginwidth 10 def\n"; - t << "/distx 20 def\n"; - t << "/disty 40 def\n"; - t << "/boundaspect " << estWidth/(float)estHeight << " def % aspect ratio of the BoundingBox (width/height)\n"; - t << "/boundx 500 def\n"; - t << "/boundy boundx boundaspect div def\n"; - t << "/xspacing 0 def\n"; - t << "/yspacing 0 def\n"; - t << "/rows " << rows << " def\n"; - t << "/cols " << cols << " def\n"; - t << "/scalefactor 0 def\n"; - t << "/boxfont /Times-Roman findfont fontheight scalefont def\n"; - t << "\n"; - t << "% ----- procedures -----\n"; - t << "\n"; - t << "/dotted { [1 4] 0 setdash } def\n"; - t << "/dashed { [5] 0 setdash } def\n"; - t << "/solid { [] 0 setdash } def\n"; - t << "\n"; - t << "/max % result = MAX(arg1,arg2)\n"; - t << "{\n"; - t << " /a exch def\n"; - t << " /b exch def\n"; - t << " a b gt {a} {b} ifelse\n"; - t << "} def\n"; - t << "\n"; - t << "/xoffset % result = MAX(0,(scalefactor-(boxwidth*cols+distx*(cols-1)))/2)\n"; - t << "{\n"; - t << " 0 scalefactor boxwidth cols mul distx cols 1 sub mul add sub 2 div max\n"; - t << "} def\n"; - t << "\n"; - t << "/cw % boxwidth = MAX(boxwidth, stringwidth(arg1))\n"; - t << "{\n"; - t << " /str exch def\n"; - t << " /boxwidth boxwidth str stringwidth pop max def\n"; - t << "} def\n"; - t << "\n"; - t << "/box % draws a box with text 'arg1' at grid pos (arg2,arg3)\n"; - t << "{ gsave\n"; - t << " 2 setlinewidth\n"; - t << " newpath\n"; - t << " exch xspacing mul xoffset add\n"; - t << " exch yspacing mul\n"; - t << " moveto\n"; - t << " boxwidth 0 rlineto \n"; - t << " 0 boxheight rlineto \n"; - t << " boxwidth neg 0 rlineto \n"; - t << " 0 boxheight neg rlineto \n"; - t << " closepath\n"; - t << " dup stringwidth pop neg boxwidth add 2 div\n"; - t << " boxheight fontheight 2 div sub 2 div\n"; - t << " rmoveto show stroke\n"; - t << " grestore\n"; - t << "} def \n"; - t << "\n"; - t << "/mark\n"; - t << "{ newpath\n"; - t << " exch xspacing mul xoffset add boxwidth add\n"; - t << " exch yspacing mul\n"; - t << " moveto\n"; - t << " 0 boxheight 4 div rlineto\n"; - t << " boxheight neg 4 div boxheight neg 4 div rlineto\n"; - t << " closepath\n"; - t << " eofill\n"; - t << " stroke\n"; - t << "} def\n"; - t << "\n"; - t << "/arrow\n"; - t << "{ newpath\n"; - t << " moveto\n"; - t << " 3 -8 rlineto\n"; - t << " -6 0 rlineto\n"; - t << " 3 8 rlineto\n"; - t << " closepath\n"; - t << " eofill\n"; - t << " stroke\n"; - t << "} def\n"; - t << "\n"; - t << "/out % draws an output connector for the block at (arg1,arg2)\n"; - t << "{\n"; - t << " newpath\n"; - t << " exch xspacing mul xoffset add boxwidth 2 div add\n"; - t << " exch yspacing mul boxheight add\n"; - t << " /y exch def\n"; - t << " /x exch def\n"; - t << " x y moveto\n"; - t << " 0 disty 2 div rlineto \n"; - t << " stroke\n"; - t << " 1 eq { x y disty 2 div add arrow } if\n"; - t << "} def\n"; - t << "\n"; - t << "/in % draws an input connector for the block at (arg1,arg2)\n"; - t << "{\n"; - t << " newpath\n"; - t << " exch xspacing mul xoffset add boxwidth 2 div add\n"; - t << " exch yspacing mul disty 2 div sub\n"; - t << " /y exch def\n"; - t << " /x exch def\n"; - t << " x y moveto\n"; - t << " 0 disty 2 div rlineto\n"; - t << " stroke\n"; - t << " 1 eq { x y disty 2 div add arrow } if\n"; - t << "} def\n"; - t << "\n"; - t << "/hedge\n"; - t << "{\n"; - t << " exch xspacing mul xoffset add boxwidth 2 div add\n"; - t << " exch yspacing mul boxheight 2 div sub\n"; - t << " /y exch def\n"; - t << " /x exch def\n"; - t << " newpath\n"; - t << " x y moveto\n"; - t << " boxwidth 2 div distx add 0 rlineto\n"; - t << " stroke\n"; - t << " 1 eq\n"; - t << " { newpath x boxwidth 2 div distx add add y moveto\n"; - t << " -8 3 rlineto\n"; - t << " 0 -6 rlineto\n"; - t << " 8 3 rlineto\n"; - t << " closepath\n"; - t << " eofill\n"; - t << " stroke\n"; - t << " } if\n"; - t << "} def\n"; - t << "\n"; - t << "/vedge\n"; - t << "{\n"; - t << " /ye exch def\n"; - t << " /ys exch def\n"; - t << " /xs exch def\n"; - t << " newpath\n"; - t << " xs xspacing mul xoffset add boxwidth 2 div add dup\n"; - t << " ys yspacing mul boxheight 2 div sub\n"; - t << " moveto\n"; - t << " ye yspacing mul boxheight 2 div sub\n"; - t << " lineto\n"; - t << " stroke\n"; - t << "} def\n"; - t << "\n"; - t << "/conn % connections the blocks from col 'arg1' to 'arg2' of row 'arg3'\n"; - t << "{\n"; - t << " /ys exch def\n"; - t << " /xe exch def\n"; - t << " /xs exch def\n"; - t << " newpath\n"; - t << " xs xspacing mul xoffset add boxwidth 2 div add\n"; - t << " ys yspacing mul disty 2 div sub\n"; - t << " moveto\n"; - t << " xspacing xe xs sub mul 0\n"; - t << " rlineto\n"; - t << " stroke\n"; - t << "} def\n"; - t << "\n"; - t << "% ----- main ------\n"; - t << "\n"; - t << "boxfont setfont\n"; - t << "1 boundaspect scale\n"; - - - for (const auto &dr : p->base) + else { - bool done=FALSE; - for (const auto &di : *dr) + TextStream t(&f); + + //printf("writeEPS() rows=%d cols=%d\n",rows,cols); + + // generate EPS header and postscript variables and procedures + + t << "%!PS-Adobe-2.0 EPSF-2.0\n"; + t << "%%Title: ClassName\n"; + t << "%%Creator: Doxygen\n"; + t << "%%CreationDate: Time\n"; + t << "%%For: \n"; + t << "%Magnification: 1.00\n"; + t << "%%Orientation: Portrait\n"; + t << "%%BoundingBox: 0 0 500 " << estHeight*500.0f/(float)estWidth << "\n"; + t << "%%Pages: 0\n"; + t << "%%BeginSetup\n"; + t << "%%EndSetup\n"; + t << "%%EndComments\n"; + t << "\n"; + t << "% ----- variables -----\n"; + t << "\n"; + t << "/boxwidth 0 def\n"; + t << "/boxheight 40 def\n"; + t << "/fontheight 24 def\n"; + t << "/marginwidth 10 def\n"; + t << "/distx 20 def\n"; + t << "/disty 40 def\n"; + t << "/boundaspect " << estWidth/(float)estHeight << " def % aspect ratio of the BoundingBox (width/height)\n"; + t << "/boundx 500 def\n"; + t << "/boundy boundx boundaspect div def\n"; + t << "/xspacing 0 def\n"; + t << "/yspacing 0 def\n"; + t << "/rows " << rows << " def\n"; + t << "/cols " << cols << " def\n"; + t << "/scalefactor 0 def\n"; + t << "/boxfont /Times-Roman findfont fontheight scalefont def\n"; + t << "\n"; + t << "% ----- procedures -----\n"; + t << "\n"; + t << "/dotted { [1 4] 0 setdash } def\n"; + t << "/dashed { [5] 0 setdash } def\n"; + t << "/solid { [] 0 setdash } def\n"; + t << "\n"; + t << "/max % result = MAX(arg1,arg2)\n"; + t << "{\n"; + t << " /a exch def\n"; + t << " /b exch def\n"; + t << " a b gt {a} {b} ifelse\n"; + t << "} def\n"; + t << "\n"; + t << "/xoffset % result = MAX(0,(scalefactor-(boxwidth*cols+distx*(cols-1)))/2)\n"; + t << "{\n"; + t << " 0 scalefactor boxwidth cols mul distx cols 1 sub mul add sub 2 div max\n"; + t << "} def\n"; + t << "\n"; + t << "/cw % boxwidth = MAX(boxwidth, stringwidth(arg1))\n"; + t << "{\n"; + t << " /str exch def\n"; + t << " /boxwidth boxwidth str stringwidth pop max def\n"; + t << "} def\n"; + t << "\n"; + t << "/box % draws a box with text 'arg1' at grid pos (arg2,arg3)\n"; + t << "{ gsave\n"; + t << " 2 setlinewidth\n"; + t << " newpath\n"; + t << " exch xspacing mul xoffset add\n"; + t << " exch yspacing mul\n"; + t << " moveto\n"; + t << " boxwidth 0 rlineto \n"; + t << " 0 boxheight rlineto \n"; + t << " boxwidth neg 0 rlineto \n"; + t << " 0 boxheight neg rlineto \n"; + t << " closepath\n"; + t << " dup stringwidth pop neg boxwidth add 2 div\n"; + t << " boxheight fontheight 2 div sub 2 div\n"; + t << " rmoveto show stroke\n"; + t << " grestore\n"; + t << "} def \n"; + t << "\n"; + t << "/mark\n"; + t << "{ newpath\n"; + t << " exch xspacing mul xoffset add boxwidth add\n"; + t << " exch yspacing mul\n"; + t << " moveto\n"; + t << " 0 boxheight 4 div rlineto\n"; + t << " boxheight neg 4 div boxheight neg 4 div rlineto\n"; + t << " closepath\n"; + t << " eofill\n"; + t << " stroke\n"; + t << "} def\n"; + t << "\n"; + t << "/arrow\n"; + t << "{ newpath\n"; + t << " moveto\n"; + t << " 3 -8 rlineto\n"; + t << " -6 0 rlineto\n"; + t << " 3 8 rlineto\n"; + t << " closepath\n"; + t << " eofill\n"; + t << " stroke\n"; + t << "} def\n"; + t << "\n"; + t << "/out % draws an output connector for the block at (arg1,arg2)\n"; + t << "{\n"; + t << " newpath\n"; + t << " exch xspacing mul xoffset add boxwidth 2 div add\n"; + t << " exch yspacing mul boxheight add\n"; + t << " /y exch def\n"; + t << " /x exch def\n"; + t << " x y moveto\n"; + t << " 0 disty 2 div rlineto \n"; + t << " stroke\n"; + t << " 1 eq { x y disty 2 div add arrow } if\n"; + t << "} def\n"; + t << "\n"; + t << "/in % draws an input connector for the block at (arg1,arg2)\n"; + t << "{\n"; + t << " newpath\n"; + t << " exch xspacing mul xoffset add boxwidth 2 div add\n"; + t << " exch yspacing mul disty 2 div sub\n"; + t << " /y exch def\n"; + t << " /x exch def\n"; + t << " x y moveto\n"; + t << " 0 disty 2 div rlineto\n"; + t << " stroke\n"; + t << " 1 eq { x y disty 2 div add arrow } if\n"; + t << "} def\n"; + t << "\n"; + t << "/hedge\n"; + t << "{\n"; + t << " exch xspacing mul xoffset add boxwidth 2 div add\n"; + t << " exch yspacing mul boxheight 2 div sub\n"; + t << " /y exch def\n"; + t << " /x exch def\n"; + t << " newpath\n"; + t << " x y moveto\n"; + t << " boxwidth 2 div distx add 0 rlineto\n"; + t << " stroke\n"; + t << " 1 eq\n"; + t << " { newpath x boxwidth 2 div distx add add y moveto\n"; + t << " -8 3 rlineto\n"; + t << " 0 -6 rlineto\n"; + t << " 8 3 rlineto\n"; + t << " closepath\n"; + t << " eofill\n"; + t << " stroke\n"; + t << " } if\n"; + t << "} def\n"; + t << "\n"; + t << "/vedge\n"; + t << "{\n"; + t << " /ye exch def\n"; + t << " /ys exch def\n"; + t << " /xs exch def\n"; + t << " newpath\n"; + t << " xs xspacing mul xoffset add boxwidth 2 div add dup\n"; + t << " ys yspacing mul boxheight 2 div sub\n"; + t << " moveto\n"; + t << " ye yspacing mul boxheight 2 div sub\n"; + t << " lineto\n"; + t << " stroke\n"; + t << "} def\n"; + t << "\n"; + t << "/conn % connections the blocks from col 'arg1' to 'arg2' of row 'arg3'\n"; + t << "{\n"; + t << " /ys exch def\n"; + t << " /xe exch def\n"; + t << " /xs exch def\n"; + t << " newpath\n"; + t << " xs xspacing mul xoffset add boxwidth 2 div add\n"; + t << " ys yspacing mul disty 2 div sub\n"; + t << " moveto\n"; + t << " xspacing xe xs sub mul 0\n"; + t << " rlineto\n"; + t << " stroke\n"; + t << "} def\n"; + t << "\n"; + t << "% ----- main ------\n"; + t << "\n"; + t << "boxfont setfont\n"; + t << "1 boundaspect scale\n"; + + + for (const auto &dr : p->base) { - done=di->isInList(); - t << "(" << convertToPSString(di->label()) << ") cw\n"; + bool done=FALSE; + for (const auto &di : *dr) + { + done=di->isInList(); + t << "(" << convertToPSString(di->label()) << ") cw\n"; + } + if (done) break; } - if (done) break; - } - auto it = p->super.begin(); - if (it!=p->super.end()) ++it; - for (;it!=p->super.end();++it) - { - const auto &dr = *it; - bool done=FALSE; - for (const auto &di : *dr) + auto it = p->super.begin(); + if (it!=p->super.end()) ++it; + for (;it!=p->super.end();++it) { - done=di->isInList(); - t << "(" << convertToPSString(di->label()) << ") cw\n"; + const auto &dr = *it; + bool done=FALSE; + for (const auto &di : *dr) + { + done=di->isInList(); + t << "(" << convertToPSString(di->label()) << ") cw\n"; + } + if (done) break; } - if (done) break; - } - t << "/boxwidth boxwidth marginwidth 2 mul add def\n" - << "/xspacing boxwidth distx add def\n" - << "/yspacing boxheight disty add def\n" - << "/scalefactor \n" - << " boxwidth cols mul distx cols 1 sub mul add\n" - << " boxheight rows mul disty rows 1 sub mul add boundaspect mul \n" - << " max def\n" - << "boundx scalefactor div boundy scalefactor div scale\n"; + t << "/boxwidth boxwidth marginwidth 2 mul add def\n" + << "/xspacing boxwidth distx add def\n" + << "/yspacing boxheight disty add def\n" + << "/scalefactor \n" + << " boxwidth cols mul distx cols 1 sub mul add\n" + << " boxheight rows mul disty rows 1 sub mul add boundaspect mul \n" + << " max def\n" + << "boundx scalefactor div boundy scalefactor div scale\n"; - t << "\n% ----- classes -----\n\n"; - p->base.drawBoxes(t,0,TRUE,FALSE,baseRows,superRows,0,0); - p->super.drawBoxes(t,0,FALSE,FALSE,baseRows,superRows,0,0); + t << "\n% ----- classes -----\n\n"; + p->base.drawBoxes(t,0,TRUE,FALSE,baseRows,superRows,0,0); + p->super.drawBoxes(t,0,FALSE,FALSE,baseRows,superRows,0,0); - t << "\n% ----- relations -----\n\n"; - p->base.drawConnectors(t,0,TRUE,FALSE,baseRows,superRows,0,0); - p->super.drawConnectors(t,0,FALSE,FALSE,baseRows,superRows,0,0); + t << "\n% ----- relations -----\n\n"; + p->base.drawConnectors(t,0,TRUE,FALSE,baseRows,superRows,0,0); + p->super.drawConnectors(t,0,FALSE,FALSE,baseRows,superRows,0,0); + + } + f.close(); - t.close(); if (Config_getBool(USE_PDFLATEX)) { QCString epstopdfArgs(4096); epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"", - epsBaseName.data(),epsBaseName.data()); - //printf("Converting eps using '%s'\n",epstopdfArgs.data()); + qPrint(epsBaseName),qPrint(epsBaseName)); + //printf("Converting eps using '%s'\n",qPrint(epstopdfArgs)); Portable::sysTimerStart(); if (Portable::system("epstopdf",epstopdfArgs)!=0) { @@ -1334,8 +1340,8 @@ void ClassDiagram::writeFigure(std::ostream &output,const char *path, } -void ClassDiagram::writeImage(std::ostream &t,const char *path, - const char *relPath,const char *fileName, +void ClassDiagram::writeImage(TextStream &t,const QCString &path, + const QCString &relPath,const QCString &fileName, bool generateMap) const { uint baseRows=p->base.computeRows(); diff --git a/src/diagram.h b/src/diagram.h index 9f8ba82..e2544e0 100644 --- a/src/diagram.h +++ b/src/diagram.h @@ -20,9 +20,10 @@ #define DIAGRAM_H #include <memory> -#include <iostream> +#include "qcstring.h" class ClassDef; +class TextStream; /** Class representing a built-in class diagram. */ class ClassDiagram @@ -30,10 +31,10 @@ class ClassDiagram public: ClassDiagram(const ClassDef *root); ~ClassDiagram(); - void writeFigure(std::ostream &t,const char *path, - const char *file) const; - void writeImage(std::ostream &t,const char *path,const char *relPath, - const char *file,bool generateMap=true) const; + void writeFigure(TextStream &t,const QCString &path, + const QCString &file) const; + void writeImage(TextStream &t,const QCString &path,const QCString &relPath, + const QCString &file,bool generateMap=true) const; private: struct Private; std::unique_ptr<Private> p; diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 6e95755..1814b51 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -37,7 +37,7 @@ class DirDefImpl : public DefinitionMixin<DirDef> { public: - DirDefImpl(const char *path); + DirDefImpl(const QCString &path); virtual ~DirDefImpl(); virtual DefType definitionType() const { return TypeDir; } @@ -61,7 +61,7 @@ class DirDefImpl : public DefinitionMixin<DirDef> virtual QCString shortTitle() const; virtual bool hasDetailedDescription() const; virtual void writeDocumentation(OutputList &ol); - virtual void writeTagFile(std::ostream &t); + virtual void writeTagFile(TextStream &t); virtual void setDiskName(const QCString &name) { m_diskName = name; } virtual void sort(); virtual void setParent(DirDef *parent); @@ -83,7 +83,7 @@ class DirDefImpl : public DefinitionMixin<DirDef> void startMemberDeclarations(OutputList &ol); void endMemberDeclarations(OutputList &ol); - static DirDef *createNewDir(const char *path); + static DirDef *createNewDir(const QCString &path); static bool matchPath(const QCString &path,const StringVector &l); DirList m_subdirs; @@ -97,7 +97,7 @@ class DirDefImpl : public DefinitionMixin<DirDef> UsedDirLinkedMap m_usedDirs; }; -DirDef *createDirDef(const char *path) +DirDef *createDirDef(const QCString &path) { return new DirDefImpl(path); } @@ -108,7 +108,7 @@ DirDef *createDirDef(const char *path) static int g_dirCount=0; -DirDefImpl::DirDefImpl(const char *path) : DefinitionMixin(path,1,1,path) +DirDefImpl::DirDefImpl(const QCString &path) : DefinitionMixin(path,1,1,path) { bool fullPathNames = Config_getBool(FULL_PATH_NAMES); // get display name (stripping the paths mentioned in STRIP_FROM_PATH) @@ -178,9 +178,9 @@ static QCString encodeDirName(const QCString &anchor) { // convert to md5 hash uchar md5_sig[16]; - QCString sigStr(33); + char sigStr[33]; MD5Buffer((const unsigned char *)anchor.data(),anchor.length(),md5_sig); - MD5SigToString(md5_sig,sigStr.rawData(),33); + MD5SigToString(md5_sig,sigStr); return sigStr; // old algorithm @@ -209,7 +209,7 @@ static QCString encodeDirName(const QCString &anchor) QCString DirDefImpl::getOutputFileBase() const { //printf("DirDefImpl::getOutputFileBase() %s->dir_%s\n", - // m_diskName.data(),encodeDirName(m_diskName).data()); + // qPrint(m_diskName),qPrint(encodeDirName(m_diskName))); return "dir_"+encodeDirName(m_diskName); } @@ -224,7 +224,7 @@ void DirDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - ol.writeAnchor(0,"details"); + ol.writeAnchor(QCString(),"details"); ol.popGeneratorState(); ol.startGroupHeader(); ol.parseText(title); @@ -234,7 +234,7 @@ void DirDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) { ol.generateDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } // separator between brief and details if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) && @@ -255,7 +255,7 @@ void DirDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) if (!documentation().isEmpty()) { ol.generateDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } } } @@ -266,7 +266,7 @@ void DirDefImpl::writeBriefDescription(OutputList &ol) { DocRoot *rootNode = validatingParseDoc( briefFile(),briefLine(),this,0,briefDescription(),TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); if (rootNode && !rootNode->isEmpty()) { ol.startParagraph(); @@ -285,7 +285,7 @@ void DirDefImpl::writeBriefDescription(OutputList &ol) ) { ol.disableAllBut(OutputGenerator::Html); - ol.startTextLink(0,"details"); + ol.startTextLink(QCString(),"details"); ol.parseText(theTranslator->trMore()); ol.endTextLink(); } @@ -306,7 +306,7 @@ void DirDefImpl::writeDirectoryGraph(OutputList &ol) DotDirDeps dirDep(this); if (!dirDep.isTrivial()) { - msg("Generating dependency graph for directory %s\n",displayName().data()); + msg("Generating dependency graph for directory %s\n",qPrint(displayName())); ol.disable(OutputGenerator::Man); //ol.startParagraph(); ol.startDirDepGraph(); @@ -344,7 +344,7 @@ void DirDefImpl::writeSubDirList(OutputList &ol) ol.startMemberItem(dd->getOutputFileBase(),0); ol.parseText(theTranslator->trDir(FALSE,TRUE)+" "); ol.insertMemberAlign(); - ol.writeObjectLink(dd->getReference(),dd->getOutputFileBase(),0,dd->shortName()); + ol.writeObjectLink(dd->getReference(),dd->getOutputFileBase(),QCString(),dd->shortName()); ol.endMemberItem(); if (!dd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { @@ -352,14 +352,14 @@ void DirDefImpl::writeSubDirList(OutputList &ol) ol.generateDoc(briefFile(),briefLine(),dd,0,dd->briefDescription(), FALSE, // indexWords FALSE, // isExample - 0, // exampleName + QCString(), // exampleName TRUE, // single line TRUE, // link from index Config_getBool(MARKDOWN_SUPPORT) ); ol.endMemberDescription(); } - ol.endMemberDeclaration(0,0); + ol.endMemberDeclaration(QCString(),QCString()); } } @@ -395,7 +395,7 @@ void DirDefImpl::writeFileList(OutputList &ol) ol.insertMemberAlign(); if (fd->isLinkable()) { - ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,fd->name()); + ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),QCString(),fd->name()); } else { @@ -408,7 +408,7 @@ void DirDefImpl::writeFileList(OutputList &ol) ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); ol.docify(" "); - ol.startTextLink(fd->includeName(),0); + ol.startTextLink(fd->includeName(),QCString()); ol.docify("["); ol.parseText(theTranslator->trCode()); ol.docify("]"); @@ -422,14 +422,14 @@ void DirDefImpl::writeFileList(OutputList &ol) ol.generateDoc(briefFile(),briefLine(),fd,0,fd->briefDescription(), FALSE, // indexWords FALSE, // isExample - 0, // exampleName + QCString(), // exampleName TRUE, // single line TRUE, // link from index Config_getBool(MARKDOWN_SUPPORT) ); ol.endMemberDescription(); } - ol.endMemberDeclaration(0,0); + ol.endMemberDeclaration(QCString(),QCString()); } } ol.endMemberList(); @@ -457,7 +457,7 @@ bool DirDefImpl::hasDetailedDescription() const return (!briefDescription().isEmpty() && repeatBrief) || !documentation().isEmpty(); } -void DirDefImpl::writeTagFile(std::ostream &tagFile) +void DirDefImpl::writeTagFile(TextStream &tagFile) { tagFile << " <compound kind=\"dir\">\n"; tagFile << " <name>" << convertToXML(displayName()) << "</name>\n"; @@ -561,11 +561,14 @@ void DirDefImpl::writeDocumentation(OutputList &ol) case LayoutDocEntry::NamespaceNestedNamespaces: case LayoutDocEntry::NamespaceNestedConstantGroups: case LayoutDocEntry::NamespaceClasses: + case LayoutDocEntry::NamespaceConcepts: case LayoutDocEntry::NamespaceInterfaces: case LayoutDocEntry::NamespaceStructs: case LayoutDocEntry::NamespaceExceptions: case LayoutDocEntry::NamespaceInlineClasses: + case LayoutDocEntry::ConceptDefinition: case LayoutDocEntry::FileClasses: + case LayoutDocEntry::FileConcepts: case LayoutDocEntry::FileInterfaces: case LayoutDocEntry::FileStructs: case LayoutDocEntry::FileExceptions: @@ -577,6 +580,7 @@ void DirDefImpl::writeDocumentation(OutputList &ol) case LayoutDocEntry::FileSourceLink: case LayoutDocEntry::FileInlineClasses: case LayoutDocEntry::GroupClasses: + case LayoutDocEntry::GroupConcepts: case LayoutDocEntry::GroupInlineClasses: case LayoutDocEntry::GroupNamespaces: case LayoutDocEntry::GroupDirs: @@ -631,10 +635,10 @@ void DirDefImpl::addUsesDependency(const DirDef *dir,const FileDef *srcFd, if (this==dir) return; // do not add self-dependencies //static int count=0; //printf(" %d add dependency %s->%s due to %s->%s\n", - // count++,shortName().data(), - // dir->shortName().data(), - // srcFd->name().data(), - // dstFd->name().data()); + // count++,qPrint(shortName()), + // qPrint(dir->shortName()), + // qPrint(srcFd->name()), + // qPrint(dstFd->name())); // levels match => add direct dependency bool added=FALSE; @@ -682,12 +686,12 @@ void DirDefImpl::computeDependencies() { for (const auto &fd : m_fileList) { - //printf(" File %s\n",fd->name().data()); - //printf("** dir=%s file=%s\n",shortName().data(),fd->name().data()); + //printf(" File %s\n",qPrint(fd->name())); + //printf("** dir=%s file=%s\n",qPrint(shortName()),qPrint(fd->name())); for (const auto &ii : fd->includeFileList()) { - //printf(" > %s\n",ii->includeName.data()); - //printf(" #include %s\n",ii->includeName.data()); + //printf(" > %s\n",qPrint(ii->includeName)); + //printf(" #include %s\n",qPrint(ii->includeName)); if (ii.fileDef && ii.fileDef->isLinkable()) // linkable file { DirDef *usedDir = ii.fileDef->getDirDef(); @@ -695,7 +699,7 @@ void DirDefImpl::computeDependencies() { // add dependency: thisDir->usedDir //static int count=0; - //printf(" %d: add dependency %s->%s\n",count++,name().data(),usedDir->name().data()); + //printf(" %d: add dependency %s->%s\n",count++,qPrint(name()),qPrint(usedDir->name())); addUsesDependency(usedDir,fd,ii.fileDef,FALSE); } } @@ -757,12 +761,12 @@ void UsedDir::sort() }); } -FilePair *UsedDir::findFilePair(const char *name) +FilePair *UsedDir::findFilePair(const QCString &name) { return m_filePairs.find(name); } -DirDef *DirDefImpl::createNewDir(const char *path) +DirDef *DirDefImpl::createNewDir(const QCString &path) { ASSERT(path!=0); DirDef *dir = Doxygen::dirLinkedMap->find(path); @@ -772,7 +776,7 @@ DirDef *DirDefImpl::createNewDir(const char *path) std::unique_ptr<DirDef>( createDirDef(path))); //printf("Adding new dir %s\n",path); - //printf("createNewDir %s short=%s\n",path,dir->shortName().data()); + //printf("createNewDir %s short=%s\n",path,qPrint(dir->shortName())); } return dir; } @@ -795,7 +799,7 @@ bool DirDefImpl::matchPath(const QCString &path,const StringVector &l) */ DirDef *DirDefImpl::mergeDirectoryInTree(const QCString &path) { - //printf("DirDefImpl::mergeDirectoryInTree(%s)\n",path.data()); + //printf("DirDefImpl::mergeDirectoryInTree(%s)\n",qPrint(path)); int p=0,i=0; DirDef *dir=0; while ((i=path.find('/',p))!=-1) @@ -826,7 +830,7 @@ static void writePartialDirPath(OutputList &ol,const DirDef *root,const DirDef * writePartialDirPath(ol,root,target->parent()); ol.writeString(" / "); } - ol.writeObjectLink(target->getReference(),target->getOutputFileBase(),0,target->shortName()); + ol.writeObjectLink(target->getReference(),target->getOutputFileBase(),QCString(),target->shortName()); } static void writePartialFilePath(OutputList &ol,const DirDef *root,const FileDef *fd) @@ -838,7 +842,7 @@ static void writePartialFilePath(OutputList &ol,const DirDef *root,const FileDef } if (fd->isLinkable()) { - ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,fd->name()); + ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),QCString(),fd->name()); } else { @@ -855,11 +859,9 @@ void DirRelation::writeDocumentation(OutputList &ol) ol.disableAllBut(OutputGenerator::Html); QCString shortTitle=theTranslator->trDirRelation( - m_src->shortName()+" → "+ - m_dst->dir()->shortName()); + (m_src->shortName()+" → "+m_dst->dir()->shortName())); QCString title=theTranslator->trDirRelation( - m_src->displayName()+" -> "+ - m_dst->dir()->shortName()); + (m_src->displayName()+" -> "+m_dst->dir()->shortName())); startFile(ol,getOutputFileBase(),getOutputFileBase(), title,HLI_None,!generateTreeView,m_src->getOutputFileBase()); @@ -934,7 +936,7 @@ static void computeCommonDirPrefix() QCString dirName = dir->name(); if (dirName.length()>path.length()) { - if (qstrncmp(dirName,path,l)!=0) // dirName does not start with path + if (dirName.left(l)!=path) // dirName does not start with path { i=path.findRev('/',(int)l-2); if (i==-1) // no unique prefix -> stop @@ -979,7 +981,7 @@ static void computeCommonDirPrefix() { QCString diskName = dir->name().right(dir->name().length()-path.length()); dir->setDiskName(diskName); - //printf("set disk name: %s -> %s\n",dir->name().data(),diskName.data()); + //printf("set disk name: %s -> %s\n",qPrint(dir->name()),qPrint(diskName)); } } @@ -990,7 +992,7 @@ void buildDirectories() { for (const auto &fd : *fn) { - //printf("buildDirectories %s\n",fd->name().data()); + //printf("buildDirectories %s\n",qPrint(fd->name())); if (fd->getReference().isEmpty()) { DirDef *dir; @@ -1020,7 +1022,7 @@ void buildDirectories() { parent->addSubDir(dir.get()); //printf("DirDefImpl::addSubdir(): Adding subdir\n%s to\n%s\n", - // dir->displayName().data(), parent->displayName().data()); + // qPrint(dir->displayName()), qPrint(parent->displayName())); } } } @@ -1050,7 +1052,7 @@ void computeDirDependencies() // compute uses dependencies between directories for (const auto &dir : *Doxygen::dirLinkedMap) { - //printf("computeDependencies for %s: #dirs=%d\n",dir->name().data(),Doxygen::directories.count()); + //printf("computeDependencies for %s: #dirs=%d\n",qPrint(dir->name()),Doxygen::directories.count()); dir->computeDependencies(); } diff --git a/src/dirdef.h b/src/dirdef.h index c7b2f9a..3d775d0 100644 --- a/src/dirdef.h +++ b/src/dirdef.h @@ -66,7 +66,7 @@ class UsedDir UsedDir(const DirDef *dir,bool inherited); virtual ~UsedDir(); void addFileDep(const FileDef *srcFd,const FileDef *dstFd); - FilePair *findFilePair(const char *name); + FilePair *findFilePair(const QCString &name); const FilePairLinkedMap &filePairs() const { return m_filePairs; } const DirDef *dir() const { return m_dir; } bool inherited() const { return m_inherited; } @@ -112,7 +112,7 @@ class DirDef : public DefinitionMutable, public Definition // generate output virtual void writeDocumentation(OutputList &ol) = 0; - virtual void writeTagFile(std::ostream &t) = 0; + virtual void writeTagFile(TextStream &t) = 0; virtual void setDiskName(const QCString &name) = 0; virtual void sort() = 0; @@ -164,6 +164,5 @@ class DirRelationLinkedMap : public LinkedMap<DirRelation> void buildDirectories(); void generateDirDocs(OutputList &ol); void computeDirDependencies(); -void writeDirDependencyGraph(const char *file); #endif diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 6214249..ab2fb84 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -71,13 +71,15 @@ #endif //------------------ -inline void writeDocbookString(std::ostream &t,const char *s) +inline void writeDocbookString(TextStream &t,const QCString &s) { t << convertToDocBook(s); } -inline void writeDocbookCodeString(std::ostream &t,const char *s, int &col) +inline void writeDocbookCodeString(TextStream &t,const QCString &str, int &col) { + if (str.isEmpty()) return; + const char *s = str.data(); char c; while ((c=*s++)) { @@ -116,7 +118,7 @@ inline void writeDocbookCodeString(std::ostream &t,const char *s, int &col) } } -static void addIndexTerm(std::ostream &t, QCString prim, QCString sec = "") +static void addIndexTerm(TextStream &t, QCString prim, QCString sec = "") { t << "<indexterm><primary>"; t << convertToDocBook(prim); @@ -129,65 +131,65 @@ static void addIndexTerm(std::ostream &t, QCString prim, QCString sec = "") } t << "</indexterm>\n"; } -void writeDocbookLink(std::ostream &t,const char * /*extRef*/,const char *compoundId, - const char *anchorId,const char * text,const char * /*tooltip*/) +void writeDocbookLink(TextStream &t,const QCString & /*extRef*/,const QCString &compoundId, + const QCString &anchorId,const QCString & text,const QCString & /*tooltip*/) { t << "<link linkend=\"_" << stripPath(compoundId); - if (anchorId) t << "_1" << anchorId; + if (!anchorId.isEmpty()) t << "_1" << anchorId; t << "\""; t << ">"; writeDocbookString(t,text); t << "</link>"; } -DocbookCodeGenerator::DocbookCodeGenerator(std::ostream &t) : m_t(nullptr) +DocbookCodeGenerator::DocbookCodeGenerator(TextStream &t) : m_t(t) { m_prettyCode=Config_getBool(DOCBOOK_PROGRAMLISTING); - setTextStream(t); -} - -DocbookCodeGenerator::DocbookCodeGenerator() : m_t(nullptr) -{ } DocbookCodeGenerator::~DocbookCodeGenerator() {} -void DocbookCodeGenerator::codify(const char *text) +void DocbookCodeGenerator::codify(const QCString &text) { Docbook_DB(("(codify \"%s\")\n",text)); writeDocbookCodeString(m_t,text,m_col); } -void DocbookCodeGenerator::writeCodeLink(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip) + +void DocbookCodeGenerator::writeCodeLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip) { Docbook_DB(("(writeCodeLink)\n")); writeDocbookLink(m_t,ref,file,anchor,name,tooltip); - m_col+=(int)strlen(name); + m_col+=name.length(); } -void DocbookCodeGenerator::writeCodeLinkLine(const char *,const char *file, - const char *,const char *name, - const char *) + +void DocbookCodeGenerator::writeCodeLinkLine(const QCString &,const QCString &file, + const QCString &,const QCString &name, + const QCString &) { Docbook_DB(("(writeCodeLinkLine)\n")); m_t << "<anchor xml:id=\"_" << stripExtensionGeneral(stripPath(file),".xml"); m_t << "_1l"; writeDocbookString(m_t,name); m_t << "\"/>"; - m_col+=(int)strlen(name); + m_col+=name.length(); } -void DocbookCodeGenerator::writeTooltip(const char *, const DocLinkInfo &, const char *, - const char *, const SourceLinkInfo &, const SourceLinkInfo & + +void DocbookCodeGenerator::writeTooltip(const QCString &, const DocLinkInfo &, const QCString &, + const QCString &, const SourceLinkInfo &, const SourceLinkInfo & ) { Docbook_DB(("(writeToolTip)\n")); } + void DocbookCodeGenerator::startCodeLine(bool) { Docbook_DB(("(startCodeLine)\n")); m_insideCodeLine=TRUE; m_col=0; } + void DocbookCodeGenerator::endCodeLine() { if (m_insideCodeLine) m_t << "\n"; @@ -197,24 +199,28 @@ void DocbookCodeGenerator::endCodeLine() m_external.resize(0); m_insideCodeLine=FALSE; } -void DocbookCodeGenerator::startFontClass(const char *colorClass) + +void DocbookCodeGenerator::startFontClass(const QCString &colorClass) { Docbook_DB(("(startFontClass)\n")); m_t << "<emphasis role=\"" << colorClass << "\">"; m_insideSpecialHL=TRUE; } + void DocbookCodeGenerator::endFontClass() { Docbook_DB(("(endFontClass)\n")); m_t << "</emphasis>"; // non DocBook m_insideSpecialHL=FALSE; } -void DocbookCodeGenerator::writeCodeAnchor(const char *) + +void DocbookCodeGenerator::writeCodeAnchor(const QCString &) { Docbook_DB(("(writeCodeAnchor)\n")); } -void DocbookCodeGenerator::writeLineNumber(const char *ref,const char *fileName, - const char *anchor,int l) + +void DocbookCodeGenerator::writeLineNumber(const QCString &ref,const QCString &fileName, + const QCString &anchor,int l) { Docbook_DB(("(writeLineNumber)\n")); m_insideCodeLine = TRUE; @@ -223,10 +229,10 @@ void DocbookCodeGenerator::writeLineNumber(const char *ref,const char *fileName, QCString lineNumber; lineNumber.sprintf("%05d",l); - if (fileName && !m_sourceFileName.isEmpty()) + if (!fileName.isEmpty() && !m_sourceFileName.isEmpty()) { - writeCodeLinkLine(ref,m_sourceFileName,anchor,lineNumber,0); - writeCodeLink(ref,fileName,anchor,lineNumber,0); + writeCodeLinkLine(ref,m_sourceFileName,anchor,lineNumber,QCString()); + writeCodeLink(ref,fileName,anchor,lineNumber,QCString()); } else { @@ -240,23 +246,27 @@ void DocbookCodeGenerator::writeLineNumber(const char *ref,const char *fileName, } m_col=0; } -void DocbookCodeGenerator::setCurrentDoc(const Definition *,const char *,bool) + +void DocbookCodeGenerator::setCurrentDoc(const Definition *,const QCString &,bool) { } -void DocbookCodeGenerator::addWord(const char *,bool) + +void DocbookCodeGenerator::addWord(const QCString &,bool) { } + void DocbookCodeGenerator::finish() { endCodeLine(); } -void DocbookCodeGenerator::startCodeFragment(const char *) + +void DocbookCodeGenerator::startCodeFragment(const QCString &) { DB_GEN_C1(m_t) m_t << "<programlisting>"; } -void DocbookCodeGenerator::endCodeFragment(const char *) +void DocbookCodeGenerator::endCodeFragment(const QCString &) { DB_GEN_C1(m_t) //endCodeLine checks is there is still an open code line, if so closes it. @@ -267,12 +277,12 @@ DB_GEN_C1(m_t) //------------------------------------------------------------------------------- -DocbookGenerator::DocbookGenerator() : OutputGenerator(Config_getString(DOCBOOK_OUTPUT)) +DocbookGenerator::DocbookGenerator() : OutputGenerator(Config_getString(DOCBOOK_OUTPUT)), m_codeGen(m_t) { DB_GEN_C } -DocbookGenerator::DocbookGenerator(const DocbookGenerator &og) : OutputGenerator(og) +DocbookGenerator::DocbookGenerator(const DocbookGenerator &og) : OutputGenerator(og), m_codeGen(og.m_codeGen) { } @@ -298,13 +308,13 @@ void DocbookGenerator::init() Dir d(dir.str()); if (!d.exists() && !d.mkdir(dir.str())) { - term("Could not create output directory %s\n",dir.data()); + term("Could not create output directory %s\n",qPrint(dir)); } createSubDirs(d); } -void DocbookGenerator::startFile(const char *name,const char *,const char *,int) +void DocbookGenerator::startFile(const QCString &name,const QCString &,const QCString &,int) { DB_GEN_C QCString fileName=name; @@ -324,28 +334,27 @@ DB_GEN_C relPath = relativePathToRoot(fileName); if (fileName.right(4)!=".xml") fileName+=".xml"; startPlainFile(fileName); - m_codeGen.setTextStream(t); m_codeGen.setRelativePath(relPath); m_codeGen.setSourceFileName(stripPath(fileName)); - t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";; - t << "<" << fileType << " xmlns=\"http://docbook.org/ns/docbook\" version=\"5.0\" xmlns:xlink=\"http://www.w3.org/1999/xlink\""; - if (!pageName.isEmpty()) t << " xml:id=\"_" << stripPath(pageName) << "\""; - t << " xml:lang=\"" << theTranslator->trISOLang() << "\""; - t << ">\n"; + m_t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";; + m_t << "<" << fileType << " xmlns=\"http://docbook.org/ns/docbook\" version=\"5.0\" xmlns:xlink=\"http://www.w3.org/1999/xlink\""; + if (!pageName.isEmpty()) m_t << " xml:id=\"_" << stripPath(pageName) << "\""; + m_t << " xml:lang=\"" << theTranslator->trISOLang() << "\""; + m_t << ">\n"; } void DocbookGenerator::endFile() { DB_GEN_C - if (m_inDetail) t << "</section>\n"; + if (m_inDetail) m_t << "</section>\n"; m_inDetail = FALSE; while (m_inLevel != -1) { - t << "</section>\n"; + m_t << "</section>\n"; m_inLevel--; } - if (m_inGroup) t << "</section>\n"; + if (m_inGroup) m_t << "</section>\n"; m_inGroup = FALSE; QCString fileType="section"; @@ -358,7 +367,7 @@ DB_GEN_C { fileType="chapter"; } - t << "</" << fileType << ">\n"; + m_t << "</" << fileType << ">\n"; endPlainFile(); m_codeGen.setSourceFileName(""); } @@ -371,16 +380,16 @@ DB_GEN_C2("IndexSections " << is) case isTitlePageStart: { QCString dbk_projectName = Config_getString(PROJECT_NAME); - t << " <info>\n"; - t << " <title>" << convertToDocBook(dbk_projectName) << "</title>\n"; - t << " </info>\n"; + m_t << " <info>\n"; + m_t << " <title>" << convertToDocBook(dbk_projectName) << "</title>\n"; + m_t << " </info>\n"; } break; case isTitlePageAuthor: break; case isMainPage: - t << "<chapter>\n"; - t << " <title>"; + m_t << "<chapter>\n"; + m_t << " <title>"; break; case isModuleIndex: //Module Index}\n" @@ -391,11 +400,14 @@ DB_GEN_C2("IndexSections " << is) case isNamespaceIndex: //Namespace Index}\n" break; + case isConceptIndex: + //Concept Index}\n" + break; case isClassHierarchyIndex: //Hierarchical Index}\n" break; case isCompoundIndex: - //t << "{"; //Class Index}\n" + //m_t << "{"; //Class Index}\n" break; case isFileIndex: //Annotated File Index}\n" @@ -404,28 +416,32 @@ DB_GEN_C2("IndexSections " << is) //Annotated Page Index}\n" break; case isModuleDocumentation: - t << "<chapter>\n"; - t << " <title>"; + m_t << "<chapter>\n"; + m_t << " <title>"; break; case isDirDocumentation: - t << "<chapter>\n"; - t << " <title>"; + m_t << "<chapter>\n"; + m_t << " <title>"; break; case isNamespaceDocumentation: - t << "<chapter>\n"; - t << " <title>"; + m_t << "<chapter>\n"; + m_t << " <title>"; + break; + case isConceptDocumentation: + m_t << "<chapter>\n"; + m_t << " <title>"; break; case isClassDocumentation: - t << "<chapter>\n"; - t << " <title>"; + m_t << "<chapter>\n"; + m_t << " <title>"; break; case isFileDocumentation: - t << "<chapter>\n"; - t << " <title>"; + m_t << "<chapter>\n"; + m_t << " <title>"; break; case isExampleDocumentation: - t << "<chapter>\n"; - t << " <title>"; + m_t << "<chapter>\n"; + m_t << " <title>"; break; case isPageDocumentation: break; @@ -447,78 +463,95 @@ DB_GEN_C2("IndexSections " << is) case isTitlePageAuthor: break; case isMainPage: - t << "</title>\n"; - t << " <xi:include href=\"mainpage.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; - t << "</chapter>\n"; + m_t << "</title>\n"; + m_t << " <xi:include href=\"mainpage.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << "</chapter>\n"; break; case isModuleIndex: - //t << "</chapter>\n"; + //m_t << "</chapter>\n"; break; case isDirIndex: - //t << "<xi:include href=\"dirs.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; - //t << "</chapter>\n"; + //m_t << "<xi:include href=\"dirs.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; + //m_t << "</chapter>\n"; break; case isNamespaceIndex: - //t << "<xi:include href=\"namespaces.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; - //t << "</chapter>\n"; + //m_t << "<xi:include href=\"namespaces.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; + //m_t << "</chapter>\n"; + break; + case isConceptIndex: + //m_t << "<xi:include href=\"concepts.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; + //m_t << "</chapter>\n"; break; case isClassHierarchyIndex: - //t << "<xi:include href=\"hierarchy.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; - //t << "</chapter>\n"; + //m_t << "<xi:include href=\"hierarchy.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; + //m_t << "</chapter>\n"; break; case isCompoundIndex: - //t << "</chapter>\n"; + //m_t << "</chapter>\n"; break; case isFileIndex: - //t << "<xi:include href=\"files.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; - //t << "</chapter>\n"; + //m_t << "<xi:include href=\"files.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; + //m_t << "</chapter>\n"; break; case isPageIndex: - //t << "<xi:include href=\"pages.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; - //t << "</chapter>\n"; + //m_t << "<xi:include href=\"pages.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; + //m_t << "</chapter>\n"; break; case isModuleDocumentation: { - t << "</title>\n"; + m_t << "</title>\n"; for (const auto &gd : *Doxygen::groupLinkedMap) { if (!gd->isReference()) { - t << " <xi:include href=\"" << gd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << gd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } - t << "</chapter>\n"; + m_t << "</chapter>\n"; break; case isDirDocumentation: { - t << "</title>\n"; + m_t << "</title>\n"; for (const auto &dd : *Doxygen::dirLinkedMap) { if (dd->isLinkableInProject()) { - t << "< xi:include href=\"" << dd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << "< xi:include href=\"" << dd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } - t << "</chapter>\n"; + m_t << "</chapter>\n"; break; case isNamespaceDocumentation: { - t << "</title>\n"; + m_t << "</title>\n"; for (const auto &nd : *Doxygen::namespaceLinkedMap) { if (nd->isLinkableInProject() && !nd->isAlias()) { - t << "<xi:include href=\"" << nd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << "<xi:include href=\"" << nd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } - t << "</chapter>\n"; + m_t << "</chapter>\n"; + break; + case isConceptDocumentation: + { + m_t << "</title>\n"; + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + if (cd->isLinkableInProject() && !cd->isAlias()) + { + m_t << "<xi:include href=\"" << cd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + } + } + } + m_t << "</chapter>\n"; break; case isClassDocumentation: { - t << "</title>\n"; + m_t << "</title>\n"; for (const auto &cd : *Doxygen::classLinkedMap) { if (cd->isLinkableInProject() && @@ -527,15 +560,15 @@ DB_GEN_C2("IndexSections " << is) !cd->isAlias() ) { - t << " <xi:include href=\"" << cd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << cd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } - t << "</chapter>\n"; + m_t << "</chapter>\n"; break; case isFileDocumentation: { - t << "</title>\n"; + m_t << "</title>\n"; bool isFirst=TRUE; for (const auto &fn : *Doxygen::inputNameLinkedMap) { @@ -545,64 +578,64 @@ DB_GEN_C2("IndexSections " << is) { if (isFirst) { - t << " <xi:include href=\"" << fd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << fd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; if (sourceBrowser && m_prettyCode && fd->generateSourceFile()) { - t << " <xi:include href=\"" << fd->getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << fd->getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } isFirst=FALSE; } else { - t << " <xi:include href=\"" << fd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << fd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; if (sourceBrowser && m_prettyCode && fd->generateSourceFile()) { - t << " <xi:include href=\"" << fd->getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << fd->getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } } } } - t << "</chapter>\n"; + m_t << "</chapter>\n"; break; case isExampleDocumentation: { - t << "</title>\n"; + m_t << "</title>\n"; for (const auto &pd : *Doxygen::exampleLinkedMap) { - t << " <xi:include href=\"" << pd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << pd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } - t << "</chapter>\n"; + m_t << "</chapter>\n"; break; case isPageDocumentation: break; case isPageDocumentation2: break; case isEndIndex: - t << "<index/>\n"; + m_t << "<index/>\n"; break; } } -void DocbookGenerator::writePageLink(const char *name, bool /*first*/) +void DocbookGenerator::writePageLink(const QCString &name, bool /*first*/) { DB_GEN_C for (const auto &pd : *Doxygen::pageLinkedMap) { if (!pd->getGroupDef() && !pd->isReference() && pd->name() == stripPath(name)) { - t << "<chapter>\n"; + m_t << "<chapter>\n"; if (pd->hasTitle()) { - t << " <title>" << convertToDocBook(pd->title()) << "</title>\n"; + m_t << " <title>" << convertToDocBook(pd->title()) << "</title>\n"; } else { - t << " <title>" << convertToDocBook(pd->name()) << "</title>\n"; + m_t << " <title>" << convertToDocBook(pd->name()) << "</title>\n"; } - t << " <xi:include href=\"" << pd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; - t << "</chapter>\n"; + m_t << " <xi:include href=\"" << pd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << "</chapter>\n"; } } } @@ -611,126 +644,130 @@ void DocbookGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef { DB_GEN_C DocbookDocVisitor *visitor = - new DocbookDocVisitor(t,*this,ctx?ctx->getDefFileExtension():QCString("")); + new DocbookDocVisitor(m_t,*this,ctx?ctx->getDefFileExtension():QCString()); n->accept(visitor); delete visitor; } -void DocbookGenerator::startParagraph(const char *) +void DocbookGenerator::startParagraph(const QCString &) { DB_GEN_C - t << "<para>\n"; + m_t << "<para>\n"; } void DocbookGenerator::endParagraph() { DB_GEN_C - t << "</para>\n"; + m_t << "</para>\n"; } -void DocbookGenerator::writeString(const char *text) +void DocbookGenerator::writeString(const QCString &text) { DB_GEN_C - t << text; + m_t << text; } -void DocbookGenerator::startMemberHeader(const char *,int) +void DocbookGenerator::startMemberHeader(const QCString &,int) { DB_GEN_C - t << "<simplesect>\n"; + m_t << "<simplesect>\n"; m_inSimpleSect[m_levelListItem] = TRUE; - t << " <title>"; + m_t << " <title>"; } void DocbookGenerator::endMemberHeader() { DB_GEN_C - t << " </title>\n"; + m_t << " </title>\n"; } -void DocbookGenerator::docify(const char *str) +void DocbookGenerator::docify(const QCString &str) { DB_GEN_C - t << convertToDocBook(str); + m_t << convertToDocBook(str); } -void DocbookGenerator::writeObjectLink(const char *, const char *f, - const char *anchor, const char *text) +void DocbookGenerator::writeObjectLink(const QCString &, const QCString &f, + const QCString &anchor, const QCString &text) { DB_GEN_C - if (anchor) - if (f) t << "<link linkend=\"_" << stripPath(f) << "_1" << anchor << "\">"; - else t << "<link linkend=\"_" << anchor << "\">"; + if (!anchor.isEmpty()) + { + if (!f.isEmpty()) m_t << "<link linkend=\"_" << stripPath(f) << "_1" << anchor << "\">"; + else m_t << "<link linkend=\"_" << anchor << "\">"; + } else - t << "<link linkend=\"_" << stripPath(f) << "\">"; + { + m_t << "<link linkend=\"_" << stripPath(f) << "\">"; + } docify(text); - t << "</link>"; + m_t << "</link>"; } void DocbookGenerator::startMemberList() { DB_GEN_C - t << " <itemizedlist>\n"; + m_t << " <itemizedlist>\n"; m_levelListItem++; } void DocbookGenerator::endMemberList() { DB_GEN_C - if (m_inListItem[m_levelListItem]) t << "</listitem>\n"; + if (m_inListItem[m_levelListItem]) m_t << "</listitem>\n"; m_inListItem[m_levelListItem] = FALSE; - t << " </itemizedlist>\n"; + m_t << " </itemizedlist>\n"; m_levelListItem = (m_levelListItem> 0 ? m_levelListItem - 1 : 0); - if (m_inSimpleSect[m_levelListItem]) t << "</simplesect>\n"; + if (m_inSimpleSect[m_levelListItem]) m_t << "</simplesect>\n"; m_inSimpleSect[m_levelListItem] = FALSE; } -void DocbookGenerator::startMemberItem(const char *,int,const char *) +void DocbookGenerator::startMemberItem(const QCString &,int,const QCString &) { DB_GEN_C - if (m_inListItem[m_levelListItem]) t << "</listitem>\n"; - t << " <listitem><para>"; + if (m_inListItem[m_levelListItem]) m_t << "</listitem>\n"; + m_t << " <listitem><para>"; m_inListItem[m_levelListItem] = TRUE; } void DocbookGenerator::endMemberItem() { DB_GEN_C - t << "</para>\n"; + m_t << "</para>\n"; } void DocbookGenerator::startBold() { DB_GEN_C - t << "<emphasis role=\"strong\">"; + m_t << "<emphasis role=\"strong\">"; } void DocbookGenerator::endBold() { DB_GEN_C - t << "</emphasis>"; + m_t << "</emphasis>"; } void DocbookGenerator::startGroupHeader(int extraIndentLevel) { DB_GEN_C2("m_inLevel " << m_inLevel) DB_GEN_C2("extraIndentLevel " << extraIndentLevel) m_firstMember = TRUE; - if (m_inSimpleSect[m_levelListItem]) t << "</simplesect>\n"; + if (m_inSimpleSect[m_levelListItem]) m_t << "</simplesect>\n"; m_inSimpleSect[m_levelListItem] = FALSE; if (m_inLevel != -1) m_inGroup = TRUE; - if (m_inLevel == extraIndentLevel) t << "</section>\n"; + if (m_inLevel == extraIndentLevel) m_t << "</section>\n"; m_inLevel = extraIndentLevel; - t << "<section>\n"; - t << "<title>"; + m_t << "<section>\n"; + m_t << "<title>"; } void DocbookGenerator::writeRuler() { DB_GEN_C2("m_inLevel " << m_inLevel) DB_GEN_C2("m_inGroup " << m_inGroup) - if (m_inGroup) t << "</section>\n"; + if (m_inGroup) m_t << "</section>\n"; m_inGroup = FALSE; } void DocbookGenerator::endGroupHeader(int) { DB_GEN_C - t << "</title>\n"; + m_t << "</title>\n"; } void DocbookGenerator::startParameterList(bool openBracket) { DB_GEN_C - if (openBracket) t << "("; + if (openBracket) m_t << "("; } void DocbookGenerator::endParameterList() { @@ -739,22 +776,22 @@ DB_GEN_C void DocbookGenerator::writeNonBreakableSpace(int n) { DB_GEN_C - for (int i=0;i<n;i++) t << " "; + for (int i=0;i<n;i++) m_t << " "; } -void DocbookGenerator::lineBreak(const char *) +void DocbookGenerator::lineBreak(const QCString &) { DB_GEN_C - t << "\n"; + m_t << "\n"; } void DocbookGenerator::startTypewriter() { DB_GEN_C - if (!m_denseText) t << "<computeroutput>"; + if (!m_denseText) m_t << "<computeroutput>"; } void DocbookGenerator::endTypewriter() { DB_GEN_C - if (!m_denseText) t << "</computeroutput>\n"; + if (!m_denseText) m_t << "</computeroutput>\n"; } void DocbookGenerator::startTextBlock(bool dense) { @@ -762,7 +799,7 @@ DB_GEN_C if (dense) { m_denseText = TRUE; - t << "<programlisting>"; + m_t << "<programlisting>"; } } void DocbookGenerator::endTextBlock(bool) @@ -771,65 +808,65 @@ DB_GEN_C if (m_denseText) { m_denseText = FALSE; - t << "</programlisting>"; + m_t << "</programlisting>"; } } -void DocbookGenerator::startMemberDoc(const char *clname, const char *memname, const char *, const char *title, +void DocbookGenerator::startMemberDoc(const QCString &clname, const QCString &memname, const QCString &, const QCString &title, int memCount, int memTotal, bool) { DB_GEN_C2("m_inLevel " << m_inLevel) - t << " <section>\n"; - t << " <title>" << convertToDocBook(title); + m_t << " <section>\n"; + m_t << " <title>" << convertToDocBook(title); if (memTotal>1) { - t << "<computeroutput>[" << memCount << "/" << memTotal << "]</computeroutput>"; + m_t << "<computeroutput>[" << memCount << "/" << memTotal << "]</computeroutput>"; } - t << "</title>\n"; - if (memname && memname[0]!='@') + m_t << "</title>\n"; + if (!memname.isEmpty() && memname[0]!='@') { - addIndexTerm(t,memname,clname); - addIndexTerm(t,clname,memname); + addIndexTerm(m_t,memname,clname); + addIndexTerm(m_t,clname,memname); } } void DocbookGenerator::endMemberDoc(bool) { DB_GEN_C - t << "</computeroutput></para>"; + m_t << "</computeroutput></para>"; } -void DocbookGenerator::startTitleHead(const char *) +void DocbookGenerator::startTitleHead(const QCString &) { DB_GEN_C - t << "<title>"; + m_t << "<title>"; } -void DocbookGenerator::endTitleHead(const char *,const char *name) +void DocbookGenerator::endTitleHead(const QCString &,const QCString &name) { DB_GEN_C - t << "</title>\n"; - if (name) addIndexTerm(t, name); + m_t << "</title>\n"; + if (!name.isEmpty()) addIndexTerm(m_t, name); } -void DocbookGenerator::startDoxyAnchor(const char *fName,const char *, - const char *anchor,const char *, - const char *) +void DocbookGenerator::startDoxyAnchor(const QCString &fName,const QCString &, + const QCString &anchor,const QCString &, + const QCString &) { DB_GEN_C if (!m_inListItem[m_levelListItem] && !m_descTable) { - if (!m_firstMember) t << " </section>"; + if (!m_firstMember) m_t << " </section>"; m_firstMember = FALSE; } - if (anchor) + if (!anchor.isEmpty()) { - t << "<anchor xml:id=\"_" << stripPath(fName) << "_1" << anchor << "\"/>"; + m_t << "<anchor xml:id=\"_" << stripPath(fName) << "_1" << anchor << "\"/>"; } } -void DocbookGenerator::endDoxyAnchor(const char *,const char *) +void DocbookGenerator::endDoxyAnchor(const QCString &,const QCString &) { DB_GEN_C } void DocbookGenerator::startMemberDocName(bool) { DB_GEN_C - t << "<para><computeroutput>"; + m_t << "<para><computeroutput>"; } void DocbookGenerator::endMemberDocName() { @@ -838,12 +875,12 @@ DB_GEN_C void DocbookGenerator::startMemberGroupHeader(bool) { DB_GEN_C - t << "<simplesect><title>"; + m_t << "<simplesect><title>"; } void DocbookGenerator::endMemberGroupHeader() { DB_GEN_C - t << "</title>\n"; + m_t << "</title>\n"; } void DocbookGenerator::startMemberGroup() { @@ -852,38 +889,38 @@ DB_GEN_C void DocbookGenerator::endMemberGroup(bool) { DB_GEN_C - t << "</simplesect>\n"; + m_t << "</simplesect>\n"; } void DocbookGenerator::startClassDiagram() { DB_GEN_C - t << "<para>"; + m_t << "<para>"; } -void DocbookGenerator::endClassDiagram(const ClassDiagram &d, const char *fileName,const char *) +void DocbookGenerator::endClassDiagram(const ClassDiagram &d, const QCString &fileName,const QCString &) { DB_GEN_C - t << " <informalfigure>\n"; - t << " <mediaobject>\n"; - t << " <imageobject>\n"; - t << " <imagedata width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" + m_t << " <informalfigure>\n"; + m_t << " <mediaobject>\n"; + m_t << " <imageobject>\n"; + m_t << " <imagedata width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << relPath << fileName << ".png\">" << "</imagedata>\n"; - t << " </imageobject>\n"; - d.writeImage(t,dir(),relPath,fileName,FALSE); - t << " </mediaobject>\n"; - t << " </informalfigure>\n"; - t << "</para>\n"; + m_t << " </imageobject>\n"; + d.writeImage(m_t,dir(),relPath,fileName,FALSE); + m_t << " </mediaobject>\n"; + m_t << " </informalfigure>\n"; + m_t << "</para>\n"; } void DocbookGenerator::startLabels() { DB_GEN_C } -void DocbookGenerator::writeLabel(const char *l,bool isLast) +void DocbookGenerator::writeLabel(const QCString &l,bool isLast) { DB_GEN_C - t << "<computeroutput>[" << l << "]</computeroutput>"; - if (!isLast) t << ", "; + m_t << "<computeroutput>[" << l << "]</computeroutput>"; + if (!isLast) m_t << ", "; } void DocbookGenerator::endLabels() @@ -893,25 +930,25 @@ DB_GEN_C void DocbookGenerator::startExamples() { DB_GEN_C - t << "<simplesect><title>"; + m_t << "<simplesect><title>"; docify(theTranslator->trExamples()); - t << "</title>"; + m_t << "</title>"; } void DocbookGenerator::endExamples() { DB_GEN_C - t << "</simplesect>\n"; + m_t << "</simplesect>\n"; } void DocbookGenerator::startSubsubsection() { DB_GEN_C - t << "<simplesect><title>"; + m_t << "<simplesect><title>"; } void DocbookGenerator::endSubsubsection() { DB_GEN_C - t << "</title></simplesect>\n"; + m_t << "</title></simplesect>\n"; } void DocbookGenerator::writeChar(char c) { @@ -924,33 +961,37 @@ DB_GEN_C void DocbookGenerator::startMemberDocPrefixItem() { DB_GEN_C - t << "<computeroutput>"; + m_t << "<computeroutput>"; } void DocbookGenerator::endMemberDocPrefixItem() { DB_GEN_C - t << "</computeroutput>"; + m_t << "</computeroutput>"; } -void DocbookGenerator::exceptionEntry(const char* prefix,bool closeBracket) +void DocbookGenerator::exceptionEntry(const QCString &prefix,bool closeBracket) { DB_GEN_C - if (prefix) - t << " " << prefix << "("; + if (!prefix.isEmpty()) + { + m_t << " " << prefix << "("; + } else if (closeBracket) - t << ")"; - t << " "; + { + m_t << ")"; + } + m_t << " "; } void DocbookGenerator::startParameterName(bool) { DB_GEN_C - t << " "; + m_t << " "; } void DocbookGenerator::endParameterName(bool last,bool /*emptyList*/,bool closeBracket) { DB_GEN_C if (last) { - if (closeBracket) t << ")"; + if (closeBracket) m_t << ")"; } } void DocbookGenerator::startMemberTemplateParams() @@ -958,65 +999,65 @@ void DocbookGenerator::startMemberTemplateParams() DB_GEN_C } -void DocbookGenerator::endMemberTemplateParams(const char *,const char *) +void DocbookGenerator::endMemberTemplateParams(const QCString &,const QCString &) { DB_GEN_C - t << "</para>"; - t << "<para>"; + m_t << "</para>"; + m_t << "<para>"; } -void DocbookGenerator::startSection(const char *lab,const char *,SectionType) +void DocbookGenerator::startSection(const QCString &lab,const QCString &,SectionType) { DB_GEN_C - t << " <section xml:id=\"_" << stripPath(lab) << "\">"; - t << "<title>"; + m_t << " <section xml:id=\"_" << stripPath(lab) << "\">"; + m_t << "<title>"; } -void DocbookGenerator::endSection(const char *,SectionType) +void DocbookGenerator::endSection(const QCString &,SectionType) { DB_GEN_C - t << "</title>"; - t << " </section>"; + m_t << "</title>"; + m_t << " </section>"; } -void DocbookGenerator::addIndexItem(const char *prim,const char *sec) +void DocbookGenerator::addIndexItem(const QCString &prim,const QCString &sec) { DB_GEN_C - addIndexTerm(t, prim, sec); + addIndexTerm(m_t, prim, sec); } -void DocbookGenerator::startDescTable(const char *title) +void DocbookGenerator::startDescTable(const QCString &title) { DB_GEN_C int ncols = 2; - t << "<informaltable frame=\"all\">\n"; - if (title)t << "<title>" << convertToDocBook(title) << "</title>\n"; - t << " <tgroup cols=\"" << ncols << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">\n"; + m_t << "<informaltable frame=\"all\">\n"; + if (!title.isEmpty()) m_t << "<title>" << convertToDocBook(title) << "</title>\n"; + m_t << " <tgroup cols=\"" << ncols << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">\n"; for (int i = 0; i < ncols; i++) { - t << " <colspec colname='c" << i+1 << "'/>\n"; + m_t << " <colspec colname='c" << i+1 << "'/>\n"; } - t << "<tbody>\n"; + m_t << "<tbody>\n"; m_descTable = TRUE; } void DocbookGenerator::endDescTable() { DB_GEN_C - t << " </tbody>\n"; - t << " </tgroup>\n"; - t << "</informaltable>\n"; + m_t << " </tbody>\n"; + m_t << " </tgroup>\n"; + m_t << "</informaltable>\n"; m_descTable = FALSE; } void DocbookGenerator::startDescTableRow() { DB_GEN_C - t << "<row>"; - t << "<entry>"; + m_t << "<row>"; + m_t << "<entry>"; } void DocbookGenerator::endDescTableRow() { DB_GEN_C - t << "</row>"; + m_t << "</row>"; } void DocbookGenerator::startDescTableTitle() @@ -1032,13 +1073,13 @@ DB_GEN_C void DocbookGenerator::startDescTableData() { DB_GEN_C - t << "</entry><entry>"; + m_t << "</entry><entry>"; } void DocbookGenerator::endDescTableData() { DB_GEN_C - t << "</entry>"; + m_t << "</entry>"; } void DocbookGenerator::startGroupCollaboration() { @@ -1047,7 +1088,7 @@ DB_GEN_C void DocbookGenerator::endGroupCollaboration(DotGroupCollaboration &g) { DB_GEN_C - g.writeGraph(t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,FALSE); + g.writeGraph(m_t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,FALSE); } void DocbookGenerator::startDotGraph() { @@ -1056,7 +1097,7 @@ DB_GEN_C void DocbookGenerator::endDotGraph(DotClassGraph &g) { DB_GEN_C - g.writeGraph(t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,TRUE,FALSE); + g.writeGraph(m_t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,TRUE,FALSE); } void DocbookGenerator::startInclDepGraph() { @@ -1065,7 +1106,7 @@ DB_GEN_C void DocbookGenerator::endInclDepGraph(DotInclDepGraph &g) { DB_GEN_C - QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,FALSE); + QCString fn = g.writeGraph(m_t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,FALSE); } void DocbookGenerator::startCallGraph() { @@ -1074,7 +1115,7 @@ DB_GEN_C void DocbookGenerator::endCallGraph(DotCallGraph &g) { DB_GEN_C - QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,FALSE); + QCString fn = g.writeGraph(m_t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,FALSE); } void DocbookGenerator::startDirDepGraph() { @@ -1083,7 +1124,7 @@ DB_GEN_C void DocbookGenerator::endDirDepGraph(DotDirDeps &g) { DB_GEN_C - QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,FALSE); + QCString fn = g.writeGraph(m_t,GOF_BITMAP,EOF_DocBook,dir(),fileName(),relPath,FALSE); } void DocbookGenerator::startMemberDocList() { @@ -1094,17 +1135,17 @@ void DocbookGenerator::endMemberDocList() DB_GEN_C m_inGroup = TRUE; } -void DocbookGenerator::startConstraintList(const char *header) +void DocbookGenerator::startConstraintList(const QCString &header) { DB_GEN_C - t << "<simplesect><title>"; + m_t << "<simplesect><title>"; docify(header); - t << "</title>\n"; + m_t << "</title>\n"; } void DocbookGenerator::startConstraintParam() { DB_GEN_C - t << "<para><emphasis role=\"strong\">"; + m_t << "<para><emphasis role=\"strong\">"; } void DocbookGenerator::endConstraintParam() { @@ -1113,12 +1154,12 @@ DB_GEN_C void DocbookGenerator::startConstraintType() { DB_GEN_C - t << ":"; + m_t << ":"; } void DocbookGenerator::endConstraintType() { DB_GEN_C - t << "</emphasis></para>\n"; + m_t << "</emphasis></para>\n"; } void DocbookGenerator::startConstraintDocs() { @@ -1131,5 +1172,5 @@ DB_GEN_C void DocbookGenerator::endConstraintList() { DB_GEN_C - t << "</simplesect>\n"; + m_t << "</simplesect>\n"; } diff --git a/src/docbookgen.h b/src/docbookgen.h index 1f8b6ef..aba1527 100644 --- a/src/docbookgen.h +++ b/src/docbookgen.h @@ -23,42 +23,37 @@ class DocbookCodeGenerator : public CodeOutputInterface { public: - DocbookCodeGenerator(std::ostream &t); - DocbookCodeGenerator(); + DocbookCodeGenerator(TextStream &t); virtual ~DocbookCodeGenerator(); - void setTextStream(std::ostream &t) - { - m_t.rdbuf(t.rdbuf()); - } void setRelativePath(const QCString &path) { m_relPath = path; } void setSourceFileName(const QCString &sourceFileName) { m_sourceFileName = sourceFileName; } QCString sourceFileName() { return m_sourceFileName; } - void codify(const char *text); - void writeCodeLink(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip); - void writeCodeLinkLine(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip); - void writeTooltip(const char *, const DocLinkInfo &, const char *, - const char *, const SourceLinkInfo &, const SourceLinkInfo & + void codify(const QCString &text); + void writeCodeLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip); + void writeCodeLinkLine(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip); + void writeTooltip(const QCString &, const DocLinkInfo &, const QCString &, + const QCString &, const SourceLinkInfo &, const SourceLinkInfo & ); void startCodeLine(bool); void endCodeLine(); - void startFontClass(const char *colorClass); + void startFontClass(const QCString &colorClass); void endFontClass(); - void writeCodeAnchor(const char *); - void writeLineNumber(const char *extRef,const char *compId, - const char *anchorId,int l); - void setCurrentDoc(const Definition *,const char *,bool); - void addWord(const char *,bool); + void writeCodeAnchor(const QCString &); + void writeLineNumber(const QCString &extRef,const QCString &compId, + const QCString &anchorId,int l); + void setCurrentDoc(const Definition *,const QCString &,bool); + void addWord(const QCString &,bool); void finish(); - void startCodeFragment(const char *style); - void endCodeFragment(const char *style); + void startCodeFragment(const QCString &style); + void endCodeFragment(const QCString &style); private: - std::ostream m_t; + TextStream &m_t; QCString m_refId; QCString m_external; int m_lineNumber = -1; @@ -108,31 +103,31 @@ class DocbookGenerator : public OutputGenerator OutputType type() const { return Docbook; } // --- CodeOutputInterface - void codify(const char *text) + void codify(const QCString &text) { m_codeGen.codify(text); } - void writeCodeLink(const char *ref, const char *file, - const char *anchor,const char *name, - const char *tooltip) + void writeCodeLink(const QCString &ref, const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip) { m_codeGen.writeCodeLink(ref,file,anchor,name,tooltip); } - void writeLineNumber(const char *ref,const char *file,const char *anchor,int lineNumber) + void writeLineNumber(const QCString &ref,const QCString &file,const QCString &anchor,int lineNumber) { m_codeGen.writeLineNumber(ref,file,anchor,lineNumber); } - void writeTooltip(const char *id, const DocLinkInfo &docInfo, const char *decl, - const char *desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo + void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, const QCString &decl, + const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo ) { m_codeGen.writeTooltip(id,docInfo,decl,desc,defInfo,declInfo); } void startCodeLine(bool hasLineNumbers) { m_codeGen.startCodeLine(hasLineNumbers); } void endCodeLine() { m_codeGen.endCodeLine(); } - void startFontClass(const char *s) + void startFontClass(const QCString &s) { m_codeGen.startFontClass(s); } void endFontClass() { m_codeGen.endFontClass(); } - void writeCodeAnchor(const char *anchor) + void writeCodeAnchor(const QCString &anchor) { m_codeGen.writeCodeAnchor(anchor); } - void startCodeFragment(const char *style) + void startCodeFragment(const QCString &style) { m_codeGen.startCodeFragment(style); } - void endCodeFragment(const char *style) + void endCodeFragment(const QCString &style) { m_codeGen.endCodeFragment(style); } // --------------------------- @@ -141,19 +136,19 @@ class DocbookGenerator : public OutputGenerator /////////////////////////////////////////////////////////////// // structural output interface /////////////////////////////////////////////////////////////// - void startFile(const char *name,const char *manName, - const char *title,int id); + void startFile(const QCString &name,const QCString &manName, + const QCString &title,int id); void writeSearchInfo(){DB_GEN_EMPTY}; - void writeFooter(const char *){DB_GEN_NEW}; + void writeFooter(const QCString &){DB_GEN_NEW}; void endFile(); void startIndexSection(IndexSections); void endIndexSection(IndexSections); - void writePageLink(const char *,bool); + void writePageLink(const QCString &,bool); void startProjectNumber(){DB_GEN_NEW}; void endProjectNumber(){DB_GEN_NEW}; void writeStyleInfo(int){DB_GEN_EMPTY}; - void startTitleHead(const char *); - void endTitleHead(const char *fileName,const char *name); + void startTitleHead(const QCString &); + void endTitleHead(const QCString &fileName,const QCString &name); void startIndexListItem(){DB_GEN_NEW}; void endIndexListItem(){DB_GEN_NEW}; void startIndexList(){DB_GEN_NEW}; @@ -161,21 +156,21 @@ class DocbookGenerator : public OutputGenerator void startIndexKey(){DB_GEN_NEW}; void endIndexKey(){DB_GEN_NEW}; void startIndexValue(bool){DB_GEN_NEW}; - void endIndexValue(const char *,bool){DB_GEN_NEW}; + void endIndexValue(const QCString &,bool){DB_GEN_NEW}; void startItemList() {DB_GEN_EMPTY}; void endItemList() {DB_GEN_EMPTY}; - void startIndexItem(const char *,const char *){DB_GEN_NEW}; - void endIndexItem(const char *,const char *){DB_GEN_NEW}; + void startIndexItem(const QCString &,const QCString &){DB_GEN_NEW}; + void endIndexItem(const QCString &,const QCString &){DB_GEN_NEW}; void startItemListItem() {DB_GEN_EMPTY}; void endItemListItem() {DB_GEN_EMPTY}; - void docify(const char *text); + void docify(const QCString &text); void writeChar(char); - void writeString(const char *); - void startParagraph(const char *); + void writeString(const QCString &); + void startParagraph(const QCString &); void endParagraph(); - void writeObjectLink(const char *,const char *,const char *,const char *); - void startHtmlLink(const char *){DB_GEN_NEW}; + void writeObjectLink(const QCString &,const QCString &,const QCString &,const QCString &); + void startHtmlLink(const QCString &){DB_GEN_NEW}; void endHtmlLink(){DB_GEN_NEW}; void startBold(); void endBold(); @@ -196,17 +191,17 @@ class DocbookGenerator : public OutputGenerator void endSmall(){DB_GEN_NEW}; void startExamples(); void endExamples(); - void startParamList(BaseOutputDocInterface::ParamListTypes,const char *){DB_GEN_NEW}; + void startParamList(BaseOutputDocInterface::ParamListTypes,const QCString &){DB_GEN_NEW}; void endParamList(){DB_GEN_NEW}; void startTitle(){DB_GEN_NEW}; void endTitle(){DB_GEN_NEW}; - void writeAnchor(const char *,const char *){DB_GEN_EMPTY}; - void startSection(const char *,const char *,SectionType); - void endSection(const char *,SectionType); - void lineBreak(const char *); - void addIndexItem(const char *,const char *); + void writeAnchor(const QCString &,const QCString &){DB_GEN_EMPTY}; + void startSection(const QCString &,const QCString &,SectionType); + void endSection(const QCString &,SectionType); + void lineBreak(const QCString &); + void addIndexItem(const QCString &,const QCString &); void writeNonBreakableSpace(int); - void startDescTable(const char *); + void startDescTable(const QCString &); void endDescTable(); void startDescTableRow(); void endDescTableRow(); @@ -214,10 +209,10 @@ class DocbookGenerator : public OutputGenerator void endDescTableTitle(); void startDescTableData(); void endDescTableData(); - void startTextLink(const char *,const char *){DB_GEN_NEW}; + void startTextLink(const QCString &,const QCString &){DB_GEN_NEW}; void endTextLink(){DB_GEN_NEW}; void startPageRef(){DB_GEN_NEW}; - void endPageRef(const char *,const char *){DB_GEN_NEW}; + void endPageRef(const QCString &,const QCString &){DB_GEN_NEW}; void startSubsection(){DB_GEN_NEW}; void endSubsection(){DB_GEN_NEW}; void startSubsubsection(); @@ -230,7 +225,7 @@ class DocbookGenerator : public OutputGenerator void endMemberSections(){DB_GEN_EMPTY}; void startHeaderSection(){DB_GEN_EMPTY}; void endHeaderSection(){DB_GEN_EMPTY}; - void startMemberHeader(const char *anchor, int typ); + void startMemberHeader(const QCString &anchor, int typ); void endMemberHeader(); void startMemberSubtitle(){DB_GEN_EMPTY}; void endMemberSubtitle(){DB_GEN_EMPTY}; @@ -242,10 +237,12 @@ class DocbookGenerator : public OutputGenerator void endInlineHeader(){DB_GEN_NEW}; void startAnonTypeScope(int){DB_GEN_EMPTY}; void endAnonTypeScope(int){DB_GEN_EMPTY}; - void startMemberItem(const char *,int,const char *); + void startMemberItem(const QCString &,int,const QCString &); void endMemberItem(); void startMemberTemplateParams(); - void endMemberTemplateParams(const char *,const char *); + void endMemberTemplateParams(const QCString &,const QCString &); + void startCompoundTemplateParams() { startSubsubsection(); } + void endCompoundTemplateParams() { endSubsubsection(); } void startMemberGroupHeader(bool); void endMemberGroupHeader(); void startMemberGroupDocs(){DB_GEN_EMPTY}; @@ -254,29 +251,29 @@ class DocbookGenerator : public OutputGenerator void endMemberGroup(bool); void insertMemberAlign(bool){DB_GEN_EMPTY}; void insertMemberAlignLeft(int,bool){DB_GEN_EMPTY}; - void startMemberDoc(const char *,const char *, - const char *,const char *,int,int,bool); + void startMemberDoc(const QCString &,const QCString &, + const QCString &,const QCString &,int,int,bool); void endMemberDoc(bool); - void startDoxyAnchor(const char *fName,const char *manName, - const char *anchor,const char *name, - const char *args); - void endDoxyAnchor(const char *fileName,const char *anchor); + void startDoxyAnchor(const QCString &fName,const QCString &manName, + const QCString &anchor,const QCString &name, + const QCString &args); + void endDoxyAnchor(const QCString &fileName,const QCString &anchor); void writeLatexSpacing(){DB_GEN_EMPTY} - void writeStartAnnoItem(const char *,const char *, - const char *,const char *){DB_GEN_NEW}; - void writeEndAnnoItem(const char *){DB_GEN_NEW}; - void startMemberDescription(const char *,const char *,bool){DB_GEN_EMPTY}; + void writeStartAnnoItem(const QCString &,const QCString &, + const QCString &,const QCString &){DB_GEN_NEW}; + void writeEndAnnoItem(const QCString &){DB_GEN_NEW}; + void startMemberDescription(const QCString &,const QCString &,bool){DB_GEN_EMPTY}; void endMemberDescription(){DB_GEN_EMPTY}; void startMemberDeclaration(){DB_GEN_EMPTY}; - void endMemberDeclaration(const char *,const char *){DB_GEN_EMPTY}; - void writeInheritedSectionTitle(const char *,const char *, - const char *,const char *, - const char *,const char *){DB_GEN_NEW}; + void endMemberDeclaration(const QCString &,const QCString &){DB_GEN_EMPTY}; + void writeInheritedSectionTitle(const QCString &,const QCString &, + const QCString &,const QCString &, + const QCString &,const QCString &){DB_GEN_NEW}; void startIndent(){DB_GEN_EMPTY}; void endIndent(){DB_GEN_EMPTY}; void writeSynopsis(){DB_GEN_EMPTY}; void startClassDiagram(); - void endClassDiagram(const ClassDiagram &,const char *,const char *); + void endClassDiagram(const ClassDiagram &,const QCString &,const QCString &); void startDotGraph(); void endDotGraph(DotClassGraph &g); void startInclDepGraph(); @@ -290,14 +287,14 @@ class DocbookGenerator : public OutputGenerator void writeGraphicalHierarchy(DotGfxHierarchyTable &){DB_GEN_NEW}; void startQuickIndices(){DB_GEN_EMPTY}; void endQuickIndices(){DB_GEN_EMPTY}; - void writeSplitBar(const char *){DB_GEN_EMPTY}; - void writeNavigationPath(const char *){DB_GEN_NEW}; + void writeSplitBar(const QCString &){DB_GEN_EMPTY}; + void writeNavigationPath(const QCString &){DB_GEN_NEW}; void writeLogo(){DB_GEN_NEW}; - void writeQuickLinks(bool,HighlightedItem,const char *){DB_GEN_EMPTY}; - void writeSummaryLink(const char *,const char *,const char *,bool){DB_GEN_EMPTY}; + void writeQuickLinks(bool,HighlightedItem,const QCString &){DB_GEN_EMPTY}; + void writeSummaryLink(const QCString &,const QCString &,const QCString &,bool){DB_GEN_EMPTY}; void startContents(){DB_GEN_EMPTY}; void endContents(){DB_GEN_EMPTY}; - void startPageDoc(const char *){DB_GEN_EMPTY} + void startPageDoc(const QCString &){DB_GEN_EMPTY} void endPageDoc() {DB_GEN_EMPTY} void startTextBlock(bool); void endTextBlock(bool); @@ -306,15 +303,15 @@ class DocbookGenerator : public OutputGenerator void endMemberDocPrefixItem(); void startMemberDocName(bool); void endMemberDocName(); - void startParameterType(bool,const char *){DB_GEN_EMPTY}; + void startParameterType(bool,const QCString &){DB_GEN_EMPTY}; void endParameterType(){DB_GEN_EMPTY}; void startParameterName(bool); void endParameterName(bool,bool,bool); void startParameterList(bool); void endParameterList(); - void exceptionEntry(const char*,bool); + void exceptionEntry(const QCString &,bool); - void startConstraintList(const char *); + void startConstraintList(const QCString &); void startConstraintParam(); void endConstraintParam(); void startConstraintType(); @@ -333,11 +330,11 @@ class DocbookGenerator : public OutputGenerator void endInlineMemberDoc(){DB_GEN_NEW}; void startLabels(); - void writeLabel(const char *,bool); + void writeLabel(const QCString &,bool); void endLabels(); - void setCurrentDoc(const Definition *,const char *,bool) {DB_GEN_EMPTY} - void addWord(const char *,bool) {DB_GEN_EMPTY} + void setCurrentDoc(const Definition *,const QCString &,bool) {DB_GEN_EMPTY} + void addWord(const QCString &,bool) {DB_GEN_EMPTY} private: diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index 60c1b08..2cfa6f0 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -48,12 +48,12 @@ #define DB_VIS_C2a(x,y) #endif -static QCString filterId(const char *s) +static QCString filterId(const QCString &s) { + if (s.isEmpty()) return s; static GrowBuf growBuf; growBuf.clear(); - if (s==0) return ""; - const char *p=s; + const char *p=s.data(); char c; while ((c=*p++)) { @@ -89,7 +89,7 @@ void DocbookDocVisitor::visitCaption(const DocNodeList &children) for (const auto &n : children) n->accept(this); } -void DocbookDocVisitor::visitPreStart(std::ostream &t, +void DocbookDocVisitor::visitPreStart(TextStream &t, const DocNodeList &children, bool hasCaption, const QCString &name, @@ -132,7 +132,7 @@ void DocbookDocVisitor::visitPreStart(std::ostream &t, } } -void DocbookDocVisitor::visitPostEnd(std::ostream &t, bool hasCaption, bool inlineImage) +void DocbookDocVisitor::visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage) { t << "\n"; if (hasCaption && !inlineImage) @@ -150,7 +150,7 @@ void DocbookDocVisitor::visitPostEnd(std::ostream &t, bool hasCaption, bool inli } } -DocbookDocVisitor::DocbookDocVisitor(std::ostream &t,CodeOutputInterface &ci,const char *langExt) +DocbookDocVisitor::DocbookDocVisitor(TextStream &t,CodeOutputInterface &ci,const QCString &langExt) : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci),m_langExt(langExt) { DB_VIS_C @@ -348,7 +348,7 @@ DB_VIS_C m_t << "<para>\n"; name.sprintf("%s%d", "dot_inline_dotgraph_", dotindex); baseName.sprintf("%s%d", - (Config_getString(DOCBOOK_OUTPUT)+"/inline_dotgraph_").data(), + qPrint(Config_getString(DOCBOOK_OUTPUT)+"/inline_dotgraph_"), dotindex++ ); std::string fileName = baseName.str()+".dot"; @@ -932,7 +932,30 @@ void DocbookDocVisitor::visitPre(DocHtmlList *s) DB_VIS_C if (m_hide) return; if (s->type()==DocHtmlList::Ordered) - m_t << "<orderedlist>\n"; + { + m_t << "<orderedlist"; + for (const auto &opt : s->attribs()) + { + if (opt.name=="type") + { + if (opt.value=="1") + m_t << " numeration=\"arabic\""; + else if (opt.value=="a") + m_t << " numeration=\"loweralpha\""; + else if (opt.value=="A") + m_t << " numeration=\"upperalpha\""; + else if (opt.value=="i") + m_t << " numeration=\"lowerroman\""; + else if (opt.value=="I") + m_t << " numeration=\"upperroman\""; + } + else if (opt.name=="start") + { + m_t << " startingnumber=\"" << opt.value << "\""; + } + } + m_t << ">\n"; + } else m_t << "<itemizedlist>\n"; } @@ -1229,7 +1252,7 @@ DB_VIS_C { m_file=fd->absFilePath(); } - copyFile(m_file,Config_getString(DOCBOOK_OUTPUT)+"/"+baseName.data()); + copyFile(m_file,Config_getString(DOCBOOK_OUTPUT)+"/"+baseName); } else { @@ -1298,7 +1321,7 @@ DB_VIS_C if (m_hide) return; if (ref->isSubPage()) { - startLink(0,ref->anchor()); + startLink(QCString(),ref->anchor()); } else { @@ -1572,7 +1595,7 @@ DB_VIS_C } -void DocbookDocVisitor::filter(const char *str) +void DocbookDocVisitor::filter(const QCString &str) { DB_VIS_C m_t << convertToDocBook(str); @@ -1584,7 +1607,7 @@ DB_VIS_C m_t << "<link linkend=\"_" << stripPath(file); if (!anchor.isEmpty()) { - if (file) m_t << "_1"; + if (!file.isEmpty()) m_t << "_1"; m_t << anchor; } m_t << "\">"; diff --git a/src/docbookvisitor.h b/src/docbookvisitor.h index f1e6c88..5580de0 100644 --- a/src/docbookvisitor.h +++ b/src/docbookvisitor.h @@ -25,12 +25,13 @@ class CodeOutputInterface; class QCString; +class TextStream; /*! @brief Concrete visitor implementation for Docbook output. */ class DocbookDocVisitor : public DocVisitor { public: - DocbookDocVisitor(std::ostream &t,CodeOutputInterface &ci,const char *langExt); + DocbookDocVisitor(TextStream &t,CodeOutputInterface &ci,const QCString &langExt); ~DocbookDocVisitor(); //-------------------------------------- // visitor functions for leaf nodes @@ -138,7 +139,7 @@ class DocbookDocVisitor : public DocVisitor //-------------------------------------- // helper functions //-------------------------------------- - void filter(const char *str); + void filter(const QCString &str); void startLink(const QCString &file, const QCString &anchor); void endLink(); @@ -155,19 +156,19 @@ class DocbookDocVisitor : public DocVisitor void endDotFile(bool hasCaption); void writeDotFile(const QCString &fileName, DocVerbatim *s); void writePlantUMLFile(const QCString &fileName, DocVerbatim *s); - void visitPreStart(std::ostream &t, + void visitPreStart(TextStream &t, const DocNodeList &children, bool hasCaption, const QCString &name, const QCString &width, const QCString &height, bool inlineImage = FALSE); - void visitPostEnd(std::ostream &t, bool hasCaption, bool inlineImage = FALSE); + void visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage = FALSE); void visitCaption(const DocNodeList &children); //-------------------------------------- // state variables //-------------------------------------- - std::ostream &m_t; + TextStream &m_t; CodeOutputInterface &m_ci; bool m_insidePre = false; bool m_hide = false; diff --git a/src/docgroup.cpp b/src/docgroup.cpp index 49fb9dc..07ff8f3 100644 --- a/src/docgroup.cpp +++ b/src/docgroup.cpp @@ -22,7 +22,7 @@ static std::atomic_int g_groupId; -void DocGroup::enterFile(const char *fileName,int) +void DocGroup::enterFile(const QCString &fileName,int) { m_openCount = 0; m_autoGroupStack.clear(); @@ -32,7 +32,7 @@ void DocGroup::enterFile(const char *fileName,int) m_compoundName=fileName; } -void DocGroup::leaveFile(const char *fileName,int line) +void DocGroup::leaveFile(const QCString &fileName,int line) { //if (m_memberGroupId!=DOX_NOGROUP) //{ @@ -51,11 +51,11 @@ void DocGroup::leaveFile(const char *fileName,int line) } } -void DocGroup::enterCompound(const char *fileName,int line,const char *name) +void DocGroup::enterCompound(const QCString &fileName,int line,const QCString &name) { if (m_memberGroupId!=DOX_NOGROUP) { - warn(fileName,line,"try to put compound %s inside a member group\n",name); + warn(fileName,line,"try to put compound %s inside a member group\n",qPrint(name)); } m_memberGroupId=DOX_NOGROUP; m_memberGroupRelates.resize(0); @@ -73,12 +73,12 @@ void DocGroup::enterCompound(const char *fileName,int line,const char *name) //printf("groupEnterCompound(%s)\n",name); } -void DocGroup::leaveCompound(const char *,int,const char * /*name*/) +void DocGroup::leaveCompound(const QCString &,int,const QCString & /*name*/) { //printf("groupLeaveCompound(%s)\n",name); //if (m_memberGroupId!=DOX_NOGROUP) //{ - // warn(fileName,line,"end of compound %s while inside a member group\n",name); + // warn(fileName,line,"end of compound %s while inside a member group\n",qPrint(name)); //} m_memberGroupId=DOX_NOGROUP; m_memberGroupRelates.resize(0); @@ -88,7 +88,7 @@ void DocGroup::leaveCompound(const char *,int,const char * /*name*/) int DocGroup::findExistingGroup(const MemberGroupInfo *info) { - //printf("findExistingGroup %s:%s\n",info->header.data(),info->compoundName.data()); + //printf("findExistingGroup %s:%s\n",qPrint(info->header),qPrint(info->compoundName)); for (const auto &kv : Doxygen::memberGroupInfoMap) { if (m_compoundName==kv.second->compoundName && // same file or scope @@ -103,18 +103,18 @@ int DocGroup::findExistingGroup(const MemberGroupInfo *info) return ++g_groupId; // start new group } -void DocGroup::open(Entry *e,const char *,int, bool implicit) +void DocGroup::open(Entry *e,const QCString &,int, bool implicit) { if (!implicit) m_openCount++; //printf("==> openGroup(name=%s,sec=%x) m_autoGroupStack=%d\n", - // e->name.data(),e->section,m_autoGroupStack.size()); + // qPrint(e->name),e->section,m_autoGroupStack.size()); if (e->section==Entry::GROUPDOC_SEC) // auto group { m_autoGroupStack.push_back(Grouping(e->name,e->groupingPri())); } else // start of a member group { - //printf(" membergroup id=%d %s\n",m_memberGroupId,m_memberGroupHeader.data()); + //printf(" membergroup id=%d %s\n",m_memberGroupId,qPrint(m_memberGroupHeader)); if (m_memberGroupId==DOX_NOGROUP) // no group started yet { auto info = std::make_unique<MemberGroupInfo>(); @@ -133,7 +133,7 @@ void DocGroup::open(Entry *e,const char *,int, bool implicit) } } -void DocGroup::close(Entry *e,const char *fileName,int line,bool foundInline,bool implicit) +void DocGroup::close(Entry *e,const QCString &fileName,int line,bool foundInline,bool implicit) { if (!implicit) { @@ -147,7 +147,7 @@ void DocGroup::close(Entry *e,const char *fileName,int line,bool foundInline,boo } } //printf("==> closeGroup(name=%s,sec=%x,file=%s,line=%d) m_autoGroupStack=%d\n", - // e->name.data(),e->section,fileName,line,m_autoGroupStack.size()); + // qPrint(e->name),e->section,fileName,line,m_autoGroupStack.size()); if (m_memberGroupId!=DOX_NOGROUP) // end of member group { auto it = Doxygen::memberGroupInfoMap.find(m_memberGroupId); @@ -170,7 +170,7 @@ void DocGroup::close(Entry *e,const char *fileName,int line,bool foundInline,boo m_autoGroupStack.pop_back(); // see bug577005: we should not remove the last group for e if (!foundInline && !e->groups.empty()) e->groups.pop_back(); - //printf("Removing %s e=%p\n",grp->groupname.data(),e); + //printf("Removing %s e=%p\n",qPrint(grp->groupname),e); if (!foundInline) initGroupInfo(e); } } @@ -178,14 +178,14 @@ void DocGroup::close(Entry *e,const char *fileName,int line,bool foundInline,boo void DocGroup::initGroupInfo(Entry *e) { //printf("==> initGroup(id=%d,related=%s,e=%p)\n",m_memberGroupId, - // m_memberGroupRelates.data(),e); + // qPrint(m_memberGroupRelates),e); e->mGrpId = m_memberGroupId; e->relates = m_memberGroupRelates; if (!m_autoGroupStack.empty()) { //printf("Appending group %s to %s: count=%d entry=%p\n", - // m_autoGroupStack.top()->groupname.data(), - // e->name.data(),e->groups->count(),e); + // qPrint(m_autoGroupStack.top()->groupname), + // qPrint(e->name),e->groups->count(),e); e->groups.push_back(Grouping(m_autoGroupStack.back())); } } diff --git a/src/docgroup.h b/src/docgroup.h index 696e4f7..de22098 100644 --- a/src/docgroup.h +++ b/src/docgroup.h @@ -27,12 +27,12 @@ class DocGroup DocGroup() {}; public: - void enterFile(const char *fileName,int); - void leaveFile(const char *fileName,int line); - void enterCompound(const char *fileName,int line,const char *name); - void leaveCompound(const char *,int,const char * /*name*/); - void open(Entry *e,const char *,int,bool implicit=false); - void close(Entry *e,const char *fileName,int line,bool foundInline,bool implicit=false); + void enterFile(const QCString &fileName,int); + void leaveFile(const QCString &fileName,int line); + void enterCompound(const QCString &fileName,int line,const QCString &name); + void leaveCompound(const QCString &,int,const QCString & /*name*/); + void open(Entry *e,const QCString &,int,bool implicit=false); + void close(Entry *e,const QCString &fileName,int line,bool foundInline,bool implicit=false); void initGroupInfo(Entry *e); bool isEmpty() const; void clearHeader(); diff --git a/src/docparser.cpp b/src/docparser.cpp index a1f982c..6e2a6d8 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -52,7 +52,7 @@ #include "fileinfo.h" #include "dir.h" -#define TK_COMMAND_CHAR(token) ((token)==TK_COMMAND_AT ? '@' : '\\') +#define TK_COMMAND_CHAR(token) ((token)==TK_COMMAND_AT ? "@" : "\\") // debug off #define DBG(x) do {} while(0) @@ -182,7 +182,7 @@ static void docParserPushContext(bool saveParamInfo=TRUE) { //QCString indent; //indent.fill(' ',g_parserStack.count()*2+2); - //printf("%sdocParserPushContext() count=%d\n",indent.data(),g_nodeStack.count()); + //printf("%sdocParserPushContext() count=%d\n",qPrint(indent),g_nodeStack.count()); doctokenizerYYpushContext(); @@ -266,7 +266,7 @@ static void docParserPopContext(bool keepParamInfo=FALSE) //QCString indent; //indent.fill(' ',g_parserStack.count()*2+2); - //printf("%sdocParserPopContext() count=%d\n",indent.data(),g_nodeStack.count()); + //printf("%sdocParserPopContext() count=%d\n",qPrint(indent),g_nodeStack.count()); } //--------------------------------------------------------------------------- @@ -275,21 +275,21 @@ static void docParserPopContext(bool keepParamInfo=FALSE) // replaces > with < and > with > within string s static void unescapeCRef(QCString &s) { - QCString tmp(s); - char *p = tmp.rawData(); + QCString result; + const char *p = s.data(); if (p) { char c; - while ((c=*p)) + while ((c=*p++)) { if (c=='{') c='<'; else if (c=='}') c='>'; - *p++=c; + result+=c; } } - tmp=substitute(tmp,"<","<"); - tmp=substitute(tmp,">",">"); - s = tmp; + result=substitute(result,"<","<"); + result=substitute(result,">",">"); + s = result; } //--------------------------------------------------------------------------- @@ -298,7 +298,7 @@ static void unescapeCRef(QCString &s) * copies the image to the output directory (which depends on the \a type * parameter). */ -static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool dowarn = true) +static QCString findAndCopyImage(const QCString &fileName,DocImage::Type type, bool dowarn = true) { QCString result; bool ambig; @@ -312,7 +312,7 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool text.sprintf("image file name %s is ambiguous.\n",qPrint(fileName)); text+="Possible candidates:\n"; text+=showFileDefMatches(Doxygen::imageNameLinkedMap,fileName); - warn_doc_error(g_fileName,getDoctokinizerLineNr(),"%s", text.data()); + warn_doc_error(g_fileName,getDoctokinizerLineNr(),"%s", qPrint(text)); } QCString inputFile = fd->absFilePath(); @@ -325,7 +325,7 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool { result = result.right((int)result.length()-i-1); } - //printf("fileName=%s result=%s\n",fileName,result.data()); + //printf("fileName=%s result=%s\n",fileName,qPrint(result)); QCString outputDir; switch(type) { @@ -377,8 +377,8 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool QCString baseName = fd->name().left(fd->name().length()-4); QCString epstopdfArgs(4096); epstopdfArgs.sprintf("\"%s/%s.eps\" --outfile=\"%s/%s.pdf\"", - outputDir.data(), baseName.data(), - outputDir.data(), baseName.data()); + qPrint(outputDir), qPrint(baseName), + qPrint(outputDir), qPrint(baseName)); Portable::sysTimerStart(); if (Portable::system("epstopdf",epstopdfArgs)!=0) { @@ -427,14 +427,14 @@ static void checkArgumentName(const std::string &name) const auto &match = *it; QCString aName=match.str(); if (lang==SrcLangExt_Fortran) aName=aName.lower(); - //printf("aName='%s'\n",aName.data()); + //printf("aName='%s'\n",qPrint(aName)); bool found=FALSE; for (const Argument &a : al) { QCString argName = g_memberDef->isDefine() ? a.type : a.name; if (lang==SrcLangExt_Fortran) argName=argName.lower(); argName=argName.stripWhiteSpace(); - //printf("argName='%s' aName=%s\n",argName.data(),aName.data()); + //printf("argName='%s' aName=%s\n",qPrint(argName),qPrint(aName)); if (argName.right(3)=="...") argName=argName.left(argName.length()-3); if (aName==argName) { @@ -481,9 +481,9 @@ static void checkRetvalName(const QCString &name) warn_doc_error(g_memberDef->getDefFileName(), g_memberDef->getDefLine(), "%s", - ("return value '" + name + "' of " + + qPrint("return value '" + name + "' of " + QCString(g_memberDef->qualifiedName()) + - " has multiple documentation sections").data()); + " has multiple documentation sections")); } g_retvalsFound.insert(name.str()); } @@ -525,7 +525,7 @@ static void checkUnOrMultipleDocumentedParams() { for (const auto &par : g_paramsFound) { - if (argName == par) count++; + if (argName == QCString(par)) count++; } } if ((count > 1) && Config_getBool(WARN_IF_DOC_ERROR)) @@ -533,10 +533,10 @@ static void checkUnOrMultipleDocumentedParams() warn_doc_error(g_memberDef->getDefFileName(), g_memberDef->getDefLine(), "%s", - ("argument '" + aName + + qPrint("argument '" + aName + "' from the argument list of " + QCString(g_memberDef->qualifiedName()) + - " has multiple @param documentation sections").data()); + " has multiple @param documentation sections")); } } if ((notArgCnt>0) && Config_getBool(WARN_IF_INCOMPLETE_DOC)) @@ -574,7 +574,7 @@ static void checkUnOrMultipleDocumentedParams() warn_incomplete_doc(g_memberDef->getDefFileName(), g_memberDef->getDefLine(), "%s", - substitute(errMsg,"%","%%").data()); + qPrint(substitute(errMsg,"%","%%"))); } } } @@ -583,7 +583,7 @@ static void checkUnOrMultipleDocumentedParams() //--------------------------------------------------------------------------- /*! Strips known html and tex extensions from \a text. */ -static QCString stripKnownExtensions(const char *text) +static QCString stripKnownExtensions(const QCString &text) { QCString result=text; if (result.right(4)==".tex") @@ -673,10 +673,10 @@ static bool insideTable(DocNode *n) * @retval TRUE if name was found. * @retval FALSE if name was not found. */ -static bool findDocsForMemberOrCompound(const char *commandName, - QCString *pDoc, - QCString *pBrief, - const Definition **pDef) +static bool findDocsForMemberOrCompound(const QCString &commandName, + QCString *pDoc, + QCString *pBrief, + const Definition **pDef) { //printf("findDocsForMemberOrCompound(%s)\n",commandName); *pDoc=""; @@ -748,11 +748,11 @@ static bool findDocsForMemberOrCompound(const char *commandName, const ClassDef *cd=0; const NamespaceDef *nd=0; bool found = getDefs( - g_context.find('.')==-1?g_context.data():"", // find('.') is a hack to detect files + g_context.find('.')==-1?g_context:QCString(), // find('.') is a hack to detect files name, - args.isEmpty()?0:args.data(), + args.isEmpty() ? QCString() : args, md,cd,fd,nd,gd,FALSE,0,TRUE); - //printf("found=%d context=%s name=%s\n",found,g_context.data(),name.data()); + //printf("found=%d context=%s name=%s\n",found,qPrint(g_context),qPrint(name)); if (found && md) { *pDoc=md->documentation(); @@ -770,7 +770,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, { fullName.prepend(g_context.left(scopeOffset)+"::"); } - //printf("Trying fullName='%s'\n",fullName.data()); + //printf("Trying fullName='%s'\n",qPrint(fullName)); // try class, namespace, group, page, file reference cd = Doxygen::classLinkedMap->find(fullName); @@ -806,7 +806,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, //--------------------------------------------------------------------------- inline void errorHandleDefaultToken(DocNode *parent,int tok, - DocNodeList &children,const char *txt) + DocNodeList &children,const QCString &txt) { const char *cmd_start = "\\"; switch (tok) @@ -817,16 +817,16 @@ inline void errorHandleDefaultToken(DocNode *parent,int tok, case TK_COMMAND_BS: children.push_back(std::make_unique<DocWord>(parent,TK_COMMAND_CHAR(tok) + g_token->name)); warn_doc_error(g_fileName,getDoctokinizerLineNr(),"Illegal command %s as part of a %s", - qPrint(cmd_start + g_token->name),txt); + qPrint(cmd_start + g_token->name),qPrint(txt)); break; case TK_SYMBOL: warn_doc_error(g_fileName,getDoctokinizerLineNr(),"Unsupported symbol %s found found as part of a %s", - qPrint(g_token->name), txt); + qPrint(g_token->name), qPrint(txt)); break; default: children.push_back(std::make_unique<DocWord>(parent,g_token->name)); warn_doc_error(g_fileName,getDoctokinizerLineNr(),"Unexpected token %s found as part of a %s", - tokToString(tok), txt); + tokToString(tok), qPrint(txt)); break; } } @@ -902,7 +902,7 @@ static void handleStyleEnter(DocNode *parent,DocNodeList &children, * encountered. */ static void handleStyleLeave(DocNode *parent,DocNodeList &children, - DocStyleChange::Style s,const char *tagName) + DocStyleChange::Style s,const QCString &tagName) { DBG(("HandleStyleLeave\n")); QCString tagNameLower = QCString(tagName).lower(); @@ -1064,7 +1064,7 @@ static void handleLinkedWord(DocNode *parent,DocNodeList &children,bool ignoreAu ClassDef *cd=0; bool ambig; FileDef *fd = findFileDef(Doxygen::inputNameLinkedMap,g_fileName,ambig); - //printf("handleLinkedWord(%s) g_context=%s\n",g_token->name.data(),g_context.data()); + //printf("handleLinkedWord(%s) g_context=%s\n",qPrint(g_token->name),qPrint(g_context)); if (!g_insideHtmlLink && (resolveRef(g_context,g_token->name,g_inSeeBlock,&compound,&member,TRUE,fd,TRUE) || (!g_context.isEmpty() && // also try with global scope @@ -1097,7 +1097,7 @@ static void handleLinkedWord(DocNode *parent,DocNodeList &children,bool ignoreAu } else if (compound->definitionType()==Definition::TypeGroup) { - name=(toGroupDef(compound))->groupTitle(); + name=toGroupDef(compound)->groupTitle(); } children.push_back( std::make_unique<DocLinkedWord>( @@ -1256,7 +1256,7 @@ static void defaultHandleTitleAndSize(const int cmd, DocNode *parent, DocNodeLis } if (!defaultHandleToken(parent,tok,children)) { - errorHandleDefaultToken(parent,tok,children,Mappers::cmdMapper->find(cmd).data()); + errorHandleDefaultToken(parent,tok,children,Mappers::cmdMapper->find(cmd)); } } // parse size attributes @@ -1285,7 +1285,7 @@ static void defaultHandleTitleAndSize(const int cmd, DocNode *parent, DocNodeLis else { warn_doc_error(g_fileName,getDoctokinizerLineNr(),"Unknown option '%s' after \\%s command, expected 'width' or 'height'", - qPrint(g_token->name), Mappers::cmdMapper->find(cmd).data()); + qPrint(g_token->name), qPrint(Mappers::cmdMapper->find(cmd))); break; } } @@ -1507,7 +1507,7 @@ reparsetoken: (void)doctokenizerYYlex(); scope = g_token->name; g_context = scope; - //printf("Found scope='%s'\n",scope.data()); + //printf("Found scope='%s'\n",qPrint(scope)); doctokenizerYYsetStatePara(); } break; @@ -1720,7 +1720,7 @@ static void handleImg(DocNode *parent, DocNodeList &children,const HtmlAttribLis uint index=0; for (const auto &opt : tagHtmlAttribs) { - //printf("option name=%s value=%s\n",opt.name.data(),opt.value.data()); + //printf("option name=%s value=%s\n",qPrint(opt.name),qPrint(opt.value)); if (opt.name=="src" && !opt.value.isEmpty()) { // copy attributes @@ -1779,7 +1779,7 @@ static int internalValidatingParseDoc(DocNode *parent,DocNodeList &children, if (doc.isEmpty()) return retval; - doctokenizerYYinit(doc,g_fileName,g_markdownSupport); + doctokenizerYYinit(doc.data(),g_fileName,g_markdownSupport); // first parse any number of paragraphs bool isFirst=TRUE; @@ -1817,7 +1817,7 @@ static int internalValidatingParseDoc(DocNode *parent,DocNodeList &children, static void readTextFileByName(const QCString &file,QCString &text) { - if (Portable::isAbsolutePath(file.data())) + if (Portable::isAbsolutePath(file)) { FileInfo fi(file.str()); if (fi.exists()) @@ -1829,7 +1829,7 @@ static void readTextFileByName(const QCString &file,QCString &text) const StringVector &examplePathList = Config_getList(EXAMPLE_PATH); for (const auto &s : examplePathList) { - std::string absFileName = s+Portable::pathSeparator()+file.str(); + std::string absFileName = s+(Portable::pathSeparator()+file).str(); FileInfo fi(absFileName); if (fi.exists()) { @@ -1865,7 +1865,7 @@ DocWord::DocWord(DocNode *parent,const QCString &word) : m_word(word) { m_parent = parent; - //printf("new word %s url=%s\n",word.data(),g_searchUrl.data()); + //printf("new word %s url=%s\n",qPrint(word),qPrint(g_searchUrl)); if (Doxygen::searchIndex && !g_searchUrl.isEmpty()) { Doxygen::searchIndex->addWord(word,FALSE); @@ -1883,7 +1883,7 @@ DocLinkedWord::DocLinkedWord(DocNode *parent,const QCString &word, { m_parent = parent; //printf("DocLinkedWord: new word %s url=%s tooltip='%s'\n", - // word.data(),g_searchUrl.data(),tooltip.data()); + // qPrint(word),qPrint(g_searchUrl),qPrint(tooltip)); if (Doxygen::searchIndex && !g_searchUrl.isEmpty()) { Doxygen::searchIndex->addWord(word,FALSE); @@ -1927,7 +1927,7 @@ DocAnchor::DocAnchor(DocNode *parent,const QCString &id,bool newAnchor) const SectionInfo *sec = SectionManager::instance().find(id); if (sec) { - //printf("Found anchor %s\n",id.data()); + //printf("Found anchor %s\n",qPrint(id)); m_file = sec->fileName(); m_anchor = sec->label(); } @@ -1974,7 +1974,7 @@ void DocInclude::parse() g_includeFileLength = m_text.length(); g_includeFileLine = 0; g_includeFileShowLineNo = (m_type == DontIncWithLines || m_type == IncWithLines); - //printf("g_includeFile=<<%s>>\n",g_includeFileText.data()); + //printf("g_includeFile=<<%s>>\n",qPrint(g_includeFileText)); break; case VerbInclude: // fall through @@ -1995,7 +1995,7 @@ void DocInclude::parse() if (!m_blockId.isEmpty() && (count=m_text.contains(m_blockId.data()))!=2) { warn_doc_error(g_fileName,getDoctokinizerLineNr(),"block marked with %s for \\snippet should appear twice in file %s, found it %d times\n", - m_blockId.data(),m_file.data(),count); + qPrint(m_blockId),qPrint(m_file),count); } break; case DocInclude::SnippetDoc: @@ -2018,11 +2018,11 @@ void DocIncOperator::parse() } m_includeFileName = g_includeFileName; - const char *p = g_includeFileText; + const char *p = g_includeFileText.data(); uint l = g_includeFileLength; uint o = g_includeFileOffset; int il = g_includeFileLine; - DBG(("DocIncOperator::parse() text=%s off=%d len=%d\n",qPrint(p),o,l)); + DBG(("DocIncOperator::parse() text=%s off=%d len=%d\n",p,o,l)); uint so = o,bo; bool nonEmpty = FALSE; switch(type()) @@ -2148,7 +2148,7 @@ void DocIncOperator::parse() //--------------------------------------------------------------------------- -DocXRefItem::DocXRefItem(DocNode *parent,int id,const char *key) : +DocXRefItem::DocXRefItem(DocNode *parent,int id,const QCString &key) : m_id(id), m_key(key), m_relPath(g_relPath) { m_parent = parent; @@ -2175,7 +2175,7 @@ bool DocXRefItem::parse() } m_title = refList->sectionTitle(); //printf("DocXRefItem: file=%s anchor=%s title=%s\n", - // m_file.data(),m_anchor.data(),m_title.data()); + // qPrint(m_file),qPrint(m_anchor),qPrint(m_title)); if (!item->text().isEmpty()) { @@ -2384,7 +2384,7 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) : m_parent = parent; const Definition *compound = 0; QCString anchor; - //printf("DocRef::DocRef(target=%s,context=%s)\n",target.data(),context.data()); + //printf("DocRef::DocRef(target=%s,context=%s)\n",qPrint(target),qPrint(context)); ASSERT(!target.isEmpty()); SrcLangExt lang = getLanguageFromFileName(target); m_relPath = g_relPath; @@ -2420,7 +2420,7 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) : m_isSubPage = pd && pd->hasParentPage(); if (sec->type()!=SectionType::Page || m_isSubPage) m_anchor = sec->label(); //printf("m_text=%s,m_ref=%s,m_file=%s,type=%d\n", - // m_text.data(),m_ref.data(),m_file.data(),m_refType); + // qPrint(m_text),qPrint(m_ref),qPrint(m_file),m_refType); return; } else if (resolveLink(context,target,TRUE,&compound,anchor)) @@ -2435,13 +2435,13 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) : { if (anchor.isEmpty() && /* compound link */ compound->definitionType()==Definition::TypeGroup && /* is group */ - (toGroupDef(compound))->groupTitle() /* with title */ + !toGroupDef(compound)->groupTitle().isEmpty() /* with title */ ) { m_text=(toGroupDef(compound))->groupTitle(); // use group's title as link } else if (compound->definitionType()==Definition::TypeMember && - (toMemberDef(compound))->isObjCMethod()) + toMemberDef(compound)->isObjCMethod()) { // Objective C Method const MemberDef *member = toMemberDef(compound); @@ -2451,12 +2451,12 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) : m_file = compound->getOutputFileBase(); m_ref = compound->getReference(); - //printf("isFile=%d compound=%s (%d)\n",isFile,compound->name().data(), + //printf("isFile=%d compound=%s (%d)\n",isFile,qPrint(compound->name()), // compound->definitionType()); return; } else if (compound && compound->definitionType()==Definition::TypeFile && - (toFileDef(compound))->generateSourceFile() + toFileDef(compound)->generateSourceFile() ) // undocumented file that has source code we can link to { m_file = compound->getSourceFileBase(); @@ -2536,12 +2536,12 @@ DocCite::DocCite(DocNode *parent,const QCString &target,const QCString &) //cont { size_t numBibFiles = Config_getList(CITE_BIB_FILES).size(); m_parent = parent; - //printf("DocCite::DocCite(target=%s)\n",target.data()); + //printf("DocCite::DocCite(target=%s)\n",qPrint(target)); ASSERT(!target.isEmpty()); m_relPath = g_relPath; const CitationManager &ct = CitationManager::instance(); const CiteInfo *cite = ct.find(target); - //printf("cite=%p text='%s' numBibFiles=%d\n",cite,cite?cite->text.data():"<null>",numBibFiles); + //printf("cite=%p text='%s' numBibFiles=%d\n",cite,cite?qPrint(cite->text):"<null>",numBibFiles); if (numBibFiles>0 && cite && !cite->text().isEmpty()) // ref to citation { m_text = cite->text(); @@ -2549,7 +2549,7 @@ DocCite::DocCite(DocNode *parent,const QCString &target,const QCString &) //cont m_anchor = ct.anchorPrefix()+cite->label(); m_file = convertNameToFile(ct.fileName(),FALSE,TRUE); //printf("CITE ==> m_text=%s,m_ref=%s,m_file=%s,m_anchor=%s\n", - // m_text.data(),m_ref.data(),m_file.data(),m_anchor.data()); + // qPrint(m_text),qPrint(m_ref),qPrint(m_file),qPrint(m_anchor)); return; } m_text = target; @@ -2582,8 +2582,7 @@ DocLink::DocLink(DocNode *parent,const QCString &target) { m_refText = m_refText.right(m_refText.length()-1); } - if (resolveLink(g_context,stripKnownExtensions(target),g_inSeeBlock, - &compound,anchor)) + if (resolveLink(g_context,stripKnownExtensions(target),g_inSeeBlock,&compound,anchor)) { m_anchor = anchor; if (compound && compound->isLinkable()) @@ -3189,7 +3188,7 @@ DocHtmlCaption::DocHtmlCaption(DocNode *parent,const HtmlAttribList &attribs) const SectionInfo *sec = SectionManager::instance().find(opt.value); if (sec) { - //printf("Found anchor %s\n",id.data()); + //printf("Found anchor %s\n",qPrint(id)); m_file = sec->fileName(); m_anchor = sec->label(); m_hasCaptionId = TRUE; @@ -4292,7 +4291,7 @@ int DocAutoList::parse() //printf("DocAutoList::parse(): retval=0x%x g_token->indent=%d m_indent=%d " // "m_isEnumList=%d g_token->isEnumList=%d g_token->name=%s\n", // retval,g_token->indent,m_indent,m_isEnumList,g_token->isEnumList, - // g_token->name.data()); + // qPrint(g_token->name)); //printf("num=%d g_token->id=%d\n",num,g_token->id); } while (retval==TK_LISTITEM && // new list item @@ -5243,7 +5242,7 @@ void DocPara::handleInheritDoc() if (reMd) // member from which was inherited. { const MemberDef *thisMd = g_memberDef; - //printf("{InheritDocs:%s=>%s}\n",g_memberDef->qualifiedName().data(),reMd->qualifiedName().data()); + //printf("{InheritDocs:%s=>%s}\n",qPrint(g_memberDef->qualifiedName()),qPrint(reMd->qualifiedName())); docParserPushContext(); g_scope=reMd->getOuterScope(); if (g_scope!=Doxygen::globalScope) @@ -5273,7 +5272,7 @@ int DocPara::handleCommand(const QCString &cmdName, const int tok) { case CMD_UNKNOWN: m_children.push_back(std::make_unique<DocWord>(this,TK_COMMAND_CHAR(tok) + cmdName)); - warn_doc_error(g_fileName,getDoctokinizerLineNr(),"Found unknown command '%c%s'",TK_COMMAND_CHAR(tok),qPrint(cmdName)); + warn_doc_error(g_fileName,getDoctokinizerLineNr(),"Found unknown command '%s%s'",TK_COMMAND_CHAR(tok),qPrint(cmdName)); break; case CMD_EMPHASIS: m_children.push_back(std::make_unique<DocStyleChange>(this,(uint)g_nodeStack.size(),DocStyleChange::Italic,cmdName,TRUE)); @@ -5796,7 +5795,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta tagId!=HTML_UNKNOWN && tagId!=HTML_IMG && tagId!=HTML_BR && tagId!=HTML_HR && tagId!=HTML_P) { warn_doc_error(g_fileName,getDoctokinizerLineNr(),"HTML tag ('<%s/>') may not use the 'empty tag' XHTML syntax.", - tagName.data()); + qPrint(tagName)); } switch (tagId) { @@ -6022,7 +6021,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta QCString paramName; if (findAttribute(tagHtmlAttribs,"name",¶mName)) { - //printf("paramName=%s\n",paramName.data()); + //printf("paramName=%s\n",qPrint(paramName)); m_children.push_back(std::make_unique<DocStyleChange>(this,(uint)g_nodeStack.size(),DocStyleChange::Italic,tagName,TRUE)); m_children.push_back(std::make_unique<DocWord>(this,paramName)); m_children.push_back(std::make_unique<DocStyleChange>(this,(uint)g_nodeStack.size(),DocStyleChange::Italic,tagName,FALSE)); @@ -6577,7 +6576,7 @@ reparsetoken: { // simple section cannot start in this paragraph, need // to unwind the stack and remember the command. - g_token->simpleSectName = g_token->name.copy(); + g_token->simpleSectName = g_token->name; retval=RetVal_SimpleSec; goto endparagraph; } @@ -7167,10 +7166,8 @@ static QCString extractCopyDocId(const char *data, uint &j, uint len) j+=9; } e=j; - QCString id(e-s+1); - if (e>s) memcpy(id.rawData(),data+s,e-s); - id.at(e-s)='\0'; - //printf("extractCopyDocId='%s' input='%s'\n",id.data(),&data[s]); + QCString id(data+s,e-s); + //printf("extractCopyDocId='%s' input='%s'\n",qPrint(id),&data[s]); return id; } @@ -7210,7 +7207,7 @@ static uint isVerbatimSection(const char *data,uint i,uint len,QCString &endMark CHECK_FOR_COMMAND("docbookonly",endMarker="enddocbookonly"); CHECK_FOR_COMMAND("startuml",endMarker="enduml"); } - //printf("isVerbatimSection(%s)=%d)\n",QCString(&data[i]).left(10).data(),j); + //printf("isVerbatimSection(%s)=%d)\n",qPrint(QCString(&data[i]).left(10)),j); return j; } @@ -7221,7 +7218,7 @@ static uint skipToEndMarker(const char *data,uint i,uint len,const QCString &end if ((data[i]=='@' || data[i]=='\\') && // start of command character (i==0 || (data[i-1]!='@' && data[i-1]!='\\'))) // that is not escaped { - if (i+endMarker.length()+1<=len && qstrncmp(data+i+1,endMarker,endMarker.length())==0) + if (i+endMarker.length()+1<=len && qstrncmp(data+i+1,endMarker.data(),endMarker.length())==0) { return i+endMarker.length()+1; } @@ -7252,10 +7249,10 @@ static QCString processCopyDoc(const char *data,uint &len) QCString id = extractCopyDocId(data,j,len); const Definition *def = 0; QCString doc,brief; - //printf("resolving docs='%s'\n",id.data()); + //printf("resolving docs='%s'\n",qPrint(id)); if (findDocsForMemberOrCompound(id,&doc,&brief,&def)) { - //printf("found it def=%p brief='%s' doc='%s' isBrief=%d\n",def,brief.data(),doc.data(),isBrief); + //printf("found it def=%p brief='%s' doc='%s' isBrief=%d\n",def,qPrint(brief),qPrint(doc),isBrief); auto it = std::find(g_copyStack.begin(),g_copyStack.end(),def); if (it==g_copyStack.end()) // definition not parsed earlier { @@ -7263,12 +7260,12 @@ static QCString processCopyDoc(const char *data,uint &len) if (isBrief) { uint l=brief.length(); - buf.addStr(processCopyDoc(brief,l)); + buf.addStr(processCopyDoc(brief.data(),l)); } else { uint l=doc.length(); - buf.addStr(processCopyDoc(doc,l)); + buf.addStr(processCopyDoc(doc.data(),l)); } g_copyStack.pop_back(); } @@ -7276,14 +7273,14 @@ static QCString processCopyDoc(const char *data,uint &len) { warn_doc_error(g_fileName,getDoctokinizerLineNr(), "Found recursive @copy%s or @copydoc relation for argument '%s'.\n", - isBrief?"brief":"details",id.data()); + isBrief?"brief":"details",qPrint(id)); } } else { warn_doc_error(g_fileName,getDoctokinizerLineNr(), "@copy%s or @copydoc target '%s' not found", isBrief?"brief":"details", - id.data()); + qPrint(id)); } // skip over command i=j; @@ -7318,15 +7315,15 @@ static QCString processCopyDoc(const char *data,uint &len) //--------------------------------------------------------------------------- -DocRoot *validatingParseDoc(const char *fileName,int startLine, +DocRoot *validatingParseDoc(const QCString &fileName,int startLine, const Definition *ctx,const MemberDef *md, - const char *input,bool indexWords, - bool isExample, const char *exampleName, + const QCString &input,bool indexWords, + bool isExample, const QCString &exampleName, bool singleLine, bool linkFromIndex, bool markdownSupport) { - //printf("validatingParseDoc(%s,%s)=[%s]\n",ctx?ctx->name().data():"<none>", - // md?md->name().data():"<none>", + //printf("validatingParseDoc(%s,%s)=[%s]\n",ctx?qPrint(ctx->name()):"<none>", + // md?qPrint(md->name()):"<none>", // input); //printf("========== validating %s at line %d\n",fileName,startLine); //printf("---------------- input --------------------\n%s\n----------- end input -------------------\n",input); @@ -7461,7 +7458,7 @@ DocRoot *validatingParseDoc(const char *fileName,int startLine, g_relPath = (!linkFromIndex && ctx) ? QCString(relativePathToRoot(ctx->getOutputFileBase())) : QCString(""); - //printf("ctx->name=%s relPath=%s\n",ctx->name().data(),g_relPath.data()); + //printf("ctx->name=%s relPath=%s\n",qPrint(ctx->name()),qPrint(g_relPath)); g_memberDef = md; while (!g_nodeStack.empty()) g_nodeStack.pop(); while (!g_styleStack.empty()) g_styleStack.pop(); @@ -7480,16 +7477,16 @@ DocRoot *validatingParseDoc(const char *fileName,int startLine, g_paramsFound.clear(); g_markdownSupport = markdownSupport; - //printf("Starting comment block at %s:%d\n",g_fileName.data(),startLine); + //printf("Starting comment block at %s:%d\n",qPrint(g_fileName),startLine); setDoctokinizerLineNr(startLine); - uint inpLen=qstrlen(input); - QCString inpStr = processCopyDoc(input,inpLen); + uint ioLen = input.length(); + QCString inpStr = processCopyDoc(input.data(),ioLen); if (inpStr.isEmpty() || inpStr.at(inpStr.length()-1)!='\n') { inpStr+='\n'; } - //printf("processCopyDoc(in='%s' out='%s')\n",input,inpStr.data()); - doctokenizerYYinit(inpStr,g_fileName,markdownSupport); + //printf("processCopyDoc(in='%s' out='%s')\n",input,qPrint(inpStr)); + doctokenizerYYinit(inpStr.data(),g_fileName,markdownSupport); // build abstract syntax tree DocRoot *root = new DocRoot(md!=0,singleLine); @@ -7515,13 +7512,13 @@ DocRoot *validatingParseDoc(const char *fileName,int startLine, // restore original parser state docParserPopContext(); - //printf(">>>>>> end validatingParseDoc(%s,%s)\n",ctx?ctx->name().data():"<none>", - // md?md->name().data():"<none>"); + //printf(">>>>>> end validatingParseDoc(%s,%s)\n",ctx?qPrint(ctx->name()):"<none>", + // md?qPrint(md->name()):"<none>"); return root; } -DocText *validatingParseText(const char *input) +DocText *validatingParseText(const QCString &input) { // store parser state so we can re-enter this function if needed docParserPushContext(); @@ -7552,10 +7549,10 @@ DocText *validatingParseText(const char *input) DocText *txt = new DocText; - if (input) + if (!input.isEmpty()) { setDoctokinizerLineNr(1); - doctokenizerYYinit(input,g_fileName,Config_getBool(MARKDOWN_SUPPORT)); + doctokenizerYYinit(input.data(),g_fileName,Config_getBool(MARKDOWN_SUPPORT)); // build abstract syntax tree txt->parse(); @@ -7574,9 +7571,9 @@ DocText *validatingParseText(const char *input) return txt; } -void docFindSections(const char *input, +void docFindSections(const QCString &input, const Definition *d, - const char *fileName) + const QCString &fileName) { doctokenizerYYFindSections(input,d,fileName); } diff --git a/src/docparser.h b/src/docparser.h index a510b32..3de54bd 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -56,22 +56,22 @@ class MemberGroup; * @returns Root node of the abstract syntax tree. Ownership of the * pointer is handed over to the caller. */ -DocRoot *validatingParseDoc(const char *fileName,int startLine, +DocRoot *validatingParseDoc(const QCString &fileName,int startLine, const Definition *context, const MemberDef *md, - const char *input,bool indexWords, - bool isExample,const char *exampleName, + const QCString &input,bool indexWords, + bool isExample,const QCString &exampleName, bool singleLine,bool linkFromIndex, bool markdownSupport); /*! Main entry point for parsing simple text fragments. These * fragments are limited to words, whitespace and symbols. */ -DocText *validatingParseText(const char *input); +DocText *validatingParseText(const QCString &input); /*! Searches for section and anchor commands in the input */ -void docFindSections(const char *input, +void docFindSections(const QCString &input, const Definition *d, - const char *fileName); + const QCString &fileName); //--------------------------------------------------------------------------- @@ -536,9 +536,9 @@ class DocInclude : public DocNode IncWithLines, Snippet , IncludeDoc, SnippetDoc, SnipWithLines, DontIncWithLines, RtfInclude, ManInclude, DocbookInclude, XmlInclude}; DocInclude(DocNode *parent,const QCString &file, - const QCString context, Type t, - bool isExample,const QCString exampleFile, - const QCString blockId, bool isBlock) : + const QCString &context, Type t, + bool isExample,const QCString &exampleFile, + const QCString &blockId, bool isBlock) : m_file(file), m_context(context), m_type(t), m_isExample(isExample), m_isBlock(isBlock), m_exampleFile(exampleFile), m_blockId(blockId) { m_parent = parent; } @@ -548,7 +548,7 @@ class DocInclude : public DocNode if (i!=-1) return m_file.right(m_file.length()-(uint)i); else - return ""; + return QCString(); } Type type() const { return m_type; } QCString text() const { return m_text; } @@ -714,7 +714,7 @@ class DocTitle : public CompAccept<DocTitle> class DocXRefItem : public CompAccept<DocXRefItem> { public: - DocXRefItem(DocNode *parent,int id,const char *key); + DocXRefItem(DocNode *parent,int id,const QCString &key); Kind kind() const { return Kind_XRefItem; } QCString file() const { return m_file; } QCString anchor() const { return m_anchor; } diff --git a/src/docsets.cpp b/src/docsets.cpp index 6040277..bf589c4 100644 --- a/src/docsets.cpp +++ b/src/docsets.cpp @@ -27,12 +27,15 @@ #include "memberdef.h" #include "namespacedef.h" #include "util.h" +#include "textstream.h" struct DocSets::Private { QCString indent(); - std::ofstream nts; - std::ofstream tts; + std::ofstream ntf; + TextStream nts; + std::ofstream ttf; + TextStream tts; std::stack<bool> indentStack; std::set<std::string> scopes; }; @@ -68,7 +71,7 @@ void DocSets::initialize() std::ofstream ts(mfName.str(),std::ofstream::out | std::ofstream::binary); if (!ts.is_open()) { - term("Could not open file %s for writing\n",mfName.data()); + term("Could not open file %s for writing\n",qPrint(mfName)); } ts << "DOCSET_NAME=" << bundleId << ".docset\n" @@ -117,7 +120,7 @@ void DocSets::initialize() std::ofstream ts(plName.str(),std::ofstream::out | std::ofstream::binary); if (!ts.is_open()) { - term("Could not open file %s for writing\n",plName.data()); + term("Could not open file %s for writing\n",qPrint(plName)); } ts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" @@ -148,11 +151,12 @@ void DocSets::initialize() // -- start Nodes.xml QCString notes = Config_getString(HTML_OUTPUT) + "/Nodes.xml"; - p->nts.open(notes.str(),std::ofstream::out | std::ofstream::binary); - if (!p->nts.is_open()) + p->ntf.open(notes.str(),std::ofstream::out | std::ofstream::binary); + if (!p->ntf.is_open()) { - term("Could not open file %s for writing\n",notes.data()); + term("Could not open file %s for writing\n",qPrint(notes)); } + p->nts.setStream(&p->ntf); //QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index"; QCString indexName="index"; p->nts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; @@ -165,11 +169,12 @@ void DocSets::initialize() p->indentStack.push(true); QCString tokens = Config_getString(HTML_OUTPUT) + "/Tokens.xml"; - p->tts.open(tokens.str(),std::ofstream::out | std::ofstream::binary); - if (!p->tts.is_open()) + p->ttf.open(tokens.str(),std::ofstream::out | std::ofstream::binary); + if (!p->ttf.is_open()) { - term("Could not open file %s for writing\n",tokens.data()); + term("Could not open file %s for writing\n",qPrint(tokens)); } + p->tts.setStream(&p->ttf); p->tts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; p->tts << "<Tokens version=\"1.0\">\n"; } @@ -185,10 +190,12 @@ void DocSets::finalize() p->nts << " </Node>\n"; p->nts << " </TOC>\n"; p->nts << "</DocSetNodes>\n"; - p->nts.close(); + p->nts.flush(); + p->ntf.close(); p->tts << "</Tokens>\n"; - p->tts.close(); + p->tts.flush(); + p->ttf.close(); } QCString DocSets::Private::indent() @@ -217,10 +224,10 @@ void DocSets::decContentsDepth() } void DocSets::addContentsItem(bool isDir, - const char *name, - const char *ref, - const char *file, - const char *anchor, + const QCString &name, + const QCString &ref, + const QCString &file, + const QCString &anchor, bool /* separateIndex */, bool /* addToNavIndex */, const Definition * /*def*/) @@ -236,7 +243,7 @@ void DocSets::addContentsItem(bool isDir, p->indentStack.top()=false; p->nts << p->indent() << " <Node>\n"; p->nts << p->indent() << " <Name>" << convertToXML(name) << "</Name>\n"; - if (file && file[0]=='^') // URL marker + if (!file.isEmpty() && file[0]=='^') // URL marker { p->nts << p->indent() << " <URL>" << convertToXML(&file[1]) << "</URL>\n"; @@ -244,16 +251,16 @@ void DocSets::addContentsItem(bool isDir, else // relative file { p->nts << p->indent() << " <Path>"; - if (file && file[0]=='!') // user specified file + if (!file.isEmpty() && file[0]=='!') // user specified file { p->nts << convertToXML(&file[1]); } - else if (file) // doxygen generated file + else if (!file.isEmpty()) // doxygen generated file { p->nts << file << Doxygen::htmlFileExtension; } p->nts << "</Path>\n"; - if (file && anchor) + if (!file.isEmpty() && !anchor.isEmpty()) { p->nts << p->indent() << " <Anchor>" << anchor << "</Anchor>\n"; } @@ -262,7 +269,7 @@ void DocSets::addContentsItem(bool isDir, } void DocSets::addIndexItem(const Definition *context,const MemberDef *md, - const char *,const char *) + const QCString &,const QCString &) { if (md==0 && context==0) return; @@ -470,19 +477,19 @@ void DocSets::addIndexItem(const Definition *context,const MemberDef *md, } if (p->scopes.find(context->getOutputFileBase().str())==p->scopes.end()) { - writeToken(p->tts,context,type,lang,scope,0,decl); + writeToken(p->tts,context,type,lang,scope,QCString(),decl); p->scopes.insert(context->getOutputFileBase().str()); } } } -void DocSets::writeToken(std::ostream &t, +void DocSets::writeToken(TextStream &t, const Definition *d, const QCString &type, const QCString &lang, - const char *scope, - const char *anchor, - const char *decl) + const QCString &scope, + const QCString &anchor, + const QCString &decl) { t << " <Token>\n"; t << " <TokenIdentifier>\n"; @@ -497,14 +504,14 @@ void DocSets::writeToken(std::ostream &t, { t << " <Type>" << type << "</Type>\n"; } - if (scope) + if (!scope.isEmpty()) { t << " <Scope>" << convertToXML(scope) << "</Scope>\n"; } t << " </TokenIdentifier>\n"; t << " <Path>" << d->getOutputFileBase() << Doxygen::htmlFileExtension << "</Path>\n"; - if (anchor) + if (!anchor.isEmpty()) { t << " <Anchor>" << anchor << "</Anchor>\n"; } @@ -513,14 +520,14 @@ void DocSets::writeToken(std::ostream &t, { t << " <Abstract>" << convertToXML(tooltip) << "</Abstract>\n"; } - if (decl) + if (!decl.isEmpty()) { t << " <DeclaredIn>" << convertToXML(decl) << "</DeclaredIn>\n"; } t << " </Token>\n"; } -void DocSets::addIndexFile(const char *name) +void DocSets::addIndexFile(const QCString &name) { (void)name; } diff --git a/src/docsets.h b/src/docsets.h index 2bdf7ac..03146f1 100644 --- a/src/docsets.h +++ b/src/docsets.h @@ -17,10 +17,11 @@ #define DOCSETS_H #include <memory> -#include <iostream> #include "index.h" +class TextStream; + class Definition; /** A class that generates docset files. @@ -39,25 +40,25 @@ class DocSets : public IndexIntf void incContentsDepth(); void decContentsDepth(); void addContentsItem(bool isDir, - const char *name, - const char *ref, - const char *file, - const char *anchor, + const QCString &name, + const QCString &ref, + const QCString &file, + const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def ); void addIndexItem(const Definition *context,const MemberDef *md, - const char *sectionAnchor,const char *title); - void addIndexFile(const char *name); - void addImageFile(const char *) {} - void addStyleSheetFile(const char *) {} + const QCString §ionAnchor,const QCString &title); + void addIndexFile(const QCString &name); + void addImageFile(const QCString &) {} + void addStyleSheetFile(const QCString &) {} private: - void writeToken(std::ostream &t, const Definition *d, + void writeToken(TextStream &t, const Definition *d, const QCString &type, const QCString &lang, - const char *scope=0, const char *anchor=0, - const char *decl=0); + const QCString &scope=QCString(), const QCString &anchor=QCString(), + const QCString &decl=QCString()); struct Private; std::unique_ptr<Private> p; diff --git a/src/doctokenizer.h b/src/doctokenizer.h index 80d757f..02dbecd 100644 --- a/src/doctokenizer.h +++ b/src/doctokenizer.h @@ -124,9 +124,9 @@ void setDoctokinizerLineNr(int lineno); int getDoctokinizerLineNr(void); // operations on the scanner -void doctokenizerYYFindSections(const char *input,const Definition *d, - const char *fileName); -void doctokenizerYYinit(const char *input,const char *fileName,bool markdownSupport); +void doctokenizerYYFindSections(const QCString &input,const Definition *d, + const QCString &fileName); +void doctokenizerYYinit(const char *input,const QCString &fileName,bool markdownSupport); void doctokenizerYYcleanup(); void doctokenizerYYpushContext(); bool doctokenizerYYpopContext(); @@ -157,7 +157,7 @@ void doctokenizerYYsetStateText(); void doctokenizerYYsetStateSkipTitle(); void doctokenizerYYsetStateAnchor(); void doctokenizerYYsetInsidePre(bool b); -void doctokenizerYYpushBackHtmlTag(const char *tag); +void doctokenizerYYpushBackHtmlTag(const QCString &tag); void doctokenizerYYsetStateSnippet(); void doctokenizerYYstartAutoList(); void doctokenizerYYendAutoList(); diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 5debd5f..bfbc345 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -27,6 +27,7 @@ #include <ctype.h> #include <stack> #include <string> +#include <cassert> #include "doctokenizer.h" #include "cmdmapper.h" @@ -115,12 +116,12 @@ bool doctokenizerYYpopContext() QCString extractPartAfterNewLine(const QCString &text) { - int nl1 = text.findRev('\n'); - if (nl1!=-1) + int nl1 = text.find('\n'); + int nl2 = text.find("\\ilinebr"); + if (nl1!=-1 && nl1<nl2) { return text.mid(nl1+1); } - int nl2 = text.findRev("\\ilinebr"); if (nl2!=-1) { if (text.at(nl2+8)==' ') nl2++; // skip space after \\ilinebr @@ -152,9 +153,10 @@ const char *tokToString(int token) return "ERROR"; } -static int computeIndent(const char *str,int length) +static int computeIndent(const char *str,size_t length) { - int i; + if (str==0 || length==std::string::npos) return 0; + size_t i; int indent=0; static int tabSize=Config_getInt(TAB_SIZE); for (i=0;i<length;i++) @@ -179,7 +181,7 @@ static int computeIndent(const char *str,int length) static void processSection() { - //printf("%s: found section/anchor with name '%s'\n",g_fileName.data(),g_secLabel.data()); + //printf("%s: found section/anchor with name '%s'\n",qPrint(g_fileName),qPrint(g_secLabel)); QCString file; if (g_definition) { @@ -187,7 +189,7 @@ static void processSection() } else { - warn(g_fileName,g_yyLineNr,"Found section/anchor %s without context\n",g_secLabel.data()); + warn(g_fileName,g_yyLineNr,"Found section/anchor %s without context\n",qPrint(g_secLabel)); } SectionInfo *si = SectionManager::instance().find(g_secLabel); if (si) @@ -199,7 +201,7 @@ static void processSection() static void handleHtmlTag() { - QCString tagText=yytext; + QCString tagText(yytext); g_token->attribs.clear(); g_token->endTag = FALSE; g_token->emptyTag = FALSE; @@ -291,7 +293,7 @@ static void handleHtmlTag() { } //printf("=====> Adding option name=<%s> value=<%s>\n", - // opt.name.data(),opt.value.data()); + // qPrint(opt.name),qPrint(opt.value)); g_token->attribs.push_back(opt); } g_token->attribsStr = tagText.mid(startAttribList,i-startAttribList); @@ -497,8 +499,9 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio <St_Para>\r /* skip carriage return */ <St_Para>^{LISTITEM} { /* list item */ lineCount(yytext,yyleng); - QCString text=yytext; - int dashPos = text.findRev('-'); + QCString text(yytext); + size_t dashPos = static_cast<size_t>(text.findRev('-')); + assert(dashPos!=std::string::npos); g_token->isEnumList = text.at(dashPos+1)=='#'; g_token->id = -1; g_token->indent = computeIndent(yytext,dashPos); @@ -512,11 +515,12 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio else { lineCount(yytext,yyleng); - std::string text=yytext; + std::string text(yytext); static const reg::Ex re(R"([*+][^*+]*$)"); // find last + or * reg::Match match; reg::search(text,match,re); size_t listPos = match.position(); + assert(listPos!=std::string::npos); g_token->isEnumList = FALSE; g_token->id = -1; g_token->indent = computeIndent(yytext,listPos); @@ -530,23 +534,26 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio } else { - std::string text=yytext; + std::string text(yytext); static const reg::Ex re(R"(\d+)"); reg::Match match; reg::search(text,match,re); + size_t markPos = match.position(); + assert(markPos!=std::string::npos); g_token->isEnumList = true; g_token->id = std::stoul(match.str()); - g_token->indent = computeIndent(yytext,match.position()); + g_token->indent = computeIndent(yytext,markPos); return TK_LISTITEM; } } <St_Para>{BLANK}*(\n|"\\ilinebr"){LISTITEM} { /* list item on next line */ lineCount(yytext,yyleng); - QCString text=extractPartAfterNewLine(yytext); - int dashPos = text.findRev('-'); + QCString text=extractPartAfterNewLine(QCString(yytext)); + size_t dashPos = static_cast<size_t>(text.findRev('-')); + assert(dashPos!=std::string::npos); g_token->isEnumList = text.at(dashPos+1)=='#'; g_token->id = -1; - g_token->indent = computeIndent(text,dashPos); + g_token->indent = computeIndent(text.data(),dashPos); return TK_LISTITEM; } <St_Para>{BLANK}*(\n|"\\ilinebr"){MLISTITEM} { /* list item on next line */ @@ -557,11 +564,12 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio else { lineCount(yytext,yyleng); - std::string text=extractPartAfterNewLine(yytext).str(); + std::string text=extractPartAfterNewLine(QCString(yytext)).str(); static const reg::Ex re(R"([*+][^*+]*$)"); // find last + or * reg::Match match; reg::search(text,match,re); size_t markPos = match.position(); + assert(markPos!=std::string::npos); g_token->isEnumList = FALSE; g_token->id = -1; g_token->indent = computeIndent(text.c_str(),markPos); @@ -576,30 +584,33 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio else { lineCount(yytext,yyleng); - std::string text=extractPartAfterNewLine(yytext).str(); + std::string text=extractPartAfterNewLine(QCString(yytext)).str(); static const reg::Ex re(R"(\d+)"); reg::Match match; reg::search(text,match,re); + size_t markPos = match.position(); + assert(markPos!=std::string::npos); g_token->isEnumList = true; g_token->id = std::stoul(match.str()); - g_token->indent = computeIndent(text.c_str(),match.position()); + g_token->indent = computeIndent(text.c_str(),markPos); return TK_LISTITEM; } } <St_Para>^{ENDLIST} { /* end list */ lineCount(yytext,yyleng); int dotPos = QCString(yytext).findRev('.'); + assert(dotPos!=-1); g_token->indent = computeIndent(yytext,dotPos); return TK_ENDLIST; } <St_Para>{BLANK}*(\n|"\\ilinebr"){ENDLIST} { /* end list on next line */ lineCount(yytext,yyleng); - QCString text=extractPartAfterNewLine(yytext); + QCString text=extractPartAfterNewLine(QCString(yytext)); int dotPos = text.findRev('.'); - g_token->indent = computeIndent(text,dotPos); + g_token->indent = computeIndent(text.data(),dotPos); return TK_ENDLIST; } -<St_Para>"{"{BLANK}*"@link"/{BLANK}+ { +<St_Para>"{"{BLANK}*"@link"/{WS}+ { g_token->name = "javalink"; return TK_COMMAND_AT; } @@ -712,7 +723,7 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio } <St_Para,St_HtmlOnly,St_ManOnly,St_LatexOnly,St_RtfOnly,St_XmlOnly,St_DbOnly>"$("{ID}")" | /* environment variable */ <St_Para,St_HtmlOnly,St_ManOnly,St_LatexOnly,St_RtfOnly,St_XmlOnly,St_DbOnly>"$("{ID}"("{ID}"))" { /* environment variable */ - QCString name = &yytext[2]; + QCString name(&yytext[2]); name = name.left(name.length()-1); QCString value = Portable::getenv(name); for (int i=value.length()-1;i>=0;i--) unput(value.at(i)); @@ -820,7 +831,7 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio } else { - g_token->indent=computeIndent(yytext,(int)yyleng); + g_token->indent=computeIndent(yytext,yyleng); int i; // put back the indentation (needed for list items) for (i=0;i<g_token->indent;i++) @@ -1228,7 +1239,7 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio BEGIN(St_XRefItem2); } <St_XRefItem2>[0-9]+"." { - QCString numStr=yytext; + QCString numStr(yytext); numStr=numStr.left((int)yyleng-1); g_token->id=numStr.toInt(); return RetVal_OK; @@ -1244,7 +1255,7 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio } <St_Param>({PHPTYPE}{BLANK}*("["{BLANK}*"]")*{BLANK}*"|"{BLANK}*)*{PHPTYPE}{BLANK}*("["{BLANK}*"]")*{WS}+("&")?"$"{LABELID} { lineCount(yytext,yyleng); - QCString params = yytext; + QCString params(yytext); int j = params.find('&'); int i = params.find('$'); if (j<i && j!=-1) i=j; @@ -1295,7 +1306,7 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio return TK_WORD; } <St_File>"\""[^\n\"]+"\"" { - QCString text=yytext; + QCString text(yytext); g_token->name = text.mid(1,text.length()-2); return TK_WORD; } @@ -1338,7 +1349,7 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio <St_Sections>{CMD}("<"|{CMD}) <St_Sections>"<"{CAPTION}({WS}+{ATTRIB})*">" { lineCount(yytext,yyleng); - QCString tag=yytext; + QCString tag(yytext); int s=tag.find("id="); if (s!=-1) // command has id attribute { @@ -1424,13 +1435,13 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio BEGIN(St_SecSkip); } <St_SecSkip>{CMD}{ID} { - if (qstrcmp(yytext+1,g_endMarker)==0) + if (g_endMarker==yytext+1) { BEGIN(St_Sections); } } <St_SecSkip>"-->" { - if (qstrcmp(yytext,g_endMarker)==0) + if (g_endMarker==yytext) { BEGIN(St_Sections); } @@ -1499,12 +1510,12 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio //-------------------------------------------------------------------------- -void doctokenizerYYFindSections(const char *input,const Definition *d, - const char *fileName) +void doctokenizerYYFindSections(const QCString &input,const Definition *d, + const QCString &fileName) { - if (input==0) return; - printlex(yy_flex_debug, TRUE, __FILE__, fileName); - g_inputString = input; + if (input.isEmpty()) return; + printlex(yy_flex_debug, TRUE, __FILE__, qPrint(fileName)); + g_inputString = input.data(); //printf("parsing --->'%s'<---\n",input); g_inputPos = 0; g_definition = d; @@ -1512,10 +1523,10 @@ void doctokenizerYYFindSections(const char *input,const Definition *d, BEGIN(St_Sections); g_yyLineNr = 1; doctokenizerYYlex(); - printlex(yy_flex_debug, FALSE, __FILE__, fileName); + printlex(yy_flex_debug, FALSE, __FILE__, qPrint(fileName)); } -void doctokenizerYYinit(const char *input,const char *fileName,bool markdownSupport) +void doctokenizerYYinit(const char *input,const QCString &fileName,bool markdownSupport) { g_autoListLevel = 0; g_inputString = input; @@ -1718,7 +1729,7 @@ void doctokenizerYYsetInsidePre(bool b) g_insidePre = b; } -void doctokenizerYYpushBackHtmlTag(const char *tag) +void doctokenizerYYpushBackHtmlTag(const QCString &tag) { QCString tagName = tag; int i,l = tagName.length(); diff --git a/src/docvisitor.cpp b/src/docvisitor.cpp index 5356faf..506c9f8 100644 --- a/src/docvisitor.cpp +++ b/src/docvisitor.cpp @@ -38,9 +38,9 @@ DocVisitor::~DocVisitor() { } -CodeParserInterface &DocVisitor::getCodeParser(const char *extension) +CodeParserInterface &DocVisitor::getCodeParser(const QCString &extension) { - std::string ext(extension?extension:""); + std::string ext = extension.str(); // for each extension we create a code parser once per visitor, so that // the context of the same parser object is reused throughout multiple passes for instance // for code fragments shown via dontinclude. diff --git a/src/docvisitor.h b/src/docvisitor.h index baf5bef..b19e76e 100644 --- a/src/docvisitor.h +++ b/src/docvisitor.h @@ -18,6 +18,8 @@ #include <memory> +#include "qcstring.h" + // ids const int DocVisitor_Html = 0; const int DocVisitor_Latex = 1; @@ -95,7 +97,7 @@ class DocVisitor DocVisitor(int id); virtual ~DocVisitor(); int id() const; - CodeParserInterface &getCodeParser(const char *langExt); + CodeParserInterface &getCodeParser(const QCString &langExt); void pushHidden(bool hide); bool popHidden(); diff --git a/src/dot.cpp b/src/dot.cpp index 2ffe9c2..8aa30b7 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -36,17 +36,16 @@ static QCString g_dotFontPath; -static void setDotFontPath(const char *path) +static void setDotFontPath(const QCString &path) { ASSERT(g_dotFontPath.isEmpty()); g_dotFontPath = Portable::getenv("DOTFONTPATH"); QCString newFontPath = Config_getString(DOT_FONTPATH); - QCString spath = path; - if (!newFontPath.isEmpty() && !spath.isEmpty()) + if (!newFontPath.isEmpty() && !path.isEmpty()) { - newFontPath.prepend(spath+Portable::pathListSeparator()); + newFontPath.prepend(path+Portable::pathListSeparator()); } - else if (newFontPath.isEmpty() && !spath.isEmpty()) + else if (newFontPath.isEmpty() && !path.isEmpty()) { newFontPath=path; } @@ -118,22 +117,22 @@ DotManager::~DotManager() delete m_queue; } -DotRunner* DotManager::createRunner(const std::string &absDotName, const std::string& md5Hash) +DotRunner* DotManager::createRunner(const QCString &absDotName, const QCString& md5Hash) { DotRunner* rv = nullptr; - auto const runit = m_runners.find(absDotName); + auto const runit = m_runners.find(absDotName.str()); if (runit == m_runners.end()) { auto insobj = std::make_unique<DotRunner>(absDotName, md5Hash); rv = insobj.get(); - m_runners.emplace(absDotName, std::move(insobj)); + m_runners.emplace(absDotName.str(), std::move(insobj)); } else { // we have a match if (md5Hash != runit->second->getMd5Hash()) { - err("md5 hash does not match for two different runs of %s !\n", absDotName.data()); + err("md5 hash does not match for two different runs of %s !\n", qPrint(absDotName)); } rv = runit->second.get(); } @@ -141,13 +140,13 @@ DotRunner* DotManager::createRunner(const std::string &absDotName, const std::st return rv; } -DotFilePatcher *DotManager::createFilePatcher(const std::string &fileName) +DotFilePatcher *DotManager::createFilePatcher(const QCString &fileName) { - auto patcher = m_filePatchers.find(fileName); + auto patcher = m_filePatchers.find(fileName.str()); if (patcher != m_filePatchers.end()) return &(patcher->second); - auto rv = m_filePatchers.emplace(fileName, fileName.c_str()); + auto rv = m_filePatchers.emplace(fileName.str(), fileName.data()); assert(rv.second); return &(rv.first->second); } @@ -270,13 +269,13 @@ bool DotManager::run() const //-------------------------------------------------------------------- -void writeDotGraphFromFile(const char *inFile,const char *outDir, - const char *outFile,GraphOutputFormat format) +void writeDotGraphFromFile(const QCString &inFile,const QCString &outDir, + const QCString &outFile,GraphOutputFormat format) { - Dir d(outDir); + Dir d(outDir.str()); if (!d.exists()) { - term("Output dir %s does not exist!\n",outDir); + term("Output dir %s does not exist!\n",qPrint(outDir)); } QCString imgExt = getDotImageExtension(); @@ -320,7 +319,7 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir, * \param context the scope in which this graph is found (for resolving links) * \param graphId a unique id for this graph, use for dynamic sections */ -void writeDotImageMapFromFile(std::ostream &t, +void writeDotImageMapFromFile(TextStream &t, const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, const QCString &context,int graphId) @@ -329,7 +328,7 @@ void writeDotImageMapFromFile(std::ostream &t, Dir d(outDir.str()); if (!d.exists()) { - term("Output dir %s does not exist!\n",outDir.data()); + term("Output dir %s does not exist!\n",qPrint(outDir)); } QCString mapName = baseName+".map"; @@ -337,7 +336,7 @@ void writeDotImageMapFromFile(std::ostream &t, QCString imgName = baseName+"."+imgExt; QCString absOutFile = QCString(d.absPath())+"/"+mapName; - DotRunner dotRun(inFile.data()); + DotRunner dotRun(inFile); dotRun.addJob(MAP_CMD,absOutFile); dotRun.preventCleanUp(); if (!dotRun.run()) @@ -355,11 +354,11 @@ void writeDotImageMapFromFile(std::ostream &t, } else // bitmap graphics { - std::ostringstream tt(std::ios_base::ate); + TextStream tt; t << "<img src=\"" << relPath << imgName << "\" alt=\"" << imgName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>\n"; DotFilePatcher::convertMapFile(tt, absOutFile, relPath ,TRUE, context); - if (tt.tellp()>0) + if (!tt.empty()) { t << "<map name=\"" << mapName << "\" id=\"" << mapName << "\">"; t << tt.str(); @@ -25,6 +25,7 @@ class DotRunner; class DotRunnerQueue; +class TextStream; /** Singleton that manages parallel dot invocations and patching files for embedding image maps */ class DotManager @@ -32,8 +33,8 @@ class DotManager public: static DotManager *instance(); static void deleteInstance(); - DotRunner* createRunner(const std::string& absDotName, const std::string& md5Hash); - DotFilePatcher *createFilePatcher(const std::string &fileName); + DotRunner* createRunner(const QCString& absDotName, const QCString& md5Hash); + DotFilePatcher *createFilePatcher(const QCString &fileName); bool run() const; private: @@ -47,9 +48,9 @@ class DotManager std::vector< std::unique_ptr<DotWorkerThread> > m_workers; }; -void writeDotGraphFromFile(const char *inFile,const char *outDir, - const char *outFile,GraphOutputFormat format); -void writeDotImageMapFromFile(std::ostream &t, +void writeDotGraphFromFile(const QCString &inFile,const QCString &outDir, + const QCString &outFile,GraphOutputFormat format); +void writeDotImageMapFromFile(TextStream &t, const QCString& inFile, const QCString& outDir, const QCString& relPath,const QCString& baseName, const QCString& context,int graphId=-1); diff --git a/src/dotcallgraph.cpp b/src/dotcallgraph.cpp index efe829f..1f77e33 100644 --- a/src/dotcallgraph.cpp +++ b/src/dotcallgraph.cpp @@ -40,7 +40,7 @@ void DotCallGraph::buildGraph(DotNode *n,const MemberDef *md,int distance) if (it!=m_usedNodes.end()) // file is already a node in the graph { DotNode *bn = it->second; - n->addChild(bn,0,0,0); + n->addChild(bn,0,0); bn->addParent(n); bn->setDistance(distance); } @@ -64,7 +64,7 @@ void DotCallGraph::buildGraph(DotNode *n,const MemberDef *md,int distance) uniqueId, 0 //distance ); - n->addChild(bn,0,0,0); + n->addChild(bn,0,0); bn->addParent(n); bn->setDistance(distance); m_usedNodes.insert(std::make_pair(uniqueId.str(),bn)); @@ -134,7 +134,7 @@ DotCallGraph::DotCallGraph(const MemberDef *md,bool inverse) m_startNode = new DotNode(getNextNodeNumber(), linkToText(md->getLanguage(),name,FALSE), tooltip, - uniqueId.data(), + uniqueId, TRUE // root node ); m_startNode->setDistance(0); @@ -179,12 +179,12 @@ QCString DotCallGraph::getMapLabel() const } QCString DotCallGraph::writeGraph( - std::ostream &out, + TextStream &out, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, - const char *path, - const char *fileName, - const char *relPath,bool generateImageMap, + const QCString &path, + const QCString &fileName, + const QCString &relPath,bool generateImageMap, int graphId) { return DotGraph::writeGraph(out, graphFormat, textFormat, path, fileName, relPath, generateImageMap, graphId); diff --git a/src/dotcallgraph.h b/src/dotcallgraph.h index ad9006f..e8361a2 100644 --- a/src/dotcallgraph.h +++ b/src/dotcallgraph.h @@ -29,9 +29,9 @@ class DotCallGraph : public DotGraph bool isTrivial() const; bool isTooBig() const; int numNodes() const; - QCString writeGraph(std::ostream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, - const char *path,const char *fileName, - const char *relPath,bool writeImageMap=TRUE, + QCString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, + const QCString &path,const QCString &fileName, + const QCString &relPath,bool writeImageMap=TRUE, int graphId=-1); protected: diff --git a/src/dotclassgraph.cpp b/src/dotclassgraph.cpp index fe36bc9..1bbe4de 100644 --- a/src/dotclassgraph.cpp +++ b/src/dotclassgraph.cpp @@ -18,16 +18,17 @@ #include "containers.h" #include "dotclassgraph.h" #include "dotnode.h" +#include "textstream.h" #include "config.h" #include "util.h" void DotClassGraph::addClass(const ClassDef *cd,DotNode *n,int prot, - const char *label,const char *usedName,const char *templSpec,bool base,int distance) + const QCString &label,const QCString &usedName,const QCString &templSpec,bool base,int distance) { if (Config_getBool(HIDE_UNDOC_CLASSES) && !cd->isLinkable()) return; - int edgeStyle = (label || prot==EdgeInfo::Orange || prot==EdgeInfo::Orange2) ? EdgeInfo::Dashed : EdgeInfo::Solid; + int edgeStyle = (!label.isEmpty() || prot==EdgeInfo::Orange || prot==EdgeInfo::Orange2) ? EdgeInfo::Dashed : EdgeInfo::Solid; QCString className; QCString fullName; if (cd->isAnonymous()) @@ -36,12 +37,12 @@ void DotClassGraph::addClass(const ClassDef *cd,DotNode *n,int prot, className+=label; fullName = className; } - else if (usedName) // name is a typedef + else if (!usedName.isEmpty()) // name is a typedef { className=usedName; fullName = className; } - else if (templSpec) // name has a template part + else if (!templSpec.isEmpty()) // name has a template part { className=insertTemplateSpecifierInScope(cd->displayName(),templSpec); fullName =insertTemplateSpecifierInScope(cd->name(),templSpec); @@ -52,7 +53,7 @@ void DotClassGraph::addClass(const ClassDef *cd,DotNode *n,int prot, fullName = cd->name(); } //printf("DotClassGraph::addClass(class='%s',parent=%s,prot=%d,label=%s,dist=%d,usedName=%s,templSpec=%s,base=%d)\n", - // className.data(),n->label().data(),prot,label,distance,usedName,templSpec,base); + // qPrint(className),qPrint(n->label()),prot,label,distance,usedName,templSpec,base); auto it = m_usedNodes.find(fullName.str()); if (it!=m_usedNodes.end()) // class already inserted { @@ -68,7 +69,7 @@ void DotClassGraph::addClass(const ClassDef *cd,DotNode *n,int prot, n->addParent(bn); } bn->setDistance(distance); - //printf(" add exiting node %s of %s\n",bn->label().data(),n->label().data()); + //printf(" add exiting node %s of %s\n",qPrint(bn->label()),qPrint(n->label())); } else // new class { @@ -87,7 +88,7 @@ void DotClassGraph::addClass(const ClassDef *cd,DotNode *n,int prot, DotNode *bn = new DotNode(getNextNodeNumber(), displayName, tooltip, - tmp_url.data(), + tmp_url, FALSE, // rootNode cd ); @@ -104,7 +105,7 @@ void DotClassGraph::addClass(const ClassDef *cd,DotNode *n,int prot, bn->setDistance(distance); m_usedNodes.insert(std::make_pair(fullName.str(),bn)); //printf(" add new child node '%s' to %s hidden=%d url=%s\n", - // className.data(),n->label().data(),cd->isHidden(),tmp_url.data()); + // qPrint(className),qPrint(n->label()),cd->isHidden(),qPrint(tmp_url)); buildGraph(cd,bn,base,distance+1); } @@ -249,7 +250,7 @@ static QCString joinLabels(const StringSet &ss) void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int distance) { //printf("DocClassGraph::buildGraph(%s,distance=%d,base=%d)\n", - // cd->name().data(),distance,base); + // qPrint(cd->name()),distance,base); // ---- Add inheritance relations if (m_graphType == Inheritance || m_graphType==Collaboration) @@ -257,8 +258,8 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista for (const auto &bcd : base ? cd->baseClasses() : cd->subClasses()) { //printf("-------- inheritance relation %s->%s templ='%s'\n", - // cd->name().data(),bcd->classDef->name().data(),bcd->templSpecifiers.data()); - addClass(bcd.classDef,n,bcd.prot,0,bcd.usedName,bcd.templSpecifiers,base,distance); + // qPrint(cd->name()),qPrint(bcd->classDef->name()),qPrint(bcd->templSpecifiers)); + addClass(bcd.classDef,n,bcd.prot,QCString(),bcd.usedName,bcd.templSpecifiers,base,distance); } } if (m_graphType == Collaboration) @@ -269,8 +270,8 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista cd->usedByImplementationClasses() ; for (const auto &ucd : list) { - //printf("addClass: %s templSpec=%s\n",ucd.classDef->name().data(),ucd.templSpecifiers.data()); - addClass(ucd.classDef,n,EdgeInfo::Purple,joinLabels(ucd.accessors),0, + //printf("addClass: %s templSpec=%s\n",qPrint(ucd.classDef->name()),qPrint(ucd.templSpecifiers)); + addClass(ucd.classDef,n,EdgeInfo::Purple,joinLabels(ucd.accessors),QCString(), ucd.templSpecifiers,base,distance); } } @@ -278,9 +279,9 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista { for (const auto &ccd : cd->templateTypeConstraints()) { - //printf("addClass: %s\n",ccd.classDef->name().data()); - addClass(ccd.classDef,n,EdgeInfo::Orange2,joinLabels(ccd.accessors),0, - 0,TRUE,distance); + //printf("addClass: %s\n",qPrint(ccd.classDef->name())); + addClass(ccd.classDef,n,EdgeInfo::Orange2,joinLabels(ccd.accessors),QCString(), + QCString(),TRUE,distance); } } @@ -296,7 +297,7 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista for (const auto &ti : templMaster->getTemplateInstances()) if (ti.classDef==cd) { - addClass(templMaster,n,EdgeInfo::Orange,ti.templSpec,0,0,TRUE,distance); + addClass(templMaster,n,EdgeInfo::Orange,ti.templSpec,QCString(),QCString(),TRUE,distance); } } } @@ -304,7 +305,7 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista { for (const auto &ti : cd->getTemplateInstances()) { - addClass(ti.classDef,n,EdgeInfo::Orange,ti.templSpec,0,0,FALSE,distance); + addClass(ti.classDef,n,EdgeInfo::Orange,ti.templSpec,QCString(),QCString(),FALSE,distance); } } } @@ -312,7 +313,7 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista DotClassGraph::DotClassGraph(const ClassDef *cd,GraphType t) { - //printf("--------------- DotClassGraph::DotClassGraph '%s'\n",cd->displayName().data()); + //printf("--------------- DotClassGraph::DotClassGraph '%s'\n",qPrint(cd->displayName())); m_graphType = t; QCString tmp_url=""; if (cd->isLinkable() && !cd->isHidden()) @@ -328,7 +329,7 @@ DotClassGraph::DotClassGraph(const ClassDef *cd,GraphType t) m_startNode = new DotNode(getNextNodeNumber(), className, tooltip, - tmp_url.data(), + tmp_url, TRUE, // is a root node cd ); @@ -443,12 +444,12 @@ QCString DotClassGraph::getImgAltText() const return ""; } -QCString DotClassGraph::writeGraph(std::ostream &out, +QCString DotClassGraph::writeGraph(TextStream &out, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, - const char *path, - const char *fileName, - const char *relPath, + const QCString &path, + const QCString &fileName, + const QCString &relPath, bool /*isTBRank*/, bool generateImageMap, int graphId) @@ -458,7 +459,7 @@ QCString DotClassGraph::writeGraph(std::ostream &out, //-------------------------------------------------------------------- -void DotClassGraph::writeXML(std::ostream &t) +void DotClassGraph::writeXML(TextStream &t) { for (const auto &kv : m_usedNodes) { @@ -466,7 +467,7 @@ void DotClassGraph::writeXML(std::ostream &t) } } -void DotClassGraph::writeDocbook(std::ostream &t) +void DotClassGraph::writeDocbook(TextStream &t) { for (const auto &kv : m_usedNodes) { @@ -474,7 +475,7 @@ void DotClassGraph::writeDocbook(std::ostream &t) } } -void DotClassGraph::writeDEF(std::ostream &t) +void DotClassGraph::writeDEF(TextStream &t) { for (const auto &kv : m_usedNodes) { diff --git a/src/dotclassgraph.h b/src/dotclassgraph.h index 5b00098..6ccba08 100644 --- a/src/dotclassgraph.h +++ b/src/dotclassgraph.h @@ -16,12 +16,12 @@ #ifndef DOTCLASSGRAPH_H #define DOTCLASSGRAPH_H -#include <iostream> - #include "classdef.h" #include "dotnode.h" #include "dotgraph.h" +class TextStream; + /** Representation of a class inheritance or dependency graph */ class DotClassGraph : public DotGraph { @@ -31,13 +31,13 @@ public: bool isTrivial() const; bool isTooBig() const; int numNodes() const; - QCString writeGraph(std::ostream &t,GraphOutputFormat gf,EmbeddedOutputFormat ef, - const char *path, const char *fileName, const char *relPath, + QCString writeGraph(TextStream &t,GraphOutputFormat gf,EmbeddedOutputFormat ef, + const QCString &path, const QCString &fileName, const QCString &relPath, bool TBRank=TRUE,bool imageMap=TRUE,int graphId=-1); - void writeXML(std::ostream &t); - void writeDocbook(std::ostream &t); - void writeDEF(std::ostream &t); + void writeXML(TextStream &t); + void writeDocbook(TextStream &t); + void writeDEF(TextStream &t); protected: virtual QCString getBaseName() const; @@ -49,8 +49,8 @@ private: void buildGraph(const ClassDef *cd,DotNode *n,bool base,int distance); bool determineVisibleNodes(DotNode *rootNode,int maxNodes,bool includeParents); void determineTruncatedNodes(DotNodeDeque &queue,bool includeParents); - void addClass(const ClassDef *cd,DotNode *n,int prot,const char *label, - const char *usedName,const char *templSpec, + void addClass(const ClassDef *cd,DotNode *n,int prot,const QCString &label, + const QCString &usedName,const QCString &templSpec, bool base,int distance); DotNode * m_startNode; diff --git a/src/dotdirdeps.cpp b/src/dotdirdeps.cpp index 680b2f7..12236a0 100644 --- a/src/dotdirdeps.cpp +++ b/src/dotdirdeps.cpp @@ -29,7 +29,7 @@ using DirDefMap = std::map<std::string,const DirDef *>; * @param[in] fillBackground if the node shall be explicitly filled * @param[in,out] directoriesInGraph lists the directories which have been written to the output stream */ -static void drawDirectory(std::ostream &outStream, const DirDef *const directory, const bool fillBackground, +static void drawDirectory(TextStream &outStream, const DirDef *const directory, const bool fillBackground, DirDefMap &directoriesInGraph) { outStream << " " << directory->getOutputFileBase() << " [shape=box " @@ -46,7 +46,7 @@ static void drawDirectory(std::ostream &outStream, const DirDef *const directory directoriesInGraph.insert(std::make_pair(directory->getOutputFileBase().str(), directory)); } -void writeDotDirDepGraph(std::ostream &t,const DirDef *dd,bool linkRelations) +void writeDotDirDepGraph(TextStream &t,const DirDef *dd,bool linkRelations) { int fontSize = Config_getInt(DOT_FONTSIZE); QCString fontName = Config_getString(DOT_FONTNAME); @@ -124,7 +124,7 @@ void writeDotDirDepGraph(std::ostream &t,const DirDef *dd,bool linkRelations) // add nodes for other used directories { - //printf("*** For dir %s\n",shortName().data()); + //printf("*** For dir %s\n",qPrint(shortName())); for (const auto &usedDir : usedDirsNotDrawn) // for each used dir (=directly used or a parent of a directly used dir) { @@ -132,10 +132,10 @@ void writeDotDirDepGraph(std::ostream &t,const DirDef *dd,bool linkRelations) while (dir) { //printf("*** check relation %s->%s same_parent=%d !%s->isParentOf(%s)=%d\n", - // dir->shortName().data(),usedDir->shortName().data(), + // qPrint(dir->shortName()),qPrint(usedDir->shortName()), // dir->parent()==usedDir->parent(), - // usedDir->shortName().data(), - // shortName().data(), + // qPrint(usedDir->shortName()), + // qPrint(shortName()), // !usedDir->isParentOf(this) // ); if (dir!=usedDir && dir->parent()==usedDir->parent()) @@ -199,8 +199,7 @@ QCString DotDirDeps::getBaseName() const void DotDirDeps::computeTheGraph() { // compute md5 checksum of the graph were are about to generate - std::ostringstream md5stream(std::ios_base::ate); - //m_dir->writeDepGraph(md5stream); + TextStream md5stream; writeDotDirDepGraph(md5stream,m_dir,m_linkRelations); m_theGraph = md5stream.str(); } @@ -215,12 +214,12 @@ QCString DotDirDeps::getImgAltText() const return convertToXML(m_dir->displayName()); } -QCString DotDirDeps::writeGraph(std::ostream &out, +QCString DotDirDeps::writeGraph(TextStream &out, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, - const char *path, - const char *fileName, - const char *relPath, + const QCString &path, + const QCString &fileName, + const QCString &relPath, bool generateImageMap, int graphId, bool linkRelations) diff --git a/src/dotdirdeps.h b/src/dotdirdeps.h index ff46db2..4f915f9 100644 --- a/src/dotdirdeps.h +++ b/src/dotdirdeps.h @@ -26,12 +26,12 @@ class DotDirDeps : public DotGraph DotDirDeps(const DirDef *dir); ~DotDirDeps(); bool isTrivial() const; - QCString writeGraph(std::ostream &out, + QCString writeGraph(TextStream &out, GraphOutputFormat gf, EmbeddedOutputFormat ef, - const char *path, - const char *fileName, - const char *relPath, + const QCString &path, + const QCString &fileName, + const QCString &relPath, bool writeImageMap=TRUE, int graphId=-1, bool linkRelations=TRUE); diff --git a/src/dotfilepatcher.cpp b/src/dotfilepatcher.cpp index 3d64418..326c1e1 100644 --- a/src/dotfilepatcher.cpp +++ b/src/dotfilepatcher.cpp @@ -123,7 +123,7 @@ static const char svgZoomFooter[] = "</svg>\n" ; -static QCString replaceRef(const QCString &buf,const QCString relPath, +static QCString replaceRef(const QCString &buf,const QCString &relPath, bool urlOnly,const QCString &context,const QCString &target=QCString()) { // search for href="...", store ... part in link @@ -152,7 +152,7 @@ static QCString replaceRef(const QCString &buf,const QCString relPath, DocRef *df = new DocRef( (DocNode*) 0, link.mid(5), context ); result+=externalRef(relPath,df->ref(),TRUE); if (!df->file().isEmpty()) - result += df->file().data() + Doxygen::htmlFileExtension; + result += df->file() + Doxygen::htmlFileExtension; if (!df->anchor().isEmpty()) result += "#" + df->anchor(); delete df; @@ -191,7 +191,7 @@ static QCString replaceRef(const QCString &buf,const QCString relPath, QCString leftPart = buf.left(indexS); QCString rightPart = buf.mid(indexE+1); //printf("replaceRef(\n'%s'\n)->\n'%s+%s+%s'\n", - // buf.data(),leftPart.data(),result.data(),rightPart.data()); + // qPrint(buf),qPrint(leftPart),qPrint(result),qPrint(rightPart)); return leftPart + result + rightPart; } else @@ -211,16 +211,16 @@ static QCString replaceRef(const QCString &buf,const QCString relPath, * map file was found * \returns TRUE if successful. */ -bool DotFilePatcher::convertMapFile(std::ostream &t,const char *mapName, - const QCString relPath, bool urlOnly, +bool DotFilePatcher::convertMapFile(TextStream &t,const QCString &mapName, + const QCString &relPath, bool urlOnly, const QCString &context) { - std::ifstream f(mapName,std::ifstream::in); + std::ifstream f(mapName.str(),std::ifstream::in); if (!f.is_open()) { err("problems opening map file %s for inclusion in the docs!\n" "If you installed Graphviz/dot after a previous failing run, \n" - "try deleting the output directory and rerun doxygen.\n",mapName); + "try deleting the output directory and rerun doxygen.\n",qPrint(mapName)); return FALSE; } std::string line; @@ -245,7 +245,7 @@ bool DotFilePatcher::convertMapFile(std::ostream &t,const char *mapName, return TRUE; } -DotFilePatcher::DotFilePatcher(const char *patchFile) +DotFilePatcher::DotFilePatcher(const QCString &patchFile) : m_patchFile(patchFile) { } @@ -291,7 +291,7 @@ int DotFilePatcher::addSVGObject(const QCString &baseName, bool DotFilePatcher::run() const { - //printf("DotFilePatcher::run(): %s\n",m_patchFile.data()); + //printf("DotFilePatcher::run(): %s\n",qPrint(m_patchFile)); bool interactiveSVG_local = Config_getBool(INTERACTIVE_SVG); bool isSVGFile = m_patchFile.right(4)==".svg"; int graphId = -1; @@ -303,30 +303,31 @@ bool DotFilePatcher::run() const graphId = map.graphId; relPath = map.relPath; //printf("DotFilePatcher::addSVGConversion: file=%s zoomable=%d\n", - // m_patchFile.data(),map->zoomable); + // qPrint(m_patchFile),map->zoomable); } std::string tmpName = m_patchFile.str()+".tmp"; std::string patchFile = m_patchFile.str(); Dir thisDir; if (!thisDir.rename(patchFile,tmpName)) { - err("Failed to rename file %s to %s!\n",m_patchFile.data(),tmpName.c_str()); + err("Failed to rename file %s to %s!\n",qPrint(m_patchFile),tmpName.c_str()); return FALSE; } std::ifstream fi(tmpName, std::ifstream::in); - std::ofstream t(patchFile, std::ofstream::out | std::ofstream::binary); + std::ofstream fo(patchFile, std::ofstream::out | std::ofstream::binary); if (!fi.is_open()) { err("problem opening file %s for patching!\n",tmpName.c_str()); thisDir.rename(tmpName,patchFile); return FALSE; } - if (!t.is_open()) + if (!fo.is_open()) { - err("problem opening file %s for patching!\n",m_patchFile.data()); + err("problem opening file %s for patching!\n",qPrint(m_patchFile)); thisDir.rename(tmpName,patchFile); return FALSE; } + TextStream t(&fo); int width,height; bool insideHeader=FALSE; bool replacedHeader=FALSE; @@ -336,7 +337,7 @@ bool DotFilePatcher::run() const while (getline(fi,lineStr)) { QCString line = lineStr+'\n'; - //printf("line=[%s]\n",line.stripWhiteSpace().data()); + //printf("line=[%s]\n",qPrint(line.stripWhiteSpace())); int i; if (isSVGFile) { @@ -391,16 +392,16 @@ bool DotFilePatcher::run() const int e = std::max(line.find("--]"),line.find("-->")); const Map &map = m_maps.at(mapId); //printf("DotFilePatcher::writeSVGFigure: file=%s zoomable=%d\n", - // m_patchFile.data(),map.zoomable); + // qPrint(m_patchFile),map.zoomable); if (!writeSVGFigureLink(t,map.relPath,map.label,map.mapFile)) { - err("Problem extracting size from SVG file %s\n",map.mapFile.data()); + err("Problem extracting size from SVG file %s\n",qPrint(map.mapFile)); } if (e!=-1) t << line.mid(e+3); } else // error invalid map id! { - err("Found invalid SVG id in file %s!\n",m_patchFile.data()); + err("Found invalid SVG id in file %s!\n",qPrint(m_patchFile)); t << line.mid(i); } } @@ -411,12 +412,12 @@ bool DotFilePatcher::run() const int n = sscanf(line.data()+i,"<!-- MAP %d",&mapId); if (n==1 && mapId>=0 && mapId<(int)m_maps.size()) { - std::ostringstream tt(std::ios_base::ate); + TextStream tt; const Map &map = m_maps.at(mapId); //printf("patching MAP %d in file %s with contents of %s\n", - // mapId,m_patchFile.data(),map.mapFile.data()); + // mapId,qPrint(m_patchFile),qPrint(map.mapFile)); convertMapFile(tt,map.mapFile,map.relPath,map.urlOnly,map.context); - if (tt.tellp()>0) + if (!tt.empty()) { t << "<map name=\"" << correctId(map.label) << "\" id=\"" << correctId(map.label) << "\">\n"; t << tt.str(); @@ -425,7 +426,7 @@ bool DotFilePatcher::run() const } else // error invalid map id! { - err("Found invalid MAP id in file %s!\n",m_patchFile.data()); + err("Found invalid MAP id in file %s!\n",qPrint(m_patchFile)); t << line.mid(i); } } @@ -433,12 +434,12 @@ bool DotFilePatcher::run() const { int mapId=-1; int n = sscanf(line.data()+i+2,"FIG %d",&mapId); - //printf("line='%s' n=%d\n",line.data()+i,n); + //printf("line='%s' n=%d\n",qPrint(line)+i,n); if (n==1 && mapId>=0 && mapId<(int)m_maps.size()) { const Map &map = m_maps.at(mapId); //printf("patching FIG %d in file %s with contents of %s\n", - // mapId,m_patchFile.data(),map.mapFile.data()); + // mapId,qPrint(m_patchFile),qPrint(map.mapFile)); if (!writeVecGfxFigure(t,map.label,map.mapFile)) { err("problem writing FIG %d figure!\n",mapId); @@ -447,7 +448,7 @@ bool DotFilePatcher::run() const } else // error invalid map id! { - err("Found invalid bounding FIG %d in file %s!\n",mapId,m_patchFile.data()); + err("Found invalid bounding FIG %d in file %s!\n",mapId,qPrint(m_patchFile)); t << line; } } @@ -462,29 +463,32 @@ bool DotFilePatcher::run() const { QCString orgName=m_patchFile.left(m_patchFile.length()-4)+"_org.svg"; t << substitute(svgZoomFooter,"$orgname",stripPath(orgName)); - t.close(); + t.flush(); + fo.close(); // keep original SVG file so we can refer to it, we do need to replace // dummy link by real ones fi.open(tmpName,std::ifstream::in); - t.open(orgName,std::ofstream::out | std::ofstream::binary); + fo.open(orgName.str(),std::ofstream::out | std::ofstream::binary); if (!fi.is_open()) { err("problem opening file %s for reading!\n",tmpName.c_str()); return FALSE; } - if (!t.is_open()) + if (!fo.is_open()) { - err("problem opening file %s for writing!\n",orgName.data()); + err("problem opening file %s for writing!\n",qPrint(orgName)); return FALSE; } + t.setStream(&fo); while (getline(fi,lineStr)) // foreach line { std::string line = lineStr+'\n'; const Map &map = m_maps.front(); // there is only one 'map' for a SVG file t << replaceRef(line.c_str(),map.relPath,map.urlOnly,map.context,"_top"); } + t.flush(); fi.close(); - t.close(); + fo.close(); } // remove temporary file thisDir.remove(tmpName); @@ -521,14 +525,14 @@ static bool readSVGSize(const QCString &fileName,int *width,int *height) return true; } -static void writeSVGNotSupported(std::ostream &out) +static void writeSVGNotSupported(TextStream &out) { out << "<p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p>"; } /// Check if a reference to a SVG figure can be written and do so if possible. /// Returns FALSE if not possible (for instance because the SVG file is not yet generated). -bool DotFilePatcher::writeSVGFigureLink(std::ostream &out,const QCString &relPath, +bool DotFilePatcher::writeSVGFigureLink(TextStream &out,const QCString &relPath, const QCString &baseName,const QCString &absImgName) { int width=600,height=600; @@ -567,7 +571,7 @@ bool DotFilePatcher::writeSVGFigureLink(std::ostream &out,const QCString &relPat return TRUE; } -bool DotFilePatcher::writeVecGfxFigure(std::ostream &out,const QCString &baseName, +bool DotFilePatcher::writeVecGfxFigure(TextStream &out,const QCString &baseName, const QCString &figureName) { int width=400,height=550; diff --git a/src/dotfilepatcher.h b/src/dotfilepatcher.h index 5b51da8..af2c855 100644 --- a/src/dotfilepatcher.h +++ b/src/dotfilepatcher.h @@ -17,16 +17,16 @@ #define DOTFILEPATCHER_H #include <vector> -#include <iostream> #include "qcstring.h" +class TextStream; + /** Helper class to insert a set of map file into an output file */ class DotFilePatcher { public: - DotFilePatcher(const char *patchFile); - + DotFilePatcher(const QCString &patchFile); int addMap(const QCString &mapFile,const QCString &relPath, bool urlOnly,const QCString &context,const QCString &label); @@ -41,14 +41,14 @@ class DotFilePatcher bool run() const; bool isSVGFile() const; - static bool convertMapFile(std::ostream &t,const char *mapName, - const QCString relPath, bool urlOnly=FALSE, + static bool convertMapFile(TextStream &t,const QCString &mapName, + const QCString &relPath, bool urlOnly=FALSE, const QCString &context=QCString()); - static bool writeSVGFigureLink(std::ostream &out,const QCString &relPath, + static bool writeSVGFigureLink(TextStream &out,const QCString &relPath, const QCString &baseName,const QCString &absImgName); - static bool writeVecGfxFigure(std::ostream& out, const QCString& baseName, + static bool writeVecGfxFigure(TextStream& out, const QCString& baseName, const QCString& figureName); private: diff --git a/src/dotgfxhierarchytable.cpp b/src/dotgfxhierarchytable.cpp index 4684f96..f7b95d9 100644 --- a/src/dotgfxhierarchytable.cpp +++ b/src/dotgfxhierarchytable.cpp @@ -29,13 +29,13 @@ QCString DotGfxHierarchyTable::getBaseName() const if (m_prefix.isEmpty()) baseName.sprintf("inherit_graph_%d", m_graphId); else - baseName.sprintf("%sinherit_graph_%d",m_prefix.data(), m_graphId); + baseName.sprintf("%sinherit_graph_%d",qPrint(m_prefix), m_graphId); return baseName; } void DotGfxHierarchyTable::computeTheGraph() { - std::ostringstream md5stream(std::ios_base::ate); + TextStream md5stream; writeGraphHeader(md5stream,theTranslator->trGraphicalHierarchy()); md5stream << " rankdir=\"LR\";\n"; for (auto node : m_rootNodes) @@ -61,8 +61,8 @@ QCString DotGfxHierarchyTable::getMapLabel() const return escapeCharsInString(m_rootSubgraphNode->label(),FALSE); } -void DotGfxHierarchyTable::createGraph(DotNode *n,std::ostream &out, - const char *path,const char *fileName,int id) +void DotGfxHierarchyTable::createGraph(DotNode *n,TextStream &out, + const QCString &path,const QCString &fileName,int id) { m_rootSubgraphNode = n; m_graphId = id; @@ -71,19 +71,19 @@ void DotGfxHierarchyTable::createGraph(DotNode *n,std::ostream &out, DotGraph::writeGraph(out, GOF_BITMAP, EOF_Html, path, fileName, "", TRUE, 0); } -void DotGfxHierarchyTable::writeGraph(std::ostream &out, - const char *path,const char *fileName) +void DotGfxHierarchyTable::writeGraph(TextStream &out, + const QCString &path,const QCString &fileName) { //printf("DotGfxHierarchyTable::writeGraph(%s)\n",name); //printf("m_rootNodes=%p count=%d\n",m_rootNodes,m_rootNodes->count()); if (m_rootSubgraphs.empty()) return; - Dir d(path); + Dir d(path.str()); // store the original directory if (!d.exists()) { - term("Output dir %s does not exist!\n",path); + term("Output dir %s does not exist!\n",qPrint(path)); } // put each connected subgraph of the hierarchy in a row of the HTML output @@ -103,16 +103,16 @@ void DotGfxHierarchyTable::writeGraph(std::ostream &out, void DotGfxHierarchyTable::addHierarchy(DotNode *n,const ClassDef *cd,ClassDefSet &visitedClasses) { - //printf("addHierarchy '%s' baseClasses=%d\n",cd->name().data(),cd->baseClasses()->count()); + //printf("addHierarchy '%s' baseClasses=%d\n",qPrint(cd->name()),cd->baseClasses()->count()); for (const auto &bcd : cd->subClasses()) { ClassDef *bClass=bcd.classDef; - //printf(" Trying sub class='%s' usedNodes=%d\n",bClass->name().data(),m_usedNodes->count()); + //printf(" Trying sub class='%s' usedNodes=%d\n",qPrint(bClass->name()),m_usedNodes->count()); if (bClass && bClass->isVisibleInHierarchy() && hasVisibleRoot(bClass->baseClasses())) { auto it = m_usedNodes.find(bClass->name().str()); - //printf(" Node '%s' Found visible class='%s'\n",n->label().data(), - // bClass->name().data()); + //printf(" Node '%s' Found visible class='%s'\n",qPrint(n->label()), + // qPrint(bClass->name())); DotNode *root = 0; if (it!=m_usedNodes.end()) // node already present { @@ -125,8 +125,8 @@ void DotGfxHierarchyTable::addHierarchy(DotNode *n,const ClassDef *cd,ClassDefSe n->addChild(bn.get(),bcd.prot); bn->addParent(n); //printf(" Adding node %s to existing base node %s (c=%d,p=%d)\n", - // n->label().data(), - // bn->label().data(), + // qPrint(n->label()), + // qPrint(bn->label()), // bn->children() ? bn->children()->count() : 0, // bn->parents() ? bn->parents()->count() : 0 // ); @@ -151,18 +151,18 @@ void DotGfxHierarchyTable::addHierarchy(DotNode *n,const ClassDef *cd,ClassDefSe auto bn = std::make_unique<DotNode>(getNextNodeNumber(), bClass->displayName(), tooltip, - tmp_url.data() + tmp_url ); n->addChild(bn.get(),bcd.prot); bn->addParent(n); root = bn.get(); //printf(" Adding node %s to new base node %s (c=%d,p=%d)\n", - // n->label().data(), - // bn->label().data(), + // qPrint(n->label()), + // qPrint(bn->label()), // bn->children() ? bn->children()->count() : 0, // bn->parents() ? bn->parents()->count() : 0 // ); - //printf(" inserting %s (%p)\n",bClass->name().data(),bn); + //printf(" inserting %s (%p)\n",qPrint(bClass->name()),bn); m_usedNodes.insert(std::make_pair(bClass->name().str(),std::move(bn))); // add node to the used list } if (visitedClasses.find(bClass)==visitedClasses.end() && !bClass->subClasses().empty()) @@ -179,7 +179,7 @@ void DotGfxHierarchyTable::addClassList(const ClassLinkedMap &cl,ClassDefSet &vi { for (const auto &cd : cl) { - //printf("Trying %s subClasses=%d\n",cd->name().data(),cd->subClasses()->count()); + //printf("Trying %s subClasses=%d\n",qPrint(cd->name()),cd->subClasses()->count()); if (cd->getLanguage()==SrcLangExt_VHDL && (VhdlDocGen::VhdlClasses)cd->protection()!=VhdlDocGen::ENTITYCLASS ) @@ -203,12 +203,12 @@ void DotGfxHierarchyTable::addClassList(const ClassLinkedMap &cl,ClassDefSet &vi tmp_url+="#"+cd->anchor(); } } - //printf("Inserting root class %s\n",cd->name().data()); + //printf("Inserting root class %s\n",qPrint(cd->name())); QCString tooltip = cd->briefDescriptionAsTooltip(); auto n = std::make_unique<DotNode>(getNextNodeNumber(), cd->displayName(), tooltip, - tmp_url.data()); + tmp_url); DotNode *root = n.get(); m_usedNodes.insert(std::make_pair(cd->name().str(),std::move(n))); @@ -222,7 +222,7 @@ void DotGfxHierarchyTable::addClassList(const ClassLinkedMap &cl,ClassDefSet &vi } } -DotGfxHierarchyTable::DotGfxHierarchyTable(const char *prefix,ClassDef::CompoundType ct) +DotGfxHierarchyTable::DotGfxHierarchyTable(const QCString &prefix,ClassDef::CompoundType ct) : m_prefix(prefix) , m_classType(ct) { @@ -243,7 +243,7 @@ DotGfxHierarchyTable::DotGfxHierarchyTable(const char *prefix,ClassDef::Compound { if (n->subgraphId()==-1) // not yet colored { - //printf("Starting at node %s (%p): %d\n",n->label().data(),n,curColor); + //printf("Starting at node %s (%p): %d\n",qPrint(n->label()),n,curColor); done=FALSE; // still uncolored nodes n->setSubgraphId(curColor); n->markAsVisible(); @@ -262,7 +262,7 @@ DotGfxHierarchyTable::DotGfxHierarchyTable(const char *prefix,ClassDef::Compound for (auto n : m_rootSubgraphs) { //printf("Node %s color=%d (c=%d,p=%d)\n", - // n->label().data(),n->m_subgraphId, + // qPrint(n->label()),n->m_subgraphId, // n->children()?n->children()->count():0, // n->parents()?n->parents()->count():0); int number=0; diff --git a/src/dotgfxhierarchytable.h b/src/dotgfxhierarchytable.h index e85f3e9..0d37881 100644 --- a/src/dotgfxhierarchytable.h +++ b/src/dotgfxhierarchytable.h @@ -31,10 +31,10 @@ class ClassLinkedMap; class DotGfxHierarchyTable : public DotGraph { public: - DotGfxHierarchyTable(const char *prefix="",ClassDef::CompoundType ct=ClassDef::Class); - void createGraph(DotNode *rootNode,std::ostream &t,const char *path, - const char *fileName,int id); - void writeGraph(std::ostream &t,const char *path, const char *fileName); + DotGfxHierarchyTable(const QCString &prefix="",ClassDef::CompoundType ct=ClassDef::Class); + void createGraph(DotNode *rootNode,TextStream &t,const QCString &path, + const QCString &fileName,int id); + void writeGraph(TextStream &t,const QCString &path, const QCString &fileName); const std::vector<DotNode*> subGraphs() const { return m_rootSubgraphs; } protected: diff --git a/src/dotgraph.cpp b/src/dotgraph.cpp index d9dd91e..fbcc8ff 100644 --- a/src/dotgraph.cpp +++ b/src/dotgraph.cpp @@ -38,31 +38,36 @@ * are compared with \a md5. If equal FALSE is returned. * The .md5 is created or updated after successful creation of the output file. */ -static bool checkMd5Signature(const QCString &baseName, - const QCString &md5) +static bool sameMd5Signature(const QCString &baseName, + const QCString &md5) { + bool same = false; + char md5stored[33]; + md5stored[0]=0; std::ifstream f(baseName.str()+".md5",std::ifstream::in | std::ifstream::binary); if (f.is_open()) { // read checksum - QCString md5stored(33); - f.read(md5stored.rawData(),32); + f.read(md5stored,32); md5stored[32]='\0'; // compare checksum if (!f.fail() && md5==md5stored) { - // bail out if equal - return false; + same = true; } + //printf("sameSignature(%s,%s==%s)=%d\n",qPrint(baseName),md5stored,qPrint(md5),same); } - return true; + else + { + //printf("sameSignature(%s) not found\n",qPrint(baseName)); + } + return same; } -static bool checkDeliverables(const QCString &file1, - const QCString &file2=QCString()) +static bool deliverablesPresent(const QCString &file1,const QCString &file2) { - bool file1Ok = TRUE; - bool file2Ok = TRUE; + bool file1Ok = true; + bool file2Ok = true; if (!file1.isEmpty()) { FileInfo fi(file1.str()); @@ -76,15 +81,15 @@ static bool checkDeliverables(const QCString &file1, return file1Ok && file2Ok; } -static bool insertMapFile(std::ostream &out,const QCString &mapFile, +static bool insertMapFile(TextStream &out,const QCString &mapFile, const QCString &relPath,const QCString &mapLabel) { FileInfo fi(mapFile.str()); if (fi.exists() && fi.size()>0) // reuse existing map file { - std::ostringstream t(std::ios_base::ate); + TextStream t; DotFilePatcher::convertMapFile(t,mapFile,relPath,false); - if (t.tellp()>0) + if (!t.empty()) { out << "<map name=\"" << mapLabel << "\" id=\"" << mapLabel << "\">\n"; out << t.str(); @@ -104,18 +109,18 @@ QCString DotGraph::imgName() const } QCString DotGraph::writeGraph( - std::ostream& t, // output stream for the code file (html, ...) + TextStream& t, // output stream for the code file (html, ...) GraphOutputFormat gf, // bitmap(png/svg) or ps(eps/pdf) EmbeddedOutputFormat ef, // html, latex, ... - const char* path, // output folder - const char* fileName, // name of the code file (for code patcher) - const char* relPath, // output folder relative to code file + const QCString &path, // output folder + const QCString &fileName, // name of the code file (for code patcher) + const QCString &relPath, // output folder relative to code file bool generateImageMap, // in case of bitmap, shall there be code generated? int graphId) // number of this graph in the current code, used in svg code { m_graphFormat = gf; m_textFormat = ef; - m_dir = Dir(path); + m_dir = Dir(path.str()); m_fileName = fileName; m_relPath = relPath; m_generateImageMap = generateImageMap; @@ -142,19 +147,19 @@ bool DotGraph::prepareDotFile() term("Output dir %s does not exist!\n", m_dir.path().c_str()); } - QCString sigStr(33); + char sigStr[33]; uchar md5_sig[16]; // calculate md5 MD5Buffer((const unsigned char*)m_theGraph.data(), m_theGraph.length(), md5_sig); // convert result to a string - MD5SigToString(md5_sig, sigStr.rawData(), 33); + MD5SigToString(md5_sig, sigStr); // already queued files are processed again in case the output format has changed - if (!checkMd5Signature(absBaseName(), sigStr) && - checkDeliverables(absImgName(), - m_graphFormat == GOF_BITMAP && m_generateImageMap ? absMapName() : QCString() - ) + if (sameMd5Signature(absBaseName(), sigStr) && + deliverablesPresent(absImgName(), + m_graphFormat == GOF_BITMAP && m_generateImageMap ? absMapName() : QCString() + ) ) { // all needed files are there @@ -167,7 +172,7 @@ bool DotGraph::prepareDotFile() std::ofstream f(absDotName().str(),std::ofstream::out | std::ofstream::binary); if (!f.is_open()) { - err("Could not open file %s for writing\n",absDotName().data()); + err("Could not open file %s for writing\n",qPrint(absDotName())); return TRUE; } f << m_theGraph; @@ -176,14 +181,14 @@ bool DotGraph::prepareDotFile() if (m_graphFormat == GOF_BITMAP) { // run dot to create a bitmap image - DotRunner * dotRun = DotManager::instance()->createRunner(absDotName().data(), sigStr.data()); + DotRunner * dotRun = DotManager::instance()->createRunner(absDotName(), sigStr); dotRun->addJob(Config_getEnum(DOT_IMAGE_FORMAT), absImgName()); if (m_generateImageMap) dotRun->addJob(MAP_CMD, absMapName()); } else if (m_graphFormat == GOF_EPS) { // run dot to create a .eps image - DotRunner *dotRun = DotManager::instance()->createRunner(absDotName().data(), sigStr.data()); + DotRunner *dotRun = DotManager::instance()->createRunner(absDotName(), sigStr); if (Config_getBool(USE_PDFLATEX)) { dotRun->addJob("pdf",absImgName()); @@ -196,7 +201,7 @@ bool DotGraph::prepareDotFile() return TRUE; } -void DotGraph::generateCode(std::ostream &t) +void DotGraph::generateCode(TextStream &t) { QCString imgExt = getDotImageExtension(); if (m_graphFormat==GOF_BITMAP && m_textFormat==EOF_DocBook) @@ -223,11 +228,11 @@ void DotGraph::generateCode(std::ostream &t) if (m_regenerate) { DotManager::instance()-> - createFilePatcher(absImgName().data())-> + createFilePatcher(absImgName())-> addSVGConversion(m_relPath,FALSE,QCString(),m_zoomable,m_graphId); } int mapId = DotManager::instance()-> - createFilePatcher(m_fileName.data())-> + createFilePatcher(m_fileName)-> addSVGObject(m_baseName,absImgName(),m_relPath); t << "<!-- SVG " << mapId << " -->\n"; } @@ -242,7 +247,7 @@ void DotGraph::generateCode(std::ostream &t) if (m_regenerate || !insertMapFile(t, absMapName(), m_relPath, correctId(getMapLabel()))) { int mapId = DotManager::instance()-> - createFilePatcher(m_fileName.data())-> + createFilePatcher(m_fileName)-> addMap(absMapName(), m_relPath, m_urlOnly, QCString(), getMapLabel()); t << "<!-- MAP " << mapId << " -->\n"; } @@ -253,14 +258,14 @@ void DotGraph::generateCode(std::ostream &t) if (m_regenerate || !DotFilePatcher::writeVecGfxFigure(t,m_baseName,absBaseName())) { int figId = DotManager::instance()-> - createFilePatcher(m_fileName.data())-> + createFilePatcher(m_fileName)-> addFigure(m_baseName,absBaseName(),FALSE /*TRUE*/); t << "\n% FIG " << figId << "\n"; } } } -void DotGraph::writeGraphHeader(std::ostream &t,const QCString &title) +void DotGraph::writeGraphHeader(TextStream &t,const QCString &title) { int fontSize = Config_getInt(DOT_FONTSIZE); QCString fontName = Config_getString(DOT_FONTNAME); @@ -292,7 +297,7 @@ void DotGraph::writeGraphHeader(std::ostream &t,const QCString &title) "fontsize=\"" << fontSize << "\",shape=record];\n"; } -void DotGraph::writeGraphFooter(std::ostream &t) +void DotGraph::writeGraphFooter(TextStream &t) { t << "}\n"; } @@ -307,7 +312,7 @@ void DotGraph::computeGraph(DotNode *root, QCString &graphStr) { //printf("computeMd5Signature\n"); - std::ostringstream md5stream(std::ios_base::ate); + TextStream md5stream; writeGraphHeader(md5stream,title); if (!rank.isEmpty()) { @@ -323,7 +328,7 @@ void DotGraph::computeGraph(DotNode *root, { const auto &children = pn->children(); auto child_it = std::find(children.begin(),children.end(),root); - int index = child_it - children.begin(); + size_t index = child_it - children.begin(); root->writeArrow(md5stream, // stream gt, // graph type format, // output format diff --git a/src/dotgraph.h b/src/dotgraph.h index 176d776..2a77504 100644 --- a/src/dotgraph.h +++ b/src/dotgraph.h @@ -22,6 +22,7 @@ #include "dir.h" class DotNode; +class TextStream; enum GraphOutputFormat { GOF_BITMAP, GOF_EPS }; enum EmbeddedOutputFormat { EOF_Html, EOF_LaTeX, EOF_Rtf, EOF_DocBook }; @@ -39,18 +40,18 @@ class DotGraph /** returns node numbers. The Counter is reset by the constructor */ int getNextNodeNumber() { return ++m_curNodeNumber; } - QCString writeGraph(std::ostream &t, + QCString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, - const char *path, - const char *fileName, - const char *relPath, + const QCString &path, + const QCString &fileName, + const QCString &relPath, bool writeImageMap=TRUE, int graphId=-1 ); - static void writeGraphHeader(std::ostream& t, const QCString& title = QCString()); - static void writeGraphFooter(std::ostream& t); + static void writeGraphHeader(TextStream& t, const QCString& title = QCString()); + static void writeGraphFooter(TextStream& t); static void computeGraph(DotNode* root, GraphType gt, GraphOutputFormat format, @@ -97,7 +98,7 @@ class DotGraph DotGraph &operator=(const DotGraph &); bool prepareDotFile(); - void generateCode(std::ostream &t); + void generateCode(TextStream &t); int m_curNodeNumber = 0; }; diff --git a/src/dotgroupcollaboration.cpp b/src/dotgroupcollaboration.cpp index 9ee0bba..d409d50 100644 --- a/src/dotgroupcollaboration.cpp +++ b/src/dotgroupcollaboration.cpp @@ -13,8 +13,6 @@ * */ -#include <sstream> - #include "dotgroupcollaboration.h" #include "classlist.h" #include "doxygen.h" @@ -22,6 +20,7 @@ #include "pagedef.h" #include "util.h" #include "config.h" +#include "textstream.h" DotGroupCollaboration::DotGroupCollaboration(const GroupDef* gd) { @@ -209,7 +208,7 @@ QCString DotGroupCollaboration::getBaseName() const void DotGroupCollaboration::computeTheGraph() { - std::ostringstream md5stream(std::ios_base::ate); + TextStream md5stream; writeGraphHeader(md5stream,m_rootNode->label()); // clean write flags @@ -240,9 +239,9 @@ QCString DotGroupCollaboration::getMapLabel() const return escapeCharsInString(m_baseName, FALSE); } -QCString DotGroupCollaboration::writeGraph( std::ostream &t, +QCString DotGroupCollaboration::writeGraph( TextStream &t, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, - const char *path, const char *fileName, const char *relPath, + const QCString &path, const QCString &fileName, const QCString &relPath, bool generateImageMap,int graphId) { m_doNotAddImageToIndex = TRUE; @@ -250,7 +249,7 @@ QCString DotGroupCollaboration::writeGraph( std::ostream &t, return DotGraph::writeGraph(t, graphFormat, textFormat, path, fileName, relPath, generateImageMap, graphId); } -void DotGroupCollaboration::Edge::write( std::ostream &t ) const +void DotGroupCollaboration::Edge::write( TextStream &t ) const { const char* linkTypeColor[] = { "darkorchid3" @@ -315,7 +314,7 @@ bool DotGroupCollaboration::isTrivial() const return m_usedNodes.size() <= 1; } -void DotGroupCollaboration::writeGraphHeader(std::ostream &t,const QCString &title) const +void DotGroupCollaboration::writeGraphHeader(TextStream &t,const QCString &title) const { int fontSize = Config_getInt(DOT_FONTSIZE); QCString fontName = Config_getString(DOT_FONTNAME); diff --git a/src/dotgroupcollaboration.h b/src/dotgroupcollaboration.h index 3d83673..872e7f7 100644 --- a/src/dotgroupcollaboration.h +++ b/src/dotgroupcollaboration.h @@ -16,20 +16,20 @@ #ifndef DOTGROUPCOLLABORATION_H #define DOTGROUPCOLLABORATION_H -#include <iostream> - #include "dotnode.h" #include "dotgraph.h" #include "groupdef.h" +class TextStream; + /** Representation of a group collaboration graph */ class DotGroupCollaboration : public DotGraph { public : DotGroupCollaboration(const GroupDef* gd); ~DotGroupCollaboration(); - QCString writeGraph(std::ostream &t, GraphOutputFormat gf,EmbeddedOutputFormat ef, - const char *path,const char *fileName,const char *relPath, + QCString writeGraph(TextStream &t, GraphOutputFormat gf,EmbeddedOutputFormat ef, + const QCString &path,const QCString &fileName,const QCString &relPath, bool writeImageMap=TRUE,int graphId=-1); bool isTrivial() const; @@ -52,7 +52,7 @@ class DotGroupCollaboration : public DotGraph struct Link { - Link(const QCString lab,const QCString &u) : label(lab), url(u) {} + Link(const QCString &lab,const QCString &u) : label(lab), url(u) {} QCString label; QCString url; }; @@ -67,13 +67,13 @@ class DotGroupCollaboration : public DotGraph EdgeType eType; std::vector<Link> links; - void write( std::ostream &t ) const; + void write( TextStream &t ) const; }; void buildGraph(const GroupDef* gd); void addCollaborationMember(const Definition* def, QCString& url, EdgeType eType ); void addMemberList( class MemberList* ml ); - void writeGraphHeader(std::ostream &t,const QCString &title) const; + void writeGraphHeader(TextStream &t,const QCString &title) const; Edge* addEdge( DotNode* _pNStart, DotNode* _pNEnd, EdgeType _eType, const QCString& _label, const QCString& _url ); diff --git a/src/dotincldepgraph.cpp b/src/dotincldepgraph.cpp index 4f6b8c3..5a2f7ca 100644 --- a/src/dotincldepgraph.cpp +++ b/src/dotincldepgraph.cpp @@ -17,6 +17,7 @@ #include "dotnode.h" #include "util.h" #include "config.h" +#include "textstream.h" void DotInclDepGraph::buildGraph(DotNode *n,const FileDef *fd,int distance) { @@ -25,7 +26,7 @@ void DotInclDepGraph::buildGraph(DotNode *n,const FileDef *fd,int distance) { const FileDef *bfd = ii.fileDef; QCString in = ii.includeName; - //printf(">>>> in='%s' bfd=%p\n",ii->includeName.data(),bfd); + //printf(">>>> in='%s' bfd=%p\n",qPrint(ii->includeName),bfd); bool doc=TRUE,src=FALSE; if (bfd) { @@ -36,7 +37,7 @@ void DotInclDepGraph::buildGraph(DotNode *n,const FileDef *fd,int distance) if (doc || src || !Config_getBool(HIDE_UNDOC_RELATIONS)) { QCString url=""; - if (bfd) url=bfd->getOutputFileBase().copy(); + if (bfd) url=bfd->getOutputFileBase(); if (!doc && src) { url=bfd->getSourceFileBase(); @@ -45,7 +46,7 @@ void DotInclDepGraph::buildGraph(DotNode *n,const FileDef *fd,int distance) if (it!=m_usedNodes.end()) // file is already a node in the graph { DotNode *bn = it->second; - n->addChild(bn,0,0,0); + n->addChild(bn,0,0); bn->addParent(n); bn->setDistance(distance); } @@ -64,7 +65,7 @@ void DotInclDepGraph::buildGraph(DotNode *n,const FileDef *fd,int distance) tmp_url, // url FALSE, // rootNode 0); // cd - n->addChild(bn,0,0,0); + n->addChild(bn,0,0); bn->addParent(n); m_usedNodes.insert(std::make_pair(in.str(),bn)); bn->setDistance(distance); @@ -130,7 +131,7 @@ DotInclDepGraph::DotInclDepGraph(const FileDef *fd,bool inverse) m_startNode = new DotNode(getNextNodeNumber(), fd->docName(), tooltip, - tmp_url.data(), + tmp_url, TRUE); // root node m_startNode->setDistance(0); m_usedNodes.insert(std::make_pair(fd->absFilePath().str(),m_startNode)); @@ -180,12 +181,12 @@ QCString DotInclDepGraph::getMapLabel() const } } -QCString DotInclDepGraph::writeGraph(std::ostream &out, +QCString DotInclDepGraph::writeGraph(TextStream &out, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, - const char *path, - const char *fileName, - const char *relPath, + const QCString &path, + const QCString &fileName, + const QCString &relPath, bool generateImageMap, int graphId) { @@ -207,7 +208,7 @@ int DotInclDepGraph::numNodes() const return (int)m_startNode->children().size(); } -void DotInclDepGraph::writeXML(std::ostream &t) +void DotInclDepGraph::writeXML(TextStream &t) { for (const auto &kv : m_usedNodes) { @@ -215,7 +216,7 @@ void DotInclDepGraph::writeXML(std::ostream &t) } } -void DotInclDepGraph::writeDocbook(std::ostream &t) +void DotInclDepGraph::writeDocbook(TextStream &t) { for (const auto &kv : m_usedNodes) { diff --git a/src/dotincldepgraph.h b/src/dotincldepgraph.h index f511608..a0e58bf 100644 --- a/src/dotincldepgraph.h +++ b/src/dotincldepgraph.h @@ -22,20 +22,22 @@ #include "dotnode.h" #include "dotgraph.h" +class TextStream; + /** Representation of an include dependency graph */ class DotInclDepGraph : public DotGraph { public: DotInclDepGraph(const FileDef *fd,bool inverse); ~DotInclDepGraph(); - QCString writeGraph(std::ostream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, - const char *path,const char *fileName,const char *relPath, + QCString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, + const QCString &path,const QCString &fileName,const QCString &relPath, bool writeImageMap=TRUE,int graphId=-1); bool isTrivial() const; bool isTooBig() const; int numNodes() const; - void writeXML(std::ostream &t); - void writeDocbook(std::ostream &t); + void writeXML(TextStream &t); + void writeDocbook(TextStream &t); protected: virtual QCString getBaseName() const; diff --git a/src/dotlegendgraph.cpp b/src/dotlegendgraph.cpp index 0389a1d..f512fa2 100644 --- a/src/dotlegendgraph.cpp +++ b/src/dotlegendgraph.cpp @@ -23,15 +23,15 @@ #include "language.h" #include "dotfilepatcher.h" -void DotLegendGraph::writeGraph(const char *path) +void DotLegendGraph::writeGraph(const QCString &path) { - std::ostringstream ts(std::ios_base::ate); + TextStream ts; DotGraph::writeGraph(ts, GOF_BITMAP, EOF_Html, path, "", "", FALSE, 0); if (getDotImageExtension()=="svg") { DotManager::instance()-> - createFilePatcher((absBaseName()+Config_getString(HTML_FILE_EXTENSION)).data())-> + createFilePatcher(absBaseName()+Config_getString(HTML_FILE_EXTENSION))-> addSVGObject("graph_legend", absImgName(),QCString()); } } @@ -45,7 +45,7 @@ void DotLegendGraph::computeTheGraph() { int fontSize = Config_getInt(DOT_FONTSIZE); QCString fontName = Config_getString(DOT_FONTNAME); - std::ostringstream md5stream(std::ios_base::ate); + TextStream md5stream; writeGraphHeader(md5stream,theTranslator->trLegendTitle()); md5stream << " Node9 [shape=\"box\",label=\"Inherited\",fontsize=\"" << fontSize << "\",height=0.2,width=0.4,fontname=\"" << fontName << "\",fillcolor=\"grey75\",style=\"filled\" fontcolor=\"black\"];\n"; md5stream << " Node10 -> Node9 [dir=\"back\",color=\"midnightblue\",fontsize=\"" << fontSize << "\",style=\"solid\",fontname=\"" << fontName << "\"];\n"; diff --git a/src/dotlegendgraph.h b/src/dotlegendgraph.h index 2d8eeec..2adf625 100644 --- a/src/dotlegendgraph.h +++ b/src/dotlegendgraph.h @@ -22,7 +22,7 @@ class DotLegendGraph : public DotGraph { public: - void writeGraph(const char *path); + void writeGraph(const QCString &path); private: virtual QCString getBaseName() const; diff --git a/src/dotnode.cpp b/src/dotnode.cpp index 234dff0..bfc7c08 100644 --- a/src/dotnode.cpp +++ b/src/dotnode.cpp @@ -21,6 +21,7 @@ #include "language.h" #include "doxygen.h" #include "util.h" +#include "textstream.h" /** Helper struct holding the properties of a edge in a dot graph. */ struct EdgeProperties @@ -121,9 +122,9 @@ static UmlDetailLevel getUmlDetailLevelFromConfig() static QCString escapeTooltip(const QCString &tooltip) { + if (tooltip.isEmpty()) return tooltip; QCString result; const char *p=tooltip.data(); - if (p==0) return result; char c; while ((c=*p++)) { @@ -137,7 +138,7 @@ static QCString escapeTooltip(const QCString &tooltip) return result; } -static void writeBoxMemberList(std::ostream &t, +static void writeBoxMemberList(TextStream &t, char prot,const MemberList *ml,const ClassDef *scope, bool isStatic=FALSE,const StringUnorderedSet *skipNames=nullptr) { @@ -285,7 +286,7 @@ static QCString stripProtectionPrefix(const QCString &s) } } -DotNode::DotNode(int n,const char *lab,const char *tip, const char *url, +DotNode::DotNode(int n,const QCString &lab,const QCString &tip, const QCString &url, bool isRoot,const ClassDef *cd) : m_number(n) , m_label(lab) @@ -303,8 +304,8 @@ DotNode::~DotNode() void DotNode::addChild(DotNode *n, int edgeColor, int edgeStyle, - const char *edgeLab, - const char *edgeURL, + const QCString &edgeLab, + const QCString &edgeURL, int edgeLabCol ) { @@ -360,7 +361,7 @@ void DotNode::setDistance(int distance) inline int DotNode::findParent( DotNode *n ) { auto it = std::find(m_parents.begin(),m_parents.end(),n); - return it!=m_parents.end() ? it-m_parents.begin() : -1; + return it!=m_parents.end() ? static_cast<int>(it-m_parents.begin()) : -1; } /*! helper function that deletes all nodes in a connected graph, given @@ -376,7 +377,7 @@ void DotNode::deleteNodes(DotNode *node) } } -void DotNode::writeBox(std::ostream &t, +void DotNode::writeBox(TextStream &t, GraphType gt, GraphOutputFormat /*format*/, bool hasNonReachableChildren) const @@ -410,7 +411,7 @@ void DotNode::writeBox(std::ostream &t, } } - //printf("DotNode::writeBox for %s\n",m_classDef->name().data()); + //printf("DotNode::writeBox for %s\n",qPrint(m_classDef->name())); t << "{" << convertLabel(m_label) << "\\n"; if (getUmlDetailLevelFromConfig()!=UmlDetailLevel::None) { @@ -501,7 +502,7 @@ void DotNode::writeBox(std::ostream &t, t << "];\n"; } -void DotNode::writeArrow(std::ostream &t, +void DotNode::writeArrow(TextStream &t, GraphType gt, GraphOutputFormat format, const DotNode *cn, @@ -550,14 +551,14 @@ void DotNode::writeArrow(std::ostream &t, t << "];\n"; } -void DotNode::write(std::ostream &t, +void DotNode::write(TextStream &t, GraphType gt, GraphOutputFormat format, bool topDown, bool toChildren, bool backArrows) const { - //printf("DotNode::write(%d) name=%s this=%p written=%d visible=%d\n",m_distance,m_label.data(),this,m_written,m_visible); + //printf("DotNode::write(%d) name=%s this=%p written=%d visible=%d\n",m_distance,qPrint(m_label),this,m_written,m_visible); if (m_written) return; // node already written to the output if (!m_visible) return; // node is not visible writeBox(t,gt,format,m_truncated==Truncated); @@ -569,7 +570,7 @@ void DotNode::write(std::ostream &t, { if (cn->isVisible()) { - //printf("write arrow %s%s%s\n",label().data(),backArrows?"<-":"->",cn->label().data()); + //printf("write arrow %s%s%s\n",qPrint(label()),backArrows?"<-":"->",qPrint(cn->label())); writeArrow(t,gt,format,cn,&(*it),topDown,backArrows); } cn->write(t,gt,format,topDown,toChildren,backArrows); @@ -584,8 +585,8 @@ void DotNode::write(std::ostream &t, { const auto &children = pn->children(); auto child_it = std::find(children.begin(),children.end(),this); - int index = child_it - children.begin(); - //printf("write arrow %s%s%s\n",label().data(),backArrows?"<-":"->",pn->label().data()); + size_t index = child_it - children.begin(); + //printf("write arrow %s%s%s\n",qPrint(label()),backArrows?"<-":"->",qPrint(pn->label())); writeArrow(t, gt, format, @@ -598,25 +599,23 @@ void DotNode::write(std::ostream &t, pn->write(t,gt,format,TRUE,FALSE,backArrows); } } - //printf("end DotNode::write(%d) name=%s\n",distance,m_label.data()); + //printf("end DotNode::write(%d) name=%s\n",distance,qPrint(m_label)); } -void DotNode::writeXML(std::ostream &t,bool isClassGraph) const +void DotNode::writeXML(TextStream &t,bool isClassGraph) const { t << " <node id=\"" << m_number << "\">\n"; t << " <label>" << convertToXML(m_label) << "</label>\n"; if (!m_url.isEmpty()) { QCString url(m_url); - const char *refPtr = url.data(); - char *urlPtr = strchr(url.rawData(),'$'); - if (urlPtr) + int dollarPos = url.find('$'); + if (dollarPos!=-1) { - *urlPtr++='\0'; - t << " <link refid=\"" << convertToXML(urlPtr) << "\""; - if (*refPtr!='\0') + t << " <link refid=\"" << convertToXML(url.mid(dollarPos+1)) << "\""; + if (dollarPos>0) { - t << " external=\"" << convertToXML(refPtr) << "\""; + t << " external=\"" << convertToXML(url.left(dollarPos)) << "\""; } t << "/>\n"; } @@ -665,22 +664,20 @@ void DotNode::writeXML(std::ostream &t,bool isClassGraph) const t << " </node>\n"; } -void DotNode::writeDocbook(std::ostream &t,bool isClassGraph) const +void DotNode::writeDocbook(TextStream &t,bool isClassGraph) const { t << " <node id=\"" << m_number << "\">\n"; t << " <label>" << convertToXML(m_label) << "</label>\n"; if (!m_url.isEmpty()) { QCString url(m_url); - const char *refPtr = url.data(); - char *urlPtr = strchr(url.rawData(),'$'); - if (urlPtr) + int dollarPos = url.find('$'); + if (dollarPos!=-1) { - *urlPtr++='\0'; - t << " <link refid=\"" << convertToXML(urlPtr) << "\""; - if (*refPtr!='\0') + t << " <link refid=\"" << convertToXML(url.mid(dollarPos+1)) << "\""; + if (dollarPos>0) { - t << " external=\"" << convertToXML(refPtr) << "\""; + t << " external=\"" << convertToXML(url.left(dollarPos)) << "\""; } t << "/>\n"; } @@ -730,7 +727,7 @@ void DotNode::writeDocbook(std::ostream &t,bool isClassGraph) const } -void DotNode::writeDEF(std::ostream &t) const +void DotNode::writeDEF(TextStream &t) const { const char* nodePrefix = " node-"; @@ -741,18 +738,15 @@ void DotNode::writeDEF(std::ostream &t) const if (!m_url.isEmpty()) { QCString url(m_url); - const char *refPtr = url.data(); - char *urlPtr = strchr(url.rawData(),'$'); - if (urlPtr) + int dollarPos = url.find('$'); + if (dollarPos!=-1) { - *urlPtr++='\0'; t << nodePrefix << "link = {\n" << " " - << nodePrefix << "link-id = '" << urlPtr << "';\n"; - - if (*refPtr!='\0') + << nodePrefix << "link-id = '" << url.mid(dollarPos+1) << "';\n"; + if (dollarPos>0) { t << " " << nodePrefix << "link-external = '" - << refPtr << "';\n"; + << url.left(dollarPos) << "';\n"; } t << " };\n"; } @@ -806,7 +800,7 @@ void DotNode::colorConnectedNodes(int curColor) cn->setSubgraphId(curColor); cn->markAsVisible(); cn->colorConnectedNodes(curColor); - //printf("coloring node %s (%p): %d\n",cn->label().data(),cn,cn->subgraphId()); + //printf("coloring node %s (%p): %d\n",qPrint(cn->label()),cn,cn->subgraphId()); } } @@ -817,7 +811,7 @@ void DotNode::colorConnectedNodes(int curColor) pn->setSubgraphId(curColor); pn->markAsVisible(); pn->colorConnectedNodes(curColor); - //printf("coloring node %s (%p): %d\n",pn->label().data(),pn,pn->subgraphId()); + //printf("coloring node %s (%p): %d\n",qPrint(pn->label()),pn,pn->subgraphId()); } } } @@ -838,7 +832,7 @@ void DotNode::renumberNodes(int &number) const DotNode *DotNode::findDocNode() const { if (!m_url.isEmpty()) return this; - //printf("findDocNode(): '%s'\n",m_label.data()); + //printf("findDocNode(): '%s'\n",qPrint(m_label)); for (const auto &pn : m_parents) { if (!pn->hasDocumentation()) diff --git a/src/dotnode.h b/src/dotnode.h index bfe5af4..cd1e75b 100644 --- a/src/dotnode.h +++ b/src/dotnode.h @@ -25,6 +25,7 @@ class ClassDef; class DotNode; +class TextStream; /** Attributes of an edge of a dot graph */ class EdgeInfo @@ -57,7 +58,7 @@ class DotNode public: static void deleteNodes(DotNode* node); static QCString convertLabel(const QCString& l); - DotNode(int n,const char *lab,const char *tip,const char *url, + DotNode(int n,const QCString &lab,const QCString &tip,const QCString &url, bool rootNode=FALSE,const ClassDef *cd=0); ~DotNode(); @@ -66,8 +67,8 @@ class DotNode void addChild(DotNode *n, int edgeColor=EdgeInfo::Purple, int edgeStyle=EdgeInfo::Solid, - const char *edgeLab=0, - const char *edgeURL=0, + const QCString &edgeLab=QCString(), + const QCString &edgeURL=QCString(), int edgeLabCol=-1); void addParent(DotNode *n); void deleteNode(DotNodeRefVector &deletedList); @@ -75,14 +76,14 @@ class DotNode void removeParent(DotNode *n); int findParent( DotNode *n ); - void write(std::ostream &t,GraphType gt,GraphOutputFormat f, + void write(TextStream &t,GraphType gt,GraphOutputFormat f, bool topDown,bool toChildren,bool backArrows) const; - void writeXML(std::ostream &t,bool isClassGraph) const; - void writeDocbook(std::ostream &t,bool isClassGraph) const; - void writeDEF(std::ostream &t) const; - void writeBox(std::ostream &t,GraphType gt,GraphOutputFormat f, + void writeXML(TextStream &t,bool isClassGraph) const; + void writeDocbook(TextStream &t,bool isClassGraph) const; + void writeDEF(TextStream &t) const; + void writeBox(TextStream &t,GraphType gt,GraphOutputFormat f, bool hasNonReachableChildren) const; - void writeArrow(std::ostream &t,GraphType gt,GraphOutputFormat f,const DotNode *cn, + void writeArrow(TextStream &t,GraphType gt,GraphOutputFormat f,const DotNode *cn, const EdgeInfo *ei,bool topDown, bool pointBack=TRUE) const; QCString label() const { return m_label; } diff --git a/src/dotrunner.cpp b/src/dotrunner.cpp index 7c31c85..f9f077d 100644 --- a/src/dotrunner.cpp +++ b/src/dotrunner.cpp @@ -33,7 +33,7 @@ // since dot silently reproduces the input file when it does not // support the PNG format, we need to check the result. -static void checkPngResult(const char *imgName) +static void checkPngResult(const QCString &imgName) { FILE *f = Portable::fopen(imgName,"rb"); if (f) @@ -46,43 +46,43 @@ static void checkPngResult(const char *imgName) err("Image '%s' produced by dot is not a valid PNG!\n" "You should either select a different format " "(DOT_IMAGE_FORMAT in the config file) or install a more " - "recent version of graphviz (1.7+)\n",imgName + "recent version of graphviz (1.7+)\n",qPrint(imgName) ); } } else { - err("Could not read image '%s' generated by dot!\n",imgName); + err("Could not read image '%s' generated by dot!\n",qPrint(imgName)); } fclose(f); } else { - err("Could not open image '%s' generated by dot!\n",imgName); + err("Could not open image '%s' generated by dot!\n",qPrint(imgName)); } } -static bool resetPDFSize(const int width,const int height, const char *base) +static bool resetPDFSize(const int width,const int height, const QCString &base) { - std::string tmpName = std::string(base)+".tmp"; - std::string patchFile = std::string(base)+".dot"; + std::string tmpName = base.str()+".tmp"; + std::string patchFile = base.str()+".dot"; Dir thisDir; if (!thisDir.rename(patchFile,tmpName)) { - err("Failed to rename file %s to %s!\n",patchFile.data(),tmpName.data()); + err("Failed to rename file %s to %s!\n",qPrint(patchFile),qPrint(tmpName)); return FALSE; } std::ifstream fi(tmpName,std::ifstream::in); std::ofstream t(patchFile,std::ofstream::out | std::ofstream::binary); if (!fi.is_open()) { - err("problem opening file %s for patching!\n",tmpName.data()); + err("problem opening file %s for patching!\n",qPrint(tmpName)); thisDir.rename(tmpName,patchFile); return FALSE; } if (!t.is_open()) { - err("problem opening file %s for patching!\n",patchFile.data()); + err("problem opening file %s for patching!\n",qPrint(patchFile)); thisDir.rename(tmpName,patchFile); return FALSE; } @@ -104,7 +104,7 @@ static bool resetPDFSize(const int width,const int height, const char *base) return TRUE; } -bool DotRunner::readBoundingBox(const char *fileName,int *width,int *height,bool isEps) +bool DotRunner::readBoundingBox(const QCString &fileName,int *width,int *height,bool isEps) { const char *bb = isEps ? "%%PageBoundingBox:" : "/MediaBox ["; int bblen = (int)strlen(bb); @@ -131,23 +131,23 @@ bool DotRunner::readBoundingBox(const char *fileName,int *width,int *height,bool return TRUE; } } - err("Failed to extract bounding box from generated diagram file %s\n",fileName); + err("Failed to extract bounding box from generated diagram file %s\n",qPrint(fileName)); fclose(f); return FALSE; } //--------------------------------------------------------------------------------- -DotRunner::DotRunner(const std::string& absDotName, const std::string& md5Hash) - : m_file(absDotName.data()) - , m_md5Hash(md5Hash.data()) +DotRunner::DotRunner(const QCString& absDotName, const QCString& md5Hash) + : m_file(absDotName) + , m_md5Hash(md5Hash) , m_dotExe(Config_getString(DOT_PATH)+"dot") , m_cleanUp(Config_getBool(DOT_CLEANUP)) { } -void DotRunner::addJob(const char *format, const char *output) +void DotRunner::addJob(const QCString &format, const QCString &output) { for (auto& s: m_jobs) @@ -157,8 +157,8 @@ void DotRunner::addJob(const char *format, const char *output) // we have this job already return; } - auto args = std::string ("-T") + format + " -o \"" + output + "\""; - m_jobs.emplace_back(format, output, args); + auto args = QCString("-T") + format + " -o \"" + output + "\""; + m_jobs.emplace_back(format.str(), output, args); } QCString getBaseNameOfOutput(const QCString &output) @@ -177,20 +177,20 @@ bool DotRunner::run() // create output if (Config_getBool(DOT_MULTI_TARGETS)) { - dotArgs=QCString("\"")+m_file.data()+"\""; + dotArgs=QCString("\"")+m_file+"\""; for (auto& s: m_jobs) { dotArgs+=' '; - dotArgs+=s.args.data(); + dotArgs+=s.args; } - if ((exitCode=Portable::system(m_dotExe.data(),dotArgs,FALSE))!=0) goto error; + if ((exitCode=Portable::system(m_dotExe,dotArgs,FALSE))!=0) goto error; } else { for (auto& s : m_jobs) { - dotArgs=QCString("\"")+m_file.data()+"\" "+s.args.data(); - if ((exitCode=Portable::system(m_dotExe.data(),dotArgs,FALSE))!=0) goto error; + dotArgs=QCString("\"")+m_file+"\" "+s.args; + if ((exitCode=Portable::system(m_dotExe,dotArgs,FALSE))!=0) goto error; } } @@ -198,35 +198,35 @@ bool DotRunner::run() // As there should be only one pdf file be generated, we don't need code for regenerating multiple pdf files in one call for (auto& s : m_jobs) { - if (s.format.compare(0, 3, "pdf") == 0) + if (s.format.left(3)=="pdf") { int width=0,height=0; - if (!readBoundingBox(s.output.data(),&width,&height,FALSE)) goto error; + if (!readBoundingBox(s.output,&width,&height,FALSE)) goto error; if ((width > MAX_LATEX_GRAPH_SIZE) || (height > MAX_LATEX_GRAPH_SIZE)) { - if (!resetPDFSize(width,height,getBaseNameOfOutput(s.output.data()))) goto error; - dotArgs=QCString("\"")+m_file.data()+"\" "+s.args.data(); - if ((exitCode=Portable::system(m_dotExe.data(),dotArgs,FALSE))!=0) goto error; + if (!resetPDFSize(width,height,getBaseNameOfOutput(s.output))) goto error; + dotArgs=QCString("\"")+m_file+"\" "+s.args; + if ((exitCode=Portable::system(m_dotExe,dotArgs,FALSE))!=0) goto error; } } - if (s.format.compare(0, 3, "png") == 0) + if (s.format.left(3)=="png") { - checkPngResult(s.output.data()); + checkPngResult(s.output); } } // remove .dot files if (m_cleanUp) { - //printf("removing dot file %s\n",m_file.data()); - Portable::unlink(m_file.data()); + //printf("removing dot file %s\n",qPrint(m_file)); + Portable::unlink(m_file); } // create checksum file - if (!m_md5Hash.empty()) + if (!m_md5Hash.isEmpty()) { - QCString md5Name = getBaseNameOfOutput(m_file.data()) + ".md5"; + QCString md5Name = getBaseNameOfOutput(m_file) + ".md5"; FILE *f = Portable::fopen(md5Name,"w"); if (f) { @@ -237,7 +237,7 @@ bool DotRunner::run() return TRUE; error: err("Problems running dot: exit code=%d, command='%s', arguments='%s'\n", - exitCode,m_dotExe.data(),dotArgs.data()); + exitCode,qPrint(m_dotExe),qPrint(dotArgs)); return FALSE; } diff --git a/src/dotrunner.h b/src/dotrunner.h index 1b54617..19bdc79 100644 --- a/src/dotrunner.h +++ b/src/dotrunner.h @@ -24,26 +24,28 @@ #include <condition_variable> #include <memory> +#include "qcstring.h" + /** Helper class to run dot from doxygen from multiple threads. */ class DotRunner { struct DotJob { - DotJob(std::string f, std::string o, std::string a) + DotJob(const QCString &f, const QCString &o, const QCString &a) : format(f), output(o), args(a) {} - std::string format; - std::string output; - std::string args; + QCString format; + QCString output; + QCString args; }; public: /** Creates a runner for a dot \a file. */ - DotRunner(const std::string& absDotName, const std::string& md5Hash = std::string()); + DotRunner(const QCString & absDotName, const QCString& md5Hash = QCString()); /** Adds an additional job to the run. * Performing multiple jobs one file can be faster. */ - void addJob(const char *format,const char *output); + void addJob(const QCString &format,const QCString &output); /** Prevent cleanup of the dot file (for user provided dot files) */ void preventCleanUp() { m_cleanUp = false; } @@ -51,16 +53,15 @@ class DotRunner /** Runs dot for all jobs added. */ bool run(); - // DotConstString const& getFileName() { return m_file; } - std::string const & getMd5Hash() { return m_md5Hash; } + QCString getMd5Hash() { return m_md5Hash; } - static bool readBoundingBox(const char* fileName, int* width, int* height, bool isEps); + static bool readBoundingBox(const QCString &fileName, int* width, int* height, bool isEps); private: - std::string m_file; - std::string m_md5Hash; - std::string m_dotExe; - bool m_cleanUp; + QCString m_file; + QCString m_md5Hash; + QCString m_dotExe; + bool m_cleanUp; std::vector<DotJob> m_jobs; }; diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 34cea10..f003e8b 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -104,6 +104,7 @@ #include "regex.h" #include "fileinfo.h" #include "dir.h" +#include "conceptdef.h" #if USE_SQLITE3 #include <sqlite3.h> @@ -124,6 +125,7 @@ extern void initResources(); // globally accessible variables ClassLinkedMap *Doxygen::classLinkedMap = 0; ClassLinkedMap *Doxygen::hiddenClassLinkedMap = 0; +ConceptLinkedMap *Doxygen::conceptLinkedMap = 0; NamespaceLinkedMap *Doxygen::namespaceLinkedMap = 0; MemberNameLinkedMap *Doxygen::memberNameLinkedMap = 0; MemberNameLinkedMap *Doxygen::functionNameLinkedMap = 0; @@ -150,7 +152,6 @@ bool Doxygen::parseSourcesNeeded = FALSE; SearchIndexIntf *Doxygen::searchIndex=0; SymbolMap<Definition> Doxygen::symbolMap; ClangUsrMap *Doxygen::clangUsrMap = 0; -bool Doxygen::outputToWizard=FALSE; Cache<std::string,LookupInfo> *Doxygen::lookupCache; DirLinkedMap *Doxygen::dirLinkedMap; DirRelationLinkedMap Doxygen::dirRelations; @@ -184,6 +185,7 @@ void clearAll() Doxygen::classLinkedMap->clear(); Doxygen::hiddenClassLinkedMap->clear(); + Doxygen::conceptLinkedMap->clear(); Doxygen::namespaceLinkedMap->clear(); Doxygen::pageLinkedMap->clear(); Doxygen::exampleLinkedMap->clear(); @@ -245,7 +247,7 @@ class Statistics } g_s; -static void addMemberDocs(const Entry *root,MemberDefMutable *md, const char *funcDecl, +static void addMemberDocs(const Entry *root,MemberDefMutable *md, const QCString &funcDecl, const ArgumentList *al,bool over_load,uint64 spec); static void findMember(const Entry *root, const QCString &relates, @@ -306,7 +308,7 @@ static void addRelatedPage(Entry *root) { if (!g.groupname.isEmpty() && (gd=Doxygen::groupLinkedMap->find(g.groupname))) break; } - //printf("---> addRelatedPage() %s gd=%p\n",root->name.data(),gd); + //printf("---> addRelatedPage() %s gd=%p\n",qPrint(root->name),gd); QCString doc; if (root->brief.isEmpty()) { @@ -347,7 +349,7 @@ static void buildGroupListFiltered(const Entry *root,bool additional, bool inclu { GroupDef *gd = Doxygen::groupLinkedMap->find(root->name); //printf("Processing group '%s':'%s' add=%d ext=%d gd=%p\n", - // root->type.data(),root->name.data(),additional,includeExternal,gd); + // qPrint(root->type),qPrint(root->name),additional,includeExternal,gd); if (gd) { @@ -446,7 +448,7 @@ static void organizeSubGroupsFiltered(const Entry *root,bool additional) GroupDef *gd; if ((gd=Doxygen::groupLinkedMap->find(root->name))) { - //printf("adding %s to group %s\n",root->name.data(),gd->name().data()); + //printf("adding %s to group %s\n",qPrint(root->name),qPrint(gd->name())); addGroupToGroups(root,gd); } } @@ -485,7 +487,7 @@ static void buildFileList(const Entry *root) fd=findFileDef(Doxygen::inputNameLinkedMap,fn.left(newIndex) + "/" + root->name,ambig); if (!fd) ambig = save_ambig; } - //printf("**************** root->name=%s fd=%p\n",root->name.data(),fd); + //printf("**************** root->name=%s fd=%p\n",qPrint(root->name),fd); if (fd && !ambig) { //printf("Adding documentation!\n"); @@ -503,13 +505,12 @@ static void buildFileList(const Entry *root) { gd->addFile(fd); fd->makePartOfGroup(gd); - //printf("File %s: in group %s\n",fd->name().data(),s->data()); + //printf("File %s: in group %s\n",qPrint(fd->name()),qPrint(gd->name())); } } } else { - const char *fn = root->fileName.data(); QCString text(4096); text.sprintf("the name '%s' supplied as " "the argument in the \\file statement ", @@ -525,13 +526,14 @@ static void buildFileList(const Entry *root) { text+="is not an input file"; } - warn(fn,root->startLine,"%s", text.data()); + warn(root->fileName,root->startLine,"%s", qPrint(text)); } } for (const auto &e : root->children()) buildFileList(e.get()); } -static void addIncludeFile(ClassDefMutable *cd,FileDef *ifd,const Entry *root) +template<class DefMutable> +static void addIncludeFile(DefMutable *cd,FileDef *ifd,const Entry *root) { if ( (!root->doc.stripWhiteSpace().isEmpty() || @@ -540,7 +542,7 @@ static void addIncludeFile(ClassDefMutable *cd,FileDef *ifd,const Entry *root) ) && root->protection!=Private ) { - //printf(">>>>>> includeFile=%s\n",root->includeFile.data()); + //printf(">>>>>> includeFile=%s\n",qPrint(root->includeFile)); bool local=Config_getBool(FORCE_LOCAL_INCLUDES); QCString includeFile = root->includeFile; @@ -558,7 +560,7 @@ static void addIncludeFile(ClassDefMutable *cd,FileDef *ifd,const Entry *root) bool ambig; FileDef *fd=0; // see if we need to include a verbatim copy of the header file - //printf("root->includeFile=%s\n",root->includeFile.data()); + //printf("root->includeFile=%s\n",qPrint(root->includeFile)); if (!includeFile.isEmpty() && (fd=findFileDef(Doxygen::inputNameLinkedMap,includeFile,ambig))==0 ) @@ -579,7 +581,7 @@ static void addIncludeFile(ClassDefMutable *cd,FileDef *ifd,const Entry *root) { text+="is not an input file"; } - warn(root->fileName,root->startLine, "%s", text.data()); + warn(root->fileName,root->startLine, "%s", qPrint(text)); } else if (includeFile.isEmpty() && ifd && // see if the file extension makes sense @@ -639,7 +641,7 @@ static bool addNamespace(Entry *root,ClassDef *cd) { NamespaceDef *nd=0; QCString nsName = stripAnonymousNamespaceScope(e->name); - //printf("addNameSpace() trying: %s\n",nsName.data()); + //printf("addNameSpace() trying: %s\n",qPrint(nsName)); if (!nsName.isEmpty() && nsName.at(0)!='@' && (nd=getResolvedNamespace(nsName)) ) @@ -661,14 +663,14 @@ static bool addNamespace(Entry *root,ClassDef *cd) static Definition *findScope(Entry *root,int level=0) { if (root==0) return 0; - //printf("start findScope name=%s\n",root->name.data()); + //printf("start findScope name=%s\n",qPrint(root->name)); Definition *result=0; if (root->section&Entry::SCOPE_MASK) { result = findScope(root->parent,level+1); // traverse to the root of the tree if (result) { - //printf("Found %s inside %s at level %d\n",root->name.data(),result->name().data(),level); + //printf("Found %s inside %s at level %d\n",qPrint(root->name),qPrint(result->name()),level); // TODO: look at template arguments result = result->findInnerCompound(root->name); } @@ -676,11 +678,11 @@ static Definition *findScope(Entry *root,int level=0) { // TODO: look at template arguments result = Doxygen::globalScope->findInnerCompound(root->name); - //printf("Found in globalScope %s at level %d\n",result->name().data(),level); + //printf("Found in globalScope %s at level %d\n",qPrint(result->name()),level); } } - //printf("end findScope(%s,%d)=%s\n",root->name.data(), - // level,result==0 ? "<none>" : result->name().data()); + //printf("end findScope(%s,%d)=%s\n",qPrint(root->name), + // level,result==0 ? "<none>" : qPrint(result->name())); return result; } #endif @@ -703,7 +705,7 @@ QCString stripTemplateSpecifiers(const QCString &s) } if (c=='>' && round==0 && count>0) count--; } - //printf("stripTemplateSpecifiers(%s)=%s\n",s.data(),result.data()); + //printf("stripTemplateSpecifiers(%s)=%s\n",qPrint(s),qPrint(result)); return result; } @@ -711,11 +713,11 @@ QCString stripTemplateSpecifiers(const QCString &s) * full qualified name \a name. Creates an artificial scope if the scope is * not found and set the parent/child scope relation if the scope is found. */ -static Definition *buildScopeFromQualifiedName(const QCString name_,SrcLangExt lang,const TagInfo *tagInfo) +static Definition *buildScopeFromQualifiedName(const QCString &name_,SrcLangExt lang,const TagInfo *tagInfo) { QCString name = stripTemplateSpecifiers(name_); int level = name.contains("::"); - //printf("buildScopeFromQualifiedName(%s) level=%d\n",name.data(),level); + //printf("buildScopeFromQualifiedName(%s) level=%d\n",qPrint(name),level); int i=0; int p=0,l; Definition *prevScope=Doxygen::globalScope; @@ -739,7 +741,7 @@ static Definition *buildScopeFromQualifiedName(const QCString name_,SrcLangExt l else if (nd==0 && cd==0 && fullScope.find('<')==-1) // scope is not known and could be a namespace! { // introduce bogus namespace - //printf("++ adding dummy namespace %s to %s tagInfo=%p\n",nsName.data(),prevScope->name().data(),tagInfo); + //printf("++ adding dummy namespace %s to %s tagInfo=%p\n",qPrint(nsName),qPrint(prevScope->name()),tagInfo); NamespaceDefMutable *newNd= toNamespaceDefMutable( Doxygen::namespaceLinkedMap->add(fullScope, @@ -784,7 +786,7 @@ static Definition *buildScopeFromQualifiedName(const QCString name_,SrcLangExt l static Definition *findScopeFromQualifiedName(NamespaceDefMutable *startScope,const QCString &n, FileDef *fileScope,const TagInfo *tagInfo) { - //printf("<findScopeFromQualifiedName(%s,%s)\n",startScope ? startScope->name().data() : 0, n.data()); + //printf("<findScopeFromQualifiedName(%s,%s)\n",startScope ? qPrint(startScope->name()) : 0, qPrint(n)); Definition *resultScope=toDefinition(startScope); if (resultScope==0) resultScope=Doxygen::globalScope; QCString scope=stripTemplateSpecifiersFromScope(n,FALSE); @@ -800,7 +802,7 @@ static Definition *findScopeFromQualifiedName(NamespaceDefMutable *startScope,co { QCString nestedNameSpecifier = scope.mid(i1,l1); Definition *orgScope = resultScope; - //printf(" nestedNameSpecifier=%s\n",nestedNameSpecifier.data()); + //printf(" nestedNameSpecifier=%s\n",qPrint(nestedNameSpecifier)); resultScope = const_cast<Definition*>(resultScope->findInnerCompound(nestedNameSpecifier)); //printf(" resultScope=%p\n",resultScope); if (resultScope==0) @@ -818,7 +820,7 @@ static Definition *findScopeFromQualifiedName(NamespaceDefMutable *startScope,co // for a nested class A::I in used namespace N, we get // N::A::I while looking for A, so we should compare // resultScope->name() against scope.left(i2+l2) - //printf(" -> result=%s scope=%s\n",resultScope->name().data(),scope.data()); + //printf(" -> result=%s scope=%s\n",qPrint(resultScope->name()),qPrint(scope)); if (rightScopeMatch(resultScope->name(),scope.left(i2+l2))) { break; @@ -841,16 +843,16 @@ static Definition *findScopeFromQualifiedName(NamespaceDefMutable *startScope,co // so use this instead. QCString fqn = QCString(usedName) + scope.right(scope.length()-p); resultScope = buildScopeFromQualifiedName(fqn,startScope->getLanguage(),0); - //printf("Creating scope from fqn=%s result %p\n",fqn.data(),resultScope); + //printf("Creating scope from fqn=%s result %p\n",qPrint(fqn),resultScope); if (resultScope) { - //printf("> Match! resultScope=%s\n",resultScope->name().data()); + //printf("> Match! resultScope=%s\n",qPrint(resultScope->name())); return resultScope; } } } - //printf("> name %s not found in scope %s\n",nestedNameSpecifier.data(),orgScope->name().data()); + //printf("> name %s not found in scope %s\n",qPrint(nestedNameSpecifier),qPrint(orgScope->name())); return 0; } nextFragment: @@ -858,7 +860,7 @@ static Definition *findScopeFromQualifiedName(NamespaceDefMutable *startScope,co l1=l2; p=i2+l2; } - //printf(">findScopeFromQualifiedName scope %s\n",resultScope->name().data()); + //printf(">findScopeFromQualifiedName scope %s\n",qPrint(resultScope->name())); return resultScope; } @@ -983,7 +985,7 @@ static void addClassToContext(const Entry *root) Debug::print(Debug::Classes,0," Existing class %s!\n",qPrint(cd->name())); //if (cd->templateArguments()==0) //{ - // //printf("existing ClassDef tempArgList=%p specScope=%s\n",root->tArgList,root->scopeSpec.data()); + // //printf("existing ClassDef tempArgList=%p specScope=%s\n",root->tArgList,qPrint(root->scopeSpec)); // cd->setTemplateArguments(tArgList); //} @@ -1011,6 +1013,10 @@ static void addClassToContext(const Entry *root) cd->setTemplateArguments(*tArgList); } } + if (cd->requiresClause().isEmpty() && !root->req.isEmpty()) + { + cd->setRequiresClause(root->req); + } cd->setCompoundType(convertToCompoundType(root->section,root->spec)); @@ -1025,7 +1031,7 @@ static void addClassToContext(const Entry *root) extractNamespaceName(fullName,className,namespaceName); //printf("New class: fullname %s namespace '%s' name='%s' brief='%s' docs='%s'\n", - // fullName.data(),namespaceName.data(),className.data(),root->brief.data(),root->doc.data()); + // qPrint(fullName),qPrint(namespaceName),qPrint(className),qPrint(root->brief),qPrint(root->doc)); QCString tagName; QCString refFileName; @@ -1055,7 +1061,7 @@ static void addClassToContext(const Entry *root) tArgList = getTemplateArgumentsFromName(fullName,root->tArgLists); } // add class to the list - //printf("ClassDict.insert(%s)\n",fullName.data()); + //printf("ClassDict.insert(%s)\n",qPrint(fullName)); cd = toClassDefMutable( Doxygen::classLinkedMap->add(fullName, std::unique_ptr<ClassDef>( @@ -1073,14 +1079,15 @@ static void addClassToContext(const Entry *root) cd->setArtificial(root->artificial); cd->setClassSpecifier(root->spec); cd->setTypeConstraints(root->typeConstr); - //printf("new ClassDef %s tempArgList=%p specScope=%s\n",fullName.data(),root->tArgList,root->scopeSpec.data()); + //printf("new ClassDef %s tempArgList=%p specScope=%s\n",qPrint(fullName),root->tArgList,qPrint(root->scopeSpec)); - //printf("class %s template args=%s\n",fullName.data(), - // tArgList ? tempArgListToString(tArgList,root->lang).data() : "<none>"); + //printf("class %s template args=%s\n",qPrint(fullName), + // tArgList ? tempArgListToString(tArgList,qPrint(root->lang)) : "<none>"); if (tArgList) { cd->setTemplateArguments(*tArgList); } + cd->setRequiresClause(root->req); cd->setProtection(root->protection); cd->setIsStatic(root->stat); @@ -1114,9 +1121,9 @@ static void addClassToContext(const Entry *root) if (fd && (root->section & Entry::COMPOUND_MASK)) { //printf(">> Inserting class '%s' in file '%s' (root->fileName='%s')\n", - // cd->name().data(), - // fd->name().data(), - // root->fileName.data() + // qPrint(cd->name()), + // qPrint(fd->name()), + // qPrint(root->fileName) // ); cd->setFileDef(fd); fd->insertClass(cd); @@ -1153,6 +1160,148 @@ static void buildClassDocList(const Entry *root) for (const auto &e : root->children()) buildClassDocList(e.get()); } +//---------------------------------------------------------------------- +// build a list of all classes mentioned in the documentation +// and all classes that have a documentation block before their definition. + +static void addConceptToContext(const Entry *root) +{ + FileDef *fd = root->fileDef(); + + QCString scName; + if (root->parent()->section&Entry::SCOPE_MASK) + { + scName=root->parent()->name; + } + + // name with scope (if not present already) + QCString qualifiedName = root->name; + if (!scName.isEmpty() && !leftScopeMatch(qualifiedName,scName)) + { + qualifiedName.prepend(scName+"::"); + } + + // see if we already found the concept before + ConceptDefMutable *cd = getConceptMutable(qualifiedName); + + Debug::print(Debug::Classes,0, " Found concept with name %s (qualifiedName=%s -> cd=%p)\n", + cd ? qPrint(cd->name()) : qPrint(root->name), qPrint(qualifiedName),cd); + + if (cd) + { + qualifiedName=cd->name(); + Debug::print(Debug::Classes,0," Existing concept %s!\n",qPrint(cd->name())); + + cd->setDocumentation(root->doc,root->docFile,root->docLine); + cd->setBriefDescription(root->brief,root->briefFile,root->briefLine); + + addIncludeFile(cd,fd,root); + } + else // new concept + { + QCString className; + QCString namespaceName; + extractNamespaceName(qualifiedName,className,namespaceName); + + //printf("New concept: fullname %s namespace '%s' name='%s' brief='%s' docs='%s'\n", + // qPrint(qualifiedName),qPrint(namespaceName),qPrint(className),qPrint(root->brief),qPrint(root->doc)); + + QCString tagName; + QCString refFileName; + const TagInfo *tagInfo = root->tagInfo(); + if (tagInfo) + { + tagName = tagInfo->tagName; + refFileName = tagInfo->fileName; + if (qualifiedName.find("::")!=-1) + // symbols imported via tag files may come without the parent scope, + // so we artificially create it here + { + buildScopeFromQualifiedName(qualifiedName,root->lang,tagInfo); + } + } + std::unique_ptr<ArgumentList> tArgList = getTemplateArgumentsFromName(qualifiedName,root->tArgLists); + // add concept to the list + //printf("ClassDict.insert(%s)\n",qPrint(fullName)); + cd = toConceptDefMutable( + Doxygen::conceptLinkedMap->add(qualifiedName, + std::unique_ptr<ConceptDef>( + createConceptDef(tagInfo?tagName:root->fileName,root->startLine,root->startColumn, + qualifiedName,tagName,refFileName)))); + if (cd) + { + Debug::print(Debug::Classes,0," New concept '%s' #tArgLists=%d tagInfo=%p\n", + qPrint(qualifiedName),root->tArgLists.size(),tagInfo); + cd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition + cd->setBriefDescription(root->brief,root->briefFile,root->briefLine); + cd->setLanguage(root->lang); + cd->setId(root->id); + cd->setHidden(root->hidden); + cd->setInitializer(root->initializer.str().c_str()); + if (tArgList) + { + cd->setTemplateArguments(*tArgList); + } + // file definition containing the class cd + cd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); + cd->setBodyDef(fd); + addIncludeFile(cd,fd,root); + + // also add namespace to the correct structural context + Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,qualifiedName,0,tagInfo); + if (d && d->definitionType()==Definition::TypeNamespace) + { + DefinitionMutable *dm = toDefinitionMutable(d); + if (dm) + { + dm->addInnerCompound(cd); + } + cd->setOuterScope(d); + } + } + else + { + Debug::print(Debug::Classes,0," Not added concept '%s', already exists (as alias)\n", qPrint(qualifiedName)); + } + } + + if (cd) + { + cd->addSectionsToDefinition(root->anchors); + if (fd) + { + //printf(">> Inserting concept '%s' in file '%s' (root->fileName='%s')\n", + // qPrint(cd->name()), + // qPrint(fd->name()), + // qPrint(root->fileName) + // ); + cd->setFileDef(fd); + fd->insertConcept(cd); + } + addConceptToGroups(root,cd); + cd->setRefItems(root->sli); + } +} +static void buildConceptList(const Entry *root) +{ + if (root->section & Entry::CONCEPT_SEC) + { + addConceptToContext(root); + } + for (const auto &e : root->children()) buildConceptList(e.get()); +} + +static void buildConceptDocList(const Entry *root) +{ + if (root->section & Entry::CONCEPTDOC_SEC) + { + addConceptToContext(root); + } + for (const auto &e : root->children()) buildConceptDocList(e.get()); +} + +//---------------------------------------------------------------------- + static void resolveClassNestingRelations() { ClassDefSet visitedClasses; @@ -1167,7 +1316,7 @@ static void resolveClassNestingRelations() { ClassAlias(const QCString &name,std::unique_ptr<ClassDef> cd,DefinitionMutable *ctx) : aliasFullName(name),aliasCd(std::move(cd)), aliasContext(ctx) {} - const QCString aliasFullName; + QCString aliasFullName; std::unique_ptr<ClassDef> aliasCd; DefinitionMutable *aliasContext; }; @@ -1178,13 +1327,13 @@ static void resolveClassNestingRelations() if (cd && visitedClasses.find(icd.get())==visitedClasses.end()) { QCString name = stripAnonymousNamespaceScope(icd->name()); - //printf("processing=%s, iteration=%d\n",cd->name().data(),iteration); + //printf("processing=%s, iteration=%d\n",qPrint(cd->name()),iteration); // also add class to the correct structural context Definition *d = findScopeFromQualifiedName(Doxygen::globalScope, name,icd->getFileDef(),0); if (d) { - //printf("****** adding %s to scope %s in iteration %d\n",cd->name().data(),d->name().data(),iteration); + //printf("****** adding %s to scope %s in iteration %d\n",qPrint(cd->name()),qPrint(d->name()),iteration); DefinitionMutable *dm = toDefinitionMutable(d); if (dm) { @@ -1223,7 +1372,7 @@ static void resolveClassNestingRelations() } //else //{ - // printf("****** ignoring %s: scope not (yet) found in iteration %d\n",cd->name().data(),iteration); + // printf("****** ignoring %s: scope not (yet) found in iteration %d\n",qPrint(cd->name()),iteration); //} } } @@ -1245,7 +1394,7 @@ static void resolveClassNestingRelations() if (cd && visitedClasses.find(icd.get())==visitedClasses.end()) { QCString name = stripAnonymousNamespaceScope(cd->name()); - //printf("processing unresolved=%s, iteration=%d\n",cd->name().data(),iteration); + //printf("processing unresolved=%s, iteration=%d\n",qPrint(cd->name()),iteration); /// create the scope artificially // anyway, so we can at least relate scopes properly. Definition *d = buildScopeFromQualifiedName(name,cd->getLanguage(),0); @@ -1262,7 +1411,7 @@ static void resolveClassNestingRelations() cd->setOuterScope(d); warn(cd->getDefFileName(),cd->getDefLine(), "Internal inconsistency: scope for class %s not " - "found!",name.data() + "found!",qPrint(name) ); } } @@ -1278,7 +1427,7 @@ void distributeClassGroupRelations() ClassDefSet visitedClasses; for (const auto &cd : *Doxygen::classLinkedMap) { - //printf("Checking %s\n",cd->name().data()); + //printf("Checking %s\n",qPrint(cd->name())); // distribute the group to nested classes as well if (visitedClasses.find(cd.get())==visitedClasses.end() && !cd->partOfGroups().empty()) { @@ -1289,7 +1438,7 @@ void distributeClassGroupRelations() ClassDefMutable *ncdm = toClassDefMutable(ncd); if (ncdm && ncdm->partOfGroups().empty()) { - //printf(" Adding %s to group '%s'\n",ncd->name().data(), + //printf(" Adding %s to group '%s'\n",qPrint(ncd->name()), // gd->groupTitle()); ncdm->makePartOfGroup(gd); const_cast<GroupDef*>(gd)->addClass(ncdm); @@ -1308,7 +1457,7 @@ static ClassDefMutable *createTagLessInstance(const ClassDef *rootCd,const Class if (fullName.right(2)=="::") fullName=fullName.left(fullName.length()-2); fullName+="."+fieldName; - //printf("** adding class %s based on %s\n",fullName.data(),templ->name().data()); + //printf("** adding class %s based on %s\n",qPrint(fullName),qPrint(templ->name())); ClassDefMutable *cd = toClassDefMutable( Doxygen::classLinkedMap->add(fullName, std::unique_ptr<ClassDef>( @@ -1352,7 +1501,7 @@ static ClassDefMutable *createTagLessInstance(const ClassDef *rootCd,const Class { for (const auto &md : *ml) { - //printf(" Member %s type=%s\n",md->name().data(),md->typeString()); + //printf(" Member %s type=%s\n",qPrint(md->name()),md->typeString()); MemberDefMutable *imd = createMemberDef(md->getDefFileName(),md->getDefLine(),md->getDefColumn(), md->typeString(),md->name(),md->argsString(),md->excpString(), md->protection(),md->virtualness(),md->isStatic(),Member, @@ -1365,6 +1514,7 @@ static ClassDefMutable *createTagLessInstance(const ClassDef *rootCd,const Class imd->setMemberSpecifiers(md->getMemberSpecifiers()); imd->setMemberGroupId(md->getMemberGroupId()); imd->setInitializer(md->initializer()); + imd->setRequiresClause(md->requiresClause()); imd->setMaxInitLines(md->initializerLines()); imd->setBitfields(md->bitfieldString()); imd->setLanguage(md->getLanguage()); @@ -1389,8 +1539,8 @@ static void processTagLessClasses(const ClassDef *rootCd, ClassDefMutable *tagParentCd, const QCString &prefix,int count) { - //printf("%d: processTagLessClasses %s\n",count,cd->name().data()); - //printf("checking members for %s\n",cd->name().data()); + //printf("%d: processTagLessClasses %s\n",count,qPrint(cd->name())); + //printf("checking members for %s\n",qPrint(cd->name())); if (tagParentCd && !cd->getClasses().empty()) { MemberList *ml = cd->getMemberList(MemberListType_pubAttribs); @@ -1403,19 +1553,19 @@ static void processTagLessClasses(const ClassDef *rootCd, { for (const auto &icd : cd->getClasses()) { - //printf(" member %s: type='%s'\n",md->name().data(),type.data()); - //printf(" comparing '%s'<->'%s'\n",type.data(),icd->name().data()); + //printf(" member %s: type='%s'\n",qPrint(md->name()),qPrint(type)); + //printf(" comparing '%s'<->'%s'\n",qPrint(type),qPrint(icd->name())); if (type.find(icd->name())!=-1) // matching tag less struct/union { QCString name = md->name(); if (md->isAnonymous()) name = "__unnamed" + name.right(name.length()-1)+"__"; if (!prefix.isEmpty()) name.prepend(prefix+"."); - //printf(" found %s for class %s\n",name.data(),cd->name().data()); + //printf(" found %s for class %s\n",qPrint(name),qPrint(cd->name())); ClassDefMutable *ncd = createTagLessInstance(rootCd,icd,name); if (ncd) { processTagLessClasses(rootCd,icd,ncd,name,count+1); - //printf(" addTagged %s to %s\n",ncd->name().data(),tagParentCd->name().data()); + //printf(" addTagged %s to %s\n",qPrint(ncd->name()),qPrint(tagParentCd->name())); ncd->setTagLessReference(icd); // replace tag-less type for generated/original member @@ -1498,7 +1648,7 @@ static void buildNamespaceList(const Entry *root) !root->name.isEmpty() ) { - //printf("** buildNamespaceList(%s)\n",root->name.data()); + //printf("** buildNamespaceList(%s)\n",qPrint(root->name)); QCString fName = root->name; if (root->section==Entry::PACKAGEDOC_SEC) @@ -1509,8 +1659,8 @@ static void buildNamespaceList(const Entry *root) QCString fullName = stripAnonymousNamespaceScope(fName); if (!fullName.isEmpty()) { - //printf("Found namespace %s in %s at line %d\n",root->name.data(), - // root->fileName.data(), root->startLine); + //printf("Found namespace %s in %s at line %d\n",qPrint(root->name), + // qPrint(root->fileName), root->startLine); NamespaceDef *ndi = Doxygen::namespaceLinkedMap->find(fullName); if (ndi) // existing namespace { @@ -1552,7 +1702,7 @@ static void buildNamespaceList(const Entry *root) tagName = tagInfo->tagName; tagFileName = tagInfo->fileName; } - //printf("++ new namespace %s lang=%s tagName=%s\n",fullName.data(),langToString(root->lang).data(),tagName.data()); + //printf("++ new namespace %s lang=%s tagName=%s\n",qPrint(fullName),qPrint(langToString(root->lang)),qPrint(tagName)); // add namespace to the list NamespaceDefMutable *nd = toNamespaceDefMutable( Doxygen::namespaceLinkedMap->add(fullName, @@ -1589,7 +1739,7 @@ static void buildNamespaceList(const Entry *root) // also add namespace to the correct structural context Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,fullName,0,tagInfo); - //printf("adding namespace %s to context %s\n",nd->name().data(),d?d->name().data():"<none>"); + //printf("adding namespace %s to context %s\n",qPrint(nd->name()),d?qPrint(d->name()):"<none>"); if (d==0) // we didn't find anything, create the scope artificially // anyway, so we can at least relate scopes properly. { @@ -1669,7 +1819,7 @@ static void findUsingDirectives(const Entry *root) if (root->section==Entry::USINGDIR_SEC) { //printf("Found using directive %s at line %d of %s\n", - // root->name.data(),root->startLine,root->fileName.data()); + // qPrint(root->name),root->startLine,qPrint(root->fileName)); QCString name=substitute(root->name,".","::"); if (name.right(2)=="::") { @@ -1705,7 +1855,7 @@ static void findUsingDirectives(const Entry *root) QCString scope=scopeOffset>0 ? nsName.left(scopeOffset)+"::" : QCString(); usingNd = getResolvedNamespace(scope+name); - //printf("Trying with scope='%s' usingNd=%p\n",(scope+name).data(),usingNd); + //printf("Trying with scope='%s' usingNd=%p\n",(scope+qPrint(name)),usingNd); if (scopeOffset==0) { scopeOffset=-1; @@ -1743,7 +1893,7 @@ static void findUsingDirectives(const Entry *root) usingNd = findUsedNamespace(fd->getUsedNamespaces(),name); } - //printf("%s -> %s\n",name.data(),usingNd?usingNd->name().data():"<none>"); + //printf("%s -> %s\n",qPrint(name),usingNd?qPrint(usingNd->name()):"<none>"); // add the namespace the correct scope if (usingNd) @@ -1751,18 +1901,18 @@ static void findUsingDirectives(const Entry *root) //printf("using fd=%p nd=%p\n",fd,nd); if (nd) { - //printf("Inside namespace %s\n",nd->name().data()); + //printf("Inside namespace %s\n",qPrint(nd->name())); nd->addUsingDirective(usingNd); } else if (fd) { - //printf("Inside file %s\n",fd->name().data()); + //printf("Inside file %s\n",qPrint(fd->name())); fd->addUsingDirective(usingNd); } } else // unknown namespace, but add it anyway. { - //printf("++ new unknown namespace %s lang=%s\n",name.data(),langToString(root->lang).data()); + //printf("++ new unknown namespace %s lang=%s\n",qPrint(name),qPrint(langToString(root->lang))); // add namespace to the list nd = toNamespaceDefMutable( Doxygen::namespaceLinkedMap->add(name, @@ -1773,7 +1923,7 @@ static void findUsingDirectives(const Entry *root) nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition nd->setBriefDescription(root->brief,root->briefFile,root->briefLine); nd->addSectionsToDefinition(root->anchors); - //printf("** Adding namespace %s hidden=%d\n",name.data(),root->hidden); + //printf("** Adding namespace %s hidden=%d\n",qPrint(name),root->hidden); nd->setHidden(root->hidden); nd->setArtificial(TRUE); nd->setLanguage(root->lang); @@ -1828,7 +1978,7 @@ static void findUsingDeclarations(const Entry *root) ) { //printf("Found using declaration %s at line %d of %s inside section %x\n", - // root->name.data(),root->startLine,root->fileName.data(), + // qPrint(root->name),root->startLine,qPrint(root->fileName), // rootNav->parent()->section()); if (!root->name.isEmpty()) { @@ -1868,7 +2018,7 @@ static void findUsingDeclarations(const Entry *root) usingCd = toClassDefMutable(Doxygen::hiddenClassLinkedMap->find(name)); // check if it is already hidden } - //printf("%s -> %p\n",root->name.data(),usingCd); + //printf("%s -> %p\n",qPrint(root->name),usingCd); if (usingCd==0) // definition not in the input => add an artificial class { Debug::print(Debug::Classes,0," New using class '%s' (sec=0x%08x)! #tArgLists=%d\n", @@ -1894,12 +2044,12 @@ static void findUsingDeclarations(const Entry *root) if (nd) { - //printf("Inside namespace %s\n",nd->name().data()); + //printf("Inside namespace %s\n",qPrint(nd->name())); nd->addUsingDeclaration(usingCd); } else if (fd) { - //printf("Inside file %s\n",fd->name().data()); + //printf("Inside file %s\n",qPrint(fd->name())); fd->addUsingDeclaration(usingCd); } } @@ -1916,14 +2066,14 @@ static void findUsingDeclImports(const Entry *root) ) { //printf("Found using declaration %s inside section %x\n", - // root->name.data(), root->parent()->section); + // qPrint(root->name), root->parent()->section); QCString fullName=removeRedundantWhiteSpace(root->parent()->name); fullName=stripAnonymousNamespaceScope(fullName); fullName=stripTemplateSpecifiersFromScope(fullName); ClassDefMutable *cd = getClassMutable(fullName); if (cd) { - //printf("found class %s\n",cd->name().data()); + //printf("found class %s\n",qPrint(cd->name())); int i=root->name.find("::"); if (i!=-1) { @@ -1933,7 +2083,7 @@ static void findUsingDeclImports(const Entry *root) const ClassDef *bcd = resolver.resolveClass(cd,scope); // todo: file in fileScope parameter if (bcd && bcd!=cd) { - //printf("found class %s memName=%s\n",bcd->name().data(),memName.data()); + //printf("found class %s memName=%s\n",qPrint(bcd->name()),qPrint(memName)); const MemberNameInfoLinkedMap &mnlm=bcd->memberNameInfoLinkedMap(); const MemberNameInfo *mni = mnlm.find(memName); if (mni) @@ -1982,6 +2132,7 @@ static void findUsingDeclImports(const Entry *root) newMd->setBodySegment(md->getDefLine(),md->getStartBodyLine(),md->getEndBodyLine()); newMd->setBodyDef(md->getBodyDef()); newMd->setInitializer(md->initializer()); + newMd->setRequiresClause(md->requiresClause()); newMd->setMaxInitLines(md->initializerLines()); newMd->setMemberGroupId(root->mGrpId); newMd->setMemberSpecifiers(md->getMemberSpecifiers()); @@ -2011,7 +2162,7 @@ static void findIncludedUsingDirectives() { for (const auto &fd : *fn) { - //printf("----- adding using directives for file %s\n",fd->name().data()); + //printf("----- adding using directives for file %s\n",qPrint(fd->name())); fd->addIncludedUsingDirectives(visitedFiles); } } @@ -2099,7 +2250,7 @@ static MemberDef *addVariableToClass( for (const auto &imd : *mn) { //printf("md->getClassDef()=%p cd=%p type=[%s] md->typeString()=[%s]\n", - // md->getClassDef(),cd,type.data(),md->typeString()); + // md->getClassDef(),cd,qPrint(type),md->typeString()); MemberDefMutable *md = toMemberDefMutable(imd.get()); if (md && md->getClassDef()==cd && @@ -2165,7 +2316,7 @@ static MemberDef *addVariableToClass( addMemberToGroups(root,md.get()); md->setBodyDef(root->fileDef()); - //printf(" New member adding to %s (%p)!\n",cd->name().data(),cd); + //printf(" New member adding to %s (%p)!\n",qPrint(cd->name()),cd); cd->insertMember(md.get()); md->setRefItems(root->sli); @@ -2173,7 +2324,7 @@ static MemberDef *addVariableToClass( cd->insertUsedFile(root->fileDef()); root->markAsProcessed(); - //printf(" Adding member=%s\n",md->name().data()); + //printf(" Adding member=%s\n",qPrint(md->name())); // add the member to the global list MemberDef *result = md.get(); mn = Doxygen::memberNameLinkedMap->add(name); @@ -2371,7 +2522,7 @@ static MemberDef *addVariableToFile( // new global variable, enum value or typedef std::unique_ptr<MemberDefMutable> md { createMemberDef( fileName,root->startLine,root->startColumn, - type,name,args,0, + type,name,args,QCString(), root->protection, Normal,root->stat,Member, mtype,!root->tArgLists.empty() ? root->tArgLists.back() : ArgumentList(), root->argList, root->metaData) }; @@ -2485,7 +2636,7 @@ static bool isVarWithConstructor(const Entry *root) int ti; SymbolResolver resolver(fd); - //printf("isVarWithConstructor(%s)\n",rootNav->name().data()); + //printf("isVarWithConstructor(%s)\n",qPrint(rootNav->name())); if (root->parent()->section & Entry::COMPOUND_MASK) { // inside a class result=FALSE; @@ -2578,7 +2729,7 @@ static bool isVarWithConstructor(const Entry *root) if (reg::search(resType,match,idChars) && match.position()==0) // resType starts with identifier { resType=match.str(); - //printf("resType=%s\n",resType.data()); + //printf("resType=%s\n",qPrint(resType)); if (resType=="int" || resType=="long" || resType=="float" || resType=="double" || resType=="char" || resType=="signed" || resType=="const" || resType=="unsigned" || resType=="void") @@ -2592,8 +2743,8 @@ static bool isVarWithConstructor(const Entry *root) } done: - //printf("isVarWithConstructor(%s,%s)=%d\n",rootNav->parent()->name().data(), - // root->type.data(),result); + //printf("isVarWithConstructor(%s,%s)=%d\n",qPrint(rootNav->parent()->name()), + // qPrint(root->type),result); return result; } @@ -2611,7 +2762,7 @@ static void addVariable(const Entry *root,int isFuncPtr=-1) root->mGrpId, qPrint(root->relates) ); - //printf("root->parent->name=%s\n",root->parent->name.data()); + //printf("root->parent->name=%s\n",qPrint(root->parent->name)); QCString type = root->type; QCString name = root->name; @@ -2635,7 +2786,7 @@ static void addVariable(const Entry *root,int isFuncPtr=-1) if (j!=std::string::npos) args=sargs.substr(0,j); // extract, e.g '[10]' from '[10])' } //printf("new: type='%s' name='%s' args='%s'\n", - // type.data(),name.data(),args.data()); + // qPrint(type),qPrint(name),qPrint(args)); } else { @@ -2654,7 +2805,7 @@ static void addVariable(const Entry *root,int isFuncPtr=-1) { type=type.left(type.length()-1); args.prepend(") "); - //printf("type=%s args=%s\n",type.data(),args.data()); + //printf("type=%s args=%s\n",qPrint(type),qPrint(args)); } } } @@ -2795,8 +2946,8 @@ static void addVariable(const Entry *root,int isFuncPtr=-1) } //printf("name='%s' scope=%s scope.right=%s\n", - // name.data(),scope.data(), - // scope.right(scope.length()-si).data()); + // qPrint(name),qPrint(scope), + // qPrint(scope.right(scope.length()-si))); addVariableToClass(root, // entry cd, // class to add member to mtype, // member type @@ -2810,7 +2961,7 @@ static void addVariable(const Entry *root,int isFuncPtr=-1) } else if (!name.isEmpty()) // global variable { - //printf("Inserting member in global scope %s!\n",scope.data()); + //printf("Inserting member in global scope %s!\n",qPrint(scope)); addVariableToFile(root,mtype,scope,type,name,args,FALSE,/*0,*/0); } @@ -2821,7 +2972,7 @@ static void addVariable(const Entry *root,int isFuncPtr=-1) // If found they are stored in their class or in the global list. static void buildTypedefList(const Entry *root) { - //printf("buildVarList(%s)\n",rootNav->name().data()); + //printf("buildVarList(%s)\n",qPrint(rootNav->name())); if (!root->name.isEmpty() && root->section==Entry::VARIABLE_SEC && root->type.find("typedef ")!=-1 // its a typedef @@ -2874,7 +3025,7 @@ static void buildDictionaryList(const Entry *root) static void buildVarList(const Entry *root) { - //printf("buildVarList(%s) section=%08x\n",rootNav->name().data(),rootNav->section()); + //printf("buildVarList(%s) section=%08x\n",qPrint(rootNav->name()),rootNav->section()); int isFuncPtr=-1; if (!root->name.isEmpty() && (root->type.isEmpty() || g_compoundKeywords.find(root->type.str())==g_compoundKeywords.end()) && @@ -3080,7 +3231,7 @@ static void addMethodToClass(const Entry *root,ClassDefMutable *cd, } //printf("root->name='%s; args='%s' root->argList='%s'\n", - // root->name.data(),args.data(),argListToString(root->argList).data() + // qPrint(root->name),qPrint(args),qPrint(argListToString(root->argList)) // ); // adding class member @@ -3104,6 +3255,7 @@ static void addMethodToClass(const Entry *root,ClassDefMutable *cd, md->setMemberGroupId(root->mGrpId); md->setTypeConstraints(root->typeConstr); md->setLanguage(root->lang); + md->setRequiresClause(root->req); md->setId(root->id); md->setBodyDef(fd); md->setFileDef(fd); @@ -3173,7 +3325,7 @@ static void addMethodToClass(const Entry *root,ClassDefMutable *cd, md->setRefItems(root->sli); // add member to the global list of all members - //printf("Adding member=%s class=%s\n",md->name().data(),cd->name().data()); + //printf("Adding member=%s class=%s\n",qPrint(md->name()),qPrint(cd->name())); MemberName *mn = Doxygen::memberNameLinkedMap->add(name); mn->push_back(std::move(md)); } @@ -3185,7 +3337,7 @@ static void addGlobalFunction(const Entry *root,const QCString &rname,const QCSt QCString scope = sc; Debug::print(Debug::Functions,0," --> new function %s found!\n",qPrint(rname)); //printf("New function type='%s' name='%s' args='%s' bodyLine=%d\n", - // root->type.data(),rname.data(),root->args.data(),root->bodyLine); + // qPrint(root->type),qPrint(rname),qPrint(root->args),root->bodyLine); // new global function QCString name=removeRedundantWhiteSpace(rname); @@ -3213,6 +3365,7 @@ static void addGlobalFunction(const Entry *root,const QCString &rname,const QCSt md->addSectionsToDefinition(root->anchors); md->setMemberSpecifiers(root->spec); md->setMemberGroupId(root->mGrpId); + md->setRequiresClause(root->req); NamespaceDefMutable *nd = 0; // see if the function is inside a namespace that was not part of @@ -3291,7 +3444,7 @@ static void addGlobalFunction(const Entry *root,const QCString &rname,const QCSt } // add member to the list of file members - //printf("Adding member=%s\n",md->name().data()); + //printf("Adding member=%s\n",qPrint(md->name())); MemberName *mn = Doxygen::functionNameLinkedMap->add(name); mn->push_back(std::move(md)); } @@ -3323,7 +3476,7 @@ static void buildFunctionList(const Entry *root) bool isFriend=root->type.find("friend ")!=-1; QCString rname = removeRedundantWhiteSpace(root->name); - //printf("rname=%s\n",rname.data()); + //printf("rname=%s\n",qPrint(rname)); QCString scope=root->parent()->name; //stripAnonymousNamespaceScope(root->parent->name); if (!rname.isEmpty() && scope.find('@')==-1) @@ -3405,7 +3558,7 @@ static void buildFunctionList(const Entry *root) { const NamespaceDef *mnd = md->getNamespaceDef(); NamespaceDef *rnd = 0; - //printf("root namespace=%s\n",rootNav->parent()->name().data()); + //printf("root namespace=%s\n",qPrint(rootNav->parent()->name())); QCString fullScope = scope; QCString parentScope = root->parent()->name; if (!parentScope.isEmpty() && !leftScopeMatch(parentScope,scope)) @@ -3413,14 +3566,14 @@ static void buildFunctionList(const Entry *root) if (!scope.isEmpty()) fullScope.prepend("::"); fullScope.prepend(parentScope); } - //printf("fullScope=%s\n",fullScope.data()); + //printf("fullScope=%s\n",qPrint(fullScope)); rnd = getResolvedNamespace(fullScope); const FileDef *mfd = md->getFileDef(); QCString nsName,rnsName; - if (mnd) nsName = mnd->name().copy(); - if (rnd) rnsName = rnd->name().copy(); + if (mnd) nsName = mnd->name(); + if (rnd) rnsName = rnd->name(); //printf("matching arguments for %s%s %s%s\n", - // md->name().data(),md->argsString(),rname.data(),argListToString(root->argList).data()); + // qPrint(md->name()),md->argsString(),qPrint(rname),qPrint(argListToString(root->argList))); const ArgumentList &mdAl = md->argumentList(); const ArgumentList &mdTempl = md->templateArguments(); @@ -3428,6 +3581,7 @@ static void buildFunctionList(const Entry *root) // functions have the same number of template parameters bool sameNumTemplateArgs = TRUE; bool matchingReturnTypes = TRUE; + bool sameRequiresClause = TRUE; if (!mdTempl.empty() && !root->tArgLists.empty()) { if (mdTempl.size()!=root->tArgLists.back().size()) @@ -3438,6 +3592,10 @@ static void buildFunctionList(const Entry *root) { matchingReturnTypes = FALSE; } + if (md->requiresClause()!=root->req) + { + sameRequiresClause = FALSE; + } } bool staticsInDifferentFiles = @@ -3449,6 +3607,7 @@ static void buildFunctionList(const Entry *root) FALSE) && sameNumTemplateArgs && matchingReturnTypes && + sameRequiresClause && !staticsInDifferentFiles ) { @@ -3458,7 +3617,7 @@ static void buildFunctionList(const Entry *root) gd = Doxygen::groupLinkedMap->find(root->groups.front().groupname); } //printf("match!\n"); - //printf("mnd=%p rnd=%p nsName=%s rnsName=%s\n",mnd,rnd,nsName.data(),rnsName.data()); + //printf("mnd=%p rnd=%p nsName=%s rnsName=%s\n",mnd,rnd,qPrint(nsName),qPrint(rnsName)); // see if we need to create a new member found=(mnd && rnd && nsName==rnsName) || // members are in the same namespace ((mnd==0 && rnd==0 && mfd!=0 && // no external reference and @@ -3473,7 +3632,7 @@ static void buildFunctionList(const Entry *root) } //printf("combining function with prototype found=%d in namespace %s\n", - // found,nsName.data()); + // found,qPrint(nsName)); if (found) { @@ -3568,7 +3727,7 @@ static void buildFunctionList(const Entry *root) } //printf("unrelated function %d '%s' '%s' '%s'\n", - // root->parent->section,root->type.data(),rname.data(),root->args.data()); + // root->parent->section,qPrint(root->type),qPrint(rname),qPrint(root->args)); } else { @@ -3770,7 +3929,7 @@ static void transferRelatedFunctionDocumentation() MemberDefMutable *md = toMemberDefMutable(imd.get()); if (md) { - //printf(" Function '%s'\n",md->name().data()); + //printf(" Function '%s'\n",qPrint(md->name())); MemberName *rmn; if ((rmn=Doxygen::memberNameLinkedMap->find(md->name()))) // check if there is a member with the same name { @@ -3788,7 +3947,7 @@ static void transferRelatedFunctionDocumentation() ) ) { - //printf(" Found related member '%s'\n",md->name().data()); + //printf(" Found related member '%s'\n",qPrint(md->name())); if (rmd->relatedAlso()) md->setRelatedAlso(rmd->relatedAlso()); else if (rmd->isForeign()) @@ -3823,7 +3982,7 @@ static TemplateNameMap getTemplateArgumentsInName(const ArgumentList &templateAr { const auto &match = *it; std::string n = match.str(); - if (n==arg.name) + if (n==arg.name.str()) { if (templateNames.find(n)==templateNames.end()) { @@ -3863,10 +4022,10 @@ static ClassDef *findClassWithinClassContext(Definition *context,ClassDef *cd,co } //printf("3. result=%p\n",result); //printf("** Trying to find %s within context %s class %s result=%s lookup=%p\n", - // name.data(), - // context ? context->name().data() : "<none>", - // cd ? cd->name().data() : "<none>", - // result ? result->name().data() : "<none>", + // qPrint(name), + // context ? qPrint(context->name()) : "<none>", + // cd ? qPrint(cd->name()) : "<none>", + // result ? qPrint(result->name()) : "<none>", // Doxygen::classLinkedMap->find(name) // ); return result; @@ -3890,7 +4049,7 @@ static void findUsedClassesForClass(const Entry *root, const MemberDef *md=mi->memberDef(); if (md->isVariable() || md->isObjCProperty()) // for each member variable in this class { - //printf(" Found variable %s in class %s\n",md->name().data(),masterCd->name().data()); + //printf(" Found variable %s in class %s\n",qPrint(md->name()),qPrint(masterCd->name())); QCString type = normalizeNonTemplateArgumentsInString(md->typeString(),masterCd,formalArgs); QCString typedefValue = resolveTypeDef(masterCd,type); if (!typedefValue.isEmpty()) @@ -3902,16 +4061,16 @@ static void findUsedClassesForClass(const Entry *root, QCString templSpec; bool found=FALSE; // the type can contain template variables, replace them if present - type = substituteTemplateArgumentsInString(type.str(),formalArgs,actualArgs); + type = substituteTemplateArgumentsInString(type,formalArgs,actualArgs); - //printf(" template substitution gives=%s\n",type.data()); + //printf(" template substitution gives=%s\n",qPrint(type)); while (!found && extractClassNameFromType(type,pos,usedClassName,templSpec,root->lang)!=-1) { // find the type (if any) that matches usedClassName SymbolResolver resolver(masterCd->getFileDef()); const ClassDefMutable *typeCd = resolver.resolveClassMutable(masterCd,usedClassName,false,true); //printf("====> usedClassName=%s -> typeCd=%s\n", - // usedClassName.data(),typeCd?typeCd->name().data():"<none>"); + // qPrint(usedClassName),typeCd?qPrint(typeCd->name()):"<none>"); if (typeCd) { usedClassName = typeCd->name(); @@ -3927,7 +4086,7 @@ static void findUsedClassesForClass(const Entry *root, } // add any template arguments to the class QCString usedName = removeRedundantWhiteSpace(usedClassName+templSpec); - //printf(" usedName=%s\n",usedName.data()); + //printf(" usedName=%s\n",qPrint(usedName)); TemplateNameMap formTemplateNames; if (templateNames.empty()) @@ -3957,7 +4116,7 @@ static void findUsedClassesForClass(const Entry *root, ClassDef::Class)))); if (usedCdm) { - //printf("making %s a template argument!!!\n",usedCd->name().data()); + //printf("making %s a template argument!!!\n",qPrint(usedCd->name())); usedCdm->makeTemplateArgument(); usedCdm->setUsedOnly(TRUE); usedCdm->setLanguage(masterCd->getLanguage()); @@ -3982,7 +4141,7 @@ static void findUsedClassesForClass(const Entry *root, { ClassDef *usedCd=findClassWithinClassContext(context,masterCd,usedName); //printf("Looking for used class %s: result=%s master=%s\n", - // usedName.data(),usedCd?usedCd->name().data():"<none>",masterCd?masterCd->name().data():"<none>"); + // qPrint(usedName),usedCd?qPrint(usedCd->name()):"<none>",masterCd?qPrint(masterCd->name()):"<none>"); if (usedCd) { @@ -4054,15 +4213,15 @@ static void findBaseClassesForClass( for (const BaseInfo &bi : root->extends) { //printf("masterCd=%s bi.name='%s' #actualArgs=%d\n", - // masterCd->localName().data(),bi.name.data(),actualArgs ? (int)actualArgs->size() : -1); + // qPrint(masterCd->localName()),qPrint(bi.name),actualArgs ? (int)actualArgs->size() : -1); TemplateNameMap formTemplateNames; if (templateNames.empty()) { formTemplateNames = getTemplateArgumentsInName(formalArgs,bi.name.str()); } BaseInfo tbi = bi; - tbi.name = substituteTemplateArgumentsInString(bi.name.str(),formalArgs,actualArgs); - //printf("bi->name=%s tbi.name=%s\n",bi->name.data(),tbi.name.data()); + tbi.name = substituteTemplateArgumentsInString(bi.name,formalArgs,actualArgs); + //printf("bi->name=%s tbi.name=%s\n",qPrint(bi->name),qPrint(tbi.name)); if (mode==DocumentedOnly) { @@ -4097,7 +4256,7 @@ static void findTemplateInstanceRelation(const Entry *root, Debug::print(Debug::Classes,0," derived from template %s with parameters %s isArtificial=%d\n", qPrint(templateClass->name()),qPrint(templSpec),isArtificial); //printf("findTemplateInstanceRelation(base=%s templSpec=%s templateNames=", - // templateClass->name().data(),templSpec.data()); + // qPrint(templateClass->name()),qPrint(templSpec)); //for (const auto &kv : templNames) //{ // printf("(%s->%d) ",kv.first.c_str(),kv.second); @@ -4125,7 +4284,7 @@ static void findTemplateInstanceRelation(const Entry *root, // search for new template instances caused by base classes of // instanceClass - auto it_pair = g_classEntries.equal_range(templateClass->name().data()); + auto it_pair = g_classEntries.equal_range(templateClass->name().str()); for (auto it=it_pair.first ; it!=it_pair.second ; ++it) { const Entry *templateRoot = it->second; @@ -4139,7 +4298,7 @@ static void findTemplateInstanceRelation(const Entry *root, isArtificial,templArgs,templateNames); } - //Debug::print(Debug::Classes,0," Template instance %s : \n",instanceClass->name().data()); + //Debug::print(Debug::Classes,0," Template instance %s : \n",qPrint(instanceClass->name())); //ArgumentList *tl = templateClass->templateArguments(); } else @@ -4240,10 +4399,10 @@ static int findEndOfTemplate(const QCString &s,int startPos) return brCount==0 ? e : -1; } -static int findTemplateSpecializationPosition(const char *name) +static int findTemplateSpecializationPosition(const QCString &name) { - if (name==0 || name[0]=='\0') return 0; - int l = static_cast<int>(strlen(name)); + if (name.isEmpty()) return 0; + int l = static_cast<int>(name.length()); if (name[l-1]=='>') // search backward to find the matching <, allowing nested <...> and strings. { int count=1; @@ -4281,7 +4440,7 @@ static bool findClassRelation( ) { //printf("findClassRelation(class=%s base=%s templateNames=", - // cd->name().data(),bi->name.data()); + // qPrint(cd->name()),qPrint(bi->name)); //for (const auto &kv : templateNames) //{ // printf("(%s->%d) ",kv.first.c_str(),kv.second); @@ -4290,7 +4449,7 @@ static bool findClassRelation( QCString biName=bi->name; bool explicitGlobalScope=FALSE; - //printf("findClassRelation: biName='%s'\n",biName.data()); + //printf("findClassRelation: biName='%s'\n",qPrint(biName)); if (biName.left(2)=="::") // explicit global scope { biName=biName.right(biName.length()-2); @@ -4302,12 +4461,12 @@ static bool findClassRelation( do // for each parent scope, starting with the largest scope // (in case of nested classes) { - QCString scopeName= parentNode ? parentNode->name.data() : ""; + QCString scopeName= parentNode ? parentNode->name : QCString(); int scopeOffset=explicitGlobalScope ? 0 : scopeName.length(); do // try all parent scope prefixes, starting with the largest scope { //printf("scopePrefix='%s' biName='%s'\n", - // scopeName.left(scopeOffset).data(),biName.data()); + // qPrint(scopeName.left(scopeOffset)),qPrint(biName)); QCString baseClassName=biName; if (scopeOffset>0) @@ -4327,12 +4486,12 @@ static bool findClassRelation( const MemberDef *baseClassTypeDef = resolver.getTypedef(); QCString templSpec = resolver.getTemplateSpec(); //printf("baseClassName=%s baseClass=%p cd=%p explicitGlobalScope=%d\n", - // baseClassName.data(),baseClass,cd,explicitGlobalScope); + // qPrint(baseClassName),baseClass,cd,explicitGlobalScope); //printf(" scope='%s' baseClassName='%s' baseClass=%s templSpec=%s\n", - // cd ? cd->name().data():"<none>", - // baseClassName.data(), - // baseClass?baseClass->name().data():"<none>", - // templSpec.data() + // cd ? qPrint(cd->name()):"<none>", + // qPrint(baseClassName), + // baseClass?qPrint(baseClass->name()):"<none>", + // qPrint(templSpec) // ); //if (baseClassName.left(root->name.length())!=root->name || // baseClassName.at(root->name.length())!='<' @@ -4377,7 +4536,7 @@ static bool findClassRelation( ); baseClassTypeDef = resolver.getTypedef(); //printf("baseClass=%p -> baseClass=%s templSpec=%s\n", - // baseClass,baseClassName.data(),templSpec.data()); + // baseClass,qPrint(baseClassName),qPrint(templSpec)); } } else if (baseClass && !templSpec.isEmpty()) // we have a known class, but also @@ -4386,7 +4545,7 @@ static bool findClassRelation( // instance (for instance if a class // derived from a template argument) { - //printf("baseClass=%s templSpec=%s\n",baseClass->name().data(),templSpec.data()); + //printf("baseClass=%s templSpec=%s\n",qPrint(baseClass->name()),qPrint(templSpec)); ClassDefMutable *templClass=getClassMutable(baseClass->name()+templSpec); if (templClass) { @@ -4419,7 +4578,7 @@ static bool findClassRelation( { baseClass=toClassDefMutable(findClassWithinClassContext(context,cd,baseClassName)); //printf("findClassWithinClassContext(%s,%s)=%p\n", - // cd->name().data(),baseClassName.data(),baseClass); + // qPrint(cd->name()),qPrint(baseClassName),baseClass); found = baseClass!=0 && baseClass!=cd; } @@ -4428,7 +4587,7 @@ static bool findClassRelation( { // for PHP the "use A\B as C" construct map class C to A::B, so we lookup // the class name also in the alias mapping. - auto it = Doxygen::namespaceAliasMap.find(baseClassName.data()); + auto it = Doxygen::namespaceAliasMap.find(baseClassName.str()); if (it!=Doxygen::namespaceAliasMap.end()) // see if it is indeed a class. { baseClass=getClassMutable(it->second.c_str()); @@ -4474,7 +4633,7 @@ static bool findClassRelation( if (baseClassTypeDef || cd->isCSharp()) { usedName=biName; - //printf("***** usedName=%s templSpec=%s\n",usedName.data(),templSpec.data()); + //printf("***** usedName=%s templSpec=%s\n",qPrint(usedName),qPrint(templSpec)); } Protection prot = bi->prot; if (Config_getBool(SIP_SUPPORT)) prot=Public; @@ -4489,7 +4648,7 @@ static bool findClassRelation( warn(root->fileName,root->startLine, "Detected potential recursive class relation " "between class %s and base class %s!", - cd->name().data(),baseClass->name().data() + qPrint(cd->name()),qPrint(baseClass->name()) ); } } @@ -4524,7 +4683,7 @@ static bool findClassRelation( { baseClass = toClassDefMutable(Doxygen::classLinkedMap->find(baseClassName)); //printf("*** classDDict->find(%s)=%p biName=%s templSpec=%s\n", - // baseClassName.data(),baseClass,biName.data(),templSpec.data()); + // qPrint(baseClassName),baseClass,qPrint(biName),qPrint(templSpec)); if (baseClass==0) // not found (or alias) { baseClass = toClassDefMutable( @@ -4591,7 +4750,7 @@ static bool findClassRelation( warn(root->fileName,root->startLine, "Detected potential recursive class relation " "between class %s and base class %s!\n", - root->name.data(),baseClassName.data() + qPrint(root->name),qPrint(baseClassName) ); } // for mode==TemplateInstance this case is quite common and @@ -4691,7 +4850,7 @@ static void findInheritedTemplateInstances() ClassDefMutable *cdm = toClassDefMutable(cd); if (cdm) { - //printf("Class %s %zu\n",cd->name().data(),root->extends.size()); + //printf("Class %s %zu\n",qPrint(cd->name()),root->extends.size()); findBaseClassesForClass(root,cd,cdm,cdm,TemplateInstances,FALSE); } } @@ -4744,7 +4903,7 @@ static void computeClassRelations() warn_undoc( root->fileName,root->startLine, "Compound %s is not documented.", - root->name.data() + qPrint(root->name) ); } } @@ -4801,7 +4960,7 @@ static void computeTemplateClassRelations() } } - tbi.name = substituteTemplateArgumentsInString(bi.name.str(),tl,templArgs); + tbi.name = substituteTemplateArgumentsInString(bi.name,tl,templArgs); // find a documented base class in the correct scope if (!findClassRelation(root,cd,tcd,&tbi,actualTemplateNames,DocumentedOnly,FALSE)) { @@ -4897,7 +5056,7 @@ static void addListReferences() addRefItem(xrefItems, name, theTranslator->trPage(TRUE,TRUE), - name,pd->title(),0,0); + name,pd->title(),QCString(),0); } } @@ -4912,7 +5071,7 @@ static void addListReferences() addRefItem(xrefItems, name, theTranslator->trDir(TRUE,TRUE), - name,dd->displayName(),0,0); + name,dd->displayName(),QCString(),0); } } @@ -4932,7 +5091,7 @@ static void generateXRefPages() // over_load is set the standard overload text is added. static void addMemberDocs(const Entry *root, - MemberDefMutable *md, const char *funcDecl, + MemberDefMutable *md, const QCString &funcDecl, const ArgumentList *al, bool over_load, uint64 spec @@ -4940,7 +5099,7 @@ static void addMemberDocs(const Entry *root, { if (md==0) return; //printf("addMemberDocs: '%s'::'%s' '%s' funcDecl='%s' mSpec=%lld\n", - // root->parent()->name.data(),md->name().data(),md->argsString(),funcDecl,spec); + // qPrint(root->parent()->name),qPrint(md->name()),md->argsString(),funcDecl,spec); QCString fDecl=funcDecl; // strip extern specifier fDecl.stripPrefix("extern "); @@ -5017,8 +5176,8 @@ static void addMemberDocs(const Entry *root, } //printf("initializer: '%s'(isEmpty=%d) '%s'(isEmpty=%d)\n", - // md->initializer().data(),md->initializer().isEmpty(), - // root->initializer.data(),root->initializer.isEmpty() + // qPrint(md->initializer()),md->initializer().isEmpty(), + // qPrint(root->initializer),root->initializer.isEmpty() // ); std::string rootInit = root->initializer.str(); if (md->initializer().isEmpty() && !rootInit.empty()) @@ -5026,6 +5185,10 @@ static void addMemberDocs(const Entry *root, //printf("setInitializer\n"); md->setInitializer(rootInit.c_str()); } + if (md->requiresClause().isEmpty() && !root->req.isEmpty()) + { + md->setRequiresClause(root->req); + } md->setMaxInitLines(root->initLines); @@ -5062,13 +5225,13 @@ static void addMemberDocs(const Entry *root, root->fileName,root->startLine, "member %s belongs to two different groups. The second " "one found here will be ignored.", - md->name().data() + qPrint(md->name()) ); } } else // set group id { - //printf("setMemberGroupId=%d md=%s\n",root->mGrpId,md->name().data()); + //printf("setMemberGroupId=%d md=%s\n",root->mGrpId,qPrint(md->name())); md->setMemberGroupId(root->mGrpId); } } @@ -5079,7 +5242,7 @@ static void addMemberDocs(const Entry *root, // template list specifier static const ClassDef *findClassDefinition(FileDef *fd,NamespaceDef *nd, - const char *scopeName) + const QCString &scopeName) { SymbolResolver resolver(fd); const ClassDef *tcd = resolver.resolveClass(nd,scopeName,true,true); @@ -5094,11 +5257,11 @@ static const ClassDef *findClassDefinition(FileDef *fd,NamespaceDef *nd, static bool findGlobalMember(const Entry *root, const QCString &namespaceName, - const char *type, - const char *name, - const char *tempArg, - const char *, - const char *decl, + const QCString &type, + const QCString &name, + const QCString &tempArg, + const QCString &, + const QCString &decl, uint64 spec) { Debug::print(Debug::FindMembers,0, @@ -5174,7 +5337,7 @@ static bool findGlobalMember(const Entry *root, } const FileDef *fd=root->fileDef(); - //printf("File %s\n",fd ? fd->name().data() : "<none>"); + //printf("File %s\n",fd ? qPrint(fd->name()) : "<none>"); LinkedRefMap<const NamespaceDef> nl; if (fd) { @@ -5218,8 +5381,8 @@ static bool findGlobalMember(const Entry *root, } //printf("%s<->%s\n", - // argListToString(md->argumentList()).data(), - // argListToString(root->argList).data()); + // qPrint(argListToString(md->argumentList())), + // qPrint(argListToString(root->argList))); // for static members we also check if the comment block was found in // the same file. This is needed because static members with the same @@ -5232,13 +5395,14 @@ static bool findGlobalMember(const Entry *root, matching = FALSE; } - // for template member we also need to check the return type + // for template member we also need to check the return type and requires if (!md->templateArguments().empty() && !root->tArgLists.empty()) { //printf("Comparing return types '%s'<->'%s'\n", // md->typeString(),type); if (md->templateArguments().size()!=root->tArgLists.back().size() || - qstrcmp(md->typeString(),type)!=0) + md->typeString()!=type || + md->requiresClause()!=root->req) { //printf(" ---> no matching\n"); matching = FALSE; @@ -5271,7 +5435,7 @@ static bool findGlobalMember(const Entry *root, " of file "+md->getDefFileName()+"\n"; } } - warn(root->fileName,root->startLine, "%s", warnMsg.data()); + warn(root->fileName,root->startLine, "%s", qPrint(warnMsg)); } } else // got docs for an undefined member! @@ -5285,7 +5449,7 @@ static bool findGlobalMember(const Entry *root, ) { warn(root->fileName,root->startLine, - "documented symbol '%s' was not declared or defined.",decl + "documented symbol '%s' was not declared or defined.",qPrint(decl) ); } } @@ -5329,7 +5493,7 @@ static QCString substituteTemplatesInString( static const reg::Ex re(R"(\a\w*)"); reg::Iterator it(src,re); reg::Iterator end; - //printf("type=%s\n",sa->type.data()); + //printf("type=%s\n",qPrint(sa->type)); size_t p=0; for (; it!=end ; ++it) // for each word in srcType { @@ -5364,9 +5528,9 @@ static QCString substituteTemplatesInString( ++tdaIt; } //if (tda) printf("tsa=%s|%s tda=%s|%s\n", - // tsa.type.data(),tsa.name.data(), - // tda->type.data(),tda->name.data()); - if (name==tsa.name) + // qPrint(tsa.type),qPrint(tsa.name), + // qPrint(tda->type),qPrint(tda->name)); + if (name==tsa.name.str()) { if (tda && tda->name.isEmpty()) { @@ -5389,9 +5553,9 @@ static QCString substituteTemplatesInString( } //printf(" srcList='%s' dstList='%s faList='%s'\n", - // argListToString(srclali.current()).data(), - // argListToString(dstlali.current()).data(), - // funcTempArgList ? argListToString(funcTempArgList).data() : "<none>"); + // qPrint(argListToString(srclali.current())), + // qPrint(argListToString(dstlali.current())), + // funcTempArgList ? qPrint(argListToString(funcTempArgList)) : "<none>"); ++srcIt; } dst+=name; @@ -5399,7 +5563,7 @@ static QCString substituteTemplatesInString( } dst+=src.substr(p); //printf(" substituteTemplatesInString(%s)=%s\n", - // src.data(),dst.data()); + // qPrint(src),qPrint(dst)); return dst; } @@ -5438,7 +5602,7 @@ static void substituteTemplatesInArgList( srcTempArgLists,dstTempArgLists, src.trailingReturnType().str())); //printf("substituteTemplatesInArgList: replacing %s with %s\n", - // argListToString(src).data(),argListToString(dst).data() + // qPrint(argListToString(src)),qPrint(argListToString(dst)) // ); } @@ -5450,13 +5614,13 @@ static void addLocalObjCMethod(const Entry *root, const QCString &exceptions,const QCString &funcDecl, uint64 spec) { - //printf("scopeName='%s' className='%s'\n",scopeName.data(),className.data()); + //printf("scopeName='%s' className='%s'\n",qPrint(scopeName),qPrint(className)); ClassDefMutable *cd=0; if (Config_getBool(EXTRACT_LOCAL_METHODS) && (cd=getClassMutable(scopeName))) { Debug::print(Debug::FindMembers,0,"4. Local objective C method %s\n" " scopeName=%s\n",qPrint(root->name),qPrint(scopeName)); - //printf("Local objective C method '%s' of class '%s' found\n",root->name.data(),cd->name().data()); + //printf("Local objective C method '%s' of class '%s' found\n",qPrint(root->name),qPrint(cd->name())); std::unique_ptr<MemberDefMutable> md { createMemberDef( root->fileName,root->startLine,root->startColumn, funcType,funcName,funcArgs,exceptions, @@ -5534,13 +5698,13 @@ static void addMemberFunction(const Entry *root, qPrint(md->argsString()), qPrint(root->fileName)); //printf("Member %s (member scopeName=%s) (this scopeName=%s) isEnumValue()=%d\n", - // md->name().data(),cd->name().data(),scopeName.data(),md->isEnumValue()); + // qPrint(md->name()),qPrint(cd->name()),qPrint(scopeName),md->isEnumValue()); FileDef *fd=root->fileDef(); NamespaceDef *nd=0; if (!namespaceName.isEmpty()) nd=getResolvedNamespace(namespaceName); - //printf("scopeName %s->%s\n",scopeName.data(), - // stripTemplateSpecifiersFromScope(scopeName,FALSE).data()); + //printf("scopeName %s->%s\n",qPrint(scopeName), + // qPrint(stripTemplateSpecifiersFromScope(scopeName,FALSE))); // if the member we are searching for is an enum value that is part of // a "strong" enum, we need to look into the fields of the enum for a match @@ -5551,7 +5715,7 @@ static void addMemberFunction(const Entry *root, if (className.left(enumNamePos)==cd->name()) { MemberName *enumMn=Doxygen::memberNameLinkedMap->find(enumName); - //printf("enumMn(%s)=%p\n",className.data(),enumMn); + //printf("enumMn(%s)=%p\n",qPrint(className),enumMn); if (enumMn) { for (const auto &emd : *enumMn) @@ -5576,12 +5740,12 @@ static void addMemberFunction(const Entry *root, tcd=cd; } //printf("Looking for %s inside nd=%s result=%p (%s) cd=%p\n", - // scopeName.data(),nd?nd->name().data():"<none>",tcd,tcd?tcd->name().data():"",cd); + // qPrint(scopeName),nd?qPrint(nd->name()):"<none>",tcd,tcd?qPrint(tcd->name()):"",cd); if (cd && tcd==cd) // member's classes match { Debug::print(Debug::FindMembers,0, - "4. class definition %s found\n",cd->name().data()); + "4. class definition %s found\n",qPrint(cd->name())); // get the template parameter lists found at the member declaration ArgumentLists declTemplArgs = cd->getTemplateParameterLists(); @@ -5650,8 +5814,7 @@ static void addMemberFunction(const Entry *root, "5b. Comparing return types '%s'<->'%s' #args %d<->%d\n", qPrint(md->typeString()),qPrint(funcType), md->templateArguments().size(),root->tArgLists.back().size()); - if (md->templateArguments().size()!=root->tArgLists.back().size() || - qstrcmp(memType,funcType)) + if (md->templateArguments().size()!=root->tArgLists.back().size() || memType!=funcType) { //printf(" ---> no matching\n"); matching = FALSE; @@ -5732,7 +5895,7 @@ static void addMemberFunction(const Entry *root, { ClassDefMutable *ccd=md->getClassDefMutable(); MemberDef *cmd=md.get(); - //printf("ccd->name()==%s className=%s\n",ccd->name().data(),className.data()); + //printf("ccd->name()==%s className=%s\n",qPrint(ccd->name()),qPrint(className)); if (ccd!=0 && rightScopeMatch(ccd->name(),className)) { const ArgumentList &templAl = md->templateArguments(); @@ -5794,7 +5957,7 @@ static void addMemberFunction(const Entry *root, warnMsg+='\n'; } - QCString fullFuncDecl=funcDecl.copy(); + QCString fullFuncDecl=funcDecl; if (isFunc) fullFuncDecl+=argListToString(root->argList,TRUE); warnMsg+=" "; @@ -5818,7 +5981,7 @@ static void addMemberFunction(const Entry *root, warnMsg+='\n'; warnMsg+=" "; } - if (md->typeString()) + if (!md->typeString().isEmpty()) { warnMsg+=md->typeString(); warnMsg+=' '; @@ -5826,8 +5989,7 @@ static void addMemberFunction(const Entry *root, QCString qScope = cd->qualifiedNameWithTemplateParameters(); if (!qScope.isEmpty()) warnMsg+=qScope+"::"+md->name(); - if (md->argsString()) - warnMsg+=md->argsString(); + warnMsg+=md->argsString(); if (noMatchCount>1) { warnMsg+="' at line "+QCString().setNum(md->getDefLine()) + @@ -5840,7 +6002,7 @@ static void addMemberFunction(const Entry *root, } } } - warn_simple(root->fileName,root->startLine,warnMsg); + warn_simple(root->fileName,root->startLine,qPrint(warnMsg)); } } @@ -5876,7 +6038,7 @@ static void addMemberSpecialization(const Entry *root, declMd ? declMd->protection() : root->protection, root->virt,root->stat,Member, mtype,tArgList,root->argList,root->metaData) }; - //printf("new specialized member %s args='%s'\n",md->name().data(),funcArgs.data()); + //printf("new specialized member %s args='%s'\n",qPrint(md->name()),qPrint(funcArgs)); md->setTagInfo(root->tagInfo()); md->setLanguage(root->lang); md->setId(root->id); @@ -5934,7 +6096,7 @@ static void addOverloaded(const Entry *root,MemberName *mn, // new overloaded member function std::unique_ptr<ArgumentList> tArgList = getTemplateArgumentsFromName(cd->name()+"::"+funcName,root->tArgLists); - //printf("new related member %s args='%s'\n",md->name().data(),funcArgs.data()); + //printf("new related member %s args='%s'\n",qPrint(md->name()),qPrint(funcArgs)); std::unique_ptr<MemberDefMutable> md { createMemberDef( root->fileName,root->startLine,root->startColumn, funcType,funcName,funcArgs,exceptions, @@ -6063,17 +6225,17 @@ static void findMember(const Entry *root, " ::","::" ).stripWhiteSpace(); - //printf("funcDecl='%s'\n",funcDecl.data()); + //printf("funcDecl='%s'\n",qPrint(funcDecl)); if (isFriend && funcDecl.left(6)=="class ") { //printf("friend class\n"); funcDecl=funcDecl.right(funcDecl.length()-6); - funcName = funcDecl.copy(); + funcName = funcDecl; } else if (isFriend && funcDecl.left(7)=="struct ") { funcDecl=funcDecl.right(funcDecl.length()-7); - funcName = funcDecl.copy(); + funcName = funcDecl; } else { @@ -6083,14 +6245,14 @@ static void findMember(const Entry *root, ); } //printf("scopeName='%s' funcType='%s' funcName='%s' funcArgs='%s'\n", - // scopeName.data(),funcType.data(),funcName.data(),funcArgs.data()); + // qPrint(scopeName),qPrint(funcType),qPrint(funcName),qPrint(funcArgs)); // the class name can also be a namespace name, we decide this later. // if a related class name is specified and the class name could // not be derived from the function declaration, then use the // related field. //printf("scopeName='%s' className='%s' namespaceName='%s'\n", - // scopeName.data(),className.data(),namespaceName.data()); + // qPrint(scopeName),qPrint(className),qPrint(namespaceName)); if (!relates.isEmpty()) { // related member, prefix user specified scope isRelated=TRUE; @@ -6158,12 +6320,12 @@ static void findMember(const Entry *root, // split scope into a namespace and a class part extractNamespaceName(scopeName,className,namespaceName,TRUE); //printf("scopeName='%s' className='%s' namespaceName='%s'\n", - // scopeName.data(),className.data(),namespaceName.data()); + // qPrint(scopeName),qPrint(className),qPrint(namespaceName)); //namespaceName=removeAnonymousScopes(namespaceName); if (namespaceName.find('@')!=-1) return; // skip stuff in anonymous namespace... - //printf("namespaceName='%s' className='%s'\n",namespaceName.data(),className.data()); + //printf("namespaceName='%s' className='%s'\n",qPrint(namespaceName),qPrint(className)); // merge class and namespace scopes again scopeName.resize(0); if (!namespaceName.isEmpty()) @@ -6186,7 +6348,7 @@ static void findMember(const Entry *root, { scopeName=className; } - //printf("new scope='%s'\n",scopeName.data()); + //printf("new scope='%s'\n",qPrint(scopeName)); QCString tempScopeName=scopeName; ClassDefMutable *cd=getClassMutable(scopeName); @@ -6203,9 +6365,9 @@ static void findMember(const Entry *root, } } //printf("scopeName=%s cd=%p root->tArgLists=%p result=%s\n", - // scopeName.data(),cd,root->tArgLists,tempScopeName.data()); + // qPrint(scopeName),cd,root->tArgLists,qPrint(tempScopeName)); - //printf("scopeName='%s' className='%s'\n",scopeName.data(),className.data()); + //printf("scopeName='%s' className='%s'\n",qPrint(scopeName),qPrint(className)); // rebuild the function declaration (needed to get the scope right). if (!scopeName.isEmpty() && !isRelated && !isFriend && !Config_getBool(HIDE_SCOPE_NAMES)) { @@ -6286,7 +6448,7 @@ static void findMember(const Entry *root, if (!funcName.isEmpty()) // function name is valid { Debug::print(Debug::FindMembers,0, - "1. funcName='%s'\n",funcName.data()); + "1. funcName='%s'\n",qPrint(funcName)); // check if 'className' is actually a scoped enum, in which case we need to // process it as a global, see issue #6471 @@ -6346,7 +6508,7 @@ static void findMember(const Entry *root, else { //printf("*** Specialized member %s of unknown scope %s%s found!\n", - // scopeName.data(),funcName.data(),funcArgs.data()); + // qPrint(scopeName),qPrint(funcName),qPrint(funcArgs)); } } else if (overloaded) // check if the function belongs to only one class @@ -6357,11 +6519,11 @@ static void findMember(const Entry *root, { if (!findGlobalMember(root,namespaceName,funcType,funcName,funcTempList,funcArgs,funcDecl,spec)) { - QCString fullFuncDecl=funcDecl.copy(); + QCString fullFuncDecl=funcDecl; if (isFunc) fullFuncDecl+=argListToString(root->argList,TRUE); warn(root->fileName,root->startLine, "Cannot determine class for function\n%s", - fullFuncDecl.data() + qPrint(fullFuncDecl) ); } } @@ -6371,7 +6533,7 @@ static void findMember(const Entry *root, Debug::print(Debug::FindMembers,0,"2. related function\n" " scopeName=%s className=%s\n",qPrint(scopeName),qPrint(className)); if (className.isEmpty()) className=relates; - //printf("scopeName='%s' className='%s'\n",scopeName.data(),className.data()); + //printf("scopeName='%s' className='%s'\n",qPrint(scopeName),qPrint(className)); if ((cd=getClassMutable(scopeName))) { bool newMember=TRUE; // assume we have a new member @@ -6422,7 +6584,7 @@ static void findMember(const Entry *root, } if (rmd_found) // member already exists as rmd -> add docs { - //printf("addMemberDocs for related member %s\n",root->name.data()); + //printf("addMemberDocs for related member %s\n",qPrint(root->name)); //rmd->setMemberDefTemplateArguments(root->mtArgList); addMemberDocs(root,rmd_found,funcDecl,0,overloaded,spec); } @@ -6450,7 +6612,7 @@ static void findMember(const Entry *root, funcDecl=funcType + " " + funcName; } - //printf("New related name '%s' '%d'\n",funcName.data(), + //printf("New related name '%s' '%d'\n",qPrint(funcName), // root->argList ? (int)root->argList->count() : -1); // first note that we pass: @@ -6491,7 +6653,7 @@ static void findMember(const Entry *root, md->setTagInfo(root->tagInfo()); //printf("Related member name='%s' decl='%s' bodyLine='%d'\n", - // funcName.data(),funcDecl.data(),root->bodyLine); + // qPrint(funcName),qPrint(funcDecl),root->bodyLine); // try to find the matching line number of the body from the // global function list @@ -6565,18 +6727,18 @@ static void findMember(const Entry *root, { addMemberToGroups(root,md.get()); } - //printf("Adding member=%s\n",md->name().data()); + //printf("Adding member=%s\n",qPrint(md->name())); mn->push_back(std::move(md)); } if (root->relatesType == Duplicate) { if (!findGlobalMember(root,namespaceName,funcType,funcName,funcTempList,funcArgs,funcDecl,spec)) { - QCString fullFuncDecl=funcDecl.copy(); + QCString fullFuncDecl=funcDecl; if (isFunc) fullFuncDecl+=argListToString(root->argList,TRUE); warn(root->fileName,root->startLine, "Cannot determine file/namespace for relatedalso function\n%s", - fullFuncDecl.data() + qPrint(fullFuncDecl) ); } } @@ -6586,7 +6748,7 @@ static void findMember(const Entry *root, warn_undoc(root->fileName,root->startLine, "class '%s' for related function '%s' is not " "documented.", - className.data(),funcName.data() + qPrint(className),qPrint(funcName) ); } } @@ -6601,14 +6763,14 @@ static void findMember(const Entry *root, { warn(root->fileName,root->startLine, "class for member '%s' cannot " - "be found.", funcName.data() + "be found.", qPrint(funcName) ); } else if (!className.isEmpty() && !globMem) { warn(root->fileName,root->startLine, "member '%s' of class '%s' cannot be found", - funcName.data(),className.data()); + qPrint(funcName),qPrint(className)); } } } @@ -6625,14 +6787,14 @@ static void findMember(const Entry *root, // find the members corresponding to the different documentation blocks // that are extracted from the sources. -static void filterMemberDocumentation(const Entry *root,const QCString relates) +static void filterMemberDocumentation(const Entry *root,const QCString &relates) { int i=-1,l; Debug::print(Debug::FindMembers,0, "findMemberDocumentation(): root->type='%s' root->inside='%s' root->name='%s' root->args='%s' section=%x root->spec=%lld root->mGrpId=%d\n", qPrint(root->type),qPrint(root->inside),qPrint(root->name),qPrint(root->args),root->section,root->spec,root->mGrpId ); - //printf("root->parent()->name=%s\n",root->parent()->name.data()); + //printf("root->parent()->name=%s\n",qPrint(root->parent()->name)); bool isFunc=TRUE; QCString type = root->type; @@ -6645,7 +6807,7 @@ static void filterMemberDocumentation(const Entry *root,const QCString relates) // fix type and argument args.prepend(type.right(type.length()-i-l)); type=type.left(i+l); - //printf("Results type=%s,name=%s,args=%s\n",type.data(),root->name.data(),args.data()); + //printf("Results type=%s,name=%s,args=%s\n",qPrint(type),qPrint(root->name),qPrint(args)); isFunc=FALSE; } else if ((type.left(8)=="typedef " && args.find('(')!=-1)) @@ -6654,12 +6816,12 @@ static void filterMemberDocumentation(const Entry *root,const QCString relates) isFunc=FALSE; } - //printf("Member %s isFunc=%d\n",root->name.data(),isFunc); + //printf("Member %s isFunc=%d\n",qPrint(root->name),isFunc); if (root->section==Entry::MEMBERDOC_SEC) { //printf("Documentation for inline member '%s' found args='%s'\n", - // root->name.data(),args.data()); - //if (relates.length()) printf(" Relates %s\n",relates.data()); + // qPrint(root->name),qPrint(args)); + //if (relates.length()) printf(" Relates %s\n",qPrint(relates)); if (type.isEmpty()) { findMember(root, @@ -6683,7 +6845,7 @@ static void filterMemberDocumentation(const Entry *root,const QCString relates) } else if (root->section==Entry::OVERLOADDOC_SEC) { - //printf("Overloaded member %s found\n",root->name.data()); + //printf("Overloaded member %s found\n",qPrint(root->name)); findMember(root, relates, type, @@ -6704,9 +6866,9 @@ static void filterMemberDocumentation(const Entry *root,const QCString relates) ) { //printf("Documentation for member '%s' found args='%s' excp='%s'\n", - // root->name.data(),args.data(),root->exception.data()); - //if (relates.length()) printf(" Relates %s\n",relates.data()); - //printf("Inside=%s\n Relates=%s\n",root->inside.data(),relates.data()); + // qPrint(root->name),qPrint(args),qPrint(root->exception)); + //if (relates.length()) printf(" Relates %s\n",qPrint(relates)); + //printf("Inside=%s\n Relates=%s\n",qPrint(root->inside),qPrint(relates)); if (type=="friend class" || type=="friend struct" || type=="friend union") { @@ -6749,8 +6911,8 @@ static void filterMemberDocumentation(const Entry *root,const QCString relates) } else if (root->section==Entry::VARIABLEDOC_SEC) { - //printf("Documentation for variable %s found\n",root->name.data()); - //if (!relates.isEmpty()) printf(" Relates %s\n",relates.data()); + //printf("Documentation for variable %s found\n",qPrint(root->name)); + //if (!relates.isEmpty()) printf(" Relates %s\n",qPrint(relates)); findMember(root, relates, type, @@ -6816,7 +6978,7 @@ static void findObjCMethodDefinitions(const Entry *root) { if (objCMethod->section==Entry::FUNCTION_SEC) { - //Printf(" Found ObjC method definition %s\n",objCMethod->name.data()); + //Printf(" Found ObjC method definition %s\n",qPrint(objCMethod->name)); findMember(objCMethod.get(), objCMethod->relates, objCMethod->type, @@ -6844,7 +7006,7 @@ static void findEnums(const Entry *root) bool isGlobal; bool isRelated=FALSE; bool isMemberOf=FALSE; - //printf("Found enum with name '%s' relates=%s\n",root->name.data(),root->relates.data()); + //printf("Found enum with name '%s' relates=%s\n",qPrint(root->name),qPrint(root->relates)); int i; QCString name; @@ -6875,13 +7037,13 @@ static void findEnums(const Entry *root) if (getClass(root->relates)==0 && !scope.isEmpty()) scope=mergeScopes(scope,root->relates); else - scope=root->relates.copy(); + scope=root->relates; if ((cd=getClassMutable(scope))==0) nd=getResolvedNamespaceMutable(scope); } if (cd && !name.isEmpty()) // found a enum inside a compound { - //printf("Enum '%s'::'%s'\n",cd->name().data(),name.data()); + //printf("Enum '%s'::'%s'\n",qPrint(cd->name()),qPrint(name)); fd=0; mnsd=Doxygen::memberNameLinkedMap; isGlobal=FALSE; @@ -6903,7 +7065,7 @@ static void findEnums(const Entry *root) // new enum type std::unique_ptr<MemberDefMutable> md { createMemberDef( root->fileName,root->startLine,root->startColumn, - 0,name,0,0, + QCString(),name,QCString(),QCString(), root->protection,Normal,FALSE, isMemberOf ? Foreign : isRelated ? Related : Member, MemberType_Enumeration, @@ -6917,16 +7079,16 @@ static void findEnums(const Entry *root) md->setMemberSpecifiers(root->spec); md->setEnumBaseType(root->args); //printf("Enum %s definition at line %d of %s: protection=%d scope=%s\n", - // root->name.data(),root->bodyLine,root->fileName.data(),root->protection,cd?cd->name().data():"<none>"); + // qPrint(root->name),root->bodyLine,qPrint(root->fileName),root->protection,cd?qPrint(cd->name()):"<none>"); md->addSectionsToDefinition(root->anchors); md->setMemberGroupId(root->mGrpId); md->enableCallGraph(root->callGraph); md->enableCallerGraph(root->callerGraph); md->enableReferencedByRelation(root->referencedByRelation); md->enableReferencesRelation(root->referencesRelation); - //printf("%s::setRefItems(%zu)\n",md->name().data(),root->sli.size()); + //printf("%s::setRefItems(%zu)\n",qPrint(md->name()),root->sli.size()); md->setRefItems(root->sli); - //printf("found enum %s nd=%p\n",md->name().data(),nd); + //printf("found enum %s nd=%p\n",qPrint(md->name()),nd); bool defSet=FALSE; QCString baseType = root->args; @@ -6985,7 +7147,7 @@ static void findEnums(const Entry *root) md->setBriefDescription(root->brief,root->briefFile,root->briefLine); md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine); - //printf("Adding member=%s\n",md->name().data()); + //printf("Adding member=%s\n",qPrint(md->name())); addMemberToGroups(root,md.get()); MemberName *mn = mnsd->add(name); @@ -7011,7 +7173,7 @@ static void addEnumValuesToEnums(const Entry *root) MemberNameLinkedMap *mnsd=0; bool isGlobal; bool isRelated=FALSE; - //printf("Found enum with name '%s' relates=%s\n",root->name.data(),root->relates.data()); + //printf("Found enum with name '%s' relates=%s\n",qPrint(root->name),qPrint(root->relates)); int i; QCString name; @@ -7041,34 +7203,34 @@ static void addEnumValuesToEnums(const Entry *root) if (getClassMutable(root->relates)==0 && !scope.isEmpty()) scope=mergeScopes(scope,root->relates); else - scope=root->relates.copy(); + scope=root->relates; if ((cd=getClassMutable(scope))==0) nd=getResolvedNamespaceMutable(scope); } if (cd && !name.isEmpty()) // found a enum inside a compound { - //printf("Enum in class '%s'::'%s'\n",cd->name().data(),name.data()); + //printf("Enum in class '%s'::'%s'\n",qPrint(cd->name()),qPrint(name)); fd=0; mnsd=Doxygen::memberNameLinkedMap; isGlobal=FALSE; } else if (nd && !nd->isAnonymous()) // found enum inside namespace { - //printf("Enum in namespace '%s'::'%s'\n",nd->name().data(),name.data()); + //printf("Enum in namespace '%s'::'%s'\n",qPrint(nd->name()),qPrint(name)); mnsd=Doxygen::functionNameLinkedMap; isGlobal=TRUE; } else // found a global enum { fd=root->fileDef(); - //printf("Enum in file '%s': '%s'\n",fd->name().data(),name.data()); + //printf("Enum in file '%s': '%s'\n",qPrint(fd->name()),qPrint(name)); mnsd=Doxygen::functionNameLinkedMap; isGlobal=TRUE; } if (!name.isEmpty()) { - //printf("** name=%s\n",name.data()); + //printf("** name=%s\n",qPrint(name)); MemberName *mn = mnsd->find(name); // for all members with this name if (mn) { @@ -7102,7 +7264,7 @@ static void addEnumValuesToEnums(const Entry *root) // values are only visible inside the enum scope, so we must create // them here and only add them to the enum //printf("md->qualifiedName()=%s e->name=%s tagInfo=%p name=%s\n", - // md->qualifiedName().data(),e->name.data(),e->tagInfo,e->name.data()); + // qPrint(md->qualifiedName()),qPrint(e->name),e->tagInfo,qPrint(e->name)); QCString qualifiedName = substitute(root->name,"::","."); if (!scope.isEmpty() && root->tagInfo()) { @@ -7119,7 +7281,7 @@ static void addEnumValuesToEnums(const Entry *root) } std::unique_ptr<MemberDefMutable> fmd { createMemberDef( fileName,e->startLine,e->startColumn, - e->type,e->name,e->args,0, + e->type,e->name,e->args,QCString(), e->protection, Normal,e->stat,Member, MemberType_EnumValue,ArgumentList(),ArgumentList(),e->metaData) }; const NamespaceDef *mnd = md->getNamespaceDef(); @@ -7150,7 +7312,7 @@ static void addEnumValuesToEnums(const Entry *root) } else { - //printf("e->name=%s isRelated=%d\n",e->name.data(),isRelated); + //printf("e->name=%s isRelated=%d\n",qPrint(e->name),isRelated); MemberName *fmn=0; MemberNameLinkedMap *emnsd = isRelated ? Doxygen::functionNameLinkedMap : mnsd; if (!e->name.isEmpty() && (fmn=emnsd->find(e->name))) @@ -7162,7 +7324,7 @@ static void addEnumValuesToEnums(const Entry *root) if (fmd && fmd->isEnumValue() && fmd->getOuterScope()==md->getOuterScope()) // in same scope { //printf("found enum value with same name %s in scope %s\n", - // fmd->name().data(),fmd->getOuterScope()->name().data()); + // qPrint(fmd->name()),qPrint(fmd->getOuterScope()->name())); if (nd && !nd->isAnonymous()) { const NamespaceDef *fnd=fmd->getNamespaceDef(); @@ -7197,7 +7359,7 @@ static void addEnumValuesToEnums(const Entry *root) if (fcd==cd) // enum value is inside a class { //printf("Inserting enum field %s in enum scope %s\n", - // fmd->name().data(),md->name().data()); + // qPrint(fmd->name()),qPrint(md->name())); md->insertEnumField(fmd); // add field def to list fmd->setEnumScope(md); // cross ref with enum name } @@ -7240,7 +7402,7 @@ static void addEnumDocs(const Entry *root,MemberDefMutable *md) md->setBriefDescription(root->brief,root->briefFile,root->briefLine); } - if (!md->inbodyDocumentation() || !root->parent()->name.isEmpty()) + if (md->inbodyDocumentation().isEmpty() || !root->parent()->name.isEmpty()) { md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine); } @@ -7278,7 +7440,7 @@ static void findEnumDocumentation(const Entry *root) { name=root->name.right(root->name.length()-i-2); // extract name scope=root->name.left(i); // extract scope - //printf("Scope='%s' Name='%s'\n",scope.data(),name.data()); + //printf("Scope='%s' Name='%s'\n",qPrint(scope),qPrint(name)); } else // just the name { @@ -7295,10 +7457,10 @@ static void findEnumDocumentation(const Entry *root) const NamespaceDef *nd=Doxygen::namespaceLinkedMap->find(scope); const FileDef *fd = root->fileDef(); Debug::print(Debug::FindMembers,0,"1. Found docs for enum with name '%s' and scope '%s' in context %s cd=%s, nd=%s fd=%s\n", - name.data(),scope.data(),root->parent()->name.data(), - cd?cd->name().data():"<none>", - nd?nd->name().data():"<none>", - fd?fd->name().data():"<none>"); + qPrint(name),qPrint(scope),qPrint(root->parent()->name), + cd?qPrint(cd->name()):"<none>", + nd?qPrint(nd->name()):"<none>", + fd?qPrint(fd->name()):"<none>"); if (!name.isEmpty()) { @@ -7350,7 +7512,7 @@ static void findEnumDocumentation(const Entry *root) { warn(root->fileName,root->startLine, "Documentation for undefined enum '%s' found.", - name.data() + qPrint(name) ); } } @@ -7483,8 +7645,8 @@ static void computeMemberRelations() { const ClassDef *bmcd = bmd->getClassDef(); //printf("Check relation between '%s'::'%s' (%p) and '%s'::'%s' (%p)\n", - // mcd->name().data(),md->name().data(),md.get(), - // bmcd->name().data(),bmd->name().data(),bmd.get() + // qPrint(mcd->name()),qPrint(md->name()),md.get(), + // qPrint(bmcd->name()),qPrint(bmd->name()),bmd.get() // ); if (bmcd && mcd && bmcd!=mcd && (bmd->virtualness()!=Normal || @@ -7500,8 +7662,8 @@ static void computeMemberRelations() const ArgumentList &bmdAl = bmd->argumentList(); const ArgumentList &mdAl = md->argumentList(); //printf(" Base argList='%s'\n Super argList='%s'\n", - // argListToString(bmdAl).data(), - // argListToString(mdAl).data() + // qPrint(argListToString(bmdAl)), + // qPrint(argListToString(mdAl)) // ); if ( matchArguments2(bmd->getOuterScope(),bmd->getFileDef(),&bmdAl, @@ -7517,7 +7679,7 @@ static void computeMemberRelations() //printf("setting (new) reimplements member\n"); md->setReimplements(bmd); } - //printf("%s: add reimplementedBy member %s\n",bmcd->name().data(),mcd->name().data()); + //printf("%s: add reimplementedBy member %s\n",qPrint(bmcd->name()),qPrint(mcd->name())); bmd->insertReimplementedBy(md); } else @@ -7567,7 +7729,7 @@ static void mergeCategories() if (baseClass) { //printf("*** merging members of category %s into %s\n", - // cd->name().data(),baseClass->name().data()); + // qPrint(cd->name()),qPrint(baseClass->name())); baseClass->mergeCategory(cd.get()); } } @@ -7588,7 +7750,7 @@ static void buildCompleteMemberLists() ClassDefMutable *cdm = toClassDefMutable(cd.get()); if (cdm) { - //printf("*** merging members for %s\n",cd->name().data()); + //printf("*** merging members for %s\n",qPrint(cd->name())); cdm->mergeMembers(); } } @@ -7639,7 +7801,7 @@ static void generateFileSources() auto clangParser = ClangParser::instance()->createTUParser(fd.get()); if (fd->generateSourceFile() && !g_useOutputTemplate) // sources need to be shown in the output { - msg("Generating code for file %s...\n",fd->docName().data()); + msg("Generating code for file %s...\n",qPrint(fd->docName())); clangParser->parse(); fd->writeSourceHeader(*g_outputList); fd->writeSourceBody(*g_outputList,clangParser.get()); @@ -7648,7 +7810,7 @@ static void generateFileSources() else if (!fd->isReference() && Doxygen::parseSourcesNeeded) // we needed to parse the sources even if we do not show them { - msg("Parsing code for file %s...\n",fd->docName().data()); + msg("Parsing code for file %s...\n",qPrint(fd->docName())); clangParser->parse(); fd->parseSource(clangParser.get()); } @@ -7656,7 +7818,7 @@ static void generateFileSources() for (auto incFile : clangParser->filesInSameTU()) { if (filesToProcess.find(incFile)!=filesToProcess.end() && // part of input - fd->absFilePath()!=incFile && // not same file + fd->absFilePath()!=QCString(incFile) && // not same file processedFiles.find(incFile)==processedFiles.end()) // not yet marked as processed { StringVector moreFiles; @@ -7666,7 +7828,7 @@ static void generateFileSources() { if (ifd->generateSourceFile() && !g_useOutputTemplate) // sources need to be shown in the output { - msg(" Generating code for file %s...\n",ifd->docName().data()); + msg(" Generating code for file %s...\n",qPrint(ifd->docName())); ifd->writeSourceHeader(*g_outputList); ifd->writeSourceBody(*g_outputList,clangParser.get()); ifd->writeSourceFooter(*g_outputList); @@ -7674,7 +7836,7 @@ static void generateFileSources() else if (!ifd->isReference() && Doxygen::parseSourcesNeeded) // we needed to parse the sources even if we do not show them { - msg(" Parsing code for file %s...\n",ifd->docName().data()); + msg(" Parsing code for file %s...\n",qPrint(ifd->docName())); ifd->parseSource(clangParser.get()); } processedFiles.insert(incFile); @@ -7695,7 +7857,7 @@ static void generateFileSources() if (fd->generateSourceFile() && !Htags::useHtags && !g_useOutputTemplate) // sources need to be shown in the output { auto clangParser = ClangParser::instance()->createTUParser(fd.get()); - msg("Generating code for file %s...\n",fd->docName().data()); + msg("Generating code for file %s...\n",qPrint(fd->docName())); clangParser->parse(); fd->writeSourceHeader(*g_outputList); fd->writeSourceBody(*g_outputList,clangParser.get()); @@ -7705,7 +7867,7 @@ static void generateFileSources() // we needed to parse the sources even if we do not show them { auto clangParser = ClangParser::instance()->createTUParser(fd.get()); - msg("Parsing code for file %s...\n",fd->docName().data()); + msg("Parsing code for file %s...\n",qPrint(fd->docName())); clangParser->parse(); fd->writeSourceHeader(*g_outputList); fd->writeSourceBody(*g_outputList,clangParser.get()); @@ -7744,12 +7906,12 @@ static void generateFileSources() auto ctx = std::make_shared<SourceContext>(fd.get(),generateSourceFile,*g_outputList); if (generateSourceFile) { - msg("Generating code for file %s...\n",fd->docName().data()); + msg("Generating code for file %s...\n",qPrint(fd->docName())); fd->writeSourceHeader(ctx->ol); } else { - msg("Parsing code for file %s...\n",fd->docName().data()); + msg("Parsing code for file %s...\n",qPrint(fd->docName())); } auto processFile = [ctx]() { StringVector filesInSameTu; @@ -7785,7 +7947,7 @@ static void generateFileSources() fd->getAllIncludeFilesRecursively(filesInSameTu); if (fd->generateSourceFile() && !Htags::useHtags && !g_useOutputTemplate) // sources need to be shown in the output { - msg("Generating code for file %s...\n",fd->docName().data()); + msg("Generating code for file %s...\n",qPrint(fd->docName())); fd->writeSourceHeader(*g_outputList); fd->writeSourceBody(*g_outputList,nullptr); fd->writeSourceFooter(*g_outputList); @@ -7793,7 +7955,7 @@ static void generateFileSources() else if (!fd->isReference() && Doxygen::parseSourcesNeeded) // we needed to parse the sources even if we do not show them { - msg("Parsing code for file %s...\n",fd->docName().data()); + msg("Parsing code for file %s...\n",qPrint(fd->docName())); fd->parseSource(nullptr); } } @@ -7818,7 +7980,7 @@ static void generateFileDocs() bool doc = fd->isLinkableInProject(); if (doc) { - msg("Generating docs for file %s...\n",fd->docName().data()); + msg("Generating docs for file %s...\n",qPrint(fd->docName())); fd->writeDocumentation(*g_outputList); } } @@ -7839,6 +8001,15 @@ static void addSourceReferences() fd->addSourceRef(cd->getStartDefLine(),cd.get(),0); } } + // add source references for concept definitions + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + FileDef *fd=cd->getBodyDef(); + if (fd && cd->isLinkableInProject() && cd->getStartDefLine()!=-1) + { + fd->addSourceRef(cd->getStartDefLine(),cd.get(),0); + } + } // add source references for namespace definitions for (const auto &nd : *Doxygen::namespaceLinkedMap) { @@ -7855,8 +8026,8 @@ static void addSourceReferences() for (const auto &md : *mn) { //printf("class member %s: def=%s body=%d link?=%d\n", - // md->name().data(), - // md->getBodyDef()?md->getBodyDef()->name().data():"<none>", + // qPrint(md->name()), + // md->getBodyDef()?qPrint(md->getBodyDef()->name()):"<none>", // md->getStartBodyLine(),md->isLinkableInProject()); FileDef *fd=md->getBodyDef(); if (fd && @@ -7866,7 +8037,7 @@ static void addSourceReferences() ) { //printf("Found member '%s' in file '%s' at line '%d' def=%s\n", - // md->name().data(),fd->name().data(),md->getStartBodyLine(),md->getOuterScope()->name().data()); + // qPrint(md->name()),qPrint(fd->name()),md->getStartBodyLine(),qPrint(md->getOuterScope()->name())); fd->addSourceRef(md->getStartDefLine(),md->getOuterScope(),md.get()); } } @@ -7877,7 +8048,7 @@ static void addSourceReferences() { FileDef *fd=md->getBodyDef(); //printf("member %s body=[%d,%d] fd=%p link=%d parseSources=%d\n", - // md->name().data(), + // qPrint(md->name()), // md->getStartBodyLine(),md->getEndBodyLine(),fd, // md->isLinkableInProject(), // Doxygen::parseSourcesNeeded); @@ -7888,7 +8059,7 @@ static void addSourceReferences() ) { //printf("Found member '%s' in file '%s' at line '%d' def=%s\n", - // md->name().data(),fd->name().data(),md->getStartBodyLine(),md->getOuterScope()->name().data()); + // qPrint(md->name()),qPrint(fd->name()),md->getStartBodyLine(),qPrint(md->getOuterScope()->name())); fd->addSourceRef(md->getStartDefLine(),md->getOuterScope(),md.get()); } } @@ -7909,7 +8080,7 @@ static void buildDefineList() { std::unique_ptr<MemberDefMutable> md { createMemberDef( def.fileName,def.lineNr,def.columnNr, - "#define",def.name,def.args,0, + "#define",def.name,def.args,QCString(), Public,Normal,FALSE,Member,MemberType_Define, ArgumentList(),ArgumentList(),"") }; @@ -8053,7 +8224,7 @@ static void generateClassList(const ClassLinkedMap &classList) { ClassDefMutable *cd=toClassDefMutable(cdi.get()); - //printf("cd=%s getOuterScope=%p global=%p\n",cd->name().data(),cd->getOuterScope(),Doxygen::globalScope); + //printf("cd=%s getOuterScope=%p global=%p\n",qPrint(cd->name()),cd->getOuterScope(),Doxygen::globalScope); if (cd && (cd->getOuterScope()==0 || // <-- should not happen, but can if we read an old tag file cd->getOuterScope()==Doxygen::globalScope // only look at global classes @@ -8064,7 +8235,7 @@ static void generateClassList(const ClassLinkedMap &classList) // template instances if ( cd->isLinkableInProject() && cd->templateMaster()==0) { - msg("Generating docs for compound %s...\n",cd->name().data()); + msg("Generating docs for compound %s...\n",qPrint(cd->name())); cd->writeDocumentation(*g_outputList); cd->writeMemberList(*g_outputList); @@ -8083,6 +8254,27 @@ static void generateClassDocs() //---------------------------------------------------------------------------- +static void generateConceptDocs() +{ + for (const auto &cdi : *Doxygen::conceptLinkedMap) + { + ConceptDefMutable *cd=toConceptDefMutable(cdi.get()); + + //printf("cd=%s getOuterScope=%p global=%p\n",qPrint(cd->name()),cd->getOuterScope(),Doxygen::globalScope); + if (cd && + (cd->getOuterScope()==0 || // <-- should not happen, but can if we read an old tag file + cd->getOuterScope()==Doxygen::globalScope // only look at global concepts + ) && !cd->isHidden() && cd->isLinkableInProject() + ) + { + msg("Generating docs for concept %s...\n",qPrint(cd->name())); + cd->writeDocumentation(*g_outputList); + } + } +} + +//---------------------------------------------------------------------------- + static void inheritDocumentation() { for (const auto &mn : *Doxygen::memberNameLinkedMap) @@ -8091,7 +8283,7 @@ static void inheritDocumentation() { MemberDefMutable *md = toMemberDefMutable(imd.get()); //static int count=0; - //printf("%04d Member '%s'\n",count++,md->qualifiedName().data()); + //printf("%04d Member '%s'\n",count++,qPrint(md->qualifiedName())); if (md && md->documentation().isEmpty() && md->briefDescription().isEmpty()) { // no documentation yet const MemberDef *bmd = md->reimplements(); @@ -8099,7 +8291,7 @@ static void inheritDocumentation() bmd->briefDescription().isEmpty() ) { // search up the inheritance tree for a documentation member - //printf("bmd=%s class=%s\n",bmd->name().data(),bmd->getClassDef()->name().data()); + //printf("bmd=%s class=%s\n",qPrint(bmd->name()),qPrint(bmd->getClassDef()->name())); bmd = bmd->reimplements(); } if (bmd) // copy the documentation from the reimplemented member @@ -8228,6 +8420,15 @@ static void findSectionsInDocumentation() cdm->findSectionsInDocumentation(); } } + // for each concept + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + ConceptDefMutable *cdm = toConceptDefMutable(cd.get()); + if (cdm) + { + cdm->findSectionsInDocumentation(); + } + } // for each file for (const auto &fn : *Doxygen::inputNameLinkedMap) { @@ -8376,19 +8577,19 @@ static void findDefineDocumentation(Entry *root) ) { //printf("found define '%s' '%s' brief='%s' doc='%s'\n", - // root->name.data(),root->args.data(),root->brief.data(),root->doc.data()); + // qPrint(root->name),qPrint(root->args),qPrint(root->brief),qPrint(root->doc)); if (root->tagInfo() && !root->name.isEmpty()) // define read from a tag file { std::unique_ptr<MemberDefMutable> md { createMemberDef(root->tagInfo()->tagName,1,1, - "#define",root->name,root->args,0, + "#define",root->name,root->args,QCString(), Public,Normal,FALSE,Member,MemberType_Define, ArgumentList(),ArgumentList(),"") }; md->setTagInfo(root->tagInfo()); md->setLanguage(root->lang); - //printf("Searching for '%s' fd=%p\n",filePathName.data(),fd); + //printf("Searching for '%s' fd=%p\n",qPrint(filePathName),fd); md->setFileDef(root->parent()->fileDef()); - //printf("Adding member=%s\n",md->name().data()); + //printf("Adding member=%s\n",qPrint(md->name())); MemberName *mn = Doxygen::functionNameLinkedMap->add(root->name); mn->push_back(std::move(md)); } @@ -8459,10 +8660,10 @@ static void findDefineDocumentation(Entry *root) } } } - //warn("define %s found in the following files:\n",root->name.data()); + //warn("define %s found in the following files:\n",qPrint(root->name)); //warn("Cannot determine where to add the documentation found " // "at line %d of file %s. \n", - // root->startLine,root->fileName.data()); + // root->startLine,qPrint(root->fileName)); } } else if (!root->doc.isEmpty() || !root->brief.isEmpty()) // define not found @@ -8472,7 +8673,7 @@ static void findDefineDocumentation(Entry *root) { warn(root->fileName,root->startLine, "documentation for unknown define %s found.\n", - root->name.data() + qPrint(root->name) ); } else @@ -8480,7 +8681,7 @@ static void findDefineDocumentation(Entry *root) warn(root->fileName,root->startLine, "found documented #define %s but ignoring it because " "ENABLE_PREPROCESSING is NO.\n", - root->name.data() + qPrint(root->name) ); } } @@ -8497,7 +8698,7 @@ static void findDirDocumentation(const Entry *root) QCString normalizedName = root->name; normalizedName = substitute(normalizedName,"\\","/"); //printf("root->docFile=%s normalizedName=%s\n", - // root->docFile.data(),normalizedName.data()); + // qPrint(root->docFile),qPrint(normalizedName)); if (root->docFile==normalizedName) // current dir? { int lastSlashPos=normalizedName.findRev('/'); @@ -8513,7 +8714,7 @@ static void findDirDocumentation(const Entry *root) DirDef *matchingDir=0; for (const auto &dir : *Doxygen::dirLinkedMap) { - //printf("Dir: %s<->%s\n",dir->name().data(),normalizedName.data()); + //printf("Dir: %s<->%s\n",qPrint(dir->name()),qPrint(normalizedName)); if (dir->name().right(normalizedName.length())==normalizedName) { if (matchingDir) @@ -8522,7 +8723,7 @@ static void findDirDocumentation(const Entry *root) "\\dir command matches multiple directories.\n" " Applying the command for directory %s\n" " Ignoring the command for directory %s\n", - matchingDir->name().data(),dir->name().data() + qPrint(matchingDir->name()),qPrint(dir->name()) ); } else @@ -8533,7 +8734,7 @@ static void findDirDocumentation(const Entry *root) } if (matchingDir) { - //printf("Match for with dir %s\n",matchingDir->name().data()); + //printf("Match for with dir %s\n",qPrint(matchingDir->name())); matchingDir->setBriefDescription(root->brief,root->briefFile,root->briefLine); matchingDir->setDocumentation(root->doc,root->docFile,root->docLine); matchingDir->setRefItems(root->sli); @@ -8542,7 +8743,7 @@ static void findDirDocumentation(const Entry *root) else { warn(root->fileName,root->startLine,"No matching " - "directory found for command \\dir %s\n",normalizedName.data()); + "directory found for command \\dir %s\n",qPrint(normalizedName)); } } for (const auto &e : root->children()) findDirDocumentation(e.get()); @@ -8572,7 +8773,7 @@ static void buildPageList(Entry *root) "page", name, title, - 0,0 + QCString(),0 ); } for (const auto &e : root->children()) buildPageList(e.get()); @@ -8586,7 +8787,7 @@ static void findMainPage(Entry *root) if (Doxygen::mainPage==0 && root->tagInfo()==0) { //printf("mainpage: docLine=%d startLine=%d\n",root->docLine,root->startLine); - //printf("Found main page! \n======\n%s\n=======\n",root->doc.data()); + //printf("Found main page! \n======\n%s\n=======\n",qPrint(root->doc)); QCString title=root->args.stripWhiteSpace(); if (title.isEmpty()) title = Config_getString(PROJECT_NAME); //QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index"; @@ -8606,12 +8807,12 @@ static void findMainPage(Entry *root) if (si->lineNr() != -1) { warn(root->fileName,root->startLine,"multiple use of section label '%s' for main page, (first occurrence: %s, line %d)", - Doxygen::mainPage->name().data(),si->fileName().data(),si->lineNr()); + qPrint(Doxygen::mainPage->name()),qPrint(si->fileName()),si->lineNr()); } else { warn(root->fileName,root->startLine,"multiple use of section label '%s' for main page, (first occurrence: %s)", - Doxygen::mainPage->name().data(),si->fileName().data()); + qPrint(Doxygen::mainPage->name()),qPrint(si->fileName())); } } else @@ -8631,7 +8832,7 @@ static void findMainPage(Entry *root) { warn(root->fileName,root->startLine, "found more than one \\mainpage comment block! (first occurrence: %s, line %d), Skipping current block!", - Doxygen::mainPage->docFile().data(),Doxygen::mainPage->getStartBodyLine()); + qPrint(Doxygen::mainPage->docFile()),Doxygen::mainPage->getStartBodyLine()); } } for (const auto &e : root->children()) findMainPage(e.get()); @@ -8670,13 +8871,13 @@ static void computePageRelations(Entry *root) { term("page defined at line %d of file %s with label %s is a direct " "subpage of itself! Please remove this cyclic dependency.\n", - pd->docLine(),pd->docFile().data(),pd->name().data()); + pd->docLine(),qPrint(pd->docFile()),qPrint(pd->name())); } else if (subPd) { pd->addInnerCompound(subPd); //printf("*** Added subpage relation: %s->%s\n", - // pd->name().data(),subPd->name().data()); + // qPrint(pd->name()),qPrint(subPd->name())); } } } @@ -8695,7 +8896,7 @@ static void checkPageRelations() { term("page defined at line %d of file %s with label %s is a subpage " "of itself! Please remove this cyclic dependency.\n", - pd->docLine(),pd->docFile().data(),pd->name().data()); + pd->docLine(),qPrint(pd->docFile()),qPrint(pd->name())); } ppd=ppd->getOuterScope(); } @@ -8709,8 +8910,8 @@ static void resolveUserReferences() for (const auto &si : SectionManager::instance()) { //printf("si->label='%s' si->definition=%s si->fileName='%s'\n", - // si->label.data(),si->definition?si->definition->name().data():"<none>", - // si->fileName.data()); + // qPrint(si->label),si->definition?qPrint(si->definition->name()):"<none>", + // qPrint(si->fileName)); PageDef *pd=0; // hack: the items of a todo/test/bug/deprecated list are all fragments from @@ -8729,7 +8930,7 @@ static void resolveUserReferences() } } - //printf("start: si->label=%s si->fileName=%s\n",si->label.data(),si->fileName.data()); + //printf("start: si->label=%s si->fileName=%s\n",qPrint(si->label),qPrint(si->fileName)); if (!si->generated()) { // if this section is in a page and the page is in a group, then we @@ -8757,12 +8958,12 @@ static void resolveUserReferences() } else { - //si->fileName=si->definition->getOutputFileBase().copy(); - //printf("Setting si->fileName to %s\n",si->fileName.data()); + //si->fileName=si->definition->getOutputFileBase(); + //printf("Setting si->fileName to %s\n",qPrint(si->fileName)); } } } - //printf("end: si->label=%s si->fileName=%s\n",si->label.data(),si->fileName.data()); + //printf("end: si->label=%s si->fileName=%s\n",qPrint(si->label),qPrint(si->fileName)); } } @@ -8780,7 +8981,7 @@ static void generatePageDocs() { if (!pd->getGroupDef() && !pd->isReference()) { - msg("Generating docs for page %s...\n",pd->name().data()); + msg("Generating docs for page %s...\n",qPrint(pd->name())); Doxygen::insideMainPage=TRUE; pd->writeDocumentation(*g_outputList); Doxygen::insideMainPage=FALSE; @@ -8800,7 +9001,7 @@ static void buildExampleList(Entry *root) warn(root->fileName,root->startLine, "Example %s was already documented. Ignoring " "documentation found here.", - root->name.data() + qPrint(root->name) ); } else @@ -8830,8 +9031,8 @@ void printNavTree(Entry *root,int indent) QCString indentStr; indentStr.fill(' ',indent); msg("%s%s (sec=0x%x)\n", - indentStr.isEmpty()?"":indentStr.data(), - root->name.isEmpty()?"<empty>":root->name.data(), + indentStr.isEmpty()?"":qPrint(indentStr), + root->name.isEmpty()?"<empty>":qPrint(root->name), root->section); for (const auto &e : root->children()) { @@ -8848,14 +9049,14 @@ static void generateExampleDocs() g_outputList->disable(OutputGenerator::Man); for (const auto &pd : *Doxygen::exampleLinkedMap) { - msg("Generating docs for example %s...\n",pd->name().data()); + msg("Generating docs for example %s...\n",qPrint(pd->name())); auto intf = Doxygen::parserManager->getCodeParser(".c"); // TODO: do this on code type intf->resetCodeParserState(); QCString n=pd->getOutputFileBase(); startFile(*g_outputList,n,n,pd->name()); startTitle(*g_outputList,n); g_outputList->docify(pd->name()); - endTitle(*g_outputList,n,0); + endTitle(*g_outputList,n,QCString()); g_outputList->startContents(); QCString lineNoOptStr; if (pd->showLineNo()) @@ -8911,7 +9112,7 @@ static void generateNamespaceClassDocs(const ClassLinkedRefMap &classList) && !cd->isHidden() && !cd->isEmbeddedInOuterScope() ) { - msg("Generating docs for compound %s...\n",cd->name().data()); + msg("Generating docs for compound %s...\n",qPrint(cd->name())); cdm->writeDocumentation(*g_outputList); cdm->writeMemberList(*g_outputList); @@ -8921,6 +9122,20 @@ static void generateNamespaceClassDocs(const ClassLinkedRefMap &classList) } } +static void generateNamespaceConceptDocs(const ConceptLinkedRefMap &conceptList) +{ + // for each concept in the namespace... + for (const auto &cd : conceptList) + { + ConceptDefMutable *cdm = toConceptDefMutable(cd); + if ( cdm && cd->isLinkableInProject() && !cd->isHidden()) + { + msg("Generating docs for concept %s...\n",qPrint(cd->name())); + cdm->writeDocumentation(*g_outputList); + } + } +} + static void generateNamespaceDocs() { static bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); @@ -8935,7 +9150,7 @@ static void generateNamespaceDocs() NamespaceDefMutable *ndm = toNamespaceDefMutable(nd.get()); if (ndm) { - msg("Generating docs for namespace %s\n",nd->name().data()); + msg("Generating docs for namespace %s\n",qPrint(nd->name())); ndm->writeDocumentation(*g_outputList); } } @@ -8947,6 +9162,7 @@ static void generateNamespaceDocs() generateNamespaceClassDocs(nd->getStructs()); generateNamespaceClassDocs(nd->getExceptions()); } + generateNamespaceConceptDocs(nd->getConcepts()); } } @@ -8978,62 +9194,60 @@ static QCString fixSlashes(QCString &s) * If the \a shortList parameter is TRUE a configuration file without * comments will be generated. */ -static void generateConfigFile(const char *configFile,bool shortList, +static void generateConfigFile(const QCString &configFile,bool shortList, bool updateOnly=FALSE) { - std::ofstream t; - bool fileOpened=openOutputFile(configFile,t); - bool writeToStdout=(configFile[0]=='-' && configFile[1]=='\0'); + std::ofstream f; + bool fileOpened=openOutputFile(configFile,f); + bool writeToStdout=configFile=="-"; if (fileOpened) { + TextStream t(&f); Config::writeTemplate(t,shortList,updateOnly); if (!writeToStdout) { if (!updateOnly) { - msg("\n\nConfiguration file '%s' created.\n\n",configFile); + msg("\n\nConfiguration file '%s' created.\n\n",qPrint(configFile)); msg("Now edit the configuration file and enter\n\n"); - if (qstrcmp(configFile,"Doxyfile") || qstrcmp(configFile,"doxyfile")) - msg(" doxygen %s\n\n",configFile); + if (configFile!="Doxyfile" && configFile!="doxyfile") + msg(" doxygen %s\n\n",qPrint(configFile)); else msg(" doxygen\n\n"); msg("to generate the documentation for your project\n\n"); } else { - msg("\n\nConfiguration file '%s' updated.\n\n",configFile); + msg("\n\nConfiguration file '%s' updated.\n\n",qPrint(configFile)); } } } else { - term("Cannot open file %s for writing\n",configFile); + term("Cannot open file %s for writing\n",qPrint(configFile)); } } static void compareDoxyfile() { std::ofstream f; - char configFile[2]; - configFile[0] = '-'; - configFile[1] = '\0'; - bool fileOpened=openOutputFile(configFile,f); + bool fileOpened=openOutputFile("-",f); if (fileOpened) { - Config::compareDoxyfile(f); + TextStream t(&f); + Config::compareDoxyfile(t); } else { - term("Cannot open file %s for writing\n",configFile); + term("Cannot open stdout for writing\n"); } } //---------------------------------------------------------------------------- // read and parse a tag file -static void readTagFile(const std::shared_ptr<Entry> &root,const char *tl) +static void readTagFile(const std::shared_ptr<Entry> &root,const QCString &tagLine) { - QCString tagLine = tl; QCString fileName; QCString destName; int eqPos = tagLine.find('='); @@ -9045,7 +9259,7 @@ static void readTagFile(const std::shared_ptr<Entry> &root,const char *tl) FileInfo fi(fileName.str()); Doxygen::tagDestinationMap.insert( std::make_pair(fi.absFilePath(), destName.str())); - //printf("insert tagDestination %s->%s\n",fi.fileName().data(),destName.data()); + //printf("insert tagDestination %s->%s\n",qPrint(fi.fileName()),qPrint(destName)); } else { @@ -9056,14 +9270,14 @@ static void readTagFile(const std::shared_ptr<Entry> &root,const char *tl) if (!fi.exists() || !fi.isFile()) { err("Tag file '%s' does not exist or is not a file. Skipping it...\n", - fileName.data()); + qPrint(fileName)); return; } if (!destName.isEmpty()) - msg("Reading tag file '%s', location '%s'...\n",fileName.data(),destName.data()); + msg("Reading tag file '%s', location '%s'...\n",qPrint(fileName),qPrint(destName)); else - msg("Reading tag file '%s'...\n",fileName.data()); + msg("Reading tag file '%s'...\n",qPrint(fileName)); parseTagFile(root,fi.absFilePath().c_str()); } @@ -9080,7 +9294,7 @@ static void copyLatexStyleSheet() FileInfo fi(fileName); if (!fi.exists()) { - err("Style sheet '%s' specified by LATEX_EXTRA_STYLESHEET does not exist!\n",fileName.data()); + err("Style sheet '%s' specified by LATEX_EXTRA_STYLESHEET does not exist!\n",qPrint(fileName)); } else { @@ -9089,7 +9303,7 @@ static void copyLatexStyleSheet() { destFileName += LATEX_STYLE_EXTENSION; } - copyFile(fileName, destFileName); + copyFile(QCString(fileName), destFileName); } } } @@ -9104,7 +9318,7 @@ static void copyStyleSheet() FileInfo fi(htmlStyleSheet.str()); if (!fi.exists()) { - err("Style sheet '%s' specified by HTML_STYLESHEET does not exist!\n",htmlStyleSheet.data()); + err("Style sheet '%s' specified by HTML_STYLESHEET does not exist!\n",qPrint(htmlStyleSheet)); htmlStyleSheet = Config_updateString(HTML_STYLESHEET,""); // revert to the default } else @@ -9126,12 +9340,12 @@ static void copyStyleSheet() } else if (fi.fileName()=="doxygen.css" || fi.fileName()=="tabs.css" || fi.fileName()=="navtree.css") { - err("Style sheet %s specified by HTML_EXTRA_STYLESHEET is already a built-in stylesheet. Please use a different name\n",fi.fileName().data()); + err("Style sheet %s specified by HTML_EXTRA_STYLESHEET is already a built-in stylesheet. Please use a different name\n",qPrint(fi.fileName())); } else { QCString destFileName = Config_getString(HTML_OUTPUT)+"/"+fi.fileName(); - copyFile(fileName, destFileName); + copyFile(QCString(fileName), destFileName); } } } @@ -9145,7 +9359,7 @@ static void copyLogo(const QCString &outputOption) FileInfo fi(projectLogo.str()); if (!fi.exists()) { - err("Project logo '%s' specified by PROJECT_LOGO does not exist!\n",projectLogo.data()); + err("Project logo '%s' specified by PROJECT_LOGO does not exist!\n",qPrint(projectLogo)); projectLogo = Config_updateString(PROJECT_LOGO,""); // revert to the default } else @@ -9166,13 +9380,13 @@ static void copyExtraFiles(const StringVector &files,const QCString &filesOption FileInfo fi(fileName); if (!fi.exists()) { - err("Extra file '%s' specified in %s does not exist!\n", fileName.c_str(),filesOption.data()); + err("Extra file '%s' specified in %s does not exist!\n", fileName.c_str(),qPrint(filesOption)); } else { QCString destFileName = outputOption+"/"+fi.fileName(); Doxygen::indexList->addImageFile(fi.fileName().c_str()); - copyFile(fileName, destFileName); + copyFile(QCString(fileName), destFileName); } } } @@ -9214,7 +9428,7 @@ static void generateDiskNames() std::sort(fileEntries.begin(), fileEntries.end(), [](const FileEntry &fe1,const FileEntry &fe2) - { return qstrcmp(fe1.path.data(),fe2.path.data())<0; } + { return fe1.path < fe2.path; } ); // since the entries are sorted, the common prefix of the whole array is same @@ -9246,7 +9460,7 @@ static void generateDiskNames() { QCString prefix = fileEntry.path.right(fileEntry.path.length()-j-1); fileEntry.fileDef->setName(prefix+fn->fileName()); - //printf("!!!!!!!! non unique disk name=%s:%s\n",prefix.data(),fn->fileName()); + //printf("!!!!!!!! non unique disk name=%s:%s\n",qPrint(prefix),fn->fileName()); fileEntry.fileDef->setDiskName(prefix+fn->fileName()); } } @@ -9257,7 +9471,7 @@ static void generateDiskNames() //---------------------------------------------------------------------------- -static std::unique_ptr<OutlineParserInterface> getParserForFile(const char *fn) +static std::unique_ptr<OutlineParserInterface> getParserForFile(const QCString &fn) { QCString fileName=fn; QCString extension; @@ -9276,7 +9490,7 @@ static std::unique_ptr<OutlineParserInterface> getParserForFile(const char *fn) } static std::shared_ptr<Entry> parseFile(OutlineParserInterface &parser, - FileDef *fd,const char *fn, + FileDef *fd,const QCString &fn, ClangTUParser *clangParser,bool newTU) { QCString fileName=fn; @@ -9305,13 +9519,13 @@ static std::shared_ptr<Entry> parseFile(OutlineParserInterface &parser, preprocessor.addSearchDir(absPath.c_str()); } BufStr inBuf((uint)fi.size()+4096); - msg("Preprocessing %s...\n",fn); + msg("Preprocessing %s...\n",qPrint(fn)); readInputFile(fileName,inBuf); preprocessor.processFile(fileName,inBuf,preBuf); } else // no preprocessing { - msg("Reading %s...\n",fn); + msg("Reading %s...\n",qPrint(fn)); readInputFile(fileName,preBuf); } if (preBuf.data() && preBuf.curPos()>0 && *(preBuf.data()+preBuf.curPos()-1)!='\n') @@ -9561,13 +9775,13 @@ static void parseFilesSingleThreading(const std::shared_ptr<Entry> &root) // resolves a path that may include symlinks, if a recursive symlink is // found an empty string is returned. -static QCString resolveSymlink(QCString path) +static std::string resolveSymlink(const std::string &path) { int sepPos=0; int oldPos=0; StringSet nonSymlinks; StringSet known; - QCString result = path; + QCString result(path); QCString oldPrefix = "/"; do { @@ -9602,7 +9816,7 @@ static QCString resolveSymlink(QCString path) } result = Dir::cleanDirPath(target.str()); sepPos = 0; - if (known.find(result.str())!=known.end()) return QCString(); // recursive symlink! + if (known.find(result.str())!=known.end()) return std::string(); // recursive symlink! known.insert(result.str()); if (isRelative) { @@ -9663,7 +9877,7 @@ static void readDir(FileInfo *fi, g_pathsVisited.insert(dirName); } Dir dir(dirName); - msg("Searching for files in directory %s\n", fi->absFilePath().data()); + msg("Searching for files in directory %s\n", qPrint(fi->absFilePath())); //printf("killSet=%p count=%d\n",killSet,killSet ? (int)killSet->count() : -1); for (const auto &dirEntry : dir.iterator()) @@ -9671,7 +9885,7 @@ static void readDir(FileInfo *fi, FileInfo cfi(dirEntry.path()); if (exclSet==0 || exclSet->find(cfi.absFilePath())==exclSet->end()) { // file should not be excluded - //printf("killSet->find(%s)\n",cfi->absFilePath().data()); + //printf("killSet->find(%s)\n",qPrint(cfi->absFilePath())); if (!cfi.exists() || !cfi.isReadable()) { if (errorIfNotExist) @@ -9689,11 +9903,11 @@ static void readDir(FileInfo *fi, std::string name=cfi.fileName(); if (fnMap) { - std::unique_ptr<FileDef> fd { createFileDef(cfi.dirPath()+"/",name) }; + std::unique_ptr<FileDef> fd { createFileDef(QCString(cfi.dirPath()+"/"),QCString(name)) }; FileName *fn=0; if (!name.empty()) { - fn = fnMap->add(name.c_str(),cfi.absFilePath().c_str()); + fn = fnMap->add(QCString(name),QCString(cfi.absFilePath())); fn->push_back(std::move(fd)); } } @@ -9721,7 +9935,7 @@ static void readDir(FileInfo *fi, // read a file or all files in a directory and append their contents to the // input string. The names of the files are appended to the 'fiList' list. -void readFileOrDirectory(const char *s, +void readFileOrDirectory(const QCString &s, FileNameLinkedMap *fnMap, StringUnorderedSet *exclSet, const StringVector *patList, @@ -9736,9 +9950,9 @@ void readFileOrDirectory(const char *s, { //printf("killSet count=%d\n",killSet ? (int)killSet->size() : -1); // strip trailing slashes - if (s==0) return; + if (s.isEmpty()) return; - FileInfo fi(s); + FileInfo fi(s.str()); //printf("readFileOrDirectory(%s)\n",s); { if (exclSet==0 || exclSet->find(fi.absFilePath())==exclSet->end()) @@ -9747,7 +9961,7 @@ void readFileOrDirectory(const char *s, { if (errorIfNotExist) { - warn_uncond("source '%s' is not a readable file or directory... skipping.\n",s); + warn_uncond("source '%s' is not a readable file or directory... skipping.\n",qPrint(s)); } } else if (!Config_getBool(EXCLUDE_SYMLINKS) || !fi.isSymLink()) @@ -9760,16 +9974,16 @@ void readFileOrDirectory(const char *s, { paths->insert(dirPath); } - //printf("killSet.find(%s)=%d\n",fi.absFilePath().data(),killSet.find(fi.absFilePath())!=killSet.end()); + //printf("killSet.find(%s)=%d\n",qPrint(fi.absFilePath()),killSet.find(fi.absFilePath())!=killSet.end()); if (killSet==0 || killSet->find(filePath)==killSet->end()) { std::string name=fi.fileName(); if (fnMap) { - std::unique_ptr<FileDef> fd { createFileDef(dirPath+"/",name) }; + std::unique_ptr<FileDef> fd { createFileDef(QCString(dirPath+"/"),QCString(name)) }; if (!name.empty()) { - FileName *fn = fnMap->add(name.c_str(),filePath.c_str()); + FileName *fn = fnMap->add(QCString(name),QCString(filePath)); fn->push_back(std::move(fd)); } } @@ -9809,7 +10023,7 @@ static void escapeAliases() { for (auto &kv : Doxygen::aliasMap) { - QCString value=kv.second; + QCString value(kv.second); QCString newValue; int in,p=0; // for each \n in the alias command value @@ -9843,7 +10057,7 @@ static void escapeAliases() } newValue+=value.mid(p,value.length()-p); kv.second=newValue.str(); - //printf("Alias %s has value %s\n",adi.currentKey().data(),s->data()); + //printf("Alias %s has value %s\n",kv.first.c_str(),qPrint(newValue)); } } @@ -9855,13 +10069,13 @@ void readAliases() const StringVector &aliasList = Config_getList(ALIASES); for (const auto &al : aliasList) { - QCString alias = al; + QCString alias(al); int i=alias.find('='); if (i>0) { QCString name=alias.left(i).stripWhiteSpace(); QCString value=alias.right(alias.length()-i-1); - //printf("Alias: found name='%s' value='%s'\n",name.data(),value.data()); + //printf("Alias: found name='%s' value='%s'\n",qPrint(name),qPrint(value)); if (!name.isEmpty()) { auto it = Doxygen::aliasMap.find(name.str()); @@ -9882,7 +10096,7 @@ void readAliases() //---------------------------------------------------------------------------- -static void dumpSymbol(std::ostream &t,Definition *d) +static void dumpSymbol(TextStream &t,Definition *d) { QCString anchor; if (d->definitionType()==Definition::TypeMember) @@ -9906,9 +10120,10 @@ static void dumpSymbol(std::ostream &t,Definition *d) static void dumpSymbolMap() { - std::ofstream t("symbols.sql",std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + std::ofstream f("symbols.sql",std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); for (const auto &kv : Doxygen::symbolMap) { dumpSymbol(t,kv.second); @@ -9921,7 +10136,7 @@ static void devUsage() { msg("Developer parameters:\n"); msg(" -m dump symbol map\n"); - msg(" -b output to wizard\n"); + msg(" -b making messages output unbuffered\n"); msg(" -T activates output generation via Django like template\n"); msg(" -d <level> enable a debug level, such as (multiple invocations of -d are possible):\n"); Debug::printFlags(); @@ -9934,7 +10149,7 @@ static void devUsage() static void version(const bool extended) { QCString versionString = getFullVersion(); - msg("%s\n",versionString.data()); + msg("%s\n",qPrint(versionString)); if (extended) { QCString extVers; @@ -9956,7 +10171,7 @@ static void version(const bool extended) { int lastComma = extVers.findRev(','); if (lastComma != -1) extVers = extVers.replace(lastComma,1," and"); - msg(" with %s.\n",extVers.data()); + msg(" with %s.\n",qPrint(extVers)); } } } @@ -9964,33 +10179,33 @@ static void version(const bool extended) //---------------------------------------------------------------------------- // print the usage of doxygen -static void usage(const char *name,const char *versionString) +static void usage(const QCString &name,const QCString &versionString) { - msg("Doxygen version %s\nCopyright Dimitri van Heesch 1997-2021\n\n",versionString); + msg("Doxygen version %s\nCopyright Dimitri van Heesch 1997-2021\n\n",qPrint(versionString)); msg("You can use doxygen in a number of ways:\n\n"); msg("1) Use doxygen to generate a template configuration file:\n"); - msg(" %s [-s] -g [configName]\n\n",name); + msg(" %s [-s] -g [configName]\n\n",qPrint(name)); msg("2) Use doxygen to update an old configuration file:\n"); - msg(" %s [-s] -u [configName]\n\n",name); + msg(" %s [-s] -u [configName]\n\n",qPrint(name)); msg("3) Use doxygen to generate documentation using an existing "); msg("configuration file:\n"); - msg(" %s [configName]\n\n",name); + msg(" %s [configName]\n\n",qPrint(name)); msg("4) Use doxygen to generate a template file controlling the layout of the\n"); msg(" generated documentation:\n"); - msg(" %s -l [layoutFileName]\n\n",name); + msg(" %s -l [layoutFileName]\n\n",qPrint(name)); msg(" In case layoutFileName is omitted layoutFileName.xml will be used as filename.\n"); msg(" If - is used for layoutFileName doxygen will write to standard output.\n\n"); msg("5) Use doxygen to generate a template style sheet file for RTF, HTML or Latex.\n"); - msg(" RTF: %s -w rtf styleSheetFile\n",name); - msg(" HTML: %s -w html headerFile footerFile styleSheetFile [configFile]\n",name); - msg(" LaTeX: %s -w latex headerFile footerFile styleSheetFile [configFile]\n\n",name); + msg(" RTF: %s -w rtf styleSheetFile\n",qPrint(name)); + msg(" HTML: %s -w html headerFile footerFile styleSheetFile [configFile]\n",qPrint(name)); + msg(" LaTeX: %s -w latex headerFile footerFile styleSheetFile [configFile]\n\n",qPrint(name)); msg("6) Use doxygen to generate a rtf extensions file\n"); - msg(" RTF: %s -e rtf extensionsFile\n\n",name); + msg(" RTF: %s -e rtf extensionsFile\n\n",qPrint(name)); msg(" If - is used for extensionsFile doxygen will write to standard output.\n\n"); msg("7) Use doxygen to compare the used configuration file with the template configuration file\n"); - msg(" %s -x [configFile]\n\n",name); + msg(" %s -x [configFile]\n\n",qPrint(name)); msg("8) Use doxygen to show a list of built-in emojis.\n"); - msg(" %s -f emoji outputFileName\n\n",name); + msg(" %s -f emoji outputFileName\n\n",qPrint(name)); msg(" If - is used for outputFileName doxygen will write to standard output.\n\n"); msg("If -s is specified the comments of the configuration items in the config file will be omitted.\n"); msg("If configName is omitted 'Doxyfile' will be used as a default.\n"); @@ -10018,9 +10233,9 @@ static const char *getArg(int argc,char **argv,int &optind) class NullOutlineParser : public OutlineParserInterface { public: - void parseInput(const char *, const char *,const std::shared_ptr<Entry> &, ClangTUParser*) {} + void parseInput(const QCString &file, const char *buf,const std::shared_ptr<Entry> &, ClangTUParser*) {} bool needsPreprocessing(const QCString &) const { return FALSE; } - void parsePrototype(const char *) {} + void parsePrototype(const QCString &) {} }; @@ -10032,8 +10247,8 @@ template<class T> std::function< std::unique_ptr<T>() > make_parser_factory() void initDoxygen() { initResources(); - const char *lang = Portable::getenv("LC_ALL"); - if (lang) Portable::setenv("LANG",lang); + QCString lang = Portable::getenv("LC_ALL"); + if (!lang.isEmpty()) Portable::setenv("LANG",lang); std::setlocale(LC_ALL,""); std::setlocale(LC_CTYPE,"C"); // to get isspace(0xA0)==0, needed for UTF-8 std::setlocale(LC_NUMERIC,"C"); @@ -10080,6 +10295,7 @@ void initDoxygen() Doxygen::namespaceLinkedMap = new NamespaceLinkedMap; Doxygen::classLinkedMap = new ClassLinkedMap; Doxygen::hiddenClassLinkedMap = new ClassLinkedMap; + Doxygen::conceptLinkedMap = new ConceptLinkedMap; Doxygen::dirLinkedMap = new DirLinkedMap; Doxygen::pageLinkedMap = new PageLinkedMap; // all doc pages Doxygen::exampleLinkedMap = new PageLinkedMap; // all examples @@ -10141,7 +10357,7 @@ void cleanUpDoxygen() DotManager::deleteInstance(); } -static int computeIdealCacheParam(uint v) +static int computeIdealCacheParam(size_t v) { //printf("computeIdealCacheParam(v=%u)\n",v); @@ -10162,11 +10378,11 @@ void readConfiguration(int argc, char **argv) **************************************************************************/ int optind=1; - const char *configName=0; - const char *layoutName=0; - const char *debugLabel; - const char *formatName; - const char *listName; + QCString configName; + QCString layoutName; + QCString debugLabel; + QCString formatName; + QCString listName; bool genConfig=FALSE; bool shortList=FALSE; bool diffList=FALSE; @@ -10197,7 +10413,7 @@ void readConfiguration(int argc, char **argv) break; case 'd': debugLabel=getArg(argc,argv,optind); - if (!debugLabel) + if (debugLabel.isEmpty()) { devUsage(); cleanUpDoxygen(); @@ -10206,7 +10422,7 @@ void readConfiguration(int argc, char **argv) retVal = Debug::setFlag(debugLabel); if (!retVal) { - err("option \"-d\" has unknown debug specifier: \"%s\".\n",debugLabel); + err("option \"-d\" has unknown debug specifier: \"%s\".\n",qPrint(debugLabel)); devUsage(); cleanUpDoxygen(); exit(1); @@ -10223,13 +10439,13 @@ void readConfiguration(int argc, char **argv) break; case 'e': formatName=getArg(argc,argv,optind); - if (!formatName) + if (formatName.isEmpty()) { err("option \"-e\" is missing format specifier rtf.\n"); cleanUpDoxygen(); exit(1); } - if (qstricmp(formatName,"rtf")==0) + if (qstricmp(formatName.data(),"rtf")==0) { if (optind+1>=argc) { @@ -10240,7 +10456,8 @@ void readConfiguration(int argc, char **argv) std::ofstream f; if (openOutputFile(argv[optind+1],f)) { - RTFGenerator::writeExtensionsFile(f); + TextStream t(&f); + RTFGenerator::writeExtensionsFile(t); } cleanUpDoxygen(); exit(0); @@ -10251,13 +10468,13 @@ void readConfiguration(int argc, char **argv) break; case 'f': listName=getArg(argc,argv,optind); - if (!listName) + if (listName.isEmpty()) { err("option \"-f\" is missing list specifier.\n"); cleanUpDoxygen(); exit(1); } - if (qstricmp(listName,"emoji")==0) + if (qstricmp(listName.data(),"emoji")==0) { if (optind+1>=argc) { @@ -10268,7 +10485,8 @@ void readConfiguration(int argc, char **argv) std::ofstream f; if (openOutputFile(argv[optind+1],f)) { - EmojiEntityMapper::instance()->writeEmojiFile(f); + TextStream t(&f); + EmojiEntityMapper::instance()->writeEmojiFile(t); } cleanUpDoxygen(); exit(0); @@ -10279,13 +10497,13 @@ void readConfiguration(int argc, char **argv) break; case 'w': formatName=getArg(argc,argv,optind); - if (!formatName) + if (formatName.isEmpty()) { err("option \"-w\" is missing format specifier rtf, html or latex\n"); cleanUpDoxygen(); exit(1); } - if (qstricmp(formatName,"rtf")==0) + if (qstricmp(formatName.data(),"rtf")==0) { if (optind+1>=argc) { @@ -10296,12 +10514,13 @@ void readConfiguration(int argc, char **argv) std::ofstream f; if (openOutputFile(argv[optind+1],f)) { - RTFGenerator::writeStyleSheetFile(f); + TextStream t(&f); + RTFGenerator::writeStyleSheetFile(t); } cleanUpDoxygen(); exit(1); } - else if (qstricmp(formatName,"html")==0) + else if (qstricmp(formatName.data(),"html")==0) { Config::init(); if (optind+4<argc || FileInfo("Doxyfile").exists()) @@ -10327,28 +10546,31 @@ void readConfiguration(int argc, char **argv) QCString outputLanguage=Config_getEnum(OUTPUT_LANGUAGE); if (!setTranslator(outputLanguage)) { - warn_uncond("Output language %s not supported! Using English instead.\n", outputLanguage.data()); + warn_uncond("Output language %s not supported! Using English instead.\n", qPrint(outputLanguage)); } std::ofstream f; if (openOutputFile(argv[optind+1],f)) { - HtmlGenerator::writeHeaderFile(f, argv[optind+3]); + TextStream t(&f); + HtmlGenerator::writeHeaderFile(t, argv[optind+3]); } f.close(); if (openOutputFile(argv[optind+2],f)) { - HtmlGenerator::writeFooterFile(f); + TextStream t(&f); + HtmlGenerator::writeFooterFile(t); } f.close(); if (openOutputFile(argv[optind+3],f)) { - HtmlGenerator::writeStyleSheetFile(f); + TextStream t(&f); + HtmlGenerator::writeStyleSheetFile(t); } cleanUpDoxygen(); exit(0); } - else if (qstricmp(formatName,"latex")==0) + else if (qstricmp(formatName.data(),"latex")==0) { Config::init(); if (optind+4<argc || FileInfo("Doxyfile").exists()) @@ -10373,30 +10595,33 @@ void readConfiguration(int argc, char **argv) QCString outputLanguage=Config_getEnum(OUTPUT_LANGUAGE); if (!setTranslator(outputLanguage)) { - warn_uncond("Output language %s not supported! Using English instead.\n", outputLanguage.data()); + warn_uncond("Output language %s not supported! Using English instead.\n", qPrint(outputLanguage)); } std::ofstream f; if (openOutputFile(argv[optind+1],f)) { - LatexGenerator::writeHeaderFile(f); + TextStream t(&f); + LatexGenerator::writeHeaderFile(t); } f.close(); if (openOutputFile(argv[optind+2],f)) { - LatexGenerator::writeFooterFile(f); + TextStream t(&f); + LatexGenerator::writeFooterFile(t); } f.close(); if (openOutputFile(argv[optind+3],f)) { - LatexGenerator::writeStyleSheetFile(f); + TextStream t(&f); + LatexGenerator::writeStyleSheetFile(t); } cleanUpDoxygen(); exit(0); } else { - err("Illegal format specifier \"%s\": should be one of rtf, html or latex\n",formatName); + err("Illegal format specifier \"%s\": should be one of rtf, html or latex\n",qPrint(formatName)); cleanUpDoxygen(); exit(1); } @@ -10442,7 +10667,6 @@ void readConfiguration(int argc, char **argv) break; case 'b': setvbuf(stdout,NULL,_IONBF,0); - Doxygen::outputToWizard=TRUE; break; case 'T': msg("Warning: this option activates output generation via Django like template files. " @@ -10522,7 +10746,7 @@ void readConfiguration(int argc, char **argv) if (!Config::parse(configName,updateConfig)) { - err("could not open or read configuration file %s!\n",configName); + err("could not open or read configuration file %s!\n",qPrint(configName)); cleanUpDoxygen(); exit(1); } @@ -10542,8 +10766,8 @@ void readConfiguration(int argc, char **argv) } /* Perlmod wants to know the path to the config file.*/ - FileInfo configFileInfo(configName); - setPerlModDoxyfile(configFileInfo.absFilePath().data()); + FileInfo configFileInfo(configName.str()); + setPerlModDoxyfile(configFileInfo.absFilePath()); } @@ -10572,7 +10796,7 @@ void adjustConfiguration() if (!setTranslator(outputLanguage)) { warn_uncond("Output language %s not supported! Using English instead.\n", - outputLanguage.data()); + qPrint(outputLanguage)); } /* Set the global html file extension. */ @@ -10610,12 +10834,12 @@ void adjustConfiguration() { err("Failed to map file extension '%s' to unsupported language '%s'.\n" "Check the EXTENSION_MAPPING setting in the config file.\n", - ext.data(),language.data()); + qPrint(ext),qPrint(language)); } else { msg("Adding custom extension mapping: '%s' will be treated as language '%s'\n", - ext.data(),language.data()); + qPrint(ext),qPrint(language)); } } } @@ -10656,14 +10880,15 @@ static void writeTagFile() QCString generateTagFile = Config_getString(GENERATE_TAGFILE); if (generateTagFile.isEmpty()) return; - std::ofstream tagFile(generateTagFile.str(),std::ofstream::out | std::ofstream::binary); - if (!tagFile.is_open()) + std::ofstream f(generateTagFile.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { err("cannot open tag file %s for writing\n", - generateTagFile.data() + qPrint(generateTagFile) ); return; } + TextStream tagFile(&f); tagFile << "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\n"; tagFile << "<tagfile doxygen_version=\"" << getDoxygenVersion() << "\""; if (strlen(getGitVersion())>0) @@ -10689,6 +10914,15 @@ static void writeTagFile() cdm->writeTagFile(tagFile); } } + // for each concept + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + ConceptDefMutable *cdm = toConceptDefMutable(cd.get()); + if (cdm && cdm->isLinkableInProject()) + { + cdm->writeTagFile(tagFile); + } + } // for each namespace for (const auto &nd : *Doxygen::namespaceLinkedMap) { @@ -10737,12 +10971,12 @@ static QCString createOutputDirectory(const QCString &baseDirName, } else if (formatDirName[0]!='/' && (formatDirName.length()==1 || formatDirName[1]!=':')) { - result.prepend(baseDirName+'/'); + result.prepend(baseDirName+"/"); } Dir formatDir(result.str()); if (!formatDir.exists() && !formatDir.mkdir(result.str())) { - err("Could not create output directory %s\n", result.data()); + err("Could not create output directory %s\n", qPrint(result)); cleanUpDoxygen(); exit(1); } @@ -10956,7 +11190,7 @@ void parseInput() // we would like to show the versionString earlier, but we first have to handle the configuration file // to know the value of the QUIET setting. QCString versionString = getFullVersion(); - msg("Doxygen version used: %s\n",versionString.data()); + msg("Doxygen version used: %s\n",qPrint(versionString)); /************************************************************************** * Make sure the output directory exists @@ -10975,14 +11209,14 @@ void parseInput() if (!dir.mkdir(outputDirectory.str())) { err("tag OUTPUT_DIRECTORY: Output directory '%s' does not " - "exist and cannot be created\n",outputDirectory.data()); + "exist and cannot be created\n",qPrint(outputDirectory)); cleanUpDoxygen(); exit(1); } else { msg("Notice: Output directory '%s' does not exist. " - "I have created it for you.\n", outputDirectory.data()); + "I have created it for you.\n", qPrint(outputDirectory)); } dir.setPath(outputDirectory.str()); } @@ -11082,11 +11316,11 @@ void parseInput() newFontPath+=Portable::pathListSeparator(); newFontPath+=curFontPath; } - Portable::setenv("DOTFONTPATH",newFontPath); + Portable::setenv("DOTFONTPATH",qPrint(newFontPath)); } else { - Portable::setenv("DOTFONTPATH",curFontPath); + Portable::setenv("DOTFONTPATH",qPrint(curFontPath)); } } @@ -11108,12 +11342,12 @@ void parseInput() FileInfo fi(layoutFileName.str()); if (fi.exists()) { - msg("Parsing layout file %s...\n",layoutFileName.data()); + msg("Parsing layout file %s...\n",qPrint(layoutFileName)); LayoutDocManager::instance().parse(layoutFileName); } else if (!defaultLayoutUsed) { - warn_uncond("failed to open layout file '%s' for reading!\n",layoutFileName.data()); + warn_uncond("failed to open layout file '%s' for reading!\n",qPrint(layoutFileName)); } /************************************************************************** @@ -11122,12 +11356,12 @@ void parseInput() // prevent search in the output directories StringVector exclPatterns = Config_getList(EXCLUDE_PATTERNS); - if (generateHtml) exclPatterns.push_back(htmlOutput.data()); - if (generateDocbook) exclPatterns.push_back(docbookOutput.data()); - if (generateXml) exclPatterns.push_back(xmlOutput.data()); - if (generateLatex) exclPatterns.push_back(latexOutput.data()); - if (generateRtf) exclPatterns.push_back(rtfOutput.data()); - if (generateMan) exclPatterns.push_back(manOutput.data()); + if (generateHtml) exclPatterns.push_back(htmlOutput.str()); + if (generateDocbook) exclPatterns.push_back(docbookOutput.str()); + if (generateXml) exclPatterns.push_back(xmlOutput.str()); + if (generateLatex) exclPatterns.push_back(latexOutput.str()); + if (generateRtf) exclPatterns.push_back(rtfOutput.str()); + if (generateMan) exclPatterns.push_back(manOutput.str()); Config_updateList(EXCLUDE_PATTERNS,exclPatterns); searchInputFiles(); @@ -11215,6 +11449,10 @@ void parseInput() buildClassList(root.get()); g_s.end(); + g_s.begin("Building concept list...\n"); + buildConceptList(root.get()); + g_s.end(); + // build list of using declarations here (global list) buildListOfUsingDecls(root.get()); g_s.end(); @@ -11234,6 +11472,11 @@ void parseInput() g_s.begin("Associating documentation with classes...\n"); buildClassDocList(root.get()); + g_s.end(); + + g_s.begin("Associating documentation with concepts...\n"); + buildConceptDocList(root.get()); + g_s.end(); g_s.begin("Building example list...\n"); buildExampleList(root.get()); @@ -11362,8 +11605,8 @@ void parseInput() auto memberNameComp = [](const MemberNameLinkedMap::Ptr &n1,const MemberNameLinkedMap::Ptr &n2) { - return qstricmp(n1->memberName()+getPrefixIndex(n1->memberName()), - n2->memberName()+getPrefixIndex(n2->memberName()) + return qstricmp(n1->memberName().data()+getPrefixIndex(n1->memberName()), + n2->memberName().data()+getPrefixIndex(n2->memberName()) )<0; }; @@ -11385,6 +11628,11 @@ void parseInput() return qstricmp(n1->name(),n2->name())<0; }; + auto conceptComp = [](const ConceptLinkedMap::Ptr &c1,const ConceptLinkedMap::Ptr &c2) + { + return qstricmp(c1->name(),c2->name())<0; + }; + g_s.begin("Sorting lists...\n"); std::sort(Doxygen::memberNameLinkedMap->begin(), Doxygen::memberNameLinkedMap->end(), @@ -11398,6 +11646,9 @@ void parseInput() std::sort(Doxygen::classLinkedMap->begin(), Doxygen::classLinkedMap->end(), classComp); + std::sort(Doxygen::conceptLinkedMap->begin(), + Doxygen::conceptLinkedMap->end(), + conceptComp); std::sort(Doxygen::namespaceLinkedMap->begin(), Doxygen::namespaceLinkedMap->end(), namespaceComp); @@ -11513,7 +11764,7 @@ void parseInput() std::sort(Doxygen::groupLinkedMap->begin(), Doxygen::groupLinkedMap->end(), [](const auto &g1,const auto &g2) - { return qstrcmp(g1->groupTitle(),g2->groupTitle())<0; }); + { return g1->groupTitle() < g2->groupTitle(); }); for (const auto &gd : *Doxygen::groupLinkedMap) { @@ -11626,7 +11877,7 @@ void generateOutput() if (!searchDir.exists() && !searchDir.mkdir(searchDirName.str())) { term("Could not create search results directory '%s' $PWD='%s'\n", - searchDirName.data(),Dir::currentDirPath().c_str()); + qPrint(searchDirName),Dir::currentDirPath().c_str()); } HtmlGenerator::writeSearchData(searchDirName); if (!serverBasedSearch) // client side search index @@ -11685,6 +11936,10 @@ void generateOutput() generateClassDocs(); g_s.end(); + g_s.begin("Generating concept documentation...\n"); + generateConceptDocs(); + g_s.end(); + g_s.begin("Generating namespace index...\n"); generateNamespaceDocs(); g_s.end(); @@ -11758,7 +12013,7 @@ void generateOutput() { searchDataFile="searchdata.xml"; } - if (!Portable::isAbsolutePath(searchDataFile)) + if (!Portable::isAbsolutePath(searchDataFile.data())) { searchDataFile.prepend(Config_getString(OUTPUT_DIRECTORY)+"/"); } @@ -11828,7 +12083,7 @@ void generateOutput() Dir::setCurrent(Config_getString(HTML_OUTPUT).str()); Portable::setShortDir(); Portable::sysTimerStart(); - if (Portable::system(Config_getString(HHC_LOCATION), "index.hhp", Debug::isFlagSet(Debug::ExtCmd))!=1) + if (Portable::system(Config_getString(HHC_LOCATION).data(), "index.hhp", Debug::isFlagSet(Debug::ExtCmd))!=1) { err("failed to run html help compiler on index.hhp\n"); } @@ -11847,11 +12102,11 @@ void generateOutput() QCString qhpFileName = Qhp::getQhpFileName(); QCString qchFileName = getQchFileName(); - QCString args = QCString().sprintf("%s -o \"%s\"", qhpFileName.data(), qchFileName.data()); + QCString args = QCString().sprintf("%s -o \"%s\"", qPrint(qhpFileName), qPrint(qchFileName)); std::string oldDir = Dir::currentDirPath(); Dir::setCurrent(Config_getString(HTML_OUTPUT).str()); Portable::sysTimerStart(); - if (Portable::system(Config_getString(QHG_LOCATION), args.data(), FALSE)) + if (Portable::system(Config_getString(QHG_LOCATION).data(), args.data(), FALSE)) { err("failed to run qhelpgenerator on index.qhp\n"); } @@ -11866,7 +12121,7 @@ void generateOutput() Doxygen::lookupCache->capacity(), Doxygen::lookupCache->hits(), Doxygen::lookupCache->misses()); - cacheParam = computeIdealCacheParam(Doxygen::lookupCache->misses()*2/3); // part of the cache is flushed, hence the 2/3 correction factor + cacheParam = computeIdealCacheParam(static_cast<size_t>(Doxygen::lookupCache->misses()*2/3)); // part of the cache is flushed, hence the 2/3 correction factor if (cacheParam>Config_getInt(LOOKUP_CACHE_SIZE)) { msg("Note: based on cache misses the ideal setting for LOOKUP_CACHE_SIZE is %d at the cost of higher memory usage.\n",cacheParam); diff --git a/src/doxygen.h b/src/doxygen.h index 5b136b4..f090f1f 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -41,6 +41,7 @@ class GroupLinkedMap; class FileDef; class ClassDef; class ClassLinkedMap; +class ConceptLinkedMap; class MemberNameLinkedMap; class FileNameLinkedMap; class NamespaceLinkedMap; @@ -76,6 +77,7 @@ class Doxygen public: static ClassLinkedMap *classLinkedMap; static ClassLinkedMap *hiddenClassLinkedMap; + static ConceptLinkedMap *conceptLinkedMap; static PageLinkedMap *exampleLinkedMap; static PageLinkedMap *pageLinkedMap; static std::unique_ptr<PageDef> mainPage; @@ -103,7 +105,6 @@ class Doxygen static SearchIndexIntf *searchIndex; static SymbolMap<Definition> symbolMap; static ClangUsrMap *clangUsrMap; - static bool outputToWizard; static Cache<std::string,LookupInfo> *lookupCache; static DirLinkedMap *dirLinkedMap; static DirRelationLinkedMap dirRelations; @@ -128,7 +129,7 @@ void generateOutput(); void readAliases(); void readFormulaRepository(QCString dir, bool cmp = FALSE); void cleanUpDoxygen(); -void readFileOrDirectory(const char *s, +void readFileOrDirectory(const QCString &s, FileNameLinkedMap *fnDict, StringUnorderedSet *exclSet, const StringVector *patList, diff --git a/src/eclipsehelp.cpp b/src/eclipsehelp.cpp index d9ef12f..b2f8193 100644 --- a/src/eclipsehelp.cpp +++ b/src/eclipsehelp.cpp @@ -71,7 +71,7 @@ void EclipseHelp::initialize() m_tocstream.open(name.str(), std::ofstream::out | std::ofstream::binary); if (!m_tocstream.is_open()) { - term("Could not open file %s for writing\n", name.data()); + term("Could not open file %s for writing\n", qPrint(name)); } // -- write the opening tag @@ -159,17 +159,17 @@ void EclipseHelp::decContentsDepth() */ void EclipseHelp::addContentsItem( bool /* isDir */, - const char *name, - const char * /* ref */, - const char *file, - const char *anchor, + const QCString &name, + const QCString & /* ref */, + const QCString &file, + const QCString &anchor, bool /* separateIndex */, bool /* addToNavIndex */, const Definition * /*def*/) { // -- write the topic tag closedTag(); - if (file) + if (!file.isEmpty()) { switch (file[0]) // check for special markers (user defined URLs) { @@ -189,7 +189,7 @@ void EclipseHelp::addContentsItem( m_tocstream << "<topic label=\"" << convertToXML(name) << "\""; m_tocstream << " href=\"" << convertToXML(m_pathprefix) << file << Doxygen::htmlFileExtension; - if (anchor) + if (!anchor.isEmpty()) { m_tocstream << "#" << anchor; } @@ -209,20 +209,20 @@ void EclipseHelp::addContentsItem( void EclipseHelp::addIndexItem( const Definition * /* context */, const MemberDef * /* md */, - const char * /* sectionAnchor */, - const char * /* title */) + const QCString & /* sectionAnchor */, + const QCString & /* title */) { } -void EclipseHelp::addIndexFile(const char * /* name */) +void EclipseHelp::addIndexFile(const QCString & /* name */) { } -void EclipseHelp::addImageFile(const char * /* name */) +void EclipseHelp::addImageFile(const QCString & /* name */) { } -void EclipseHelp::addStyleSheetFile(const char * /* name */) +void EclipseHelp::addStyleSheetFile(const QCString & /* name */) { } diff --git a/src/eclipsehelp.h b/src/eclipsehelp.h index 1f4a8df..1ba4df4 100644 --- a/src/eclipsehelp.h +++ b/src/eclipsehelp.h @@ -48,14 +48,14 @@ class EclipseHelp : public IndexIntf virtual void finalize(); virtual void incContentsDepth(); virtual void decContentsDepth(); - virtual void addContentsItem(bool isDir, const char *name, const char *ref, - const char *file, const char *anchor,bool separateIndex,bool addToNavIndex, + virtual void addContentsItem(bool isDir, const QCString &name, const QCString &ref, + const QCString &file, const QCString &anchor,bool separateIndex,bool addToNavIndex, const Definition *def); virtual void addIndexItem(const Definition *context,const MemberDef *md, - const char *sectionAnchor,const char *title); - virtual void addIndexFile(const char *name); - virtual void addImageFile(const char *name); - virtual void addStyleSheetFile(const char *name); + const QCString §ionAnchor,const QCString &title); + virtual void addIndexFile(const QCString &name); + virtual void addImageFile(const QCString &name); + virtual void addStyleSheetFile(const QCString &name); private: int m_depth; diff --git a/src/emoji.cpp b/src/emoji.cpp index 9871c22..d723f64 100644 --- a/src/emoji.cpp +++ b/src/emoji.cpp @@ -16,6 +16,7 @@ #include "emoji.h" #include "message.h" #include "util.h" +#include "textstream.h" static struct emojiEntityInfo { @@ -1563,7 +1564,7 @@ int EmojiEntityMapper::symbol2index(const std::string &symName) const /*! * @brief Writes the list of supported emojis to the given file. */ -void EmojiEntityMapper::writeEmojiFile(std::ostream &t) +void EmojiEntityMapper::writeEmojiFile(TextStream &t) { for (int i = 0; i < g_numEmojiEntities; i++) { diff --git a/src/emoji.h b/src/emoji.h index a0184f6..7ec2519 100644 --- a/src/emoji.h +++ b/src/emoji.h @@ -17,7 +17,8 @@ #include <map> #include <string> -#include <iostream> + +class TextStream; /** @brief Singleton helper class to map emoji entities to other formats */ class EmojiEntityMapper @@ -27,7 +28,7 @@ class EmojiEntityMapper static void deleteInstance(); const char *name(int index) const; const char *unicode(int index) const; - void writeEmojiFile(std::ostream &t); + void writeEmojiFile(TextStream &t); int symbol2index(const std::string &symName) const; private: diff --git a/src/entry.cpp b/src/entry.cpp index 6ab9dc1..84d1844 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -30,7 +30,7 @@ static AtomicInt g_num; -Entry::Entry() : program(std::ios_base::ate), initializer(std::ios_base::ate) +Entry::Entry() { //printf("Entry::Entry(%p)\n",this); g_num++; @@ -45,7 +45,7 @@ Entry::Entry() : program(std::ios_base::ate), initializer(std::ios_base::ate) reset(); } -Entry::Entry(const Entry &e) : program(std::ios_base::ate), initializer(std::ios_base::ate) +Entry::Entry(const Entry &e) { //printf("Entry::Entry(%p):copy\n",this); g_num++; @@ -108,6 +108,7 @@ Entry::Entry(const Entry &e) : program(std::ios_base::ate), initializer(std::ios id = e.id; extends = e.extends; groups = e.groups; + req = e.req; m_fileDef = e.m_fileDef; m_parent = e.m_parent; @@ -123,7 +124,7 @@ Entry::~Entry() { //printf("Entry::~Entry(%p) num=%d\n",this,g_num); //printf("Deleting entry %d name %s type %x children %d\n", - // num,name.data(),section,sublist->count()); + // num,qPrint(name),section,sublist->count()); g_num--; } @@ -242,6 +243,7 @@ void Entry::reset() tArgLists.clear(); typeConstr.reset(); sli.clear(); + req.resize(0); m_fileDef = 0; } diff --git a/src/entry.h b/src/entry.h index cf46efb..831501c 100644 --- a/src/entry.h +++ b/src/entry.h @@ -25,6 +25,7 @@ #include "types.h" #include "arguments.h" #include "reflist.h" +#include "textstream.h" class SectionInfo; class FileDef; @@ -34,7 +35,7 @@ class FileDef; struct BaseInfo { /*! Creates an object representing an inheritance relation */ - BaseInfo(const char *n,Protection p,Specifier v) : + BaseInfo(const QCString &n,Protection p,Specifier v) : name(n),prot(p),virt(v) {} QCString name; //!< the name of the base class Protection prot; //!< inheritance type @@ -65,6 +66,7 @@ class Entry enum Sections { CLASS_SEC = 0x00000001, NAMESPACE_SEC = 0x00000010, + CONCEPT_SEC = 0x00000020, COMPOUND_MASK = CLASS_SEC, SCOPE_MASK = COMPOUND_MASK | NAMESPACE_SEC, @@ -78,6 +80,7 @@ class Entry CATEGORYDOC_SEC = 0x00040000, SERVICEDOC_SEC = 0x00080000, SINGLETONDOC_SEC = 0x00100000, + CONCEPTDOC_SEC = 0x00200000, COMPOUNDDOC_MASK = CLASSDOC_SEC | STRUCTDOC_SEC | UNIONDOC_SEC | INTERFACEDOC_SEC | EXCEPTIONDOC_SEC | PROTOCOLDOC_SEC | CATEGORYDOC_SEC | SERVICEDOC_SEC | SINGLETONDOC_SEC, @@ -255,9 +258,9 @@ class Entry QCString args; //!< member argument string QCString bitfields; //!< member's bit fields ArgumentList argList; //!< member arguments as a list - ArgumentLists tArgLists; //!< template argument declarations - std::ostringstream program; //!< the program text - std::ostringstream initializer; //!< initial value (for variables) + ArgumentLists tArgLists; //!< template argument declarations + TextStream program; //!< the program text + TextStream initializer; //!< initial value (for variables) QCString includeFile; //!< include file (2 arg of \\class, must be unique) QCString includeName; //!< include name (3 arg of \\class) QCString doc; //!< documentation block (partly parsed) @@ -294,6 +297,7 @@ class Entry QCString id; //!< libclang id LocalToc localToc; QCString metaData; //!< Slice metadata + QCString req; //!< C++20 requires clause /// return the command name used to define GROUPDOC_SEC const char *groupDocCmd() const diff --git a/src/filedef.cpp b/src/filedef.cpp index 18050dd..7149b97 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -45,6 +45,7 @@ #include "clangparser.h" #include "settings.h" #include "definitionimpl.h" +#include "conceptdef.h" //--------------------------------------------------------------------------- @@ -55,7 +56,7 @@ using IncludeInfoMap = std::unordered_map<std::string, const IncludeInfo *>; class FileDefImpl : public DefinitionMixin<FileDef> { public: - FileDefImpl(const char *p,const char *n,const char *ref=0,const char *dn=0); + FileDefImpl(const QCString &p,const QCString &n,const QCString &ref=QCString(),const QCString &dn=QCString()); virtual ~FileDefImpl(); virtual DefType definitionType() const { return TypeFile; } @@ -90,8 +91,9 @@ class FileDefImpl : public DefinitionMixin<FileDef> virtual MemberList *getMemberList(MemberListType lt) const; virtual const MemberLists &getMemberLists() const { return m_memberLists; } virtual const MemberGroupList &getMemberGroups() const { return m_memberGroups; } - virtual NamespaceLinkedRefMap getNamespaces() const { return m_namespaces; } - virtual ClassLinkedRefMap getClasses() const { return m_classes; } + virtual const NamespaceLinkedRefMap &getNamespaces() const { return m_namespaces; } + virtual const ConceptLinkedRefMap &getConcepts() const { return m_concepts; } + virtual const ClassLinkedRefMap &getClasses() const { return m_classes; } virtual QCString title() const; virtual bool hasDetailedDescription() const; virtual QCString fileVersion() const; @@ -104,7 +106,7 @@ class FileDefImpl : public DefinitionMixin<FileDef> virtual void writeMemberPages(OutputList &ol); virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const; virtual void writeSummaryLinks(OutputList &ol) const; - virtual void writeTagFile(std::ostream &t); + virtual void writeTagFile(TextStream &t); virtual void writeSourceHeader(OutputList &ol); virtual void writeSourceBody(OutputList &ol,ClangTUParser *clangParser); virtual void writeSourceFooter(OutputList &ol); @@ -112,6 +114,7 @@ class FileDefImpl : public DefinitionMixin<FileDef> virtual void setDiskName(const QCString &name); virtual void insertMember(MemberDef *md); virtual void insertClass(const ClassDef *cd); + virtual void insertConcept(const ConceptDef *cd); virtual void insertNamespace(const NamespaceDef *nd); virtual void computeAnchors(); virtual void setPackageDef(PackageDef *pd) { m_package=pd; } @@ -121,8 +124,8 @@ class FileDefImpl : public DefinitionMixin<FileDef> virtual void combineUsingRelations(); virtual bool generateSourceFile() const; virtual void sortMemberLists(); - virtual void addIncludeDependency(const FileDef *fd,const char *incName,bool local,bool imported); - virtual void addIncludedByDependency(const FileDef *fd,const char *incName,bool local,bool imported); + virtual void addIncludeDependency(const FileDef *fd,const QCString &incName,bool local,bool imported); + virtual void addIncludedByDependency(const FileDef *fd,const QCString &incName,bool local,bool imported); virtual void addMembersToMemberGroup(); virtual void distributeMemberGroupDocumentation(); virtual void findSectionsInDocumentation(); @@ -143,6 +146,7 @@ class FileDefImpl : public DefinitionMixin<FileDef> void writeNamespaceDeclarations(OutputList &ol,const QCString &title, bool isConstantGroup); void writeClassDeclarations(OutputList &ol,const QCString &title,const ClassLinkedRefMap &list); + void writeConcepts(OutputList &ol,const QCString &title); void writeInlineClasses(OutputList &ol); void startMemberDeclarations(OutputList &ol); void endMemberDeclarations(OutputList &ol); @@ -150,7 +154,7 @@ class FileDefImpl : public DefinitionMixin<FileDef> void endMemberDocumentation(OutputList &ol); void writeDetailedDescription(OutputList &ol,const QCString &title); void writeBriefDescription(OutputList &ol); - void writeClassesToTagFile(std::ostream &t,const ClassLinkedRefMap &list); + void writeClassesToTagFile(TextStream &t,const ClassLinkedRefMap &list); IncludeInfoMap m_includeMap; IncludeInfoList m_includeList; @@ -178,12 +182,13 @@ class FileDefImpl : public DefinitionMixin<FileDef> ClassLinkedRefMap m_interfaces; ClassLinkedRefMap m_structs; ClassLinkedRefMap m_exceptions; + ConceptLinkedRefMap m_concepts; bool m_subGrouping; }; -FileDef *createFileDef(const std::string &p,const std::string &n,const char *ref,const char *dn) +FileDef *createFileDef(const QCString &p,const QCString &n,const QCString &ref,const QCString &dn) { - return new FileDefImpl(p.c_str(),n.c_str(),ref,dn); + return new FileDefImpl(p,n,ref,dn); } @@ -193,25 +198,24 @@ FileDef *createFileDef(const std::string &p,const std::string &n,const char *ref class DevNullCodeDocInterface : public CodeOutputInterface { public: - virtual void codify(const char *) {} - virtual void writeCodeLink(const char *,const char *, - const char *,const char *, - const char *) {} - virtual void writeTooltip(const char *, const DocLinkInfo &, const char *, - const char *, const SourceLinkInfo &, const SourceLinkInfo & - ) {} - virtual void writeLineNumber(const char *,const char *, - const char *,int) {} - virtual void startCodeLine(bool) {} - virtual void endCodeLine() {} - virtual void startFontClass(const char *) {} - virtual void endFontClass() {} - virtual void writeCodeAnchor(const char *) {} - virtual void linkableSymbol(int, const char *,Definition *,Definition *) {} - virtual void setCurrentDoc(const Definition *,const char *,bool) {} - virtual void addWord(const char *,bool) {} - virtual void startCodeFragment(const char *) {} - virtual void endCodeFragment(const char *) {} + virtual void codify(const QCString &) override {} + virtual void writeCodeLink(const QCString &,const QCString &, + const QCString &,const QCString &, + const QCString &) override {} + virtual void writeTooltip(const QCString &, const DocLinkInfo &, const QCString &, + const QCString &, const SourceLinkInfo &, const SourceLinkInfo & + ) override {} + virtual void writeLineNumber(const QCString &,const QCString &, + const QCString &,int) override {} + virtual void startCodeLine(bool) override {} + virtual void endCodeLine() override {} + virtual void startFontClass(const QCString &) override {} + virtual void endFontClass() override {} + virtual void writeCodeAnchor(const QCString &) override {} + virtual void setCurrentDoc(const Definition *,const QCString &,bool) override {} + virtual void addWord(const QCString &,bool) override {} + virtual void startCodeFragment(const QCString &) override {} + virtual void endCodeFragment(const QCString &) override {} }; //--------------------------------------------------------------------------- @@ -220,22 +224,22 @@ class DevNullCodeDocInterface : public CodeOutputInterface \a nm the file name, and \a lref is an HTML anchor name if the file was read from a tag file or 0 otherwise */ -FileDefImpl::FileDefImpl(const char *p,const char *nm, - const char *lref,const char *dn) +FileDefImpl::FileDefImpl(const QCString &p,const QCString &nm, + const QCString &lref,const QCString &dn) : DefinitionMixin((QCString)p+nm,1,1,nm) { m_path=p; m_filePath=m_path+nm; m_fileName=nm; setReference(lref); - setDiskName(dn?dn:nm); + setDiskName(!dn.isEmpty() ? dn : nm); m_package = 0; m_isSource = guessSection(nm)==Entry::SOURCE_SEC; m_docname = nm; m_dir = 0; if (Config_getBool(FULL_PATH_NAMES)) { - m_docname.prepend(stripFromPath(m_path.copy())); + m_docname.prepend(stripFromPath(m_path)); } setLanguage(getLanguageFromFileName(name())); acquireFileVersion(); @@ -307,7 +311,7 @@ bool FileDefImpl::hasDetailedDescription() const ); } -void FileDefImpl::writeTagFile(std::ostream &tagFile) +void FileDefImpl::writeTagFile(TextStream &tagFile) { tagFile << " <compound kind=\"file\">\n"; tagFile << " <name>" << convertToXML(name()) << "</name>\n"; @@ -356,6 +360,17 @@ void FileDefImpl::writeTagFile(std::ostream &tagFile) writeClassesToTagFile(tagFile, m_exceptions); } break; + case LayoutDocEntry::FileConcepts: + { + for (const auto *nd : m_concepts) + { + if (nd->isLinkableInProject()) + { + tagFile << " <concept>" << convertToXML(nd->name()) << "</concept>\n"; + } + } + } + break; case LayoutDocEntry::FileNamespaces: { for (const auto *nd : m_namespaces) @@ -404,7 +419,7 @@ void FileDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - ol.writeAnchor(0,"details"); + ol.writeAnchor(QCString(),"details"); ol.popGeneratorState(); ol.startGroupHeader(); ol.parseText(title); @@ -414,7 +429,7 @@ void FileDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) { ol.generateDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) && !documentation().isEmpty()) @@ -432,9 +447,9 @@ void FileDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) if (!documentation().isEmpty()) { ol.generateDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } - //printf("Writing source ref for file %s\n",name().data()); + //printf("Writing source ref for file %s\n",qPrint(name())); if (Config_getBool(SOURCE_BROWSER)) { //if Latex enabled and LATEX_SOURCE_CODE isn't -> skip, bug_738548 @@ -458,8 +473,7 @@ void FileDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) if (fileMarkerPos!=-1) // should always pass this. { ol.parseText(refText.left(fileMarkerPos)); //text left from marker 1 - ol.writeObjectLink(0,getSourceFileBase(), - 0,name()); + ol.writeObjectLink(QCString(),getSourceFileBase(),QCString(),name()); ol.parseText(refText.right( refText.length()-fileMarkerPos-2)); // text right from marker 2 } @@ -481,7 +495,7 @@ void FileDefImpl::writeBriefDescription(OutputList &ol) { DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0, briefDescription(),TRUE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); if (rootNode && !rootNode->isEmpty()) { @@ -501,7 +515,7 @@ void FileDefImpl::writeBriefDescription(OutputList &ol) ) { ol.disableAllBut(OutputGenerator::Html); - ol.startTextLink(0,"details"); + ol.startTextLink(QCString(),"details"); ol.parseText(theTranslator->trMore()); ol.endTextLink(); } @@ -513,7 +527,7 @@ void FileDefImpl::writeBriefDescription(OutputList &ol) ol.writeSynopsis(); } -void FileDefImpl::writeClassesToTagFile(std::ostream &tagFile, const ClassLinkedRefMap &list) +void FileDefImpl::writeClassesToTagFile(TextStream &tagFile, const ClassLinkedRefMap &list) { for (const auto &cd : list) { @@ -568,7 +582,7 @@ void FileDefImpl::writeIncludeFiles(OutputList &ol) { ol.writeObjectLink(fd->getReference(), fd->generateSourceFile() ? fd->includeName() : fd->getOutputFileBase(), - 0,ii.includeName); + QCString(),ii.includeName); } else { @@ -593,12 +607,12 @@ void FileDefImpl::writeIncludeGraph(OutputList &ol) { if (Config_getBool(HAVE_DOT) /*&& Config_getBool(INCLUDE_GRAPH)*/) { - //printf("Graph for file %s\n",name().data()); + //printf("Graph for file %s\n",qPrint(name())); DotInclDepGraph incDepGraph(this,FALSE); if (incDepGraph.isTooBig()) { warn_uncond("Include graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", - name().data(), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); + qPrint(name()), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!incDepGraph.isTrivial()) { @@ -618,12 +632,12 @@ void FileDefImpl::writeIncludedByGraph(OutputList &ol) { if (Config_getBool(HAVE_DOT) /*&& Config_getBool(INCLUDED_BY_GRAPH)*/) { - //printf("Graph for file %s\n",name().data()); + //printf("Graph for file %s\n",qPrint(name())); DotInclDepGraph incDepGraph(this,TRUE); if (incDepGraph.isTooBig()) { warn_uncond("Included by graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", - name().data(), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); + qPrint(name()), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!incDepGraph.isTrivial()) { @@ -642,12 +656,12 @@ void FileDefImpl::writeIncludedByGraph(OutputList &ol) void FileDefImpl::writeSourceLink(OutputList &ol) { - //printf("%s: generateSourceFile()=%d\n",name().data(),generateSourceFile()); + //printf("%s: generateSourceFile()=%d\n",qPrint(name()),generateSourceFile()); if (generateSourceFile()) { ol.disableAllBut(OutputGenerator::Html); ol.startParagraph(); - ol.startTextLink(includeName(),0); + ol.startTextLink(includeName(),QCString()); ol.parseText(theTranslator->trGotoSourceCode()); ol.endTextLink(); ol.endParagraph(); @@ -668,6 +682,12 @@ void FileDefImpl::writeClassDeclarations(OutputList &ol,const QCString &title,co list.writeDeclaration(ol,0,title,FALSE); } +void FileDefImpl::writeConcepts(OutputList &ol,const QCString &title) +{ + // write list of classes + m_concepts.writeDeclaration(ol,title,FALSE); +} + void FileDefImpl::writeInlineClasses(OutputList &ol) { // temporarily undo the disabling could be done by startMemberDocumentation() @@ -746,35 +766,42 @@ void FileDefImpl::writeSummaryLinks(OutputList &ol) const { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "nested-classes"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::FileInterfaces && m_interfaces.declVisible()) { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "interfaces"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::FileStructs && m_structs.declVisible()) { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "structs"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::FileExceptions && m_exceptions.declVisible()) { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "exceptions"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::FileNamespaces && m_namespaces.declVisible()) { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "namespaces"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); + first=FALSE; + } + else if (lde->kind()==LayoutDocEntry::FileConcepts && m_concepts.declVisible()) + { + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); + QCString label = "concepts"; + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::MemberDecl) @@ -783,7 +810,7 @@ void FileDefImpl::writeSummaryLinks(OutputList &ol) const MemberList * ml = getMemberList(lmd->type); if (ml && ml->declVisible()) { - ol.writeSummaryLink(0,MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first); + ol.writeSummaryLink(QCString(),MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first); first=FALSE; } } @@ -806,10 +833,10 @@ void FileDefImpl::writeDocumentation(OutputList &ol) //QCString fn = name(); //if (Config_getBool(FULL_PATH_NAMES)) //{ - // fn.prepend(stripFromPath(getPath().copy())); + // fn.prepend(stripFromPath(getPath())); //} - //printf("WriteDocumentation diskname=%s\n",diskname.data()); + //printf("WriteDocumentation diskname=%s\n",qPrint(diskname)); QCString versionTitle; if (!m_fileVersion.isEmpty()) @@ -919,6 +946,12 @@ void FileDefImpl::writeDocumentation(OutputList &ol) writeClassDeclarations(ol,ls->title(lang),m_exceptions); } break; + case LayoutDocEntry::FileConcepts: + { + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); + writeConcepts(ol,ls->title(lang)); + } + break; case LayoutDocEntry::FileNamespaces: { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); @@ -977,11 +1010,14 @@ void FileDefImpl::writeDocumentation(OutputList &ol) case LayoutDocEntry::NamespaceNestedNamespaces: case LayoutDocEntry::NamespaceNestedConstantGroups: case LayoutDocEntry::NamespaceClasses: + case LayoutDocEntry::NamespaceConcepts: case LayoutDocEntry::NamespaceInterfaces: case LayoutDocEntry::NamespaceStructs: case LayoutDocEntry::NamespaceExceptions: case LayoutDocEntry::NamespaceInlineClasses: + case LayoutDocEntry::ConceptDefinition: case LayoutDocEntry::GroupClasses: + case LayoutDocEntry::GroupConcepts: case LayoutDocEntry::GroupInlineClasses: case LayoutDocEntry::GroupNamespaces: case LayoutDocEntry::GroupDirs: @@ -1091,7 +1127,7 @@ void FileDefImpl::writeSourceHeader(OutputList &ol) bool genSourceFile = !isDocFile && generateSourceFile(); if (getDirDef()) { - startFile(ol,getSourceFileBase(),0,pageTitle,HLI_FileVisible, + startFile(ol,getSourceFileBase(),QCString(),pageTitle,HLI_FileVisible, !generateTreeView, !isDocFile && genSourceFile ? QCString() : getOutputFileBase()); if (!generateTreeView) @@ -1105,11 +1141,11 @@ void FileDefImpl::writeSourceHeader(OutputList &ol) } else { - startFile(ol,getSourceFileBase(),0,pageTitle,HLI_FileVisible,FALSE, + startFile(ol,getSourceFileBase(),QCString(),pageTitle,HLI_FileVisible,FALSE, !isDocFile && genSourceFile ? QCString() : getOutputFileBase()); startTitle(ol,getSourceFileBase()); ol.parseText(title); - endTitle(ol,getSourceFileBase(),0); + endTitle(ol,getSourceFileBase(),QCString()); } ol.startContents(); @@ -1120,7 +1156,7 @@ void FileDefImpl::writeSourceHeader(OutputList &ol) if (latexSourceCode) ol.disable(OutputGenerator::Latex); if (rtfSourceCode) ol.disable(OutputGenerator::RTF); if (docbookSourceCode) ol.disable(OutputGenerator::Docbook); - ol.startTextLink(getOutputFileBase(),0); + ol.startTextLink(getOutputFileBase(),QCString()); ol.parseText(theTranslator->trGotoDocumentation()); ol.endTextLink(); ol.popGeneratorState(); @@ -1154,17 +1190,17 @@ void FileDefImpl::writeSourceBody(OutputList &ol,ClangTUParser *clangParser) if (needs2PassParsing) { // parse code for cross-references only (see bug707641) - intf->parseCode(devNullIntf,0, + intf->parseCode(devNullIntf,QCString(), fileToString(absFilePath(),TRUE,TRUE), getLanguage(), - FALSE,0,this + FALSE,QCString(),this ); } - intf->parseCode(ol,0, + intf->parseCode(ol,QCString(), fileToString(absFilePath(),filterSourceFiles,TRUE), getLanguage(), // lang FALSE, // isExampleBlock - 0, // exampleName + QCString(), // exampleName this, // fileDef -1, // startLine -1, // endLine @@ -1202,10 +1238,10 @@ void FileDefImpl::parseSource(ClangTUParser *clangParser) auto intf = Doxygen::parserManager->getCodeParser(getDefFileExtension()); intf->resetCodeParserState(); intf->parseCode( - devNullIntf,0, + devNullIntf,QCString(), fileToString(absFilePath(),filterSourceFiles,TRUE), getLanguage(), - FALSE,0,this + FALSE,QCString(),this ); } } @@ -1225,7 +1261,7 @@ void FileDefImpl::addMembersToMemberGroup() { if (mg->allMembersInSameSection() && m_subGrouping) { - //printf("----> addToDeclarationSection(%s)\n",mg->header().data()); + //printf("----> addToDeclarationSection(%s)\n",qPrint(mg->header())); mg->addToDeclarationSection(); } } @@ -1236,7 +1272,7 @@ void FileDefImpl::insertMember(MemberDef *md) { if (md->isHidden()) return; //printf("%s:FileDefImpl::insertMember(%s (=%p) list has %d elements)\n", - // name().data(),md->name().data(),md,allMemberList.count()); + // qPrint(name()),qPrint(md->name()),md,allMemberList.count()); MemberList *allMemberList = getMemberList(MemberListType_allMembersList); if (allMemberList && allMemberList->contains(md)) { @@ -1286,9 +1322,9 @@ void FileDefImpl::insertMember(MemberDef *md) default: err("FileDefImpl::insertMembers(): " "member '%s' with class scope '%s' inserted in file scope '%s'!\n", - md->name().data(), - md->getClassDef() ? md->getClassDef()->name().data() : "<global>", - name().data()); + qPrint(md->name()), + md->getClassDef() ? qPrint(md->getClassDef()->name()) : "<global>", + qPrint(name())); } //addMemberToGroup(md,groupId); } @@ -1319,6 +1355,12 @@ void FileDefImpl::insertClass(const ClassDef *cd) list.add(cd->name(),cd); } +void FileDefImpl::insertConcept(const ConceptDef *cd) +{ + if (cd->isHidden()) return; + m_concepts.add(cd->name(),cd); +} + /*! Adds namespace definition \a nd to the list of all compounds of this file */ void FileDefImpl::insertNamespace(const NamespaceDef *nd) { @@ -1342,21 +1384,21 @@ void FileDefImpl::addSourceRef(int line,const Definition *d,const MemberDef *md) m_srcDefMap.insert(std::make_pair(line,d)); if (md) m_srcMemberMap.insert(std::make_pair(line,md)); //printf("Adding member %s with anchor %s at line %d to file %s\n", - // md?md->name().data():"<none>",md?md->anchor().data():"<none>",line,name().data()); + // md?qPrint(md->name()):"<none>",md?qPrint(md->anchor()):"<none>",line,qPrint(name())); } } const Definition *FileDefImpl::getSourceDefinition(int lineNr) const { auto it = m_srcDefMap.find(lineNr); - //printf("%s::getSourceDefinition(%d)=%s\n",name().data(),lineNr,it!=m_srcDefMap.end()?it->second->name().data():"none"); + //printf("%s::getSourceDefinition(%d)=%s\n",qPrint(name()),lineNr,it!=m_srcDefMap.end()?qPrint(it->second->name()):"none"); return it!=m_srcDefMap.end() ? it->second : 0; } const MemberDef *FileDefImpl::getSourceMember(int lineNr) const { auto it = m_srcMemberMap.find(lineNr); - //printf("%s::getSourceMember(%d)=%s\n",name().data(),lineNr,it!=m_srcMemberMap.end()?it->second->name().data():"none"); + //printf("%s::getSourceMember(%d)=%s\n",qPrint(name()),lineNr,it!=m_srcMemberMap.end()?qPrint(it->second->name()):"none"); return it!=m_srcMemberMap.end() ? it->second : 0; } @@ -1364,12 +1406,12 @@ const MemberDef *FileDefImpl::getSourceMember(int lineNr) const void FileDefImpl::addUsingDirective(const NamespaceDef *nd) { m_usingDirList.add(nd->qualifiedName(),nd); - //printf("%p: FileDefImpl::addUsingDirective: %s:%d\n",this,name().data(),usingDirList->count()); + //printf("%p: FileDefImpl::addUsingDirective: %s:%d\n",this,qPrint(name()),usingDirList->count()); } LinkedRefMap<const NamespaceDef> FileDefImpl::getUsedNamespaces() const { - //printf("%p: FileDefImpl::getUsedNamespace: %s:%d\n",this,name().data(),usingDirList?usingDirList->count():0); + //printf("%p: FileDefImpl::getUsedNamespace: %s:%d\n",this,qPrint(name()),usingDirList?usingDirList->count():0); return m_usingDirList; } @@ -1378,10 +1420,10 @@ void FileDefImpl::addUsingDeclaration(const ClassDef *cd) m_usingDeclList.add(cd->qualifiedName(),cd); } -void FileDefImpl::addIncludeDependency(const FileDef *fd,const char *incName,bool local,bool imported) +void FileDefImpl::addIncludeDependency(const FileDef *fd,const QCString &incName,bool local,bool imported) { //printf("FileDefImpl::addIncludeDependency(%p,%s,%d)\n",fd,incName,local); - QCString iName = fd ? fd->absFilePath().data() : incName; + QCString iName = fd ? fd->absFilePath() : incName; if (!iName.isEmpty() && m_includeMap.find(iName.str())==m_includeMap.end()) { m_includeList.emplace_back(fd,incName,local,imported); @@ -1393,7 +1435,7 @@ void FileDefImpl::addIncludedUsingDirectives(FileDefSet &visitedFiles) { if (visitedFiles.find(this)!=visitedFiles.end()) return; // file already processed visitedFiles.insert(this); - //printf("( FileDefImpl::addIncludedUsingDirectives for file %s\n",name().data()); + //printf("( FileDefImpl::addIncludedUsingDirectives for file %s\n",qPrint(name())); if (!m_includeList.empty()) // file contains #includes { @@ -1432,15 +1474,15 @@ void FileDefImpl::addIncludedUsingDirectives(FileDefSet &visitedFiles) } } } - //printf(") end FileDefImpl::addIncludedUsingDirectives for file %s\n",name().data()); + //printf(") end FileDefImpl::addIncludedUsingDirectives for file %s\n",qPrint(name())); } -void FileDefImpl::addIncludedByDependency(const FileDef *fd,const char *incName, +void FileDefImpl::addIncludedByDependency(const FileDef *fd,const QCString &incName, bool local,bool imported) { //printf("FileDefImpl::addIncludedByDependency(%p,%s,%d)\n",fd,incName,local); - QCString iName = fd ? fd->absFilePath().data() : incName; + QCString iName = fd ? fd->absFilePath() : incName; if (!iName.isEmpty() && m_includedByMap.find(iName.str())==m_includedByMap.end()) { m_includedByList.emplace_back(fd,incName,local,imported); @@ -1474,7 +1516,7 @@ void FileDefImpl::addListReferences() getOutputFileBase(), theTranslator->trFile(TRUE,TRUE), getOutputFileBase(),name(), - 0, + QCString(), 0 ); } @@ -1537,13 +1579,13 @@ void FileDefImpl::acquireFileVersion() if (!vercmd.isEmpty() && !m_filePath.isEmpty() && m_filePath!="generated" && m_filePath!="graph_legend") { - msg("Version of %s : ",m_filePath.data()); + msg("Version of %s : ",qPrint(m_filePath)); QCString cmd = vercmd+" \""+m_filePath+"\""; Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",qPrint(cmd)); FILE *f=Portable::popen(cmd,"r"); if (!f) { - err("could not execute %s\n",vercmd.data()); + err("could not execute %s\n",qPrint(vercmd)); return; } const int bufSize=1024; @@ -1556,7 +1598,7 @@ void FileDefImpl::acquireFileVersion() m_fileVersion=QCString(buf,numRead).stripWhiteSpace(); if (!m_fileVersion.isEmpty()) { - msg("%s\n",m_fileVersion.data()); + msg("%s\n",qPrint(m_fileVersion)); return; } } @@ -1624,6 +1666,9 @@ void FileDefImpl::sortMemberLists() if (mlg.needsSorting()) { mlg.sort(); mlg.setNeedsSorting(FALSE); } } + std::sort(m_includedByList.begin(),m_includedByList.end(), + [](const auto &fi1,const auto &fi2) { return fi1.includeName < fi2.includeName; }); + if (Config_getBool(SORT_BRIEF_DOCS)) { auto classComp = [](const ClassLinkedRefMap::Ptr &c1,const ClassLinkedRefMap::Ptr &c2) @@ -1672,7 +1717,7 @@ void FileDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,const } else { - ml->writeDeclarations(ol,0,0,this,0,title,0); + ml->writeDeclarations(ol,0,0,this,0,title,QCString()); } } } @@ -1697,7 +1742,7 @@ static void getAllIncludeFilesRecursively( if (ii.fileDef && !ii.fileDef->isReference() && filesVisited.find(ii.fileDef->absFilePath().str())==filesVisited.end()) { - //printf("FileDefImpl::addIncludeDependency(%s)\n",ii->fileDef->absFilePath().data()); + //printf("FileDefImpl::addIncludeDependency(%s)\n",qPrint(ii->fileDef->absFilePath())); incFiles.push_back(ii.fileDef->absFilePath().str()); filesVisited.insert(ii.fileDef->absFilePath().str()); getAllIncludeFilesRecursively(filesVisited,ii.fileDef,incFiles); diff --git a/src/filedef.h b/src/filedef.h index b3c38ba..7019485 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -24,16 +24,18 @@ #include "definition.h" #include "memberlist.h" #include "containers.h" -#include "classlist.h" class MemberList; class FileDef; class FileList; class ClassDef; +class ConceptDef; class MemberDef; class OutputList; class NamespaceDef; class NamespaceLinkedRefMap; +class ConceptLinkedRefMap; +class ClassLinkedRefMap; class PackageDef; class DirDef; class ClangTUParser; @@ -133,8 +135,9 @@ class FileDef : public DefinitionMutable, public Definition /* user defined member groups */ virtual const MemberGroupList &getMemberGroups() const = 0; - virtual NamespaceLinkedRefMap getNamespaces() const = 0; - virtual ClassLinkedRefMap getClasses() const = 0; + virtual const NamespaceLinkedRefMap &getNamespaces() const = 0; + virtual const ConceptLinkedRefMap &getConcepts() const = 0; + virtual const ClassLinkedRefMap &getClasses() const = 0; virtual QCString title() const = 0; virtual bool hasDetailedDescription() const = 0; @@ -154,7 +157,7 @@ class FileDef : public DefinitionMutable, public Definition virtual void writeMemberPages(OutputList &ol) = 0; virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const = 0; virtual void writeSummaryLinks(OutputList &ol) const = 0; - virtual void writeTagFile(std::ostream &t) = 0; + virtual void writeTagFile(TextStream &t) = 0; virtual void writeSourceHeader(OutputList &ol) = 0; virtual void writeSourceBody(OutputList &ol,ClangTUParser *clangParser) = 0; @@ -164,6 +167,7 @@ class FileDef : public DefinitionMutable, public Definition virtual void insertMember(MemberDef *md) = 0; virtual void insertClass(const ClassDef *cd) = 0; + virtual void insertConcept(const ConceptDef *cd) = 0; virtual void insertNamespace(const NamespaceDef *nd) = 0; virtual void computeAnchors() = 0; @@ -177,8 +181,8 @@ class FileDef : public DefinitionMutable, public Definition virtual bool generateSourceFile() const = 0; virtual void sortMemberLists() = 0; - virtual void addIncludeDependency(const FileDef *fd,const char *incName,bool local,bool imported) = 0; - virtual void addIncludedByDependency(const FileDef *fd,const char *incName,bool local,bool imported) = 0; + virtual void addIncludeDependency(const FileDef *fd,const QCString &incName,bool local,bool imported) = 0; + virtual void addIncludedByDependency(const FileDef *fd,const QCString &incName,bool local,bool imported) = 0; virtual void addMembersToMemberGroup() = 0; virtual void distributeMemberGroupDocumentation() = 0; @@ -188,7 +192,7 @@ class FileDef : public DefinitionMutable, public Definition virtual void addListReferences() = 0; }; -FileDef *createFileDef(const std::string &p,const std::string &n,const char *ref=0,const char *dn=0); +FileDef *createFileDef(const QCString &p,const QCString &n,const QCString &ref=QCString(),const QCString &dn=QCString()); // --- Cast functions diff --git a/src/filename.h b/src/filename.h index d236046..f2eb304 100644 --- a/src/filename.h +++ b/src/filename.h @@ -28,10 +28,10 @@ class FileDef; class FileName : public std::vector< std::unique_ptr<FileDef> > { public: - FileName(const char *nm,const char *fn) : m_name(nm), m_fName(fn), m_pathName("tmp") {} - const char *fileName() const { return m_name; } - const char *fullName() const { return m_fName; } - const char *path() const { return m_pathName; } + FileName(const QCString &nm,const QCString &fn) : m_name(nm), m_fName(fn), m_pathName("tmp") {} + QCString fileName() const { return m_name; } + QCString fullName() const { return m_fName; } + QCString path() const { return m_pathName; } private: QCString m_name; diff --git a/src/fileparser.cpp b/src/fileparser.cpp index 34085dc..33491fc 100644 --- a/src/fileparser.cpp +++ b/src/fileparser.cpp @@ -17,19 +17,19 @@ #include "outputgen.h" void FileCodeParser::parseCode(CodeOutputInterface &codeOutIntf, - const char *, // scopeName + const QCString &, // scopeName const QCString & input, - SrcLangExt, // lang - bool, // isExampleBlock - const char *, // exampleName + SrcLangExt, // lang + bool, // isExampleBlock + const QCString &, // exampleName FileDef * fileDef, int startLine, int endLine, - bool, // inlineFragment - const MemberDef *, // memberDef + bool, // inlineFragment + const MemberDef *, // memberDef bool showLineNumbers, - const Definition *, // searchCtx, - bool // collectXRefs + const Definition *, // searchCtx, + bool // collectXRefs ) { int lineNr = startLine!=-1 ? startLine : 1; @@ -41,8 +41,11 @@ void FileCodeParser::parseCode(CodeOutputInterface &codeOutIntf, while (j<length && input[j]!='\n') j++; QCString lineStr = input.mid(i,j-i); codeOutIntf.startCodeLine(fileDef != 0 && showLineNumbers); - if (fileDef != 0 && showLineNumbers) codeOutIntf.writeLineNumber(0,0,0,lineNr); - if (!lineStr.isEmpty()) codeOutIntf.codify(lineStr); + if (fileDef != 0 && showLineNumbers) + { + codeOutIntf.writeLineNumber(QCString(),QCString(),QCString(),lineNr); + } + if (!lineStr.isEmpty()) codeOutIntf.codify(lineStr.data()); codeOutIntf.endCodeLine(); lineNr++; i=j+1; diff --git a/src/fileparser.h b/src/fileparser.h index 3245878..c7c07aa 100644 --- a/src/fileparser.h +++ b/src/fileparser.h @@ -3,8 +3,8 @@ * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -24,11 +24,11 @@ class FileCodeParser : public CodeParserInterface public: virtual ~FileCodeParser() {} void parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt lang, bool isExampleBlock, - const char *exampleName=0, + const QCString &exampleName=QCString(), FileDef *fileDef=0, int startLine=-1, int endLine=-1, diff --git a/src/formula.cpp b/src/formula.cpp index c08e9be..2e5aef9 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -68,9 +68,9 @@ FormulaManager &FormulaManager::instance() return fm; } -void FormulaManager::readFormulas(const char *dir,bool doCompare) +void FormulaManager::readFormulas(const QCString &dir,bool doCompare) { - std::ifstream f(std::string(dir)+"/formula.repository",std::ifstream::in); + std::ifstream f(dir.str()+"/formula.repository",std::ifstream::in); if (f.is_open()) { uint formulaCount=0; @@ -85,7 +85,7 @@ void FormulaManager::readFormulas(const char *dir,bool doCompare) size_t se=line.find(':'); // find name and text separator. if (ei==std::string::npos || hi==std::string::npos || se==std::string::npos || hi>se || ei<hi || ei>se) { - warn_uncond("%s/formula.repository is corrupted at line %d!\n",dir,lineNr); + warn_uncond("%s/formula.repository is corrupted at line %d!\n",qPrint(dir),lineNr); break; } else @@ -127,13 +127,13 @@ void FormulaManager::readFormulas(const char *dir,bool doCompare) } } -void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) const +void FormulaManager::generateImages(const QCString &path,Format format,HighDPI hd) const { - Dir d(path); + Dir d(path.str()); // store the original directory if (!d.exists()) { - term("Output directory '%s' does not exist!\n",path); + term("Output directory '%s' does not exist!\n",qPrint(path)); } std::string oldDir = Dir::currentDirPath(); QCString macroFile = Config_getString(FORMULA_MACROFILE); @@ -151,9 +151,10 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c // generate a latex file containing one formula per page. QCString texName="_formulas.tex"; IntVector formulasToGenerate; - std::ofstream t(texName.str(),std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + std::ofstream f(texName.str(),std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); if (Config_getBool(LATEX_BATCHMODE)) t << "\\batchmode\n"; t << "\\documentclass{article}\n"; t << "\\usepackage{ifthen}\n"; @@ -183,7 +184,8 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c Doxygen::indexList->addImageFile(resultName); } t << "\\end{document}\n"; - t.close(); + t.flush(); + f.close(); } if (!formulasToGenerate.empty()) // there are new formulas { @@ -212,7 +214,7 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c // run dvips to convert the page with number pageIndex to an // postscript file. sprintf(args,"-q -D 600 -n 1 -p %d -o %s_tmp.ps _formulas.dvi", - pageIndex,formBase.data()); + pageIndex,qPrint(formBase)); Portable::sysTimerStart(); if (Portable::system("dvips",args)!=0) { @@ -225,7 +227,7 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c // extract the bounding box for the postscript file sprintf(args,"-q -dBATCH -dNOPAUSE -P- -dNOSAFER -sDEVICE=bbox %s_tmp.ps 2>%s_tmp.epsi", - formBase.data(),formBase.data()); + qPrint(formBase),qPrint(formBase)); Portable::sysTimerStart(); if (Portable::system(Portable::ghostScriptCommand(),args)!=0) { @@ -249,7 +251,7 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c } else { - err("Couldn't extract bounding box from %s_tmp.epsi",formBase.data()); + err("Couldn't extract bounding box from %s_tmp.epsi",qPrint(formBase)); } } //printf("Bounding box [%d %d %d %d]\n",x1,y1,x2,y2); @@ -269,7 +271,7 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c // crop the image to its bounding box sprintf(args,"-q -dBATCH -dNOPAUSE -P- -dNOSAFER -sDEVICE=pdfwrite" " -o %s_tmp.pdf -c \"[/CropBox [%d %d %d %d] /PAGES pdfmark\" -f %s_tmp.ps", - formBase.data(),x1,y1,x2,y2,formBase.data()); + qPrint(formBase),x1,y1,x2,y2,qPrint(formBase)); Portable::sysTimerStart(); if (Portable::system(Portable::ghostScriptCommand(),args)!=0) { @@ -283,7 +285,7 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c // if we have pdf2svg available use it to create a SVG image if (Portable::checkForExecutable("pdf2svg")) { - sprintf(args,"%s_tmp.pdf form_%d.svg",formBase.data(),pageNum); + sprintf(args,"%s_tmp.pdf form_%d.svg",qPrint(formBase),pageNum); Portable::sysTimerStart(); if (Portable::system("pdf2svg",args)!=0) { @@ -305,11 +307,11 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c } else if (inkscapeVersion == 0) { - sprintf(args,"-l form_%d.svg -z %s_tmp.pdf 2>%s",pageNum,formBase.data(),Portable::devNull()); + sprintf(args,"-l form_%d.svg -z %s_tmp.pdf 2>%s",pageNum,qPrint(formBase),Portable::devNull()); } else // inkscapeVersion >= 1 { - sprintf(args,"--export-type=svg --export-filename=form_%d.svg %s_tmp.pdf 2>%s",pageNum,formBase.data(),Portable::devNull()); + sprintf(args,"--export-type=svg --export-filename=form_%d.svg %s_tmp.pdf 2>%s",pageNum,qPrint(formBase),Portable::devNull()); } Portable::sysTimerStart(); if (Portable::system("inkscape",args)!=0) @@ -336,7 +338,7 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c { // crop the image to its bounding box sprintf(args,"-q -dBATCH -dNOPAUSE -P- -dNOSAFER -sDEVICE=eps2write" - " -o %s_tmp.eps -f %s_tmp.ps",formBase.data(),formBase.data()); + " -o %s_tmp.eps -f %s_tmp.ps",qPrint(formBase),qPrint(formBase)); Portable::sysTimerStart(); if (Portable::system(Portable::ghostScriptCommand(),args)!=0) { @@ -373,7 +375,7 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c else { err("Problems correcting the eps files from %s_tmp.eps to %s_tmp_corr.eps\n", - formBase.data(),formBase.data()); + qPrint(formBase),qPrint(formBase)); Dir::setCurrent(oldDir); return; } @@ -386,7 +388,7 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c Portable::sysTimerStop(); sprintf(args,"-q -dNOSAFER -dBATCH -dNOPAUSE -dEPSCrop -sDEVICE=pnggray -dGraphicsAlphaBits=4 -dTextAlphaBits=4 " - "-r%d -sOutputFile=form_%d.png %s_tmp_corr.eps",(int)(scaleFactor*72),pageNum,formBase.data()); + "-r%d -sOutputFile=form_%d.png %s_tmp_corr.eps",(int)(scaleFactor*72),pageNum,qPrint(formBase)); Portable::sysTimerStart(); if (Portable::system(Portable::ghostScriptCommand(),args)!=0) { @@ -427,9 +429,10 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c // generated images represent (we use this next time to avoid regeneration // of the images, and to avoid forcing the user to delete all images in order // to let a browser refresh the images). - t.open("formula.repository",std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + f.open("formula.repository",std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); for (int i=0; i<(int)p->formulas.size(); i++) { DisplaySize size = p->getDisplaySize(i); @@ -440,7 +443,6 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c } t << ":" << p->formulas[i].c_str() << "\n"; } - t.close(); } // reset the directory to the original location. Dir::setCurrent(oldDir); diff --git a/src/formula.h b/src/formula.h index 39fabdd..9baeb24 100644 --- a/src/formula.h +++ b/src/formula.h @@ -36,10 +36,10 @@ class FormulaManager enum class Format { Bitmap, Vector }; enum class HighDPI { On, Off }; static FormulaManager &instance(); - void readFormulas(const char *dir,bool doCompare=false); + void readFormulas(const QCString &dir,bool doCompare=false); void clear(); int addFormula(const std::string &formulaText); - void generateImages(const char *outputDir,Format format,HighDPI hd = HighDPI::Off) const; + void generateImages(const QCString &outputDir,Format format,HighDPI hd = HighDPI::Off) const; std::string findFormula(int formulaId) const; bool hasFormulas() const; DisplaySize displaySize(int formulaId) const; diff --git a/src/fortrancode.h b/src/fortrancode.h index b8cac31..7601a39 100644 --- a/src/fortrancode.h +++ b/src/fortrancode.h @@ -32,11 +32,11 @@ class FortranCodeParser : public CodeParserInterface FortranCodeParser(FortranFormat format=FortranFormat_Unknown); virtual ~FortranCodeParser(); void parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt lang, bool isExampleBlock, - const char *exampleName=0, + const QCString &exampleName=QCString(), FileDef *fileDef=0, int startLine=-1, int endLine=-1, diff --git a/src/fortrancode.l b/src/fortrancode.l index fbc1a64..c7c4d89 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -124,12 +124,12 @@ class Scope struct fortrancodeYY_state { QCString docBlock; //!< contents of all lines of a documentation block - QCString currentModule=0; //!< name of the current enclosing module - UseMap useMembers; //!< info about used modules + QCString currentModule=QCString(); //!< name of the current enclosing module + UseMap useMembers; //!< info about used modules UseEntry useEntry; //!< current use statement info std::vector<Scope> scopeStack; bool isExternal = false; - QCString str=""; //!> contents of fortran string + QCString str=QCString(); //!< contents of fortran string CodeOutputInterface * code = 0; @@ -181,21 +181,22 @@ static bool getFortranTypeDefs(const QCString &tname, const QCString &moduleName static void endFontClass(yyscan_t yyscanner); static void startFontClass(yyscan_t yyscanner,const char *s); static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor); -static void addToSearchIndex(yyscan_t yyscanner,const char *text); +static void addToSearchIndex(yyscan_t yyscanner,const QCString &text); static void startCodeLine(yyscan_t yyscanner); static void endCodeLine(yyscan_t yyscanner); static void nextCodeLine(yyscan_t yyscanner); -static void codifyLines(yyscan_t yyscanner,const char *text); +static void codifyLines(yyscan_t yyscanner,const QCString &text); static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, - Definition *d,const char *text); + Definition *d,const QCString &text); static bool getGenericProcedureLink(yyscan_t yyscanner,const ClassDef *cd, - const char *memberText, + const QCString &memberText, CodeOutputInterface &ol); static bool getLink(yyscan_t yyscanner,const UseMap &useMap, // map with used modules - const char *memberText, // exact member text + const QCString &memberText, // exact member text CodeOutputInterface &ol, - const char *text); -static void generateLink(yyscan_t yyscanner,CodeOutputInterface &ol, char *lname); + const QCString &text); +static void generateLink(yyscan_t yyscanner,CodeOutputInterface &ol, const QCString &lname); +static void generateLink(yyscan_t yyscanner,CodeOutputInterface &ol, const char *lname); static int countLines(yyscan_t yyscanner); static void startScope(yyscan_t yyscanner); static void endScope(yyscan_t yyscanner); @@ -342,7 +343,7 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") BEGIN(UseOnly); } <Use>{ID} { - QCString tmp = yytext; + QCString tmp(yytext); tmp = tmp.lower(); yyextra->insideBody=TRUE; generateLink(yyscanner,*yyextra->code, yytext); @@ -359,7 +360,7 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") yyextra->contLineNr++; YY_FTN_RESET} <UseOnly>{ID} { - QCString tmp = yytext; + QCString tmp(yytext); tmp = tmp.lower(); yyextra->useEntry.onlyNames.push_back(tmp); yyextra->insideBody=TRUE; @@ -430,10 +431,10 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") yy_pop_state(yyscanner); } <ClassName>({ACCESS_SPEC}|ABSTRACT|EXTENDS)/[,:( ] { //| variable declaration - startFontClass(yyscanner,"keyword"); - yyextra->code->codify(yytext); - endFontClass(yyscanner); - } + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(QCString(yytext)); + endFontClass(yyscanner); + } <ClassName>\n { // interface may be without name yy_pop_state(yyscanner); YY_FTN_REJECT; @@ -504,18 +505,18 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") yy_push_state(YY_START,yyscanner); BEGIN(Declaration); startFontClass(yyscanner,"keywordtype"); - yyextra->code->codify(yytext); + yyextra->code->codify(QCString(yytext)); endFontClass(yyscanner); } <Start>{TYPE_SPEC}/[,:( ] { - QCString typ = yytext; + QCString typ(yytext); typ = removeRedundantWhiteSpace(typ.lower()); if (typ.startsWith("real")) YY_FTN_REJECT; if (typ == "type" || typ == "class" || typ == "procedure") yyextra->inTypeDecl = 1; yy_push_state(YY_START,yyscanner); BEGIN(Declaration); startFontClass(yyscanner,"keywordtype"); - yyextra->code->codify(yytext); + yyextra->code->codify(QCString(yytext)); endFontClass(yyscanner); } <Start>{ATTR_SPEC} { @@ -526,20 +527,20 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") yyextra->isExternal = true; } startFontClass(yyscanner,"keywordtype"); - yyextra->code->codify(yytext); + yyextra->code->codify(QCString(yytext)); endFontClass(yyscanner); } <Declaration>({TYPE_SPEC}|{ATTR_SPEC})/[,:( ] { //| variable declaration if (QCString(yytext) == "external") yyextra->isExternal = true; startFontClass(yyscanner,"keywordtype"); - yyextra->code->codify(yytext); + yyextra->code->codify(QCString(yytext)); endFontClass(yyscanner); } <Declaration>{ID} { // local var if (yyextra->isFixedForm && yy_my_start == 1) { startFontClass(yyscanner,"comment"); - yyextra->code->codify(yytext); + yyextra->code->codify(QCString(yytext)); endFontClass(yyscanner); } else if (yyextra->currentMemberDef && @@ -552,13 +553,13 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") } else { - yyextra->code->codify(yytext); - addLocalVar(yyscanner,yytext); + yyextra->code->codify(QCString(yytext)); + addLocalVar(yyscanner,QCString(yytext)); } } <Declaration>{BS}("=>"|"="){BS} { // Procedure binding BEGIN(DeclarationBinding); - yyextra->code->codify(yytext); + yyextra->code->codify(QCString(yytext)); } <DeclarationBinding>{ID} { // Type bound procedure link generateLink(yyscanner,*yyextra->code, yytext); @@ -566,17 +567,17 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") } <Declaration>[(] { // start of array or type / class specification yyextra->bracketCount++; - yyextra->code->codify(yytext); + yyextra->code->codify(QCString(yytext)); } <Declaration>[)] { // end array specification yyextra->bracketCount--; if (!yyextra->bracketCount) yyextra->inTypeDecl = 0; - yyextra->code->codify(yytext); + yyextra->code->codify(QCString(yytext)); } <Declaration,DeclarationBinding>"&" { // continuation line - yyextra->code->codify(yytext); + yyextra->code->codify(QCString(yytext)); if (!yyextra->isFixedForm) { yy_push_state(YY_START,yyscanner); @@ -637,12 +638,12 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") startFontClass(yyscanner,"keywordtype"); yyextra->code->codify(QCString(yytext).stripWhiteSpace()); endFontClass(yyscanner); - yyextra->code->codify(yytext + 4); + yyextra->code->codify(QCString(yytext + 4)); } else { yyextra->insideBody=TRUE; - generateLink(yyscanner,*yyextra->code, yytext); + generateLink(yyscanner,*yyextra->code,yytext); yyextra->insideBody=FALSE; } } @@ -740,7 +741,7 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") /*------ variable references? -------------------------------------*/ <Start>"%"{BS}{ID} { // ignore references to elements - yyextra->code->codify(yytext); + yyextra->code->codify(QCString(yytext)); } <Start>{ID} { yyextra->insideBody=TRUE; @@ -791,7 +792,7 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") yyextra->contLineNr++; YY_FTN_RESET } -<*>^{BS}"type"{BS}"=" { yyextra->code->codify(yytext); } +<*>^{BS}"type"{BS}"=" { yyextra->code->codify(QCString(yytext)); } <*>[\x80-\xFF]* { // keep utf8 characters together... if (yyextra->isFixedForm && yy_my_start > fixedCommentAfter) @@ -801,7 +802,7 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") } else { - yyextra->code->codify(yytext); + yyextra->code->codify(QCString(yytext)); } } <*>. { @@ -815,11 +816,11 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") } else { - yyextra->code->codify(yytext); + yyextra->code->codify(QCString(yytext)); } } <*>{LOG_OPER} { // Fortran logical comparison keywords - yyextra->code->codify(yytext); + yyextra->code->codify(QCString(yytext)); } <*><<EOF>> { if (YY_START == DocBlock) { @@ -870,7 +871,7 @@ static void startFontClass(yyscan_t yyscanner,const char *s) if (!yyextra->currentFontClass || !s || strcmp(yyextra->currentFontClass,s)) { endFontClass(yyscanner); - yyextra->code->startFontClass(s); + yyextra->code->startFontClass(QCString(s)); yyextra->currentFontClass=s; } } @@ -891,7 +892,7 @@ static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor) } } -static void addToSearchIndex(yyscan_t yyscanner,const char *text) +static void addToSearchIndex(yyscan_t yyscanner,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (Doxygen::searchIndex) @@ -914,7 +915,7 @@ static void startCodeLine(yyscan_t yyscanner) //lineAnchor.sprintf("l%05d",yyextra->yyLineNr); const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr); - //printf("startCodeLine %d d=%s\n", yyextra->yyLineNr,d ? d->name().data() : "<null>"); + //printf("startCodeLine %d d=%s\n", yyextra->yyLineNr,d ? qPrint(d->name()) : "<null>"); if (!yyextra->includeCodeFragment && d) { yyextra->currentDefinition = d; @@ -934,19 +935,19 @@ static void startCodeLine(yyscan_t yyscanner) { yyextra->code->writeLineNumber(d->getReference(), d->getOutputFileBase(), - 0,yyextra->yyLineNr); + QCString(),yyextra->yyLineNr); setCurrentDoc(yyscanner,lineAnchor); } } else { - yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr); + yyextra->code->writeLineNumber(QCString(),QCString(),QCString(),yyextra->yyLineNr); } } yyextra->code->startCodeLine(yyextra->sourceFileDef); if (yyextra->currentFontClass) { - yyextra->code->startFontClass(yyextra->currentFontClass); + yyextra->code->startFontClass(QCString(yyextra->currentFontClass)); } } @@ -973,11 +974,12 @@ static void nextCodeLine(yyscan_t yyscanner) /*! write a code fragment 'text' that may span multiple lines, inserting * line numbers for each line. */ -static void codifyLines(yyscan_t yyscanner,const char *text) +static void codifyLines(yyscan_t yyscanner,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,text); - const char *p=text,*sp=p; + if (text.isEmpty()) return; + const char *p=text.data(),*sp=p; char c; bool done=FALSE; while (!done) @@ -991,13 +993,13 @@ static void codifyLines(yyscan_t yyscanner,const char *text) char *tmp = (char*)malloc(l+1); memcpy(tmp,sp,l); tmp[l]='\0'; - yyextra->code->codify(tmp); + yyextra->code->codify(QCString(tmp)); free(tmp); nextCodeLine(yyscanner); } else { - yyextra->code->codify(sp); + yyextra->code->codify(QCString(sp)); done=TRUE; } } @@ -1008,7 +1010,7 @@ static void codifyLines(yyscan_t yyscanner,const char *text) * split into multiple links with the same destination, one for each line. */ static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, - Definition *d,const char *text) + Definition *d,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS); @@ -1022,18 +1024,17 @@ static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, tooltip = d->briefDescriptionAsTooltip(); } bool done=FALSE; - char *p=(char *)text; + const char *p=text.data(); while (!done) { - char *sp=p; + const char *sp=p; char c; while ((c=*p++) && c!='\n') { } if (c=='\n') { yyextra->yyLineNr++; - *(p-1)='\0'; //printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp); - ol.writeCodeLink(ref,file,anchor,sp,tooltip); + ol.writeCodeLink(ref,file,anchor,QCString(sp,p-sp-1),tooltip); nextCodeLine(yyscanner); } else @@ -1083,7 +1084,7 @@ static bool getFortranTypeDefs(const QCString &tname, const QCString &moduleName //cout << "=== type found in global module" << endl; return TRUE; } - else if (moduleName && (cd= Doxygen::classLinkedMap->find(moduleName+"::"+tname))) + else if (!moduleName.isEmpty() && (cd= Doxygen::classLinkedMap->find(moduleName+"::"+tname))) { //cout << "=== type found in local module" << endl; return TRUE; @@ -1200,7 +1201,7 @@ static MemberDef *getFortranDefs(yyscan_t yyscanner,const QCString &memberName, @todo implementation */ static bool getGenericProcedureLink(yyscan_t yyscanner,const ClassDef *cd, - const char *memberText, + const QCString &memberText, CodeOutputInterface &ol) { (void)cd; @@ -1210,9 +1211,9 @@ static bool getGenericProcedureLink(yyscan_t yyscanner,const ClassDef *cd, } static bool getLink(yyscan_t yyscanner,const UseMap &useMap, // dictionary with used modules - const char *memberText, // exact member text + const QCString &memberText, // exact member text CodeOutputInterface &ol, - const char *text) + const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; MemberDef *md=0; @@ -1234,8 +1235,8 @@ static bool getLink(yyscan_t yyscanner,const UseMap &useMap, // dictionary with std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex); addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md)); } - writeMultiLineCodeLink(yyscanner,ol,md,text ? text : memberText); - addToSearchIndex(yyscanner, text ? text : memberText); + writeMultiLineCodeLink(yyscanner,ol,md,!text.isEmpty() ? text : memberText); + addToSearchIndex(yyscanner, !text.isEmpty() ? text : memberText); return TRUE; } } @@ -1243,36 +1244,36 @@ static bool getLink(yyscan_t yyscanner,const UseMap &useMap, // dictionary with } -static void generateLink(yyscan_t yyscanner,CodeOutputInterface &ol, char *lname) +static void generateLink(yyscan_t yyscanner,CodeOutputInterface &ol, const QCString &lname) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; ClassDef *cd=0; NamespaceDef *nsd=0; - QCString tmp = lname; - tmp = removeRedundantWhiteSpace(tmp.lower()); + QCString name = lname; + name = removeRedundantWhiteSpace(name.lower()); // check if lowercase lname is a linkable type or interface - if ( (getFortranTypeDefs(tmp, yyextra->currentModule, cd, yyextra->useMembers)) && cd->isLinkable() ) + if ( (getFortranTypeDefs(name, yyextra->currentModule, cd, yyextra->useMembers)) && cd->isLinkable() ) { if ( (cd->compoundType() == ClassDef::Class) && // was Entry::INTERFACE_SEC) && - (getGenericProcedureLink(yyscanner, cd, tmp, ol)) ) + (getGenericProcedureLink(yyscanner, cd, name, ol)) ) { //cout << "=== generic procedure resolved" << endl; } else { // write type or interface link - writeMultiLineCodeLink(yyscanner, ol,cd,tmp); - addToSearchIndex(yyscanner, tmp); + writeMultiLineCodeLink(yyscanner, ol,cd,name); + addToSearchIndex(yyscanner, name); } } // check for module - else if ( (getFortranNamespaceDefs(tmp, nsd)) && nsd->isLinkable() ) + else if ( (getFortranNamespaceDefs(name, nsd)) && nsd->isLinkable() ) { // write module link - writeMultiLineCodeLink(yyscanner,ol,nsd,tmp); - addToSearchIndex(yyscanner,tmp); + writeMultiLineCodeLink(yyscanner,ol,nsd,name); + addToSearchIndex(yyscanner,name); } // check for function/variable - else if (getLink(yyscanner,yyextra->useMembers, tmp, ol, tmp)) + else if (getLink(yyscanner,yyextra->useMembers, name, ol, name)) { //cout << "=== found link for lowercase " << lname << endl; } @@ -1280,12 +1281,17 @@ static void generateLink(yyscan_t yyscanner,CodeOutputInterface &ol, char *lname { // nothing found, just write out the word //startFontClass("charliteral"); //test - codifyLines(yyscanner,tmp); + codifyLines(yyscanner,name); //endFontClass(yyscanner); //test - addToSearchIndex(yyscanner,tmp); + addToSearchIndex(yyscanner,name); } } +static void generateLink(yyscan_t yyscanner,CodeOutputInterface &ol, const char *lname) +{ + generateLink(yyscanner,ol,QCString(lname)); +} + /*! counts the number of lines in the input */ static int countLines(yyscan_t yyscanner) { @@ -1423,11 +1429,11 @@ void FortranCodeParser::resetCodeParserState() } void FortranCodeParser::parseCode(CodeOutputInterface & codeOutIntf, - const char * scopeName, + const QCString & scopeName, const QCString & input, SrcLangExt /*lang*/, bool isExampleBlock, - const char * exampleName, + const QCString & exampleName, FileDef * fileDef, int startLine, int endLine, @@ -1449,9 +1455,9 @@ void FortranCodeParser::parseCode(CodeOutputInterface & codeOutIntf, // const MemberDef *,bool,const Definition *searchCtx, // bool collectXRefs, FortranFormat format) if (input.isEmpty()) return; - printlex(yy_flex_debug, TRUE, __FILE__, fileDef ? fileDef->fileName().data(): NULL); + printlex(yy_flex_debug, TRUE, __FILE__, fileDef ? qPrint(fileDef->fileName()): NULL); yyextra->code = &codeOutIntf; - yyextra->inputString = input; + yyextra->inputString = input.data(); yyextra->inputPosition = 0; yyextra->isFixedForm = recognizeFixedForm(input,p->format); yyextra->contLineNr = 1; @@ -1480,11 +1486,11 @@ void FortranCodeParser::parseCode(CodeOutputInterface & codeOutIntf, if (isExampleBlock && fileDef==0) { // create a dummy filedef for the example - yyextra->sourceFileDef = createFileDef("",exampleName); + yyextra->sourceFileDef = createFileDef(QCString(),exampleName); } if (yyextra->sourceFileDef) { - setCurrentDoc(yyscanner,"l00001"); + setCurrentDoc(yyscanner,QCString("l00001")); } yyextra->currentDefinition = 0; yyextra->currentMemberDef = 0; @@ -1514,7 +1520,7 @@ void FortranCodeParser::parseCode(CodeOutputInterface & codeOutIntf, // write the tooltips TooltipManager::instance().writeTooltips(codeOutIntf); - printlex(yy_flex_debug, FALSE, __FILE__, fileDef ? fileDef->fileName().data(): NULL); + printlex(yy_flex_debug, FALSE, __FILE__, fileDef ? qPrint(fileDef->fileName()): NULL); } //--------------------------------------------------------- diff --git a/src/fortranscanner.h b/src/fortranscanner.h index 0fbba89..bf286c3 100644 --- a/src/fortranscanner.h +++ b/src/fortranscanner.h @@ -29,12 +29,12 @@ class FortranOutlineParser : public OutlineParserInterface public: FortranOutlineParser(FortranFormat format=FortranFormat_Unknown); ~FortranOutlineParser(); - void parseInput(const char *fileName, + void parseInput(const QCString &fileName, const char *fileBuf, const std::shared_ptr<Entry> &root, ClangTUParser *clangParser); bool needsPreprocessing(const QCString &extension) const; - void parsePrototype(const char *text); + void parsePrototype(const QCString &text); private: struct Private; diff --git a/src/fortranscanner.l b/src/fortranscanner.l index bfab8c2..328612a 100755 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -206,8 +206,8 @@ struct fortranscannerYY_state //----------------------------------------------------------------------------- static int getAmpersandAtTheStart(const char *buf, int length); static int getAmpOrExclAtTheEnd(const char *buf, int length, char ch); -static QCString extractFromParens(const QCString name); -static QCString extractBind(const QCString name); +static QCString extractFromParens(const QCString &name); +static QCString extractBind(const QCString &name); static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); @@ -216,8 +216,8 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief); static void subrHandleCommentBlockResult(yyscan_t yyscanner,const QCString &doc,bool brief); static void addCurrentEntry(yyscan_t yyscanner,bool case_insens); -static void addModule(yyscan_t yyscanner,const char *name, bool isModule=FALSE); -static void addSubprogram(yyscan_t yyscanner,const char *text); +static void addModule(yyscan_t yyscanner,const QCString &name=QCString(), bool isModule=FALSE); +static void addSubprogram(yyscan_t yyscanner,const QCString &text); static void addInterface(yyscan_t yyscanner,QCString name, InterfaceType type); static Argument *getParameter(yyscan_t yyscanner,const QCString &name); static void scanner_abort(yyscan_t yyscanner); @@ -226,7 +226,7 @@ static void startScope(yyscan_t yyscanner,Entry *scope); static bool endScope(yyscan_t yyscanner,Entry *scope, bool isGlobalRoot=FALSE); static void resolveModuleProcedures(yyscan_t yyscanner,Entry *current_root); static void truncatePrepass(yyscan_t yyscanner,int index); -static void pushBuffer(yyscan_t yyscanner,QCString &buffer); +static void pushBuffer(yyscan_t yyscanner,const QCString &buffer); static void popBuffer(yyscan_t yyscanner); static const CommentInPrepass* locatePrepassComment(yyscan_t yyscanner,int from, int to); static void updateVariablePrepassComment(yyscan_t yyscanner,int from, int to); @@ -378,6 +378,7 @@ SCOPENAME ({ID}{BS}"::"{BS})* if (YY_START != Prepass) { yyextra->comments.clear(); + yyextra->inputStringPrepass=QCString(); yy_push_state(Prepass,yyscanner); } @@ -445,7 +446,7 @@ SCOPENAME ({ID}{BS}"::"{BS})* } } <StrIgnore>.?/\n { yy_pop_state(yyscanner); // comment ends with endline character - DBG_CTX((stderr,"end comment %d %s\n",yyextra->lineNr,yyextra->debugStr.data())); + DBG_CTX((stderr,"end comment %d %s\n",yyextra->lineNr,qPrint(yyextra->debugStr))); } // comment line ends <StrIgnore>. { yyextra->debugStr+=yytext; } @@ -455,7 +456,7 @@ SCOPENAME ({ID}{BS}"::"{BS})* <Start,ModuleBody,SubprogBody>"use"{BS_} { if (YY_START == Start) { - addModule(yyscanner,NULL); + addModule(yyscanner); yy_push_state(ModuleBody,yyscanner); //anon program } yy_push_state(Use,yyscanner); @@ -555,7 +556,7 @@ SCOPENAME ({ID}{BS}"::"{BS})* <Start>^{BS}{CONTAINS}/({BS}|\n|!|;) { if (YY_START == Start) { - addModule(yyscanner,NULL); + addModule(yyscanner); yy_push_state(ModuleBodyContains,yyscanner); //anon program } } @@ -612,11 +613,11 @@ SCOPENAME ({ID}{BS}"::"{BS})* } } <Module>{ID} { - addModule(yyscanner,yytext, TRUE); + addModule(yyscanner, QCString(yytext), TRUE); BEGIN(ModuleBody); } <Program>{ID} { - addModule(yyscanner,yytext, FALSE); + addModule(yyscanner, QCString(yytext), FALSE); BEGIN(ModuleBody); } @@ -634,7 +635,7 @@ SCOPENAME ({ID}{BS}"::"{BS})* <Start,ModuleBody>^{BS}type/[^a-z0-9_] { if (YY_START == Start) { - addModule(yyscanner,NULL); + addModule(yyscanner,QCString()); yy_push_state(ModuleBody,yyscanner); //anon program } @@ -793,7 +794,7 @@ private { /* variable declaration starts */ if (YY_START == Start) { - addModule(yyscanner,NULL); + addModule(yyscanner); yy_push_state(ModuleBody,yyscanner); //anon program } yy_push_state(AttributeList,yyscanner); @@ -802,7 +803,7 @@ private { /* external can be a "type" or an attribute */ if (YY_START == Start) { - addModule(yyscanner,NULL); + addModule(yyscanner); yy_push_state(ModuleBody,yyscanner); //anon program } QCString tmp = yytext; @@ -990,7 +991,7 @@ private { <Variable>";".*"\n" { yyextra->currentModifiers = SymbolModifiers(); yy_pop_state(yyscanner); // end variable declaration list yyextra->docBlock.resize(0); - yyextra->inputStringSemi =(const char*)(QCString(" \n") + QCString(yytext+1)).data(); + yyextra->inputStringSemi = " \n"+QCString(yytext+1); yyextra->lineNr--; pushBuffer(yyscanner,yyextra->inputStringSemi); } @@ -998,7 +999,7 @@ private { if (YY_START == Variable) REJECT; // Just be on the safe side if (YY_START == String) REJECT; // ";" ignored in strings if (YY_START == StrIgnore) REJECT; // ";" ignored in regular yyextra->comments - yyextra->inputStringSemi =(const char*)(QCString(" \n") + QCString(yytext+1)).data(); + yyextra->inputStringSemi = " \n"+QCString(yytext+1); yyextra->lineNr--; pushBuffer(yyscanner,yyextra->inputStringSemi); } @@ -1060,7 +1061,7 @@ private { <*>{BS}"enum"{BS}","{BS}"bind"{BS}"("{BS}"c"{BS}")"{BS} { if (YY_START == Start) { - addModule(yyscanner,NULL); + addModule(yyscanner); yy_push_state(ModuleBody,yyscanner); //anon program } @@ -1753,7 +1754,7 @@ const char* prepassFixedForm(const char* contents, int *hasContLine) return newContents; } -static void pushBuffer(yyscan_t yyscanner,QCString& buffer) +static void pushBuffer(yyscan_t yyscanner,const QCString &buffer) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (yyextra->includeStackCnt <= yyextra->includeStackPtr) @@ -1762,10 +1763,9 @@ static void pushBuffer(yyscan_t yyscanner,QCString& buffer) yyextra->includeStack = (YY_BUFFER_STATE *)realloc(yyextra->includeStack, yyextra->includeStackCnt * sizeof(YY_BUFFER_STATE)); } yyextra->includeStack[yyextra->includeStackPtr++] = YY_CURRENT_BUFFER; - yy_switch_to_buffer(yy_scan_string(buffer,yyscanner),yyscanner); + yy_switch_to_buffer(yy_scan_string(buffer.data(),yyscanner),yyscanner); - DBG_CTX((stderr, "--PUSH--%s", (const char *)buffer)); - buffer = NULL; + DBG_CTX((stderr, "--PUSH--%s", qPrint(buffer))); } static void popBuffer(yyscan_t yyscanner) @@ -1814,7 +1814,7 @@ void resolveModuleProcedures(yyscan_t yyscanner,Entry *current_root) } /*! Extracts string which resides within parentheses of provided string. */ -static QCString extractFromParens(const QCString name) +static QCString extractFromParens(const QCString &name) { QCString extracted = name; int start = extracted.find("("); @@ -1834,7 +1834,7 @@ static QCString extractFromParens(const QCString name) } /*! remove useless spaces from bind statement */ -static QCString extractBind(const QCString name) +static QCString extractBind(const QCString &name) { QCString parensPart = extractFromParens(name); if (parensPart.length() == 1) @@ -2199,8 +2199,8 @@ static bool endScope(yyscan_t yyscanner,Entry *scope, bool isGlobalRoot) // iterate all symbol yyextra->modifiers of the scope for (const auto &kv : mdfsMap) { - //cout<<it.key()<<": "<<it.data()<<endl; - Argument *arg = findArgument(scope, kv.first); + //cout<<it.key()<<": "<<qPrint(it)<<endl; + Argument *arg = findArgument(scope, QCString(kv.first)); if (arg) { @@ -2315,23 +2315,23 @@ static void addCurrentEntry(yyscan_t yyscanner,bool case_insens) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (case_insens) yyextra->current->name = yyextra->current->name.lower(); - //printf("===Adding entry %s to %s\n", yyextra->current->name.data(), yyextra->current_root->name.data()); + //printf("===Adding entry %s to %s\n", qPrint(yyextra->current->name), qPrint(yyextra->current_root->name)); yyextra->last_entry = yyextra->current; yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); initEntry(yyscanner); } -static void addModule(yyscan_t yyscanner,const char *name, bool isModule) +static void addModule(yyscan_t yyscanner,const QCString &name, bool isModule) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - DBG_CTX((stderr, "0=========> got module %s\n", name)); + DBG_CTX((stderr, "0=========> got module %s\n", qPrint(name))); if (isModule) yyextra->current->section = Entry::NAMESPACE_SEC; else yyextra->current->section = Entry::FUNCTION_SEC; - if (name!=NULL) + if (!name.isEmpty()) { yyextra->current->name = name; } @@ -2353,10 +2353,10 @@ static void addModule(yyscan_t yyscanner,const char *name, bool isModule) } -static void addSubprogram(yyscan_t yyscanner,const char *text) +static void addSubprogram(yyscan_t yyscanner,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - DBG_CTX((stderr,"1=========> got subprog, type: %s\n",text)); + DBG_CTX((stderr,"1=========> got subprog, type: %s\n",qPrint(text))); yyextra->subrCurrent.push_back(yyextra->current); yyextra->current->section = Entry::FUNCTION_SEC ; QCString subtype = text; subtype=subtype.lower().stripWhiteSpace(); @@ -2380,7 +2380,7 @@ static void addInterface(yyscan_t yyscanner,QCString name, InterfaceType type) struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (YY_START == Start) { - addModule(yyscanner,NULL); + addModule(yyscanner); yy_push_state(ModuleBody,yyscanner); //anon program } @@ -2467,7 +2467,7 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief yyextra->docBlockInBody = FALSE; return; } - DBG_CTX((stderr,"call parseCommentBlock [%s]\n",doc.data())); + DBG_CTX((stderr,"call parseCommentBlock [%s]\n",qPrint(doc))); int lineNr = brief ? yyextra->current->briefLine : yyextra->current->docLine; int position=0; bool needsEntry = FALSE; @@ -2539,8 +2539,8 @@ static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool b else { // something different specified, give warning and leave error. - warn(yyextra->fileName,yyextra->lineNr, "%s", ("Routine: " + yyextra->current->name + yyextra->current->args + - " inconsistency between intent attribute and documentation for parameter: " + yyextra->argName).data()); + warn(yyextra->fileName,yyextra->lineNr, "Routine: %s%s inconsistency between intent attribute and documentation for parameter %s:", + qPrint(yyextra->current->name),qPrint(yyextra->current->args),qPrint(yyextra->argName)); handleCommentBlock(yyscanner,QCString("\n\n@param ") + directionParam[dir1] + " " + yyextra->argName + " " + loc_doc,brief); } @@ -2563,8 +2563,8 @@ static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool b } else { - warn(yyextra->fileName,yyextra->lineNr, "%s", ("Routine: " + yyextra->current->name + yyextra->current->args + - " inconsistency between intent attribute and documentation for parameter: " + yyextra->argName).data()); + warn(yyextra->fileName,yyextra->lineNr, "Routine: %s%s inconsistency between intent attribute and documentation for parameter %s:", + qPrint(yyextra->current->name),qPrint(yyextra->current->args),qPrint(yyextra->argName)); handleCommentBlock(yyscanner,QCString("\n\n@param ") + directionParam[dir1] + " " + yyextra->argName + " " + loc_doc,brief); } @@ -2585,8 +2585,8 @@ static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool b } else { - warn(yyextra->fileName,yyextra->lineNr, "%s", ("Routine: " + yyextra->current->name + yyextra->current->args + - " inconsistency between intent attribute and documentation for parameter: " + yyextra->argName).data()); + warn(yyextra->fileName,yyextra->lineNr, "Routine: %s%s inconsistency between intent attribute and documentation for parameter %s:", + qPrint(yyextra->current->name),qPrint(yyextra->current->args),qPrint(yyextra->argName)); handleCommentBlock(yyscanner,QCString("\n\n@param ") + directionParam[dir1] + " " + yyextra->argName + " " + loc_doc,brief); } @@ -2634,20 +2634,19 @@ static void subrHandleCommentBlockResult(yyscan_t yyscanner,const QCString &doc, //---------------------------------------------------------------------------- -static void parseMain(yyscan_t yyscanner, const char *fileName,const char *fileBuf, +static void parseMain(yyscan_t yyscanner, const QCString &fileName,const char *fileBuf, const std::shared_ptr<Entry> &rt, FortranFormat format) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - char *tmpBuf = NULL; + char *tmpBuf = nullptr; initParser(yyscanner); - if (fileBuf==0 || fileBuf[0]=='\0') return; yyextra->defaultProtection = Public; yyextra->inputString = fileBuf; yyextra->inputPosition = 0; - yyextra->inputStringPrepass = NULL; + yyextra->inputStringPrepass = nullptr; yyextra->inputPositionPrepass = 0; //yyextra->anonCount = 0; // don't reset per file @@ -2658,13 +2657,13 @@ static void parseMain(yyscan_t yyscanner, const char *fileName,const char *fileB if (yyextra->isFixedForm) { - msg("Prepassing fixed form of %s\n", fileName); + msg("Prepassing fixed form of %s\n", qPrint(fileName)); //printf("---strlen=%d\n", strlen(fileBuf)); //clock_t start=clock(); //printf("Input fixed form string:\n%s\n", fileBuf); //printf("===========================\n"); - yyextra->inputString = prepassFixedForm(fileBuf, NULL); + yyextra->inputString = prepassFixedForm(fileBuf, nullptr); Debug::print(Debug::FortranFixed2Free,0,"======== Fixed to Free format =========\n---- Input fixed form string ------- \n%s\n", fileBuf); Debug::print(Debug::FortranFixed2Free,0,"---- Resulting free form string ------- \n%s\n", yyextra->inputString); //printf("Resulting free form string:\n%s\n", yyextra->inputString); @@ -2684,7 +2683,7 @@ static void parseMain(yyscan_t yyscanner, const char *fileName,const char *fileB yyextra->lineNr= 1 ; yyextra->fileName = fileName; - msg("Parsing file %s...\n",yyextra->fileName.data()); + msg("Parsing file %s...\n",qPrint(yyextra->fileName)); yyextra->global_scope = rt.get(); startScope(yyscanner,rt.get()); // implies yyextra->current_root = rt @@ -2760,19 +2759,19 @@ FortranOutlineParser::~FortranOutlineParser() { } -void FortranOutlineParser::parseInput(const char *fileName, - const char *fileBuf, - const std::shared_ptr<Entry> &root, - ClangTUParser * /*clangParser*/) +void FortranOutlineParser::parseInput(const QCString &fileName, + const char *fileBuf, + const std::shared_ptr<Entry> &root, + ClangTUParser * /*clangParser*/) { struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; yyextra->thisParser = this; - printlex(yy_flex_debug, TRUE, __FILE__, fileName); + printlex(yy_flex_debug, TRUE, __FILE__, qPrint(fileName)); ::parseMain(p->yyscanner,fileName,fileBuf,root,p->format); - printlex(yy_flex_debug, FALSE, __FILE__, fileName); + printlex(yy_flex_debug, FALSE, __FILE__, qPrint(fileName)); } bool FortranOutlineParser::needsPreprocessing(const QCString &extension) const @@ -2780,11 +2779,10 @@ bool FortranOutlineParser::needsPreprocessing(const QCString &extension) const return extension!=extension.lower(); // use preprocessor only for upper case extensions } -void FortranOutlineParser::parsePrototype(const char *text) +void FortranOutlineParser::parsePrototype(const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; - QCString buffer = QCString(text); - pushBuffer(p->yyscanner,buffer); + pushBuffer(p->yyscanner,text); yyextra->parsingPrototype = TRUE; BEGIN(Prototype); fortranscannerYYlex(p->yyscanner); @@ -2798,7 +2796,7 @@ static void scanner_abort(yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; fprintf(stderr,"********************************************************************\n"); - fprintf(stderr,"Error in file %s line: %d, state: %d(%s)\n",yyextra->fileName.data(),yyextra->lineNr,YY_START,stateToString(YY_START)); + fprintf(stderr,"Error in file %s line: %d, state: %d(%s)\n",qPrint(yyextra->fileName),yyextra->lineNr,YY_START,stateToString(YY_START)); fprintf(stderr,"********************************************************************\n"); bool start=FALSE; diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index 572556d..24ed957 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -67,8 +67,8 @@ const char *JAVASCRIPT_LICENSE_TEXT = R"LIC(/* struct FTVNode { - FTVNode(bool dir,const char *r,const char *f,const char *a, - const char *n,bool sepIndex,bool navIndex,const Definition *df) + FTVNode(bool dir,const QCString &r,const QCString &f,const QCString &a, + const QCString &n,bool sepIndex,bool navIndex,const Definition *df) : isLast(TRUE), isDir(dir),ref(r),file(f),anchor(a),name(n), index(0), parent(0), separateIndex(sepIndex), addToNavIndex(navIndex), def(df) {} @@ -208,10 +208,10 @@ void FTVHelp::decContentsDepth() * \param def Definition corresponding to this entry */ void FTVHelp::addContentsItem(bool isDir, - const char *name, - const char *ref, - const char *file, - const char *anchor, + const QCString &name, + const QCString &ref, + const QCString &file, + const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def @@ -279,7 +279,7 @@ QCString FTVHelp::generateIndentLabel(FTVNode *n,int level) return result; } -void FTVHelp::generateIndent(std::ostream &t, FTVNode *n,bool opened) +void FTVHelp::generateIndent(TextStream &t, FTVNode *n,bool opened) { int indent=0; FTVNode *p = n->parent; @@ -299,10 +299,10 @@ void FTVHelp::generateIndent(std::ostream &t, FTVNode *n,bool opened) } } -void FTVHelp::generateLink(std::ostream &t,FTVNode *n) +void FTVHelp::generateLink(TextStream &t,FTVNode *n) { //printf("FTVHelp::generateLink(ref=%s,file=%s,anchor=%s\n", - // n->ref.data(),n->file.data(),n->anchor.data()); + // qPrint(n->ref),qPrint(n->file),qPrint(n->anchor)); bool setTarget = FALSE; if (n->file.isEmpty()) // no link { @@ -344,15 +344,15 @@ void FTVHelp::generateLink(std::ostream &t,FTVNode *n) } } -static void generateBriefDoc(std::ostream &t,const Definition *def) +static void generateBriefDoc(TextStream &t,const Definition *def) { QCString brief = def->briefDescription(TRUE); - //printf("*** %p: generateBriefDoc(%s)='%s'\n",def,def->name().data(),brief.data()); + //printf("*** %p: generateBriefDoc(%s)='%s'\n",def,qPrint(def->name()),qPrint(brief)); if (!brief.isEmpty()) { DocNode *root = validatingParseDoc(def->briefFile(),def->briefLine(), def,0,brief,FALSE,FALSE, - 0,TRUE,TRUE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,TRUE,Config_getBool(MARKDOWN_SUPPORT)); QCString relPath = relativePathToRoot(def->getOutputFileBase()); HtmlCodeGenerator htmlGen(t,relPath); HtmlDocVisitor *visitor = new HtmlDocVisitor(t,htmlGen,def); @@ -383,7 +383,7 @@ static char compoundIcon(const ClassDef *cd) return icon; } -void FTVHelp::generateTree(std::ostream &t, const std::vector<FTVNode*> &nl,int level,int maxLevel,int &index) +void FTVHelp::generateTree(TextStream &t, const std::vector<FTVNode*> &nl,int level,int maxLevel,int &index) { for (const auto &n : nl) { @@ -479,6 +479,10 @@ void FTVHelp::generateTree(std::ostream &t, const std::vector<FTVNode*> &nl,int char icon=compoundIcon(toClassDef(n->def)); t << "<span class=\"icona\"><span class=\"icon\">" << icon << "</span></span>"; } + else if (n->def && n->def->definitionType()==Definition::TypeConcept) + { + t << "<span class=\"icona\"><span class=\"icon\">R</span></span>"; + } else if (n->def && n->def->definitionType()==Definition::TypeDir) { t << "<span class=\"iconfclosed\"></span>"; @@ -534,7 +538,7 @@ static bool dupOfParent(const FTVNode *n) return FALSE; } -static void generateJSLink(std::ostream &t,const FTVNode *n) +static void generateJSLink(TextStream &t,const FTVNode *n) { if (n->file.isEmpty()) // no link { @@ -557,7 +561,7 @@ static QCString convertFileId2Var(const QCString &fileId) return substitute(varId,"-","_"); } -static bool generateJSTree(NavIndexEntryList &navIndex,std::ostream &t, +static bool generateJSTree(NavIndexEntryList &navIndex,TextStream &t, const std::vector<FTVNode*> &nl,int level,bool &first) { static QCString htmlOutput = Config_getString(HTML_OUTPUT); @@ -607,7 +611,7 @@ static bool generateJSTree(NavIndexEntryList &navIndex,std::ostream &t, if (!n->children.empty()) // write children to separate file for dynamic loading { QCString fileId = n->file; - if (n->anchor) + if (!n->anchor.isEmpty()) { fileId+="_"+n->anchor; } @@ -616,14 +620,15 @@ static bool generateJSTree(NavIndexEntryList &navIndex,std::ostream &t, fileId+="_dup"; } QCString fileName = htmlOutput+"/"+fileId+".js"; - std::ofstream tt(fileName,std::ofstream::out | std::ofstream::binary); - if (tt.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream tt(&f); tt << "var " << convertFileId2Var(fileId) << " =\n"; generateJSTree(navIndex,tt,n->children,1,firstChild); tt << "\n];"; } - tt.close(); + f.close(); t << "\"" << fileId << "\" ]"; } else // no children @@ -649,11 +654,12 @@ static bool generateJSTree(NavIndexEntryList &navIndex,std::ostream &t, static void generateJSNavTree(const std::vector<FTVNode*> &nodeList) { QCString htmlOutput = Config_getString(HTML_OUTPUT); - std::ofstream t(htmlOutput.str()+"/navtreedata.js",std::ofstream::out | std::ofstream::binary); + std::ofstream f(htmlOutput.str()+"/navtreedata.js",std::ofstream::out | std::ofstream::binary); NavIndexEntryList navIndex; - if (t.is_open()) + if (f.is_open()) { - //std::ostream tidx(&fidx); + TextStream t(&f); + //TextStream tidx(&fidx); //tidx << "var NAVTREEINDEX =\n"; //tidx << "{\n"; t << JAVASCRIPT_LICENSE_TEXT; @@ -695,7 +701,7 @@ static void generateJSNavTree(const std::vector<FTVNode*> &nodeList) // write the navigation index (and sub-indices) std::sort(navIndex.begin(),navIndex.end(),[](const auto &n1,const auto &n2) - { return qstrcmp(n1.url,n2.url)<0; }); + { return !n1.url.isEmpty() && (n2.url.isEmpty() || (n1.url<n2.url)); }); int subIndex=0; int elemCount=0; @@ -779,7 +785,7 @@ void FTVHelp::generateTreeViewScripts() } // write tree inside page -void FTVHelp::generateTreeViewInline(std::ostream &t) +void FTVHelp::generateTreeViewInline(TextStream &t) { int preferredNumEntries = Config_getInt(HTML_INDEX_NUM_ENTRIES); t << "<div class=\"directory\">\n"; diff --git a/src/ftvhelp.h b/src/ftvhelp.h index 11317fd..196b01c 100644 --- a/src/ftvhelp.h +++ b/src/ftvhelp.h @@ -24,11 +24,11 @@ #ifndef FTVHELP_H #define FTVHELP_H -#include <iostream> #include <vector> #include "index.h" class Definition; +class TextStream; struct FTVNode; /** A class that generates a dynamic tree view side panel. @@ -43,26 +43,26 @@ class FTVHelp : public IndexIntf void incContentsDepth(); void decContentsDepth(); void addContentsItem(bool isDir, - const char *name, - const char *ref, - const char *file, - const char *anchor, + const QCString &name, + const QCString &ref, + const QCString &file, + const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def); - void addIndexItem(const Definition *,const MemberDef *,const char *,const char *) {} - void addIndexFile(const char *) {} - void addImageFile(const char *) {} - void addStyleSheetFile(const char *) {} + void addIndexItem(const Definition *,const MemberDef *,const QCString &,const QCString &) {} + void addIndexFile(const QCString &) {} + void addImageFile(const QCString &) {} + void addStyleSheetFile(const QCString &) {} void generateTreeView(); - void generateTreeViewInline(std::ostream &t); + void generateTreeViewInline(TextStream &t); static void generateTreeViewImages(); void generateTreeViewScripts(); private: - void generateTree(std::ostream &t,const std::vector<FTVNode*> &nl,int level,int maxLevel,int &index); + void generateTree(TextStream &t,const std::vector<FTVNode*> &nl,int level,int maxLevel,int &index); QCString generateIndentLabel(FTVNode *n,int level); - void generateIndent(std::ostream &t,FTVNode *n,bool opened); - void generateLink(std::ostream &t,FTVNode *n); + void generateIndent(TextStream &t,FTVNode *n,bool opened); + void generateLink(TextStream &t,FTVNode *n); std::vector< std::vector<FTVNode*> > m_indentNodes; int m_indent; bool m_topLevelIndex; diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 7e6dca4..a1ed4d5 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -52,18 +52,19 @@ class GroupDefImpl : public DefinitionMixin<GroupDef> { public: - GroupDefImpl(const char *fileName,int line,const char *name,const char *title,const char *refFileName=0); + GroupDefImpl(const QCString &fileName,int line,const QCString &name,const QCString &title,const QCString &refFileName=QCString()); virtual ~GroupDefImpl(); virtual DefType definitionType() const { return TypeGroup; } virtual QCString getOutputFileBase() const; virtual QCString anchor() const { return QCString(); } virtual QCString displayName(bool=TRUE) const { return hasGroupTitle() ? m_title : DefinitionMixin::name(); } - virtual const char *groupTitle() const { return m_title; } - virtual void setGroupTitle( const char *newtitle ); + virtual QCString groupTitle() const { return m_title; } + virtual void setGroupTitle( const QCString &newtitle ); virtual bool hasGroupTitle( ) const { return m_titleSet; } virtual void addFile(const FileDef *def); virtual bool addClass(const ClassDef *def); + virtual bool addConcept(const ConceptDef *def); virtual bool addNamespace(const NamespaceDef *def); virtual void addGroup(const GroupDef *def); virtual void addPage(const PageDef *def); @@ -75,7 +76,7 @@ class GroupDefImpl : public DefinitionMixin<GroupDef> virtual void writeDocumentation(OutputList &ol); virtual void writeMemberPages(OutputList &ol); virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const; - virtual void writeTagFile(std::ostream &); + virtual void writeTagFile(TextStream &); virtual size_t numDocMembers() const; virtual bool isLinkableInProject() const; virtual bool isLinkable() const; @@ -102,6 +103,7 @@ class GroupDefImpl : public DefinitionMixin<GroupDef> virtual const FileList &getFiles() const { return m_fileList; } virtual const ClassLinkedRefMap &getClasses() const { return m_classes; } + virtual const ConceptLinkedRefMap &getConcepts() const { return m_concepts; } virtual const NamespaceLinkedRefMap &getNamespaces() const { return m_namespaces; } virtual const GroupList &getSubGroups() const { return m_groups; } virtual const PageLinkedRefMap &getPages() const { return m_pages; } @@ -122,6 +124,7 @@ class GroupDefImpl : public DefinitionMixin<GroupDef> void writeNestedGroups(OutputList &ol,const QCString &title); void writeDirs(OutputList &ol,const QCString &title); void writeClasses(OutputList &ol,const QCString &title); + void writeConcepts(OutputList &ol,const QCString &title); void writeInlineClasses(OutputList &ol); void writePageDocumentation(OutputList &ol); void writeDetailedDescription(OutputList &ol,const QCString &title); @@ -140,6 +143,7 @@ class GroupDefImpl : public DefinitionMixin<GroupDef> QCString m_fileName; // base name of the generated file FileList m_fileList; // list of files in the group ClassLinkedRefMap m_classes; // list of classes in the group + ConceptLinkedRefMap m_concepts; // list of concepts in the group NamespaceLinkedRefMap m_namespaces; // list of namespaces in the group GroupList m_groups; // list of sub groups. PageLinkedRefMap m_pages; // list of pages in the group @@ -154,8 +158,8 @@ class GroupDefImpl : public DefinitionMixin<GroupDef> }; -GroupDef *createGroupDef(const char *fileName,int line,const char *name, - const char *title,const char *refFileName) +GroupDef *createGroupDef(const QCString &fileName,int line,const QCString &name, + const QCString &title,const QCString &refFileName) { return new GroupDefImpl(fileName,line,name,title,refFileName); } @@ -163,11 +167,11 @@ GroupDef *createGroupDef(const char *fileName,int line,const char *name, //--------------------------------------------------------------------------- -GroupDefImpl::GroupDefImpl(const char *df,int dl,const char *na,const char *t, - const char *refFileName) : DefinitionMixin(df,dl,1,na), +GroupDefImpl::GroupDefImpl(const QCString &df,int dl,const QCString &na,const QCString &t, + const QCString &refFileName) : DefinitionMixin(df,dl,1,na), m_allMemberList(MemberListType_allMembersList) { - if (refFileName) + if (!refFileName.isEmpty()) { m_fileName=stripExtension(refFileName); } @@ -186,9 +190,9 @@ GroupDefImpl::~GroupDefImpl() { } -void GroupDefImpl::setGroupTitle( const char *t ) +void GroupDefImpl::setGroupTitle( const QCString &t ) { - if ( t && *t ) + if ( !t.isEmpty()) { m_title = t; m_titleSet = TRUE; @@ -256,6 +260,18 @@ bool GroupDefImpl::addClass(const ClassDef *cd) return FALSE; } +bool GroupDefImpl::addConcept(const ConceptDef *cd) +{ + if (cd->isHidden()) return FALSE; + QCString qn = cd->name(); + if (m_concepts.find(qn)==0) + { + m_concepts.add(qn,cd); + return TRUE; + } + return FALSE; +} + bool GroupDefImpl::addNamespace(const NamespaceDef *def) { //printf("adding namespace hidden=%d\n",def->isHidden()); @@ -278,7 +294,7 @@ void GroupDefImpl::addDir(DirDef *def) void GroupDefImpl::addPage(const PageDef *def) { if (def->isHidden()) return; - //printf("Making page %s part of a group\n",def->name.data()); + //printf("Making page %s part of a group\n",qPrint(def->name)); m_pages.add(def->name(),def); const_cast<PageDef*>(def)->makePartOfGroup(this); } @@ -312,7 +328,7 @@ bool GroupDefImpl::insertMember(const MemberDef *md,bool docOnly) { if (md->isHidden()) return FALSE; updateLanguage(md); - //printf("GroupDef(%s)::insertMember(%s)\n", title.data(), md->name().data()); + //printf("GroupDef(%s)::insertMember(%s)\n", qPrint(title), qPrint(md->name())); MemberNameInfo *mni = m_allMemberNameInfoLinkedMap.add(md->name()); for (auto &srcMi : *mni) { @@ -454,16 +470,16 @@ bool GroupDefImpl::insertMember(const MemberDef *md,bool docOnly) default: err("GroupDefImpl::insertMembers(): " "member '%s' (typeid=%d) with scope '%s' inserted in group scope '%s'!\n", - md->name().data(),md->memberType(), - md->getClassDef() ? md->getClassDef()->name().data() : "", - name().data()); + qPrint(md->name()),md->memberType(), + md->getClassDef() ? qPrint(md->getClassDef()->name()) : "", + qPrint(name())); } return TRUE; } void GroupDefImpl::removeMember(MemberDef *md) { - // fprintf(stderr, "GroupDef(%s)::removeMember( %s )\n", title.data(), md->name().data()); + // fprintf(stderr, "GroupDef(%s)::removeMember( %s )\n", qPrint(title), qPrint(md->name())); MemberNameInfo *mni = m_allMemberNameInfoLinkedMap.find(md->name()); if (mni) { @@ -553,7 +569,7 @@ bool GroupDefImpl::findGroup(const GroupDef *def) const void GroupDefImpl::addGroup(const GroupDef *def) { - //printf("adding group '%s' to group '%s'\n",def->name().data(),name().data()); + //printf("adding group '%s' to group '%s'\n",qPrint(def->name()),qPrint(name())); //if (Config_getBool(SORT_MEMBER_DOCS)) // groupList->inSort(def); //else @@ -597,7 +613,7 @@ void GroupDefImpl::computeAnchors() m_allMemberList.setAnchors(); } -void GroupDefImpl::writeTagFile(std::ostream &tagFile) +void GroupDefImpl::writeTagFile(TextStream &tagFile) { tagFile << " <compound kind=\"group\">\n"; tagFile << " <name>" << convertToXML(name()) << "</name>\n"; @@ -619,6 +635,18 @@ void GroupDefImpl::writeTagFile(std::ostream &tagFile) } } break; + case LayoutDocEntry::GroupConcepts: + { + for (const auto &cd : m_concepts) + { + if (cd->isLinkableInProject()) + { + tagFile << " <concept>" << convertToXML(cd->name()) + << "</concept>\n"; + } + } + } + break; case LayoutDocEntry::GroupNamespaces: { for (const auto &nd : m_namespaces) @@ -717,7 +745,7 @@ void GroupDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - ol.writeAnchor(0,"details"); + ol.writeAnchor(QCString(),"details"); ol.popGeneratorState(); } else @@ -733,7 +761,7 @@ void GroupDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) { ol.generateDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } // write separator between brief and details if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) && @@ -754,14 +782,14 @@ void GroupDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title if (!documentation().isEmpty()) { ol.generateDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } // write inbody documentation if (!inbodyDocumentation().isEmpty()) { ol.generateDoc(inbodyFile(),inbodyLine(),this,0,inbodyDocumentation()+"\n",TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } } } @@ -772,7 +800,7 @@ void GroupDefImpl::writeBriefDescription(OutputList &ol) { DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0, briefDescription(),TRUE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); if (rootNode && !rootNode->isEmpty()) { ol.startParagraph(); @@ -789,7 +817,7 @@ void GroupDefImpl::writeBriefDescription(OutputList &ol) if (hasDetailedDescription()) { ol.disableAllBut(OutputGenerator::Html); - ol.startTextLink(0,"details"); + ol.startTextLink(QCString(),"details"); ol.parseText(theTranslator->trMore()); ol.endTextLink(); } @@ -808,7 +836,7 @@ void GroupDefImpl::writeGroupGraph(OutputList &ol) DotGroupCollaboration graph(this); if (!graph.isTrivial()) { - msg("Generating dependency graph for group %s\n",qualifiedName().data()); + msg("Generating dependency graph for group %s\n",qPrint(qualifiedName())); ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); //ol.startParagraph(); @@ -837,16 +865,16 @@ void GroupDefImpl::writeFiles(OutputList &ol,const QCString &title) ol.startMemberItem(fd->getOutputFileBase(),0); ol.docify(theTranslator->trFile(FALSE,TRUE)+" "); ol.insertMemberAlign(); - ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,fd->name()); + ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),QCString(),fd->name()); ol.endMemberItem(); if (!fd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { ol.startMemberDescription(fd->getOutputFileBase()); ol.generateDoc(briefFile(),briefLine(),fd,0,fd->briefDescription(),FALSE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberDescription(); } - ol.endMemberDeclaration(0,0); + ol.endMemberDeclaration(QCString(),QCString()); } ol.endMemberList(); } @@ -882,16 +910,16 @@ void GroupDefImpl::writeNestedGroups(OutputList &ol,const QCString &title) //ol.docify(theTranslator->trGroup(FALSE,TRUE)); //ol.docify(" "); ol.insertMemberAlign(); - ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),0,gd->groupTitle()); + ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),QCString(),gd->groupTitle()); ol.endMemberItem(); if (!gd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { ol.startMemberDescription(gd->getOutputFileBase()); ol.generateDoc(briefFile(),briefLine(),gd,0,gd->briefDescription(),FALSE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberDescription(); } - ol.endMemberDeclaration(0,0); + ol.endMemberDeclaration(QCString(),QCString()); } } ol.endMemberList(); @@ -914,16 +942,16 @@ void GroupDefImpl::writeDirs(OutputList &ol,const QCString &title) ol.startMemberItem(dd->getOutputFileBase(),0); ol.parseText(theTranslator->trDir(FALSE,TRUE)); ol.insertMemberAlign(); - ol.writeObjectLink(dd->getReference(),dd->getOutputFileBase(),0,dd->shortName()); + ol.writeObjectLink(dd->getReference(),dd->getOutputFileBase(),QCString(),dd->shortName()); ol.endMemberItem(); if (!dd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { ol.startMemberDescription(dd->getOutputFileBase()); ol.generateDoc(briefFile(),briefLine(),dd,0,dd->briefDescription(),FALSE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberDescription(); } - ol.endMemberDeclaration(0,0); + ol.endMemberDeclaration(QCString(),QCString()); } ol.endMemberList(); @@ -936,6 +964,12 @@ void GroupDefImpl::writeClasses(OutputList &ol,const QCString &title) m_classes.writeDeclaration(ol,0,title,FALSE); } +void GroupDefImpl::writeConcepts(OutputList &ol,const QCString &title) +{ + // write list of concepts + m_concepts.writeDeclaration(ol,title,FALSE); +} + void GroupDefImpl::writeInlineClasses(OutputList &ol) { m_classes.writeDocumentation(ol); @@ -956,8 +990,8 @@ void GroupDefImpl::writePageDocumentation(OutputList &ol) ol.endSection(si->label(),SectionType::Subsection); } ol.startTextBlock(); - ol.generateDoc(pd->docFile(),pd->docLine(),pd,0,pd->documentation()+pd->inbodyDocumentation(),TRUE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + ol.generateDoc(pd->docFile(),pd->docLine(),pd,0,(pd->documentation()+pd->inbodyDocumentation()),TRUE,FALSE, + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endTextBlock(); } } @@ -1023,20 +1057,22 @@ void GroupDefImpl::writeSummaryLinks(OutputList &ol) const SrcLangExt lang = getLanguage(); for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Group)) { - if ((lde->kind()==LayoutDocEntry::GroupClasses && m_classes.declVisible()) || - (lde->kind()==LayoutDocEntry::GroupNamespaces && m_namespaces.declVisible()) || - (lde->kind()==LayoutDocEntry::GroupFiles && !m_fileList.empty()) || + if ((lde->kind()==LayoutDocEntry::GroupClasses && m_classes.declVisible()) || + (lde->kind()==LayoutDocEntry::GroupConcepts && m_concepts.declVisible()) || + (lde->kind()==LayoutDocEntry::GroupNamespaces && m_namespaces.declVisible()) || + (lde->kind()==LayoutDocEntry::GroupFiles && !m_fileList.empty()) || (lde->kind()==LayoutDocEntry::GroupNestedGroups && !m_groups.empty()) || - (lde->kind()==LayoutDocEntry::GroupDirs && !m_dirList.empty()) + (lde->kind()==LayoutDocEntry::GroupDirs && !m_dirList.empty()) ) { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = lde->kind()==LayoutDocEntry::GroupClasses ? "nested-classes" : + lde->kind()==LayoutDocEntry::GroupConcepts ? "concepts" : lde->kind()==LayoutDocEntry::GroupNamespaces ? "namespaces" : lde->kind()==LayoutDocEntry::GroupFiles ? "files" : lde->kind()==LayoutDocEntry::GroupNestedGroups ? "groups" : "dirs"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::MemberDecl) @@ -1045,7 +1081,7 @@ void GroupDefImpl::writeSummaryLinks(OutputList &ol) const MemberList * ml = getMemberList(lmd->type); if (ml && ml->declVisible()) { - ol.writeSummaryLink(0,MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first); + ol.writeSummaryLink(QCString(),MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first); first=FALSE; } } @@ -1102,7 +1138,7 @@ void GroupDefImpl::writeDocumentation(OutputList &ol) } } - Doxygen::indexList->addIndexItem(this,0,0,m_title); + Doxygen::indexList->addIndexItem(this,0,QCString(),m_title); //---------------------------------------- start flexible part ------------------------------- @@ -1123,6 +1159,12 @@ void GroupDefImpl::writeDocumentation(OutputList &ol) writeClasses(ol,ls->title(lang)); } break; + case LayoutDocEntry::GroupConcepts: + { + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); + writeConcepts(ol,ls->title(lang)); + } + break; case LayoutDocEntry::GroupInlineClasses: { writeInlineClasses(ol); @@ -1201,11 +1243,14 @@ void GroupDefImpl::writeDocumentation(OutputList &ol) case LayoutDocEntry::NamespaceNestedNamespaces: case LayoutDocEntry::NamespaceNestedConstantGroups: case LayoutDocEntry::NamespaceClasses: + case LayoutDocEntry::NamespaceConcepts: case LayoutDocEntry::NamespaceInterfaces: case LayoutDocEntry::NamespaceStructs: case LayoutDocEntry::NamespaceExceptions: case LayoutDocEntry::NamespaceInlineClasses: + case LayoutDocEntry::ConceptDefinition: case LayoutDocEntry::FileClasses: + case LayoutDocEntry::FileConcepts: case LayoutDocEntry::FileInterfaces: case LayoutDocEntry::FileStructs: case LayoutDocEntry::FileExceptions: @@ -1307,18 +1352,36 @@ void addClassToGroups(const Entry *root,ClassDef *cd) { cdm->makePartOfGroup(gd); } - //printf("Compound %s: in group %s\n",cd->name().data(),gd->groupTitle()); + //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle()); } } } +void addConceptToGroups(const Entry *root,ConceptDef *cd) +{ + for (const Grouping &g : root->groups) + { + GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname); + if (gd && gd->addConcept(cd)) + { + ConceptDefMutable *cdm = toConceptDefMutable(cd); + if (cdm) + { + cdm->makePartOfGroup(gd); + } + //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle()); + } + } +} + + void addNamespaceToGroups(const Entry *root,NamespaceDef *nd) { //printf("root->groups.size()=%zu\n",root->groups.size()); for (const Grouping &g : root->groups) { GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname); - //printf("group '%s' gd=%p\n",g.groupname.data(),(void*)gd); + //printf("group '%s' gd=%p\n",qPrint(g.groupname),(void*)gd); if (gd && gd->addNamespace(nd)) { NamespaceDefMutable *ndm = toNamespaceDefMutable(nd); @@ -1326,7 +1389,7 @@ void addNamespaceToGroups(const Entry *root,NamespaceDef *nd) { ndm->makePartOfGroup(gd); } - //printf("Namespace %s: in group %s\n",nd->name().data(),s->data()); + //printf("Namespace %s: in group %s\n",qPrint(nd->name()),qPrint(gd->name())); } } } @@ -1337,19 +1400,19 @@ void addDirToGroups(const Entry *root,DirDef *dd) for (const Grouping &g : root->groups) { GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname); - //printf("group '%s'\n",g->groupname.data()); + //printf("group '%s'\n",qPrint(g->groupname)); if (gd) { gd->addDir(dd); dd->makePartOfGroup(gd); - //printf("Dir %s: in group %s\n",dd->name().data(),g->groupname.data()); + //printf("Dir %s: in group %s\n",qPrint(dd->name()),qPrint(g->groupname)); } } } void addGroupToGroups(const Entry *root,GroupDef *subGroup) { - //printf("addGroupToGroups for %s groups=%d\n",root->name.data(),root->groups.size()); + //printf("addGroupToGroups for %s groups=%d\n",qPrint(root->name),root->groups.size()); for (const Grouping &g : root->groups) { GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname); @@ -1358,12 +1421,12 @@ void addGroupToGroups(const Entry *root,GroupDef *subGroup) if (gd==subGroup) { warn(root->fileName,root->startLine,"Refusing to add group %s to itself", - gd->name().data()); + qPrint(gd->name())); } else if (subGroup->findGroup(gd)) { warn(root->fileName,root->startLine,"Refusing to add group %s to group %s, since the latter is already a " - "subgroup of the former\n", subGroup->name().data(),gd->name().data()); + "subgroup of the former\n", qPrint(subGroup->name()),qPrint(gd->name())); } else if (!gd->findGroup(subGroup)) { @@ -1378,7 +1441,7 @@ void addGroupToGroups(const Entry *root,GroupDef *subGroup) void addMemberToGroups(const Entry *root,MemberDef *md) { //printf("addMemberToGroups: Root %p = %s, md %p=%s groups=%zu\n", - // root, root->name.data(), md, md->name().data(), root->groups.size() ); + // root, qPrint(root->name), md, qPrint(md->name()), root->groups.size() ); // Search entry's group list for group with highest pri. Grouping::GroupPri_t pri = Grouping::GROUPING_LOWEST; @@ -1392,11 +1455,11 @@ void addMemberToGroups(const Entry *root,MemberDef *md) { if (fgd && gd!=fgd && g.pri==pri) { - warn(root->fileName.data(), root->startLine, + warn(root->fileName, root->startLine, "Member %s found in multiple %s groups! " "The member will be put in group %s, and not in group %s", - md->name().data(), Grouping::getGroupPriName( pri ), - gd->name().data(), fgd->name().data() + qPrint(md->name()), Grouping::getGroupPriName( pri ), + qPrint(gd->name()), qPrint(fgd->name()) ); } @@ -1440,10 +1503,10 @@ void addMemberToGroups(const Entry *root,MemberDef *md) warn(md->getGroupFileName(),md->getGroupStartLine(), "Member documentation for %s found several times in %s groups!\n" "%s:%d: The member will remain in group %s, and won't be put into group %s", - md->name().data(), Grouping::getGroupPriName( pri ), - root->fileName.data(), root->startLine, - mgd->name().data(), - fgd->name().data() + qPrint(md->name()), Grouping::getGroupPriName( pri ), + qPrint(root->fileName), root->startLine, + qPrint(mgd->name()), + qPrint(fgd->name()) ); } } @@ -1460,8 +1523,8 @@ void addMemberToGroups(const Entry *root,MemberDef *md) if (insertit) { //printf("insertMember found at %s line %d: %s: related %s\n", - // md->getDefFileName().data(),md->getDefLine(), - // md->name().data(),root->relates.data()); + // qPrint(md->getDefFileName()),md->getDefLine(), + // qPrint(md->name()),qPrint(root->relates)); bool success = fgd->insertMember(md); if (success) { @@ -1491,7 +1554,7 @@ void addExampleToGroups(const Entry *root,PageDef *eg) { gd->addExample(eg); eg->makePartOfGroup(gd); - //printf("Example %s: in group %s\n",eg->name().data(),s->data()); + //printf("Example %s: in group %s\n",qPrint(eg->name()),s->data()); } } } @@ -1509,7 +1572,7 @@ void GroupDefImpl::addListReferences() getOutputFileBase(), theTranslator->trGroup(TRUE,TRUE), getOutputFileBase(),name(), - 0, + QCString(), 0 ); } @@ -1654,7 +1717,7 @@ void GroupDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,cons } if (ml) { - ml->writeDeclarations(ol,0,0,0,this,title,0); + ml->writeDeclarations(ol,0,0,0,this,title,QCString()); } } @@ -1675,7 +1738,7 @@ void GroupDefImpl::sortSubGroups() std::sort(m_groups.begin(), m_groups.end(), [](const auto &g1,const auto &g2) - { return qstrcmp(g1->groupTitle(),g2->groupTitle())<0; }); + { return g1->groupTitle() < g2->groupTitle(); }); } bool GroupDefImpl::isLinkableInProject() const diff --git a/src/groupdef.h b/src/groupdef.h index 2d0dafc..587c709 100644 --- a/src/groupdef.h +++ b/src/groupdef.h @@ -30,9 +30,11 @@ class MemberList; class MemberLists; class FileList; class ClassLinkedRefMap; +class ConceptLinkedRefMap; class NamespaceLinkedRefMap; class FileDef; class ClassDef; +class ConceptDef; class NamespaceDef; class GroupList; class OutputList; @@ -53,11 +55,12 @@ class GroupDef : public DefinitionMutable, public Definition virtual QCString getOutputFileBase() const = 0; virtual QCString anchor() const = 0; virtual QCString displayName(bool=TRUE) const = 0; - virtual const char *groupTitle() const = 0; - virtual void setGroupTitle( const char *newtitle ) = 0; + virtual QCString groupTitle() const = 0; + virtual void setGroupTitle( const QCString &newtitle ) = 0; virtual bool hasGroupTitle( ) const = 0; virtual void addFile(const FileDef *def) = 0; virtual bool addClass(const ClassDef *def) = 0; + virtual bool addConcept(const ConceptDef *def) = 0; virtual bool addNamespace(const NamespaceDef *def) = 0; virtual void addGroup(const GroupDef *def) = 0; virtual void addPage(const PageDef *def) = 0; @@ -69,7 +72,7 @@ class GroupDef : public DefinitionMutable, public Definition virtual void writeDocumentation(OutputList &ol) = 0; virtual void writeMemberPages(OutputList &ol) = 0; virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const = 0; - virtual void writeTagFile(std::ostream &) = 0; + virtual void writeTagFile(TextStream &) = 0; virtual size_t numDocMembers() const = 0; virtual bool isLinkableInProject() const = 0; virtual bool isLinkable() const = 0; @@ -96,6 +99,7 @@ class GroupDef : public DefinitionMutable, public Definition virtual const FileList &getFiles() const = 0; virtual const ClassLinkedRefMap &getClasses() const = 0; + virtual const ConceptLinkedRefMap &getConcepts() const = 0; virtual const NamespaceLinkedRefMap &getNamespaces() const = 0; virtual const GroupList &getSubGroups() const = 0; virtual const PageLinkedRefMap &getPages() const = 0; @@ -106,8 +110,8 @@ class GroupDef : public DefinitionMutable, public Definition }; -GroupDef *createGroupDef(const char *fileName,int line,const char *name, - const char *title,const char *refFileName=0); +GroupDef *createGroupDef(const QCString &fileName,int line,const QCString &name, + const QCString &title,const QCString &refFileName=QCString()); // --- Cast functions @@ -125,6 +129,7 @@ class GroupList : public std::vector<const GroupDef *> }; void addClassToGroups (const Entry *root,ClassDef *cd); +void addConceptToGroups (const Entry *root,ConceptDef *cd); void addNamespaceToGroups(const Entry *root,NamespaceDef *nd); void addGroupToGroups (const Entry *root,GroupDef *subGroup); void addMemberToGroups (const Entry *root,MemberDef *md); diff --git a/src/growbuf.h b/src/growbuf.h index bb26404..8c532ca 100644 --- a/src/growbuf.h +++ b/src/growbuf.h @@ -5,7 +5,7 @@ #include <string.h> #include <string> -#define GROW_AMOUNT 1024 +#define GROW_AMOUNT 1024*4 /** Class representing a string buffer optimised for growing. */ class GrowBuf @@ -14,6 +14,37 @@ class GrowBuf GrowBuf() : m_str(0), m_pos(0), m_len(0) {} GrowBuf(uint initialSize) : m_pos(0), m_len(initialSize) { m_str=(char*)malloc(m_len); } ~GrowBuf() { free(m_str); } + GrowBuf(const GrowBuf &other) + { + m_len = other.m_len; + m_pos = other.m_pos; + m_str = (char*)malloc(m_len); + memcpy(m_str,other.m_str,m_len); + } + GrowBuf &operator=(const GrowBuf &other) + { + if (this!=&other) + { + m_len = other.m_len; + m_pos = other.m_pos; + m_str = (char*)malloc(m_len); + memcpy(m_str,other.m_str,m_len); + } + return *this; + } + GrowBuf(GrowBuf &&other) + { + m_len = std::move(other.m_len); + m_pos = std::move(other.m_pos); + m_str = std::move(other.m_str); + } + GrowBuf &operator=(GrowBuf &&other) + { + m_len = std::move(other.m_len); + m_pos = std::move(other.m_pos); + m_str = std::move(other.m_str); + return *this; + } void reserve(uint size) { if (m_len<size) { m_len = size; m_str = (char*)realloc(m_str,m_len); } } void clear() { m_pos=0; } void addChar(char c) { if (m_pos>=m_len) { m_len+=GROW_AMOUNT; m_str = (char*)realloc(m_str,m_len); } @@ -56,10 +87,12 @@ class GrowBuf m_pos+=l; } } - const char *get() { return m_str; } + char *get() { return m_str; } + const char *get() const { return m_str; } uint getPos() const { return m_pos; } void setPos(uint newPos) { m_pos = newPos; } char at(uint i) const { return m_str[i]; } + bool empty() const { return m_pos==0; } private: char *m_str; uint m_pos; diff --git a/src/htags.cpp b/src/htags.cpp index e59e7c8..cb7b99c 100644 --- a/src/htags.cpp +++ b/src/htags.cpp @@ -87,7 +87,7 @@ bool Htags::execute(const QCString &htmldir) commandLine += " \"" + htmldir + "\""; std::string oldDir = Dir::currentDirPath(); Dir::setCurrent(g_inputDir.absPath()); - //printf("CommandLine=[%s]\n",commandLine.data()); + //printf("CommandLine=[%s]\n",qPrint(commandLine)); Portable::sysTimerStart(); bool result=Portable::system("htags",commandLine,FALSE)==0; if (!result) @@ -128,8 +128,8 @@ bool Htags::loadFilemap(const QCString &htmlDir) std::string lineStr; while (getline(f,lineStr)) { - QCString line = lineStr; - //printf("Read line: %s",line.data()); + QCString line(lineStr); + //printf("Read line: %s",qPrint(line)); int sep = line.find('\t'); if (sep!=-1) { @@ -138,14 +138,14 @@ bool Htags::loadFilemap(const QCString &htmlDir) int ext=value.findRev('.'); if (ext!=-1) value=value.left(ext); // strip extension g_symbolMap.insert(std::make_pair(key.str(),value.str())); - //printf("Key/Value=(%s,%s)\n",key.data(),value.data()); + //printf("Key/Value=(%s,%s)\n",qPrint(key),qPrint(value)); } } return true; } else { - err("file %s cannot be opened\n",fileMapName.data()); + err("file %s cannot be opened\n",qPrint(fileMapName)); } } return false; @@ -167,10 +167,10 @@ QCString Htags::path2URL(const QCString &path) if (!symName.isEmpty()) { auto it = g_symbolMap.find(symName.str()); - //printf("path2URL=%s symName=%s result=%p\n",path.data(),symName.data(),result); + //printf("path2URL=%s symName=%s result=%p\n",qPrint(path),qPrint(symName),result); if (it!=g_symbolMap.end()) { - url = QCString("HTML/") + it->second; + url = QCString("HTML/"+it->second); } } return url; diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 73939a0..a11d045 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -264,7 +264,7 @@ static QCString htmlAttribsToString(const HtmlAttribList &attribs, QCString *pAl //------------------------------------------------------------------------- -HtmlDocVisitor::HtmlDocVisitor(std::ostream &t,CodeOutputInterface &ci, +HtmlDocVisitor::HtmlDocVisitor(TextStream &t,CodeOutputInterface &ci, const Definition *ctx) : DocVisitor(DocVisitor_Html), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_ctx(ctx) @@ -278,7 +278,7 @@ HtmlDocVisitor::HtmlDocVisitor(std::ostream &t,CodeOutputInterface &ci, void HtmlDocVisitor::visit(DocWord *w) { - //printf("word: %s\n",w->word().data()); + //printf("word: %s\n",qPrint(w->word())); if (m_hide) return; filter(w->word()); } @@ -286,7 +286,7 @@ void HtmlDocVisitor::visit(DocWord *w) void HtmlDocVisitor::visit(DocLinkedWord *w) { if (m_hide) return; - //printf("linked word: %s\n",w->word().data()); + //printf("linked word: %s\n",qPrint(w->word())); startLink(w->ref(),w->file(),w->relPath(),w->anchor(),w->tooltip()); filter(w->word()); endLink(); @@ -471,7 +471,7 @@ void HtmlDocVisitor::visit(DocStyleChange *s) } -static void visitPreCaption(std::ostream &t, DocVerbatim *s) +static void visitPreCaption(TextStream &t, DocVerbatim *s) { if (s->hasCaption()) { @@ -480,7 +480,7 @@ static void visitPreCaption(std::ostream &t, DocVerbatim *s) } -static void visitPostCaption(std::ostream &t, DocVerbatim *s) +static void visitPostCaption(TextStream &t, DocVerbatim *s) { if (s->hasCaption()) { @@ -554,14 +554,14 @@ void HtmlDocVisitor::visit(DocVerbatim *s) forceEndParagraph(s); fileName.sprintf("%s%d%s", - (Config_getString(HTML_OUTPUT)+"/inline_dotgraph_").data(), + qPrint(Config_getString(HTML_OUTPUT)+"/inline_dotgraph_"), dotindex++, ".dot" ); std::ofstream file(fileName.str(),std::ofstream::out | std::ofstream::binary); if (!file.is_open()) { - err("Could not open file %s for writing\n",fileName.data()); + err("Could not open file %s for writing\n",qPrint(fileName)); } else { @@ -589,13 +589,13 @@ void HtmlDocVisitor::visit(DocVerbatim *s) QCString baseName(4096); baseName.sprintf("%s%d", - (Config_getString(HTML_OUTPUT)+"/inline_mscgraph_").data(), + qPrint(Config_getString(HTML_OUTPUT)+"/inline_mscgraph_"), mscindex++ ); std::ofstream file(baseName.str()+".msc",std::ofstream::out | std::ofstream::binary); if (!file.is_open()) { - err("Could not open file %s.msc for writing\n",baseName.data()); + err("Could not open file %s.msc for writing\n",qPrint(baseName)); } else { @@ -778,7 +778,7 @@ void HtmlDocVisitor::visit(DocInclude *inc) void HtmlDocVisitor::visit(DocIncOperator *op) { //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n", - // op->type(),op->isFirst(),op->isLast(),op->text().data()); + // op->type(),op->isFirst(),op->isLast(),qPrint(op->text())); if (op->isFirst()) { forceEndParagraph(op); @@ -902,9 +902,9 @@ void HtmlDocVisitor::visit(DocIndexEntry *e) } m_t << "<a name=\"" << anchor << "\"></a>"; //printf("*** DocIndexEntry: word='%s' scope='%s' member='%s'\n", - // e->entry().data(), - // e->scope() ? e->scope()->name().data() : "<null>", - // e->member() ? e->member()->name().data() : "<null>" + // qPrint(e->entry()), + // e->scope() ? qPrint(e->scope()->name()) : "<null>", + // e->member() ? qPrint(e->member()->name()) : "<null>" // ); Doxygen::indexList->addIndexItem(e->scope(),e->member(),anchor,e->entry()); } @@ -1438,7 +1438,7 @@ void HtmlDocVisitor::visitPre(DocSection *s) m_t << "<h" << s->level() << ">"; m_t << "<a class=\"anchor\" id=\"" << s->anchor(); m_t << "\"></a>\n"; - filter(convertCharEntitiesToUTF8(s->title().data())); + filter(convertCharEntitiesToUTF8(s->title())); m_t << "</h" << s->level() << ">\n"; } @@ -2054,7 +2054,7 @@ void HtmlDocVisitor::visitPost(DocXRefItem *x) void HtmlDocVisitor::visitPre(DocInternalRef *ref) { if (m_hide) return; - startLink(0,ref->file(),ref->relPath(),ref->anchor()); + startLink(QCString(),ref->file(),ref->relPath(),ref->anchor()); } void HtmlDocVisitor::visitPost(DocInternalRef *) @@ -2097,9 +2097,9 @@ void HtmlDocVisitor::visitPre(DocVhdlFlow *vf) m_t << "<p>"; m_t << "flowchart: " ; // TODO: translate me m_t << "<a href=\""; - m_t << fname.data(); + m_t << fname; m_t << ".svg\">"; - m_t << VhdlDocGen::getFlowMember()->name().data(); + m_t << VhdlDocGen::getFlowMember()->name(); m_t << "</a>"; if (vf->hasCaption()) { @@ -2130,10 +2130,10 @@ void HtmlDocVisitor::visitPost(DocParBlock *) -void HtmlDocVisitor::filter(const char *str) +void HtmlDocVisitor::filter(const QCString &str) { - if (str==0) return; - const char *p=str; + if (str.isEmpty()) return; + const char *p=str.data(); char c; while (*p) { @@ -2167,10 +2167,10 @@ void HtmlDocVisitor::filter(const char *str) /// Escape basic entities to produce a valid CDATA attribute value, /// assume that the outer quoting will be using the double quote " -void HtmlDocVisitor::filterQuotedCdataAttr(const char* str) +void HtmlDocVisitor::filterQuotedCdataAttr(const QCString &str) { - if (str==0) return; - const char *p=str; + if (str.isEmpty()) return; + const char *p=str.data(); char c; while (*p) { @@ -2207,7 +2207,7 @@ void HtmlDocVisitor::startLink(const QCString &ref,const QCString &file, const QCString &relPath,const QCString &anchor, const QCString &tooltip) { - //printf("HtmlDocVisitor: file=%s anchor=%s\n",file.data(),anchor.data()); + //printf("HtmlDocVisitor: file=%s anchor=%s\n",qPrint(file),qPrint(anchor)); if (!ref.isEmpty()) // link to entity imported via tag file { m_t << "<a class=\"elRef\" "; @@ -2378,7 +2378,7 @@ void HtmlDocVisitor::forceEndParagraph(DocNode *n) const DocNodeList &children = para->children(); auto it = std::find_if(children.begin(),children.end(),[n](const auto &np) { return np.get()==n; }); if (it==children.end()) return; - int nodeIndex = it - children.begin(); + int nodeIndex = static_cast<int>(it - children.begin()); nodeIndex--; if (nodeIndex<0) return; // first node in paragraph while (nodeIndex>=0 && isInvisibleNode(children.at(nodeIndex).get())) @@ -2414,7 +2414,7 @@ void HtmlDocVisitor::forceStartParagraph(DocNode *n) const DocNodeList &children = para->children(); auto it = std::find_if(children.begin(),children.end(),[n](const auto &np) { return np.get()==n; }); if (it==children.end()) return; - int nodeIndex = it - children.begin(); + int nodeIndex = static_cast<int>(it - children.begin()); int numNodes = static_cast<int>(para->children().size()); bool styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,nodeIndex); if (styleOutsideParagraph) return; diff --git a/src/htmldocvisitor.h b/src/htmldocvisitor.h index 3e157d2..287088d 100644 --- a/src/htmldocvisitor.h +++ b/src/htmldocvisitor.h @@ -23,12 +23,13 @@ class Definition; class MemberDef; class DocNode; class CodeOutputInterface; +class TextStream; /*! @brief Concrete visitor implementation for HTML output. */ class HtmlDocVisitor : public DocVisitor { public: - HtmlDocVisitor(std::ostream &t,CodeOutputInterface &ci,const Definition *ctx); + HtmlDocVisitor(TextStream &t,CodeOutputInterface &ci,const Definition *ctx); //-------------------------------------- // visitor functions for leaf nodes @@ -138,8 +139,8 @@ class HtmlDocVisitor : public DocVisitor //-------------------------------------- void writeObfuscatedMailAddress(const QCString &url); - void filter(const char *str); - void filterQuotedCdataAttr(const char* str); + void filter(const QCString &str); + void filterQuotedCdataAttr(const QCString &str); void startLink(const QCString &ref,const QCString &file, const QCString &relPath,const QCString &anchor, const QCString &tooltip = ""); @@ -156,7 +157,7 @@ class HtmlDocVisitor : public DocVisitor // state variables //-------------------------------------- - std::ostream &m_t; + TextStream &m_t; CodeOutputInterface &m_ci; bool m_insidePre; bool m_hide; diff --git a/src/htmlentity.cpp b/src/htmlentity.cpp index f5ddd6f..8f2eb78 100644 --- a/src/htmlentity.cpp +++ b/src/htmlentity.cpp @@ -15,6 +15,7 @@ #include "htmlentity.h" #include "message.h" +#include "textstream.h" //! Number of doxygen commands mapped as if it were HTML entities static const int g_numberHtmlMappedCmds = 11; @@ -473,7 +474,7 @@ DocSymbol::SymType HtmlEntityMapper::name2sym(const QCString &symName) const return it!=m_name2sym.end() ? it->second : DocSymbol::Sym_Unknown; } -void HtmlEntityMapper::writeXMLSchema(std::ostream &t) +void HtmlEntityMapper::writeXMLSchema(TextStream &t) { for (int i=0;i<g_numHtmlEntities - g_numberHtmlMappedCmds;i++) { diff --git a/src/htmlentity.h b/src/htmlentity.h index 7d0a822..cbdc0a1 100644 --- a/src/htmlentity.h +++ b/src/htmlentity.h @@ -17,10 +17,11 @@ #include <unordered_map> #include <string> -#include <iostream> #include "docparser.h" +class TextStream; + /** @brief Singleton helper class to map html entities to other formats */ class HtmlEntityMapper { @@ -36,7 +37,7 @@ class HtmlEntityMapper const char *man(DocSymbol::SymType symb) const; const char *rtf(DocSymbol::SymType symb) const; const DocSymbol::PerlSymb *perl(DocSymbol::SymType symb) const; - void writeXMLSchema(std::ostream &t); + void writeXMLSchema(TextStream &t); private: void validate(); HtmlEntityMapper(); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index be7071c..ea20707 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -52,6 +52,7 @@ #include "fileinfo.h" #include "dir.h" #include "utf8.h" +#include "textstream.h" //#define DBG_HTML(x) x; #define DBG_HTML(x) @@ -64,12 +65,11 @@ static const char *hex="0123456789ABCDEF"; // note: this is only active if DISABLE_INDEX=YES, if DISABLE_INDEX is disabled, this // part will be rendered inside menu.js -static void writeClientSearchBox(std::ostream &t,const char *relPath) +static void writeClientSearchBox(TextStream &t,const QCString &relPath) { - const char *rp = relPath ? relPath : ""; t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n"; t << " <span class=\"left\">\n"; - t << " <img id=\"MSearchSelect\" src=\"" << rp << "search/mag_sel.svg\"\n"; + t << " <img id=\"MSearchSelect\" src=\"" << relPath << "search/mag_sel.svg\"\n"; t << " onmouseover=\"return searchBox.OnSearchSelectShow()\"\n"; t << " onmouseout=\"return searchBox.OnSearchSelectHide()\"\n"; t << " alt=\"\"/>\n"; @@ -80,20 +80,19 @@ static void writeClientSearchBox(std::ostream &t,const char *relPath) t << " onkeyup=\"searchBox.OnSearchFieldChange(event)\"/>\n"; t << " </span><span class=\"right\">\n"; t << " <a id=\"MSearchClose\" href=\"javascript:searchBox.CloseResultsWindow()\">" - << "<img id=\"MSearchCloseImg\" border=\"0\" src=\"" << rp << "search/close.svg\" alt=\"\"/></a>\n"; + << "<img id=\"MSearchCloseImg\" border=\"0\" src=\"" << relPath << "search/close.svg\" alt=\"\"/></a>\n"; t << " </span>\n"; t << " </div>\n"; } // note: this is only active if DISABLE_INDEX=YES. if DISABLE_INDEX is disabled, this // part will be rendered inside menu.js -static void writeServerSearchBox(std::ostream &t,const char *relPath,bool highlightSearch) +static void writeServerSearchBox(TextStream &t,const QCString &relPath,bool highlightSearch) { - const char *rp = relPath ? relPath : ""; bool externalSearch = Config_getBool(EXTERNAL_SEARCH); t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n"; t << " <div class=\"left\">\n"; - t << " <form id=\"FSearchBox\" action=\"" << rp; + t << " <form id=\"FSearchBox\" action=\"" << relPath; if (externalSearch) { t << "search" << Doxygen::htmlFileExtension; @@ -103,7 +102,7 @@ static void writeServerSearchBox(std::ostream &t,const char *relPath,bool highli t << "search.php"; } t << "\" method=\"get\">\n"; - t << " <img id=\"MSearchSelect\" src=\"" << rp << "search/mag.svg\" alt=\"\"/>\n"; + t << " <img id=\"MSearchSelect\" src=\"" << relPath << "search/mag.svg\" alt=\"\"/>\n"; if (!highlightSearch) { t << " <input type=\"text\" id=\"MSearchField\" name=\"query\" value=\"" @@ -301,7 +300,7 @@ static QCString getConvertLatexMacro() static QCString getSearchBox(bool serverSide, QCString relPath, bool highlightSearch) { - std::ostringstream t(std::ios_base::ate); + TextStream t; if (serverSide) { writeServerSearchBox(t, relPath, highlightSearch); @@ -375,7 +374,8 @@ static QCString substituteHtmlKeywords(const QCString &str, if (timeStamp) { - generatedBy = theTranslator->trGeneratedAt(dateToString(TRUE), convertToHtml(Config_getString(PROJECT_NAME))); + generatedBy = theTranslator->trGeneratedAt(dateToString(TRUE), + convertToHtml(Config_getString(PROJECT_NAME))); } else { @@ -436,44 +436,109 @@ static QCString substituteHtmlKeywords(const QCString &str, if (mathJax) { + QCString mathJaxVersion = Config_getEnum(MATHJAX_VERSION); QCString path = Config_getString(MATHJAX_RELPATH); if (path.isEmpty() || path.left(2)=="..") // relative path { path.prepend(relPath); } - mathJaxJs = "<script type=\"text/x-mathjax-config\">\n" - " MathJax.Hub.Config({\n" - " extensions: [\"tex2jax.js\""; - const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS); - for (const auto &s : mathJaxExtensions) - { - mathJaxJs+= ", \""+QCString(s.c_str())+".js\""; - } - if (mathJaxFormat.isEmpty()) - { - mathJaxFormat = "HTML-CSS"; - } - mathJaxJs += "],\n" - " jax: [\"input/TeX\",\"output/"+mathJaxFormat+"\"],\n" - "});\n"; - if (!g_mathjax_code.isEmpty()) + + if (mathJaxVersion == "MathJax_3") { - mathJaxJs += g_mathjax_code; - mathJaxJs += "\n"; + mathJaxJs += "<script>\n" + " window.MathJax = {\n" + " options: {\n" + " ignoreHtmlClass: 'tex2jax_ignore',\n" + " processHtmlClass: 'tex2jax_process'\n" + " },\n"; + const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS); + if (!mathJaxExtensions.empty() || !g_latex_macro.isEmpty()) + { + mathJaxJs+= " tex: {\n" + " packages: ['base'"; + if (!g_latex_macro.isEmpty()) + { + mathJaxJs+= ",'newcommand'"; + } + for (const auto &s : mathJaxExtensions) + { + mathJaxJs+= ",'"+QCString(s.c_str())+"'"; + } + mathJaxJs += "]\n" + " },\n" + " tex: {\n" + " macros: {}\n" + " }\n"; + } + mathJaxJs += " };\n"; + mathJaxJs += "</script>\n"; + + if (!g_latex_macro.isEmpty()) + { + mathJaxJs += "<script>\n" + " Object.assign(MathJax.tex.macros, {\n"; + mathJaxJs += g_latex_macro; + mathJaxJs += "\n" + " });\n" + "</script>\n"; + } + + // MATHJAX_CODEFILE + if (!g_mathjax_code.isEmpty()) + { + mathJaxJs += "<script>\n"; + mathJaxJs += g_mathjax_code; + mathJaxJs += "\n"; + mathJaxJs += "</script>\n"; + } + + + mathJaxJs += "<script type=\"text/javascript\" id=\"MathJax-script\" async=\"async\" src=\"" + path; + if (mathJaxFormat == "chtml") + { + mathJaxJs += "es5/tex-chtml.js\"></script>\n" ; + } + else if (mathJaxFormat == "SVG") + { + mathJaxJs += "es5/tex-svg.js\"></script>\n" ; + } } - mathJaxJs += "</script>\n"; - if (!g_latex_macro.isEmpty()) + else { - mathJaxJs += "<script type=\"text/x-mathjax-config\">\n" - " MathJax.Hub.Config({\n" - " TeX: { Macros: {\n"; - mathJaxJs += g_latex_macro; - mathJaxJs += "\n" - " } }\n" - "});\n" - "</script>\n"; + mathJaxJs = "<script type=\"text/x-mathjax-config\">\n" + " MathJax.Hub.Config({\n" + " extensions: [\"tex2jax.js\""; + const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS); + for (const auto &s : mathJaxExtensions) + { + mathJaxJs+= ", \""+QCString(s.c_str())+".js\""; + } + if (mathJaxFormat.isEmpty()) + { + mathJaxFormat = "HTML-CSS"; + } + mathJaxJs += "],\n" + " jax: [\"input/TeX\",\"output/"+mathJaxFormat+"\"],\n" + "});\n"; + if (!g_mathjax_code.isEmpty()) + { + mathJaxJs += g_mathjax_code; + mathJaxJs += "\n"; + } + mathJaxJs += "</script>\n"; + if (!g_latex_macro.isEmpty()) + { + mathJaxJs += "<script type=\"text/x-mathjax-config\">\n" + " MathJax.Hub.Config({\n" + " TeX: { Macros: {\n"; + mathJaxJs += g_latex_macro; + mathJaxJs += "\n" + " } }\n" + "});\n" + "</script>\n"; + } + mathJaxJs += "<script type=\"text/javascript\" async=\"async\" src=\"" + path + "MathJax.js\"></script>\n"; } - mathJaxJs += "<script type=\"text/javascript\" async=\"async\" src=\"" + path + "MathJax.js\"></script>\n"; } // first substitute generic keywords @@ -511,20 +576,13 @@ static QCString substituteHtmlKeywords(const QCString &str, //-------------------------------------------------------------------------- -HtmlCodeGenerator::HtmlCodeGenerator() : m_t(nullptr) -{ -} - -HtmlCodeGenerator::HtmlCodeGenerator(std::ostream &t,const QCString &relPath) - : m_t(nullptr), m_relPath(relPath) +HtmlCodeGenerator::HtmlCodeGenerator(TextStream &t) : m_t(t) { - setTextStream(t); } -void HtmlCodeGenerator::setTextStream(std::ostream &t) +HtmlCodeGenerator::HtmlCodeGenerator(TextStream &t,const QCString &relPath) + : m_t(t), m_relPath(relPath) { - m_t.rdbuf(t.rdbuf()); - m_streamSet=true; } void HtmlCodeGenerator::setRelativePath(const QCString &path) @@ -532,12 +590,12 @@ void HtmlCodeGenerator::setRelativePath(const QCString &path) m_relPath = path; } -void HtmlCodeGenerator::codify(const char *str) +void HtmlCodeGenerator::codify(const QCString &str) { int tabSize = Config_getInt(TAB_SIZE); - if (str && m_streamSet) + if (!str.isEmpty()) { - const char *p=str; + const char *p=str.data(); char c; int spacesToNextTabStop; while (*p) @@ -596,13 +654,13 @@ void HtmlCodeGenerator::codify(const char *str) } } -void HtmlCodeGenerator::docify(const char *str) +void HtmlCodeGenerator::docify(const QCString &str) { //m_t << getHtmlDirEmbeddingChar(getTextDirByConfig(str)); - if (str && m_streamSet) + if (!str.isEmpty()) { - const char *p=str; + const char *p=str.data(); char c; while (*p) { @@ -643,10 +701,9 @@ void HtmlCodeGenerator::docify(const char *str) } } -void HtmlCodeGenerator::writeLineNumber(const char *ref,const char *filename, - const char *anchor,int l) +void HtmlCodeGenerator::writeLineNumber(const QCString &ref,const QCString &filename, + const QCString &anchor,int l) { - if (!m_streamSet) return; const int maxLineNrStr = 10; char lineNumber[maxLineNrStr]; char lineAnchor[maxLineNrStr]; @@ -660,9 +717,9 @@ void HtmlCodeGenerator::writeLineNumber(const char *ref,const char *filename, } m_t << "<a name=\"" << lineAnchor << "\"></a><span class=\"lineno\">"; - if (filename) + if (!filename.isEmpty()) { - _writeCodeLink("line",ref,filename,anchor,lineNumber,0); + _writeCodeLink("line",ref,filename,anchor,lineNumber,QCString()); } else { @@ -673,21 +730,20 @@ void HtmlCodeGenerator::writeLineNumber(const char *ref,const char *filename, m_col=0; } -void HtmlCodeGenerator::writeCodeLink(const char *ref,const char *f, - const char *anchor, const char *name, - const char *tooltip) +void HtmlCodeGenerator::writeCodeLink(const QCString &ref,const QCString &f, + const QCString &anchor, const QCString &name, + const QCString &tooltip) { - if (!m_streamSet) return; //printf("writeCodeLink(ref=%s,f=%s,anchor=%s,name=%s,tooltip=%s)\n",ref,f,anchor,name,tooltip); _writeCodeLink("code",ref,f,anchor,name,tooltip); } -void HtmlCodeGenerator::_writeCodeLink(const char *className, - const char *ref,const char *f, - const char *anchor, const char *name, - const char *tooltip) +void HtmlCodeGenerator::_writeCodeLink(const QCString &className, + const QCString &ref,const QCString &f, + const QCString &anchor, const QCString &name, + const QCString &tooltip) { - if (ref) + if (!ref.isEmpty()) { m_t << "<a class=\"" << className << "Ref\" "; m_t << externalLinkTarget(); @@ -698,18 +754,18 @@ void HtmlCodeGenerator::_writeCodeLink(const char *className, } m_t << "href=\""; m_t << externalRef(m_relPath,ref,TRUE); - if (f) m_t << addHtmlExtensionIfMissing(f); - if (anchor) m_t << "#" << anchor; + if (!f.isEmpty()) m_t << addHtmlExtensionIfMissing(f); + if (!anchor.isEmpty()) m_t << "#" << anchor; m_t << "\""; - if (tooltip) m_t << " title=\"" << convertToHtml(tooltip) << "\""; + if (!tooltip.isEmpty()) m_t << " title=\"" << convertToHtml(tooltip) << "\""; m_t << ">"; docify(name); m_t << "</a>"; - m_col+=qstrlen(name); + m_col+=name.length(); } -void HtmlCodeGenerator::writeTooltip(const char *id, const DocLinkInfo &docInfo, - const char *decl, const char *desc, +void HtmlCodeGenerator::writeTooltip(const QCString &id, const DocLinkInfo &docInfo, + const QCString &decl, const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo) { @@ -732,13 +788,13 @@ void HtmlCodeGenerator::writeTooltip(const char *id, const DocLinkInfo &docInfo, m_t << "</a>"; } m_t << "</div>"; - if (decl) + if (!decl.isEmpty()) { m_t << "<div class=\"ttdeci\">"; docify(decl); m_t << "</div>"; } - if (desc) + if (!desc.isEmpty()) { m_t << "<div class=\"ttdoc\">"; docify(desc); @@ -792,70 +848,64 @@ void HtmlCodeGenerator::writeTooltip(const char *id, const DocLinkInfo &docInfo, void HtmlCodeGenerator::startCodeLine(bool) { - if (m_streamSet) + m_col=0; + if (!m_lineOpen) { - m_col=0; - if (!m_lineOpen) - { - m_t << "<div class=\"line\">"; - m_lineOpen = TRUE; - } + m_t << "<div class=\"line\">"; + m_lineOpen = TRUE; } } void HtmlCodeGenerator::endCodeLine() { - if (m_streamSet) + if (m_col == 0) { - if (m_col == 0) - { - m_t << " "; - m_col++; - } - if (m_lineOpen) - { - m_t << "</div>\n"; - m_lineOpen = FALSE; - } + m_t << " "; + m_col++; + } + if (m_lineOpen) + { + m_t << "</div>\n"; + m_lineOpen = FALSE; } } -void HtmlCodeGenerator::startFontClass(const char *s) +void HtmlCodeGenerator::startFontClass(const QCString &s) { - if (m_streamSet) m_t << "<span class=\"" << s << "\">"; + m_t << "<span class=\"" << s << "\">"; } void HtmlCodeGenerator::endFontClass() { - if (m_streamSet) m_t << "</span>"; + m_t << "</span>"; } -void HtmlCodeGenerator::writeCodeAnchor(const char *anchor) +void HtmlCodeGenerator::writeCodeAnchor(const QCString &anchor) { - if (m_streamSet) m_t << "<a name=\"" << anchor << "\"></a>"; + m_t << "<a name=\"" << anchor << "\"></a>"; } -void HtmlCodeGenerator::startCodeFragment(const char *) +void HtmlCodeGenerator::startCodeFragment(const QCString &) { - if (m_streamSet) m_t << "<div class=\"fragment\">"; + m_t << "<div class=\"fragment\">"; } -void HtmlCodeGenerator::endCodeFragment(const char *) +void HtmlCodeGenerator::endCodeFragment(const QCString &) { //endCodeLine checks is there is still an open code line, if so closes it. endCodeLine(); - if (m_streamSet) m_t << "</div><!-- fragment -->"; + m_t << "</div><!-- fragment -->"; } //-------------------------------------------------------------------------- -HtmlGenerator::HtmlGenerator() : OutputGenerator(Config_getString(HTML_OUTPUT)) +HtmlGenerator::HtmlGenerator() : OutputGenerator(Config_getString(HTML_OUTPUT)), m_codeGen(m_t) { } -HtmlGenerator::HtmlGenerator(const HtmlGenerator &og) : OutputGenerator(og) +HtmlGenerator::HtmlGenerator(const HtmlGenerator &og) : OutputGenerator(og), m_codeGen(og.m_codeGen) { } @@ -882,13 +932,13 @@ void HtmlGenerator::init() Dir d(dname.str()); if (!d.exists() && !d.mkdir(dname.str())) { - term("Could not create output directory %s\n",dname.data()); + term("Could not create output directory %s\n",qPrint(dname)); } //writeLogo(dname); if (!Config_getString(HTML_HEADER).isEmpty()) { g_header=fileToString(Config_getString(HTML_HEADER)); - //printf("g_header='%s'\n",g_header.data()); + //printf("g_header='%s'\n",qPrint(g_header)); } else { @@ -898,7 +948,7 @@ void HtmlGenerator::init() if (!Config_getString(HTML_FOOTER).isEmpty()) { g_footer=fileToString(Config_getString(HTML_FOOTER)); - //printf("g_footer='%s'\n",g_footer.data()); + //printf("g_footer='%s'\n",qPrint(g_footer)); } else { @@ -910,10 +960,10 @@ void HtmlGenerator::init() if (!Config_getString(MATHJAX_CODEFILE).isEmpty()) { g_mathjax_code=fileToString(Config_getString(MATHJAX_CODEFILE)); - //printf("g_mathjax_code='%s'\n",g_mathjax_code.data()); + //printf("g_mathjax_code='%s'\n",qPrint(g_mathjax_code)); } g_latex_macro=getConvertLatexMacro(); - //printf("converted g_latex_macro='%s'\n",g_latex_macro.data()); + //printf("converted g_latex_macro='%s'\n",qPrint(g_latex_macro)); } createSubDirs(d); @@ -937,9 +987,10 @@ void HtmlGenerator::init() } { - std::ofstream t(dname+"/dynsections.js",std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + std::ofstream f(dname.str()+"/dynsections.js",std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); t << mgr.getAsString("dynsections.js"); if (Config_getBool(SOURCE_BROWSER) && Config_getBool(SOURCE_TOOLTIPS)) { @@ -985,7 +1036,7 @@ void HtmlGenerator::writeTabData() mgr.copyResource("nav_g.png",dname); } -void HtmlGenerator::writeSearchData(const char *dname) +void HtmlGenerator::writeSearchData(const QCString &dname) { bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH); //writeImgData(dname,serverBasedSearch ? search_server_data : search_client_data); @@ -1011,9 +1062,10 @@ void HtmlGenerator::writeSearchData(const char *dname) } QCString searchDirName = dname; - std::ofstream t(searchDirName.str()+"/search.css",std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + std::ofstream f(searchDirName.str()+"/search.css",std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); QCString searchCss; if (Config_getBool(DISABLE_INDEX)) { @@ -1033,18 +1085,18 @@ void HtmlGenerator::writeSearchData(const char *dname) } } -void HtmlGenerator::writeStyleSheetFile(std::ostream &t) +void HtmlGenerator::writeStyleSheetFile(TextStream &t) { t << replaceColorMarkers(substitute(ResourceMgr::instance().getAsString("doxygen.css"),"$doxygenversion",getDoxygenVersion())); } -void HtmlGenerator::writeHeaderFile(std::ostream &t, const char * /*cssname*/) +void HtmlGenerator::writeHeaderFile(TextStream &t, const QCString & /*cssname*/) { t << "<!-- HTML header for doxygen " << getDoxygenVersion() << "-->\n"; t << ResourceMgr::instance().getAsString("header.html"); } -void HtmlGenerator::writeFooterFile(std::ostream &t) +void HtmlGenerator::writeFooterFile(TextStream &t) { t << "<!-- HTML footer for doxygen " << getDoxygenVersion() << "-->\n"; t << ResourceMgr::instance().getAsString("footer.html"); @@ -1052,17 +1104,16 @@ void HtmlGenerator::writeFooterFile(std::ostream &t) static std::mutex g_indexLock; -void HtmlGenerator::startFile(const char *name,const char *, - const char *title,int id) +void HtmlGenerator::startFile(const QCString &name,const QCString &, + const QCString &title,int id) { - //printf("HtmlGenerator::startFile(%s)\n",name); + //printf("HtmlGenerator::startFile(%s)\n",qPrint(name)); m_relPath = relativePathToRoot(name); QCString fileName = addHtmlExtensionIfMissing(name); m_lastTitle=title; startPlainFile(fileName); m_codeGen.setId(id); - m_codeGen.setTextStream(t); m_codeGen.setRelativePath(m_relPath); { std::lock_guard<std::mutex> lock(g_indexLock); @@ -1070,26 +1121,26 @@ void HtmlGenerator::startFile(const char *name,const char *, } m_lastFile = fileName; - t << substituteHtmlKeywords(g_header,convertToHtml(filterTitle(title?title:"")),m_relPath); + m_t << substituteHtmlKeywords(g_header,convertToHtml(filterTitle(title)),m_relPath); - t << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " - << getDoxygenVersion() << " -->\n"; + m_t << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " + << getDoxygenVersion() << " -->\n"; //bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); bool searchEngine = Config_getBool(SEARCHENGINE); if (searchEngine /*&& !generateTreeView*/) { - t << "<script type=\"text/javascript\">\n"; - t << "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n"; - t << "var searchBox = new SearchBox(\"searchBox\", \"" - << m_relPath<< "search\",false,'" << theTranslator->trSearch() << "','" << Doxygen::htmlFileExtension << "');\n"; - t << "/* @license-end */\n"; - t << "</script>\n"; + m_t << "<script type=\"text/javascript\">\n"; + m_t << "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n"; + m_t << "var searchBox = new SearchBox(\"searchBox\", \"" + << m_relPath<< "search\",false,'" << theTranslator->trSearch() << "','" << Doxygen::htmlFileExtension << "');\n"; + m_t << "/* @license-end */\n"; + m_t << "</script>\n"; } //generateDynamicSections(t,relPath); m_sectionCount=0; } -void HtmlGenerator::writeSearchInfo(std::ostream &t,const QCString &) +void HtmlGenerator::writeSearchInfo(TextStream &t,const QCString &) { bool searchEngine = Config_getBool(SEARCHENGINE); bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH); @@ -1114,11 +1165,11 @@ void HtmlGenerator::writeSearchInfo(std::ostream &t,const QCString &) void HtmlGenerator::writeSearchInfo() { - writeSearchInfo(t,m_relPath); + writeSearchInfo(m_t,m_relPath); } -QCString HtmlGenerator::writeLogoAsString(const char *path) +QCString HtmlGenerator::writeLogoAsString(const QCString &path) { bool timeStamp = Config_getBool(HTML_TIMESTAMP); QCString result; @@ -1144,18 +1195,18 @@ QCString HtmlGenerator::writeLogoAsString(const char *path) void HtmlGenerator::writeLogo() { - t << writeLogoAsString(m_relPath); + m_t << writeLogoAsString(m_relPath); } -void HtmlGenerator::writePageFooter(std::ostream &t,const QCString &lastTitle, +void HtmlGenerator::writePageFooter(TextStream &t,const QCString &lastTitle, const QCString &relPath,const QCString &navPath) { t << substituteHtmlKeywords(g_footer,convertToHtml(lastTitle),relPath,navPath); } -void HtmlGenerator::writeFooter(const char *navPath) +void HtmlGenerator::writeFooter(const QCString &navPath) { - writePageFooter(t,m_lastTitle,m_relPath,navPath); + writePageFooter(m_t,m_lastTitle,m_relPath,navPath); } void HtmlGenerator::endFile() @@ -1165,12 +1216,12 @@ void HtmlGenerator::endFile() void HtmlGenerator::startProjectNumber() { - t << "<h3 class=\"version\">"; + m_t << "<h3 class=\"version\">"; } void HtmlGenerator::endProjectNumber() { - t << "</h3>"; + m_t << "</h3>"; } void HtmlGenerator::writeStyleInfo(int part) @@ -1187,7 +1238,7 @@ void HtmlGenerator::writeStyleInfo(int part) //t << "H1 { text-align: center; border-width: thin none thin none;\n"; //t << " border-style : double; border-color : blue; padding-left : 1em; padding-right : 1em }\n"; - t << replaceColorMarkers(substitute(ResourceMgr::instance().getAsString("doxygen.css"),"$doxygenversion",getDoxygenVersion())); + m_t << replaceColorMarkers(substitute(ResourceMgr::instance().getAsString("doxygen.css"),"$doxygenversion",getDoxygenVersion())); endPlainFile(); Doxygen::indexList->addStyleSheetFile("doxygen.css"); } @@ -1197,7 +1248,7 @@ void HtmlGenerator::writeStyleInfo(int part) FileInfo cssfi(cssname.str()); if (!cssfi.exists() || !cssfi.isFile() || !cssfi.isReadable()) { - err("style sheet %s does not exist or is not readable!", Config_getString(HTML_STYLESHEET).data()); + err("style sheet %s does not exist or is not readable!", qPrint(Config_getString(HTML_STYLESHEET))); } else { @@ -1205,7 +1256,7 @@ void HtmlGenerator::writeStyleInfo(int part) QCString fileStr = fileToString(cssname); // write the string into the output dir startPlainFile(cssfi.fileName().c_str()); - t << fileStr; + m_t << fileStr; endPlainFile(); } Doxygen::indexList->addStyleSheetFile(cssfi.fileName().c_str()); @@ -1232,14 +1283,14 @@ void HtmlGenerator::writeStyleInfo(int part) } } -void HtmlGenerator::startDoxyAnchor(const char *,const char *, - const char *anchor, const char *, - const char *) +void HtmlGenerator::startDoxyAnchor(const QCString &,const QCString &, + const QCString &anchor, const QCString &, + const QCString &) { - t << "<a id=\"" << anchor << "\"></a>"; + m_t << "<a id=\"" << anchor << "\"></a>"; } -void HtmlGenerator::endDoxyAnchor(const char *,const char *) +void HtmlGenerator::endDoxyAnchor(const QCString &,const QCString &) { } @@ -1248,144 +1299,144 @@ void HtmlGenerator::endDoxyAnchor(const char *,const char *) // t << "\n<p>\n"; //} -void HtmlGenerator::startParagraph(const char *classDef) +void HtmlGenerator::startParagraph(const QCString &classDef) { - if (classDef) - t << "\n<p class=\"" << classDef << "\">"; + if (!classDef.isEmpty()) + m_t << "\n<p class=\"" << classDef << "\">"; else - t << "\n<p>"; + m_t << "\n<p>"; } void HtmlGenerator::endParagraph() { - t << "</p>\n"; + m_t << "</p>\n"; } -void HtmlGenerator::writeString(const char *text) +void HtmlGenerator::writeString(const QCString &text) { - t << text; + m_t << text; } void HtmlGenerator::startIndexListItem() { - t << "<li>"; + m_t << "<li>"; } void HtmlGenerator::endIndexListItem() { - t << "</li>\n"; + m_t << "</li>\n"; } -void HtmlGenerator::startIndexItem(const char *ref,const char *f) +void HtmlGenerator::startIndexItem(const QCString &ref,const QCString &f) { //printf("HtmlGenerator::startIndexItem(%s,%s)\n",ref,f); - if (ref || f) + if (!ref.isEmpty() || !f.isEmpty()) { - if (ref) + if (!ref.isEmpty()) { - t << "<a class=\"elRef\" "; - t << externalLinkTarget(); + m_t << "<a class=\"elRef\" "; + m_t << externalLinkTarget(); } else { - t << "<a class=\"el\" "; + m_t << "<a class=\"el\" "; } - t << "href=\""; - t << externalRef(m_relPath,ref,TRUE); - if (f) t << addHtmlExtensionIfMissing(f); - t << "\">"; + m_t << "href=\""; + m_t << externalRef(m_relPath,ref,TRUE); + if (!f.isEmpty()) m_t << addHtmlExtensionIfMissing(f); + m_t << "\">"; } else { - t << "<b>"; + m_t << "<b>"; } } -void HtmlGenerator::endIndexItem(const char *ref,const char *f) +void HtmlGenerator::endIndexItem(const QCString &ref,const QCString &f) { //printf("HtmlGenerator::endIndexItem(%s,%s,%s)\n",ref,f,name); - if (ref || f) + if (!ref.isEmpty() || !f.isEmpty()) { - t << "</a>"; + m_t << "</a>"; } else { - t << "</b>"; + m_t << "</b>"; } } -void HtmlGenerator::writeStartAnnoItem(const char *,const char *f, - const char *path,const char *name) +void HtmlGenerator::writeStartAnnoItem(const QCString &,const QCString &f, + const QCString &path,const QCString &name) { - t << "<li>"; - if (path) docify(path); - t << "<a class=\"el\" href=\"" << addHtmlExtensionIfMissing(f) << "\">"; + m_t << "<li>"; + if (!path.isEmpty()) docify(path); + m_t << "<a class=\"el\" href=\"" << addHtmlExtensionIfMissing(f) << "\">"; docify(name); - t << "</a> "; + m_t << "</a> "; } -void HtmlGenerator::writeObjectLink(const char *ref,const char *f, - const char *anchor, const char *name) +void HtmlGenerator::writeObjectLink(const QCString &ref,const QCString &f, + const QCString &anchor, const QCString &name) { - if (ref) + if (!ref.isEmpty()) { - t << "<a class=\"elRef\" "; - t << externalLinkTarget(); + m_t << "<a class=\"elRef\" "; + m_t << externalLinkTarget(); } else { - t << "<a class=\"el\" "; + m_t << "<a class=\"el\" "; } - t << "href=\""; - t << externalRef(m_relPath,ref,TRUE); - if (f) t << addHtmlExtensionIfMissing(f); - if (anchor) t << "#" << anchor; - t << "\">"; + m_t << "href=\""; + m_t << externalRef(m_relPath,ref,TRUE); + if (!f.isEmpty()) m_t << addHtmlExtensionIfMissing(f); + if (!anchor.isEmpty()) m_t << "#" << anchor; + m_t << "\">"; docify(name); - t << "</a>"; + m_t << "</a>"; } -void HtmlGenerator::startTextLink(const char *f,const char *anchor) +void HtmlGenerator::startTextLink(const QCString &f,const QCString &anchor) { - t << "<a href=\""; - if (f) t << m_relPath << addHtmlExtensionIfMissing(f); - if (anchor) t << "#" << anchor; - t << "\">"; + m_t << "<a href=\""; + if (!f.isEmpty()) m_t << m_relPath << addHtmlExtensionIfMissing(f); + if (!anchor.isEmpty()) m_t << "#" << anchor; + m_t << "\">"; } void HtmlGenerator::endTextLink() { - t << "</a>"; + m_t << "</a>"; } -void HtmlGenerator::startHtmlLink(const char *url) +void HtmlGenerator::startHtmlLink(const QCString &url) { bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); - t << "<a "; - if (generateTreeView) t << "target=\"top\" "; - t << "href=\""; - if (url) t << url; - t << "\">"; + m_t << "<a "; + if (generateTreeView) m_t << "target=\"top\" "; + m_t << "href=\""; + if (!url.isEmpty()) m_t << url; + m_t << "\">"; } void HtmlGenerator::endHtmlLink() { - t << "</a>"; + m_t << "</a>"; } void HtmlGenerator::startGroupHeader(int extraIndentLevel) { if (extraIndentLevel==2) { - t << "<h4 class=\"groupheader\">"; + m_t << "<h4 class=\"groupheader\">"; } else if (extraIndentLevel==1) { - t << "<h3 class=\"groupheader\">"; + m_t << "<h3 class=\"groupheader\">"; } else // extraIndentLevel==0 { - t << "<h2 class=\"groupheader\">"; + m_t << "<h2 class=\"groupheader\">"; } } @@ -1393,79 +1444,79 @@ void HtmlGenerator::endGroupHeader(int extraIndentLevel) { if (extraIndentLevel==2) { - t << "</h4>\n"; + m_t << "</h4>\n"; } else if (extraIndentLevel==1) { - t << "</h3>\n"; + m_t << "</h3>\n"; } else { - t << "</h2>\n"; + m_t << "</h2>\n"; } } -void HtmlGenerator::startSection(const char *lab,const char *,SectionType type) +void HtmlGenerator::startSection(const QCString &lab,const QCString &,SectionType type) { switch(type) { - case SectionType::Page: t << "\n\n<h1>"; break; - case SectionType::Section: t << "\n\n<h2>"; break; - case SectionType::Subsection: t << "\n\n<h3>"; break; - case SectionType::Subsubsection: t << "\n\n<h4>"; break; - case SectionType::Paragraph: t << "\n\n<h5>"; break; + case SectionType::Page: m_t << "\n\n<h1>"; break; + case SectionType::Section: m_t << "\n\n<h2>"; break; + case SectionType::Subsection: m_t << "\n\n<h3>"; break; + case SectionType::Subsubsection: m_t << "\n\n<h4>"; break; + case SectionType::Paragraph: m_t << "\n\n<h5>"; break; default: ASSERT(0); break; } - t << "<a id=\"" << lab << "\"></a>"; + m_t << "<a id=\"" << lab << "\"></a>"; } -void HtmlGenerator::endSection(const char *,SectionType type) +void HtmlGenerator::endSection(const QCString &,SectionType type) { switch(type) { - case SectionType::Page: t << "</h1>"; break; - case SectionType::Section: t << "</h2>"; break; - case SectionType::Subsection: t << "</h3>"; break; - case SectionType::Subsubsection: t << "</h4>"; break; - case SectionType::Paragraph: t << "</h5>"; break; + case SectionType::Page: m_t << "</h1>"; break; + case SectionType::Section: m_t << "</h2>"; break; + case SectionType::Subsection: m_t << "</h3>"; break; + case SectionType::Subsubsection: m_t << "</h4>"; break; + case SectionType::Paragraph: m_t << "</h5>"; break; default: ASSERT(0); break; } } -void HtmlGenerator::docify(const char *str) +void HtmlGenerator::docify(const QCString &str) { docify(str,FALSE); } -void HtmlGenerator::docify(const char *str,bool inHtmlComment) +void HtmlGenerator::docify(const QCString &str,bool inHtmlComment) { - if (str) + if (!str.isEmpty()) { - const char *p=str; + const char *p=str.data(); char c; while (*p) { c=*p++; switch(c) { - case '<': t << "<"; break; - case '>': t << ">"; break; - case '&': t << "&"; break; - case '"': t << """; break; - case '-': if (inHtmlComment) t << "-"; else t << "-"; break; + case '<': m_t << "<"; break; + case '>': m_t << ">"; break; + case '&': m_t << "&"; break; + case '"': m_t << """; break; + case '-': if (inHtmlComment) m_t << "-"; else m_t << "-"; break; case '\\': if (*p=='<') - { t << "<"; p++; } + { m_t << "<"; p++; } else if (*p=='>') - { t << ">"; p++; } + { m_t << ">"; p++; } else if (*p=='(') - { t << "\\‍("; p++; } + { m_t << "\\‍("; p++; } else if (*p==')') - { t << "\\‍)"; p++; } + { m_t << "\\‍)"; p++; } else - t << "\\"; + m_t << "\\"; break; - default: t << c; + default: m_t << c; } } } @@ -1481,7 +1532,7 @@ void HtmlGenerator::writeChar(char c) //--- helper function for dynamic sections ------------------------- -static void startSectionHeader(std::ostream &t, +static void startSectionHeader(TextStream &t, const QCString &relPath,int sectionCount) { //t << "<!-- startSectionHeader -->"; @@ -1501,13 +1552,13 @@ static void startSectionHeader(std::ostream &t, } } -static void endSectionHeader(std::ostream &t) +static void endSectionHeader(TextStream &t) { //t << "<!-- endSectionHeader -->"; t << "</div>\n"; } -static void startSectionSummary(std::ostream &t,int sectionCount) +static void startSectionSummary(TextStream &t,int sectionCount) { //t << "<!-- startSectionSummary -->"; bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); @@ -1519,7 +1570,7 @@ static void startSectionSummary(std::ostream &t,int sectionCount) } } -static void endSectionSummary(std::ostream &t) +static void endSectionSummary(TextStream &t) { //t << "<!-- endSectionSummary -->"; bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); @@ -1529,7 +1580,7 @@ static void endSectionSummary(std::ostream &t) } } -static void startSectionContent(std::ostream &t,int sectionCount) +static void startSectionContent(TextStream &t,int sectionCount) { //t << "<!-- startSectionContent -->"; bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); @@ -1545,7 +1596,7 @@ static void startSectionContent(std::ostream &t,int sectionCount) } } -static void endSectionContent(std::ostream &t) +static void endSectionContent(TextStream &t) { //t << "<!-- endSectionContent -->"; t << "</div>\n"; @@ -1555,142 +1606,151 @@ static void endSectionContent(std::ostream &t) void HtmlGenerator::startClassDiagram() { - startSectionHeader(t,m_relPath,m_sectionCount); + startSectionHeader(m_t,m_relPath,m_sectionCount); } void HtmlGenerator::endClassDiagram(const ClassDiagram &d, - const char *fileName,const char *name) + const QCString &fileName,const QCString &name) { - endSectionHeader(t); - startSectionSummary(t,m_sectionCount); - endSectionSummary(t); - startSectionContent(t,m_sectionCount); - std::ostringstream tt(std::ios_base::ate); + endSectionHeader(m_t); + startSectionSummary(m_t,m_sectionCount); + endSectionSummary(m_t); + startSectionContent(m_t,m_sectionCount); + TextStream tt; d.writeImage(tt,dir(),m_relPath,fileName); - if (tt.tellp()>0) - { - t << " <div class=\"center\">\n"; - t << " <img src=\""; - t << m_relPath << fileName << ".png\" usemap=\"#" << convertToId(name); - t << "_map\" alt=\"\"/>\n"; - t << " <map id=\"" << convertToId(name); - t << "_map\" name=\"" << convertToId(name); - t << "_map\">\n"; - t << tt.str(); - t << " </map>\n"; - t << "</div>"; + if (!tt.empty()) + { + m_t << " <div class=\"center\">\n"; + m_t << " <img src=\""; + m_t << m_relPath << fileName << ".png\" usemap=\"#" << convertToId(name); + m_t << "_map\" alt=\"\"/>\n"; + m_t << " <map id=\"" << convertToId(name); + m_t << "_map\" name=\"" << convertToId(name); + m_t << "_map\">\n"; + m_t << tt.str(); + m_t << " </map>\n"; + m_t << "</div>"; } else { - t << " <div class=\"center\">\n"; - t << " <img src=\""; - t << m_relPath << fileName << ".png\" alt=\"\"/>\n"; - t << " </div>"; + m_t << " <div class=\"center\">\n"; + m_t << " <img src=\""; + m_t << m_relPath << fileName << ".png\" alt=\"\"/>\n"; + m_t << " </div>"; } - endSectionContent(t); + endSectionContent(m_t); m_sectionCount++; } void HtmlGenerator::startMemberList() { - DBG_HTML(t << "<!-- startMemberList -->\n") + DBG_HTML(m_t << "<!-- startMemberList -->\n") } void HtmlGenerator::endMemberList() { - DBG_HTML(t << "<!-- endMemberList -->\n") + DBG_HTML(m_t << "<!-- endMemberList -->\n") } // anonymous type: // 0 = single column right aligned // 1 = double column left aligned // 2 = single column left aligned -void HtmlGenerator::startMemberItem(const char *anchor,int annoType,const char *inheritId) +void HtmlGenerator::startMemberItem(const QCString &anchor,int annoType,const QCString &inheritId) { - DBG_HTML(t << "<!-- startMemberItem() -->\n") + DBG_HTML(m_t << "<!-- startMemberItem() -->\n") if (m_emptySection) { - t << "<table class=\"memberdecls\">\n"; + m_t << "<table class=\"memberdecls\">\n"; m_emptySection=FALSE; } - t << "<tr class=\"memitem:" << (anchor?anchor:""); - if (inheritId) + m_t << "<tr class=\"memitem:" << anchor; + if (!inheritId.isEmpty()) { - t << " inherit " << inheritId; + m_t << " inherit " << inheritId; } - t << "\">"; + m_t << "\">"; insertMemberAlignLeft(annoType, true); } void HtmlGenerator::endMemberItem() { - t << "</td></tr>\n"; + m_t << "</td></tr>\n"; } void HtmlGenerator::startMemberTemplateParams() { } -void HtmlGenerator::endMemberTemplateParams(const char *anchor,const char *inheritId) +void HtmlGenerator::endMemberTemplateParams(const QCString &anchor,const QCString &inheritId) { - t << "</td></tr>\n"; - t << "<tr class=\"memitem:" << (anchor?anchor:""); - if (inheritId) + m_t << "</td></tr>\n"; + m_t << "<tr class=\"memitem:" << anchor; + if (!inheritId.isEmpty()) { - t << " inherit " << inheritId; + m_t << " inherit " << inheritId; } - t << "\"><td class=\"memTemplItemLeft\" align=\"right\" valign=\"top\">"; + m_t << "\"><td class=\"memTemplItemLeft\" align=\"right\" valign=\"top\">"; +} + +void HtmlGenerator::startCompoundTemplateParams() +{ + m_t << "<div class=\"compoundTemplParams\">"; } +void HtmlGenerator::endCompoundTemplateParams() +{ + m_t << "</div>"; +} void HtmlGenerator::insertMemberAlign(bool templ) { - DBG_HTML(t << "<!-- insertMemberAlign -->\n") + DBG_HTML(m_t << "<!-- insertMemberAlign -->\n") QCString className = templ ? "memTemplItemRight" : "memItemRight"; - t << " </td><td class=\"" << className << "\" valign=\"bottom\">"; + m_t << " </td><td class=\"" << className << "\" valign=\"bottom\">"; } void HtmlGenerator::insertMemberAlignLeft(int annoType, bool initTag) { - if (!initTag) t << " </td>"; + if (!initTag) m_t << " </td>"; switch(annoType) { - case 0: t << "<td class=\"memItemLeft\" align=\"right\" valign=\"top\">"; break; - case 1: t << "<td class=\"memItemLeft\" >"; break; - case 2: t << "<td class=\"memItemLeft\" valign=\"top\">"; break; - default: t << "<td class=\"memTemplParams\" colspan=\"2\">"; break; + case 0: m_t << "<td class=\"memItemLeft\" align=\"right\" valign=\"top\">"; break; + case 1: m_t << "<td class=\"memItemLeft\" >"; break; + case 2: m_t << "<td class=\"memItemLeft\" valign=\"top\">"; break; + default: m_t << "<td class=\"memTemplParams\" colspan=\"2\">"; break; } } -void HtmlGenerator::startMemberDescription(const char *anchor,const char *inheritId, bool typ) +void HtmlGenerator::startMemberDescription(const QCString &anchor,const QCString &inheritId, bool typ) { - DBG_HTML(t << "<!-- startMemberDescription -->\n") - if (m_emptySection) - { - t << "<table class=\"memberdecls\">\n"; - m_emptySection=FALSE; - } - t << "<tr class=\"memdesc:" << (anchor?anchor:""); - if (inheritId) + DBG_HTML(m_t << "<!-- startMemberDescription -->\n") + if (m_emptySection) { - t << " inherit " << inheritId; + m_t << "<table class=\"memberdecls\">\n"; + m_emptySection=FALSE; + } + m_t << "<tr class=\"memdesc:" << anchor; + if (!inheritId.isEmpty()) + { + m_t << " inherit " << inheritId; } - t << "\">"; - t << "<td class=\"mdescLeft\"> </td>"; - if (typ) t << "<td class=\"mdescLeft\"> </td>"; - t << "<td class=\"mdescRight\">";; + m_t << "\">"; + m_t << "<td class=\"mdescLeft\"> </td>"; + if (typ) m_t << "<td class=\"mdescLeft\"> </td>"; + m_t << "<td class=\"mdescRight\">";; } void HtmlGenerator::endMemberDescription() { - DBG_HTML(t << "<!-- endMemberDescription -->\n") - t << "<br /></td></tr>\n"; + DBG_HTML(m_t << "<!-- endMemberDescription -->\n") + m_t << "<br /></td></tr>\n"; } void HtmlGenerator::startMemberSections() { - DBG_HTML(t << "<!-- startMemberSections -->\n") + DBG_HTML(m_t << "<!-- startMemberSections -->\n") m_emptySection=TRUE; // we postpone writing <table> until we actually // write a row to prevent empty tables, which // are not valid XHTML! @@ -1698,364 +1758,362 @@ void HtmlGenerator::startMemberSections() void HtmlGenerator::endMemberSections() { - DBG_HTML(t << "<!-- endMemberSections -->\n") + DBG_HTML(m_t << "<!-- endMemberSections -->\n") if (!m_emptySection) { - t << "</table>\n"; + m_t << "</table>\n"; } } -void HtmlGenerator::startMemberHeader(const char *anchor, int typ) +void HtmlGenerator::startMemberHeader(const QCString &anchor, int typ) { - DBG_HTML(t << "<!-- startMemberHeader -->\n") + DBG_HTML(m_t << "<!-- startMemberHeader -->\n") if (!m_emptySection) { - t << "</table>"; + m_t << "</table>"; m_emptySection=TRUE; } if (m_emptySection) { - t << "<table class=\"memberdecls\">\n"; + m_t << "<table class=\"memberdecls\">\n"; m_emptySection=FALSE; } - t << "<tr class=\"heading\"><td colspan=\"" << typ << "\"><h2 class=\"groupheader\">"; - if (anchor) + m_t << "<tr class=\"heading\"><td colspan=\"" << typ << "\"><h2 class=\"groupheader\">"; + if (!anchor.isEmpty()) { - t << "<a name=\"" << anchor << "\"></a>\n"; + m_t << "<a name=\"" << anchor << "\"></a>\n"; } } void HtmlGenerator::endMemberHeader() { - DBG_HTML(t << "<!-- endMemberHeader -->\n") - t << "</h2></td></tr>\n"; + DBG_HTML(m_t << "<!-- endMemberHeader -->\n") + m_t << "</h2></td></tr>\n"; } void HtmlGenerator::startMemberSubtitle() { - DBG_HTML(t << "<!-- startMemberSubtitle -->\n") - t << "<tr><td class=\"ititle\" colspan=\"2\">"; + DBG_HTML(m_t << "<!-- startMemberSubtitle -->\n") + m_t << "<tr><td class=\"ititle\" colspan=\"2\">"; } void HtmlGenerator::endMemberSubtitle() { - DBG_HTML(t << "<!-- endMemberSubtitle -->\n") - t << "</td></tr>\n"; + DBG_HTML(m_t << "<!-- endMemberSubtitle -->\n") + m_t << "</td></tr>\n"; } void HtmlGenerator::startIndexList() { - t << "<table>\n"; + m_t << "<table>\n"; } void HtmlGenerator::endIndexList() { - t << "</table>\n"; + m_t << "</table>\n"; } void HtmlGenerator::startIndexKey() { // inserted 'class = ...', 02 jan 2002, jh - t << " <tr><td class=\"indexkey\">"; + m_t << " <tr><td class=\"indexkey\">"; } void HtmlGenerator::endIndexKey() { - t << "</td>"; + m_t << "</td>"; } void HtmlGenerator::startIndexValue(bool) { // inserted 'class = ...', 02 jan 2002, jh - t << "<td class=\"indexvalue\">"; + m_t << "<td class=\"indexvalue\">"; } -void HtmlGenerator::endIndexValue(const char *,bool) +void HtmlGenerator::endIndexValue(const QCString &,bool) { - t << "</td></tr>\n"; + m_t << "</td></tr>\n"; } void HtmlGenerator::startMemberDocList() { - DBG_HTML(t << "<!-- startMemberDocList -->\n";) + DBG_HTML(m_t << "<!-- startMemberDocList -->\n";) } void HtmlGenerator::endMemberDocList() { - DBG_HTML(t << "<!-- endMemberDocList -->\n";) + DBG_HTML(m_t << "<!-- endMemberDocList -->\n";) } -void HtmlGenerator::startMemberDoc( const char *clName, const char *memName, - const char *anchor, const char *title, +void HtmlGenerator::startMemberDoc( const QCString &clName, const QCString &memName, + const QCString &anchor, const QCString &title, int memCount, int memTotal, bool showInline) { - DBG_HTML(t << "<!-- startMemberDoc -->\n";) - t << "\n<h2 class=\"memtitle\">" - << "<span class=\"permalink\"><a href=\"#" << anchor << "\">◆ </a></span>"; + DBG_HTML(m_t << "<!-- startMemberDoc -->\n";) + m_t << "\n<h2 class=\"memtitle\">" + << "<span class=\"permalink\"><a href=\"#" << anchor << "\">◆ </a></span>"; docify(title); if (memTotal>1) { - t << " <span class=\"overload\">[" << memCount << "/" << memTotal <<"]</span>"; + m_t << " <span class=\"overload\">[" << memCount << "/" << memTotal <<"]</span>"; } - t << "</h2>\n"; - t << "\n<div class=\"memitem\">\n"; - t << "<div class=\"memproto\">\n"; + m_t << "</h2>\n"; + m_t << "\n<div class=\"memitem\">\n"; + m_t << "<div class=\"memproto\">\n"; } void HtmlGenerator::startMemberDocPrefixItem() { - DBG_HTML(t << "<!-- startMemberDocPrefixItem -->\n";) - t << "<div class=\"memtemplate\">\n"; + DBG_HTML(m_t << "<!-- startMemberDocPrefixItem -->\n";) + m_t << "<div class=\"memtemplate\">\n"; } void HtmlGenerator::endMemberDocPrefixItem() { - DBG_HTML(t << "<!-- endMemberDocPrefixItem -->\n";) - t << "</div>\n"; + DBG_HTML(m_t << "<!-- endMemberDocPrefixItem -->\n";) + m_t << "</div>\n"; } void HtmlGenerator::startMemberDocName(bool /*align*/) { - DBG_HTML(t << "<!-- startMemberDocName -->\n";) + DBG_HTML(m_t << "<!-- startMemberDocName -->\n";) - t << " <table class=\"memname\">\n"; + m_t << " <table class=\"memname\">\n"; - t << " <tr>\n"; - t << " <td class=\"memname\">"; + m_t << " <tr>\n"; + m_t << " <td class=\"memname\">"; } void HtmlGenerator::endMemberDocName() { - DBG_HTML(t << "<!-- endMemberDocName -->\n";) - t << "</td>\n"; + DBG_HTML(m_t << "<!-- endMemberDocName -->\n";) + m_t << "</td>\n"; } void HtmlGenerator::startParameterList(bool openBracket) { - DBG_HTML(t << "<!-- startParameterList -->\n";) - t << " <td>"; - if (openBracket) t << "("; - t << "</td>\n"; + DBG_HTML(m_t << "<!-- startParameterList -->\n";) + m_t << " <td>"; + if (openBracket) m_t << "("; + m_t << "</td>\n"; } -void HtmlGenerator::startParameterType(bool first,const char *key) +void HtmlGenerator::startParameterType(bool first,const QCString &key) { if (first) { - DBG_HTML(t << "<!-- startFirstParameterType -->\n";) - t << " <td class=\"paramtype\">"; + DBG_HTML(m_t << "<!-- startFirstParameterType -->\n";) + m_t << " <td class=\"paramtype\">"; } else { - DBG_HTML(t << "<!-- startParameterType -->\n";) - t << " <tr>\n"; - t << " <td class=\"paramkey\">"; - if (key) t << key; - t << "</td>\n"; - t << " <td></td>\n"; - t << " <td class=\"paramtype\">"; + DBG_HTML(m_t << "<!-- startParameterType -->\n";) + m_t << " <tr>\n"; + m_t << " <td class=\"paramkey\">" << key << "</td>\n"; + m_t << " <td></td>\n"; + m_t << " <td class=\"paramtype\">"; } } void HtmlGenerator::endParameterType() { - DBG_HTML(t << "<!-- endParameterType -->\n";) - t << " </td>\n"; + DBG_HTML(m_t << "<!-- endParameterType -->\n";) + m_t << " </td>\n"; } void HtmlGenerator::startParameterName(bool /*oneArgOnly*/) { - DBG_HTML(t << "<!-- startParameterName -->\n";) - t << " <td class=\"paramname\">"; + DBG_HTML(m_t << "<!-- startParameterName -->\n";) + m_t << " <td class=\"paramname\">"; } void HtmlGenerator::endParameterName(bool last,bool emptyList,bool closeBracket) { - DBG_HTML(t << "<!-- endParameterName -->\n";) + DBG_HTML(m_t << "<!-- endParameterName -->\n";) if (last) { if (emptyList) { - if (closeBracket) t << "</td><td>)"; - t << "</td>\n"; - t << " <td>"; + if (closeBracket) m_t << "</td><td>)"; + m_t << "</td>\n"; + m_t << " <td>"; } else { - t << " </td>\n"; - t << " </tr>\n"; - t << " <tr>\n"; - t << " <td></td>\n"; - t << " <td>"; - if (closeBracket) t << ")"; - t << "</td>\n"; - t << " <td></td><td>"; + m_t << " </td>\n"; + m_t << " </tr>\n"; + m_t << " <tr>\n"; + m_t << " <td></td>\n"; + m_t << " <td>"; + if (closeBracket) m_t << ")"; + m_t << "</td>\n"; + m_t << " <td></td><td>"; } } else { - t << "</td>\n"; - t << " </tr>\n"; + m_t << "</td>\n"; + m_t << " </tr>\n"; } } void HtmlGenerator::endParameterList() { - DBG_HTML(t << "<!-- endParameterList -->\n";) - t << "</td>\n"; - t << " </tr>\n"; + DBG_HTML(m_t << "<!-- endParameterList -->\n";) + m_t << "</td>\n"; + m_t << " </tr>\n"; } -void HtmlGenerator::exceptionEntry(const char* prefix,bool closeBracket) +void HtmlGenerator::exceptionEntry(const QCString &prefix,bool closeBracket) { - DBG_HTML(t << "<!-- exceptionEntry -->\n";) - t << "</td>\n"; - t << " </tr>\n"; - t << " <tr>\n"; - t << " <td align=\"right\">"; + DBG_HTML(m_t << "<!-- exceptionEntry -->\n";) + m_t << "</td>\n"; + m_t << " </tr>\n"; + m_t << " <tr>\n"; + m_t << " <td align=\"right\">"; // colspan 2 so it gets both parameter type and parameter name columns - if (prefix) - t << prefix << "</td><td>(</td><td colspan=\"2\">"; + if (!prefix.isEmpty()) + m_t << prefix << "</td><td>(</td><td colspan=\"2\">"; else if (closeBracket) - t << "</td><td>)</td><td></td><td>"; + m_t << "</td><td>)</td><td></td><td>"; else - t << "</td><td></td><td colspan=\"2\">"; + m_t << "</td><td></td><td colspan=\"2\">"; } void HtmlGenerator::endMemberDoc(bool hasArgs) { - DBG_HTML(t << "<!-- endMemberDoc -->\n";) + DBG_HTML(m_t << "<!-- endMemberDoc -->\n";) if (!hasArgs) { - t << " </tr>\n"; + m_t << " </tr>\n"; } - t << " </table>\n"; - // t << "</div>\n"; + m_t << " </table>\n"; + // m_t << "</div>\n"; } void HtmlGenerator::startDotGraph() { - startSectionHeader(t,m_relPath,m_sectionCount); + startSectionHeader(m_t,m_relPath,m_sectionCount); } void HtmlGenerator::endDotGraph(DotClassGraph &g) { bool generateLegend = Config_getBool(GENERATE_LEGEND); bool umlLook = Config_getBool(UML_LOOK); - endSectionHeader(t); - startSectionSummary(t,m_sectionCount); - endSectionSummary(t); - startSectionContent(t,m_sectionCount); + endSectionHeader(m_t); + startSectionSummary(m_t,m_sectionCount); + endSectionSummary(m_t); + startSectionContent(m_t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,TRUE,m_sectionCount); + g.writeGraph(m_t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,TRUE,m_sectionCount); if (generateLegend && !umlLook) { - t << "<center><span class=\"legend\">["; - startHtmlLink(m_relPath+"graph_legend"+Doxygen::htmlFileExtension); - t << theTranslator->trLegend(); + m_t << "<center><span class=\"legend\">["; + startHtmlLink((m_relPath+"graph_legend"+Doxygen::htmlFileExtension)); + m_t << theTranslator->trLegend(); endHtmlLink(); - t << "]</span></center>"; + m_t << "]</span></center>"; } - endSectionContent(t); + endSectionContent(m_t); m_sectionCount++; } void HtmlGenerator::startInclDepGraph() { - startSectionHeader(t,m_relPath,m_sectionCount); + startSectionHeader(m_t,m_relPath,m_sectionCount); } void HtmlGenerator::endInclDepGraph(DotInclDepGraph &g) { - endSectionHeader(t); - startSectionSummary(t,m_sectionCount); - endSectionSummary(t); - startSectionContent(t,m_sectionCount); + endSectionHeader(m_t); + startSectionSummary(m_t,m_sectionCount); + endSectionSummary(m_t); + startSectionContent(m_t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); + g.writeGraph(m_t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); - endSectionContent(t); + endSectionContent(m_t); m_sectionCount++; } void HtmlGenerator::startGroupCollaboration() { - startSectionHeader(t,m_relPath,m_sectionCount); + startSectionHeader(m_t,m_relPath,m_sectionCount); } void HtmlGenerator::endGroupCollaboration(DotGroupCollaboration &g) { - endSectionHeader(t); - startSectionSummary(t,m_sectionCount); - endSectionSummary(t); - startSectionContent(t,m_sectionCount); + endSectionHeader(m_t); + startSectionSummary(m_t,m_sectionCount); + endSectionSummary(m_t); + startSectionContent(m_t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); + g.writeGraph(m_t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); - endSectionContent(t); + endSectionContent(m_t); m_sectionCount++; } void HtmlGenerator::startCallGraph() { - startSectionHeader(t,m_relPath,m_sectionCount); + startSectionHeader(m_t,m_relPath,m_sectionCount); } void HtmlGenerator::endCallGraph(DotCallGraph &g) { - endSectionHeader(t); - startSectionSummary(t,m_sectionCount); - endSectionSummary(t); - startSectionContent(t,m_sectionCount); + endSectionHeader(m_t); + startSectionSummary(m_t,m_sectionCount); + endSectionSummary(m_t); + startSectionContent(m_t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); + g.writeGraph(m_t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); - endSectionContent(t); + endSectionContent(m_t); m_sectionCount++; } void HtmlGenerator::startDirDepGraph() { - startSectionHeader(t,m_relPath,m_sectionCount); + startSectionHeader(m_t,m_relPath,m_sectionCount); } void HtmlGenerator::endDirDepGraph(DotDirDeps &g) { - endSectionHeader(t); - startSectionSummary(t,m_sectionCount); - endSectionSummary(t); - startSectionContent(t,m_sectionCount); + endSectionHeader(m_t); + startSectionSummary(m_t,m_sectionCount); + endSectionSummary(m_t); + startSectionContent(m_t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); + g.writeGraph(m_t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); - endSectionContent(t); + endSectionContent(m_t); m_sectionCount++; } void HtmlGenerator::writeGraphicalHierarchy(DotGfxHierarchyTable &g) { - g.writeGraph(t,dir(),fileName()); + g.writeGraph(m_t,dir(),fileName()); } void HtmlGenerator::startMemberGroupHeader(bool) { - t << "<tr><td colspan=\"2\"><div class=\"groupHeader\">"; + m_t << "<tr><td colspan=\"2\"><div class=\"groupHeader\">"; } void HtmlGenerator::endMemberGroupHeader() { - t << "</div></td></tr>\n"; + m_t << "</div></td></tr>\n"; } void HtmlGenerator::startMemberGroupDocs() { - t << "<tr><td colspan=\"2\"><div class=\"groupText\">"; + m_t << "<tr><td colspan=\"2\"><div class=\"groupText\">"; } void HtmlGenerator::endMemberGroupDocs() { - t << "</div></td></tr>\n"; + m_t << "</div></td></tr>\n"; } void HtmlGenerator::startMemberGroup() @@ -2068,18 +2126,18 @@ void HtmlGenerator::endMemberGroup(bool) void HtmlGenerator::startIndent() { - DBG_HTML(t << "<!-- startIndent -->\n";) + DBG_HTML(m_t << "<!-- startIndent -->\n";) - t << "<div class=\"memdoc\">\n"; + m_t << "<div class=\"memdoc\">\n"; } void HtmlGenerator::endIndent() { - DBG_HTML(t << "<!-- endIndent -->\n";) - t << "\n</div>\n" << "</div>\n"; + DBG_HTML(m_t << "<!-- endIndent -->\n";) + m_t << "\n</div>\n" << "</div>\n"; } -void HtmlGenerator::addIndexItem(const char *,const char *) +void HtmlGenerator::addIndexItem(const QCString &,const QCString &) { } @@ -2088,86 +2146,86 @@ void HtmlGenerator::writeNonBreakableSpace(int n) int i; for (i=0;i<n;i++) { - t << " "; + m_t << " "; } } -void HtmlGenerator::startDescTable(const char *title) +void HtmlGenerator::startDescTable(const QCString &title) { - t << "<table class=\"fieldtable\">\n" - << "<tr><th colspan=\"2\">" << title << "</th></tr>"; + m_t << "<table class=\"fieldtable\">\n" + << "<tr><th colspan=\"2\">" << title << "</th></tr>"; } void HtmlGenerator::endDescTable() { - t << "</table>\n"; + m_t << "</table>\n"; } void HtmlGenerator::startDescTableRow() { - t << "<tr>"; + m_t << "<tr>"; } void HtmlGenerator::endDescTableRow() { - t << "</tr>\n"; + m_t << "</tr>\n"; } void HtmlGenerator::startDescTableTitle() { - t << "<td class=\"fieldname\">"; + m_t << "<td class=\"fieldname\">"; } void HtmlGenerator::endDescTableTitle() { - t << " </td>"; + m_t << " </td>"; } void HtmlGenerator::startDescTableData() { - t << "<td class=\"fielddoc\">"; + m_t << "<td class=\"fielddoc\">"; } void HtmlGenerator::endDescTableData() { - t << "</td>"; + m_t << "</td>"; } void HtmlGenerator::startExamples() { - t << "<dl class=\"section examples\"><dt>"; + m_t << "<dl class=\"section examples\"><dt>"; docify(theTranslator->trExamples()); - t << "</dt>"; + m_t << "</dt>"; } void HtmlGenerator::endExamples() { - t << "</dl>\n"; + m_t << "</dl>\n"; } void HtmlGenerator::startParamList(ParamListTypes, - const char *title) + const QCString &title) { - t << "<dl><dt><b>"; + m_t << "<dl><dt><b>"; docify(title); - t << "</b></dt>"; + m_t << "</b></dt>"; } void HtmlGenerator::endParamList() { - t << "</dl>"; + m_t << "</dl>"; } void HtmlGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *,int id) { m_codeGen.setId(id); - HtmlDocVisitor *visitor = new HtmlDocVisitor(t,m_codeGen,ctx); + HtmlDocVisitor *visitor = new HtmlDocVisitor(m_t,m_codeGen,ctx); n->accept(visitor); delete visitor; } //---------------- helpers for index generation ----------------------------- -static void startQuickIndexList(std::ostream &t,bool compact,bool topLevel=TRUE) +static void startQuickIndexList(TextStream &t,bool compact,bool topLevel=TRUE) { if (compact) { @@ -2187,7 +2245,7 @@ static void startQuickIndexList(std::ostream &t,bool compact,bool topLevel=TRUE) } } -static void endQuickIndexList(std::ostream &t,bool compact) +static void endQuickIndexList(TextStream &t,bool compact) { if (compact) { @@ -2200,7 +2258,7 @@ static void endQuickIndexList(std::ostream &t,bool compact) } } -static void startQuickIndexItem(std::ostream &t,const char *l, +static void startQuickIndexItem(TextStream &t,const QCString &l, bool hl,bool /*compact*/, const QCString &relPath) { @@ -2210,14 +2268,14 @@ static void startQuickIndexItem(std::ostream &t,const char *l, t << " class=\"current\""; } t << ">"; - if (l) t << "<a href=\"" << correctURL(l,relPath) << "\">"; + if (!l.isEmpty()) t << "<a href=\"" << correctURL(l,relPath) << "\">"; t << "<span>"; } -static void endQuickIndexItem(std::ostream &t,const char *l) +static void endQuickIndexItem(TextStream &t,const QCString &l) { t << "</span>"; - if (l) t << "</a>"; + if (!l.isEmpty()) t << "</a>"; t << "</li>\n"; } @@ -2235,6 +2293,7 @@ static bool quickLinkVisible(LayoutNavEntry::Kind kind) case LayoutNavEntry::Namespaces: return documentedNamespaces>0 && showNamespaces; case LayoutNavEntry::NamespaceList: return documentedNamespaces>0 && showNamespaces; case LayoutNavEntry::NamespaceMembers: return documentedNamespaceMembers[NMHL_All]>0; + case LayoutNavEntry::Concepts: return documentedConcepts>0; case LayoutNavEntry::Classes: return annotatedClasses>0; case LayoutNavEntry::ClassList: return annotatedClasses>0; case LayoutNavEntry::ClassIndex: return annotatedClasses>0; @@ -2262,7 +2321,7 @@ static bool quickLinkVisible(LayoutNavEntry::Kind kind) return FALSE; } -static void renderQuickLinksAsTree(std::ostream &t,const QCString &relPath,LayoutNavEntry *root) +static void renderQuickLinksAsTree(TextStream &t,const QCString &relPath,LayoutNavEntry *root) { int count=0; @@ -2291,7 +2350,7 @@ static void renderQuickLinksAsTree(std::ostream &t,const QCString &relPath,Layou } -static void renderQuickLinksAsTabs(std::ostream &t,const QCString &relPath, +static void renderQuickLinksAsTabs(TextStream &t,const QCString &relPath, LayoutNavEntry *hlEntry,LayoutNavEntry::Kind kind, bool highlightParent,bool highlightSearch) { @@ -2360,9 +2419,9 @@ static void renderQuickLinksAsTabs(std::ostream &t,const QCString &relPath, } } -static void writeDefaultQuickLinks(std::ostream &t,bool compact, +static void writeDefaultQuickLinks(TextStream &t,bool compact, HighlightedItem hli, - const char *file, + const QCString &file, const QCString &relPath) { bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH); @@ -2382,6 +2441,7 @@ static void writeDefaultQuickLinks(std::ostream &t,bool compact, case HLI_InterfaceHierarchy: kind = LayoutNavEntry::InterfaceHierarchy; break; case HLI_ExceptionHierarchy: kind = LayoutNavEntry::ExceptionHierarchy; break; case HLI_Classes: kind = LayoutNavEntry::ClassIndex; altKind = LayoutNavEntry::Classes; break; + case HLI_Concepts: kind = LayoutNavEntry::Concepts; break; case HLI_Interfaces: kind = LayoutNavEntry::InterfaceIndex; altKind = LayoutNavEntry::Interfaces; break; case HLI_Structs: kind = LayoutNavEntry::StructIndex; altKind = LayoutNavEntry::Structs; break; case HLI_Exceptions: kind = LayoutNavEntry::ExceptionIndex; altKind = LayoutNavEntry::Exceptions; break; @@ -2398,6 +2458,8 @@ static void writeDefaultQuickLinks(std::ostream &t,bool compact, case HLI_UserGroup: kind = LayoutNavEntry::UserGroup; break; case HLI_ClassVisible: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes; highlightParent = TRUE; break; + case HLI_ConceptVisible: kind = LayoutNavEntry::Concepts; + highlightParent = TRUE; break; case HLI_InterfaceVisible: kind = LayoutNavEntry::InterfaceList; altKind = LayoutNavEntry::Interfaces; highlightParent = TRUE; break; case HLI_StructVisible: kind = LayoutNavEntry::StructList; altKind = LayoutNavEntry::Structs; @@ -2455,7 +2517,7 @@ static void writeDefaultQuickLinks(std::ostream &t,bool compact, else if (compact) // && !Config_getBool(HTML_DYNAMIC_MENUS) { // find highlighted index item - LayoutNavEntry *hlEntry = root->find(kind,kind==LayoutNavEntry::UserGroup ? file : 0); + LayoutNavEntry *hlEntry = root->find(kind,kind==LayoutNavEntry::UserGroup ? file : QCString()); if (!hlEntry && altKind!=(LayoutNavEntry::Kind)-1) { hlEntry=root->find(altKind); kind=altKind; } if (!hlEntry) // highlighted item not found in the index! -> just show the level 1 index... { @@ -2484,10 +2546,10 @@ static void writeDefaultQuickLinks(std::ostream &t,bool compact, void HtmlGenerator::endQuickIndices() { - t << "</div><!-- top -->\n"; + m_t << "</div><!-- top -->\n"; } -QCString HtmlGenerator::writeSplitBarAsString(const char *name,const char *relpath) +QCString HtmlGenerator::writeSplitBarAsString(const QCString &name,const QCString &relpath) { bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); QCString result; @@ -2495,62 +2557,62 @@ QCString HtmlGenerator::writeSplitBarAsString(const char *name,const char *relpa if (generateTreeView) { result = QCString( - "<div id=\"side-nav\" class=\"ui-resizable side-nav-resizable\">\n" - " <div id=\"nav-tree\">\n" - " <div id=\"nav-tree-contents\">\n" - " <div id=\"nav-sync\" class=\"sync\"></div>\n" - " </div>\n" - " </div>\n" - " <div id=\"splitbar\" style=\"-moz-user-select:none;\" \n" - " class=\"ui-resizable-handle\">\n" - " </div>\n" - "</div>\n" - "<script type=\"text/javascript\">\n" - "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n" - "$(document).ready(function(){initNavTree('") + - QCString(addHtmlExtensionIfMissing(name)) + - QCString("','") + relpath + - QCString("'); initResizable(); });\n" - "/* @license-end */\n" - "</script>\n" - "<div id=\"doc-content\">\n"); + "<div id=\"side-nav\" class=\"ui-resizable side-nav-resizable\">\n" + " <div id=\"nav-tree\">\n" + " <div id=\"nav-tree-contents\">\n" + " <div id=\"nav-sync\" class=\"sync\"></div>\n" + " </div>\n" + " </div>\n" + " <div id=\"splitbar\" style=\"-moz-user-select:none;\" \n" + " class=\"ui-resizable-handle\">\n" + " </div>\n" + "</div>\n" + "<script type=\"text/javascript\">\n" + "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n" + "$(document).ready(function(){initNavTree('") + + QCString(addHtmlExtensionIfMissing(name)) + + QCString("','") + relpath + + QCString("'); initResizable(); });\n" + "/* @license-end */\n" + "</script>\n" + "<div id=\"doc-content\">\n"); } return result; } -void HtmlGenerator::writeSplitBar(const char *name) +void HtmlGenerator::writeSplitBar(const QCString &name) { - t << writeSplitBarAsString(name,m_relPath); + m_t << writeSplitBarAsString(name,m_relPath); } -void HtmlGenerator::writeNavigationPath(const char *s) +void HtmlGenerator::writeNavigationPath(const QCString &s) { - t << substitute(s,"$relpath^",m_relPath); + m_t << substitute(s,"$relpath^",m_relPath); } void HtmlGenerator::startContents() { - t << "<div class=\"contents\">\n"; + m_t << "<div class=\"contents\">\n"; } void HtmlGenerator::endContents() { - t << "</div><!-- contents -->\n"; + m_t << "</div><!-- contents -->\n"; } -void HtmlGenerator::startPageDoc(const char *pageTitle) +void HtmlGenerator::startPageDoc(const QCString &pageTitle) { - t << "<div>"; + m_t << "<div>"; } void HtmlGenerator::endPageDoc() { - t << "</div><!-- PageDoc -->\n"; + m_t << "</div><!-- PageDoc -->\n"; } -void HtmlGenerator::writeQuickLinks(bool compact,HighlightedItem hli,const char *file) +void HtmlGenerator::writeQuickLinks(bool compact,HighlightedItem hli,const QCString &file) { - writeDefaultQuickLinks(t,compact,hli,file,m_relPath); + writeDefaultQuickLinks(m_t,compact,hli,file,m_relPath); } // PHP based search script @@ -2563,9 +2625,10 @@ void HtmlGenerator::writeSearchPage() // OPENSEARCH_PROVIDER { QCString configFileName = htmlOutput+"/search_config.php"; - std::ofstream t(configFileName.str(),std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + std::ofstream f(configFileName.str(),std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); t << "<?php\n\n"; t << "$config = array(\n"; t << " 'PROJECT_NAME' => \"" << convertToHtml(projectName) << "\",\n"; @@ -2586,16 +2649,17 @@ void HtmlGenerator::writeSearchPage() t << ");\n\n"; t << "?>\n"; } - t.close(); + f.close(); ResourceMgr::instance().copyResource("search_functions.php",htmlOutput); ResourceMgr::instance().copyResource("search_opensearch.php",htmlOutput); // OPENSEARCH_PROVIDER } QCString fileName = htmlOutput+"/search.php"; - t.open(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + f.open(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); t << substituteHtmlKeywords(g_header,"Search",""); t << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " @@ -2608,7 +2672,7 @@ void HtmlGenerator::writeSearchPage() t << "</script>\n"; if (!Config_getBool(DISABLE_INDEX)) { - writeDefaultQuickLinks(t,TRUE,HLI_Search,0,""); + writeDefaultQuickLinks(t,TRUE,HLI_Search,QCString(),QCString()); } else { @@ -2628,17 +2692,18 @@ void HtmlGenerator::writeSearchPage() writePageFooter(t,"Search","",""); } - t.close(); + f.close(); QCString scriptName = htmlOutput+"/search/search.js"; - t.open(scriptName.str(),std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + f.open(scriptName.str(),std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); t << ResourceMgr::instance().getAsString("extsearch.js"); } else { - err("Failed to open file '%s' for writing...\n",scriptName.data()); + err("Failed to open file '%s' for writing...\n",qPrint(scriptName)); } } @@ -2647,9 +2712,10 @@ void HtmlGenerator::writeExternalSearchPage() bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); QCString dname = Config_getString(HTML_OUTPUT); QCString fileName = dname+"/search"+Doxygen::htmlFileExtension; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); t << substituteHtmlKeywords(g_header,"Search",""); t << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " @@ -2662,7 +2728,7 @@ void HtmlGenerator::writeExternalSearchPage() t << "</script>\n"; if (!Config_getBool(DISABLE_INDEX)) { - writeDefaultQuickLinks(t,TRUE,HLI_Search,0,""); + writeDefaultQuickLinks(t,TRUE,HLI_Search,QCString(),QCString()); t << " <input type=\"text\" id=\"MSearchField\" name=\"query\" value=\"\" size=\"20\" accesskey=\"S\" onfocus=\"searchBox.OnSearchFieldFocus(true)\" onblur=\"searchBox.OnSearchFieldFocus(false)\"/>\n"; t << " </form>\n"; t << " </div><div class=\"right\"></div>\n"; @@ -2695,12 +2761,13 @@ void HtmlGenerator::writeExternalSearchPage() writePageFooter(t,"Search","",""); } - t.close(); + f.close(); QCString scriptName = dname+"/search/search.js"; - t.open(scriptName.str(),std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + f.open(scriptName.str(),std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); t << "var searchResultsText=[" << "\"" << theTranslator->trSearchResults(0) << "\"," << "\"" << theTranslator->trSearchResults(1) << "\"," @@ -2742,185 +2809,185 @@ void HtmlGenerator::writeExternalSearchPage() } else { - err("Failed to open file '%s' for writing...\n",scriptName.data()); + err("Failed to open file '%s' for writing...\n",qPrint(scriptName)); } } -void HtmlGenerator::startConstraintList(const char *header) +void HtmlGenerator::startConstraintList(const QCString &header) { - t << "<div class=\"typeconstraint\">\n"; - t << "<dl><dt><b>" << header << "</b></dt><dd>\n"; - t << "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\">\n"; + m_t << "<div class=\"typeconstraint\">\n"; + m_t << "<dl><dt><b>" << header << "</b></dt><dd>\n"; + m_t << "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\">\n"; } void HtmlGenerator::startConstraintParam() { - t << "<tr><td valign=\"top\"><em>"; + m_t << "<tr><td valign=\"top\"><em>"; } void HtmlGenerator::endConstraintParam() { - t << "</em></td>"; + m_t << "</em></td>"; } void HtmlGenerator::startConstraintType() { - t << "<td> :</td><td valign=\"top\"><em>"; + m_t << "<td> :</td><td valign=\"top\"><em>"; } void HtmlGenerator::endConstraintType() { - t << "</em></td>"; + m_t << "</em></td>"; } void HtmlGenerator::startConstraintDocs() { - t << "<td> "; + m_t << "<td> "; } void HtmlGenerator::endConstraintDocs() { - t << "</td></tr>\n"; + m_t << "</td></tr>\n"; } void HtmlGenerator::endConstraintList() { - t << "</table>\n"; - t << "</dd>\n"; - t << "</dl>\n"; - t << "</div>\n"; + m_t << "</table>\n"; + m_t << "</dd>\n"; + m_t << "</dl>\n"; + m_t << "</div>\n"; } -void HtmlGenerator::lineBreak(const char *style) +void HtmlGenerator::lineBreak(const QCString &style) { - if (style) + if (!style.isEmpty()) { - t << "<br class=\"" << style << "\" />\n"; + m_t << "<br class=\"" << style << "\" />\n"; } else { - t << "<br />\n"; + m_t << "<br />\n"; } } void HtmlGenerator::startHeaderSection() { - t << "<div class=\"header\">\n"; + m_t << "<div class=\"header\">\n"; } -void HtmlGenerator::startTitleHead(const char *) +void HtmlGenerator::startTitleHead(const QCString &) { - t << " <div class=\"headertitle\">\n"; + m_t << " <div class=\"headertitle\">\n"; startTitle(); } -void HtmlGenerator::endTitleHead(const char *,const char *) +void HtmlGenerator::endTitleHead(const QCString &,const QCString &) { endTitle(); - t << " </div>\n"; + m_t << " </div>\n"; } void HtmlGenerator::endHeaderSection() { - t << "</div><!--header-->\n"; + m_t << "</div><!--header-->\n"; } void HtmlGenerator::startInlineHeader() { if (m_emptySection) { - t << "<table class=\"memberdecls\">\n"; + m_t << "<table class=\"memberdecls\">\n"; m_emptySection=FALSE; } - t << "<tr><td colspan=\"2\"><h3>"; + m_t << "<tr><td colspan=\"2\"><h3>"; } void HtmlGenerator::endInlineHeader() { - t << "</h3></td></tr>\n"; + m_t << "</h3></td></tr>\n"; } void HtmlGenerator::startMemberDocSimple(bool isEnum) { - DBG_HTML(t << "<!-- startMemberDocSimple -->\n";) - t << "<table class=\"fieldtable\">\n"; - t << "<tr><th colspan=\"" << (isEnum?"2":"3") << "\">"; - t << (isEnum? theTranslator->trEnumerationValues() : + DBG_HTML(m_t << "<!-- startMemberDocSimple -->\n";) + m_t << "<table class=\"fieldtable\">\n"; + m_t << "<tr><th colspan=\"" << (isEnum?"2":"3") << "\">"; + m_t << (isEnum? theTranslator->trEnumerationValues() : theTranslator->trCompoundMembers()) << "</th></tr>\n"; } void HtmlGenerator::endMemberDocSimple(bool) { - DBG_HTML(t << "<!-- endMemberDocSimple -->\n";) - t << "</table>\n"; + DBG_HTML(m_t << "<!-- endMemberDocSimple -->\n";) + m_t << "</table>\n"; } void HtmlGenerator::startInlineMemberType() { - DBG_HTML(t << "<!-- startInlineMemberType -->\n";) - t << "<tr><td class=\"fieldtype\">\n"; + DBG_HTML(m_t << "<!-- startInlineMemberType -->\n";) + m_t << "<tr><td class=\"fieldtype\">\n"; } void HtmlGenerator::endInlineMemberType() { - DBG_HTML(t << "<!-- endInlineMemberType -->\n";) - t << "</td>\n"; + DBG_HTML(m_t << "<!-- endInlineMemberType -->\n";) + m_t << "</td>\n"; } void HtmlGenerator::startInlineMemberName() { - DBG_HTML(t << "<!-- startInlineMemberName -->\n";) - t << "<td class=\"fieldname\">\n"; + DBG_HTML(m_t << "<!-- startInlineMemberName -->\n";) + m_t << "<td class=\"fieldname\">\n"; } void HtmlGenerator::endInlineMemberName() { - DBG_HTML(t << "<!-- endInlineMemberName -->\n";) - t << "</td>\n"; + DBG_HTML(m_t << "<!-- endInlineMemberName -->\n";) + m_t << "</td>\n"; } void HtmlGenerator::startInlineMemberDoc() { - DBG_HTML(t << "<!-- startInlineMemberDoc -->\n";) - t << "<td class=\"fielddoc\">\n"; + DBG_HTML(m_t << "<!-- startInlineMemberDoc -->\n";) + m_t << "<td class=\"fielddoc\">\n"; } void HtmlGenerator::endInlineMemberDoc() { - DBG_HTML(t << "<!-- endInlineMemberDoc -->\n";) - t << "</td></tr>\n"; + DBG_HTML(m_t << "<!-- endInlineMemberDoc -->\n";) + m_t << "</td></tr>\n"; } void HtmlGenerator::startLabels() { - DBG_HTML(t << "<!-- startLabels -->\n";) - t << "<span class=\"mlabels\">"; + DBG_HTML(m_t << "<!-- startLabels -->\n";) + m_t << "<span class=\"mlabels\">"; } -void HtmlGenerator::writeLabel(const char *l,bool /*isLast*/) +void HtmlGenerator::writeLabel(const QCString &l,bool /*isLast*/) { - DBG_HTML(t << "<!-- writeLabel(" << l << ") -->\n";) - //t << "<tt>[" << l << "]</tt>"; - //if (!isLast) t << ", "; - t << "<span class=\"mlabel\">" << l << "</span>"; + DBG_HTML(m_t << "<!-- writeLabel(" << l << ") -->\n";) + //m_t << "<tt>[" << l << "]</tt>"; + //if (!isLast) m_t << ", "; + m_t << "<span class=\"mlabel\">" << l << "</span>"; } void HtmlGenerator::endLabels() { - DBG_HTML(t << "<!-- endLabels -->\n";) - t << "</span>"; + DBG_HTML(m_t << "<!-- endLabels -->\n";) + m_t << "</span>"; } void HtmlGenerator::writeInheritedSectionTitle( - const char *id, const char *ref, - const char *file, const char *anchor, - const char *title, const char *name) + const QCString &id, const QCString &ref, + const QCString &file, const QCString &anchor, + const QCString &title, const QCString &name) { - DBG_HTML(t << "<!-- writeInheritedSectionTitle -->\n";) + DBG_HTML(m_t << "<!-- writeInheritedSectionTitle -->\n";) QCString a = anchor; if (!a.isEmpty()) a.prepend("#"); QCString classLink = QCString("<a class=\"el\" "); - if (ref) + if (!ref.isEmpty()) { classLink+= externalLinkTarget(); classLink += " href=\""; @@ -2933,49 +3000,49 @@ void HtmlGenerator::writeInheritedSectionTitle( } classLink=classLink+addHtmlExtensionIfMissing(file)+a; classLink+=QCString("\">")+convertToHtml(name,FALSE)+"</a>"; - t << "<tr class=\"inherit_header " << id << "\">" + m_t << "<tr class=\"inherit_header " << id << "\">" << "<td colspan=\"2\" onclick=\"javascript:toggleInherit('" << id << "')\">" << "<img src=\"" << m_relPath << "closed.png\" alt=\"-\"/> " << theTranslator->trInheritedFrom(convertToHtml(title,FALSE),classLink) << "</td></tr>\n"; } -void HtmlGenerator::writeSummaryLink(const char *file,const char *anchor,const char *title,bool first) +void HtmlGenerator::writeSummaryLink(const QCString &file,const QCString &anchor,const QCString &title,bool first) { if (first) { - t << " <div class=\"summary\">\n"; + m_t << " <div class=\"summary\">\n"; } else { - t << " |\n"; + m_t << " |\n"; } - t << "<a href=\""; - if (file) + m_t << "<a href=\""; + if (!file.isEmpty()) { - t << m_relPath << addHtmlExtensionIfMissing(file); + m_t << m_relPath << addHtmlExtensionIfMissing(file); } - else if (anchor) + else if (!anchor.isEmpty()) { - t << "#"; - t << anchor; + m_t << "#"; + m_t << anchor; } - t << "\">"; - t << title; - t << "</a>"; + m_t << "\">"; + m_t << title; + m_t << "</a>"; } -void HtmlGenerator::endMemberDeclaration(const char *anchor,const char *inheritId) +void HtmlGenerator::endMemberDeclaration(const QCString &anchor,const QCString &inheritId) { - t << "<tr class=\"separator:" << (anchor?anchor:""); - if (inheritId) + m_t << "<tr class=\"separator:" << anchor; + if (!inheritId.isEmpty()) { - t << " inherit " << inheritId; + m_t << " inherit " << inheritId; } - t << "\"><td class=\"memSeparator\" colspan=\"2\"> </td></tr>\n"; + m_t << "\"><td class=\"memSeparator\" colspan=\"2\"> </td></tr>\n"; } -void HtmlGenerator::setCurrentDoc(const Definition *context,const char *anchor,bool isSourceFile) +void HtmlGenerator::setCurrentDoc(const Definition *context,const QCString &anchor,bool isSourceFile) { if (Doxygen::searchIndex) { @@ -2983,7 +3050,7 @@ void HtmlGenerator::setCurrentDoc(const Definition *context,const char *anchor,b } } -void HtmlGenerator::addWord(const char *word,bool hiPriority) +void HtmlGenerator::addWord(const QCString &word,bool hiPriority) { if (Doxygen::searchIndex) { diff --git a/src/htmlgen.h b/src/htmlgen.h index df9bc0c..845f259 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -21,42 +21,40 @@ class HtmlCodeGenerator : public CodeOutputInterface { public: - HtmlCodeGenerator(std::ostream &t,const QCString &relPath); - HtmlCodeGenerator(); + HtmlCodeGenerator(TextStream &t,const QCString &relPath); + HtmlCodeGenerator(TextStream &t); int id() const { return m_id; } void setId(int id) { m_id = id; } - void setTextStream(std::ostream &t); void setRelativePath(const QCString &path); - void codify(const char *text); - void writeCodeLink(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip); - void writeTooltip(const char *id, + void codify(const QCString &text); + void writeCodeLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip); + void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, - const char *decl, - const char *desc, + const QCString &decl, + const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo ); - void writeLineNumber(const char *,const char *,const char *,int); + void writeLineNumber(const QCString &,const QCString &,const QCString &,int); void startCodeLine(bool); void endCodeLine(); - void startFontClass(const char *s); + void startFontClass(const QCString &s); void endFontClass(); - void writeCodeAnchor(const char *anchor); - void setCurrentDoc(const Definition *,const char *,bool) {} - void addWord(const char *,bool) {} - void startCodeFragment(const char *style); - void endCodeFragment(const char *); + void writeCodeAnchor(const QCString &anchor); + void setCurrentDoc(const Definition *,const QCString &,bool) {} + void addWord(const QCString &,bool) {} + void startCodeFragment(const QCString &style); + void endCodeFragment(const QCString &); private: - void _writeCodeLink(const char *className, - const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip); - void docify(const char *str); - bool m_streamSet = false; - std::ostream m_t; + void _writeCodeLink(const QCString &className, + const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip); + void docify(const QCString &str); + TextStream &m_t; int m_col = 0; QCString m_relPath; bool m_lineOpen = false; @@ -75,70 +73,70 @@ class HtmlGenerator : public OutputGenerator virtual OutputType type() const { return Html; } static void init(); - static void writeStyleSheetFile(std::ostream &t); - static void writeHeaderFile(std::ostream &t, const char *cssname); - static void writeFooterFile(std::ostream &t); + static void writeStyleSheetFile(TextStream &t); + static void writeHeaderFile(TextStream &t, const QCString &cssname); + static void writeFooterFile(TextStream &t); static void writeTabData(); - static void writeSearchInfo(std::ostream &t,const QCString &relPath); - static void writeSearchData(const char *dir); + static void writeSearchInfo(TextStream &t,const QCString &relPath); + static void writeSearchData(const QCString &dir); static void writeSearchPage(); static void writeExternalSearchPage(); - static QCString writeLogoAsString(const char *path); - static QCString writeSplitBarAsString(const char *name,const char *relpath); + static QCString writeLogoAsString(const QCString &path); + static QCString writeSplitBarAsString(const QCString &name,const QCString &relpath); // ---- CodeOutputInterface - void codify(const char *text) + void codify(const QCString &text) { m_codeGen.codify(text); } - void writeCodeLink(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip) + void writeCodeLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip) { m_codeGen.writeCodeLink(ref,file,anchor,name,tooltip); } - void writeLineNumber(const char *ref,const char *file,const char *anchor,int lineNumber) + void writeLineNumber(const QCString &ref,const QCString &file,const QCString &anchor,int lineNumber) { m_codeGen.writeLineNumber(ref,file,anchor,lineNumber); } - void writeTooltip(const char *id, const DocLinkInfo &docInfo, const char *decl, - const char *desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo + void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, const QCString &decl, + const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo ) { m_codeGen.writeTooltip(id,docInfo,decl,desc,defInfo,declInfo); } void startCodeLine(bool hasLineNumbers) { m_codeGen.startCodeLine(hasLineNumbers); } void endCodeLine() { m_codeGen.endCodeLine(); } - void startFontClass(const char *s) + void startFontClass(const QCString &s) { m_codeGen.startFontClass(s); } void endFontClass() { m_codeGen.endFontClass(); } - void writeCodeAnchor(const char *anchor) + void writeCodeAnchor(const QCString &anchor) { m_codeGen.writeCodeAnchor(anchor); } - void startCodeFragment(const char *style) + void startCodeFragment(const QCString &style) { m_codeGen.startCodeFragment(style); } - void endCodeFragment(const char *style) + void endCodeFragment(const QCString &style) { m_codeGen.endCodeFragment(style); } // --------------------------- - void setCurrentDoc(const Definition *context,const char *anchor,bool isSourceFile); - void addWord(const char *word,bool hiPriority); + void setCurrentDoc(const Definition *context,const QCString &anchor,bool isSourceFile); + void addWord(const QCString &word,bool hiPriority); void writeDoc(DocNode *,const Definition *,const MemberDef *,int id); - void startFile(const char *name,const char *manName,const char *title,int id); - void writeFooter(const char *navPath); + void startFile(const QCString &name,const QCString &manName,const QCString &title,int id); + void writeFooter(const QCString &navPath); void endFile(); void clearBuffer(); void writeSearchInfo(); void startIndexSection(IndexSections) {} void endIndexSection(IndexSections) {} - void writePageLink(const char *,bool) {} + void writePageLink(const QCString &,bool) {} void startProjectNumber(); void endProjectNumber(); void writeStyleInfo(int part); - void startTitleHead(const char *); - void endTitleHead(const char *,const char *); - void startTitle() { t << "<div class=\"title\">"; } - void endTitle() { t << "</div>"; } + void startTitleHead(const QCString &); + void endTitleHead(const QCString &,const QCString &); + void startTitle() { m_t << "<div class=\"title\">"; } + void endTitle() { m_t << "</div>"; } - void startParagraph(const char *classDef); + void startParagraph(const QCString &classDef); void endParagraph(); - void writeString(const char *text); + void writeString(const QCString &text); void startIndexListItem(); void endIndexListItem(); void startIndexList(); @@ -146,32 +144,32 @@ class HtmlGenerator : public OutputGenerator void startIndexKey(); void endIndexKey(); void startIndexValue(bool); - void endIndexValue(const char *,bool); - void startItemList() { t << "<ul>\n"; } - void endItemList() { t << "</ul>\n"; } - void startIndexItem(const char *ref,const char *file); - void endIndexItem(const char *ref,const char *file); - void docify(const char *text); + void endIndexValue(const QCString &,bool); + void startItemList() { m_t << "<ul>\n"; } + void endItemList() { m_t << "</ul>\n"; } + void startIndexItem(const QCString &ref,const QCString &file); + void endIndexItem(const QCString &ref,const QCString &file); + void docify(const QCString &text); - void writeObjectLink(const char *ref,const char *file, - const char *anchor,const char *name); + void writeObjectLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name); - void startTextLink(const char *file,const char *anchor); + void startTextLink(const QCString &file,const QCString &anchor); void endTextLink(); - void startHtmlLink(const char *url); + void startHtmlLink(const QCString &url); void endHtmlLink(); - void startTypewriter() { t << "<code>"; } - void endTypewriter() { t << "</code>"; } + void startTypewriter() { m_t << "<code>"; } + void endTypewriter() { m_t << "</code>"; } void startGroupHeader(int); void endGroupHeader(int); - void startItemListItem() { t << "<li>"; } - void endItemListItem() { t << "</li>\n"; } + void startItemListItem() { m_t << "<li>"; } + void endItemListItem() { m_t << "</li>\n"; } void startMemberSections(); void endMemberSections(); void startHeaderSection(); void endHeaderSection(); - void startMemberHeader(const char *, int); + void startMemberHeader(const QCString &, int); void endMemberHeader(); void startMemberSubtitle(); void endMemberSubtitle(); @@ -183,10 +181,12 @@ class HtmlGenerator : public OutputGenerator void endInlineHeader(); void startAnonTypeScope(int) {} void endAnonTypeScope(int) {} - void startMemberItem(const char *anchor,int,const char *inheritId); + void startMemberItem(const QCString &anchor,int,const QCString &inheritId); void endMemberItem(); void startMemberTemplateParams(); - void endMemberTemplateParams(const char *anchor,const char *inheritId); + void endMemberTemplateParams(const QCString &anchor,const QCString &inheritId); + void startCompoundTemplateParams(); + void endCompoundTemplateParams(); void startMemberGroupHeader(bool); void endMemberGroupHeader(); @@ -197,77 +197,77 @@ class HtmlGenerator : public OutputGenerator void insertMemberAlign(bool); void insertMemberAlignLeft(int,bool); - void startMemberDescription(const char *anchor,const char *inheritId, bool typ); + void startMemberDescription(const QCString &anchor,const QCString &inheritId, bool typ); void endMemberDescription(); void startMemberDeclaration() {} - void endMemberDeclaration(const char *anchor,const char *inheritId); - void writeInheritedSectionTitle(const char *id, const char *ref, - const char *file, const char *anchor, - const char *title,const char *name); + void endMemberDeclaration(const QCString &anchor,const QCString &inheritId); + void writeInheritedSectionTitle(const QCString &id, const QCString &ref, + const QCString &file, const QCString &anchor, + const QCString &title,const QCString &name); - void writeRuler() { t << "<hr/>"; } - void writeAnchor(const char *,const char *name) - { t << "<a name=\"" << name <<"\" id=\"" << name << "\"></a>"; } - void startEmphasis() { t << "<em>"; } - void endEmphasis() { t << "</em>"; } - void startBold() { t << "<b>"; } - void endBold() { t << "</b>"; } - void startDescription() { t << "\n<dl>\n"; } - void endDescription() { t << "\n</dl>\n\n"; } - void startDescItem() { t << "<dt>"; } - void endDescItem() { t << "</dt>"; } - void startDescForItem() { t << "<dd>"; } - void endDescForItem() { t << "</dd>\n"; } - void lineBreak(const char *style); + void writeRuler() { m_t << "<hr/>"; } + void writeAnchor(const QCString &,const QCString &name) + { m_t << "<a name=\"" << name <<"\" id=\"" << name << "\"></a>"; } + void startEmphasis() { m_t << "<em>"; } + void endEmphasis() { m_t << "</em>"; } + void startBold() { m_t << "<b>"; } + void endBold() { m_t << "</b>"; } + void startDescription() { m_t << "\n<dl>\n"; } + void endDescription() { m_t << "\n</dl>\n\n"; } + void startDescItem() { m_t << "<dt>"; } + void endDescItem() { m_t << "</dt>"; } + void startDescForItem() { m_t << "<dd>"; } + void endDescForItem() { m_t << "</dd>\n"; } + void lineBreak(const QCString &style); void writeChar(char c); - void startMemberDoc(const char *clName, const char *memName, - const char *anchor, const char *title, + void startMemberDoc(const QCString &clName, const QCString &memName, + const QCString &anchor, const QCString &title, int memCount, int memTotal, bool showInline); void endMemberDoc(bool); - void startDoxyAnchor(const char *fName,const char *manName, - const char *anchor,const char *name, - const char *args); - void endDoxyAnchor(const char *fName,const char *anchor); + void startDoxyAnchor(const QCString &fName,const QCString &manName, + const QCString &anchor,const QCString &name, + const QCString &args); + void endDoxyAnchor(const QCString &fName,const QCString &anchor); void writeLatexSpacing() {} - void writeStartAnnoItem(const char *type,const char *file, - const char *path,const char *name); - void writeEndAnnoItem(const char *) { t << "\n"; } - void startSubsection() { t << "<h2>"; } - void endSubsection() { t << "</h2>\n"; } - void startSubsubsection() { t << "<h3>"; } - void endSubsubsection() { t << "</h3>\n"; } - void startCenter() { t << "<center>\n"; } - void endCenter() { t << "</center>\n"; } - void startSmall() { t << "<small>\n"; } - void endSmall() { t << "</small>\n"; } + void writeStartAnnoItem(const QCString &type,const QCString &file, + const QCString &path,const QCString &name); + void writeEndAnnoItem(const QCString &) { m_t << "\n"; } + void startSubsection() { m_t << "<h2>"; } + void endSubsection() { m_t << "</h2>\n"; } + void startSubsubsection() { m_t << "<h3>"; } + void endSubsubsection() { m_t << "</h3>\n"; } + void startCenter() { m_t << "<center>\n"; } + void endCenter() { m_t << "</center>\n"; } + void startSmall() { m_t << "<small>\n"; } + void endSmall() { m_t << "</small>\n"; } void startExamples(); void endExamples(); - void startParamList(ParamListTypes,const char *); + void startParamList(ParamListTypes,const QCString &); void endParamList(); - void startSection(const char *,const char *,SectionType); - void endSection(const char *,SectionType); - void addIndexItem(const char *,const char *); + void startSection(const QCString &,const QCString &,SectionType); + void endSection(const QCString &,SectionType); + void addIndexItem(const QCString &,const QCString &); void startIndent(); void endIndent(); void writeSynopsis() {} void startClassDiagram(); - void endClassDiagram(const ClassDiagram &,const char *,const char *); + void endClassDiagram(const ClassDiagram &,const QCString &,const QCString &); void startPageRef() {} - void endPageRef(const char *,const char *) {} + void endPageRef(const QCString &,const QCString &) {} void startQuickIndices() {} void endQuickIndices(); - void writeSplitBar(const char *name); - void writeNavigationPath(const char *s); + void writeSplitBar(const QCString &name); + void writeNavigationPath(const QCString &s); void writeLogo(); - void writeQuickLinks(bool compact,HighlightedItem hli,const char *file); - void writeSummaryLink(const char *file,const char *anchor,const char *title,bool first); + void writeQuickLinks(bool compact,HighlightedItem hli,const QCString &file); + void writeSummaryLink(const QCString &file,const QCString &anchor,const QCString &title,bool first); void startContents(); void endContents(); - void startPageDoc(const char *pageTitle); + void startPageDoc(const QCString &pageTitle); void endPageDoc(); void writeNonBreakableSpace(int); - void startDescTable(const char *title); + void startDescTable(const QCString &title); void endDescTable(); void startDescTableRow(); void endDescTableRow(); @@ -289,24 +289,24 @@ class HtmlGenerator : public OutputGenerator void writeGraphicalHierarchy(DotGfxHierarchyTable &g); void startTextBlock(bool) - { t << "<div class=\"textblock\">"; } + { m_t << "<div class=\"textblock\">"; } void endTextBlock(bool) - { t << "</div>"; } + { m_t << "</div>"; } void lastIndexPage() {} void startMemberDocPrefixItem(); void endMemberDocPrefixItem(); void startMemberDocName(bool); void endMemberDocName(); - void startParameterType(bool first,const char *key); + void startParameterType(bool first,const QCString &key); void endParameterType(); void startParameterName(bool); void endParameterName(bool last,bool emptyList,bool closeBracket); void startParameterList(bool); void endParameterList(); - virtual void exceptionEntry(const char*,bool); + void exceptionEntry(const QCString &,bool); - void startConstraintList(const char *); + void startConstraintList(const QCString &); void startConstraintParam(); void endConstraintParam(); void startConstraintType(); @@ -325,15 +325,15 @@ class HtmlGenerator : public OutputGenerator void endInlineMemberDoc(); void startLabels(); - void writeLabel(const char *l,bool isLast); + void writeLabel(const QCString &l,bool isLast); void endLabels(); private: - static void writePageFooter(std::ostream &t,const QCString &,const QCString &,const QCString &); + static void writePageFooter(TextStream &t,const QCString &,const QCString &,const QCString &); QCString m_lastTitle; QCString m_lastFile; QCString m_relPath; - void docify(const char *text,bool inHtmlComment); + void docify(const QCString &text,bool inHtmlComment); int m_sectionCount = 0; bool m_emptySection = false; diff --git a/src/htmlhelp.cpp b/src/htmlhelp.cpp index b6816b8..9887616 100644 --- a/src/htmlhelp.cpp +++ b/src/htmlhelp.cpp @@ -49,12 +49,12 @@ class HtmlHelpRecoder void initialize() { - const char *str = Config_getString(CHM_INDEX_ENCODING); - if (!str) str = "CP1250"; // use safe and likely default - m_fromUtf8 = portable_iconv_open(str,"UTF-8"); + QCString str = Config_getString(CHM_INDEX_ENCODING); + if (str.isEmpty()) str = "CP1250"; // use safe and likely default + m_fromUtf8 = portable_iconv_open(str.data(),"UTF-8"); if (m_fromUtf8==m_iconv_null) { - term("unsupported character conversion for CHM_INDEX_ENCODING: '%s'->'UTF-8'\n", str); + term("unsupported character conversion for CHM_INDEX_ENCODING: '%s'->'UTF-8'\n", qPrint(str)); } } void finalize() @@ -73,7 +73,7 @@ class HtmlHelpRecoder QCString output(oSize); size_t iLeft = iSize; size_t oLeft = oSize; - char *iPtr = s.rawData(); + const char *iPtr = s.data(); char *oPtr = output.rawData(); if (!portable_iconv(m_fromUtf8,&iPtr,&iLeft,&oPtr,&oLeft)) { @@ -98,7 +98,7 @@ class HtmlHelpRecoder /** Class representing a field in the HTML help index. */ struct IndexField { - IndexField(const char *k,const char *n,const char *u,const char *a,bool l,bool r) : + IndexField(const QCString &k,const QCString &n,const QCString &u,const QCString &a,bool l,bool r) : key(k), name(n), url(u), anchor(a), link(l), reversed(r) {} QCString key; QCString name; @@ -116,8 +116,8 @@ class HtmlHelpIndex public: HtmlHelpIndex(HtmlHelpRecoder &recoder); ~HtmlHelpIndex(); - void addItem(const char *first,const char *second, - const char *url, const char *anchor, + void addItem(const QCString &first,const QCString &second, + const QCString &url, const QCString &anchor, bool hasLink,bool reversed); void writeFields(std::ostream &t); size_t size() const { return m_map.size(); } @@ -149,21 +149,21 @@ HtmlHelpIndex::~HtmlHelpIndex() * \param reversed TRUE if level1 is the member name and level2 the compound * name. */ -void HtmlHelpIndex::addItem(const char *level1,const char *level2, - const char *url,const char *anchor,bool hasLink, +void HtmlHelpIndex::addItem(const QCString &level1,const QCString &level2, + const QCString &url,const QCString &anchor,bool hasLink, bool reversed) { static const reg::Ex re(R"(@\d+)"); - std::string key = level1; - if (level2) key+= std::string("?") + level2; + std::string key = level1.str(); + if (!level2.isEmpty()) key+= std::string("?") + level2.str(); if (reg::search(key,re)) // skip anonymous stuff { return; } std::string key_anchor; - if (anchor) + if (!anchor.isEmpty()) { - key_anchor = key+anchor; + key_anchor = key+anchor.str(); } else { @@ -447,7 +447,7 @@ void HtmlHelp::initialize() p->cts.open(fName.str(),std::ofstream::out | std::ofstream::binary); if (!p->cts.is_open()) { - term("Could not open file %s for writing\n",fName.data()); + term("Could not open file %s for writing\n",qPrint(fName)); } /* Write the header of the contents file */ p->cts << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n" @@ -462,7 +462,7 @@ void HtmlHelp::initialize() p->kts.open(fName.str(),std::ofstream::out | std::ofstream::binary); if (!p->kts.is_open()) { - term("Could not open file %s for writing\n",fName.data()); + term("Could not open file %s for writing\n",qPrint(fName)); } /* Write the header of the contents file */ p->kts << "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n" @@ -482,7 +482,7 @@ QCString HtmlHelp::getLanguageString() auto it = s_languageDict.find(theTranslator->idLanguage().str()); if (it!=s_languageDict.end()) { - return it->second; + return QCString(it->second); } } // default language @@ -559,13 +559,13 @@ void HtmlHelp::Private::createProjectFile() } else { - err("Could not open file %s for writing\n",fName.data()); + err("Could not open file %s for writing\n",qPrint(fName)); } } -void HtmlHelp::addIndexFile(const char *s) +void HtmlHelp::addIndexFile(const QCString &s) { - p->indexFiles.insert(s); + p->indexFiles.insert(s.str()); } /*! Finalizes the HTML help. This will finish and close the @@ -626,10 +626,10 @@ void HtmlHelp::decContentsDepth() * \param def not used. */ void HtmlHelp::addContentsItem(bool isDir, - const char *name, - const char * /*ref*/, - const char *file, - const char *anchor, + const QCString &name, + const QCString & /*ref*/, + const QCString &file, + const QCString &anchor, bool /* separateIndex */, bool /* addToNavIndex */, const Definition * /* def */) @@ -647,9 +647,9 @@ void HtmlHelp::addContentsItem(bool isDir, int i; for (i=0;i<p->dc;i++) p->cts << " "; p->cts << "<LI><OBJECT type=\"text/sitemap\">"; p->cts << "<param name=\"Name\" value=\"" << convertToHtml(p->recoder.recode(name),TRUE) << "\">"; - if (file) // made file optional param - KPW + if (!file.isEmpty()) // made file optional param - KPW { - if (file && (file[0]=='!' || file[0]=='^')) // special markers for user defined URLs + if (file[0]=='!' || file[0]=='^') // special markers for user defined URLs { p->cts << "<param name=\""; if (file[0]=='^') p->cts << "URL"; else p->cts << "Local"; @@ -660,7 +660,7 @@ void HtmlHelp::addContentsItem(bool isDir, { p->cts << "<param name=\"Local\" value=\""; p->cts << file << Doxygen::htmlFileExtension; - if (anchor) p->cts << "#" << anchor; + if (!anchor.isEmpty()) p->cts << "#" << anchor; } p->cts << "\">"; } @@ -679,7 +679,7 @@ void HtmlHelp::addContentsItem(bool isDir, void HtmlHelp::addIndexItem(const Definition *context,const MemberDef *md, - const char *sectionAnchor,const char *word) + const QCString §ionAnchor,const QCString &word) { if (md) { @@ -699,19 +699,19 @@ void HtmlHelp::addIndexItem(const Definition *context,const MemberDef *md, QCString level2 = md->name(); QCString contRef = separateMemberPages ? cfname : cfiname; QCString memRef = cfname; - QCString anchor = sectionAnchor ? QCString(sectionAnchor) : md->anchor(); + QCString anchor = !sectionAnchor.isEmpty() ? sectionAnchor : md->anchor(); p->index.addItem(level1,level2,contRef,anchor,TRUE,FALSE); p->index.addItem(level2,level1,memRef,anchor,TRUE,TRUE); } else if (context) { - QCString level1 = word ? QCString(word) : context->name(); - p->index.addItem(level1,0,context->getOutputFileBase(),sectionAnchor,TRUE,FALSE); + QCString level1 = !word.isEmpty() ? word : context->name(); + p->index.addItem(level1,QCString(),context->getOutputFileBase(),sectionAnchor,TRUE,FALSE); } } -void HtmlHelp::addImageFile(const char *fileName) +void HtmlHelp::addImageFile(const QCString &fileName) { - p->imageFiles.insert(fileName); + p->imageFiles.insert(fileName.str()); } diff --git a/src/htmlhelp.h b/src/htmlhelp.h index 421320e..9d8eea5 100644 --- a/src/htmlhelp.h +++ b/src/htmlhelp.h @@ -66,18 +66,18 @@ class HtmlHelp : public IndexIntf void incContentsDepth(); void decContentsDepth(); void addContentsItem(bool isDir, - const char *name, - const char *ref, - const char *file, - const char *anchor, + const QCString &name, + const QCString &ref, + const QCString &file, + const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def); void addIndexItem(const Definition *context,const MemberDef *md, - const char *sectionAnchor, const char *title); - void addIndexFile(const char *name); - void addImageFile(const char *); - void addStyleSheetFile(const char *) {} + const QCString §ionAnchor, const QCString &title); + void addIndexFile(const QCString &name); + void addImageFile(const QCString &); + void addStyleSheetFile(const QCString &) {} static QCString getLanguageString(); private: diff --git a/src/image.cpp b/src/image.cpp index 033332f..0b353a9 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -297,12 +297,13 @@ void Image::writeChar(uint x,uint y,char c,uchar fg) } } -void Image::writeString(uint x,uint y,const char *s,uchar fg) +void Image::writeString(uint x,uint y,const QCString &s,uchar fg) { - if (s) + if (!s.isEmpty()) { + const char *p = s.data(); char c; - while ((c=*s++)) + while ((c=*p++)) { writeChar(x,y,c,fg); x+=charWidth[c-' ']; @@ -310,13 +311,14 @@ void Image::writeString(uint x,uint y,const char *s,uchar fg) } } -uint Image::stringLength(const char *s) +uint Image::stringLength(const QCString &s) { uint w=0; - if (s) + if (!s.isEmpty()) { + const char *p = s.data(); char c; - while ((c=*s++)) w+=charWidth[c-' ']; + while ((c=*p++)) w+=charWidth[c-' ']; } return w; } @@ -379,7 +381,7 @@ void Image::fillRect(uint x,uint y,uint width,uint height,uchar colIndex,uint ma setPixel(xp,yp,colIndex); } -bool Image::save(const char *fileName,int mode) +bool Image::save(const QCString &fileName,int mode) { static bool useTransparency = Config_getBool(FORMULA_TRANSPARENT); uchar* buffer; @@ -399,7 +401,7 @@ bool Image::save(const char *fileName,int mode) encoder.infoPng.color.colorType = 3; encoder.infoRaw.color.colorType = 3; LodePNG_encode(&encoder, &buffer, &bufferSize, m_data, m_width, m_height); - LodePNG_saveFile(buffer, bufferSize, fileName); + LodePNG_saveFile(buffer, bufferSize, fileName.data()); free(buffer); LodePNG_Encoder_cleanup(&encoder); return TRUE; @@ -504,7 +506,7 @@ ColoredImage::~ColoredImage() free(m_data); } -bool ColoredImage::save(const char *fileName) +bool ColoredImage::save(const QCString &fileName) { uchar *buffer; size_t bufferSize; @@ -513,7 +515,7 @@ bool ColoredImage::save(const char *fileName) encoder.infoPng.color.colorType = m_hasAlpha ? 6 : 2; // 2=RGB 24 bit, 6=RGBA 32 bit encoder.infoRaw.color.colorType = 6; // 6=RGBA 32 bit LodePNG_encode(&encoder, &buffer, &bufferSize, m_data, m_width, m_height); - LodePNG_saveFile(buffer, bufferSize, fileName); + LodePNG_saveFile(buffer, bufferSize, fileName.data()); LodePNG_Encoder_cleanup(&encoder); free(buffer); return TRUE; diff --git a/src/image.h b/src/image.h index 6eb2c21..cbeea87 100644 --- a/src/image.h +++ b/src/image.h @@ -20,6 +20,7 @@ #define _IMAGE_H #include "types.h" +#include "qcstring.h" /** Class representing a bitmap image generated by doxygen. */ class Image @@ -31,19 +32,19 @@ class Image void setPixel(uint x,uint y,uchar val); uchar getPixel(uint x,uint y) const; void writeChar(uint x,uint y,char c,uchar fg); - void writeString(uint x,uint y,const char *s,uchar fg); + void writeString(uint x,uint y,const QCString &s,uchar fg); void drawHorzLine(uint y,uint xs,uint xe,uchar colIndex,uint mask); void drawHorzArrow(uint y,uint xs,uint xe,uchar colIndex,uint mask); void drawVertLine(uint x,uint ys,uint ye,uchar colIndex,uint mask); void drawVertArrow(uint x,uint ys,uint ye,uchar colIndex,uint mask); void drawRect(uint x,uint y,uint width,uint height,uchar colIndex,uint mask); void fillRect(uint x,uint y,uint width,uint height,uchar colIndex,uint mask); - bool save(const char *fileName,int mode=0); - friend uint stringLength(const char *s); + bool save(const QCString &fileName,int mode=0); + friend uint stringLength(const QCString &s); uint width() const { return m_width; } uint height() const { return m_height; } uchar *data() const { return m_data; } - static uint stringLength(const char *s); + static uint stringLength(const QCString &s); private: uint m_width; @@ -59,7 +60,7 @@ class ColoredImage const uchar *greyLevels,const uchar *alphaLevels, int saturation,int hue,int gamma); ~ColoredImage(); - bool save(const char *fileName); + bool save(const QCString &fileName); static void hsl2rgb(double h,double s,double l, double *pRed,double *pGreen,double *pBlue); private: diff --git a/src/index.cpp b/src/index.cpp index 92c9f37..99942f1 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -67,6 +67,7 @@ int hierarchyExceptions; int documentedFiles; int documentedGroups; int documentedNamespaces; +int documentedConcepts; int indexedPages; int documentedClassMembers[CMHL_Total]; int documentedFileMembers[FMHL_Total]; @@ -80,6 +81,7 @@ static void countFiles(int &htmlFiles,int &files); static int countGroups(); static int countDirs(); static int countNamespaces(); +static int countConcepts(); static int countAnnotatedClasses(int *cp,ClassDef::CompoundType ct); static void countRelatedPages(int &docPages,int &indexPages); @@ -102,6 +104,7 @@ void countDataStructures() countRelatedPages(documentedPages,indexedPages); // "pages" documentedGroups = countGroups(); // "modules" documentedNamespaces = countNamespaces(); // "namespaces" + documentedConcepts = countConcepts(); // "concepts" documentedDirs = countDirs(); // "dirs" // "globals" // "namespacemembers" @@ -187,7 +190,7 @@ static void endQuickIndexList(OutputList &ol) ol.writeString(" </div>\n"); } -static void startQuickIndexItem(OutputList &ol,const char *l, +static void startQuickIndexItem(OutputList &ol,const QCString &l, bool hl,bool compact,bool &first) { first=FALSE; @@ -214,7 +217,7 @@ QCString fixSpaces(const QCString &s) return substitute(s," "," "); } -void startTitle(OutputList &ol,const char *fileName,const DefinitionMutable *def) +void startTitle(OutputList &ol,const QCString &fileName,const DefinitionMutable *def) { ol.startHeaderSection(); if (def) def->writeSummaryLinks(ol); @@ -223,16 +226,16 @@ void startTitle(OutputList &ol,const char *fileName,const DefinitionMutable *def ol.disable(OutputGenerator::Man); } -void endTitle(OutputList &ol,const char *fileName,const char *name) +void endTitle(OutputList &ol,const QCString &fileName,const QCString &name) { ol.popGeneratorState(); ol.endTitleHead(fileName,name); ol.endHeaderSection(); } -void startFile(OutputList &ol,const char *name,const char *manName, - const char *title,HighlightedItem hli,bool additionalIndices, - const char *altSidebarName) +void startFile(OutputList &ol,const QCString &name,const QCString &manName, + const QCString &title,HighlightedItem hli,bool additionalIndices, + const QCString &altSidebarName) { static bool disableIndex = Config_getBool(DISABLE_INDEX); ol.startFile(name,manName,title); @@ -245,7 +248,7 @@ void startFile(OutputList &ol,const char *name,const char *manName, { ol.endQuickIndices(); } - ol.writeSplitBar(altSidebarName ? altSidebarName : name); + ol.writeSplitBar(!altSidebarName.isEmpty() ? altSidebarName : name); ol.writeSearchInfo(); } @@ -307,12 +310,12 @@ static void writeMemberToIndex(const Definition *def,const MemberDef *md,bool ad if (md->getOuterScope()==def || md->getOuterScope()==Doxygen::globalScope) { Doxygen::indexList->addContentsItem(isDir, - md->name(),md->getReference(),md->getOutputFileBase(),md->anchor(),FALSE,addToIndex); + md->name(),md->getReference(),md->getOutputFileBase(),md->anchor(),FALSE,addToIndex && md->getGroupDef()==nullptr); } else // inherited member { Doxygen::indexList->addContentsItem(isDir, - md->name(),def->getReference(),def->getOutputFileBase(),md->anchor(),FALSE,addToIndex); + md->name(),def->getReference(),def->getOutputFileBase(),md->anchor(),FALSE,addToIndex && md->getGroupDef()==nullptr); } if (isDir) { @@ -347,7 +350,9 @@ static void writeMemberToIndex(const Definition *def,const MemberDef *md,bool ad template<class T> void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part, const QCString &name,const QCString &anchor, - bool addToIndex=TRUE,bool preventSeparateIndex=FALSE) + bool addToIndex=TRUE,bool preventSeparateIndex=FALSE, + const ConceptLinkedRefMap *concepts = nullptr) + { bool hasMembers = !def->getMemberLists().empty() || !def->getMemberGroups().empty(); Doxygen::indexList->addContentsItem(hasMembers,name, @@ -360,13 +365,22 @@ void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part, { if (cd->isLinkable()) numClasses++; } - //printf("addMembersToIndex(def=%s hasMembers=%d numClasses=%d)\n",def->name().data(),hasMembers,numClasses); - if (hasMembers || numClasses>0) + int numConcepts=0; + if (concepts) + { + for (const auto &cd : *concepts) + { + if (cd->isLinkable()) numConcepts++; + } + } + //printf("addMembersToIndex(def=%s hasMembers=%d numClasses=%d)\n",qPrint(def->name()),hasMembers,numClasses); + if (hasMembers || numClasses>0 || numConcepts>0) { Doxygen::indexList->incContentsDepth(); for (const auto &lde : LayoutDocManager::instance().docEntries(part)) { - if (lde->kind()==LayoutDocEntry::MemberDef) + auto kind = lde->kind(); + if (kind==LayoutDocEntry::MemberDef) { const LayoutDocEntryMemberDef *lmd = (const LayoutDocEntryMemberDef*)lde.get(); MemberList *ml = def->getMemberList(lmd->type); @@ -381,9 +395,9 @@ void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part, } } } - else if (lde->kind()==LayoutDocEntry::NamespaceClasses || - lde->kind()==LayoutDocEntry::FileClasses || - lde->kind()==LayoutDocEntry::ClassNestedClasses + else if (kind==LayoutDocEntry::NamespaceClasses || + kind==LayoutDocEntry::FileClasses || + kind==LayoutDocEntry::ClassNestedClasses ) { for (const auto &cd : def->getClasses()) @@ -392,12 +406,26 @@ void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part, { static bool inlineSimpleStructs = Config_getBool(INLINE_SIMPLE_STRUCTS); bool isNestedClass = def->definitionType()==Definition::TypeClass; - addMembersToIndex(cd,LayoutDocManager::Class,cd->displayName(FALSE),cd->anchor(), + addMembersToIndex(cd,LayoutDocManager::Class,cd->displayName(lde->kind()==LayoutDocEntry::FileClasses),cd->anchor(), addToIndex && (isNestedClass || (cd->isSimple() && inlineSimpleStructs)), preventSeparateIndex || cd->isEmbeddedInOuterScope()); } } } + else if (kind==LayoutDocEntry::FileConcepts && concepts) + { + for (const auto &cd : *concepts) + { + if (cd->isLinkable() && (cd->partOfGroups().empty() || def->definitionType()==Definition::TypeGroup)) + { + Doxygen::indexList->addContentsItem(false,cd->displayName(), + cd->getReference(),cd->getOutputFileBase(),QCString(), + addToIndex, + false, + cd); + } + } + } } Doxygen::indexList->decContentsDepth(); @@ -449,10 +477,10 @@ static void writeClassTreeToOutput(OutputList &ol,const BaseClassList &bcl,int l //printf("Passed...\n"); bool hasChildren = visitedClasses.find(cd)==visitedClasses.end() && classHasVisibleChildren(cd); - //printf("tree4: Has children %s: %d\n",cd->name().data(),hasChildren); + //printf("tree4: Has children %s: %d\n",qPrint(cd->name()),hasChildren); if (cd->isLinkable()) { - //printf("Writing class %s\n",cd->displayName().data()); + //printf("Writing class %s\n",qPrint(cd->displayName())); ol.startIndexItem(cd->getReference(),cd->getOutputFileBase()); ol.parseText(cd->displayName()); ol.endIndexItem(cd->getReference(),cd->getOutputFileBase()); @@ -480,21 +508,21 @@ static void writeClassTreeToOutput(OutputList &ol,const BaseClassList &bcl,int l } else { - ol.startIndexItem(0,0); + ol.startIndexItem(QCString(),QCString()); ol.parseText(cd->name()); - ol.endIndexItem(0,0); + ol.endIndexItem(QCString(),QCString()); if (addToIndex) { - Doxygen::indexList->addContentsItem(hasChildren,cd->displayName(),0,0,0); + Doxygen::indexList->addContentsItem(hasChildren,cd->displayName(),QCString(),QCString(),QCString()); } if (ftv) { - ftv->addContentsItem(hasChildren,cd->displayName(),0,0,0,FALSE,FALSE,cd); + ftv->addContentsItem(hasChildren,cd->displayName(),QCString(),QCString(),QCString(),FALSE,FALSE,cd); } } if (hasChildren) { - //printf("Class %s at %p visited=%d\n",cd->name().data(),cd,cd->visited); + //printf("Class %s at %p visited=%d\n",qPrint(cd->name()),cd,cd->visited); visitedClasses.insert(cd); if (cd->getLanguage()==SrcLangExt_VHDL) { @@ -558,7 +586,7 @@ static void writeDirTreeNode(OutputList &ol, const DirDef *dd, int level, FTVHel { warn(dd->getDefFileName(),dd->getDefLine(), "maximum nesting level exceeded for directory %s: " - "check for possible recursive directory relation!\n",dd->name().data() + "check for possible recursive directory relation!\n",qPrint(dd->name()) ); return; } @@ -573,16 +601,16 @@ static void writeDirTreeNode(OutputList &ol, const DirDef *dd, int level, FTVHel (tocExpand && // or toc expand and !dd->getFiles().empty() // there are files ); - //printf("gd='%s': pageDict=%d\n",gd->name().data(),gd->pageDict->count()); + //printf("gd='%s': pageDict=%d\n",qPrint(gd->name()),gd->pageDict->count()); if (addToIndex) { - Doxygen::indexList->addContentsItem(isDir,dd->shortName(),dd->getReference(),dd->getOutputFileBase(),0,TRUE,TRUE); + Doxygen::indexList->addContentsItem(isDir,dd->shortName(),dd->getReference(),dd->getOutputFileBase(),QCString(),TRUE,TRUE); Doxygen::indexList->incContentsDepth(); } if (ftv) { ftv->addContentsItem(isDir,dd->shortName(),dd->getReference(), - dd->getOutputFileBase(),0,FALSE,TRUE,dd); + dd->getOutputFileBase(),QCString(),FALSE,TRUE,dd); ftv->incContentsDepth(); } @@ -654,7 +682,7 @@ static void writeDirTreeNode(OutputList &ol, const DirDef *dd, int level, FTVHel ftv->addContentsItem(FALSE, fd->displayName(), reference,outputBase, - 0,FALSE,FALSE,fd); + QCString(),FALSE,FALSE,fd); } } } @@ -675,13 +703,14 @@ static void writeDirTreeNode(OutputList &ol, const DirDef *dd, int level, FTVHel doc = fileVisibleInIndex(fd,src); if (doc) { - addMembersToIndex(fd,LayoutDocManager::File,fd->displayName(),QCString(),TRUE); + addMembersToIndex(fd,LayoutDocManager::File,fd->displayName(),QCString(), + TRUE,FALSE,&fd->getConcepts()); } else if (src) { Doxygen::indexList->addContentsItem( - FALSE, fd->name(), 0, - fd->getSourceFileBase(), 0, FALSE, TRUE, fd); + FALSE, fd->name(), QCString(), + fd->getSourceFileBase(), QCString(), FALSE, TRUE, fd); } } } @@ -736,20 +765,20 @@ static void writeDirHierarchy(OutputList &ol, FTVHelp* ftv,bool addToIndex) if (doc || src) { ftv->addContentsItem(FALSE,fd->displayName(), - reference, outputBase, 0, + reference, outputBase, QCString(), FALSE,FALSE,fd.get()); } if (addToIndex) { if (doc) { - addMembersToIndex(fd.get(),LayoutDocManager::File,fd->displayName(),QCString(),TRUE); + addMembersToIndex(fd.get(),LayoutDocManager::File,fd->displayName(),QCString(),TRUE,FALSE,&fd->getConcepts()); } else if (src) { Doxygen::indexList->addContentsItem( - FALSE, fd->name(), 0, - fd->getSourceFileBase(), 0, FALSE, TRUE, fd.get()); + FALSE, fd->name(), QCString(), + fd->getSourceFileBase(), QCString(), FALSE, TRUE, fd.get()); } } } @@ -773,7 +802,7 @@ static void writeClassTreeForList(OutputList &ol,const ClassLinkedMap &cl,bool & for (const auto &cd : cl) { //printf("class %s hasVisibleRoot=%d isVisibleInHierarchy=%d\n", - // cd->name().data(), + // qPrint(cd->name()), // hasVisibleRoot(cd->baseClasses()), // cd->isVisibleInHierarchy() // ); @@ -811,11 +840,11 @@ static void writeClassTreeForList(OutputList &ol,const ClassLinkedMap &cl,bool & ol.startIndexListItem(); bool hasChildren = visitedClasses.find(cd.get())==visitedClasses.end() && classHasVisibleChildren(cd.get()); - //printf("list: Has children %s: %d\n",cd->name().data(),hasChildren); + //printf("list: Has children %s: %d\n",qPrint(cd->name()),hasChildren); if (cd->isLinkable()) { //printf("Writing class %s isLinkable()=%d isLinkableInProject()=%d cd->templateMaster()=%p\n", - // cd->displayName().data(),cd->isLinkable(),cd->isLinkableInProject(),cd->templateMaster()); + // qPrint(cd->displayName()),cd->isLinkable(),cd->isLinkableInProject(),cd->templateMaster()); ol.startIndexItem(cd->getReference(),cd->getOutputFileBase()); ol.parseText(cd->displayName()); ol.endIndexItem(cd->getReference(),cd->getOutputFileBase()); @@ -837,16 +866,16 @@ static void writeClassTreeForList(OutputList &ol,const ClassLinkedMap &cl,bool & } else { - ol.startIndexItem(0,0); + ol.startIndexItem(QCString(),QCString()); ol.parseText(cd->displayName()); - ol.endIndexItem(0,0); + ol.endIndexItem(QCString(),QCString()); if (addToIndex) { - Doxygen::indexList->addContentsItem(hasChildren,cd->displayName(),0,0,0,FALSE,FALSE); + Doxygen::indexList->addContentsItem(hasChildren,cd->displayName(),QCString(),QCString(),QCString(),FALSE,FALSE); } if (ftv) { - ftv->addContentsItem(hasChildren,cd->displayName(),0,0,0,FALSE,FALSE,cd.get()); + ftv->addContentsItem(hasChildren,cd->displayName(),QCString(),QCString(),QCString(),FALSE,FALSE,cd.get()); } } if (cd->getLanguage()==SrcLangExt_VHDL && hasChildren) @@ -938,10 +967,10 @@ static void writeHierarchicalIndex(OutputList &ol) QCString title = lne ? lne->title() : theTranslator->trClassHierarchy(); bool addToIndex = lne==0 || lne->visible(); - startFile(ol,"hierarchy",0, title, HLI_ClassHierarchy); - startTitle(ol,0); + startFile(ol,"hierarchy",QCString(), title, HLI_ClassHierarchy); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); ol.startTextBlock(); @@ -952,7 +981,7 @@ static void writeHierarchicalIndex(OutputList &ol) ol.disable(OutputGenerator::RTF); ol.disable(OutputGenerator::Docbook); ol.startParagraph(); - ol.startTextLink("inherits",0); + ol.startTextLink("inherits",QCString()); ol.parseText(theTranslator->trGotoGraphicalHierarchy()); ol.endTextLink(); ol.endParagraph(); @@ -985,11 +1014,11 @@ static void writeHierarchicalIndex(OutputList &ol) { if (addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,title,0,"hierarchy",0,TRUE,TRUE); + Doxygen::indexList->addContentsItem(TRUE,title,QCString(),"hierarchy",QCString(),TRUE,TRUE); } FTVHelp* ftv = new FTVHelp(FALSE); writeClassHierarchy(ol,ftv,addToIndex,ClassDef::Class); - std::ostringstream t(std::ios_base::ate); + TextStream t; ftv->generateTreeViewInline(t); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -1014,14 +1043,14 @@ static void writeGraphicalClassHierarchy(OutputList &ol) ol.disableAllBut(OutputGenerator::Html); LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::ClassHierarchy); QCString title = lne ? lne->title() : theTranslator->trClassHierarchy(); - startFile(ol,"inherits",0,title,HLI_ClassHierarchy,FALSE,"hierarchy"); - startTitle(ol,0); + startFile(ol,"inherits",QCString(),title,HLI_ClassHierarchy,FALSE,"hierarchy"); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); ol.startTextBlock(); ol.startParagraph(); - ol.startTextLink("hierarchy",0); + ol.startTextLink("hierarchy",QCString()); ol.parseText(theTranslator->trGotoTextualHierarchy()); ol.endTextLink(); ol.endParagraph(); @@ -1045,10 +1074,10 @@ static void writeHierarchicalInterfaceIndex(OutputList &ol) QCString title = lne ? lne->title() : theTranslator->trInterfaceHierarchy(); bool addToIndex = lne==0 || lne->visible(); - startFile(ol,"interfacehierarchy",0, title, HLI_InterfaceHierarchy); - startTitle(ol,0); + startFile(ol,"interfacehierarchy",QCString(), title, HLI_InterfaceHierarchy); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); ol.startTextBlock(); @@ -1057,7 +1086,7 @@ static void writeHierarchicalInterfaceIndex(OutputList &ol) ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::RTF); ol.startParagraph(); - ol.startTextLink("interfaceinherits",0); + ol.startTextLink("interfaceinherits",QCString()); ol.parseText(theTranslator->trGotoGraphicalHierarchy()); ol.endTextLink(); ol.endParagraph(); @@ -1091,11 +1120,11 @@ static void writeHierarchicalInterfaceIndex(OutputList &ol) { if (addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,title,0,"interfacehierarchy",0,TRUE,TRUE); + Doxygen::indexList->addContentsItem(TRUE,title,QCString(),"interfacehierarchy",QCString(),TRUE,TRUE); } FTVHelp* ftv = new FTVHelp(FALSE); writeClassHierarchy(ol,ftv,addToIndex,ClassDef::Interface); - std::ostringstream t(std::ios_base::ate); + TextStream t; ftv->generateTreeViewInline(t); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -1120,14 +1149,14 @@ static void writeGraphicalInterfaceHierarchy(OutputList &ol) ol.disableAllBut(OutputGenerator::Html); LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::InterfaceHierarchy); QCString title = lne ? lne->title() : theTranslator->trInterfaceHierarchy(); - startFile(ol,"interfaceinherits",0,title,HLI_InterfaceHierarchy,FALSE,"interfacehierarchy"); - startTitle(ol,0); + startFile(ol,"interfaceinherits",QCString(),title,HLI_InterfaceHierarchy,FALSE,"interfacehierarchy"); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); ol.startTextBlock(); ol.startParagraph(); - ol.startTextLink("interfacehierarchy",0); + ol.startTextLink("interfacehierarchy",QCString()); ol.parseText(theTranslator->trGotoTextualHierarchy()); ol.endTextLink(); ol.endParagraph(); @@ -1151,10 +1180,10 @@ static void writeHierarchicalExceptionIndex(OutputList &ol) QCString title = lne ? lne->title() : theTranslator->trExceptionHierarchy(); bool addToIndex = lne==0 || lne->visible(); - startFile(ol,"exceptionhierarchy",0, title, HLI_ExceptionHierarchy); - startTitle(ol,0); + startFile(ol,"exceptionhierarchy",QCString(), title, HLI_ExceptionHierarchy); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); ol.startTextBlock(); @@ -1163,7 +1192,7 @@ static void writeHierarchicalExceptionIndex(OutputList &ol) ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::RTF); ol.startParagraph(); - ol.startTextLink("exceptioninherits",0); + ol.startTextLink("exceptioninherits",QCString()); ol.parseText(theTranslator->trGotoGraphicalHierarchy()); ol.endTextLink(); ol.endParagraph(); @@ -1197,11 +1226,11 @@ static void writeHierarchicalExceptionIndex(OutputList &ol) { if (addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,title,0,"exceptionhierarchy",0,TRUE,TRUE); + Doxygen::indexList->addContentsItem(TRUE,title,QCString(),"exceptionhierarchy",QCString(),TRUE,TRUE); } FTVHelp* ftv = new FTVHelp(FALSE); writeClassHierarchy(ol,ftv,addToIndex,ClassDef::Exception); - std::ostringstream t(std::ios_base::ate); + TextStream t; ftv->generateTreeViewInline(t); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -1226,14 +1255,14 @@ static void writeGraphicalExceptionHierarchy(OutputList &ol) ol.disableAllBut(OutputGenerator::Html); LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::ExceptionHierarchy); QCString title = lne ? lne->title() : theTranslator->trExceptionHierarchy(); - startFile(ol,"exceptioninherits",0,title,HLI_ExceptionHierarchy,FALSE,"exceptionhierarchy"); - startTitle(ol,0); + startFile(ol,"exceptioninherits",QCString(),title,HLI_ExceptionHierarchy,FALSE,"exceptionhierarchy"); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); ol.startTextBlock(); ol.startParagraph(); - ol.startTextLink("exceptionhierarchy",0); + ol.startTextLink("exceptionhierarchy",QCString()); ol.parseText(theTranslator->trGotoTextualHierarchy()); ol.endTextLink(); ol.endParagraph(); @@ -1270,7 +1299,7 @@ static void countFiles(int &htmlFiles,int &files) static void writeSingleFileIndex(OutputList &ol,const FileDef *fd) { - //printf("Found filedef %s\n",fd->name().data()); + //printf("Found filedef %s\n",qPrint(fd->name())); bool doc = fd->isLinkableInProject(); bool src = fd->generateSourceFile(); bool nameOk = !fd->isDocumentationFile(); @@ -1279,7 +1308,7 @@ static void writeSingleFileIndex(OutputList &ol,const FileDef *fd) QCString path; if (Config_getBool(FULL_PATH_NAMES)) { - path=stripFromPath(fd->getPath().copy()); + path=stripFromPath(fd->getPath()); } QCString fullName=fd->name(); if (!path.isEmpty()) @@ -1292,7 +1321,7 @@ static void writeSingleFileIndex(OutputList &ol,const FileDef *fd) ol.docify(path); if (doc) { - ol.writeObjectLink(0,fd->getOutputFileBase(),0,fd->name()); + ol.writeObjectLink(QCString(),fd->getOutputFileBase(),QCString(),fd->name()); //if (addToIndex) //{ // addMembersToIndex(fd,LayoutDocManager::File,fullName,QCString()); @@ -1305,7 +1334,7 @@ static void writeSingleFileIndex(OutputList &ol,const FileDef *fd) ol.endBold(); //if (addToIndex) //{ - // Doxygen::indexList->addContentsItem(FALSE,fullName,0,0,0); + // Doxygen::indexList->addContentsItem(FALSE,fullName,QCString(),QCString(),QCString()); //} } if (src) @@ -1313,7 +1342,7 @@ static void writeSingleFileIndex(OutputList &ol,const FileDef *fd) ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); ol.docify(" "); - ol.startTextLink(fd->includeName(),0); + ol.startTextLink(fd->includeName(),QCString()); ol.docify("["); ol.parseText(theTranslator->trCode()); ol.docify("]"); @@ -1332,7 +1361,7 @@ static void writeSingleFileIndex(OutputList &ol,const FileDef *fd) fd->briefDescription(TRUE), FALSE, // index words FALSE, // isExample - 0, // example name + QCString(), // example name TRUE, // single line TRUE, // link from index Config_getBool(MARKDOWN_SUPPORT) @@ -1361,20 +1390,20 @@ static void writeFileIndex(OutputList &ol) QCString title = lne ? lne->title() : theTranslator->trFileList(); bool addToIndex = lne==0 || lne->visible(); - startFile(ol,"files",0,title,HLI_Files); - startTitle(ol,0); + startFile(ol,"files",QCString(),title,HLI_Files); + startTitle(ol,QCString()); //if (!Config_getString(PROJECT_NAME).isEmpty()) //{ // title.prepend(Config_getString(PROJECT_NAME)+" "); //} ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); ol.startTextBlock(); if (addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,title,0,"files",0,TRUE,TRUE); + Doxygen::indexList->addContentsItem(TRUE,title,QCString(),"files",QCString(),TRUE,TRUE); Doxygen::indexList->incContentsDepth(); } @@ -1457,7 +1486,7 @@ static void writeFileIndex(OutputList &ol) FTVHelp* ftv = new FTVHelp(FALSE); writeDirHierarchy(ol,ftv,addToIndex); - std::ostringstream t(std::ios_base::ate); + TextStream t; ftv->generateTreeViewInline(t); ol.writeString(t.str().c_str()); delete ftv; @@ -1486,6 +1515,18 @@ static int countNamespaces() } //---------------------------------------------------------------------------- +static int countConcepts() +{ + int count=0; + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + if (cd->isLinkableInProject()) count++; + } + return count; +} + + +//---------------------------------------------------------------------------- template<typename Ptr> const ClassDef *get_pointer(const Ptr &p); template<> const ClassDef *get_pointer(const ClassLinkedMap::Ptr &p) { return p.get(); } template<> const ClassDef *get_pointer(const ClassLinkedRefMap::Ptr &p) { return p; } @@ -1509,7 +1550,7 @@ static void writeClassTree(const ListType &cl,FTVHelp *ftv,bool addToIndex,bool if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS) { QCString n=cd->name(); - cdm->setClassName(n.data()); + cdm->setClassName(n); } } @@ -1535,7 +1576,8 @@ static void writeClassTree(const ListType &cl,FTVHelp *ftv,bool addToIndex,bool { ftv->addContentsItem(count>0,cd->displayName(FALSE),cd->getReference(), cd->getOutputFileBase(),cd->anchor(),FALSE,TRUE,cd); - if ((cd->getOuterScope()==0 || + if (addToIndex && + (cd->getOuterScope()==0 || cd->getOuterScope()->definitionType()!=Definition::TypeClass ) ) @@ -1543,7 +1585,7 @@ static void writeClassTree(const ListType &cl,FTVHelp *ftv,bool addToIndex,bool addMembersToIndex(cd,LayoutDocManager::Class, cd->displayName(FALSE), cd->anchor(), - addToIndex && cd->partOfGroups().empty() && !cd->isSimple()); + cd->partOfGroups().empty() && !cd->isSimple()); } if (count>0) { @@ -1592,7 +1634,7 @@ static void writeNamespaceMembers(const NamespaceDef *nd,bool addToIndex) { for (const auto &md : *ml) { - //printf(" member %s visible=%d\n",md->name().data(),memberVisibleInIndex(md)); + //printf(" member %s visible=%d\n",qPrint(md->name()),memberVisibleInIndex(md)); if (memberVisibleInIndex(md)) { writeMemberToIndex(nd,md,addToIndex); @@ -1603,6 +1645,7 @@ static void writeNamespaceMembers(const NamespaceDef *nd,bool addToIndex) } } +static void writeConceptList(const ConceptLinkedRefMap &concepts, FTVHelp *ftv,bool addToIndex); static void writeNamespaceTree(const NamespaceLinkedRefMap &nsLinkedMap,FTVHelp *ftv, bool rootOnly,bool addToIndex); @@ -1614,11 +1657,12 @@ static void writeNamespaceTreeElement(const NamespaceDef *nd,FTVHelp *ftv, { bool hasChildren = namespaceHasNestedNamespace(nd) || - namespaceHasNestedClass(nd,false,ClassDef::Class); + namespaceHasNestedClass(nd,false,ClassDef::Class) || + namespaceHasNestedConcept(nd); bool isLinkable = nd->isLinkableInProject(); int visibleMembers = countVisibleMembers(nd); - //printf("namespace %s hasChildren=%d visibleMembers=%d\n",nd->name().data(),hasChildren,visibleMembers); + //printf("namespace %s hasChildren=%d visibleMembers=%d\n",qPrint(nd->name()),hasChildren,visibleMembers); QCString ref; QCString file; @@ -1635,25 +1679,24 @@ static void writeNamespaceTreeElement(const NamespaceDef *nd,FTVHelp *ftv, bool isDir = hasChildren || visibleMembers>0; if ((isLinkable) || isDir) { - ftv->addContentsItem(hasChildren,nd->localName(),ref,file,0,FALSE,TRUE,nd); + ftv->addContentsItem(hasChildren,nd->localName(),ref,file,QCString(),FALSE,nd->partOfGroups().empty(),nd); if (addToIndex) { Doxygen::indexList->addContentsItem(isDir,nd->localName(),ref,file,QCString(), - hasChildren && !file.isEmpty(),addToIndex); + hasChildren && !file.isEmpty(),nd->partOfGroups().empty()); } if (addToIndex && isDir) { Doxygen::indexList->incContentsDepth(); } - //printf("*** writeNamespaceTree count=%d addToIndex=%d false=%d classCount=%d\n", - // count,addToIndex,false,classCount); if (isDir) { ftv->incContentsDepth(); writeNamespaceTree(nd->getNamespaces(),ftv,FALSE,addToIndex); - writeClassTree(nd->getClasses(),ftv,FALSE,FALSE,ClassDef::Class); + writeClassTree(nd->getClasses(),ftv,addToIndex,FALSE,ClassDef::Class); + writeConceptList(nd->getConcepts(),ftv,addToIndex); writeNamespaceMembers(nd,addToIndex); ftv->decContentsDepth(); } @@ -1696,7 +1739,7 @@ static void writeClassTreeInsideNamespaceElement(const NamespaceDef *nd,FTVHelp bool isDir = namespaceHasNestedClass(nd,sliceOpt,ct); bool isLinkable = nd->isLinkableInProject(); - //printf("namespace %s isDir=%d\n",nd->name().data(),isDir); + //printf("namespace %s isDir=%d\n",qPrint(nd->name()),isDir); QCString ref; QCString file; @@ -1712,7 +1755,7 @@ static void writeClassTreeInsideNamespaceElement(const NamespaceDef *nd,FTVHelp if (isDir) { - ftv->addContentsItem(isDir,nd->localName(),ref,file,0,FALSE,TRUE,nd); + ftv->addContentsItem(isDir,nd->localName(),ref,file,QCString(),FALSE,TRUE,nd); if (addToIndex) { @@ -1786,10 +1829,10 @@ static void writeNamespaceIndex(OutputList &ol) if (lne==0) lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Namespaces); // fall back QCString title = lne ? lne->title() : theTranslator->trNamespaceList(); bool addToIndex = lne==0 || lne->visible(); - startFile(ol,"namespaces",0,title,HLI_Namespaces); - startTitle(ol,0); + startFile(ol,"namespaces",QCString(),title,HLI_Namespaces); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); ol.startTextBlock(); ol.parseText(lne ? lne->intro() : theTranslator->trNamespaceListDescription(Config_getBool(EXTRACT_ALL))); @@ -1816,11 +1859,11 @@ static void writeNamespaceIndex(OutputList &ol) ol.startIndexKey(); if (nd->getLanguage()==SrcLangExt_VHDL) { - ol.writeObjectLink(0, nd->getOutputFileBase().replace(0,qstrlen("namespace"),"class"),0,nd->displayName()); + ol.writeObjectLink(QCString(), nd->getOutputFileBase().replace(0,qstrlen("namespace"),"class"),QCString(),nd->displayName()); } else { - ol.writeObjectLink(0,nd->getOutputFileBase(),0,nd->displayName()); + ol.writeObjectLink(QCString(),nd->getOutputFileBase(),QCString(),nd->displayName()); } ol.endIndexKey(); @@ -1835,7 +1878,7 @@ static void writeNamespaceIndex(OutputList &ol) nd->briefDescription(TRUE), FALSE, // index words FALSE, // isExample - 0, // example name + QCString(), // example name TRUE, // single line TRUE, // link from index Config_getBool(MARKDOWN_SUPPORT) @@ -1859,12 +1902,12 @@ static void writeNamespaceIndex(OutputList &ol) { if (addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,title,0,"namespaces",0,TRUE,TRUE); + Doxygen::indexList->addContentsItem(TRUE,title,QCString(),"namespaces",QCString(),TRUE,TRUE); Doxygen::indexList->incContentsDepth(); } FTVHelp* ftv = new FTVHelp(FALSE); writeNamespaceTree(*Doxygen::namespaceLinkedMap,ftv,TRUE,addToIndex); - std::ostringstream t(std::ios_base::ate); + TextStream t; ftv->generateTreeViewInline(t); ol.writeString(t.str().c_str()); delete ftv; @@ -1949,10 +1992,10 @@ static void writeAnnotatedClassList(OutputList &ol,ClassDef::CompoundType ct) if (cd->getLanguage()==SrcLangExt_VHDL) { QCString prot= VhdlDocGen::getProtectionName((VhdlDocGen::VhdlClasses)cd->protection()); - ol.docify(prot.data()); + ol.docify(prot); ol.writeString(" "); } - ol.writeObjectLink(0,cd->getOutputFileBase(),cd->anchor(),cd->displayName()); + ol.writeObjectLink(QCString(),cd->getOutputFileBase(),cd->anchor(),cd->displayName()); ol.endIndexKey(); bool hasBrief = !cd->briefDescription().isEmpty(); ol.startIndexValue(hasBrief); @@ -1964,7 +2007,7 @@ static void writeAnnotatedClassList(OutputList &ol,ClassDef::CompoundType ct) cd->briefDescription(TRUE), FALSE, // indexWords FALSE, // isExample - 0, // example name + QCString(), // example name TRUE, // single line TRUE, // link from index Config_getBool(MARKDOWN_SUPPORT) @@ -1987,10 +2030,10 @@ inline bool isId1(int c) return (c<127 && c>31); // printable ASCII character } -static QCString letterToLabel(const char *startLetter) +static QCString letterToLabel(const QCString &startLetter) { - const char *p = startLetter; - if (startLetter==0 || *startLetter==0) return ""; + if (startLetter.isEmpty()) return startLetter; + const char *p = startLetter.data(); char c = *p; QCString result; if (isId1(c)) @@ -2071,9 +2114,9 @@ static void writeAlphabeticalClassList(OutputList &ol, ClassDef::CompoundType ct if (!first) alphaLinks += " | "; first=false; QCString li = letterToLabel(letter.c_str()); - alphaLinks += (QCString)"<a class=\"qindex\" href=\"#letter_" + + alphaLinks += "<a class=\"qindex\" href=\"#letter_" + li + "\">" + - letter + "</a>"; + QCString(letter) + "</a>"; } alphaLinks += "</div>\n"; ol.writeString(alphaLinks); @@ -2172,7 +2215,7 @@ static void writeAlphabeticalClassList(OutputList &ol, ClassDef::CompoundType ct if (nd && nd->isLinkable()) { ol.writeObjectLink(nd->getReference(), - nd->getOutputFileBase(),0,nsDispName); + nd->getOutputFileBase(),QCString(),nsDispName); } else { @@ -2200,15 +2243,15 @@ static void writeAlphabeticalIndex(OutputList &ol) QCString title = lne ? lne->title() : theTranslator->trCompoundIndex(); bool addToIndex = lne==0 || lne->visible(); - startFile(ol,"classes",0,title,HLI_Classes); + startFile(ol,"classes",QCString(),title,HLI_Classes); - startTitle(ol,0); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); if (addToIndex) { - Doxygen::indexList->addContentsItem(FALSE,title,0,"classes",0,FALSE,TRUE); + Doxygen::indexList->addContentsItem(FALSE,title,QCString(),"classes",QCString(),FALSE,TRUE); } ol.startContents(); @@ -2229,15 +2272,15 @@ static void writeAlphabeticalInterfaceIndex(OutputList &ol) QCString title = lne ? lne->title() : theTranslator->trInterfaceIndex(); bool addToIndex = lne==0 || lne->visible(); - startFile(ol,"interfaces",0,title,HLI_Interfaces); + startFile(ol,"interfaces",QCString(),title,HLI_Interfaces); - startTitle(ol,0); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); if (addToIndex) { - Doxygen::indexList->addContentsItem(FALSE,title,0,"interfaces",0,FALSE,TRUE); + Doxygen::indexList->addContentsItem(FALSE,title,QCString(),"interfaces",QCString(),FALSE,TRUE); } ol.startContents(); @@ -2258,15 +2301,15 @@ static void writeAlphabeticalStructIndex(OutputList &ol) QCString title = lne ? lne->title() : theTranslator->trStructIndex(); bool addToIndex = lne==0 || lne->visible(); - startFile(ol,"structs",0,title,HLI_Structs); + startFile(ol,"structs",QCString(),title,HLI_Structs); - startTitle(ol,0); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); if (addToIndex) { - Doxygen::indexList->addContentsItem(FALSE,title,0,"structs",0,FALSE,TRUE); + Doxygen::indexList->addContentsItem(FALSE,title,QCString(),"structs",QCString(),FALSE,TRUE); } ol.startContents(); @@ -2287,15 +2330,15 @@ static void writeAlphabeticalExceptionIndex(OutputList &ol) QCString title = lne ? lne->title() : theTranslator->trExceptionIndex(); bool addToIndex = lne==0 || lne->visible(); - startFile(ol,"exceptions",0,title,HLI_Exceptions); + startFile(ol,"exceptions",QCString(),title,HLI_Exceptions); - startTitle(ol,0); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); if (addToIndex) { - Doxygen::indexList->addContentsItem(FALSE,title,0,"exceptions",0,FALSE,TRUE); + Doxygen::indexList->addContentsItem(FALSE,title,QCString(),"exceptions",QCString(),FALSE,TRUE); } ol.startContents(); @@ -2350,11 +2393,11 @@ static void writeAnnotatedIndexGeneric(OutputList &ol,const AnnotatedIndexContex QCString title = lne ? lne->title() : ctx.listDefaultTitleText; bool addToIndex = lne==0 || lne->visible(); - startFile(ol,ctx.fileBaseName,0,title,ctx.hiItem); + startFile(ol,ctx.fileBaseName,QCString(),title,ctx.hiItem); - startTitle(ol,0); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); @@ -2383,13 +2426,13 @@ static void writeAnnotatedIndexGeneric(OutputList &ol,const AnnotatedIndexContex { if (addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,title,0,ctx.fileBaseName,0,TRUE,TRUE); + Doxygen::indexList->addContentsItem(TRUE,title,QCString(),ctx.fileBaseName,QCString(),TRUE,TRUE); Doxygen::indexList->incContentsDepth(); } FTVHelp ftv(false); writeClassTreeInsideNamespace(*Doxygen::namespaceLinkedMap,&ftv,TRUE,addToIndex,ctx.compoundType); writeClassTree(*Doxygen::classLinkedMap,&ftv,addToIndex,TRUE,ctx.compoundType); - std::ostringstream t(std::ios_base::ate); + TextStream t; ftv.generateTreeViewInline(t); ol.writeString(t.str().c_str()); if (addToIndex) @@ -2462,7 +2505,7 @@ static void writeAnnotatedExceptionIndex(OutputList &ol) } //---------------------------------------------------------------------------- -static void writeClassLinkForMember(OutputList &ol,const MemberDef *md,const char *separator, +static void writeClassLinkForMember(OutputList &ol,const MemberDef *md,const QCString &separator, QCString &prevClassName) { const ClassDef *cd=md->getClassDef(); @@ -2476,7 +2519,7 @@ static void writeClassLinkForMember(OutputList &ol,const MemberDef *md,const cha } } -static void writeFileLinkForMember(OutputList &ol,const MemberDef *md,const char *separator, +static void writeFileLinkForMember(OutputList &ol,const MemberDef *md,const QCString &separator, QCString &prevFileName) { const FileDef *fd=md->getFileDef(); @@ -2490,7 +2533,7 @@ static void writeFileLinkForMember(OutputList &ol,const MemberDef *md,const char } } -static void writeNamespaceLinkForMember(OutputList &ol,const MemberDef *md,const char *separator, +static void writeNamespaceLinkForMember(OutputList &ol,const MemberDef *md,const QCString &separator, QCString &prevNamespaceName) { const NamespaceDef *nd=md->getNamespaceDef(); @@ -2511,7 +2554,7 @@ static void writeMemberList(OutputList &ol,bool useSections,const std::string &p int index = (int)type; ASSERT(index<3); - typedef void (*writeLinkForMember_t)(OutputList &ol,const MemberDef *md,const char *separator, + typedef void (*writeLinkForMember_t)(OutputList &ol,const MemberDef *md,const QCString &separator, QCString &prevNamespaceName); // each index tab has its own write function @@ -2552,7 +2595,7 @@ static void writeMemberList(OutputList &ol,bool useSections,const std::string &p (md->isFunction() || md->isSlot() || md->isSignal()); QCString name=md->name(); int startIndex = getPrefixIndex(name); - if (QCString(name.data()+startIndex)!=prevName) // new entry + if (name.data()+startIndex!=prevName) // new entry { if ((prevName.isEmpty() || tolower(name.at(startIndex))!=tolower(prevName.at(0))) && @@ -2898,7 +2941,7 @@ static void writeQuickMemberIndex(OutputList &ol, /** Helper class representing a class member in the navigation menu. */ struct CmhlInfo { - CmhlInfo(const char *fn,const char *t) : fname(fn), title(t) {} + CmhlInfo(const char *fn,const QCString &t) : fname(fn), title(t) {} const char *fname; QCString title; }; @@ -2948,8 +2991,8 @@ static void writeClassMemberIndexFiltered(OutputList &ol, ClassMemberHighlight h if (addToIndex) { - Doxygen::indexList->addContentsItem(multiPageIndex,getCmhlInfo(hl)->title,0, - getCmhlInfo(hl)->fname,0,multiPageIndex,TRUE); + Doxygen::indexList->addContentsItem(multiPageIndex,getCmhlInfo(hl)->title,QCString(), + getCmhlInfo(hl)->fname,QCString(),multiPageIndex,TRUE); if (multiPageIndex) Doxygen::indexList->incContentsDepth(); } @@ -2960,23 +3003,23 @@ static void writeClassMemberIndexFiltered(OutputList &ol, ClassMemberHighlight h QCString fileName = getCmhlInfo(hl)->fname; if (multiPageIndex) { - QCString cs = page; + QCString cs(page); if (!first) { fileName+="_"+letterToLabel(cs); } if (addToIndex) { - Doxygen::indexList->addContentsItem(FALSE,cs,0,fileName,0,FALSE,TRUE); + Doxygen::indexList->addContentsItem(FALSE,cs,QCString(),fileName,QCString(),FALSE,TRUE); } } bool quickIndex = documentedClassMembers[hl]>maxItemsBeforeQuickIndex; - ol.startFile(fileName+extension,0,title); + ol.startFile(fileName+extension,QCString(),title); ol.startQuickIndices(); if (!disableIndex) { - ol.writeQuickLinks(TRUE,HLI_Functions,0); + ol.writeQuickLinks(TRUE,HLI_Functions,QCString()); if (!Config_getBool(HTML_DYNAMIC_MENUS)) { @@ -2997,7 +3040,7 @@ static void writeClassMemberIndexFiltered(OutputList &ol, ClassMemberHighlight h startQuickIndexItem(ol,getCmhlInfo(i)->fname+Doxygen::htmlFileExtension,hl==i,TRUE,first); ol.writeString(fixSpaces(getCmhlInfo(i)->title)); //printf("multiPageIndex=%d first=%d fileName=%s file=%s title=%s\n", - // multiPageIndex,first,fileName.data(),getCmhlInfo(i)->fname,getCmhlInfo(i)->title.data()); + // multiPageIndex,first,qPrint(fileName),getCmhlInfo(i)->fname,qPrint(getCmhlInfo(i)->title)); endQuickIndexItem(ol); } } @@ -3051,7 +3094,7 @@ static void writeClassMemberIndex(OutputList &ol) if (documentedClassMembers[CMHL_All]>0 && addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,lne ? lne->title() : theTranslator->trCompoundMembers(),0,"functions",0); + Doxygen::indexList->addContentsItem(TRUE,lne ? lne->title() : theTranslator->trCompoundMembers(),QCString(),"functions",QCString()); Doxygen::indexList->incContentsDepth(); } writeClassMemberIndexFiltered(ol,CMHL_All); @@ -3075,7 +3118,7 @@ static void writeClassMemberIndex(OutputList &ol) /** Helper class representing a file member in the navigation menu. */ struct FmhlInfo { - FmhlInfo(const char *fn,const char *t) : fname(fn), title(t) {} + FmhlInfo(const char *fn,const QCString &t) : fname(fn), title(t) {} const char *fname; QCString title; }; @@ -3125,8 +3168,8 @@ static void writeFileMemberIndexFiltered(OutputList &ol, FileMemberHighlight hl) if (addToIndex) { - Doxygen::indexList->addContentsItem(multiPageIndex,getFmhlInfo(hl)->title,0, - getFmhlInfo(hl)->fname,0,multiPageIndex,TRUE); + Doxygen::indexList->addContentsItem(multiPageIndex,getFmhlInfo(hl)->title,QCString(), + getFmhlInfo(hl)->fname,QCString(),multiPageIndex,TRUE); if (multiPageIndex) Doxygen::indexList->incContentsDepth(); } @@ -3137,23 +3180,23 @@ static void writeFileMemberIndexFiltered(OutputList &ol, FileMemberHighlight hl) QCString fileName = getFmhlInfo(hl)->fname; if (multiPageIndex) { - QCString cs = page; + QCString cs(page); if (!first) { fileName+="_"+letterToLabel(cs); } if (addToIndex) { - Doxygen::indexList->addContentsItem(FALSE,cs,0,fileName,0,FALSE,TRUE); + Doxygen::indexList->addContentsItem(FALSE,cs,QCString(),fileName,QCString(),FALSE,TRUE); } } bool quickIndex = documentedFileMembers[hl]>maxItemsBeforeQuickIndex; - ol.startFile(fileName+extension,0,title); + ol.startFile(fileName+extension,QCString(),title); ol.startQuickIndices(); if (!disableIndex) { - ol.writeQuickLinks(TRUE,HLI_Globals,0); + ol.writeQuickLinks(TRUE,HLI_Globals,QCString()); if (!Config_getBool(HTML_DYNAMIC_MENUS)) { startQuickIndexList(ol); @@ -3222,7 +3265,7 @@ static void writeFileMemberIndex(OutputList &ol) bool addToIndex = lne==0 || lne->visible(); if (documentedFileMembers[FMHL_All]>0 && addToIndex) { - Doxygen::indexList->addContentsItem(FALSE,lne ? lne->title() : theTranslator->trFileMembers(),0,"globals",0); + Doxygen::indexList->addContentsItem(FALSE,lne ? lne->title() : theTranslator->trFileMembers(),QCString(),"globals",QCString()); Doxygen::indexList->incContentsDepth(); } writeFileMemberIndexFiltered(ol,FMHL_All); @@ -3246,7 +3289,7 @@ static void writeFileMemberIndex(OutputList &ol) /** Helper class representing a namespace member in the navigation menu. */ struct NmhlInfo { - NmhlInfo(const char *fn,const char *t) : fname(fn), title(t) {} + NmhlInfo(const char *fn,const QCString &t) : fname(fn), title(t) {} const char *fname; QCString title; }; @@ -3299,8 +3342,8 @@ static void writeNamespaceMemberIndexFiltered(OutputList &ol, if (addToIndex) { - Doxygen::indexList->addContentsItem(multiPageIndex,getNmhlInfo(hl)->title,0, - getNmhlInfo(hl)->fname,0,multiPageIndex,TRUE); + Doxygen::indexList->addContentsItem(multiPageIndex,getNmhlInfo(hl)->title,QCString(), + getNmhlInfo(hl)->fname,QCString(),multiPageIndex,TRUE); if (multiPageIndex) Doxygen::indexList->incContentsDepth(); } @@ -3311,23 +3354,23 @@ static void writeNamespaceMemberIndexFiltered(OutputList &ol, QCString fileName = getNmhlInfo(hl)->fname; if (multiPageIndex) { - QCString cs = page; + QCString cs(page); if (!first) { fileName+="_"+letterToLabel(cs); } if (addToIndex) { - Doxygen::indexList->addContentsItem(FALSE,cs,0,fileName,0,FALSE,TRUE); + Doxygen::indexList->addContentsItem(FALSE,cs,QCString(),fileName,QCString(),FALSE,TRUE); } } bool quickIndex = documentedNamespaceMembers[hl]>maxItemsBeforeQuickIndex; - ol.startFile(fileName+extension,0,title); + ol.startFile(fileName+extension,QCString(),title); ol.startQuickIndices(); if (!disableIndex) { - ol.writeQuickLinks(TRUE,HLI_NamespaceMembers,0); + ol.writeQuickLinks(TRUE,HLI_NamespaceMembers,QCString()); if (!Config_getBool(HTML_DYNAMIC_MENUS)) { startQuickIndexList(ol); @@ -3396,7 +3439,7 @@ static void writeNamespaceMemberIndex(OutputList &ol) bool addToIndex = lne==0 || lne->visible(); if (documentedNamespaceMembers[NMHL_All]>0 && addToIndex) { - Doxygen::indexList->addContentsItem(FALSE,lne ? lne->title() : theTranslator->trNamespaceMembers(),0,"namespacemembers",0); + Doxygen::indexList->addContentsItem(FALSE,lne ? lne->title() : theTranslator->trNamespaceMembers(),QCString(),"namespacemembers",QCString()); Doxygen::indexList->incContentsDepth(); } //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); @@ -3429,17 +3472,17 @@ static void writeExampleIndex(OutputList &ol) QCString title = lne ? lne->title() : theTranslator->trExamples(); bool addToIndex = lne==0 || lne->visible(); - startFile(ol,"examples",0,title,HLI_Examples); + startFile(ol,"examples",QCString(),title,HLI_Examples); - startTitle(ol,0); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); if (addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,title,0,"examples",0,TRUE,TRUE); + Doxygen::indexList->addContentsItem(TRUE,title,QCString(),"examples",QCString(),TRUE,TRUE); Doxygen::indexList->incContentsDepth(); } @@ -3454,18 +3497,18 @@ static void writeExampleIndex(OutputList &ol) QCString n=pd->getOutputFileBase(); if (!pd->title().isEmpty()) { - ol.writeObjectLink(0,n,0,pd->title()); + ol.writeObjectLink(QCString(),n,QCString(),pd->title()); if (addToIndex) { - Doxygen::indexList->addContentsItem(FALSE,filterTitle(pd->title().str()),pd->getReference(),n,0,FALSE,TRUE); + Doxygen::indexList->addContentsItem(FALSE,filterTitle(pd->title().str()),pd->getReference(),n,QCString(),FALSE,TRUE); } } else { - ol.writeObjectLink(0,n,0,pd->name()); + ol.writeObjectLink(QCString(),n,QCString(),pd->name()); if (addToIndex) { - Doxygen::indexList->addContentsItem(FALSE,pd->name(),pd->getReference(),n,0,FALSE,TRUE); + Doxygen::indexList->addContentsItem(FALSE,pd->name(),pd->getReference(),n,QCString(),FALSE,TRUE); } } ol.endItemListItem(); @@ -3515,7 +3558,7 @@ static bool mainPageHasOwnTitle() static void writePages(const PageDef *pd,FTVHelp *ftv) { - //printf("writePages()=%s pd=%p mainpage=%p\n",pd->name().data(),pd,Doxygen::mainPage); + //printf("writePages()=%s pd=%p mainpage=%p\n",qPrint(pd->name()),pd,Doxygen::mainPage); LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Pages); bool addToIndex = lne==0 || lne->visible(); if (!addToIndex) return; @@ -3534,18 +3577,18 @@ static void writePages(const PageDef *pd,FTVHelp *ftv) if (ftv) { - //printf("*** adding %s hasSubPages=%d hasSections=%d\n",pageTitle.data(),hasSubPages,hasSections); + //printf("*** adding %s hasSubPages=%d hasSections=%d\n",qPrint(pageTitle),hasSubPages,hasSections); ftv->addContentsItem( hasSubPages,pageTitle, pd->getReference(),pd->getOutputFileBase(), - 0,hasSubPages,TRUE,pd); + QCString(),hasSubPages,TRUE,pd); } if (addToIndex && pd!=Doxygen::mainPage.get()) { Doxygen::indexList->addContentsItem( hasSubPages || hasSections,pageTitle, pd->getReference(),pd->getOutputFileBase(), - 0,hasSubPages,TRUE); + QCString(),hasSubPages,TRUE); } } if (hasSubPages && ftv) ftv->incContentsDepth(); @@ -3568,7 +3611,7 @@ static void writePages(const PageDef *pd,FTVHelp *ftv) { Doxygen::indexList->decContentsDepth(); } - //printf("end writePages()=%s\n",pd->title().data()); + //printf("end writePages()=%s\n",qPrint(pd->title())); } //---------------------------------------------------------------------------- @@ -3580,10 +3623,10 @@ static void writePageIndex(OutputList &ol) ol.disableAllBut(OutputGenerator::Html); LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Pages); QCString title = lne ? lne->title() : theTranslator->trRelatedPages(); - startFile(ol,"pages",0,title,HLI_Pages); - startTitle(ol,0); + startFile(ol,"pages",QCString(),title,HLI_Pages); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); ol.startTextBlock(); ol.parseText(lne ? lne->intro() : theTranslator->trRelatedPagesDescription()); @@ -3601,7 +3644,7 @@ static void writePageIndex(OutputList &ol) writePages(pd.get(),ftv); } } - std::ostringstream t(std::ios_base::ate); + TextStream t; ftv->generateTreeViewInline(t); ol.writeString(t.str().c_str()); delete ftv; @@ -3666,10 +3709,10 @@ void writeGraphInfo(OutputList &ol) // temporarily disable create subdirs for linking to our example createSubdirs = Config_updateBool(CREATE_SUBDIRS,FALSE); - startFile(ol,"graph_legend",0,theTranslator->trLegendTitle().data()); - startTitle(ol,0); + startFile(ol,"graph_legend",QCString(),theTranslator->trLegendTitle()); + startTitle(ol,QCString()); ol.parseText(theTranslator->trLegendTitle()); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); QCString legendDocs = theTranslator->trLegendDocs(); int s = legendDocs.find("<center>"); @@ -3678,11 +3721,11 @@ void writeGraphInfo(OutputList &ol) if (imgExt=="svg" && s!=-1 && e!=-1) { legendDocs = legendDocs.left(s+8) + "[!-- SVG 0 --]\n" + legendDocs.mid(e); - //printf("legendDocs=%s\n",legendDocs.data()); + //printf("legendDocs=%s\n",qPrint(legendDocs)); } FileDef *fd = createFileDef("","graph_legend.dox"); ol.generateDoc("graph_legend",1,fd,0,legendDocs,FALSE,FALSE, - 0,FALSE,FALSE,FALSE); + QCString(),FALSE,FALSE,FALSE); delete fd; // restore config settings @@ -3706,7 +3749,7 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT if (level>20) { warn(gd->getDefFileName(),gd->getDefLine(), - "maximum nesting level exceeded for group %s: check for possible recursive group relation!\n",gd->name().data() + "maximum nesting level exceeded for group %s: check for possible recursive group relation!\n",qPrint(gd->name()) ); return; } @@ -3719,7 +3762,7 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT (!gd->isReference() || Config_getBool(EXTERNAL_GROUPS)) // hide external groups by default ) { - //printf("gd->name()=%s #members=%d\n",gd->name().data(),gd->countMembers()); + //printf("gd->name()=%s #members=%d\n",qPrint(gd->name()),gd->countMembers()); // write group info bool hasSubGroups = !gd->getSubGroups().empty(); bool hasSubPages = !gd->getPages().empty(); @@ -3736,21 +3779,22 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT numSubItems += gd->getNamespaces().size(); numSubItems += gd->getClasses().size(); numSubItems += gd->getFiles().size(); + numSubItems += gd->getConcepts().size(); numSubItems += gd->getDirs().size(); numSubItems += gd->getPages().size(); } bool isDir = hasSubGroups || hasSubPages || numSubItems>0; - //printf("gd='%s': pageDict=%d\n",gd->name().data(),gd->pageDict->count()); + //printf("gd='%s': pageDict=%d\n",qPrint(gd->name()),gd->pageDict->count()); if (addToIndex) { - Doxygen::indexList->addContentsItem(isDir,gd->groupTitle(),gd->getReference(),gd->getOutputFileBase(),0,isDir,TRUE); + Doxygen::indexList->addContentsItem(isDir,gd->groupTitle(),gd->getReference(),gd->getOutputFileBase(),QCString(),isDir,TRUE); Doxygen::indexList->incContentsDepth(); } if (ftv) { ftv->addContentsItem(hasSubGroups,gd->groupTitle(), - gd->getReference(),gd->getOutputFileBase(),0, + gd->getReference(),gd->getOutputFileBase(),QCString(), FALSE,FALSE,gd); ftv->incContentsDepth(); } @@ -3786,7 +3830,7 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT if (md->isVisible() && !md->isAnonymous()) { Doxygen::indexList->addContentsItem(isDir, - md->name(),md->getReference(), + md->qualifiedName(),md->getReference(), md->getOutputFileBase(),md->anchor(),FALSE,addToIndex); } if (isDir) @@ -3797,7 +3841,7 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT if (emd->isVisible()) { Doxygen::indexList->addContentsItem(FALSE, - emd->name(),emd->getReference(),emd->getOutputFileBase(), + emd->qualifiedName(),emd->getReference(),emd->getOutputFileBase(), emd->anchor(),FALSE,addToIndex); } } @@ -3813,21 +3857,15 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT //bool nestedClassInSameGroup = // cd->getOuterScope() && cd->getOuterScope()->definitionType()==Definition::TypeClass && // cd->getOuterScope()->partOfGroups().empty() && cd->getOuterScope()->partOfGroups()->contains(gd); - //printf("===== GroupClasses: %s visible=%d nestedClassInSameGroup=%d\n",cd->name().data(),cd->isVisible(),nestedClassInSameGroup); + //printf("===== GroupClasses: %s visible=%d nestedClassInSameGroup=%d\n",qPrint(cd->name()),cd->isVisible(),nestedClassInSameGroup); if (cd->isVisible() /*&& !nestedClassInSameGroup*/) { - //if (cd->isEmbeddedInOuterScope()) - //{ - //printf("add class & members %d\n",addToIndex); - addMembersToIndex(cd,LayoutDocManager::Class,cd->displayName(FALSE),cd->anchor(),addToIndex,TRUE); - //} - //else // only index the class, not its members - //{ - // printf("%s: add class only\n",cd->name().data()); - // Doxygen::indexList->addContentsItem(FALSE, - // cd->displayName(TRUE),cd->getReference(), - // cd->getOutputFileBase(),cd->anchor(),addToIndex,TRUE); - //} + addMembersToIndex(cd, + LayoutDocManager::Class, + cd->displayName(), + cd->anchor(), + addToIndex, + TRUE); } } } @@ -3838,8 +3876,20 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT if (nd->isVisible()) { Doxygen::indexList->addContentsItem(FALSE, - nd->localName(),nd->getReference(), - nd->getOutputFileBase(),0,FALSE,FALSE); + nd->displayName(),nd->getReference(), + nd->getOutputFileBase(),QCString(),FALSE,addToIndex); + } + } + } + else if (lde->kind()==LayoutDocEntry::GroupConcepts && addToIndex) + { + for (const auto &cd : gd->getConcepts()) + { + if (cd->isVisible()) + { + Doxygen::indexList->addContentsItem(FALSE, + cd->displayName(),cd->getReference(), + cd->getOutputFileBase(),QCString(),FALSE,addToIndex); } } } @@ -3851,7 +3901,7 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT { Doxygen::indexList->addContentsItem(FALSE, fd->displayName(),fd->getReference(), - fd->getOutputFileBase(),0,FALSE,FALSE); + fd->getOutputFileBase(),QCString(),FALSE,FALSE); } } } @@ -3863,7 +3913,7 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT { Doxygen::indexList->addContentsItem(FALSE, dd->shortName(),dd->getReference(), - dd->getOutputFileBase(),0,FALSE,FALSE); + dd->getOutputFileBase(),QCString(),FALSE,FALSE); } } } @@ -3880,7 +3930,7 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT pd->title(), gd->getReference(), gd->getOutputFileBase(), - si ? si->label().data() : 0, + si ? si->label() : QCString(), hasSubPages || hasSections, TRUE); // addToNavIndex if (hasSections || hasSubPages) @@ -3958,10 +4008,10 @@ static void writeGroupIndex(OutputList &ol) QCString title = lne ? lne->title() : theTranslator->trModules(); bool addToIndex = lne==0 || lne->visible(); - startFile(ol,"modules",0,title,HLI_Modules); - startTitle(ol,0); + startFile(ol,"modules",QCString(),title,HLI_Modules); + startTitle(ol,QCString()); ol.parseText(title); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); ol.startTextBlock(); ol.parseText(lne ? lne->intro() : theTranslator->trModulesDescription()); @@ -3991,12 +4041,12 @@ static void writeGroupIndex(OutputList &ol) { if (addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,title,0,"modules",0,TRUE,TRUE); + Doxygen::indexList->addContentsItem(TRUE,title,QCString(),"modules",QCString(),TRUE,TRUE); Doxygen::indexList->incContentsDepth(); } FTVHelp* ftv = new FTVHelp(FALSE); writeGroupHierarchy(ol,ftv,addToIndex); - std::ostringstream t(std::ios_base::ate); + TextStream t; ftv->generateTreeViewInline(t); ol.disableAllBut(OutputGenerator::Html); ol.writeString(t.str().c_str()); @@ -4016,16 +4066,221 @@ static void writeGroupIndex(OutputList &ol) //---------------------------------------------------------------------------- +static void writeConceptList(const ConceptLinkedRefMap &concepts, FTVHelp *ftv,bool addToIndex) +{ + for (const auto &cd : concepts) + { + ftv->addContentsItem(false,cd->displayName(FALSE),cd->getReference(), + cd->getOutputFileBase(),QCString(),false,cd->partOfGroups().empty(),cd); + if (addToIndex) + { + Doxygen::indexList->addContentsItem(false,cd->displayName(FALSE),cd->getReference(), + cd->getOutputFileBase(),QCString(),false,cd->partOfGroups().empty()); + } + } +} + +static void writeConceptTreeInsideNamespaceElement(const NamespaceDef *nd,FTVHelp *ftv, + bool rootOnly, bool addToIndex); + +static void writeConceptTreeInsideNamespace(const NamespaceLinkedRefMap &nsLinkedMap,FTVHelp *ftv, + bool rootOnly, bool addToIndex) +{ + for (const auto &nd : nsLinkedMap) + { + writeConceptTreeInsideNamespaceElement(nd,ftv,rootOnly,addToIndex); + } +} + + +static void writeConceptTreeInsideNamespaceElement(const NamespaceDef *nd,FTVHelp *ftv, + bool rootOnly, bool addToIndex) +{ + if (!nd->isAnonymous() && + (!rootOnly || nd->getOuterScope()==Doxygen::globalScope)) + { + bool isDir = namespaceHasNestedConcept(nd); + bool isLinkable = nd->isLinkableInProject(); + + //printf("namespace %s isDir=%d\n",qPrint(nd->name()),isDir); + + QCString ref; + QCString file; + if (isLinkable) + { + ref = nd->getReference(); + file = nd->getOutputFileBase(); + } + + if (isDir) + { + ftv->addContentsItem(isDir,nd->localName(),ref,file,QCString(),FALSE,TRUE,nd); + + if (addToIndex) + { + // the namespace entry is already shown under the namespace list so don't + // add it to the nav index and don't create a separate index file for it otherwise + // it will overwrite the one written for the namespace list. + Doxygen::indexList->addContentsItem(isDir,nd->localName(),ref,file,QCString(), + false, // separateIndex + false // addToNavIndex + ); + } + if (addToIndex) + { + Doxygen::indexList->incContentsDepth(); + } + + ftv->incContentsDepth(); + writeConceptTreeInsideNamespace(nd->getNamespaces(),ftv,FALSE,addToIndex); + writeConceptList(nd->getConcepts(),ftv,addToIndex); + ftv->decContentsDepth(); + + if (addToIndex) + { + Doxygen::indexList->decContentsDepth(); + } + } + } +} + +static void writeConceptRootList(FTVHelp *ftv,bool addToIndex) +{ + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + if (cd->getOuterScope()==0 || + cd->getOuterScope()==Doxygen::globalScope) + { + //printf("*** adding %s hasSubPages=%d hasSections=%d\n",qPrint(pageTitle),hasSubPages,hasSections); + ftv->addContentsItem( + false,cd->localName(),cd->getReference(),cd->getOutputFileBase(), + QCString(),false,true,cd.get()); + if (addToIndex) + { + Doxygen::indexList->addContentsItem( + false,cd->localName(),cd->getReference(),cd->getOutputFileBase(), + QCString(),false,true); + } + } + } +} + +static void writeConceptIndex(OutputList &ol) +{ + if (documentedConcepts==0) return; + ol.pushGeneratorState(); + // 1.{ + ol.disable(OutputGenerator::Man); + ol.disable(OutputGenerator::Docbook); + LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Concepts); + QCString title = lne ? lne->title() : theTranslator->trConceptList(); + bool addToIndex = lne==0 || lne->visible(); + + startFile(ol,"concepts",QCString(),title,HLI_Concepts); + startTitle(ol,QCString()); + ol.parseText(title); + endTitle(ol,QCString(),QCString()); + ol.startContents(); + ol.startTextBlock(); + ol.parseText(lne ? lne->intro() : theTranslator->trConceptListDescription(Config_getBool(EXTRACT_ALL))); + ol.endTextBlock(); + + // --------------- + // Normal group index for Latex/RTF + // --------------- + // 2.{ + ol.pushGeneratorState(); + ol.disable(OutputGenerator::Html); + + bool first=TRUE; + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + if (cd->isLinkableInProject()) + { + if (first) + { + ol.startIndexList(); + first=FALSE; + } + //ol.writeStartAnnoItem("namespace",nd->getOutputFileBase(),0,nd->name()); + ol.startIndexKey(); + ol.writeObjectLink(QCString(),cd->getOutputFileBase(),QCString(),cd->displayName()); + ol.endIndexKey(); + + bool hasBrief = !cd->briefDescription().isEmpty(); + ol.startIndexValue(hasBrief); + if (hasBrief) + { + //ol.docify(" ("); + ol.generateDoc( + cd->briefFile(),cd->briefLine(), + cd.get(),0, + cd->briefDescription(TRUE), + FALSE, // index words + FALSE, // isExample + QCString(), // example name + TRUE, // single line + TRUE, // link from index + Config_getBool(MARKDOWN_SUPPORT) + ); + //ol.docify(")"); + } + ol.endIndexValue(cd->getOutputFileBase(),hasBrief); + + } + } + if (!first) ol.endIndexList(); + + ol.popGeneratorState(); + // 2.} + + // --------------- + // interactive group index for HTML + // --------------- + // 2.{ + ol.pushGeneratorState(); + ol.disableAllBut(OutputGenerator::Html); + + { + if (addToIndex) + { + Doxygen::indexList->addContentsItem(TRUE,title,QCString(),"concepts",QCString(),TRUE,TRUE); + Doxygen::indexList->incContentsDepth(); + } + FTVHelp ftv(false); + for (const auto &nd : *Doxygen::namespaceLinkedMap) + { + writeConceptTreeInsideNamespaceElement(nd.get(),&ftv,true,addToIndex); + } + writeConceptRootList(&ftv,addToIndex); + TextStream t; + ftv.generateTreeViewInline(t); + ol.writeString(t.str().c_str()); + if (addToIndex) + { + Doxygen::indexList->decContentsDepth(); + } + } + ol.popGeneratorState(); + // 2.} + + endFile(ol); + ol.popGeneratorState(); + // 1.} +} + +//---------------------------------------------------------------------------- + static void writeUserGroupStubPage(OutputList &ol,LayoutNavEntry *lne) { if (lne->baseFile().left(9)=="usergroup") { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - startFile(ol,lne->baseFile(),0,lne->title(),HLI_UserGroup); - startTitle(ol,0); + startFile(ol,lne->baseFile(),QCString(),lne->title(),HLI_UserGroup); + startTitle(ol,QCString()); ol.parseText(lne->title()); - endTitle(ol,0,0); + endTitle(ol,QCString(),QCString()); ol.startContents(); int count=0; for (const auto &entry: lne->children()) @@ -4073,7 +4328,7 @@ static void writeIndex(OutputList &ol) ol.disableAllBut(OutputGenerator::Html); QCString defFileName = - Doxygen::mainPage ? Doxygen::mainPage->docFile().data() : "[generated]"; + Doxygen::mainPage ? Doxygen::mainPage->docFile() : QCString("[generated]"); int defLine = Doxygen::mainPage ? Doxygen::mainPage->docLine() : -1; @@ -4088,7 +4343,7 @@ static void writeIndex(OutputList &ol) } QCString indexName="index"; - ol.startFile(indexName,0,title); + ol.startFile(indexName,QCString(),title); if (Doxygen::mainPage) { @@ -4096,7 +4351,7 @@ static void writeIndex(OutputList &ol) (!projectName.isEmpty() && mainPageHasTitle() && qstricmp(title,projectName)!=0) ) // to avoid duplicate entries in the treeview { - Doxygen::indexList->addContentsItem(Doxygen::mainPage->hasSubPages(),title,0,indexName,0,Doxygen::mainPage->hasSubPages(),TRUE); + Doxygen::indexList->addContentsItem(Doxygen::mainPage->hasSubPages(),title,QCString(),indexName,QCString(),Doxygen::mainPage->hasSubPages(),TRUE); } if (Doxygen::mainPage->hasSubPages() || Doxygen::mainPage->hasSections()) { @@ -4107,7 +4362,7 @@ static void writeIndex(OutputList &ol) ol.startQuickIndices(); if (!Config_getBool(DISABLE_INDEX)) { - ol.writeQuickLinks(TRUE,HLI_Main,0); + ol.writeQuickLinks(TRUE,HLI_Main,QCString()); } ol.endQuickIndices(); ol.writeSplitBar(indexName); @@ -4130,10 +4385,10 @@ static void writeIndex(OutputList &ol) if (Doxygen::mainPage->title().lower()!="notitle") { ol.startHeaderSection(); - ol.startTitleHead(0); + ol.startTitleHead(QCString()); ol.generateDoc(Doxygen::mainPage->docFile(),Doxygen::mainPage->getStartBodyLine(), Doxygen::mainPage.get(),0,Doxygen::mainPage->title(),TRUE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); headerWritten = TRUE; } } @@ -4142,21 +4397,21 @@ static void writeIndex(OutputList &ol) if (!projectName.isEmpty()) { ol.startHeaderSection(); - ol.startTitleHead(0); + ol.startTitleHead(QCString()); ol.parseText(projPrefix+theTranslator->trDocumentation()); headerWritten = TRUE; } } if (headerWritten) { - ol.endTitleHead(0,0); + ol.endTitleHead(QCString(),QCString()); ol.endHeaderSection(); } ol.startContents(); if (Config_getBool(DISABLE_INDEX) && Doxygen::mainPage==0) { - ol.writeQuickLinks(FALSE,HLI_Main,0); + ol.writeQuickLinks(FALSE,HLI_Main,QCString()); } if (Doxygen::mainPage) @@ -4170,7 +4425,7 @@ static void writeIndex(OutputList &ol) ol.startTextBlock(); ol.generateDoc(defFileName,defLine,Doxygen::mainPage.get(),0, Doxygen::mainPage->documentation(),TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endTextBlock(); ol.endPageDoc(); @@ -4187,7 +4442,7 @@ static void writeIndex(OutputList &ol) ol.enable(OutputGenerator::Docbook); ol.enable(OutputGenerator::RTF); - ol.startFile("refman",0,0); + ol.startFile("refman",QCString(),QCString()); ol.startIndexSection(isTitlePageStart); ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::Docbook); @@ -4205,7 +4460,7 @@ static void writeIndex(OutputList &ol) { ol.startProjectNumber(); ol.generateDoc(defFileName,defLine,Doxygen::mainPage.get(),0,Config_getString(PROJECT_NUMBER),FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endProjectNumber(); } ol.endIndexSection(isTitlePageStart); @@ -4264,7 +4519,7 @@ static void writeIndex(OutputList &ol) ol.endIndexSection(isPageDocumentation2); ol.popGeneratorState(); - ol.writeAnchor(0,pd->getOutputFileBase()); + ol.writeAnchor(QCString(),pd->getOutputFileBase()); ol.writePageLink(pd->getOutputFileBase(),first); first=FALSE; @@ -4298,6 +4553,12 @@ static void writeIndex(OutputList &ol) ol.parseText(/*projPrefix+*/(fortranOpt?theTranslator->trModulesIndex():theTranslator->trNamespaceIndex())); ol.endIndexSection(isNamespaceIndex); } + if (documentedConcepts>0) + { + ol.startIndexSection(isConceptIndex); + ol.parseText(/*projPrefix+*/theTranslator->trConceptIndex()); + ol.endIndexSection(isConceptIndex); + } if (hierarchyInterfaces>0) { ol.startIndexSection(isClassHierarchyIndex); @@ -4369,6 +4630,12 @@ static void writeIndex(OutputList &ol) ol.parseText(/*projPrefix+*/(fortranOpt?theTranslator->trModuleDocumentation():theTranslator->trNamespaceDocumentation())); ol.endIndexSection(isNamespaceDocumentation); } + if (documentedConcepts>0) + { + ol.startIndexSection(isConceptDocumentation); + ol.parseText(/*projPrefix+*/theTranslator->trConceptDocumentation()); + ol.endIndexSection(isConceptDocumentation); + } if (annotatedInterfacesPrinted>0) { ol.startIndexSection(isClassDocumentation); @@ -4412,12 +4679,12 @@ static void writeIndex(OutputList &ol) { Doxygen::insideMainPage=TRUE; ol.disable(OutputGenerator::Man); - startFile(ol,Doxygen::mainPage->name(),0,Doxygen::mainPage->title()); + startFile(ol,Doxygen::mainPage->name(),QCString(),Doxygen::mainPage->title()); ol.startContents(); ol.startTextBlock(); ol.generateDoc(defFileName,defLine,Doxygen::mainPage.get(),0, Doxygen::mainPage->documentation(),FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT) + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT) ); ol.endTextBlock(); endFile(ol); @@ -4439,13 +4706,13 @@ static void writeIndexHierarchyEntries(OutputList &ol,const LayoutNavEntryList & uint index = (uint)kind; if (index>=indexWritten.size()) { - uint i; - uint oldSize = indexWritten.size(); - uint newSize = index+1; + size_t i; + size_t oldSize = indexWritten.size(); + size_t newSize = index+1; indexWritten.resize(newSize); for (i=oldSize;i<newSize;i++) indexWritten.at(i)=FALSE; } - //printf("starting %s kind=%d\n",lne->title().data(),lne->kind()); + //printf("starting %s kind=%d\n",qPrint(lne->title()),lne->kind()); bool addToIndex=lne->visible(); bool needsClosing=FALSE; if (!indexWritten.at(index)) @@ -4471,7 +4738,7 @@ static void writeIndexHierarchyEntries(OutputList &ol,const LayoutNavEntryList & { if (documentedNamespaces>0 && addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,lne->title(),0,lne->baseFile(),0); + Doxygen::indexList->addContentsItem(TRUE,lne->title(),QCString(),lne->baseFile(),QCString()); Doxygen::indexList->incContentsDepth(); needsClosing=TRUE; } @@ -4500,7 +4767,7 @@ static void writeIndexHierarchyEntries(OutputList &ol,const LayoutNavEntryList & case LayoutNavEntry::Classes: if (annotatedClasses>0 && addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,lne->title(),0,lne->baseFile(),0); + Doxygen::indexList->addContentsItem(TRUE,lne->title(),QCString(),lne->baseFile(),QCString()); Doxygen::indexList->incContentsDepth(); needsClosing=TRUE; } @@ -4510,6 +4777,10 @@ static void writeIndexHierarchyEntries(OutputList &ol,const LayoutNavEntryList & writeAnnotatedIndex(ol); } break; + case LayoutNavEntry::Concepts: + msg("Generating concept index...\n"); + writeConceptIndex(ol); + break; case LayoutNavEntry::ClassList: msg("Generating annotated compound index...\n"); writeAnnotatedIndex(ol); @@ -4537,7 +4808,7 @@ static void writeIndexHierarchyEntries(OutputList &ol,const LayoutNavEntryList & case LayoutNavEntry::Interfaces: if (sliceOpt && annotatedInterfaces>0 && addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,lne->title(),0,lne->baseFile(),0); + Doxygen::indexList->addContentsItem(TRUE,lne->title(),QCString(),lne->baseFile(),QCString()); Doxygen::indexList->incContentsDepth(); needsClosing=TRUE; } @@ -4571,7 +4842,7 @@ static void writeIndexHierarchyEntries(OutputList &ol,const LayoutNavEntryList & case LayoutNavEntry::Structs: if (sliceOpt && annotatedStructs>0 && addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,lne->title(),0,lne->baseFile(),0); + Doxygen::indexList->addContentsItem(TRUE,lne->title(),QCString(),lne->baseFile(),QCString()); Doxygen::indexList->incContentsDepth(); needsClosing=TRUE; } @@ -4593,7 +4864,7 @@ static void writeIndexHierarchyEntries(OutputList &ol,const LayoutNavEntryList & case LayoutNavEntry::Exceptions: if (sliceOpt && annotatedExceptions>0 && addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,lne->title(),0,lne->baseFile(),0); + Doxygen::indexList->addContentsItem(TRUE,lne->title(),QCString(),lne->baseFile(),QCString()); Doxygen::indexList->incContentsDepth(); needsClosing=TRUE; } @@ -4631,7 +4902,7 @@ static void writeIndexHierarchyEntries(OutputList &ol,const LayoutNavEntryList & { if (documentedHtmlFiles>0 && addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,lne->title(),0,lne->baseFile(),0); + Doxygen::indexList->addContentsItem(TRUE,lne->title(),QCString(),lne->baseFile(),QCString()); Doxygen::indexList->incContentsDepth(); needsClosing=TRUE; } @@ -4671,7 +4942,7 @@ static void writeIndexHierarchyEntries(OutputList &ol,const LayoutNavEntryList & url.prepend("^"); // prepend ^ to absolute URL } bool isRef = lne->baseFile().left(4)=="@ref" || lne->baseFile().left(4)=="\\ref"; - Doxygen::indexList->addContentsItem(TRUE,lne->title(),0,url,0,FALSE,isRef || isRelative); + Doxygen::indexList->addContentsItem(TRUE,lne->title(),QCString(),url,QCString(),FALSE,isRef || isRelative); } break; case LayoutNavEntry::UserGroup: @@ -4682,7 +4953,7 @@ static void writeIndexHierarchyEntries(OutputList &ol,const LayoutNavEntryList & { if (url=="![none]") { - Doxygen::indexList->addContentsItem(TRUE,lne->title(),0,0,0,FALSE,FALSE); + Doxygen::indexList->addContentsItem(TRUE,lne->title(),QCString(),QCString(),QCString(),FALSE,FALSE); } else { @@ -4692,12 +4963,12 @@ static void writeIndexHierarchyEntries(OutputList &ol,const LayoutNavEntryList & url.prepend("^"); // prepend ^ to absolute URL } bool isRef = lne->baseFile().left(4)=="@ref" || lne->baseFile().left(4)=="\\ref"; - Doxygen::indexList->addContentsItem(TRUE,lne->title(),0,url,0,FALSE,isRef || isRelative); + Doxygen::indexList->addContentsItem(TRUE,lne->title(),QCString(),url,QCString(),FALSE,isRef || isRelative); } } else { - Doxygen::indexList->addContentsItem(TRUE,lne->title(),0,lne->baseFile(),0,TRUE,TRUE); + Doxygen::indexList->addContentsItem(TRUE,lne->title(),QCString(),lne->baseFile(),QCString(),TRUE,TRUE); } Doxygen::indexList->incContentsDepth(); needsClosing=TRUE; @@ -4728,7 +4999,7 @@ static void writeIndexHierarchyEntries(OutputList &ol,const LayoutNavEntryList & break; } } - //printf("ending %s kind=%d\n",lne->title().data(),lne->kind()); + //printf("ending %s kind=%d\n",qPrint(lne->title()),lne->kind()); } } @@ -4747,6 +5018,7 @@ static bool quickLinkVisible(LayoutNavEntry::Kind kind) case LayoutNavEntry::Namespaces: return documentedNamespaces>0 && showNamespaces; case LayoutNavEntry::NamespaceList: return documentedNamespaces>0 && showNamespaces; case LayoutNavEntry::NamespaceMembers: return documentedNamespaceMembers[NMHL_All]>0; + case LayoutNavEntry::Concepts: return documentedConcepts>0; case LayoutNavEntry::Classes: return annotatedClasses>0; case LayoutNavEntry::ClassList: return annotatedClasses>0; case LayoutNavEntry::ClassIndex: return annotatedClasses>0; @@ -4811,8 +5083,8 @@ void renderMemberIndicesAsJs(std::ostream &t, { if (!firstLetter) t << ",\n"; std::string letter = kv.first; - QCString ci = letter; - QCString is = letterToLabel(ci); + QCString ci(letter); + QCString is(letterToLabel(ci)); QCString anchor; QCString extension=Doxygen::htmlFileExtension; QCString fullName = getInfo(i)->fname; diff --git a/src/index.h b/src/index.h index 8b090dc..a10cbc9 100644 --- a/src/index.h +++ b/src/index.h @@ -36,14 +36,14 @@ class IndexIntf virtual void finalize() = 0; virtual void incContentsDepth() = 0; virtual void decContentsDepth() = 0; - virtual void addContentsItem(bool isDir, const char *name, const char *ref, - const char *file, const char *anchor, bool separateIndex, + virtual void addContentsItem(bool isDir, const QCString &name, const QCString &ref, + const QCString &file, const QCString &anchor, bool separateIndex, bool addToNavIndex,const Definition *def) = 0; virtual void addIndexItem(const Definition *context,const MemberDef *md, - const char *sectionAnchor,const char *title) = 0; - virtual void addIndexFile(const char *name) = 0; - virtual void addImageFile(const char *name) = 0; - virtual void addStyleSheetFile(const char *name) = 0; + const QCString §ionAnchor,const QCString &title) = 0; + virtual void addIndexFile(const QCString &name) = 0; + virtual void addImageFile(const QCString &name) = 0; + virtual void addStyleSheetFile(const QCString &name) = 0; }; /** \brief A list of index interfaces. @@ -93,17 +93,17 @@ class IndexList : public IndexIntf { if (m_enabled) foreach(&IndexIntf::incContentsDepth); } void decContentsDepth() { if (m_enabled) foreach(&IndexIntf::decContentsDepth); } - void addContentsItem(bool isDir, const char *name, const char *ref, - const char *file, const char *anchor,bool separateIndex=FALSE,bool addToNavIndex=FALSE, + void addContentsItem(bool isDir, const QCString &name, const QCString &ref, + const QCString &file, const QCString &anchor,bool separateIndex=FALSE,bool addToNavIndex=FALSE, const Definition *def=0) { if (m_enabled) foreach(&IndexIntf::addContentsItem,isDir,name,ref,file,anchor,separateIndex,addToNavIndex,def); } - void addIndexItem(const Definition *context,const MemberDef *md,const char *sectionAnchor=0,const char *title=0) + void addIndexItem(const Definition *context,const MemberDef *md,const QCString §ionAnchor=QCString(),const QCString &title=QCString()) { if (m_enabled) foreach(&IndexIntf::addIndexItem,context,md,sectionAnchor,title); } - void addIndexFile(const char *name) + void addIndexFile(const QCString &name) { if (m_enabled) foreach(&IndexIntf::addIndexFile,name); } - void addImageFile(const char *name) + void addImageFile(const QCString &name) { if (m_enabled) foreach(&IndexIntf::addImageFile,name); } - void addStyleSheetFile(const char *name) + void addStyleSheetFile(const QCString &name) { if (m_enabled) foreach(&IndexIntf::addStyleSheetFile,name); } private: @@ -119,6 +119,7 @@ enum IndexSections isModuleIndex, isDirIndex, isNamespaceIndex, + isConceptIndex, isClassHierarchyIndex, isCompoundIndex, isFileIndex, @@ -127,6 +128,7 @@ enum IndexSections isDirDocumentation, isNamespaceDocumentation, isClassDocumentation, + isConceptDocumentation, isFileDocumentation, isExampleDocumentation, isPageDocumentation, @@ -145,6 +147,7 @@ enum HighlightedItem HLI_InterfaceHierarchy, HLI_ExceptionHierarchy, HLI_Classes, + HLI_Concepts, HLI_Interfaces, HLI_Structs, HLI_Exceptions, @@ -162,6 +165,7 @@ enum HighlightedItem HLI_UserGroup, HLI_ClassVisible, + HLI_ConceptVisible, HLI_InterfaceVisible, HLI_StructVisible, HLI_ExceptionVisible, @@ -238,6 +242,7 @@ extern int hierarchyExceptions; extern int documentedFiles; extern int documentedGroups; extern int documentedNamespaces; +extern int documentedConcepts; extern int indexedPages; extern int documentedClassMembers[CMHL_Total]; extern int documentedFileMembers[FMHL_Total]; @@ -246,11 +251,11 @@ extern int documentedDirs; extern int documentedHtmlFiles; extern int documentedPages; -void startTitle(OutputList &ol,const char *fileName,const DefinitionMutable *def=0); -void endTitle(OutputList &ol,const char *fileName,const char *name); -void startFile(OutputList &ol,const char *name,const char *manName, - const char *title,HighlightedItem hli=HLI_None, - bool additionalIndices=FALSE,const char *altSidebarName=0); +void startTitle(OutputList &ol,const QCString &fileName,const DefinitionMutable *def=0); +void endTitle(OutputList &ol,const QCString &fileName,const QCString &name); +void startFile(OutputList &ol,const QCString &name,const QCString &manName, + const QCString &title,HighlightedItem hli=HLI_None, + bool additionalIndices=FALSE,const QCString &altSidebarName=QCString()); void endFile(OutputList &ol,bool skipNavIndex=FALSE,bool skipEndContents=FALSE, const QCString &navPath=QCString()); void endFileWithNavPath(const Definition *d,OutputList &ol); diff --git a/src/language.cpp b/src/language.cpp index 299c452..af2ca3d 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -152,11 +152,11 @@ #endif #endif // !ENGLISH_ONLY -#define L_EQUAL(a) !qstricmp(langName,a) +#define L_EQUAL(a) !qstricmp(langName.data(),a) Translator *theTranslator=0; -bool setTranslator(const char *langName) +bool setTranslator(const QCString &langName) { if (L_EQUAL("english")) { @@ -417,6 +417,6 @@ bool setTranslator(const char *langName) } QCString msg = theTranslator->updateNeededMessage(); - if (!msg.isEmpty()) warn_uncond("%s", msg.data()); + if (!msg.isEmpty()) warn_uncond("%s", qPrint(msg)); return TRUE; } diff --git a/src/language.h b/src/language.h index 7c8eef9..8f38bfc 100644 --- a/src/language.h +++ b/src/language.h @@ -1,12 +1,12 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -21,6 +21,6 @@ #include "translator.h" extern Translator *theTranslator; -extern bool setTranslator(const char *languageName); +extern bool setTranslator(const QCString &languageName); #endif diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index ddaa97b..589cb0b 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -52,7 +52,7 @@ static const char *getSectionName(int level) return secLabels[std::min(maxLevels-1,l)]; } -static void visitPreStart(std::ostream &t, bool hasCaption, QCString name, QCString width, QCString height, bool inlineImage = FALSE) +static void visitPreStart(TextStream &t, bool hasCaption, QCString name, QCString width, QCString height, bool inlineImage = FALSE) { if (inlineImage) { @@ -122,7 +122,7 @@ static void visitPreStart(std::ostream &t, bool hasCaption, QCString name, QCSt -static void visitPostEnd(std::ostream &t, bool hasCaption, bool inlineImage = FALSE) +static void visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage = FALSE) { if (inlineImage) { @@ -176,8 +176,8 @@ QCString LatexDocVisitor::escapeMakeIndexChars(const char *s) } -LatexDocVisitor::LatexDocVisitor(std::ostream &t,LatexCodeGenerator &ci, - const char *langExt,bool insideTabbing) +LatexDocVisitor::LatexDocVisitor(TextStream &t,LatexCodeGenerator &ci, + const QCString &langExt,bool insideTabbing) : DocVisitor(DocVisitor_Latex), m_t(t), m_ci(ci), m_insidePre(FALSE), m_insideItem(FALSE), m_hide(FALSE), m_hideCaption(FALSE), m_insideTabbing(insideTabbing), m_langExt(langExt) @@ -378,14 +378,14 @@ void LatexDocVisitor::visit(DocVerbatim *s) QCString fileName(4096); fileName.sprintf("%s%d%s", - (Config_getString(LATEX_OUTPUT)+"/inline_dotgraph_").data(), + qPrint(Config_getString(LATEX_OUTPUT)+"/inline_dotgraph_"), dotindex++, ".dot" ); std::ofstream file(fileName.str(),std::ofstream::out | std::ofstream::binary); if (!file.is_open()) { - err("Could not open file %s for writing\n",fileName.data()); + err("Could not open file %s for writing\n",qPrint(fileName)); } else { @@ -406,7 +406,7 @@ void LatexDocVisitor::visit(DocVerbatim *s) QCString baseName(4096); baseName.sprintf("%s%d", - (Config_getString(LATEX_OUTPUT)+"/inline_mscgraph_").data(), + qPrint(Config_getString(LATEX_OUTPUT)+"/inline_mscgraph_"), mscindex++ ); std::string fileName = baseName.str()+".msc"; @@ -556,7 +556,7 @@ void LatexDocVisitor::visit(DocInclude *inc) void LatexDocVisitor::visit(DocIncOperator *op) { //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n", - // op->type(),op->isFirst(),op->isLast(),op->text().data()); + // op->type(),op->isFirst(),op->isLast(),qPrint(op->text())); if (op->isFirst()) { if (!m_hide) m_ci.startCodeFragment("DoxyCodeInclude"); @@ -904,7 +904,7 @@ void LatexDocVisitor::visitPre(DocSection *s) m_t << "\\hypertarget{" << stripPath(s->file()) << "_" << s->anchor() << "}{}"; } m_t << "\\" << getSectionName(s->level()) << "{"; - filter(convertCharEntitiesToUTF8(s->title().data())); + filter(convertCharEntitiesToUTF8(s->title())); m_t << "}\\label{" << stripPath(s->file()) << "_" << s->anchor() << "}\n"; } @@ -916,7 +916,53 @@ void LatexDocVisitor::visitPre(DocHtmlList *s) { if (m_hide) return; if (s->type()==DocHtmlList::Ordered) + { + bool first = true; m_t << "\n\\begin{DoxyEnumerate}"; + for (const auto &opt : s->attribs()) + { + if (opt.name=="type") + { + if (opt.value=="1") + { + m_t << (first ? "[": ","); + m_t << "label=\\arabic*"; + first = false; + } + else if (opt.value=="a") + { + m_t << (first ? "[": ","); + m_t << "label=\\enumalphalphcnt*"; + first = false; + } + else if (opt.value=="A") + { + m_t << (first ? "[": ","); + m_t << "label=\\enumAlphAlphcnt*"; + first = false; + } + else if (opt.value=="i") + { + m_t << (first ? "[": ","); + m_t << "label=\\roman*"; + first = false; + } + else if (opt.value=="I") + { + m_t << (first ? "[": ","); + m_t << "label=\\Roman*"; + first = false; + } + } + else if (opt.name=="start") + { + m_t << (first ? "[": ","); + m_t << "start=" << opt.value; + first = false; + } + } + if (!first) m_t << "]\n"; + } else m_t << "\n\\begin{DoxyItemize}"; } @@ -1045,7 +1091,7 @@ static bool tableIsNested(const DocNode *n) return isNested; } -static void writeStartTableCommand(std::ostream &t,const DocNode *n,int cols) +static void writeStartTableCommand(TextStream &t,const DocNode *n,int cols) { if (tableIsNested(n)) { @@ -1058,7 +1104,7 @@ static void writeStartTableCommand(std::ostream &t,const DocNode *n,int cols) //return isNested ? "TabularNC" : "TabularC"; } -static void writeEndTableCommand(std::ostream &t,const DocNode *n) +static void writeEndTableCommand(TextStream &t,const DocNode *n) { if (tableIsNested(n)) { @@ -1450,7 +1496,7 @@ void LatexDocVisitor::visitPre(DocRef *ref) // ref->anchor() for LaTeX/RTF if (ref->isSubPage()) { - startLink(ref->ref(),0,ref->anchor()); + startLink(ref->ref(),QCString(),ref->anchor()); } else { @@ -1464,7 +1510,7 @@ void LatexDocVisitor::visitPost(DocRef *ref) if (m_hide) return; if (ref->isSubPage()) { - endLink(ref->ref(),0,ref->anchor()); + endLink(ref->ref(),QCString(),ref->anchor()); } else { @@ -1708,13 +1754,13 @@ void LatexDocVisitor::visitPost(DocXRefItem *x) void LatexDocVisitor::visitPre(DocInternalRef *ref) { if (m_hide) return; - startLink(0,ref->file(),ref->anchor()); + startLink(QCString(),ref->file(),ref->anchor()); } void LatexDocVisitor::visitPost(DocInternalRef *ref) { if (m_hide) return; - endLink(0,ref->file(),ref->anchor()); + endLink(QCString(),ref->file(),ref->anchor()); } void LatexDocVisitor::visitPre(DocText *) @@ -1757,7 +1803,7 @@ void LatexDocVisitor::visitPost(DocParBlock *) if (m_hide) return; } -void LatexDocVisitor::filter(const char *str) +void LatexDocVisitor::filter(const QCString &str) { filterLatexString(m_t,str, m_insideTabbing, diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h index 5e590eb..696147f 100644 --- a/src/latexdocvisitor.h +++ b/src/latexdocvisitor.h @@ -22,13 +22,14 @@ #include "docvisitor.h" class LatexCodeGenerator; +class TextStream; /*! @brief Concrete visitor implementation for LaTeX output. */ class LatexDocVisitor : public DocVisitor { public: - LatexDocVisitor(std::ostream &t,LatexCodeGenerator &ci, - const char *langExt,bool insideTabbing); + LatexDocVisitor(TextStream &t,LatexCodeGenerator &ci, + const QCString &langExt,bool insideTabbing); //-------------------------------------- // visitor functions for leaf nodes @@ -151,7 +152,7 @@ class LatexDocVisitor : public DocVisitor // helper functions //-------------------------------------- - void filter(const char *str); + void filter(const QCString &str); void startLink(const QCString &ref,const QCString &file, const QCString &anchor,bool refToTable=FALSE); void endLink(const QCString &ref,const QCString &file, @@ -176,7 +177,7 @@ class LatexDocVisitor : public DocVisitor // state variables //-------------------------------------- - std::ostream &m_t; + TextStream &m_t; LatexCodeGenerator &m_ci; bool m_insidePre; bool m_insideItem; diff --git a/src/latexgen.cpp b/src/latexgen.cpp index c0c3e47..fdcb993 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -49,23 +49,17 @@ static QCString g_header; static QCString g_footer; -LatexCodeGenerator::LatexCodeGenerator(std::ostream &t,const QCString &relPath,const QCString &sourceFileName) - : m_t(nullptr), m_relPath(relPath), m_sourceFileName(sourceFileName) +LatexCodeGenerator::LatexCodeGenerator(TextStream &t,const QCString &relPath,const QCString &sourceFileName) + : m_t(t), m_relPath(relPath), m_sourceFileName(sourceFileName) { m_prettyCode=Config_getBool(LATEX_SOURCE_CODE); - setTextStream(t); } -LatexCodeGenerator::LatexCodeGenerator() : m_t(nullptr) +LatexCodeGenerator::LatexCodeGenerator(TextStream &t) : m_t(t) { m_prettyCode=Config_getBool(LATEX_SOURCE_CODE); } -void LatexCodeGenerator::setTextStream(std::ostream &t) -{ - m_t.rdbuf(t.rdbuf()); -} - void LatexCodeGenerator::setRelativePath(const QCString &path) { m_relPath = path; @@ -76,11 +70,11 @@ void LatexCodeGenerator::setSourceFileName(const QCString &name) m_sourceFileName = name; } -void LatexCodeGenerator::codify(const char *str) +void LatexCodeGenerator::codify(const QCString &str) { - if (str) + if (!str.isEmpty()) { - const signed char *p=(const signed char*)str; + const signed char *p=(const signed char*)str.data(); signed char c; //char cs[5]; int spacesToNextTabStop; @@ -154,19 +148,19 @@ void LatexCodeGenerator::codify(const char *str) } -void LatexCodeGenerator::writeCodeLink(const char *ref,const char *f, - const char *anchor,const char *name, - const char *) +void LatexCodeGenerator::writeCodeLink(const QCString &ref,const QCString &f, + const QCString &anchor,const QCString &name, + const QCString &) { bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS); bool usePDFLatex = Config_getBool(USE_PDFLATEX); - int l = qstrlen(name); - if (!ref && usePDFLatex && pdfHyperlinks) + uint l = name.length(); + if (ref.isEmpty() && usePDFLatex && pdfHyperlinks) { m_t << "\\mbox{\\hyperlink{"; - if (f) m_t << stripPath(f); - if (f && anchor) m_t << "_"; - if (anchor) m_t << anchor; + if (!f.isEmpty()) m_t << stripPath(f); + if (!f.isEmpty() && !anchor.isEmpty()) m_t << "_"; + if (!anchor.isEmpty()) m_t << anchor; m_t << "}{"; codify(name); m_t << "}}"; @@ -178,7 +172,7 @@ void LatexCodeGenerator::writeCodeLink(const char *ref,const char *f, m_col+=l; } -void LatexCodeGenerator::writeLineNumber(const char *ref,const char *fileName,const char *anchor,int l) +void LatexCodeGenerator::writeLineNumber(const QCString &ref,const QCString &fileName,const QCString &anchor,int l) { bool usePDFLatex = Config_getBool(USE_PDFLATEX); bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS); @@ -192,7 +186,7 @@ void LatexCodeGenerator::writeLineNumber(const char *ref,const char *fileName,co QCString lineNumber; lineNumber.sprintf("%05d",l); - if (fileName && !m_sourceFileName.isEmpty()) + if (!fileName.isEmpty() && !m_sourceFileName.isEmpty()) { QCString lineAnchor; lineAnchor.sprintf("_l%05d",l); @@ -202,7 +196,7 @@ void LatexCodeGenerator::writeLineNumber(const char *ref,const char *fileName,co { m_t << "\\Hypertarget{" << stripPath(lineAnchor) << "}"; } - writeCodeLink(ref,fileName,anchor,lineNumber,0); + writeCodeLink(ref,fileName,anchor,lineNumber,QCString()); } else { @@ -238,7 +232,7 @@ void LatexCodeGenerator::endCodeLine() codify("\n"); } -void LatexCodeGenerator::startFontClass(const char *name) +void LatexCodeGenerator::startFontClass(const QCString &name) { m_t << "\\textcolor{" << name << "}{"; } @@ -248,12 +242,12 @@ void LatexCodeGenerator::endFontClass() m_t << "}"; } -void LatexCodeGenerator::startCodeFragment(const char *style) +void LatexCodeGenerator::startCodeFragment(const QCString &style) { m_t << "\n\\begin{" << style << "}{" << m_usedTableLevel << "}\n"; } -void LatexCodeGenerator::endCodeFragment(const char *style) +void LatexCodeGenerator::endCodeFragment(const QCString &style) { //endCodeLine checks is there is still an open code line, if so closes it. endCodeLine(); @@ -264,12 +258,12 @@ void LatexCodeGenerator::endCodeFragment(const char *style) //------------------------------- -LatexGenerator::LatexGenerator() : OutputGenerator(Config_getString(LATEX_OUTPUT)) +LatexGenerator::LatexGenerator() : OutputGenerator(Config_getString(LATEX_OUTPUT)), m_codeGen(m_t) { //printf("LatexGenerator::LatexGenerator() m_insideTabbing=FALSE\n"); } -LatexGenerator::LatexGenerator(const LatexGenerator &og) : OutputGenerator(og) +LatexGenerator::LatexGenerator(const LatexGenerator &og) : OutputGenerator(og), m_codeGen(og.m_codeGen) { } @@ -292,11 +286,12 @@ static void writeLatexMakefile() { bool generateBib = !CitationManager::instance().isEmpty(); QCString fileName=Config_getString(LATEX_OUTPUT)+"/Makefile"; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { - term("Could not open file %s for writing\n",fileName.data()); + term("Could not open file %s for writing\n",qPrint(fileName)); } + TextStream t(&f); // inserted by KONNO Akihisa <konno@researchers.jp> 2002-03-05 QCString latex_command = theTranslator->latexCommandName(); QCString mkidx_command = Config_getString(MAKEINDEX_CMD_NAME); @@ -392,7 +387,7 @@ static void writeMakeBat() std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); if (!t.is_open()) { - term("Could not open file %s for writing\n",fileName.data()); + term("Could not open file %s for writing\n",qPrint(fileName)); } t << "set Dir_Old=%cd%\r\n"; t << "cd /D %~dp0\r\n\r\n"; @@ -471,13 +466,13 @@ void LatexGenerator::init() Dir d(dname.str()); if (!d.exists() && !d.mkdir(dname.str())) { - term("Could not create output directory %s\n",dname.data()); + term("Could not create output directory %s\n",qPrint(dname)); } if (!Config_getString(LATEX_HEADER).isEmpty()) { g_header=fileToString(Config_getString(LATEX_HEADER)); - //printf("g_header='%s'\n",g_header.data()); + //printf("g_header='%s'\n",qPrint(g_header)); } else { @@ -486,7 +481,7 @@ void LatexGenerator::init() if (!Config_getString(LATEX_FOOTER).isEmpty()) { g_footer=fileToString(Config_getString(LATEX_FOOTER)); - //printf("g_footer='%s'\n",g_footer.data()); + //printf("g_footer='%s'\n",qPrint(g_footer)); } else { @@ -499,30 +494,30 @@ void LatexGenerator::init() createSubDirs(d); } -static void writeDefaultStyleSheet(std::ostream &t) +static void writeDefaultStyleSheet(TextStream &t) { t << ResourceMgr::instance().getAsString("doxygen.sty"); } -void LatexGenerator::writeHeaderFile(std::ostream &t) +void LatexGenerator::writeHeaderFile(TextStream &t) { t << "% Latex header for doxygen " << getDoxygenVersion() << "\n"; t << ResourceMgr::instance().getAsString("header.tex"); } -void LatexGenerator::writeFooterFile(std::ostream &t) +void LatexGenerator::writeFooterFile(TextStream &t) { t << "% Latex footer for doxygen " << getDoxygenVersion() << "\n"; t << ResourceMgr::instance().getAsString("footer.tex"); } -void LatexGenerator::writeStyleSheetFile(std::ostream &t) +void LatexGenerator::writeStyleSheetFile(TextStream &t) { t << "% stylesheet for doxygen " << getDoxygenVersion() << "\n"; writeDefaultStyleSheet(t); } -void LatexGenerator::startFile(const char *name,const char *,const char *,int) +void LatexGenerator::startFile(const QCString &name,const QCString &,const QCString &,int) { #if 0 setEncoding(Config_getString(LATEX_OUTPUT_ENCODING)); @@ -531,7 +526,6 @@ void LatexGenerator::startFile(const char *name,const char *,const char *,int) m_relPath = relativePathToRoot(fileName); if (fileName.right(4)!=".tex" && fileName.right(4)!=".sty") fileName+=".tex"; startPlainFile(fileName); - m_codeGen.setTextStream(t); m_codeGen.setRelativePath(m_relPath); m_codeGen.setSourceFileName(stripPath(fileName)); } @@ -549,7 +543,7 @@ void LatexGenerator::endFile() void LatexGenerator::startProjectNumber() { - t << "\\\\[1ex]\\large "; + m_t << "\\\\[1ex]\\large "; } static QCString extraLatexStyleSheet() @@ -589,7 +583,7 @@ static QCString makeIndex() if (latex_mkidx_command[0] == '\\') result += latex_mkidx_command; else - result += '\\'+latex_mkidx_command; + result += "\\"+latex_mkidx_command; } else { @@ -613,12 +607,13 @@ static QCString substituteLatexKeywords(const QCString &str, style="plain"; } - std::ostringstream tg(std::ios_base::ate); + TextStream tg; bool timeStamp = Config_getBool(LATEX_TIMESTAMP); QCString generatedBy; if (timeStamp) { - generatedBy = theTranslator->trGeneratedAt(dateToString(TRUE), Config_getString(PROJECT_NAME)); + generatedBy = theTranslator->trGeneratedAt(dateToString(TRUE).data(), + Config_getString(PROJECT_NAME).data()); } else { @@ -639,11 +634,11 @@ static QCString substituteLatexKeywords(const QCString &str, if (latexEmojiDirectory.isEmpty()) latexEmojiDirectory = "."; latexEmojiDirectory = substitute(latexEmojiDirectory,"\\","/"); - std::ostringstream tg1(std::ios_base::ate); + TextStream tg1; writeExtraLatexPackages(tg1); QCString extraLatexPackages = tg1.str(); - std::ostringstream tg2(std::ios_base::ate); + TextStream tg2; writeLatexSpecialFormulaChars(tg2); QCString latexSpecialFormulaChars = tg2.str(); @@ -652,7 +647,7 @@ static QCString substituteLatexKeywords(const QCString &str, { FileInfo fi(formulaMacrofile.str()); formulaMacrofile=fi.absFilePath(); - QCString stripMacroFile = fi.fileName().data(); + QCString stripMacroFile = fi.fileName(); copyFile(formulaMacrofile,Config_getString(LATEX_OUTPUT) + "/" + stripMacroFile); } @@ -701,45 +696,49 @@ void LatexGenerator::startIndexSection(IndexSections is) switch (is) { case isTitlePageStart: - t << substituteLatexKeywords(g_header,convertToLaTeX(Config_getString(PROJECT_NAME))); + m_t << substituteLatexKeywords(g_header,convertToLaTeX(Config_getString(PROJECT_NAME))); break; case isTitlePageAuthor: break; case isMainPage: - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //Introduction}\n" + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Introduction}\n" break; //case isPackageIndex: - // if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - // t << "{"; //Package Index}\n" + // if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + // m_t << "{"; //Package Index}\n" // break; case isModuleIndex: - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //Module Index}\n" + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Module Index}\n" break; case isDirIndex: - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //Directory Index}\n" + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Directory Index}\n" break; case isNamespaceIndex: - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //Namespace Index}\n" + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Namespace Index}\n" + break; + case isConceptIndex: + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Concept Index}\n" break; case isClassHierarchyIndex: - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //Hierarchical Index}\n" + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Hierarchical Index}\n" break; case isCompoundIndex: - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //Annotated Compound Index}\n" + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Annotated Compound Index}\n" break; case isFileIndex: - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //Annotated File Index}\n" + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Annotated File Index}\n" break; case isPageIndex: - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //Annotated Page Index}\n" + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Annotated Page Index}\n" break; case isModuleDocumentation: { @@ -747,8 +746,8 @@ void LatexGenerator::startIndexSection(IndexSections is) { if (!gd->isReference()) { - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //Module Documentation}\n"; + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Module Documentation}\n"; break; } } @@ -760,8 +759,8 @@ void LatexGenerator::startIndexSection(IndexSections is) { if (dd->isLinkableInProject()) { - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //Module Documentation}\n"; + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Module Documentation}\n"; break; } } @@ -773,8 +772,21 @@ void LatexGenerator::startIndexSection(IndexSections is) { if (nd->isLinkableInProject() && !nd->isAlias()) { - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; // Namespace Documentation}\n": + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; // Namespace Documentation}\n": + break; + } + } + } + break; + case isConceptDocumentation: + { + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + if (cd->isLinkableInProject() && !cd->isAlias()) + { + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; // Concept Documentation}\n": break; } } @@ -790,8 +802,8 @@ void LatexGenerator::startIndexSection(IndexSections is) !cd->isAlias() ) { - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //Compound Documentation}\n"; + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Compound Documentation}\n"; break; } } @@ -808,8 +820,8 @@ void LatexGenerator::startIndexSection(IndexSections is) { if (isFirst) { - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //File Documentation}\n"; + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //File Documentation}\n"; isFirst=FALSE; break; } @@ -820,14 +832,14 @@ void LatexGenerator::startIndexSection(IndexSections is) break; case isExampleDocumentation: { - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //Example Documentation}\n"; + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Example Documentation}\n"; } break; case isPageDocumentation: { - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{"; //Page Documentation}\n"; + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{"; //Page Documentation}\n"; } break; case isPageDocumentation2: @@ -850,31 +862,34 @@ void LatexGenerator::endIndexSection(IndexSections is) { //QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index"; QCString indexName="index"; - t << "}\n\\label{index}"; - if (Config_getBool(PDF_HYPERLINKS)) t << "\\hypertarget{index}{}"; - t << "\\input{" << indexName << "}\n"; + m_t << "}\n\\label{index}"; + if (Config_getBool(PDF_HYPERLINKS)) m_t << "\\hypertarget{index}{}"; + m_t << "\\input{" << indexName << "}\n"; } break; case isModuleIndex: - t << "}\n\\input{modules}\n"; + m_t << "}\n\\input{modules}\n"; break; case isDirIndex: - t << "}\n\\input{dirs}\n"; + m_t << "}\n\\input{dirs}\n"; break; case isNamespaceIndex: - t << "}\n\\input{namespaces}\n"; + m_t << "}\n\\input{namespaces}\n"; + break; + case isConceptIndex: + m_t << "}\n\\input{concepts}\n"; break; case isClassHierarchyIndex: - t << "}\n\\input{hierarchy}\n"; + m_t << "}\n\\input{hierarchy}\n"; break; case isCompoundIndex: - t << "}\n\\input{annotated}\n"; + m_t << "}\n\\input{annotated}\n"; break; case isFileIndex: - t << "}\n\\input{files}\n"; + m_t << "}\n\\input{files}\n"; break; case isPageIndex: - t << "}\n\\input{pages}\n"; + m_t << "}\n\\input{pages}\n"; break; case isModuleDocumentation: { @@ -885,10 +900,10 @@ void LatexGenerator::endIndexSection(IndexSections is) { if (!found) { - t << "}\n"; + m_t << "}\n"; found=TRUE; } - t << "\\input{" << gd->getOutputFileBase() << "}\n"; + m_t << "\\input{" << gd->getOutputFileBase() << "}\n"; } } } @@ -902,10 +917,10 @@ void LatexGenerator::endIndexSection(IndexSections is) { if (!found) { - t << "}\n"; + m_t << "}\n"; found = TRUE; } - t << "\\input{" << dd->getOutputFileBase() << "}\n"; + m_t << "\\input{" << dd->getOutputFileBase() << "}\n"; } } } @@ -919,10 +934,27 @@ void LatexGenerator::endIndexSection(IndexSections is) { if (!found) { - t << "}\n"; + m_t << "}\n"; found=true; } - t << "\\input{" << nd->getOutputFileBase() << "}\n"; + m_t << "\\input{" << nd->getOutputFileBase() << "}\n"; + } + } + } + break; + case isConceptDocumentation: + { + bool found=FALSE; + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + if (cd->isLinkableInProject() && !cd->isAlias()) + { + if (!found) + { + m_t << "}\n"; + found=true; + } + m_t << "\\input{" << cd->getOutputFileBase() << "}\n"; } } } @@ -940,10 +972,10 @@ void LatexGenerator::endIndexSection(IndexSections is) { if (!found) { - t << "}\n"; // end doxysection or chapter title + m_t << "}\n"; // end doxysection or chapter title found=TRUE; } - t << "\\input{" << cd->getOutputFileBase() << "}\n"; + m_t << "\\input{" << cd->getOutputFileBase() << "}\n"; } } } @@ -959,14 +991,14 @@ void LatexGenerator::endIndexSection(IndexSections is) { if (isFirst) { - t << "}\n"; // end doxysection or chapter title + m_t << "}\n"; // end doxysection or chapter title } isFirst=FALSE; - t << "\\input{" << fd->getOutputFileBase() << "}\n"; + m_t << "\\input{" << fd->getOutputFileBase() << "}\n"; if (sourceBrowser && m_prettyCode && fd->generateSourceFile()) { - //t << "\\include{" << fd->getSourceFileBase() << "}\n"; - t << "\\input{" << fd->getSourceFileBase() << "}\n"; + //m_t << "\\include{" << fd->getSourceFileBase() << "}\n"; + m_t << "\\input{" << fd->getSourceFileBase() << "}\n"; } } } @@ -975,28 +1007,28 @@ void LatexGenerator::endIndexSection(IndexSections is) break; case isExampleDocumentation: { - t << "}\n"; + m_t << "}\n"; for (const auto &pd : *Doxygen::exampleLinkedMap) { - t << "\\input{" << pd->getOutputFileBase() << "}\n"; + m_t << "\\input{" << pd->getOutputFileBase() << "}\n"; } } break; case isPageDocumentation: { - t << "}\n"; + m_t << "}\n"; #if 0 bool first=TRUE; for (const auto *pd : Doxygen::pageLinkedMap) { if (!pd->getGroupDef() && !pd->isReference()) { - if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; - t << "{" << pd->title(); - t << "}\n"; + if (compactLatex) m_t << "\\doxysection"; else m_t << "\\chapter"; + m_t << "{" << pd->title(); + m_t << "}\n"; - if (compactLatex || first) t << "\\input" ; else t << "\\include"; - t << "{" << pd->getOutputFileBase() << "}\n"; + if (compactLatex || first) m_t << "\\input" ; else m_t << "\\include"; + m_t << "{" << pd->getOutputFileBase() << "}\n"; first=FALSE; } } @@ -1006,18 +1038,18 @@ void LatexGenerator::endIndexSection(IndexSections is) case isPageDocumentation2: break; case isEndIndex: - t << substituteLatexKeywords(g_footer,convertToLaTeX(Config_getString(PROJECT_NAME))); + m_t << substituteLatexKeywords(g_footer,convertToLaTeX(Config_getString(PROJECT_NAME))); break; } } -void LatexGenerator::writePageLink(const char *name, bool /*first*/) +void LatexGenerator::writePageLink(const QCString &name, bool /*first*/) { //bool &compactLatex = Config_getBool(COMPACT_LATEX); // next is remove for bug615957 - //if (compactLatex || first) t << "\\input" ; else t << "\\include"; - t << "\\input" ; - t << "{" << name << "}\n"; + //if (compactLatex || first) m_t << "\\input" ; else m_t << "\\include"; + m_t << "\\input" ; + m_t << "{" << name << "}\n"; } @@ -1027,110 +1059,110 @@ void LatexGenerator::writeStyleInfo(int part) return; startPlainFile("doxygen.sty"); - writeDefaultStyleSheet(t); + writeDefaultStyleSheet(m_t); endPlainFile(); // workaround for the problem caused by change in LaTeX in version 2019 // in the unmaintained tabu package startPlainFile("tabu_doxygen.sty"); - t << ResourceMgr::instance().getAsString("tabu_doxygen.sty"); + m_t << ResourceMgr::instance().getAsString("tabu_doxygen.sty"); endPlainFile(); startPlainFile("longtable_doxygen.sty"); - t << ResourceMgr::instance().getAsString("longtable_doxygen.sty"); + m_t << ResourceMgr::instance().getAsString("longtable_doxygen.sty"); endPlainFile(); } void LatexGenerator::newParagraph() { - t << "\n" << "\n"; + m_t << "\n" << "\n"; } -void LatexGenerator::startParagraph(const char *) +void LatexGenerator::startParagraph(const QCString &) { - t << "\n" << "\n"; + m_t << "\n" << "\n"; } void LatexGenerator::endParagraph() { - t << "\n" << "\n"; + m_t << "\n" << "\n"; } -void LatexGenerator::writeString(const char *text) +void LatexGenerator::writeString(const QCString &text) { - t << text; + m_t << text; } -void LatexGenerator::startIndexItem(const char *ref,const char *fn) +void LatexGenerator::startIndexItem(const QCString &ref,const QCString &fn) { - t << "\\item "; - if (!ref && fn) + m_t << "\\item "; + if (ref.isEmpty() && !fn.isEmpty()) { - t << "\\contentsline{section}{"; + m_t << "\\contentsline{section}{"; } } -void LatexGenerator::endIndexItem(const char *ref,const char *fn) +void LatexGenerator::endIndexItem(const QCString &ref,const QCString &fn) { - if (!ref && fn) + if (ref.isEmpty() && !fn.isEmpty()) { - t << "}{\\pageref{" << stripPath(fn) << "}}{}\n"; + m_t << "}{\\pageref{" << stripPath(fn) << "}}{}\n"; } } -//void LatexGenerator::writeIndexFileItem(const char *,const char *text) +//void LatexGenerator::writeIndexFileItem(const QCString &,const QCString &text) //{ -// t << "\\item\\contentsline{section}{"; +// m_t << "\\item\\contentsline{section}{"; // docify(text); -// t << "}{\\pageref{" << stripPath(text) << "}}\n"; +// m_t << "}{\\pageref{" << stripPath(text) << "}}\n"; //} -void LatexGenerator::startHtmlLink(const char *url) +void LatexGenerator::startHtmlLink(const QCString &url) { if (Config_getBool(PDF_HYPERLINKS)) { - t << "\\href{"; - t << latexFilterURL(url); - t << "}"; + m_t << "\\href{"; + m_t << latexFilterURL(url); + m_t << "}"; } - t << "{\\texttt{ "; + m_t << "{\\texttt{ "; } void LatexGenerator::endHtmlLink() { - t << "}}"; + m_t << "}}"; } -//void LatexGenerator::writeMailLink(const char *url) +//void LatexGenerator::writeMailLink(const QCString &url) //{ // if (Config_getBool(PDF_HYPERLINKS)) // { -// t << "\\href{mailto:"; -// t << url; -// t << "}"; +// m_t << "\\href{mailto:"; +// m_t << url; +// m_t << "}"; // } -// t << "\\texttt{ "; +// m_t << "\\texttt{ "; // docify(url); -// t << "}"; +// m_t << "}"; //} -void LatexGenerator::writeStartAnnoItem(const char *,const char *, - const char *path,const char *name) +void LatexGenerator::writeStartAnnoItem(const QCString &,const QCString &, + const QCString &path,const QCString &name) { - t << "\\item\\contentsline{section}\\textbf{ "; - if (path) docify(path); + m_t << "\\item\\contentsline{section}\\textbf{ "; + if (!path.isEmpty()) docify(path); docify(name); - t << "} "; + m_t << "} "; } -void LatexGenerator::writeEndAnnoItem(const char *name) +void LatexGenerator::writeEndAnnoItem(const QCString &name) { - t << "}{\\pageref{" << stripPath(name) << "}}{}\n"; + m_t << "}{\\pageref{" << stripPath(name) << "}}{}\n"; } void LatexGenerator::startIndexKey() { - t << "\\item\\contentsline{section}{"; + m_t << "\\item\\contentsline{section}{"; } void LatexGenerator::endIndexKey() @@ -1139,37 +1171,37 @@ void LatexGenerator::endIndexKey() void LatexGenerator::startIndexValue(bool hasBrief) { - t << " "; - if (hasBrief) t << "\\\\*"; + m_t << " "; + if (hasBrief) m_t << "\\\\*"; } -void LatexGenerator::endIndexValue(const char *name,bool /*hasBrief*/) +void LatexGenerator::endIndexValue(const QCString &name,bool /*hasBrief*/) { - //if (hasBrief) t << ")"; - t << "}{\\pageref{" << stripPath(name) << "}}{}\n"; + //if (hasBrief) m_t << ")"; + m_t << "}{\\pageref{" << stripPath(name) << "}}{}\n"; } -//void LatexGenerator::writeClassLink(const char *,const char *, -// const char *,const char *name) +//void LatexGenerator::writeClassLink(const QCString &,const QCString &, +// const QCString &,const QCString &name) //{ -// t << "\\textbf{ "; +// m_t << "\\textbf{ "; // docify(name); -// t << "}"; +// m_t << "}"; //} -void LatexGenerator::startTextLink(const char *f,const char *anchor) +void LatexGenerator::startTextLink(const QCString &f,const QCString &anchor) { bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS); if (!m_disableLinks && pdfHyperlinks) { - t << "\\mbox{\\hyperlink{"; - if (f) t << stripPath(f); - if (anchor) t << "_" << anchor; - t << "}{"; + m_t << "\\mbox{\\hyperlink{"; + if (!f.isEmpty()) m_t << stripPath(f); + if (!anchor.isEmpty()) m_t << "_" << anchor; + m_t << "}{"; } else { - t << "\\textbf{ "; + m_t << "\\textbf{ "; } } @@ -1178,75 +1210,75 @@ void LatexGenerator::endTextLink() bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS); if (!m_disableLinks && pdfHyperlinks) { - t << "}"; + m_t << "}"; } - t << "}"; + m_t << "}"; } -void LatexGenerator::writeObjectLink(const char *ref, const char *f, - const char *anchor, const char *text) +void LatexGenerator::writeObjectLink(const QCString &ref, const QCString &f, + const QCString &anchor, const QCString &text) { bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS); - if (!m_disableLinks && !ref && pdfHyperlinks) + if (!m_disableLinks && ref.isEmpty() && pdfHyperlinks) { - t << "\\mbox{\\hyperlink{"; - if (f) t << stripPath(f); - if (f && anchor) t << "_"; - if (anchor) t << anchor; - t << "}{"; + m_t << "\\mbox{\\hyperlink{"; + if (!f.isEmpty()) m_t << stripPath(f); + if (!f.isEmpty() && !anchor.isEmpty()) m_t << "_"; + if (!anchor.isEmpty()) m_t << anchor; + m_t << "}{"; docify(text); - t << "}}"; + m_t << "}}"; } else { - t << "\\textbf{ "; + m_t << "\\textbf{ "; docify(text); - t << "}"; + m_t << "}"; } } void LatexGenerator::startPageRef() { - t << " \\doxyref{}{"; + m_t << " \\doxyref{}{"; } -void LatexGenerator::endPageRef(const char *clname, const char *anchor) +void LatexGenerator::endPageRef(const QCString &clname, const QCString &anchor) { - t << "}{"; - if (clname) t << clname; - if (anchor) t << "_" << anchor; - t << "}"; + m_t << "}{"; + if (!clname.isEmpty()) m_t << clname; + if (!anchor.isEmpty()) m_t << "_" << anchor; + m_t << "}"; } -void LatexGenerator::startTitleHead(const char *fileName) +void LatexGenerator::startTitleHead(const QCString &fileName) { bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS); bool usePDFLatex = Config_getBool(USE_PDFLATEX); - if (usePDFLatex && pdfHyperlinks && fileName) + if (usePDFLatex && pdfHyperlinks && !fileName.isEmpty()) { - t << "\\hypertarget{" << stripPath(fileName) << "}{}"; + m_t << "\\hypertarget{" << stripPath(fileName) << "}{}"; } if (Config_getBool(COMPACT_LATEX)) { - t << "\\doxysubsection{"; + m_t << "\\doxysubsection{"; } else { - t << "\\doxysection{"; + m_t << "\\doxysection{"; } } -void LatexGenerator::endTitleHead(const char *fileName,const char *name) +void LatexGenerator::endTitleHead(const QCString &fileName,const QCString &name) { - t << "}\n"; - if (name) + m_t << "}\n"; + if (!name.isEmpty()) { - t << "\\label{" << stripPath(fileName) << "}\\index{"; - t << latexEscapeLabelName(name); - t << "@{"; - t << latexEscapeIndexChars(name); - t << "}}\n"; + m_t << "\\label{" << stripPath(fileName) << "}\\index{"; + m_t << latexEscapeLabelName(name); + m_t << "@{"; + m_t << latexEscapeIndexChars(name); + m_t << "}}\n"; } } @@ -1254,11 +1286,11 @@ void LatexGenerator::startTitle() { if (Config_getBool(COMPACT_LATEX)) { - t << "\\doxysubsection{"; + m_t << "\\doxysubsection{"; } else { - t << "\\doxysection{"; + m_t << "\\doxysection{"; } } @@ -1271,19 +1303,19 @@ void LatexGenerator::startGroupHeader(int extraIndentLevel) if (extraIndentLevel==3) { - t << "\\doxysubparagraph*{"; + m_t << "\\doxysubparagraph*{"; } else if (extraIndentLevel==2) { - t << "\\doxyparagraph{"; + m_t << "\\doxyparagraph{"; } else if (extraIndentLevel==1) { - t << "\\doxysubsubsection{"; + m_t << "\\doxysubsubsection{"; } else // extraIndentLevel==0 { - t << "\\doxysubsection{"; + m_t << "\\doxysubsection{"; } m_disableLinks=TRUE; } @@ -1291,18 +1323,18 @@ void LatexGenerator::startGroupHeader(int extraIndentLevel) void LatexGenerator::endGroupHeader(int) { m_disableLinks=FALSE; - t << "}\n"; + m_t << "}\n"; } -void LatexGenerator::startMemberHeader(const char *,int) +void LatexGenerator::startMemberHeader(const QCString &,int) { if (Config_getBool(COMPACT_LATEX)) { - t << "\\doxysubsubsection*{"; + m_t << "\\doxysubsubsection*{"; } else { - t << "\\doxysubsection*{"; + m_t << "\\doxysubsection*{"; } m_disableLinks=TRUE; } @@ -1310,46 +1342,46 @@ void LatexGenerator::startMemberHeader(const char *,int) void LatexGenerator::endMemberHeader() { m_disableLinks=FALSE; - t << "}\n"; + m_t << "}\n"; } -void LatexGenerator::startMemberDoc(const char *clname, - const char *memname, - const char *, - const char *title, +void LatexGenerator::startMemberDoc(const QCString &clname, + const QCString &memname, + const QCString &, + const QCString &title, int memCount, int memTotal, bool showInline) { - if (memname && memname[0]!='@') + if (!memname.isEmpty() && memname[0]!='@') { - t << "\\index{"; - if (clname) + m_t << "\\index{"; + if (!clname.isEmpty()) { - t << latexEscapeLabelName(clname); - t << "@{"; - t << latexEscapeIndexChars(clname); - t << "}!"; + m_t << latexEscapeLabelName(clname); + m_t << "@{"; + m_t << latexEscapeIndexChars(clname); + m_t << "}!"; } - t << latexEscapeLabelName(memname); - t << "@{"; - t << latexEscapeIndexChars(memname); - t << "}}\n"; - - t << "\\index{"; - t << latexEscapeLabelName(memname); - t << "@{"; - t << latexEscapeIndexChars(memname); - t << "}"; - if (clname) + m_t << latexEscapeLabelName(memname); + m_t << "@{"; + m_t << latexEscapeIndexChars(memname); + m_t << "}}\n"; + + m_t << "\\index{"; + m_t << latexEscapeLabelName(memname); + m_t << "@{"; + m_t << latexEscapeIndexChars(memname); + m_t << "}"; + if (!clname.isEmpty()) { - t << "!"; - t << latexEscapeLabelName(clname); - t << "@{"; - t << latexEscapeIndexChars(clname); - t << "}"; + m_t << "!"; + m_t << latexEscapeLabelName(clname); + m_t << "@{"; + m_t << latexEscapeIndexChars(clname); + m_t << "}"; } - t << "}\n"; + m_t << "}\n"; } static const char *levelLab[] = { "doxysubsubsection","doxyparagraph","doxysubparagraph", "doxysubparagraph" }; bool compactLatex = Config_getBool(COMPACT_LATEX); @@ -1357,151 +1389,151 @@ void LatexGenerator::startMemberDoc(const char *clname, int level=0; if (showInline) level+=2; if (compactLatex) level++; - t << "\\" << levelLab[level]; + m_t << "\\" << levelLab[level]; - t << "{"; + m_t << "{"; if (pdfHyperlinks) { - t << "\\texorpdfstring{"; + m_t << "\\texorpdfstring{"; } - t << latexEscapeIndexChars(title); + m_t << latexEscapeIndexChars(title); if (pdfHyperlinks) { - t << "}{" << latexEscapePDFString(title) << "}"; + m_t << "}{" << latexEscapePDFString(title) << "}"; } if (memTotal>1) { - t << "\\hspace{0.1cm}{\\footnotesize\\ttfamily [" << memCount << "/" << memTotal << "]}"; + m_t << "\\hspace{0.1cm}{\\footnotesize\\ttfamily [" << memCount << "/" << memTotal << "]}"; } - t << "}"; - t << "\n{\\footnotesize\\ttfamily "; + m_t << "}"; + m_t << "\n{\\footnotesize\\ttfamily "; //m_disableLinks=TRUE; } void LatexGenerator::endMemberDoc(bool) { m_disableLinks=FALSE; - t << "}\n\n"; - //if (Config_getBool(COMPACT_LATEX)) t << "\\hfill"; + m_t << "}\n\n"; + //if (Config_getBool(COMPACT_LATEX)) m_t << "\\hfill"; } -void LatexGenerator::startDoxyAnchor(const char *fName,const char *, - const char *anchor, const char *, - const char *) +void LatexGenerator::startDoxyAnchor(const QCString &fName,const QCString &, + const QCString &anchor, const QCString &, + const QCString &) { bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS); bool usePDFLatex = Config_getBool(USE_PDFLATEX); - t << "\\mbox{"; + m_t << "\\mbox{"; if (usePDFLatex && pdfHyperlinks) { - t << "\\Hypertarget{"; - if (fName) t << stripPath(fName); - if (anchor) t << "_" << anchor; - t << "}"; + m_t << "\\Hypertarget{"; + if (!fName.isEmpty()) m_t << stripPath(fName); + if (!anchor.isEmpty()) m_t << "_" << anchor; + m_t << "}"; } - t << "\\label{"; - if (fName) t << stripPath(fName); - if (anchor) t << "_" << anchor; - t << "}} \n"; + m_t << "\\label{"; + if (!fName.isEmpty()) m_t << stripPath(fName); + if (!anchor.isEmpty()) m_t << "_" << anchor; + m_t << "}} \n"; } -void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor) +void LatexGenerator::endDoxyAnchor(const QCString &fName,const QCString &anchor) { } -void LatexGenerator::writeAnchor(const char *fName,const char *name) +void LatexGenerator::writeAnchor(const QCString &fName,const QCString &name) { //printf("LatexGenerator::writeAnchor(%s,%s)\n",fName,name); - t << "\\label{" << stripPath(name) << "}\n"; + m_t << "\\label{" << stripPath(name) << "}\n"; bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS); bool usePDFLatex = Config_getBool(USE_PDFLATEX); if (usePDFLatex && pdfHyperlinks) { - if (fName) + if (!fName.isEmpty()) { - t << "\\Hypertarget{" << stripPath(fName) << "_" << stripPath(name) << "}\n"; + m_t << "\\Hypertarget{" << stripPath(fName) << "_" << stripPath(name) << "}\n"; } else { - t << "\\Hypertarget{" << stripPath(name) << "}\n"; + m_t << "\\Hypertarget{" << stripPath(name) << "}\n"; } } } -//void LatexGenerator::writeLatexLabel(const char *clName,const char *anchor) +//void LatexGenerator::writeLatexLabel(const QCString &clName,const QCString &anchor) //{ // writeDoxyAnchor(0,clName,anchor,0); //} -void LatexGenerator::addIndexItem(const char *s1,const char *s2) +void LatexGenerator::addIndexItem(const QCString &s1,const QCString &s2) { - if (s1) + if (!s1.isEmpty()) { - t << "\\index{"; - t << latexEscapeLabelName(s1); - t << "@{"; - t << latexEscapeIndexChars(s1); - t << "}"; - if (s2) + m_t << "\\index{"; + m_t << latexEscapeLabelName(s1); + m_t << "@{"; + m_t << latexEscapeIndexChars(s1); + m_t << "}"; + if (!s2.isEmpty()) { - t << "!"; - t << latexEscapeLabelName(s2); - t << "@{"; - t << latexEscapeIndexChars(s2); - t << "}"; + m_t << "!"; + m_t << latexEscapeLabelName(s2); + m_t << "@{"; + m_t << latexEscapeIndexChars(s2); + m_t << "}"; } - t << "}"; + m_t << "}"; } } -void LatexGenerator::startSection(const char *lab,const char *,SectionType type) +void LatexGenerator::startSection(const QCString &lab,const QCString &,SectionType type) { bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS); bool usePDFLatex = Config_getBool(USE_PDFLATEX); if (usePDFLatex && pdfHyperlinks) { - t << "\\hypertarget{" << stripPath(lab) << "}{}"; + m_t << "\\hypertarget{" << stripPath(lab) << "}{}"; } - t << "\\"; + m_t << "\\"; if (Config_getBool(COMPACT_LATEX)) { switch(type) { - case SectionType::Page: t << "doxysubsection"; break; - case SectionType::Section: t << "doxysubsubsection"; break; - case SectionType::Subsection: t << "doxyparagraph"; break; - case SectionType::Subsubsection: t << "doxysubparagraph"; break; - case SectionType::Paragraph: t << "doxysubparagraph"; break; + case SectionType::Page: m_t << "doxysubsection"; break; + case SectionType::Section: m_t << "doxysubsubsection"; break; + case SectionType::Subsection: m_t << "doxyparagraph"; break; + case SectionType::Subsubsection: m_t << "doxysubparagraph"; break; + case SectionType::Paragraph: m_t << "doxysubparagraph"; break; default: ASSERT(0); break; } - t << "{"; + m_t << "{"; } else { switch(type) { - case SectionType::Page: t << "doxysection"; break; - case SectionType::Section: t << "doxysubsection"; break; - case SectionType::Subsection: t << "doxysubsubsection"; break; - case SectionType::Subsubsection: t << "doxyparagraph"; break; - case SectionType::Paragraph: t << "doxysubparagraph"; break; + case SectionType::Page: m_t << "doxysection"; break; + case SectionType::Section: m_t << "doxysubsection"; break; + case SectionType::Subsection: m_t << "doxysubsubsection"; break; + case SectionType::Subsubsection: m_t << "doxyparagraph"; break; + case SectionType::Paragraph: m_t << "doxysubparagraph"; break; default: ASSERT(0); break; } - t << "{"; + m_t << "{"; } } -void LatexGenerator::endSection(const char *lab,SectionType) +void LatexGenerator::endSection(const QCString &lab,SectionType) { - t << "}\\label{" << lab << "}\n"; + m_t << "}\\label{" << lab << "}\n"; } -void LatexGenerator::docify(const char *str) +void LatexGenerator::docify(const QCString &str) { - filterLatexString(t,str, + filterLatexString(m_t,str, m_insideTabbing, // insideTabbing false, // insidePre false, // insideItem @@ -1520,14 +1552,14 @@ void LatexGenerator::writeChar(char c) void LatexGenerator::startClassDiagram() { - //if (Config_getBool(COMPACT_LATEX)) t << "\\doxysubsubsection"; else t << "\\doxysubsection"; - //t << "{"; + //if (Config_getBool(COMPACT_LATEX)) m_t << "\\doxysubsubsection"; else m_t << "\\doxysubsection"; + //m_t << "{"; } void LatexGenerator::endClassDiagram(const ClassDiagram &d, - const char *fileName,const char *) + const QCString &fileName,const QCString &) { - d.writeFigure(t,dir(),fileName); + d.writeFigure(m_t,dir(),fileName); } @@ -1535,8 +1567,8 @@ void LatexGenerator::startAnonTypeScope(int indent) { if (indent==0) { - t << "\\begin{tabbing}\n"; - t << "xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=\\kill\n"; + m_t << "\\begin{tabbing}\n"; + m_t << "xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=xx\\=\\kill\n"; m_insideTabbing=TRUE; } m_indent=indent; @@ -1546,7 +1578,7 @@ void LatexGenerator::endAnonTypeScope(int indent) { if (indent==0) { - t << "\n" << "\\end{tabbing}"; + m_t << "\n" << "\\end{tabbing}"; m_insideTabbing=FALSE; } m_indent=indent; @@ -1556,24 +1588,24 @@ void LatexGenerator::startMemberTemplateParams() { if (templateMemberItem) { - t << "{\\footnotesize "; + m_t << "{\\footnotesize "; } } -void LatexGenerator::endMemberTemplateParams(const char *,const char *) +void LatexGenerator::endMemberTemplateParams(const QCString &,const QCString &) { if (templateMemberItem) { - t << "}\\\\"; + m_t << "}\\\\"; } } -void LatexGenerator::startMemberItem(const char *,int annoType,const char *) +void LatexGenerator::startMemberItem(const QCString &,int annoType,const QCString &) { //printf("LatexGenerator::startMemberItem(%d)\n",annType); if (!m_insideTabbing) { - t << "\\item \n"; + m_t << "\\item \n"; templateMemberItem = (annoType == 3); } } @@ -1582,22 +1614,22 @@ void LatexGenerator::endMemberItem() { if (m_insideTabbing) { - t << "\\\\"; + m_t << "\\\\"; } templateMemberItem = FALSE; - t << "\n"; + m_t << "\n"; } -void LatexGenerator::startMemberDescription(const char *,const char *,bool) +void LatexGenerator::startMemberDescription(const QCString &,const QCString &,bool) { if (!m_insideTabbing) { - t << "\\begin{DoxyCompactList}\\small\\item\\em "; + m_t << "\\begin{DoxyCompactList}\\small\\item\\em "; } else { - for (int i=0;i<m_indent+2;i++) t << "\\>"; - t << "{\\em "; + for (int i=0;i<m_indent+2;i++) m_t << "\\>"; + m_t << "{\\em "; } } @@ -1605,12 +1637,12 @@ void LatexGenerator::endMemberDescription() { if (!m_insideTabbing) { - //t << "\\item\\end{DoxyCompactList}"; - t << "\\end{DoxyCompactList}"; + //m_t << "\\item\\end{DoxyCompactList}"; + m_t << "\\end{DoxyCompactList}"; } else { - t << "}\\\\\n"; + m_t << "}\\\\\n"; } } @@ -1620,11 +1652,11 @@ void LatexGenerator::writeNonBreakableSpace(int) //printf("writeNonBreakableSpace()\n"); if (m_insideTabbing) { - t << "\\>"; + m_t << "\\>"; } else { - t << "~"; + m_t << "~"; } } @@ -1642,23 +1674,23 @@ void LatexGenerator::writeNonBreakableSpace(int) // - endDescTableRow() // endDescTable() -void LatexGenerator::startDescTable(const char *title) +void LatexGenerator::startDescTable(const QCString &title) { m_codeGen.incUsedTableLevel(); - t << "\\begin{DoxyEnumFields}{" << title << "}\n"; + m_t << "\\begin{DoxyEnumFields}{" << title << "}\n"; } void LatexGenerator::endDescTable() { m_codeGen.decUsedTableLevel(); - t << "\\end{DoxyEnumFields}\n"; + m_t << "\\end{DoxyEnumFields}\n"; } void LatexGenerator::startDescTableRow() { // this is needed to prevent the \hypertarget, \label, and \index commands from messing up // the row height (based on http://tex.stackexchange.com/a/186102) - t << "\\raisebox{\\heightof{T}}[0pt][0pt]{"; + m_t << "\\raisebox{\\heightof{T}}[0pt][0pt]{"; } void LatexGenerator::endDescTableRow() @@ -1667,7 +1699,7 @@ void LatexGenerator::endDescTableRow() void LatexGenerator::startDescTableTitle() { - t << "}"; + m_t << "}"; } void LatexGenerator::endDescTableTitle() @@ -1676,12 +1708,12 @@ void LatexGenerator::endDescTableTitle() void LatexGenerator::startDescTableData() { - t << "&"; + m_t << "&"; } void LatexGenerator::endDescTableData() { - t << "\\\\\n\\hline\n\n"; + m_t << "\\\\\n\\hline\n\n"; } void LatexGenerator::lastIndexPage() @@ -1693,7 +1725,7 @@ void LatexGenerator::startMemberList() { if (!m_insideTabbing) { - t << "\\begin{DoxyCompactItemize}\n"; + m_t << "\\begin{DoxyCompactItemize}\n"; } } @@ -1702,41 +1734,41 @@ void LatexGenerator::endMemberList() //printf("LatexGenerator::endMemberList(%d)\n",m_insideTabbing); if (!m_insideTabbing) { - t << "\\end{DoxyCompactItemize}\n"; + m_t << "\\end{DoxyCompactItemize}\n"; } } void LatexGenerator::startMemberGroupHeader(bool hasHeader) { - if (hasHeader) t << "\\begin{Indent}"; - t << "\\textbf{ "; + if (hasHeader) m_t << "\\begin{Indent}"; + m_t << "\\textbf{ "; // changed back to rev 756 due to bug 660501 //if (Config_getBool(COMPACT_LATEX)) //{ - // t << "\\doxysubparagraph*{"; + // m_t << "\\doxysubparagraph*{"; //} //else //{ - // t << "\\doxyparagraph*{"; + // m_t << "\\doxyparagraph*{"; //} } void LatexGenerator::endMemberGroupHeader() { // changed back to rev 756 due to bug 660501 - t << "}\\par\n"; - //t << "}\n"; + m_t << "}\\par\n"; + //m_t << "}\n"; } void LatexGenerator::startMemberGroupDocs() { - t << "{\\em "; + m_t << "{\\em "; } void LatexGenerator::endMemberGroupDocs() { - t << "}"; + m_t << "}"; } void LatexGenerator::startMemberGroup() @@ -1745,8 +1777,8 @@ void LatexGenerator::startMemberGroup() void LatexGenerator::endMemberGroup(bool hasHeader) { - if (hasHeader)t << "\\end{Indent}"; - t << "\n"; + if (hasHeader)m_t << "\\end{Indent}"; + m_t << "\n"; } void LatexGenerator::startDotGraph() @@ -1756,7 +1788,7 @@ void LatexGenerator::startDotGraph() void LatexGenerator::endDotGraph(DotClassGraph &g) { - g.writeGraph(t,GOF_EPS,EOF_LaTeX,dir(),fileName(),m_relPath); + g.writeGraph(m_t,GOF_EPS,EOF_LaTeX,dir(),fileName(),m_relPath); } void LatexGenerator::startInclDepGraph() @@ -1765,7 +1797,7 @@ void LatexGenerator::startInclDepGraph() void LatexGenerator::endInclDepGraph(DotInclDepGraph &g) { - g.writeGraph(t,GOF_EPS,EOF_LaTeX,dir(),fileName(),m_relPath); + g.writeGraph(m_t,GOF_EPS,EOF_LaTeX,dir(),fileName(),m_relPath); } void LatexGenerator::startGroupCollaboration() @@ -1774,7 +1806,7 @@ void LatexGenerator::startGroupCollaboration() void LatexGenerator::endGroupCollaboration(DotGroupCollaboration &g) { - g.writeGraph(t,GOF_EPS,EOF_LaTeX,dir(),fileName(),m_relPath); + g.writeGraph(m_t,GOF_EPS,EOF_LaTeX,dir(),fileName(),m_relPath); } void LatexGenerator::startCallGraph() @@ -1783,7 +1815,7 @@ void LatexGenerator::startCallGraph() void LatexGenerator::endCallGraph(DotCallGraph &g) { - g.writeGraph(t,GOF_EPS,EOF_LaTeX,dir(),fileName(),m_relPath); + g.writeGraph(m_t,GOF_EPS,EOF_LaTeX,dir(),fileName(),m_relPath); } void LatexGenerator::startDirDepGraph() @@ -1792,31 +1824,31 @@ void LatexGenerator::startDirDepGraph() void LatexGenerator::endDirDepGraph(DotDirDeps &g) { - g.writeGraph(t,GOF_EPS,EOF_LaTeX,dir(),fileName(),m_relPath); + g.writeGraph(m_t,GOF_EPS,EOF_LaTeX,dir(),fileName(),m_relPath); } void LatexGenerator::startDescription() { - t << "\\begin{description}\n"; + m_t << "\\begin{description}\n"; } void LatexGenerator::endDescription() { - t << "\\end{description}\n"; + m_t << "\\end{description}\n"; m_firstDescItem=TRUE; } void LatexGenerator::startDescItem() { m_firstDescItem=TRUE; - t << "\\item["; + m_t << "\\item["; } void LatexGenerator::endDescItem() { if (m_firstDescItem) { - t << "]\n"; + m_t << "]\n"; m_firstDescItem=FALSE; } else @@ -1827,93 +1859,97 @@ void LatexGenerator::endDescItem() void LatexGenerator::startExamples() { - t << "\\begin{Desc}\n\\item["; + m_t << "\\begin{Desc}\n\\item["; docify(theTranslator->trExamples()); - t << "]"; + m_t << "]"; } void LatexGenerator::endExamples() { - t << "\\end{Desc}\n"; + m_t << "\\end{Desc}\n"; } -void LatexGenerator::startParamList(ParamListTypes,const char *title) +void LatexGenerator::startParamList(ParamListTypes,const QCString &title) { - t << "\\begin{Desc}\n\\item["; + m_t << "\\begin{Desc}\n\\item["; docify(title); - t << "]"; + m_t << "]"; } void LatexGenerator::endParamList() { - t << "\\end{Desc}\n"; + m_t << "\\end{Desc}\n"; } void LatexGenerator::startParameterList(bool openBracket) { /* start of ParameterType ParameterName list */ - if (openBracket) t << "("; - t << "\\begin{DoxyParamCaption}"; + if (openBracket) m_t << "("; + m_t << "\\begin{DoxyParamCaption}"; } void LatexGenerator::endParameterList() { } -void LatexGenerator::startParameterType(bool first,const char *key) +void LatexGenerator::startParameterType(bool first,const QCString &key) { - t << "\\item[{"; - if (!first && key) docify(key); + m_t << "\\item[{"; + if (!first && !key.isEmpty()) docify(key); } void LatexGenerator::endParameterType() { - t << "}]"; + m_t << "}]"; } void LatexGenerator::startParameterName(bool /*oneArgOnly*/) { - t << "{"; + m_t << "{"; } void LatexGenerator::endParameterName(bool last,bool /*emptyList*/,bool closeBracket) { - t << " }"; + m_t << " }"; if (last) { - t << "\\end{DoxyParamCaption}"; - if (closeBracket) t << ")"; + m_t << "\\end{DoxyParamCaption}"; + if (closeBracket) m_t << ")"; } } -void LatexGenerator::exceptionEntry(const char* prefix,bool closeBracket) +void LatexGenerator::exceptionEntry(const QCString &prefix,bool closeBracket) { - if (prefix) - t << " " << prefix << "("; + if (!prefix.isEmpty()) + { + m_t << " " << prefix << "("; + } else if (closeBracket) - t << ")"; - t << " "; + { + m_t << ")"; + } + m_t << " "; } void LatexGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *,int) { LatexDocVisitor *visitor = - new LatexDocVisitor(t,m_codeGen,ctx?ctx->getDefFileExtension():QCString(""),m_insideTabbing); + new LatexDocVisitor(m_t,m_codeGen,ctx?ctx->getDefFileExtension():QCString(""),m_insideTabbing); n->accept(visitor); delete visitor; } -void LatexGenerator::startConstraintList(const char *header) +void LatexGenerator::startConstraintList(const QCString &header) { - t << "\\begin{Desc}\n\\item["; + m_t << "\\begin{Desc}\n\\item["; docify(header); - t << "]"; - t << "\\begin{description}\n"; + m_t << "]"; + m_t << "\\begin{description}\n"; } void LatexGenerator::startConstraintParam() { - t << "\\item[{\\em "; + m_t << "\\item[{\\em "; } void LatexGenerator::endConstraintParam() @@ -1922,12 +1958,12 @@ void LatexGenerator::endConstraintParam() void LatexGenerator::startConstraintType() { - t << "} : {\\em "; + m_t << "} : {\\em "; } void LatexGenerator::endConstraintType() { - t << "}]"; + m_t << "}]"; } void LatexGenerator::startConstraintDocs() @@ -1940,36 +1976,36 @@ void LatexGenerator::endConstraintDocs() void LatexGenerator::endConstraintList() { - t << "\\end{description}\n"; - t << "\\end{Desc}\n"; + m_t << "\\end{description}\n"; + m_t << "\\end{Desc}\n"; } void LatexGenerator::startInlineHeader() { if (Config_getBool(COMPACT_LATEX)) { - t << "\\doxyparagraph*{"; + m_t << "\\doxyparagraph*{"; } else { - t << "\\doxysubsubsection*{"; + m_t << "\\doxysubsubsection*{"; } } void LatexGenerator::endInlineHeader() { - t << "}\n"; + m_t << "}\n"; } -void LatexGenerator::lineBreak(const char *) +void LatexGenerator::lineBreak(const QCString &) { if (m_insideTabbing) { - t << "\\\\\n"; + m_t << "\\\\\n"; } else { - t << "\\newline\n"; + m_t << "\\newline\n"; } } @@ -1978,15 +2014,15 @@ void LatexGenerator::startMemberDocSimple(bool isEnum) m_codeGen.incUsedTableLevel(); if (isEnum) { - t << "\\begin{DoxyEnumFields}{"; + m_t << "\\begin{DoxyEnumFields}{"; docify(theTranslator->trEnumerationValues()); } else { - t << "\\begin{DoxyFields}{"; + m_t << "\\begin{DoxyFields}{"; docify(theTranslator->trCompoundMembers()); } - t << "}\n"; + m_t << "}\n"; } void LatexGenerator::endMemberDocSimple(bool isEnum) @@ -1994,11 +2030,11 @@ void LatexGenerator::endMemberDocSimple(bool isEnum) m_codeGen.decUsedTableLevel(); if (isEnum) { - t << "\\end{DoxyEnumFields}\n"; + m_t << "\\end{DoxyEnumFields}\n"; } else { - t << "\\end{DoxyFields}\n"; + m_t << "\\end{DoxyFields}\n"; } } @@ -2009,7 +2045,7 @@ void LatexGenerator::startInlineMemberType() void LatexGenerator::endInlineMemberType() { - t << "&\n"; + m_t << "&\n"; m_insideTabbing = FALSE; } @@ -2020,7 +2056,7 @@ void LatexGenerator::startInlineMemberName() void LatexGenerator::endInlineMemberName() { - t << "&\n"; + m_t << "&\n"; m_insideTabbing = FALSE; } @@ -2030,18 +2066,18 @@ void LatexGenerator::startInlineMemberDoc() void LatexGenerator::endInlineMemberDoc() { - t << "\\\\\n\\hline\n\n"; + m_t << "\\\\\n\\hline\n\n"; } void LatexGenerator::startLabels() { - t << "\\hspace{0.3cm}"; + m_t << "\\hspace{0.3cm}"; } -void LatexGenerator::writeLabel(const char *l,bool isLast) +void LatexGenerator::writeLabel(const QCString &l,bool isLast) { - t << "{\\ttfamily [" << l << "]}"; - if (!isLast) t << ", "; + m_t << "{\\ttfamily [" << l << "]}"; + if (!isLast) m_t << ", "; } void LatexGenerator::endLabels() diff --git a/src/latexgen.h b/src/latexgen.h index 0a6309c..f457d79 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -23,35 +23,36 @@ #define LATEX_STYLE_EXTENSION ".sty" +class TextStream; + class LatexCodeGenerator : public CodeOutputInterface { public: - LatexCodeGenerator(std::ostream &t,const QCString &relPath,const QCString &sourceFile); - LatexCodeGenerator(); - void setTextStream(std::ostream &t); + LatexCodeGenerator(TextStream &t,const QCString &relPath,const QCString &sourceFile); + LatexCodeGenerator(TextStream &t); void setRelativePath(const QCString &path); void setSourceFileName(const QCString &sourceFileName); - void codify(const char *text); - void writeCodeLink(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip); - void writeTooltip(const char *, + void codify(const QCString &text) override; + void writeCodeLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip) override; + void writeTooltip(const QCString &, const DocLinkInfo &, - const char *, - const char *, + const QCString &, + const QCString &, const SourceLinkInfo &, const SourceLinkInfo & - ) {} - void writeLineNumber(const char *,const char *,const char *,int); - void startCodeLine(bool); - void endCodeLine(); - void startFontClass(const char *); - void endFontClass(); - void writeCodeAnchor(const char *) {} - void setCurrentDoc(const Definition *,const char *,bool) {} - void addWord(const char *,bool) {} - void startCodeFragment(const char *style); - void endCodeFragment(const char *style); + ) override{} + void writeLineNumber(const QCString &,const QCString &,const QCString &,int) override; + void startCodeLine(bool) override; + void endCodeLine() override; + void startFontClass(const QCString &) override; + void endFontClass() override; + void writeCodeAnchor(const QCString &) override {} + void setCurrentDoc(const Definition *,const QCString &,bool) override {} + void addWord(const QCString &,bool) override {} + void startCodeFragment(const QCString &style) override; + void endCodeFragment(const QCString &style) override; // extra methods not part of CodeOutputInterface void incUsedTableLevel() { m_usedTableLevel++; } @@ -59,13 +60,13 @@ class LatexCodeGenerator : public CodeOutputInterface int usedTableLevel() const { return m_usedTableLevel; } private: - void _writeCodeLink(const char *className, - const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip); - void docify(const char *str); + void _writeCodeLink(const QCString &className, + const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip); + void docify(const QCString &str); bool m_streamSet = false; - std::ostream m_t; + TextStream &m_t; QCString m_relPath; QCString m_sourceFileName; int m_col = 0; @@ -85,97 +86,97 @@ class LatexGenerator : public OutputGenerator virtual std::unique_ptr<OutputGenerator> clone() const; static void init(); - static void writeStyleSheetFile(std::ostream &t); - static void writeHeaderFile(std::ostream &t); - static void writeFooterFile(std::ostream &t); + static void writeStyleSheetFile(TextStream &t); + static void writeHeaderFile(TextStream &t); + static void writeFooterFile(TextStream &t); virtual OutputType type() const { return Latex; } // --- CodeOutputInterface - void codify(const char *text) + void codify(const QCString &text) { m_codeGen.codify(text); } - void writeCodeLink(const char *ref, const char *file, - const char *anchor,const char *name, - const char *tooltip) + void writeCodeLink(const QCString &ref, const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip) { m_codeGen.writeCodeLink(ref,file,anchor,name,tooltip); } - void writeLineNumber(const char *ref,const char *file,const char *anchor,int lineNumber) + void writeLineNumber(const QCString &ref,const QCString &file,const QCString &anchor,int lineNumber) { m_codeGen.writeLineNumber(ref,file,anchor,lineNumber); } - void writeTooltip(const char *id, const DocLinkInfo &docInfo, const char *decl, - const char *desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo + void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, const QCString &decl, + const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo ) { m_codeGen.writeTooltip(id,docInfo,decl,desc,defInfo,declInfo); } void startCodeLine(bool hasLineNumbers) { m_codeGen.startCodeLine(hasLineNumbers); } void endCodeLine() { m_codeGen.endCodeLine(); } - void startFontClass(const char *s) + void startFontClass(const QCString &s) { m_codeGen.startFontClass(s); } void endFontClass() { m_codeGen.endFontClass(); } - void writeCodeAnchor(const char *anchor) + void writeCodeAnchor(const QCString &anchor) { m_codeGen.writeCodeAnchor(anchor); } - void startCodeFragment(const char *style) + void startCodeFragment(const QCString &style) { m_codeGen.startCodeFragment(style); } - void endCodeFragment(const char *style) + void endCodeFragment(const QCString &style) { m_codeGen.endCodeFragment(style); } // --------------------------- void writeDoc(DocNode *,const Definition *ctx,const MemberDef *,int id); - void startFile(const char *name,const char *manName,const char *title,int id); + void startFile(const QCString &name,const QCString &manName,const QCString &title,int id); void writeSearchInfo() {} - void writeFooter(const char *) {} + void writeFooter(const QCString &) {} void endFile(); void clearBuffer(); void startIndexSection(IndexSections); void endIndexSection(IndexSections); - void writePageLink(const char *,bool); + void writePageLink(const QCString &,bool); void startProjectNumber(); void endProjectNumber() {} void writeStyleInfo(int part); - void startTitleHead(const char *); + void startTitleHead(const QCString &); void startTitle(); - void endTitleHead(const char *,const char *name); - void endTitle() { t << "}"; } + void endTitleHead(const QCString &,const QCString &name); + void endTitle() { m_t << "}"; } void newParagraph(); - void startParagraph(const char *classDef); + void startParagraph(const QCString &classDef); void endParagraph(); - void writeString(const char *text); + void writeString(const QCString &text); void startIndexListItem() {} void endIndexListItem() {} - void startIndexList() { t << "\\begin{DoxyCompactList}\n"; } - void endIndexList() { t << "\\end{DoxyCompactList}\n"; } + void startIndexList() { m_t << "\\begin{DoxyCompactList}\n"; } + void endIndexList() { m_t << "\\end{DoxyCompactList}\n"; } void startIndexKey(); void endIndexKey(); void startIndexValue(bool); - void endIndexValue(const char *,bool); - void startItemList() { t << "\\begin{DoxyCompactItemize}\n"; } - void endItemList() { t << "\\end{DoxyCompactItemize}\n"; } - void startIndexItem(const char *ref,const char *file); - void endIndexItem(const char *ref,const char *file); - void docify(const char *text); - void writeObjectLink(const char *ref,const char *file, - const char *anchor,const char *name); - - void startTextLink(const char *,const char *); + void endIndexValue(const QCString &,bool); + void startItemList() { m_t << "\\begin{DoxyCompactItemize}\n"; } + void endItemList() { m_t << "\\end{DoxyCompactItemize}\n"; } + void startIndexItem(const QCString &ref,const QCString &file); + void endIndexItem(const QCString &ref,const QCString &file); + void docify(const QCString &text); + void writeObjectLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name); + + void startTextLink(const QCString &,const QCString &); void endTextLink(); - void startHtmlLink(const char *url); + void startHtmlLink(const QCString &url); void endHtmlLink(); - void startTypewriter() { t << "{\\ttfamily "; } - void endTypewriter() { t << "}"; } + void startTypewriter() { m_t << "{\\ttfamily "; } + void endTypewriter() { m_t << "}"; } void startGroupHeader(int); void endGroupHeader(int); - void startItemListItem() { t << "\\item \n"; } + void startItemListItem() { m_t << "\\item \n"; } void endItemListItem() {} void startMemberSections() {} void endMemberSections() {} void startHeaderSection() {} void endHeaderSection() {} - void startMemberHeader(const char *,int); + void startMemberHeader(const QCString &,int); void endMemberHeader(); void startMemberSubtitle() {} void endMemberSubtitle() {} @@ -187,10 +188,12 @@ class LatexGenerator : public OutputGenerator void endInlineHeader(); void startAnonTypeScope(int); void endAnonTypeScope(int); - void startMemberItem(const char *,int,const char *); + void startMemberItem(const QCString &,int,const QCString &); void endMemberItem(); void startMemberTemplateParams(); - void endMemberTemplateParams(const char *,const char *); + void endMemberTemplateParams(const QCString &,const QCString &); + void startCompoundTemplateParams() { startSubsubsection(); } + void endCompoundTemplateParams() { endSubsubsection(); } void startMemberGroupHeader(bool); void endMemberGroupHeader(); @@ -202,70 +205,70 @@ class LatexGenerator : public OutputGenerator void insertMemberAlign(bool) {} void insertMemberAlignLeft(int,bool){} - void writeRuler() { t << "\n\n"; } - void writeAnchor(const char *fileName,const char *name); - void startEmphasis() { t << "{\\em "; } - void endEmphasis() { t << "}"; } - void startBold() { t << "{\\bfseries "; } - void endBold() { t << "}"; } + void writeRuler() { m_t << "\n\n"; } + void writeAnchor(const QCString &fileName,const QCString &name); + void startEmphasis() { m_t << "{\\em "; } + void endEmphasis() { m_t << "}"; } + void startBold() { m_t << "{\\bfseries "; } + void endBold() { m_t << "}"; } void startDescription(); void endDescription(); void startDescItem(); void endDescItem(); - void lineBreak(const char *style=0); - void startMemberDoc(const char *,const char *,const char *,const char *,int,int,bool); + void lineBreak(const QCString &style=QCString()); + void startMemberDoc(const QCString &,const QCString &,const QCString &,const QCString &,int,int,bool); void endMemberDoc(bool); - void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *); - void endDoxyAnchor(const char *,const char *); + void startDoxyAnchor(const QCString &,const QCString &,const QCString &,const QCString &,const QCString &); + void endDoxyAnchor(const QCString &,const QCString &); void writeChar(char c); - void writeLatexSpacing() { t << "\\hspace{0.3cm}"; } - void writeStartAnnoItem(const char *type,const char *file, - const char *path,const char *name); - void writeEndAnnoItem(const char *name); - void startSubsection() { t << "\\subsection*{"; } - void endSubsection() { t << "}\n"; } - void startSubsubsection() { t << "\\subsubsection*{"; } - void endSubsubsection() { t << "}\n"; } - void startCenter() { t << "\\begin{center}\n"; } - void endCenter() { t << "\\end{center}\n"; } - void startSmall() { t << "\\footnotesize "; } - void endSmall() { t << "\\normalsize "; } - void startMemberDescription(const char *,const char *,bool); + void writeLatexSpacing() { m_t << "\\hspace{0.3cm}"; } + void writeStartAnnoItem(const QCString &type,const QCString &file, + const QCString &path,const QCString &name); + void writeEndAnnoItem(const QCString &name); + void startSubsection() { m_t << "\\subsection*{"; } + void endSubsection() { m_t << "}\n"; } + void startSubsubsection() { m_t << "\\subsubsection*{"; } + void endSubsubsection() { m_t << "}\n"; } + void startCenter() { m_t << "\\begin{center}\n"; } + void endCenter() { m_t << "\\end{center}\n"; } + void startSmall() { m_t << "\\footnotesize "; } + void endSmall() { m_t << "\\normalsize "; } + void startMemberDescription(const QCString &,const QCString &,bool); void endMemberDescription(); void startMemberDeclaration() {} - void endMemberDeclaration(const char *,const char *) {} - void writeInheritedSectionTitle(const char *,const char *,const char *, - const char *,const char *,const char *) {} - void startDescList(SectionTypes) { t << "\\begin{Desc}\n\\item["; } - void endDescList() { t << "\\end{Desc}\n"; } + void endMemberDeclaration(const QCString &,const QCString &) {} + void writeInheritedSectionTitle(const QCString &,const QCString &,const QCString &, + const QCString &,const QCString &,const QCString &) {} + void startDescList(SectionTypes) { m_t << "\\begin{Desc}\n\\item["; } + void endDescList() { m_t << "\\end{Desc}\n"; } void startExamples(); void endExamples(); - void startParamList(ParamListTypes,const char *title); + void startParamList(ParamListTypes,const QCString &title); void endParamList(); - void startDescForItem() { t << "\\par\n"; } + void startDescForItem() { m_t << "\\par\n"; } void endDescForItem() {} - void startSection(const char *,const char *,SectionType); - void endSection(const char *,SectionType); - void addIndexItem(const char *,const char *); + void startSection(const QCString &,const QCString &,SectionType); + void endSection(const QCString &,SectionType); + void addIndexItem(const QCString &,const QCString &); void startIndent() {} void endIndent() {} void writeSynopsis() {} void startClassDiagram(); - void endClassDiagram(const ClassDiagram &,const char *,const char *); + void endClassDiagram(const ClassDiagram &,const QCString &,const QCString &); void startPageRef(); - void endPageRef(const char *,const char *); + void endPageRef(const QCString &,const QCString &); void startQuickIndices() {} void endQuickIndices() {} - void writeSplitBar(const char *) {} - void writeNavigationPath(const char *) {} + void writeSplitBar(const QCString &) {} + void writeNavigationPath(const QCString &) {} void writeLogo() {} - void writeQuickLinks(bool,HighlightedItem,const char*) {} - void writeSummaryLink(const char *,const char *,const char *,bool) {} + void writeQuickLinks(bool,HighlightedItem,const QCString &) {} + void writeSummaryLink(const QCString &,const QCString &,const QCString &,bool) {} void startContents() {} void endContents() {} void writeNonBreakableSpace(int); - void startDescTable(const char *title); + void startDescTable(const QCString &title); void endDescTable(); void startDescTableRow(); void endDescTableRow(); @@ -291,18 +294,18 @@ class LatexGenerator : public OutputGenerator void endTextBlock(bool) {} void startMemberDocPrefixItem() {} - void endMemberDocPrefixItem() { t << "\\\\\n"; } + void endMemberDocPrefixItem() { m_t << "\\\\\n"; } void startMemberDocName(bool) {} void endMemberDocName() {} - void startParameterType(bool,const char *); + void startParameterType(bool,const QCString &); void endParameterType(); void startParameterName(bool); void endParameterName(bool,bool,bool); void startParameterList(bool); void endParameterList(); - void exceptionEntry(const char*,bool); + void exceptionEntry(const QCString &,bool); - void startConstraintList(const char *); + void startConstraintList(const QCString &); void startConstraintParam(); void endConstraintParam(); void startConstraintType(); @@ -321,11 +324,11 @@ class LatexGenerator : public OutputGenerator void endInlineMemberDoc(); void startLabels(); - void writeLabel(const char *l,bool isLast); + void writeLabel(const QCString &l,bool isLast); void endLabels(); - void setCurrentDoc(const Definition *,const char *,bool) {} - void addWord(const char *,bool) {} + void setCurrentDoc(const Definition *,const QCString &,bool) {} + void addWord(const QCString &,bool) {} private: diff --git a/src/layout.cpp b/src/layout.cpp index fe71db0..7c368be 100644 --- a/src/layout.cpp +++ b/src/layout.cpp @@ -92,7 +92,7 @@ static bool elemIsVisible(const XMLHandlers::Attributes &attrib,bool defVal=TRUE else if (!opt) { err("found unsupported value %s for visible attribute in layout file\n", - visible.data()); + qPrint(visible)); } } return visible!="no" && visible!="0"; @@ -101,7 +101,7 @@ static bool elemIsVisible(const XMLHandlers::Attributes &attrib,bool defVal=TRUE //--------------------------------------------------------------------------------- LayoutNavEntry *LayoutNavEntry::find(LayoutNavEntry::Kind kind, - const char *file) const + const QCString &file) const { LayoutNavEntry *result=0; for (const auto &entry : m_children) @@ -110,7 +110,7 @@ LayoutNavEntry *LayoutNavEntry::find(LayoutNavEntry::Kind kind, // root in case an entry is in the tree twice result = entry->find(kind,file); if (result) return result; - if (entry->kind()==kind && (file==0 || entry->baseFile()==file)) + if (entry->kind()==kind && (file==QCString() || entry->baseFile()==file)) { return entry.get(); } @@ -133,7 +133,7 @@ QCString LayoutNavEntry::url() const const Definition *d = 0; QCString anchor; bool found=FALSE; - if (resolveLink(0,url.mid(5).stripWhiteSpace(),TRUE,&d,anchor)) + if (resolveLink(QCString(),url.mid(5).stripWhiteSpace(),TRUE,&d,anchor)) { if (d && d->isLinkable()) { @@ -150,7 +150,7 @@ QCString LayoutNavEntry::url() const msg("explicit link request to '%s' in layout file '%s' could not be resolved\n",qPrint(url.mid(5)),qPrint(Config_getString(LAYOUT_FILE))); } } - //printf("LayoutNavEntry::url()=%s\n",url.data()); + //printf("LayoutNavEntry::url()=%s\n",qPrint(url)); return url; } @@ -195,7 +195,7 @@ class LayoutParser bool isVisible = elemIsVisible(attrib); QCString userTitle = XMLHandlers::value(attrib,"title"); //printf("startSectionEntry: title='%s' userTitle='%s'\n", - // title.data(),userTitle.data()); + // qPrint(title),qPrint(userTitle)); if (userTitle.isEmpty()) userTitle = title; if (m_part!=-1 && isVisible) { @@ -214,7 +214,7 @@ class LayoutParser QCString userSubscript = XMLHandlers::value(attrib,"subtitle"); if (userTitle.isEmpty()) userTitle = title; if (userSubscript.isEmpty()) userSubscript = subscript; - //printf("memberdecl: %s\n",userTitle.data()); + //printf("memberdecl: %s\n",qPrint(userTitle)); if (m_part!=-1 /*&& isVisible*/) { LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part, @@ -227,7 +227,7 @@ class LayoutParser { QCString userTitle = XMLHandlers::value(attrib,"title"); if (userTitle.isEmpty()) userTitle = title; - //printf("memberdef: %s\n",userTitle.data()); + //printf("memberdef: %s\n",qPrint(userTitle)); if (m_part!=-1 /*&& isVisible*/) { LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part, @@ -319,6 +319,13 @@ class LayoutParser fortranOpt || sliceOpt ? theTranslator->trModulesMemberDescription(extractAll) : theTranslator->trNamespaceMemberDescription(extractAll), "namespacemembers" }, + { "concepts", + LayoutNavEntry::Concepts, + theTranslator->trConcept(true,false), + theTranslator->trConceptList(), + theTranslator->trConceptListDescription(extractAll), + "concepts" + }, { "classindex", LayoutNavEntry::ClassIndex, fortranOpt ? theTranslator->trDataTypes() : vhdlOpt ? theTranslator->trDesignUnits() : theTranslator->trCompoundIndex(), @@ -510,7 +517,7 @@ class LayoutParser } else { - ::warn(fileName.c_str(),m_locator->lineNr(),"the type '%s' is not supported for the entry tag within a navindex! Check your layout file!\n",type.data()); + ::warn(fileName.c_str(),m_locator->lineNr(),"the type '%s' is not supported for the entry tag within a navindex! Check your layout file!\n",qPrint(type)); } m_invalidEntry=TRUE; return; @@ -585,6 +592,19 @@ class LayoutParser m_part = -1; } + void startConcept(const XMLHandlers::Attributes &) + { + LayoutDocManager::instance().clear(LayoutDocManager::Concept); + m_scope="concept/"; + m_part = (int)LayoutDocManager::Concept; + } + + void endConcept() + { + m_scope=""; + m_part = -1; + } + void startFile(const XMLHandlers::Attributes &) { LayoutDocManager::instance().clear(LayoutDocManager::File); @@ -973,6 +993,31 @@ static const std::map< std::string, ElementCallbacks > g_elementHandlers = endCb() } }, + // concept layout handlers + { "concept", { startCb(&LayoutParser::startConcept), + endCb(&LayoutParser::endConcept) + } }, + + { "concept/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc), + endCb() + } }, + { "concept/definition", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ConceptDefinition, + []() { return compileOptions(theTranslator->trConceptDefinition()); }), + endCb() + } }, + { "concept/includes", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::ClassIncludes), + endCb() + } }, + { "concept/sourcelink", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileSourceLink), + endCb() + } }, + { "concept/detaileddescription", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::DetailedDesc, + []() { return compileOptions(theTranslator->trDetailedDescription()); }), + endCb() + } }, + { "concept/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection), + endCb() + } }, // namespace layout handlers { "namespace", { startCb(&LayoutParser::startNamespace), endCb(&LayoutParser::endNamespace) @@ -1016,6 +1061,10 @@ static const std::map< std::string, ElementCallbacks > g_elementHandlers = SrcLangExt_Fortran,theTranslator->trDataTypes()); }), endCb() } }, + { "namespace/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceConcepts, + []() { return compileOptions(theTranslator->trConcept(true,false)); }), + endCb() + } }, { "namespace/memberdecl/structs", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceStructs, []() { return compileOptions(theTranslator->trStructs()); }), endCb() @@ -1135,6 +1184,10 @@ static const std::map< std::string, ElementCallbacks > g_elementHandlers = SrcLangExt_Fortran,theTranslator->trDataTypes()); }), endCb() } }, + { "file/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::FileConcepts, + []() { return compileOptions(theTranslator->trConcept(true,false)); }), + endCb() + } }, { "file/memberdecl/structs", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileStructs, []() { return compileOptions(theTranslator->trStructs()); }), endCb() @@ -1255,6 +1308,10 @@ static const std::map< std::string, ElementCallbacks > g_elementHandlers = []() { return compileOptions(/* default */ theTranslator->trCompounds(), SrcLangExt_VHDL, theTranslator->trVhdlType(VhdlDocGen::ENTITY,FALSE), SrcLangExt_Fortran, theTranslator->trDataTypes()); }), + endCb() + } }, + { "group/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupConcepts, + []() { return compileOptions(theTranslator->trConcept(true,false)); }), endCb() } }, { "group/memberdecl/namespaces", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupNamespaces, @@ -1440,7 +1497,7 @@ static const std::map< std::string, ElementCallbacks > g_elementHandlers = void LayoutParser::startElement( const std::string &name, const XMLHandlers::Attributes& attrib ) { - //printf("startElement [%s]::[%s]\n",m_scope.data(),name.data()); + //printf("startElement [%s]::[%s]\n",qPrint(m_scope),qPrint(name)); auto it = g_elementHandlers.find(m_scope.str()+name); if (it!=g_elementHandlers.end()) { @@ -1450,13 +1507,13 @@ void LayoutParser::startElement( const std::string &name, const XMLHandlers::Att { std::string fileName = m_locator->fileName(); ::warn(fileName.c_str(),m_locator->lineNr(),"Unexpected start tag '%s' found in scope='%s'!\n", - name.data(),m_scope.data()); + qPrint(name),qPrint(m_scope)); } } void LayoutParser::endElement( const std::string &name ) { - //printf("endElement [%s]::[%s]\n",m_scope.data(),name.data()); + //printf("endElement [%s]::[%s]\n",qPrint(m_scope),qPrint(name)); auto it=g_elementHandlers.end(); if (!m_scope.isEmpty() && m_scope.right(static_cast<uint>(name.length())+1)==name+"/") @@ -1502,7 +1559,7 @@ void LayoutDocManager::init() XMLParser parser(handlers); layoutParser.setDocumentLocator(&parser); QCString layout_default = ResourceMgr::instance().getAsString("layout_default.xml"); - parser.parse("layout_default.xml",layout_default,Debug::isFlagSet(Debug::Lex)); + parser.parse("layout_default.xml",layout_default.data(),Debug::isFlagSet(Debug::Lex)); } LayoutDocManager::~LayoutDocManager() @@ -1536,7 +1593,7 @@ void LayoutDocManager::clear(LayoutDocManager::LayoutPart p) d->docEntries[(int)p].clear(); } -void LayoutDocManager::parse(const char *fileName) +void LayoutDocManager::parse(const QCString &fileName) { LayoutParser &layoutParser = LayoutParser::instance(); XMLHandlers handlers; @@ -1545,22 +1602,26 @@ void LayoutDocManager::parse(const char *fileName) handlers.error = [&layoutParser](const std::string &fn,int lineNr,const std::string &msg) { layoutParser.error(fn,lineNr,msg); }; XMLParser parser(handlers); layoutParser.setDocumentLocator(&parser); - parser.parse(fileName,fileToString(fileName),Debug::isFlagSet(Debug::Lex)); + parser.parse(fileName.data(),fileToString(fileName).data(),Debug::isFlagSet(Debug::Lex)); } //--------------------------------------------------------------------------------- -void writeDefaultLayoutFile(const char *fileName) +void writeDefaultLayoutFile(const QCString &fileName) { - std::ofstream t(fileName,std::ofstream::out | std::ofstream::binary); - bool ok = openOutputFile(fileName,t); - if (!ok) + std::ofstream f; + if (openOutputFile(fileName,f)) { - err("Failed to open file %s for writing!\n",fileName); + TextStream t(&f); + QCString layout_default = ResourceMgr::instance().getAsString("layout_default.xml"); + t << substitute(layout_default,"$doxygenversion",getDoxygenVersion()); + } + else + { + err("Failed to open file %s for writing!\n",qPrint(fileName)); return; } - QCString layout_default = ResourceMgr::instance().getAsString("layout_default.xml"); - t << substitute(layout_default,"$doxygenversion",getDoxygenVersion()); + f.close(); } //---------------------------------------------------------------------------------- diff --git a/src/layout.h b/src/layout.h index 851af22..04fdf52 100644 --- a/src/layout.h +++ b/src/layout.h @@ -45,19 +45,22 @@ struct LayoutDocEntry ClassCollaborationGraph, ClassAllMembersLink, ClassUsedFiles, + // Concept specific items + ConceptDefinition, + // Namespace specific items NamespaceNestedNamespaces, NamespaceNestedConstantGroups, - NamespaceClasses, NamespaceInterfaces, NamespaceStructs, NamespaceExceptions, + NamespaceClasses, NamespaceConcepts, NamespaceInterfaces, NamespaceStructs, NamespaceExceptions, NamespaceInlineClasses, // File specific items - FileClasses, FileInterfaces, FileStructs, FileExceptions, FileConstantGroups, FileNamespaces, + FileClasses, FileConcepts, FileInterfaces, FileStructs, FileExceptions, FileConstantGroups, FileNamespaces, FileIncludes, FileIncludeGraph, FileIncludedByGraph, FileSourceLink, FileInlineClasses, // Group specific items - GroupClasses, GroupInlineClasses, GroupNamespaces, + GroupClasses, GroupConcepts, GroupInlineClasses, GroupNamespaces, GroupDirs, GroupNestedGroups, GroupFiles, GroupGraph, GroupPageDocs, @@ -130,6 +133,7 @@ struct LayoutNavEntry Namespaces, NamespaceList, NamespaceMembers, + Concepts, Classes, ClassList, ClassIndex, @@ -173,7 +177,7 @@ struct LayoutNavEntry void addChild(LayoutNavEntry *e) { m_children.push_back(std::unique_ptr<LayoutNavEntry>(e)); } void prependChild(LayoutNavEntry *e) { m_children.insert(m_children.begin(),std::unique_ptr<LayoutNavEntry>(e)); } const LayoutNavEntryList &children() const { return m_children; } - LayoutNavEntry *find(LayoutNavEntry::Kind k,const char *file=0) const; + LayoutNavEntry *find(LayoutNavEntry::Kind k,const QCString &file=QCString()) const; private: LayoutNavEntry() : m_parent(0), m_kind(None), m_visible(FALSE) {} @@ -196,7 +200,7 @@ class LayoutDocManager public: enum LayoutPart { - Class, Namespace, File, Group, Directory, + Class, Concept, Namespace, File, Group, Directory, NrParts }; /** Returns a reference to this singleton. */ @@ -209,7 +213,7 @@ class LayoutDocManager LayoutNavEntry *rootNavEntry() const; /** Parses a user provided layout */ - void parse(const char *fileName); + void parse(const QCString &fileName); void init(); private: void addEntry(LayoutPart p,LayoutDocEntry*e); @@ -220,7 +224,7 @@ class LayoutDocManager friend class LayoutParser; }; -void writeDefaultLayoutFile(const char *fileName); +void writeDefaultLayoutFile(const QCString &fileName); #endif diff --git a/src/lexcode.h b/src/lexcode.h index 38aec50..b64b691 100644 --- a/src/lexcode.h +++ b/src/lexcode.h @@ -33,11 +33,11 @@ class LexCodeParser : public CodeParserInterface LexCodeParser(); virtual ~LexCodeParser(); void parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt, bool isExampleBlock, - const char *exampleName=0, + const QCString &exampleName=QCString(), FileDef *fileDef=0, int startLine=-1, int endLine=-1, diff --git a/src/lexcode.l b/src/lexcode.l index a118703..4cfb636 100644 --- a/src/lexcode.l +++ b/src/lexcode.l @@ -66,7 +66,6 @@ struct lexcodeYY_state QCString CCodeBuffer; int startCCodeLine = -1; int roundCount = 0; - int squareCount = 0; bool insideCode = FALSE; QCString delimiter; QCString docBlockName; @@ -93,7 +92,7 @@ static void startCodeLine(yyscan_t yyscanner); static void endFontClass(yyscan_t yyscanner); static void endCodeLine(yyscan_t yyscanner); static void nextCodeLine(yyscan_t yyscanner); -static void codifyLines(yyscan_t yyscanner,const char *text); +static void codifyLines(yyscan_t yyscanner,const QCString &text); static void startFontClass(yyscan_t yyscanner,const char *s); static int countLines(yyscan_t yyscanner); static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); @@ -114,12 +113,13 @@ LiteralStart "%{"{nl} LiteralEnd "%}"{nl} RulesStart "%%"{nl} RulesEnd "%%"{nl} -RulesSharp "<"[^>]*">" +RulesSharp "<"[^>\n]*">" RulesCurly "{"[^{}\n]*"}" StartSquare "[" StartDouble "\"" StartRound "(" -EscapeRulesCharOpen "\\["|"\\<"|"\\{"|"\\("|"\\\""|"\\{"|"\\ " +StartRoundQuest "(?" +EscapeRulesCharOpen "\\["|"\\<"|"\\{"|"\\("|"\\\""|"\\ "|"\\\\" EscapeRulesCharClose "\\]"|"\\>"|"\\}"|"\\)" EscapeRulesChar {EscapeRulesCharOpen}|{EscapeRulesCharClose} @@ -134,14 +134,15 @@ CODE [cC][oO][dD][eE] RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"(" RAWEND ")"[^ \t\(\)\\]{0,16}\" CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) +CHARCE "[:"[^:]*":]" /* no comment start / end signs inside square brackets */ NCOMM [^/\*] - // C start comment + // C start comment CCS "/\*" // C end comment CCE "*\/" - // Cpp comment + // Cpp comment CPPC "/\/" // doxygen start comment DCOMM ("/\*!"|"/\**"|"/\/!"|"/\/\/") @@ -160,6 +161,7 @@ NONLopt [^\n]* %x RulesSquare %x RulesRoundSquare %x RulesRound +%x RulesRoundQuest %x UserSection %x TopSection @@ -326,28 +328,24 @@ NONLopt [^\n]* yyextra->rulesPatternBuffer += yytext; } <RulesPattern>{StartSquare} { - yyextra->squareCount++; yyextra->rulesPatternBuffer += yytext; yyextra->lastContext = YY_START; BEGIN(RulesSquare); } -<RulesSquare,RulesRoundSquare>"\\[" | -<RulesSquare,RulesRoundSquare>"\\]" { +<RulesSquare,RulesRoundSquare>{CHARCE} { yyextra->rulesPatternBuffer += yytext; } -<RulesSquare,RulesRoundSquare>"[" { - yyextra->squareCount++; +<RulesSquare,RulesRoundSquare>"\\[" | +<RulesSquare,RulesRoundSquare>"\\]" { yyextra->rulesPatternBuffer += yytext; } <RulesSquare>"]" { - yyextra->squareCount--; yyextra->rulesPatternBuffer += yytext; - if (!yyextra->squareCount) BEGIN(RulesPattern) ; + BEGIN(RulesPattern) ; } <RulesRoundSquare>"]" { - yyextra->squareCount--; yyextra->rulesPatternBuffer += yytext; - if (!yyextra->squareCount) BEGIN(RulesRound) ; + BEGIN(RulesRound) ; } <RulesSquare,RulesRoundSquare>"\\\\" { yyextra->rulesPatternBuffer += yytext; @@ -355,6 +353,28 @@ NONLopt [^\n]* <RulesSquare,RulesRoundSquare>. { yyextra->rulesPatternBuffer += yytext; } +<RulesPattern>{StartRoundQuest} { + yyextra->rulesPatternBuffer += yytext; + yyextra->lastContext = YY_START; + BEGIN(RulesRoundQuest); + } +<RulesRoundQuest>{nl} { + yyextra->rulesPatternBuffer += yytext; + if (!yyextra->rulesPatternBuffer.isEmpty()) + { + startFontClass(yyscanner,"stringliteral"); + codifyLines(yyscanner,yyextra->rulesPatternBuffer.data()); + yyextra->rulesPatternBuffer.resize(0); + endFontClass(yyscanner); + } + } +<RulesRoundQuest>[^)] { + yyextra->rulesPatternBuffer += yytext; + } +<RulesRoundQuest>")" { + yyextra->rulesPatternBuffer += yytext; + BEGIN(yyextra->lastContext); + } <RulesPattern>{StartRound} { yyextra->roundCount++; yyextra->rulesPatternBuffer += yytext; @@ -365,7 +385,6 @@ NONLopt [^\n]* yyextra->rulesPatternBuffer += yytext; } <RulesRound>{StartSquare} { - yyextra->squareCount++; yyextra->rulesPatternBuffer += yytext; BEGIN(RulesRoundSquare); } @@ -373,8 +392,7 @@ NONLopt [^\n]* yyextra->rulesPatternBuffer += yytext; BEGIN(RulesRoundDouble); } -<RulesRound>"\\(" | -<RulesRound>"\\)" { +<RulesRound>{EscapeRulesChar} { yyextra->rulesPatternBuffer += yytext; } <RulesRound>"(" { @@ -386,6 +404,13 @@ NONLopt [^\n]* yyextra->rulesPatternBuffer += yytext; if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ; } +<RulesRound>{nl} { + yyextra->rulesPatternBuffer += yytext; + yyextra->yyLineNr++; + } +<RulesRound>{ws} { + yyextra->rulesPatternBuffer += yytext; + } <RulesRound>. { yyextra->rulesPatternBuffer += yytext; } @@ -393,7 +418,7 @@ NONLopt [^\n]* if (!yyextra->rulesPatternBuffer.isEmpty()) { startFontClass(yyscanner,"stringliteral"); - codifyLines(yyscanner,yyextra->rulesPatternBuffer.data()); + codifyLines(yyscanner,yyextra->rulesPatternBuffer); yyextra->rulesPatternBuffer.resize(0); endFontClass(yyscanner); } @@ -413,7 +438,7 @@ NONLopt [^\n]* if (!yyextra->rulesPatternBuffer.isEmpty()) { startFontClass(yyscanner,"stringliteral"); - codifyLines(yyscanner,yyextra->rulesPatternBuffer.data()); + codifyLines(yyscanner,yyextra->rulesPatternBuffer); yyextra->rulesPatternBuffer.resize(0); endFontClass(yyscanner); } @@ -428,7 +453,7 @@ NONLopt [^\n]* if (!yyextra->rulesPatternBuffer.isEmpty()) { startFontClass(yyscanner,"stringliteral"); - codifyLines(yyscanner,yyextra->rulesPatternBuffer.data()); + codifyLines(yyscanner,yyextra->rulesPatternBuffer); yyextra->rulesPatternBuffer.resize(0); endFontClass(yyscanner); } @@ -500,7 +525,7 @@ NONLopt [^\n]* } <SkipCurly>{B}*{RAWBEGIN} { QCString raw=QCString(yytext).stripWhiteSpace(); - yyextra->delimiter = raw.data()+2; + yyextra->delimiter = raw.mid(2); yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1); yyextra->lastRawStringContext = YY_START; yyextra->CCodeBuffer += yytext; @@ -890,9 +915,10 @@ NONLopt [^\n]* yyextra->CCodeBuffer += yytext; yyextra->yyLineNr++; } - /* + /* <*>. { fprintf(stderr,"Lex code scanner Def rule for %s: #%s#\n",stateToString(YY_START),yytext);} - */ +<*>{nl} { fprintf(stderr,"Lex code scanner Def rule for newline %s: #%s#\n",stateToString(YY_START),yytext); yyextra->yyLineNr++;} + */ <*><<EOF>> { handleCCode(yyscanner); yyterminate(); @@ -930,7 +956,7 @@ static void startCodeLine(yyscan_t yyscanner) { yyextra->currentDefinition = d; yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr); - yyextra->classScope = d->name().copy(); + yyextra->classScope = d->name(); QCString lineAnchor; lineAnchor.sprintf("l%05d",yyextra->yyLineNr); if (yyextra->currentMemberDef) @@ -944,13 +970,13 @@ static void startCodeLine(yyscan_t yyscanner) { yyextra->code->writeLineNumber(d->getReference(), d->getOutputFileBase(), - 0,yyextra->yyLineNr); + QCString(),yyextra->yyLineNr); setCurrentDoc(yyscanner,lineAnchor); } } else { - yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr); + yyextra->code->writeLineNumber(QCString(),QCString(),QCString(),yyextra->yyLineNr); } } @@ -991,10 +1017,11 @@ static void nextCodeLine(yyscan_t yyscanner) } } -static void codifyLines(yyscan_t yyscanner,const char *text) +static void codifyLines(yyscan_t yyscanner,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - const char *p=text,*sp=p; + if (text.isEmpty()) return; + const char *p=text.data(),*sp=p; char c; bool done=false; while (!done) @@ -1148,11 +1175,11 @@ void LexCodeParser::resetCodeParserState() } void LexCodeParser::parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt, bool isExampleBlock, - const char *exampleName, + const QCString &exampleName, FileDef *fileDef, int startLine, int endLine, @@ -1168,10 +1195,10 @@ void LexCodeParser::parseCode(CodeOutputInterface &codeOutIntf, if (input.isEmpty()) return; - printlex(yy_flex_debug, true, __FILE__, fileDef ? fileDef->fileName().data(): NULL); + printlex(yy_flex_debug, true, __FILE__, fileDef ? qPrint(fileDef->fileName()): NULL); yyextra->code = &codeOutIntf; - yyextra->inputString = input; + yyextra->inputString = input.data(); yyextra->inputPosition = 0; yyextra->currentFontClass = 0; yyextra->needsTermination = false; @@ -1202,7 +1229,7 @@ void LexCodeParser::parseCode(CodeOutputInterface &codeOutIntf, if (isExampleBlock && fileDef==0) { // create a dummy filedef for the example - yyextra->sourceFileDef = createFileDef("",(exampleName?exampleName:"generated")); + yyextra->sourceFileDef = createFileDef(QCString(),!exampleName.isEmpty() ? exampleName : QCString("generated")); cleanupSourceDef = true; } @@ -1230,7 +1257,7 @@ void LexCodeParser::parseCode(CodeOutputInterface &codeOutIntf, yyextra->sourceFileDef=0; } - printlex(yy_flex_debug, false, __FILE__, fileDef ? fileDef->fileName().data(): NULL); + printlex(yy_flex_debug, false, __FILE__, fileDef ? qPrint(fileDef->fileName()): NULL); } //--------------------------------------------------------------------------------- diff --git a/src/lexscanner.h b/src/lexscanner.h index 8734c59..dbb1f56 100644 --- a/src/lexscanner.h +++ b/src/lexscanner.h @@ -29,12 +29,12 @@ class LexOutlineParser : public OutlineParserInterface public: LexOutlineParser(); ~LexOutlineParser(); - void parseInput(const char *fileName, + void parseInput(const QCString &fileName, const char *fileBuf, const std::shared_ptr<Entry> &root, ClangTUParser *clangParser); bool needsPreprocessing(const QCString &extension) const { return TRUE; }; - void parsePrototype(const char *text){} + void parsePrototype(const QCString &text){} private: struct Private; diff --git a/src/lexscanner.l b/src/lexscanner.l index f148e16..cd06464 100644 --- a/src/lexscanner.l +++ b/src/lexscanner.l @@ -1,7 +1,5 @@ /***************************************************************************** * - * - * * Copyright (C) 1997-2021 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its @@ -74,9 +72,11 @@ struct lexscannerYY_state bool nestedComment = false; QCString prefix = "yy"; - QCString CCodeBuffer; + bool reentrant = false; + bool bison_bridge = false; + bool bison_locations = false; + QCString cCodeBuffer; int roundCount = 0; - int squareCount = 0; QCString yyFileName; ClangTUParser *clangParser = 0; @@ -108,15 +108,16 @@ TopStart "%top{"{nl} TopEnd "}"{nl} LiteralStart "%{"{nl} LiteralEnd "%}"{nl} -OptPrefix "%option"{ws}+"prefix"{ws}*"="{ws}* +Option "%option" RulesStart "%%"{nl} RulesEnd "%%"{nl} -RulesSharp "<"[^>]*">" +RulesSharp "<"[^>\n]*">" RulesCurly "{"[^{}\n]*"}" StartSquare "[" StartDouble "\"" StartRound "(" -EscapeRulesCharOpen "\\["|"\\<"|"\\{"|"\\("|"\\\""|"\\{"|"\\ " +StartRoundQuest "(?" +EscapeRulesCharOpen "\\["|"\\<"|"\\{"|"\\("|"\\\""|"\\ "|"\\\\" EscapeRulesCharClose "\\]"|"\\>"|"\\}"|"\\)" EscapeRulesChar {EscapeRulesCharOpen}|{EscapeRulesCharClose} @@ -131,14 +132,14 @@ CODE [cC][oO][dD][eE] RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"(" RAWEND ")"[^ \t\(\)\\]{0,16}\" CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) - +CHARCE "[:"[^:]*":]" /* no comment start / end signs inside square brackets */ NCOMM [^/\*] - // C start comment + // C start comment CCS "/\*" // C end comment CCE "*\/" - // Cpp comment + // Cpp comment CPPC "/\/" // doxygen start comment DCOMM ("/\*!"|"/\**"|"/\/!"|"/\/\/") @@ -149,6 +150,7 @@ ANYopt .* NONLopt [^\n]* %x DefSection +%x Option %x OptPrefix %x DefSectionLine %x RulesSectionInit @@ -158,6 +160,7 @@ NONLopt [^\n]* %x RulesSquare %x RulesRoundSquare %x RulesRound +%x RulesRoundQuest %x UserSection %x TopSection @@ -180,88 +183,130 @@ NONLopt [^\n]* %% <*>\x0d -<DefSection>{OptPrefix} { +<DefSection>{Option} { + BEGIN (Option); + } +<Option>"prefix"{ws}*"="{ws}* { BEGIN (OptPrefix); } <OptPrefix>"\""[^\"]*"\"" { yyextra->prefix = yytext; yyextra->prefix = yyextra->prefix.mid(1,yyleng-2); + BEGIN (Option); + } +<Option>"reentrant" { + yyextra-> reentrant = true; + } +<Option>"bison-bridge" { + yyextra-> bison_bridge = true; } -<OptPrefix>{nl} { - yyextra->CCodeBuffer += yytext; +<Option>"bison-locations" { + yyextra-> bison_bridge = true; + yyextra-> bison_locations = true; + } +<Option>{nws}+ +<Option>{ws}+ +<Option>{nl} { + yyextra->cCodeBuffer += yytext; BEGIN (DefSection); } <DefSection>^{RulesStart} { - yyextra->CCodeBuffer += "int " + yyextra->prefix + "lex (yyscan_t yyscanner) {\n"; + { + bool fill = false; + yyextra->cCodeBuffer += "int " + yyextra->prefix + "lex ("; + if (yyextra->bison_bridge ) + { + if (fill) yyextra->cCodeBuffer += ","; + yyextra->cCodeBuffer += "YYSTYPE * yylval_param"; + fill = true; + } + if (yyextra->bison_locations) + { + if (fill) yyextra->cCodeBuffer += ","; + yyextra->cCodeBuffer += "YYLTYPE * yylloc_param"; + fill = true; + } + if (yyextra->reentrant) + { + if (fill) yyextra->cCodeBuffer += ","; + yyextra->cCodeBuffer += "yyscan_t yyscanner"; + fill = true; + } + if (!yyextra->bison_bridge && !yyextra->bison_locations && !yyextra->reentrant) + { + yyextra->cCodeBuffer += "void"; + } + yyextra->cCodeBuffer += ") {\n"; + } BEGIN (RulesSectionInit); } <DefSection>^{TopStart} { - yyextra->CCodeBuffer += "\n"; + yyextra->cCodeBuffer += "\n"; yyextra->lastContext = YY_START; BEGIN (TopSection); } <DefSection>^{LiteralStart} { - yyextra->CCodeBuffer += "\n"; + yyextra->cCodeBuffer += "\n"; yyextra->lastContext = YY_START; BEGIN (LiteralSection); } <TopSection>^{TopEnd} { - yyextra->CCodeBuffer += "\n"; + yyextra->cCodeBuffer += "\n"; BEGIN( yyextra->lastContext ) ; } <TopSection>.*{nl} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <LiteralSection>^{LiteralEnd} { - yyextra->CCodeBuffer += "\n"; + yyextra->cCodeBuffer += "\n"; BEGIN( yyextra->lastContext ) ; } <LiteralSection>.*{nl} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DefSection>^{nws} { BEGIN(DefSectionLine); } <DefSection>{CPPC}.*{nl} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DefSection>^{ws}*{CCS} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; yyextra->lastContext = YY_START; BEGIN(COMMENT); } <COMMENT>{CCE}{ws}*{nl} { - yyextra->CCodeBuffer+=yytext; + yyextra->cCodeBuffer+=yytext; BEGIN(yyextra->lastContext); } <COMMENT>{CCE} { - yyextra->CCodeBuffer+=yytext; + yyextra->cCodeBuffer+=yytext; BEGIN(yyextra->lastContext); } <COMMENT>[^*\n]+ { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <COMMENT>{CPPC}|{CCS} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <COMMENT>{nl} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <COMMENT>. { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DefSection>^{nl} { - yyextra->CCodeBuffer += "\n"; + yyextra->cCodeBuffer += "\n"; } <DefSection>^{ws}.*{nl} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DefSectionLine>.*{nl} { - yyextra->CCodeBuffer += "\n"; + yyextra->cCodeBuffer += "\n"; BEGIN(DefSection); } <RulesSectionInit,RulesPattern>^{RulesEnd} { - yyextra->CCodeBuffer += "}\n"; + yyextra->cCodeBuffer += "}\n"; BEGIN (UserSection); } <RulesSectionInit>^{nws} { @@ -269,116 +314,131 @@ NONLopt [^\n]* BEGIN(RulesPattern); } <RulesSectionInit>^{ws}.*{nl} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <RulesSectionInit>^{nl} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <RulesPattern>"<<EOF>>" { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <RulesPattern>{EscapeRulesChar} { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <RulesPattern>{RulesSharp} { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <RulesPattern>{RulesCurly} { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <RulesPattern>{StartDouble} { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); yyextra->lastContext = YY_START; BEGIN(RulesDouble); } <RulesDouble,RulesRoundDouble>"\\\\" { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <RulesDouble,RulesRoundDouble>"\\\"" { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <RulesDouble>"\"" { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); BEGIN( yyextra->lastContext ) ; } <RulesRoundDouble>"\"" { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); BEGIN(RulesRound) ; } <RulesDouble,RulesRoundDouble>. { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <RulesPattern>{StartSquare} { - yyextra->squareCount++; - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); yyextra->lastContext = YY_START; BEGIN(RulesSquare); } +<RulesSquare,RulesRoundSquare>{CHARCE} { + yyextra->cCodeBuffer += repeatChar(' ', yyleng); + } <RulesSquare,RulesRoundSquare>"\\[" | <RulesSquare,RulesRoundSquare>"\\]" { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); - } -<RulesSquare,RulesRoundSquare>"[" { - yyextra->squareCount++; - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <RulesSquare>"]" { - yyextra->squareCount--; - yyextra->CCodeBuffer += repeatChar(' ', yyleng); - if (!yyextra->squareCount) BEGIN(RulesPattern); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); + BEGIN(RulesPattern); } <RulesRoundSquare>"]" { - yyextra->squareCount--; - yyextra->CCodeBuffer += repeatChar(' ', yyleng); - if (!yyextra->squareCount) BEGIN(RulesRound) ; + yyextra->cCodeBuffer += repeatChar(' ', yyleng); + BEGIN(RulesRound) ; } <RulesSquare,RulesRoundSquare>"\\\\" { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <RulesSquare,RulesRoundSquare>. { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } +<RulesPattern>{StartRoundQuest} { + yyextra->cCodeBuffer += repeatChar(' ', yyleng); + yyextra->lastContext = YY_START; + BEGIN(RulesRoundQuest); + } +<RulesRoundQuest>{nl} { + yyextra->cCodeBuffer += "\n"; + } +<RulesRoundQuest>[^)] { + yyextra->cCodeBuffer += repeatChar(' ', yyleng); + } +<RulesRoundQuest>")" { + yyextra->cCodeBuffer += repeatChar(' ', yyleng); + BEGIN(yyextra->lastContext); + } <RulesPattern>{StartRound} { yyextra->roundCount++; - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); yyextra->lastContext = YY_START; BEGIN(RulesRound); } <RulesRound>{RulesCurly} { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <RulesRound>{StartSquare} { - yyextra->squareCount++; - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); BEGIN(RulesRoundSquare); } <RulesRound>{StartDouble} { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); BEGIN(RulesRoundDouble); } -<RulesRound>"\\(" | -<RulesRound>"\\)" { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); +<RulesRound>{EscapeRulesChar} { + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <RulesRound>"(" { yyextra->roundCount++; - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <RulesRound>")" { yyextra->roundCount--; - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ; } +<RulesRound>{nl} { + yyextra->cCodeBuffer += "\n"; + } +<RulesRound>{ws} { + yyextra->cCodeBuffer += repeatChar(' ', yyleng); + } <RulesRound>. { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <RulesPattern>{ws}+"|" { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); yyextra->curlyCount = 0; BEGIN(SkipCurly); } <RulesPattern>^{ws}*{nl} { - yyextra->CCodeBuffer += "\n"; + yyextra->cCodeBuffer += "\n"; } <RulesPattern>^{ws}+ { } @@ -389,45 +449,45 @@ NONLopt [^\n]* BEGIN(SkipCurly); } <RulesPattern>"\\\\" { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } -<RulesPattern>{CCS} { - yyextra->CCodeBuffer += yytext; +<RulesPattern>{CCS} { + yyextra->cCodeBuffer += yytext; yyextra->lastContext = YY_START; BEGIN(COMMENT); } <RulesPattern>. { - yyextra->CCodeBuffer += repeatChar(' ', yyleng); + yyextra->cCodeBuffer += repeatChar(' ', yyleng); } <SkipCurly>{B}*"#"{B}+[0-9]+{B}+/"\"" { /* line control directive */ - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; yyextra->lastPreLineCtrlContext = YY_START; BEGIN( PreLineCtrl ); } <PreLineCtrl>"\""[^\n\"]*"\"" { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <PreLineCtrl>. { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <PreLineCtrl>\n { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; BEGIN( yyextra->lastPreLineCtrlContext ); } <SkipCurly>"{" { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; ++yyextra->curlyCount ; } <SkipCurly>"}"/{BN}*{DCOMM}"<!--" | /* see bug710917 */ <SkipCurly>"}" { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; if( yyextra->curlyCount ) { --yyextra->curlyCount ; } } <SkipCurly>"}"{BN}*{DCOMM}"<" { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; if ( yyextra->curlyCount ) { --yyextra->curlyCount ; @@ -446,53 +506,53 @@ NONLopt [^\n]* } } <SkipCurly>\" { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; yyextra->lastStringContext=SkipCurly; BEGIN( SkipString ); } <SkipCurly>^{B}*"#" { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; yyextra->lastPreLineCtrlContext = YY_START; BEGIN( PreLineCtrl ); } <SkipCurly>{B}*{RAWBEGIN} { QCString raw=QCString(yytext).stripWhiteSpace(); - yyextra->delimiter = raw.data()+2; + yyextra->delimiter = raw.mid(2); yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1); yyextra->lastRawStringContext = YY_START; - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; BEGIN(RawString); } <SkipCurly>[^\n#"'@\\/{}<]+ { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <SkipCurly>{CCS} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; yyextra->lastCContext = YY_START; BEGIN(SkipComment); } <SkipCurly>{CPPC} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; yyextra->lastCContext = YY_START; BEGIN(SkipCxxComment); } <SkipCurly>{CHARLIT} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <SkipCurly>\' { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <SkipCurly>. { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <SkipCurly>({CPPC}{B}*)?{CCS}"!" { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; yyextra->docBlockContext = YY_START; BEGIN( DocBlock ); } <SkipCurly>{CCS}"*"[*]+{BL} { bool javadocBanner = Config_getBool(JAVADOC_BANNER); - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; if( javadocBanner ) { yyextra->docBlockContext = YY_START; @@ -504,88 +564,88 @@ NONLopt [^\n]* } } <SkipCurly>({CPPC}{B}*)?{CCS}"*"/{NCOMM} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; yyextra->docBlockContext = YY_START; BEGIN( DocBlock ); } <SkipCurly>{CPPC}"!" { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; yyextra->docBlockContext = YY_START; BEGIN( DocLine ); } <SkipCurly>{CPPC}"/"/[^/] { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; yyextra->docBlockContext = YY_START; BEGIN( DocLine ); } <SkipCurly>\n { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; if (yyextra->curlyCount<=0) { BEGIN(RulesPattern); } } <SkipString>\\. { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <SkipString>\" { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; BEGIN( yyextra->lastStringContext ); } <SkipString>{CCS}|{CCE}|{CPPC} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <SkipString>\n { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <SkipString>. { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <SkipCxxComment>.*"\\\n" { // line continuation - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <SkipCxxComment>{ANYopt}/\n { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; BEGIN( yyextra->lastCContext ) ; } <Comment>{BN}+ { - yyextra->CCodeBuffer += yytext ; + yyextra->cCodeBuffer += yytext ; } -<Comment>{CCS} { yyextra->CCodeBuffer += yytext ; } -<Comment>{CPPC} { yyextra->CCodeBuffer += yytext ; } +<Comment>{CCS} { yyextra->cCodeBuffer += yytext ; } +<Comment>{CPPC} { yyextra->cCodeBuffer += yytext ; } <Comment>{CMD}("code"|"verbatim") { yyextra->insideCode=TRUE; - yyextra->CCodeBuffer += yytext ; + yyextra->cCodeBuffer += yytext ; } <Comment>{CMD}("endcode"|"endverbatim") { yyextra->insideCode=FALSE; - yyextra->CCodeBuffer += yytext ; + yyextra->cCodeBuffer += yytext ; } -<Comment>[^ \.\t\r\n\/\*]+ { yyextra->CCodeBuffer += yytext ; } -<Comment>{CCE} { yyextra->CCodeBuffer += yytext ; +<Comment>[^ \.\t\r\n\/\*]+ { yyextra->cCodeBuffer += yytext ; } +<Comment>{CCE} { yyextra->cCodeBuffer += yytext ; if (!yyextra->insideCode) BEGIN( yyextra->lastContext ) ; } -<Comment>. { yyextra->CCodeBuffer += *yytext ; } +<Comment>. { yyextra->cCodeBuffer += *yytext ; } <SkipComment>{CPPC}|{CCS} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <SkipComment>[^\*\n]+ { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <SkipComment>\n { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <SkipComment>{B}*{CCE} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; BEGIN( yyextra->lastCContext ); } <SkipComment>"*" { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <RawString>{RAWEND} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; QCString delimiter = yytext+1; delimiter=delimiter.left(delimiter.length()-1); if (delimiter==yyextra->delimiter) @@ -594,60 +654,60 @@ NONLopt [^\n]* } } <RawString>[^)\n]+ { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <RawString>. { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <RawString>\n { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } /* ---- Single line comments ------ */ <DocLine>[^\n]*"\n"[ \t]*{CPPC}[/!][<]? { // continuation of multiline C++-style comment - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DocLine>{B}*{CPPC}"/"[/]+{Bopt}/"\n" { // ignore marker line (see bug700345) - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; BEGIN( yyextra->docBlockContext ); } <DocLine>{NONLopt}/"\n"{B}*{CPPC}[!/]{B}*{CMD}"}" { // next line is an end group marker, see bug 752712 - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; BEGIN( yyextra->docBlockContext ); } <DocLine>{NONLopt}/"\n" { // whole line - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; BEGIN( yyextra->docBlockContext ); } /* ---- Comments blocks ------ */ <DocBlock>"*"*{CCE} { // end of comment block - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; BEGIN(yyextra->docBlockContext); } <DocBlock>^{B}*"*"+/[^/] { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DocBlock>^{B}*({CPPC})?{B}*"*"+/[^/a-z_A-Z0-9*] { // start of a comment line - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DocBlock>^{B}*({CPPC}){B}* { // strip embedded C++ comments if at the start of a line - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DocBlock>{CPPC} { // slashes in the middle of a comment block - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DocBlock>{CCS} { // start of a new comment in the // middle of a comment block - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DocBlock>({CMD}{CMD}){ID}/[^a-z_A-Z0-9] { // escaped command - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DocBlock>{CMD}("f$"|"f["|"f{") { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; yyextra->docBlockName=&yytext[1]; if (yyextra->docBlockName.at(1)=='{') { @@ -658,21 +718,21 @@ NONLopt [^\n]* BEGIN(DocCopyBlock); } <DocBlock>{B}*"<"{PRE}">" { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; yyextra->docBlockName="<pre>"; yyextra->fencedSize=0; yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); } <DocBlock>{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; yyextra->docBlockName=&yytext[1]; yyextra->fencedSize=0; yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); } <DocBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; QCString pat = substitute(yytext,"*"," "); yyextra->docBlockName="~~~"; yyextra->fencedSize=pat.stripWhiteSpace().length(); @@ -680,7 +740,7 @@ NONLopt [^\n]* BEGIN(DocCopyBlock); } <DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; QCString pat = substitute(yytext,"*"," "); yyextra->docBlockName="```"; yyextra->fencedSize=pat.stripWhiteSpace().length(); @@ -691,43 +751,43 @@ NONLopt [^\n]* REJECT; } <DocBlock>[^@*~\/\\\n]+ { // any character that isn't special - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DocBlock>\n { // newline - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DocBlock>. { // command block - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } /* ---- Copy verbatim sections ------ */ <DocCopyBlock>"</"{PRE}">" { // end of a <pre> block - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; if (yyextra->docBlockName=="<pre>") { BEGIN(DocBlock); } } <DocCopyBlock>"</"{CODE}">" { // end of a <code> block - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; if (yyextra->docBlockName=="<code>") { BEGIN(DocBlock); } } <DocCopyBlock>[\\@]("f$"|"f]"|"f}") { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; BEGIN(DocBlock); } <DocCopyBlock>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; if (&yytext[4]==yyextra->docBlockName) { BEGIN(DocBlock); } } <DocCopyBlock>^{B}*"*"+/{BN}+ { // start of a comment line - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; if (yyextra->docBlockName=="verbatim") { REJECT; @@ -738,13 +798,13 @@ NONLopt [^\n]* } else { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } } <DocCopyBlock>^{B}*"*"+/{B}+"*"{BN}* { // start of a comment line with two *'s if (yyextra->docBlockName=="code") { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } else { @@ -754,7 +814,7 @@ NONLopt [^\n]* <DocCopyBlock>^{B}*"*"+/({ID}|"(") { // Assume *var or *(... is part of source code (see bug723516) if (yyextra->docBlockName=="code") { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } else { @@ -766,11 +826,11 @@ NONLopt [^\n]* { if (yyextra->nestedComment) // keep * it is part of the code { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } else // remove * it is part of the comment block { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } } else @@ -779,7 +839,7 @@ NONLopt [^\n]* } } <DocCopyBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; QCString pat = substitute(yytext,"*"," "); if (yyextra->fencedSize==pat.stripWhiteSpace().length()) { @@ -787,7 +847,7 @@ NONLopt [^\n]* } } <DocCopyBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; QCString pat = substitute(yytext,"*"," "); if (yyextra->fencedSize==pat.stripWhiteSpace().length()) { @@ -795,7 +855,7 @@ NONLopt [^\n]* } } <DocCopyBlock>[^\<@/\*\]~\$\\\n]+ { // any character that is not special - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DocCopyBlock>{CCS}|{CCE}|{CPPC} { if (yytext[1]=='*') @@ -806,17 +866,17 @@ NONLopt [^\n]* { yyextra->nestedComment=FALSE; } - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DocCopyBlock>\n { // newline - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <DocCopyBlock>. { // any other character - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } <SkipCurlyEndDoc>"}"{BN}*{DCOMM}"<" { // desc is followed by another one yyextra->docBlockContext = SkipCurlyEndDoc; - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; if (yytext[yyleng-3]=='/') { BEGIN( DocLine ); @@ -827,17 +887,19 @@ NONLopt [^\n]* } } <SkipCurlyEndDoc>"}" { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; BEGIN(SkipCurly); } <UserSection>.*{nl} { - yyextra->CCodeBuffer += yytext; + yyextra->cCodeBuffer += yytext; } - /* + + /* <*>. { fprintf(stderr,"Lex scanner Def rule for %s: #%s#\n",stateToString(YY_START),yytext);} - */ +<*>{nl} { fprintf(stderr,"Lex scanner Def rule for newline %s: #%s#\n",stateToString(YY_START),yytext);} + */ <*><<EOF>> { handleCCode(yyscanner); yyterminate(); @@ -861,7 +923,7 @@ static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) //----------------------------------------------------------------------------- static void parseMain(yyscan_t yyscanner, - const char *fileName, + const QCString &fileName, const char *fileBuf, const std::shared_ptr<Entry> &rt, ClangTUParser *clangParser) @@ -877,7 +939,7 @@ static void parseMain(yyscan_t yyscanner, yyextra->clangParser = clangParser; yyextra->language = getLanguageFromFileName(yyextra->yyFileName); rt->lang = yyextra->language; - msg("Parsing file %s...\n",yyextra->yyFileName.data()); + msg("Parsing file %s...\n",qPrint(yyextra->yyFileName)); yyextra->current_root = rt; yyextra->current = std::make_shared<Entry>(); @@ -903,13 +965,12 @@ static void handleCCode(yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - if (yyextra->CCodeBuffer.isEmpty()) return; + if (yyextra->cCodeBuffer.isEmpty()) return; yyextra->cOutlineParser.parseInput(yyextra->yyFileName, - yyextra->CCodeBuffer, + yyextra->cCodeBuffer.data(), yyextra->current_root, yyextra->clangParser); - // SrcLangExt_Cpp, - yyextra->CCodeBuffer.resize(0); + yyextra->cCodeBuffer.resize(0); return; } //---------------------------------------------------------------------------- @@ -933,18 +994,18 @@ LexOutlineParser::~LexOutlineParser() lexscannerYYlex_destroy(p->yyscanner); } -void LexOutlineParser::parseInput(const char *fileName, +void LexOutlineParser::parseInput(const QCString &fileName, const char *fileBuf, const std::shared_ptr<Entry> &root, ClangTUParser *clangParser) { struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; - printlex(yy_flex_debug, TRUE, __FILE__, fileName); + printlex(yy_flex_debug, TRUE, __FILE__, qPrint(fileName)); ::parseMain(p->yyscanner,fileName,fileBuf,root,clangParser); - printlex(yy_flex_debug, FALSE, __FILE__, fileName); + printlex(yy_flex_debug, FALSE, __FILE__, qPrint(fileName)); } diff --git a/src/linkedmap.h b/src/linkedmap.h index 0e866d9..db3f7b1 100644 --- a/src/linkedmap.h +++ b/src/linkedmap.h @@ -23,6 +23,8 @@ #include <algorithm> #include <cctype> +#include "qcstring.h" + //! @brief Container class representing a vector of objects with keys. //! @details Objects can efficiently be looked up given the key. //! Objects are owned by the container. @@ -50,6 +52,14 @@ class LinkedMap //! Find an object given the key. //! Returns a pointer to the element if found or nullptr if it is not found. + const T *find(const QCString &key) const + { + auto it = m_lookup.find(key.str()); + return it!=m_lookup.end() ? it->second : nullptr; + } + + //! Find an object given the key. + //! Returns a pointer to the element if found or nullptr if it is not found. const T *find(const char *key) const { return find(std::string(key ? key : "")); @@ -62,6 +72,12 @@ class LinkedMap } //! A non-const wrapper for find() const + T* find(const QCString &key) + { + return const_cast<T*>(static_cast<const LinkedMap&>(*this).find(key)); + } + + //! A non-const wrapper for find() const T* find(const std::string &key) { return const_cast<T*>(static_cast<const LinkedMap&>(*this).find(key)); @@ -77,7 +93,22 @@ class LinkedMap if (result==nullptr) { std::string key(k ? k : ""); - Ptr ptr = std::make_unique<T>(key.c_str(),std::forward<Args>(args)...); + Ptr ptr = std::make_unique<T>(QCString(k),std::forward<Args>(args)...); + result = ptr.get(); + m_lookup.insert({key,result}); + m_entries.push_back(std::move(ptr)); + } + return result; + } + + template<class...Args> + T *add(const QCString &k, Args&&... args) + { + std::string key = k.str(); + T *result = find(key); + if (result==nullptr) + { + Ptr ptr = std::make_unique<T>(k,std::forward<Args>(args)...); result = ptr.get(); m_lookup.insert({key,result}); m_entries.push_back(std::move(ptr)); @@ -102,6 +133,19 @@ class LinkedMap return result; } + T *add(const QCString &k, Ptr &&ptr) + { + std::string key = k.str(); + T *result = find(key); + if (result==nullptr) + { + result = ptr.get(); + m_lookup.insert({key,result}); + m_entries.push_back(std::move(ptr)); + } + return result; + } + //! Prepends a new object to the ordered vector if it was not added already. //! Return a non-owning pointer to the newly added object, or to the existing object if //! it was already inserted before under the given key. @@ -120,12 +164,25 @@ class LinkedMap return result; } + template<class...Args> + T *prepend(const QCString &key, Args&&... args) + { + T *result = find(key); + if (result==nullptr) + { + Ptr ptr = std::make_unique<T>(key,std::forward<Args>(args)...); + result = ptr.get(); + m_lookup.insert({key.str(),result}); + m_entries.push_front(std::move(ptr)); + } + return result; + } + //! Removes an object from the container and deletes it. //! Returns true if the object was deleted or false it is was not found. - bool del(const char *key_) + bool del(const QCString &key) { - std::string key(key_ ? key_ : ""); - auto it = m_lookup.find(key); + auto it = m_lookup.find(key.str()); if (it!=m_lookup.end()) { auto vecit = std::find_if(m_entries.begin(),m_entries.end(),[obj=it->second](auto &el) { return el.get()==obj; }); @@ -191,6 +248,14 @@ class LinkedRefMap //! find an object given the key. //! Returns a pointer to the object if found or nullptr if it is not found. + const T *find(const QCString &key) const + { + auto it = m_lookup.find(key.str()); + return it!=m_lookup.end() ? it->second : nullptr; + } + + //! find an object given the key. + //! Returns a pointer to the object if found or nullptr if it is not found. const T *find(const char *key) const { return find(std::string(key ? key : "")); @@ -202,6 +267,11 @@ class LinkedRefMap return const_cast<T*>(static_cast<const LinkedRefMap&>(*this).find(key)); } + T* find(const QCString &key) + { + return const_cast<T*>(static_cast<const LinkedRefMap&>(*this).find(key)); + } + //! non-const wrapper for find() const T* find(const std::string &key) { @@ -226,6 +296,21 @@ class LinkedRefMap } } + bool add(const QCString &k, T* obj) + { + std::string key = k.str(); + if (find(key)==nullptr) // new element + { + m_lookup.insert({key,obj}); + m_entries.push_back(obj); + return true; + } + else // already existing, don't add + { + return false; + } + } + //! Prepends an object reference to the ordered vector if it was not added already. //! Return true if the reference was added, and false if an object with the same key //! was already added before @@ -244,12 +329,25 @@ class LinkedRefMap } } + bool prepend(const QCString &key, T* obj) + { + if (find(key)==nullptr) // new element + { + m_lookup.insert({key.str(),obj}); + m_entries.insert(m_entries.begin(),obj); + return true; + } + else // already existing, don't add + { + return false; + } + } + //! Removes an object from the container and deletes it. //! Returns true if the object was deleted or false it is was not found. - bool del(const char *key_) + bool del(const QCString &key) { - std::string key(key_ ? key_ : ""); - auto it = m_lookup.find(key); + auto it = m_lookup.find(key.str()); if (it!=m_lookup.end()) { auto vecit = std::find_if(m_entries.begin(),m_entries.end(),[obj=it->second](auto &el) { return el.get()==obj; }); diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index 3839510..93ae712 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -28,8 +28,10 @@ #include "emoji.h" #include "fileinfo.h" -ManDocVisitor::ManDocVisitor(std::ostream &t,CodeOutputInterface &ci, - const char *langExt) +ManListItemInfo man_listItemInfo[man_maxIndentLevels]; + +ManDocVisitor::ManDocVisitor(TextStream &t,CodeOutputInterface &ci, + const QCString &langExt) : DocVisitor(DocVisitor_Man), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_firstCol(FALSE), m_indent(0), m_langExt(langExt) { @@ -371,7 +373,7 @@ void ManDocVisitor::visit(DocIncOperator *op) if (locLangExt.isEmpty()) locLangExt = m_langExt; SrcLangExt langExt = getLanguageFromFileName(locLangExt); //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n", - // op->type(),op->isFirst(),op->isLast(),op->text().data()); + // op->type(),op->isFirst(),op->isLast(),qPrint(op->text())); if (op->isFirst()) { if (!m_hide) @@ -643,12 +645,27 @@ void ManDocVisitor::visitPost(DocSection *) { } -void ManDocVisitor::visitPre(DocHtmlList *) +void ManDocVisitor::visitPre(DocHtmlList *l) { if (m_hide) return; m_indent+=2; if (!m_firstCol) m_t << "\n"; m_t << ".PD 0\n"; + man_listItemInfo[m_indent].number = 1; + man_listItemInfo[m_indent].type = '1'; + for (const auto &opt : l->attribs()) + { + if (opt.name=="type") + { + man_listItemInfo[m_indent].type = opt.value[0]; + } + if (opt.name=="start") + { + bool ok; + int val = opt.value.toInt(&ok); + if (ok) man_listItemInfo[m_indent].number = val; + } + } } void ManDocVisitor::visitPost(DocHtmlList *) @@ -668,7 +685,29 @@ void ManDocVisitor::visitPre(DocHtmlListItem *li) m_t << ".IP \"" << ws; if (((DocHtmlList *)li->parent())->type()==DocHtmlList::Ordered) { - m_t << li->itemNumber() << ".\" " << m_indent+2; + switch (man_listItemInfo[m_indent].type) + { + case '1': + m_t << man_listItemInfo[m_indent].number; + break; + case 'a': + m_t << integerToAlpha(man_listItemInfo[m_indent].number,false); + break; + case 'A': + m_t << integerToAlpha(man_listItemInfo[m_indent].number); + break; + case 'i': + m_t << integerToRoman(man_listItemInfo[m_indent].number,false); + break; + case 'I': + m_t << integerToRoman(man_listItemInfo[m_indent].number); + break; + default: + m_t << man_listItemInfo[m_indent].number; + break; + } + m_t << ".\" " << m_indent+2; + man_listItemInfo[m_indent].number++; } else // bullet list { @@ -1049,11 +1088,11 @@ void ManDocVisitor::visitPost(DocParBlock *) } -void ManDocVisitor::filter(const char *str) +void ManDocVisitor::filter(const QCString &str) { - if (str) + if (!str.isEmpty()) { - const char *p=str; + const char *p=str.data(); char c=0; while ((c=*p++)) { diff --git a/src/mandocvisitor.h b/src/mandocvisitor.h index c994f08..332ca70 100644 --- a/src/mandocvisitor.h +++ b/src/mandocvisitor.h @@ -25,12 +25,13 @@ #include "docvisitor.h" class CodeOutputInterface; +class TextStream; /*! @brief Concrete visitor implementation for LaTeX output. */ class ManDocVisitor : public DocVisitor { public: - ManDocVisitor(std::ostream &t,CodeOutputInterface &ci,const char *langExt); + ManDocVisitor(TextStream &t,CodeOutputInterface &ci,const QCString &langExt); //-------------------------------------- // visitor functions for leaf nodes @@ -143,13 +144,13 @@ class ManDocVisitor : public DocVisitor // helper functions //-------------------------------------- - void filter(const char *str); + void filter(const QCString &str); //-------------------------------------- // state variables //-------------------------------------- - std::ostream &m_t; + TextStream &m_t; CodeOutputInterface &m_ci; bool m_insidePre; bool m_hide; @@ -158,4 +159,13 @@ class ManDocVisitor : public DocVisitor QCString m_langExt; }; +struct ManListItemInfo +{ + int number; + char type; +}; + +const int man_maxIndentLevels = 13; + +extern ManListItemInfo man_listItemInfo[man_maxIndentLevels]; #endif diff --git a/src/mangen.cpp b/src/mangen.cpp index 2c26553..05c5e77 100644 --- a/src/mangen.cpp +++ b/src/mangen.cpp @@ -105,22 +105,22 @@ void ManGenerator::init() Dir d(manOutput.str()); if (!d.exists() && !d.mkdir(manOutput.str())) { - term("Could not create output directory %s\n",manOutput.data()); + term("Could not create output directory %s\n",qPrint(manOutput)); } std::string manDir = manOutput.str()+"/"+getSubdir().str(); if (!d.exists(manDir) && !d.mkdir(manDir)) { - term("Could not create output directory %s/%s\n",manOutput.data(), getSubdir().data()); + term("Could not create output directory %s/%s\n",qPrint(manOutput), qPrint(getSubdir())); } createSubDirs(d); } -static QCString buildFileName(const char *name) +static QCString buildFileName(const QCString &name) { QCString fileName; - if (name==0) return "noname"; + if (name.isEmpty()) return "noname"; - const char *p=name; + const char *p=name.data(); char c; while ((c=*p++)) { @@ -156,7 +156,7 @@ static QCString buildFileName(const char *name) return fileName; } -void ManGenerator::startFile(const char *,const char *manName,const char *,int) +void ManGenerator::startFile(const QCString &,const QCString &manName,const QCString &,int) { startPlainFile( buildFileName( manName ) ); m_firstCol=TRUE; @@ -164,25 +164,25 @@ void ManGenerator::startFile(const char *,const char *manName,const char *,int) void ManGenerator::endFile() { - t << "\n"; + m_t << "\n"; endPlainFile(); } -void ManGenerator::endTitleHead(const char *,const char *name) +void ManGenerator::endTitleHead(const QCString &,const QCString &name) { - t << ".TH \"" << name << "\" " << getExtension() << " \"" + m_t << ".TH \"" << name << "\" " << getExtension() << " \"" << dateToString(FALSE) << "\" \""; if (!Config_getString(PROJECT_NUMBER).isEmpty()) - t << "Version " << Config_getString(PROJECT_NUMBER) << "\" \""; + m_t << "Version " << Config_getString(PROJECT_NUMBER) << "\" \""; if (Config_getString(PROJECT_NAME).isEmpty()) - t << "Doxygen"; + m_t << "Doxygen"; else - t << Config_getString(PROJECT_NAME); - t << "\" \\\" -*- nroff -*-\n"; - t << ".ad l\n"; - t << ".nh\n"; - t << ".SH NAME\n"; - t << name; + m_t << Config_getString(PROJECT_NAME); + m_t << "\" \\\" -*- nroff -*-\n"; + m_t << ".ad l\n"; + m_t << ".nh\n"; + m_t << ".SH NAME\n"; + m_t << name; m_firstCol=FALSE; m_paragraph=TRUE; m_inHeader=TRUE; @@ -192,19 +192,19 @@ void ManGenerator::newParagraph() { if (!m_paragraph) { - if (!m_firstCol) t << "\n"; - t << ".PP\n"; + if (!m_firstCol) m_t << "\n"; + m_t << ".PP\n"; m_firstCol=TRUE; } m_paragraph=TRUE; } -void ManGenerator::startParagraph(const char *) +void ManGenerator::startParagraph(const QCString &) { if (!m_paragraph) { - if (!m_firstCol) t << "\n"; - t << ".PP\n"; + if (!m_firstCol) m_t << "\n"; + m_t << ".PP\n"; m_firstCol=TRUE; } m_paragraph=TRUE; @@ -214,38 +214,38 @@ void ManGenerator::endParagraph() { } -void ManGenerator::writeString(const char *text) +void ManGenerator::writeString(const QCString &text) { docify(text); } -void ManGenerator::startIndexItem(const char *,const char *) +void ManGenerator::startIndexItem(const QCString &,const QCString &) { } -void ManGenerator::endIndexItem(const char *,const char *) +void ManGenerator::endIndexItem(const QCString &,const QCString &) { } -void ManGenerator::writeStartAnnoItem(const char *,const char *, - const char *,const char *) +void ManGenerator::writeStartAnnoItem(const QCString &,const QCString &, + const QCString &,const QCString &) { } -void ManGenerator::writeObjectLink(const char *,const char *, - const char *, const char *name) +void ManGenerator::writeObjectLink(const QCString &,const QCString &, + const QCString &, const QCString &name) { startBold(); docify(name); endBold(); } -void ManGenerator::writeCodeLink(const char *,const char *, - const char *, const char *name, - const char *) +void ManGenerator::writeCodeLink(const QCString &,const QCString &, + const QCString &, const QCString &name, + const QCString &) { docify(name); } -void ManGenerator::startHtmlLink(const char *) +void ManGenerator::startHtmlLink(const QCString &) { } @@ -253,56 +253,56 @@ void ManGenerator::endHtmlLink() { } -//void ManGenerator::writeMailLink(const char *url) +//void ManGenerator::writeMailLink(const QCString &url) //{ // docify(url); //} void ManGenerator::startGroupHeader(int) { - if (!m_firstCol) t << "\n"; - t << ".SH \""; + if (!m_firstCol) m_t << "\n"; + m_t << ".SH \""; m_upperCase=TRUE; m_firstCol=FALSE; } void ManGenerator::endGroupHeader(int) { - t << "\"\n.PP \n"; + m_t << "\"\n.PP \n"; m_firstCol=TRUE; m_paragraph=TRUE; m_upperCase=FALSE; } -void ManGenerator::startMemberHeader(const char *,int) +void ManGenerator::startMemberHeader(const QCString &,int) { - if (!m_firstCol) t << "\n"; - t << ".SS \""; + if (!m_firstCol) m_t << "\n"; + m_t << ".SS \""; } void ManGenerator::endMemberHeader() { - t << "\"\n"; + m_t << "\"\n"; m_firstCol=TRUE; m_paragraph=FALSE; } -void ManGenerator::docify(const char *str) +void ManGenerator::docify(const QCString &str) { - if (str) + if (!str.isEmpty()) { - const char *p=str; + const char *p=str.data(); char c=0; while ((c=*p++)) { switch(c) { - case '-': t << "\\-"; break; // see bug747780 - case '.': t << "\\&."; break; // see bug652277 - case '\\': t << "\\\\"; m_col++; break; - case '\n': t << "\n"; m_col=0; break; + case '-': m_t << "\\-"; break; // see bug747780 + case '.': m_t << "\\&."; break; // see bug652277 + case '\\': m_t << "\\\\"; m_col++; break; + case '\n': m_t << "\n"; m_col=0; break; case '\"': c = '\''; // no break! - default: t << c; m_col++; break; + default: m_t << c; m_col++; break; } } m_firstCol=(c=='\n'); @@ -311,12 +311,12 @@ void ManGenerator::docify(const char *str) m_paragraph=FALSE; } -void ManGenerator::codify(const char *str) +void ManGenerator::codify(const QCString &str) { //static char spaces[]=" "; - if (str) + if (!str.isEmpty()) { - const char *p=str; + const char *p=str.data(); char c; int spacesToNextTabStop; while (*p) @@ -324,16 +324,16 @@ void ManGenerator::codify(const char *str) c=*p++; switch(c) { - case '.': t << "\\&."; break; // see bug652277 + case '.': m_t << "\\&."; break; // see bug652277 case '\t': spacesToNextTabStop = Config_getInt(TAB_SIZE) - (m_col%Config_getInt(TAB_SIZE)); - t << Doxygen::spaces.left(spacesToNextTabStop); + m_t << Doxygen::spaces.left(spacesToNextTabStop); m_col+=spacesToNextTabStop; break; - case '\n': t << "\n"; m_firstCol=TRUE; m_col=0; break; - case '\\': t << "\\"; m_col++; break; + case '\n': m_t << "\n"; m_firstCol=TRUE; m_col=0; break; + case '\\': m_t << "\\"; m_col++; break; case '\"': // no break! - default: p=writeUTF8Char(t,p-1); m_firstCol=FALSE; m_col++; break; + default: p=writeUTF8Char(m_t,p-1); m_firstCol=FALSE; m_col++; break; } } //printf("%s",str);fflush(stdout); @@ -347,9 +347,9 @@ void ManGenerator::writeChar(char c) if (m_firstCol) m_col=0; else m_col++; switch (c) { - case '\\': t << "\\\\"; break; + case '\\': m_t << "\\\\"; break; case '\"': c = '\''; // no break! - default: t << c; break; + default: m_t << c; break; } //printf("%c",c);fflush(stdout); m_paragraph=FALSE; @@ -358,7 +358,7 @@ void ManGenerator::writeChar(char c) void ManGenerator::startDescList(SectionTypes) { if (!m_firstCol) - { t << "\n" << ".PP\n"; + { m_t << "\n" << ".PP\n"; m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } @@ -368,21 +368,21 @@ void ManGenerator::startDescList(SectionTypes) void ManGenerator::startTitle() { - if (!m_firstCol) t << "\n"; - t << ".SH \""; + if (!m_firstCol) m_t << "\n"; + m_t << ".SH \""; m_firstCol=FALSE; m_paragraph=FALSE; } void ManGenerator::endTitle() { - t << "\""; + m_t << "\""; } void ManGenerator::startItemListItem() { - if (!m_firstCol) t << "\n"; - t << ".TP\n"; + if (!m_firstCol) m_t << "\n"; + m_t << ".TP\n"; m_firstCol=TRUE; m_paragraph=FALSE; m_col=0; @@ -392,34 +392,34 @@ void ManGenerator::endItemListItem() { } -void ManGenerator::startCodeFragment(const char *) +void ManGenerator::startCodeFragment(const QCString &) { newParagraph(); - t << ".nf\n"; + m_t << ".nf\n"; m_firstCol=TRUE; m_paragraph=FALSE; } -void ManGenerator::endCodeFragment(const char *) +void ManGenerator::endCodeFragment(const QCString &) { - if (!m_firstCol) t << "\n"; - t << ".fi\n"; + if (!m_firstCol) m_t << "\n"; + m_t << ".fi\n"; m_firstCol=TRUE; m_paragraph=FALSE; m_col=0; } -void ManGenerator::startMemberDoc(const char *,const char *,const char *,const char *,int,int,bool) +void ManGenerator::startMemberDoc(const QCString &,const QCString &,const QCString &,const QCString &,int,int,bool) { - if (!m_firstCol) t << "\n"; - t << ".SS \""; + if (!m_firstCol) m_t << "\n"; + m_t << ".SS \""; m_firstCol=FALSE; m_paragraph=FALSE; } -void ManGenerator::startDoxyAnchor(const char *,const char *manName, - const char *, const char *name, - const char *) +void ManGenerator::startDoxyAnchor(const QCString &,const QCString &manName, + const QCString &, const QCString &name, + const QCString &) { // something to be done? if( !Config_getBool(MAN_LINKS) ) @@ -434,7 +434,7 @@ void ManGenerator::startDoxyAnchor(const char *,const char *manName, if (i!=-1) baseName=baseName.right(baseName.length()-i-2); //printf("Converting man link '%s'->'%s'->'%s'\n", - // name,baseName.data(),buildFileName(baseName).data()); + // name,qPrint(baseName),qPrint(buildFileName(baseName))); // - remove dangerous characters and append suffix, then add dir prefix QCString fileName=dir()+"/"+buildFileName( baseName ); @@ -451,48 +451,48 @@ void ManGenerator::startDoxyAnchor(const char *,const char *manName, void ManGenerator::endMemberDoc(bool) { - t << "\"\n"; + m_t << "\"\n"; } void ManGenerator::startSubsection() { - if (!m_firstCol) t << "\n"; - t << ".SS \""; + if (!m_firstCol) m_t << "\n"; + m_t << ".SS \""; m_firstCol=FALSE; m_paragraph=FALSE; } void ManGenerator::endSubsection() { - t << "\""; + m_t << "\""; } void ManGenerator::startSubsubsection() { - if (!m_firstCol) t << "\n"; - t << "\n.SS \""; + if (!m_firstCol) m_t << "\n"; + m_t << "\n.SS \""; m_firstCol=FALSE; m_paragraph=FALSE; } void ManGenerator::endSubsubsection() { - t << "\""; + m_t << "\""; } void ManGenerator::writeSynopsis() { - if (!m_firstCol) t << "\n"; - t << ".SH SYNOPSIS\n.br\n.PP\n"; + if (!m_firstCol) m_t << "\n"; + m_t << ".SH SYNOPSIS\n.br\n.PP\n"; m_firstCol=TRUE; m_paragraph=FALSE; } void ManGenerator::startDescItem() { - if (!m_firstCol) t << "\n"; - t << ".IP \""; + if (!m_firstCol) m_t << "\n"; + m_t << ".IP \""; m_firstCol=FALSE; } @@ -504,9 +504,9 @@ void ManGenerator::startDescItem() void ManGenerator::startDescForItem() { - if (!m_firstCol) t << "\n"; - if (!m_paragraph) t << ".in -1c\n"; - t << ".in +1c\n"; + if (!m_firstCol) m_t << "\n"; + if (!m_paragraph) m_t << ".in -1c\n"; + m_t << ".in +1c\n"; m_firstCol=TRUE; m_paragraph=FALSE; m_col=0; @@ -518,7 +518,7 @@ void ManGenerator::endDescForItem() void ManGenerator::endDescItem() { - t << "\" 1c\n"; + m_t << "\" 1c\n"; m_firstCol=TRUE; } @@ -539,23 +539,23 @@ void ManGenerator::endAnonTypeScope(int indentLevel) } -void ManGenerator::startMemberItem(const char *,int,const char *) +void ManGenerator::startMemberItem(const QCString &,int,const QCString &) { - if (m_firstCol && !m_insideTabbing) t << ".in +1c\n"; - t << "\n.ti -1c\n.RI \""; + if (m_firstCol && !m_insideTabbing) m_t << ".in +1c\n"; + m_t << "\n.ti -1c\n.RI \""; m_firstCol=FALSE; } void ManGenerator::endMemberItem() { - t << "\"\n.br"; + m_t << "\"\n.br"; } void ManGenerator::startMemberList() { if (!m_insideTabbing) { - t << "\n.in +1c"; m_firstCol=FALSE; + m_t << "\n.in +1c"; m_firstCol=FALSE; } } @@ -563,18 +563,18 @@ void ManGenerator::endMemberList() { if (!m_insideTabbing) { - t << "\n.in -1c"; m_firstCol=FALSE; + m_t << "\n.in -1c"; m_firstCol=FALSE; } } void ManGenerator::startMemberGroupHeader(bool) { - t << "\n.PP\n.RI \"\\fB"; + m_t << "\n.PP\n.RI \"\\fB"; } void ManGenerator::endMemberGroupHeader() { - t << "\\fP\"\n.br\n"; + m_t << "\\fP\"\n.br\n"; m_firstCol=TRUE; } @@ -584,21 +584,21 @@ void ManGenerator::startMemberGroupDocs() void ManGenerator::endMemberGroupDocs() { - t << "\n.PP"; + m_t << "\n.PP"; } void ManGenerator::startMemberGroup() { - t << "\n.in +1c"; + m_t << "\n.in +1c"; } void ManGenerator::endMemberGroup(bool) { - t << "\n.in -1c"; + m_t << "\n.in -1c"; m_firstCol=FALSE; } -void ManGenerator::startSection(const char *,const char *,SectionType type) +void ManGenerator::startSection(const QCString &,const QCString &,SectionType type) { if( !m_inHeader ) { @@ -606,15 +606,15 @@ void ManGenerator::startSection(const char *,const char *,SectionType type) { case SectionType::Page: startGroupHeader(FALSE); break; case SectionType::Section: startGroupHeader(FALSE); break; - case SectionType::Subsection: startMemberHeader(0, -1); break; - case SectionType::Subsubsection: startMemberHeader(0, -1); break; - case SectionType::Paragraph: startMemberHeader(0, -1); break; + case SectionType::Subsection: startMemberHeader(QCString(), -1); break; + case SectionType::Subsubsection: startMemberHeader(QCString(), -1); break; + case SectionType::Paragraph: startMemberHeader(QCString(), -1); break; default: ASSERT(0); break; } } } -void ManGenerator::endSection(const char *,SectionType type) +void ManGenerator::endSection(const QCString &,SectionType type) { if( !m_inHeader ) { @@ -630,7 +630,7 @@ void ManGenerator::endSection(const char *,SectionType type) } else { - t << "\n"; + m_t << "\n"; m_firstCol=TRUE; m_paragraph=FALSE; m_inHeader=FALSE; @@ -640,7 +640,7 @@ void ManGenerator::endSection(const char *,SectionType type) void ManGenerator::startExamples() { if (!m_firstCol) - { t << "\n" << ".PP\n"; + { m_t << "\n" << ".PP\n"; m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } @@ -655,10 +655,10 @@ void ManGenerator::endExamples() { } -void ManGenerator::startDescTable(const char *title) +void ManGenerator::startDescTable(const QCString &title) { if (!m_firstCol) - { t << "\n.PP\n"; + { m_t << "\n.PP\n"; m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } @@ -675,10 +675,10 @@ void ManGenerator::endDescTable() endDescForItem(); } -void ManGenerator::startParamList(ParamListTypes,const char *title) +void ManGenerator::startParamList(ParamListTypes,const QCString &title) { if (!m_firstCol) - { t << "\n.PP\n"; + { m_t << "\n.PP\n"; m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } @@ -695,17 +695,17 @@ void ManGenerator::endParamList() void ManGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *,int) { - ManDocVisitor *visitor = new ManDocVisitor(t,*this,ctx?ctx->getDefFileExtension():QCString("")); + ManDocVisitor *visitor = new ManDocVisitor(m_t,*this,ctx?ctx->getDefFileExtension():QCString("")); n->accept(visitor); delete visitor; m_firstCol=FALSE; m_paragraph = FALSE; } -void ManGenerator::startConstraintList(const char *header) +void ManGenerator::startConstraintList(const QCString &header) { if (!m_firstCol) - { t << "\n.PP\n"; + { m_t << "\n.PP\n"; m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } @@ -726,7 +726,7 @@ void ManGenerator::endConstraintParam() { endEmphasis(); endItemListItem(); - t << " : "; + m_t << " : "; } void ManGenerator::startConstraintType() @@ -745,7 +745,7 @@ void ManGenerator::startConstraintDocs() void ManGenerator::endConstraintDocs() { - t << "\n"; m_firstCol=TRUE; + m_t << "\n"; m_firstCol=TRUE; } void ManGenerator::endConstraintList() @@ -757,14 +757,14 @@ void ManGenerator::startInlineHeader() { if (!m_firstCol) { - t << "\n.PP\n" << ".in -1c\n"; + m_t << "\n.PP\n" << ".in -1c\n"; } - t << ".RI \"\\fB"; + m_t << ".RI \"\\fB"; } void ManGenerator::endInlineHeader() { - t << "\\fP\"\n" << ".in +1c\n"; + m_t << "\\fP\"\n" << ".in +1c\n"; m_firstCol = FALSE; } @@ -772,9 +772,9 @@ void ManGenerator::startMemberDocSimple(bool isEnum) { if (!m_firstCol) { - t << "\n.PP\n"; + m_t << "\n.PP\n"; } - t << "\\fB"; + m_t << "\\fB"; if (isEnum) { docify(theTranslator->trEnumerationValues()); @@ -783,15 +783,15 @@ void ManGenerator::startMemberDocSimple(bool isEnum) { docify(theTranslator->trCompoundMembers()); } - t << ":\\fP\n"; - t << ".RS 4\n"; + m_t << ":\\fP\n"; + m_t << ".RS 4\n"; } void ManGenerator::endMemberDocSimple(bool) { - if (!m_firstCol) t << "\n"; - t << ".RE\n"; - t << ".PP\n"; + if (!m_firstCol) m_t << "\n"; + m_t << ".RE\n"; + m_t << ".PP\n"; m_firstCol=TRUE; } @@ -801,17 +801,17 @@ void ManGenerator::startInlineMemberType() void ManGenerator::endInlineMemberType() { - t << " "; + m_t << " "; } void ManGenerator::startInlineMemberName() { - t << "\\fI"; + m_t << "\\fI"; } void ManGenerator::endInlineMemberName() { - t << "\\fP "; + m_t << "\\fP "; } void ManGenerator::startInlineMemberDoc() @@ -820,9 +820,9 @@ void ManGenerator::startInlineMemberDoc() void ManGenerator::endInlineMemberDoc() { - if (!m_firstCol) t << "\n"; - t << ".br\n"; - t << ".PP\n"; + if (!m_firstCol) m_t << "\n"; + m_t << ".br\n"; + m_t << ".PP\n"; m_firstCol=TRUE; } @@ -830,10 +830,10 @@ void ManGenerator::startLabels() { } -void ManGenerator::writeLabel(const char *l,bool isLast) +void ManGenerator::writeLabel(const QCString &l,bool isLast) { - t << "\\fC [" << l << "]\\fP"; - if (!isLast) t << ", "; + m_t << "\\fC [" << l << "]\\fP"; + if (!isLast) m_t << ", "; } void ManGenerator::endLabels() diff --git a/src/mangen.h b/src/mangen.h index d35e61c..c552580 100644 --- a/src/mangen.h +++ b/src/mangen.h @@ -35,27 +35,27 @@ class ManGenerator : public OutputGenerator void writeDoc(DocNode *,const Definition *,const MemberDef *,int); static void init(); - void startFile(const char *name,const char *manName,const char *title,int); + void startFile(const QCString &name,const QCString &manName,const QCString &title,int); void writeSearchInfo() {} - void writeFooter(const char *) {} + void writeFooter(const QCString &) {} void endFile(); void clearBuffer(); void startIndexSection(IndexSections) {} void endIndexSection(IndexSections) {} - void writePageLink(const char *,bool) {} + void writePageLink(const QCString &,bool) {} void startProjectNumber() {} void endProjectNumber() {} void writeStyleInfo(int) {} - void startTitleHead(const char *) {} - void endTitleHead(const char *,const char *); + void startTitleHead(const QCString &) {} + void endTitleHead(const QCString &,const QCString &); void startTitle(); void endTitle(); void newParagraph(); - void startParagraph(const char *classDef); + void startParagraph(const QCString &classDef); void endParagraph(); - void writeString(const char *text); + void writeString(const QCString &text); void startIndexListItem() {} void endIndexListItem() {} void startIndexList() {} @@ -63,34 +63,34 @@ class ManGenerator : public OutputGenerator void startIndexKey() {} void endIndexKey() {} void startIndexValue(bool) {} - void endIndexValue(const char *,bool) {} + void endIndexValue(const QCString &,bool) {} void startItemList() {} void endItemList() { newParagraph(); } - void startIndexItem(const char *ref,const char *file); - void endIndexItem(const char *ref,const char *file); - void docify(const char *text); - void codify(const char *text); - void writeObjectLink(const char *ref,const char *file, - const char *anchor,const char *name); - void writeCodeLink(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip); - void writeTooltip(const char *, const DocLinkInfo &, const char *, - const char *, const SourceLinkInfo &, const SourceLinkInfo & + void startIndexItem(const QCString &ref,const QCString &file); + void endIndexItem(const QCString &ref,const QCString &file); + void docify(const QCString &text); + void codify(const QCString &text); + void writeObjectLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name); + void writeCodeLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip); + void writeTooltip(const QCString &, const DocLinkInfo &, const QCString &, + const QCString &, const SourceLinkInfo &, const SourceLinkInfo & ) {} - void startTextLink(const char *,const char *) {} + void startTextLink(const QCString &,const QCString &) {} void endTextLink() {} - void startHtmlLink(const char *url); + void startHtmlLink(const QCString &url); void endHtmlLink(); - void startTypewriter() { t << "\\fC"; m_firstCol=FALSE; } - void endTypewriter() { t << "\\fP"; m_firstCol=FALSE; } + void startTypewriter() { m_t << "\\fC"; m_firstCol=FALSE; } + void endTypewriter() { m_t << "\\fP"; m_firstCol=FALSE; } void startGroupHeader(int); void endGroupHeader(int); void startMemberSections() {} void endMemberSections() {} void startHeaderSection() {} void endHeaderSection(); - void startMemberHeader(const char *,int); + void startMemberHeader(const QCString &,int); void endMemberHeader(); void insertMemberAlign(bool) {} void insertMemberAlignLeft(int,bool){} @@ -107,10 +107,12 @@ class ManGenerator : public OutputGenerator void endInlineHeader(); void startAnonTypeScope(int); void endAnonTypeScope(int); - void startMemberItem(const char *,int,const char *); + void startMemberItem(const QCString &,int,const QCString &); void endMemberItem(); void startMemberTemplateParams() {} - void endMemberTemplateParams(const char *,const char *) {} + void endMemberTemplateParams(const QCString &,const QCString &) {} + void startCompoundTemplateParams() { startSubsubsection(); } + void endCompoundTemplateParams() { endSubsubsection(); } void startMemberGroupHeader(bool); void endMemberGroupHeader(); @@ -120,30 +122,30 @@ class ManGenerator : public OutputGenerator void endMemberGroup(bool); void writeRuler() {} - void writeAnchor(const char *,const char *) {} - void startCodeFragment(const char *); - void endCodeFragment(const char *); - void writeLineNumber(const char *,const char *,const char *,int l) { t << l << " "; m_col=0; } + void writeAnchor(const QCString &,const QCString &) {} + void startCodeFragment(const QCString &); + void endCodeFragment(const QCString &); + void writeLineNumber(const QCString &,const QCString &,const QCString &,int l) { m_t << l << " "; m_col=0; } void startCodeLine(bool) {} void endCodeLine() { codify("\n"); m_col=0; } - void startEmphasis() { t << "\\fI"; m_firstCol=FALSE; } - void endEmphasis() { t << "\\fP"; m_firstCol=FALSE; } - void startBold() { t << "\\fB"; m_firstCol=FALSE; } - void endBold() { t << "\\fP"; m_firstCol=FALSE; } + void startEmphasis() { m_t << "\\fI"; m_firstCol=FALSE; } + void endEmphasis() { m_t << "\\fP"; m_firstCol=FALSE; } + void startBold() { m_t << "\\fB"; m_firstCol=FALSE; } + void endBold() { m_t << "\\fP"; m_firstCol=FALSE; } void startDescription() {} void endDescription() {} void startDescItem(); void endDescItem(); - void lineBreak(const char *) { t << "\n.br\n"; } + void lineBreak(const QCString &) { m_t << "\n.br\n"; } void writeChar(char c); - void startMemberDoc(const char *,const char *,const char *,const char *,int,int,bool); + void startMemberDoc(const QCString &,const QCString &,const QCString &,const QCString &,int,int,bool); void endMemberDoc(bool); - void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *); - void endDoxyAnchor(const char *,const char *) {} + void startDoxyAnchor(const QCString &,const QCString &,const QCString &,const QCString &,const QCString &); + void endDoxyAnchor(const QCString &,const QCString &) {} void writeLatexSpacing() {} - void writeStartAnnoItem(const char *type,const char *file, - const char *path,const char *name); - void writeEndAnnoItem(const char *) { t << "\n"; m_firstCol=TRUE; } + void writeStartAnnoItem(const QCString &type,const QCString &file, + const QCString &path,const QCString &name); + void writeEndAnnoItem(const QCString &) { m_t << "\n"; m_firstCol=TRUE; } void startSubsection(); void endSubsection(); void startSubsubsection(); @@ -152,49 +154,49 @@ class ManGenerator : public OutputGenerator void endCenter() {} void startSmall() {} void endSmall() {} - void startMemberDescription(const char *,const char *,bool) { t << "\n.RI \""; m_firstCol=FALSE; } - void endMemberDescription() { t << "\""; m_firstCol=FALSE; } + void startMemberDescription(const QCString &,const QCString &,bool) { m_t << "\n.RI \""; m_firstCol=FALSE; } + void endMemberDescription() { m_t << "\""; m_firstCol=FALSE; } void startMemberDeclaration() {} - void endMemberDeclaration(const char *,const char *) {} - void writeInheritedSectionTitle(const char *,const char *,const char *, - const char *,const char *,const char *) {} + void endMemberDeclaration(const QCString &,const QCString &) {} + void writeInheritedSectionTitle(const QCString &,const QCString &,const QCString &, + const QCString &,const QCString &,const QCString &) {} void startDescList(SectionTypes); void endDescList() {} void startExamples(); void endExamples(); - void startParamList(ParamListTypes,const char *title); + void startParamList(ParamListTypes,const QCString &title); void endParamList(); //void writeDescItem(); void startDescForItem(); void endDescForItem(); - void startSection(const char *,const char *,SectionType); - void endSection(const char *,SectionType); - void addIndexItem(const char *,const char *) {} + void startSection(const QCString &,const QCString &,SectionType); + void endSection(const QCString &,SectionType); + void addIndexItem(const QCString &,const QCString &) {} void startIndent() {} void endIndent() {} void writeSynopsis(); void startClassDiagram() {} - void endClassDiagram(const ClassDiagram &,const char *,const char *) {} + void endClassDiagram(const ClassDiagram &,const QCString &,const QCString &) {} void startPageRef() {} - void endPageRef(const char *,const char *) {} + void endPageRef(const QCString &,const QCString &) {} void startQuickIndices() {} void endQuickIndices() {} - void writeSplitBar(const char *) {} - void writeNavigationPath(const char *) {} + void writeSplitBar(const QCString &) {} + void writeNavigationPath(const QCString &) {} void writeLogo() {} - void writeQuickLinks(bool,HighlightedItem,const char *) {} - void writeSummaryLink(const char *,const char *,const char *,bool) {} + void writeQuickLinks(bool,HighlightedItem,const QCString &) {} + void writeSummaryLink(const QCString &,const QCString &,const QCString &,bool) {} void startContents() {} void endContents() {} - void writeNonBreakableSpace(int n) { int i; for (i=0;i<n;i++) t << " "; } + void writeNonBreakableSpace(int n) { int i; for (i=0;i<n;i++) m_t << " "; } - void startDescTable(const char *t); + void startDescTable(const QCString &t); void endDescTable(); void startDescTableRow() {} void endDescTableRow() {} void startDescTableTitle() { startItemListItem(); startBold(); startEmphasis(); endItemListItem(); } void endDescTableTitle() { endEmphasis(); endBold(); } - void startDescTableData() { t << "\n"; m_firstCol=TRUE; } + void startDescTableData() { m_t << "\n"; m_firstCol=TRUE; } void endDescTableData() {} void startDotGraph() {} @@ -217,18 +219,18 @@ class ManGenerator : public OutputGenerator void endMemberDocPrefixItem() {} void startMemberDocName(bool) {} void endMemberDocName() {} - void startParameterType(bool,const char *) {} + void startParameterType(bool,const QCString &) {} void endParameterType() {} void startParameterName(bool) {} void endParameterName(bool,bool,bool) {} void startParameterList(bool) {} void endParameterList() {} - void exceptionEntry(const char*,bool) {} + void exceptionEntry(const QCString &,bool) {} - void startFontClass(const char *) {} + void startFontClass(const QCString &) {} void endFontClass() {} - void startConstraintList(const char *); + void startConstraintList(const QCString &); void startConstraintParam(); void endConstraintParam(); void startConstraintType(); @@ -247,12 +249,12 @@ class ManGenerator : public OutputGenerator void endInlineMemberDoc(); void startLabels(); - void writeLabel(const char *l,bool isLast); + void writeLabel(const QCString &l,bool isLast); void endLabels(); - void writeCodeAnchor(const char *) {} - void setCurrentDoc(const Definition *,const char *,bool) {} - void addWord(const char *,bool) {} + void writeCodeAnchor(const QCString &) {} + void setCurrentDoc(const Definition *,const QCString &,bool) {} + void addWord(const QCString &,bool) {} private: bool m_firstCol = true; diff --git a/src/markdown.cpp b/src/markdown.cpp index d7ec28d..4627e73 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -69,22 +69,22 @@ class Trace { public: - Trace(const char *func) : m_func(func) + Trace(const QCString &func) : m_func(func) { if (Debug::isFlagSet(Debug::Markdown)) { - fprintf(IOSTREAM,"> %s\n",func); + fprintf(IOSTREAM,"> %s\n",qPrint(func)); s_indent++; } } - Trace(const char *func,const char *data) : m_func(func) + Trace(const QCString &func,const QCString &data) : m_func(func) { if (Debug::isFlagSet(Debug::Markdown)) { indent(); char data_s[DATA_BUFSIZE*2+1] = ""; // worst case each input char outputs 2 chars + 0 terminator. int j=0; - if (data) + if (!data.isEmpty()) { for (int i=0;i<DATA_BUFSIZE;i++) { @@ -98,7 +98,7 @@ class Trace } } data_s[j++]=0; - fprintf(IOSTREAM,"> %s data=[%s…]\n",func,data_s); + fprintf(IOSTREAM,"> %s data=[%s…]\n",qPrint(func),data_s); s_indent++; } } @@ -108,7 +108,7 @@ class Trace { s_indent--; indent(); - fprintf(IOSTREAM,"< %s\n",m_func); + fprintf(IOSTREAM,"< %s\n",qPrint(m_func)); } } void trace(const char *fmt,...) @@ -116,7 +116,7 @@ class Trace if (Debug::isFlagSet(Debug::Markdown)) { indent(); - fprintf(IOSTREAM,": %s: ",m_func); + fprintf(IOSTREAM,": %s: ",qPrint(m_func)); va_list args; va_start(args,fmt); vfprintf(IOSTREAM, fmt, args); @@ -125,7 +125,7 @@ class Trace } private: void indent() { for (int i=0;i<s_indent;i++) fputs(" ",IOSTREAM); } - const char *m_func; + QCString m_func; static int s_indent; }; @@ -173,7 +173,7 @@ struct TableCell bool colSpan; }; -Markdown::Markdown(const char *fileName,int lineNr,int indentLevel) +Markdown::Markdown(const QCString &fileName,int lineNr,int indentLevel) : m_fileName(fileName), m_lineNr(lineNr), m_indentLevel(indentLevel) { using namespace std::placeholders; @@ -217,10 +217,10 @@ inline int isNewline(const char *data) // escape double quotes in string static QCString escapeDoubleQuotes(const QCString &s) { - TRACE(s.data()); - if (s.isEmpty()) return ""; + TRACE(s); + if (s.isEmpty()) return s; GrowBuf growBuf; - const char *p=s; + const char *p=s.data(); char c,pc='\0'; while ((c=*p++)) { @@ -237,11 +237,11 @@ static QCString escapeDoubleQuotes(const QCString &s) // escape characters that have a special meaning later on. static QCString escapeSpecialChars(const QCString &s) { - TRACE(s.data()); - if (s.isEmpty()) return ""; + TRACE(s); + if (s.isEmpty()) return s; bool insideQuote=FALSE; GrowBuf growBuf; - const char *p=s; + const char *p=s.data(); char c,pc='\0'; while ((c=*p++)) { @@ -263,11 +263,9 @@ static QCString escapeSpecialChars(const QCString &s) static void convertStringFragment(QCString &result,const char *data,int size) { - TRACE(result.data()); + TRACE(result); if (size<0) size=0; - result.resize(size+1); - memcpy(result.rawData(),data,size); - result.at(size)='\0'; + result = QCString(data,(uint)size); } /** helper function to convert presence of left and/or right alignment markers @@ -435,7 +433,7 @@ int Markdown::findEmphasisChar(const char *data, int size, char c, int c_size) if ((data[i]=='\\' || data[i]=='@') && // command data[i-1]!='\\' && data[i-1]!='@') // not escaped { - if (qstrncmp(&data[i+1],endBlockName,l)==0) + if (qstrncmp(&data[i+1],endBlockName.data(),l)==0) { break; } @@ -697,13 +695,13 @@ int Markdown::processHtmlTagWrite(const char *data,int offset,int size,bool doWr { if (data[i]=='/' && i<size-1 && data[i+1]=='>') // <bla/> { - //printf("Found htmlTag={%s}\n",QCString(data).left(i+2).data()); + //printf("Found htmlTag={%s}\n",qPrint(QCString(data).left(i+2))); if (doWrite) m_out.addStr(data,i+2); return i+2; } else if (data[i]=='>') // <bla> { - //printf("Found htmlTag={%s}\n",QCString(data).left(i+1).data()); + //printf("Found htmlTag={%s}\n",qPrint(QCString(data).left(i+1))); if (doWrite) m_out.addStr(data,i+1); return i+1; } @@ -723,7 +721,7 @@ int Markdown::processHtmlTagWrite(const char *data,int offset,int size,bool doWr } else if (!insideAttr && data[i]=='>') // found end of tag { - //printf("Found htmlTag={%s}\n",QCString(data).left(i+1).data()); + //printf("Found htmlTag={%s}\n",qPrint(QCString(data).left(i+1))); if (doWrite) m_out.addStr(data,i+1); return i+1; } @@ -862,7 +860,7 @@ int Markdown::processLink(const char *data,int,int size) if (i>=size) return 0; // premature end of comment -> no link contentEnd=i; convertStringFragment(content,data+contentStart,contentEnd-contentStart); - //printf("processLink: content={%s}\n",content.data()); + //printf("processLink: content={%s}\n",qPrint(content)); if (!isImageLink && content.isEmpty()) return 0; // no link text i++; // skip over ] @@ -911,7 +909,7 @@ int Markdown::processLink(const char *data,int,int size) if (i>=size || data[i]=='\n') return 0; convertStringFragment(link,data+linkStart,i-linkStart); link = link.stripWhiteSpace(); - //printf("processLink: link={%s}\n",link.data()); + //printf("processLink: link={%s}\n",qPrint(link)); if (link.isEmpty()) return 0; if (link.at(link.length()-1)=='>') link=link.left(link.length()-1); @@ -941,7 +939,7 @@ int Markdown::processLink(const char *data,int,int size) if (data[titleEnd]==c) // found it { convertStringFragment(title,data+titleStart,titleEnd-titleStart); - //printf("processLink: title={%s}\n",title.data()); + //printf("processLink: title={%s}\n",qPrint(title)); } else { @@ -968,7 +966,7 @@ int Markdown::processLink(const char *data,int,int size) if (i>=size) return 0; // extract link convertStringFragment(link,data+linkStart,i-linkStart); - //printf("processLink: link={%s}\n",link.data()); + //printf("processLink: link={%s}\n",qPrint(link)); link = link.stripWhiteSpace(); if (link.isEmpty()) // shortcut link { @@ -981,11 +979,11 @@ int Markdown::processLink(const char *data,int,int size) { link = lr_it->second.link; title = lr_it->second.title; - //printf("processLink: ref: link={%s} title={%s}\n",link.data(),title.data()); + //printf("processLink: ref: link={%s} title={%s}\n",qPrint(link),qPrint(title)); } else // reference not found! { - //printf("processLink: ref {%s} do not exist\n",link.lower().data()); + //printf("processLink: ref {%s} do not exist\n",link.qPrint(lower())); return 0; } i++; @@ -994,7 +992,7 @@ int Markdown::processLink(const char *data,int,int size) { QCString content_lower = content.lower(); auto lr_it = m_linkRefs.find(content_lower.str()); - //printf("processLink: minimal link {%s} lr=%p",content.data(),lr); + //printf("processLink: minimal link {%s} lr=%p",qPrint(content),lr); if (lr_it!=m_linkRefs.end()) // found it { link = lr_it->second.link; @@ -1113,12 +1111,12 @@ int Markdown::processLink(const char *data,int,int size) } m_out.addStr(">"); content = content.simplifyWhiteSpace(); - processInline(content,content.length()); + processInline(content.data(),content.length()); m_out.addStr("</a>"); } else // avoid link to e.g. F[x](y) { - //printf("no link for '%s'\n",link.data()); + //printf("no link for '%s'\n",qPrint(link)); return 0; } } @@ -1186,7 +1184,7 @@ int Markdown::processCodeSpan(const char *data, int /*offset*/, int size) f_end--; } - //printf("found code span '%s'\n",QCString(data+f_begin).left(f_end-f_begin).data()); + //printf("found code span '%s'\n",qPrint(QCString(data+f_begin).left(f_end-f_begin))); /* real code span */ if (f_begin < f_end) @@ -1228,7 +1226,7 @@ int Markdown::processSpecialCommand(const char *data, int offset, int size) if ((data[i]=='\\' || data[i]=='@') && // command data[i-1]!='\\' && data[i-1]!='@') // not escaped { - if (qstrncmp(&data[i+1],endBlockName,l)==0) + if (qstrncmp(&data[i+1],endBlockName.data(),l)==0) { //printf("found end at %d\n",i); addStrEscapeUtf8Nbsp(data,i+1+l); @@ -1365,7 +1363,7 @@ static int isLinkRef(const char *data,int size, if (i>=size || data[i]!=']') return 0; convertStringFragment(refid,data+refIdStart,i-refIdStart); if (refid.isEmpty()) return 0; - //printf(" isLinkRef: found refid='%s'\n",refid.data()); + //printf(" isLinkRef: found refid='%s'\n",qPrint(refid)); i++; if (i>=size || data[i]!=':') return 0; i++; @@ -1386,7 +1384,7 @@ static int isLinkRef(const char *data,int size, if (i<size && data[i]=='>') i++; if (linkStart==linkEnd) return 0; // empty link convertStringFragment(link,data+linkStart,linkEnd-linkStart); - //printf(" isLinkRef: found link='%s'\n",link.data()); + //printf(" isLinkRef: found link='%s'\n",qPrint(link)); if (link=="@ref" || link=="\\ref") { int argStart=i; @@ -1431,7 +1429,7 @@ static int isLinkRef(const char *data,int size, { convertStringFragment(title,data+titleStart,end-titleStart); } - //printf(" title found: '%s'\n",title.data()); + //printf(" title found: '%s'\n",qPrint(title)); } while (i<size && data[i]==' ') i++; //printf("end of isLinkRef: i=%d size=%d data[i]='%c' eol=%d\n", @@ -1471,7 +1469,7 @@ static int isHRuler(const char *data,int size) static QCString extractTitleId(QCString &title, int level) { - TRACE(title.data()); + TRACE(title); // match e.g. '{#id-b11} ' and capture 'id-b11' static const reg::Ex r2(R"({#(\a[\w-]*)}\s*$)"); reg::Match match; @@ -1480,7 +1478,7 @@ static QCString extractTitleId(QCString &title, int level) { std::string id = match[1].str(); title = title.left((int)match.position()); - //printf("found match id='%s' title=%s\n",id.c_str(),title.data()); + //printf("found match id='%s' title=%s\n",id.c_str(),qPrint(title)); return id; } if ((level > 0) && (level <= Config_getInt(TOC_INCLUDE_HEADINGS))) @@ -1488,10 +1486,10 @@ static QCString extractTitleId(QCString &title, int level) static AtomicInt autoId { 0 }; QCString id; id.sprintf("autotoc_md%d",autoId++); - //printf("auto-generated id='%s' title='%s'\n",id.data(),title.data()); + //printf("auto-generated id='%s' title='%s'\n",qPrint(id),qPrint(title)); return id; } - //printf("no id found in title '%s'\n",title.data()); + //printf("no id found in title '%s'\n",qPrint(title)); return ""; } @@ -1641,7 +1639,7 @@ static int computeIndentExcludingListMarkers(const char *data,int size) } indent++,i++; } - //printf("{%s}->%d\n",QCString(data).left(size).data(),indent); + //printf("{%s}->%d\n",QCString(data).qPrint(left(size)),indent); return indent; } @@ -1731,8 +1729,8 @@ static bool isCodeBlock(const char *data,int offset,int size,int &indent) { //printf(" positions: nl_pos=[%d,%d,%d] line[-2]='%s' line[-1]='%s'\n", // nl_pos[0],nl_pos[1],nl_pos[2], - // QCString(data+nl_pos[1]).left(nl_pos[0]-nl_pos[1]-1).data(), - // QCString(data+nl_pos[2]).left(nl_pos[1]-nl_pos[2]-1).data()); + // qPrint(QCString(data+nl_pos[1]).left(nl_pos[0]-nl_pos[1]-1)), + // qPrint(QCString(data+nl_pos[2]).left(nl_pos[1]-nl_pos[2]-1))); // check that line -1 is empty if (!isEmptyLine(data+nl_pos[1],nl_pos[0]-nl_pos[1]-1)) @@ -2177,7 +2175,7 @@ int Markdown::writeCodeBlock(const char *data,int size,int refIndent) { TRACE(data); int i=0,end; - //printf("writeCodeBlock: data={%s}\n",QCString(data).left(size).data()); + //printf("writeCodeBlock: data={%s}\n",qPrint(QCString(data).left(size))); // no need for \ilinebr here as the previous line was empty and was skipped m_out.addStr("@verbatim\n"); int emptyLines=0; @@ -2190,7 +2188,7 @@ int Markdown::writeCodeBlock(const char *data,int size,int refIndent) int indent=0; while (j<end && data[j]==' ') j++,indent++; //printf("j=%d end=%d indent=%d refIndent=%d tabSize=%d data={%s}\n", - // j,end,indent,refIndent,Config_getInt(TAB_SIZE),QCString(data+i).left(end-i-1).data()); + // j,end,indent,refIndent,Config_getInt(TAB_SIZE),qPrint(QCString(data+i).left(end-i-1))); if (j==end-1) // empty line { emptyLines++; @@ -2254,10 +2252,10 @@ void Markdown::findEndOfLine(const char *data,int size, data[end-1]!='\\' && data[end-1]!='@' ) { - if (qstrncmp(&data[end+1],endBlockName,l)==0) + if (qstrncmp(&data[end+1],endBlockName.data(),l)==0) { // found end marker, skip over this block - //printf("feol.block m_out={%s}\n",QCString(data+i).left(end+l+1-i).data()); + //printf("feol.block m_out={%s}\n",qPrint(QCString(data+i).left(end+l+1-i))); end = end + l + 2; break; } @@ -2297,7 +2295,7 @@ void Markdown::findEndOfLine(const char *data,int size, } } if (j>0) end+=j-1; - //printf("findEndOfLine pi=%d i=%d end=%d {%s}\n",pi,i,end,QCString(data+i).left(end-i).data()); + //printf("findEndOfLine pi=%d i=%d end=%d {%s}\n",pi,i,end,qPrint(QCString(data+i).left(end-i))); } void Markdown::writeFencedCodeBlock(const char *data,const char *lng, @@ -2317,7 +2315,7 @@ void Markdown::writeFencedCodeBlock(const char *data,const char *lng, QCString Markdown::processQuotations(const QCString &s,int refIndent) { - TRACE(s.data()); + TRACE(s); m_out.clear(); const char *data = s.data(); int size = s.length(); @@ -2333,7 +2331,7 @@ QCString Markdown::processQuotations(const QCString &s,int refIndent) { if (isFencedCodeBlock(data+pi,size-pi,refIndent,lang,blockStart,blockEnd,blockOffset)) { - writeFencedCodeBlock(data+pi,lang,blockStart,blockEnd); + writeFencedCodeBlock(data+pi,lang.data(),blockStart,blockEnd); i=pi+blockOffset; pi=-1; end=i+1; @@ -2369,14 +2367,14 @@ QCString Markdown::processQuotations(const QCString &s,int refIndent) m_out.addChar(0); //printf("Process quotations\n---- input ----\n%s\n---- output ----\n%s\n------------\n", - // s.data(),m_out.get()); + // qPrint(s),m_out.get()); return m_out.get(); } QCString Markdown::processBlocks(const QCString &s,int indent) { - TRACE(s.data()); + TRACE(s); m_out.clear(); const char *data = s.data(); int size = s.length(); @@ -2441,7 +2439,7 @@ QCString Markdown::processBlocks(const QCString &s,int indent) if ((data[i]=='\\' || data[i]=='@') && // command data[i-1]!='\\' && data[i-1]!='@') // not escaped { - if (qstrncmp(&data[i+1],endBlockName,l)==0) + if (qstrncmp(&data[i+1],endBlockName.data(),l)==0) { m_out.addChar(data[i]); m_out.addStr(endBlockName); @@ -2461,7 +2459,7 @@ QCString Markdown::processBlocks(const QCString &s,int indent) QCString header; convertStringFragment(header,data+pi,i-pi-1); id = extractTitleId(header, level); - //printf("header='%s' is='%s'\n",header.data(),id.data()); + //printf("header='%s' is='%s'\n",qPrint(header),qPrint(id)); if (!header.isEmpty()) { if (!id.isEmpty()) @@ -2491,7 +2489,7 @@ QCString Markdown::processBlocks(const QCString &s,int indent) else if ((ref=isLinkRef(data+pi,size-pi,id,link,title))) { //printf("found link ref: id='%s' link='%s' title='%s'\n", - // id.data(),link.data(),title.data()); + // qPrint(id),qPrint(link),qPrint(title)); m_linkRefs.insert({id.lower().str(),LinkRef(link,title)}); i=ref+pi; pi=-1; @@ -2500,8 +2498,8 @@ QCString Markdown::processBlocks(const QCString &s,int indent) else if (isFencedCodeBlock(data+pi,size-pi,indent,lang,blockStart,blockEnd,blockOffset)) { //printf("Found FencedCodeBlock lang='%s' start=%d end=%d code={%s}\n", - // lang.data(),blockStart,blockEnd,QCString(data+pi+blockStart).left(blockEnd-blockStart).data()); - writeFencedCodeBlock(data+pi,lang,blockStart,blockEnd); + // qPrint(lang),blockStart,blockEnd,QCString(data+pi+blockStart).left(blockEnd-blockStart).data()); + writeFencedCodeBlock(data+pi,lang.data(),blockStart,blockEnd); i=pi+blockOffset; pi=-1; end=i+1; @@ -2536,7 +2534,7 @@ QCString Markdown::processBlocks(const QCString &s,int indent) if (isLinkRef(data+pi,size-pi,id,link,title)) { //printf("found link ref: id='%s' link='%s' title='%s'\n", - // id.data(),link.data(),title.data()); + // qPrint(id),qPrint(link),qPrint(title)); m_linkRefs.insert({id.lower().str(),LinkRef(link,title)}); } else @@ -2552,7 +2550,7 @@ QCString Markdown::processBlocks(const QCString &s,int indent) /** returns TRUE if input string docs starts with \@page or \@mainpage command */ static bool isExplicitPage(const QCString &docs) { - TRACE(docs.data()); + TRACE(docs); int i=0; const char *data = docs.data(); if (data) @@ -2575,7 +2573,7 @@ static bool isExplicitPage(const QCString &docs) QCString Markdown::extractPageTitle(QCString &docs,QCString &id, int &prepend) { - TRACE(docs.data()); + TRACE(docs); // first first non-empty line prepend = 0; QCString title; @@ -2618,13 +2616,13 @@ QCString Markdown::extractPageTitle(QCString &docs,QCString &id, int &prepend) docs=docs_org; id = extractTitleId(title, 0); } - //printf("extractPageTitle(title='%s' docs='%s' id='%s')\n",title.data(),docs.data(),id.data()); + //printf("extractPageTitle(title='%s' docs='%s' id='%s')\n",qPrint(title),qPrint(docs),qPrint(id)); return title; } QCString Markdown::detab(const QCString &s,int &refIndent) { - TRACE(s.data()); + TRACE(s); int tabSize = Config_getInt(TAB_SIZE); int size = s.length(); m_out.clear(); @@ -2701,19 +2699,19 @@ QCString Markdown::process(const QCString &input, int &startNewlines) QCString s = input; if (s.at(s.length()-1)!='\n') s += "\n"; // see PR #6766 s = detab(s,refIndent); - //printf("======== DeTab =========\n---- output -----\n%s\n---------\n",s.data()); + //printf("======== DeTab =========\n---- output -----\n%s\n---------\n",qPrint(s)); // then process quotation blocks (as these may contain other blocks) s = processQuotations(s,refIndent); - //printf("======== Quotations =========\n---- output -----\n%s\n---------\n",s.data()); + //printf("======== Quotations =========\n---- output -----\n%s\n---------\n",qPrint(s)); // then process block items (headers, rules, and code blocks, references) s = processBlocks(s,refIndent); - //printf("======== Blocks =========\n---- output -----\n%s\n---------\n",s.data()); + //printf("======== Blocks =========\n---- output -----\n%s\n---------\n",qPrint(s)); // finally process the inline markup (links, emphasis and code spans) m_out.clear(); - processInline(s,s.length()); + processInline(s.data(),s.length()); m_out.addChar(0); Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n---- output -----\n%s\n=========\n",qPrint(input),qPrint(m_out.get())); @@ -2729,7 +2727,7 @@ QCString Markdown::process(const QCString &input, int &startNewlines) if (p>result.data()) { // strip part of the input - result = result.mid(p-result.data()); + result = result.mid(static_cast<int>(p-result.data())); } return result; } @@ -2738,7 +2736,7 @@ QCString Markdown::process(const QCString &input, int &startNewlines) QCString markdownFileNameToId(const QCString &fileName) { - TRACE(fileName.data()); + TRACE(fileName); std::string absFileName = FileInfo(fileName.str()).absFilePath(); QCString baseFn = stripFromPath(absFileName.c_str()); int i = baseFn.findRev('.'); @@ -2770,7 +2768,7 @@ MarkdownOutlineParser::~MarkdownOutlineParser() { } -void MarkdownOutlineParser::parseInput(const char *fileName, +void MarkdownOutlineParser::parseInput(const QCString &fileName, const char *fileBuf, const std::shared_ptr<Entry> &root, ClangTUParser* /*clangParser*/) @@ -2788,7 +2786,7 @@ void MarkdownOutlineParser::parseInput(const char *fileName, if (id.startsWith("autotoc_md")) id = ""; int indentLevel=title.isEmpty() ? 0 : -1; markdown.setIndentLevel(indentLevel); - QCString fn = FileInfo(fileName).fileName(); + QCString fn = FileInfo(fileName.str()).fileName(); QCString titleFn = stripExtensionGeneral(fn,getFileNameExtension(fn)); QCString mdfileAsMainPage = Config_getString(USE_MDFILE_AS_MAINPAGE); bool wasEmpty = id.isEmpty(); @@ -2797,7 +2795,7 @@ void MarkdownOutlineParser::parseInput(const char *fileName, { if (!mdfileAsMainPage.isEmpty() && (fn==mdfileAsMainPage || // name reference - FileInfo(fileName).absFilePath()== + FileInfo(fileName.str()).absFilePath()== FileInfo(mdfileAsMainPage.str()).absFilePath()) // file reference with path ) { @@ -2855,7 +2853,7 @@ void MarkdownOutlineParser::parseInput(const char *fileName, p->commentScanner.leaveFile(fileName,lineNr); } -void MarkdownOutlineParser::parsePrototype(const char *text) +void MarkdownOutlineParser::parsePrototype(const QCString &text) { Doxygen::parserManager->getOutlineParser("*.cpp")->parsePrototype(text); } diff --git a/src/markdown.h b/src/markdown.h index 6744149..afed003 100644 --- a/src/markdown.h +++ b/src/markdown.h @@ -32,7 +32,7 @@ QCString markdownFileNameToId(const QCString &fileName); class Markdown { public: - Markdown(const char *fileName,int lineNr,int indentLevel=0); + Markdown(const QCString &fileName,int lineNr,int indentLevel=0); QCString process(const QCString &input, int &startNewlines); QCString extractPageTitle(QCString &docs,QCString &id,int &prepend); void setIndentLevel(int level) { m_indentLevel = level; } @@ -73,7 +73,7 @@ class Markdown private: struct LinkRef { - LinkRef(const char *l,const char *t) : link(l), title(t) {} + LinkRef(const QCString &l,const QCString &t) : link(l), title(t) {} QCString link; QCString title; }; @@ -93,12 +93,12 @@ class MarkdownOutlineParser : public OutlineParserInterface public: MarkdownOutlineParser(); virtual ~MarkdownOutlineParser(); - void parseInput(const char *fileName, + void parseInput(const QCString &fileName, const char *fileBuf, const std::shared_ptr<Entry> &root, ClangTUParser *clangParser); bool needsPreprocessing(const QCString &) const { return FALSE; } - void parsePrototype(const char *text); + void parsePrototype(const QCString &text); private: struct Private; std::unique_ptr<Private> p; diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 26b997c..dc5d095 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -50,11 +50,11 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable> { public: - MemberDefImpl(const char *defFileName,int defLine,int defColumn, - const char *type,const char *name,const char *args, - const char *excp,Protection prot,Specifier virt,bool stat, + MemberDefImpl(const QCString &defFileName,int defLine,int defColumn, + const QCString &type,const QCString &name,const QCString &args, + const QCString &excp,Protection prot,Specifier virt,bool stat, Relationship related,MemberType t,const ArgumentList &tal, - const ArgumentList &al,const char *metaData); + const ArgumentList &al,const QCString &metaData); virtual ~MemberDefImpl(); virtual DefType definitionType() const { return TypeMember; } @@ -65,13 +65,13 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable> virtual QCString getOutputFileBase() const; virtual QCString getReference() const; virtual QCString anchor() const; - virtual const char *declaration() const; - virtual const char *definition() const; - virtual const char *typeString() const; - virtual const char *argsString() const; - virtual const char *excpString() const; - virtual const char *bitfieldString() const; - virtual const char *extraTypeChars() const; + virtual QCString declaration() const; + virtual QCString definition() const; + virtual QCString typeString() const; + virtual QCString argsString() const; + virtual QCString excpString() const; + virtual QCString bitfieldString() const; + virtual QCString extraTypeChars() const; virtual const QCString &initializer() const; virtual int initializerLines() const; virtual uint64 getMemberSpecifiers() const; @@ -82,10 +82,10 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable> virtual const NamespaceDef* getNamespaceDef() const; virtual const GroupDef *getGroupDef() const; virtual ClassDef *accessorClass() const; - virtual const char *getReadAccessor() const; - virtual const char *getWriteAccessor() const; + virtual QCString getReadAccessor() const; + virtual QCString getWriteAccessor() const; virtual Grouping::GroupPri_t getGroupPri() const; - virtual const char *getGroupFileName() const; + virtual QCString getGroupFileName() const; virtual int getGroupStartLine() const; virtual bool getGroupHasDocs() const; virtual QCString qualifiedName() const; @@ -93,7 +93,7 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable> virtual Protection protection() const; virtual Specifier virtualness(int count=0) const; virtual MemberType memberType() const; - virtual QCString memberTypeName() const; + virtual QCString memberTypeName() const; virtual bool isSignal() const; virtual bool isSlot() const; virtual bool isVariable() const; @@ -229,6 +229,7 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable> virtual QCString getDeclType() const; virtual StringVector getLabels(const Definition *container) const; virtual const ArgumentList &typeConstraints() const; + virtual QCString requiresClause() const; virtual QCString documentation() const; virtual QCString briefDescription(bool abbr=FALSE) const; virtual QCString fieldType() const; @@ -237,28 +238,28 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable> virtual int getDeclLine() const; virtual int getDeclColumn() const; virtual void setMemberType(MemberType t); - virtual void setDefinition(const char *d); + virtual void setDefinition(const QCString &d); virtual void setFileDef(const FileDef *fd); virtual void setAnchor(); virtual void setProtection(Protection p); virtual void setMemberSpecifiers(uint64 s); virtual void mergeMemberSpecifiers(uint64 s); - virtual void setInitializer(const char *i); - virtual void setBitfields(const char *s); + virtual void setInitializer(const QCString &i); + virtual void setBitfields(const QCString &s); virtual void setMaxInitLines(int lines); virtual void setMemberClass(const ClassDef *cd); virtual void setSectionList(const Definition *container,const MemberList *sl); virtual void setGroupDef(const GroupDef *gd,Grouping::GroupPri_t pri, const QCString &fileName,int startLine,bool hasDocs, MemberDef *member=0); - virtual void setReadAccessor(const char *r); - virtual void setWriteAccessor(const char *w); + virtual void setReadAccessor(const QCString &r); + virtual void setWriteAccessor(const QCString &w); virtual void setTemplateSpecialization(bool b); virtual void makeRelated(); virtual void makeForeign(); virtual void setInheritsDocsFrom(const MemberDef *md); virtual void setTagInfo(const TagInfo *i); - virtual void setArgsString(const char *as); + virtual void setArgsString(const QCString &as); virtual void setReimplements(const MemberDef *md); virtual void insertReimplementedBy(const MemberDef *md); virtual void setRelatedAlso(ClassDef *cd); @@ -267,7 +268,7 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable> virtual void setEnumClassScope(const ClassDef *cd); virtual void setDocumentedEnumValues(bool value); virtual void setAnonymousEnumType(const MemberDef *md); - virtual bool addExample(const char *anchor,const char *name,const char *file); + virtual bool addExample(const QCString &anchor,const QCString &name,const QCString &file); virtual void setPrototype(bool p,const QCString &df,int line, int column); virtual void setExplicitExternal(bool b,const QCString &df,int line,int column); virtual void setDeclFile(const QCString &df,int line,int column); @@ -275,8 +276,8 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable> virtual void moveDeclArgumentList(std::unique_ptr<ArgumentList> al); virtual void setDefinitionTemplateParameterLists(const ArgumentLists &lists); virtual void setTypeConstraints(const ArgumentList &al); - virtual void setType(const char *t); - virtual void setAccessorType(ClassDef *cd,const char *t); + virtual void setType(const QCString &t); + virtual void setAccessorType(ClassDef *cd,const QCString &t); virtual void setNamespace(const NamespaceDef *nd); virtual void setMemberGroup(MemberGroup *grp); virtual void setMemberGroupId(int id); @@ -300,22 +301,23 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable> virtual void copyArgumentNames(const MemberDef *bmd); virtual void setCategory(ClassDef *); virtual void setCategoryRelation(const MemberDef *); - virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE); - virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine); - virtual void setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine); + virtual void setDocumentation(const QCString &d,const QCString &docFile,int docLine,bool stripWhiteSpace=TRUE); + virtual void setBriefDescription(const QCString &b,const QCString &briefFile,int briefLine); + virtual void setInbodyDocumentation(const QCString &d,const QCString &inbodyFile,int inbodyLine); virtual void setHidden(bool b); + virtual void setRequiresClause(const QCString &req); virtual void incrementFlowKeyWordCount(); virtual void writeDeclaration(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, - bool inGroup, const ClassDef *inheritFrom=0,const char *inheritId=0) const; + bool inGroup, const ClassDef *inheritFrom=0,const QCString &inheritId=QCString()) const; virtual void writeDocumentation(const MemberList *ml,int memCount,int memTotal,OutputList &ol, - const char *scopeName,const Definition *container, + const QCString &scopeName,const Definition *container, bool inGroup,bool showEnumValues=FALSE,bool showInline=FALSE) const; virtual void writeMemberDocSimple(OutputList &ol,const Definition *container) const; virtual void writeEnumDeclaration(OutputList &typeDecl, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd) const; - virtual void writeTagFile(std::ostream &) const; + virtual void writeTagFile(TextStream &) const; virtual void warnIfUndocumented() const; virtual void warnIfUndocumentedParams() const; virtual void detectUndocumentedParams(bool hasParamCommand,bool hasReturnCommand) const; @@ -344,6 +346,8 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable> const QCString &cname) const; void _writeCategoryRelation(OutputList &ol) const; void _writeTagData(const DefType) const; + void _writeTemplatePrefix(OutputList &ol, const Definition *def, + const ArgumentList &al, bool writeReqClause=true) const; static int s_indentLevel; @@ -360,11 +364,11 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable> uchar m_isDestructorCached; // 1 = not cached, 1=FALSE, 2=TRUE }; -MemberDefMutable *createMemberDef(const char *defFileName,int defLine,int defColumn, - const char *type,const char *name,const char *args, - const char *excp,Protection prot,Specifier virt,bool stat, +MemberDefMutable *createMemberDef(const QCString &defFileName,int defLine,int defColumn, + const QCString &type,const QCString &name,const QCString &args, + const QCString &excp,Protection prot,Specifier virt,bool stat, Relationship related,MemberType t,const ArgumentList &tal, - const ArgumentList &al,const char *metaData) + const ArgumentList &al,const QCString &metaData) { return new MemberDefImpl(defFileName,defLine,defColumn,type,name,args,excp,prot,virt, stat,related,t,tal,al,metaData); @@ -397,19 +401,19 @@ class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef> { return getMdAlias()->getReference(); } virtual QCString anchor() const { return getMdAlias()->anchor(); } - virtual const char *declaration() const + virtual QCString declaration() const { return getMdAlias()->declaration(); } - virtual const char *definition() const + virtual QCString definition() const { return getMdAlias()->definition(); } - virtual const char *typeString() const + virtual QCString typeString() const { return getMdAlias()->typeString(); } - virtual const char *argsString() const + virtual QCString argsString() const { return getMdAlias()->argsString(); } - virtual const char *excpString() const + virtual QCString excpString() const { return getMdAlias()->excpString(); } - virtual const char *bitfieldString() const + virtual QCString bitfieldString() const { return getMdAlias()->bitfieldString(); } - virtual const char *extraTypeChars() const + virtual QCString extraTypeChars() const { return getMdAlias()->extraTypeChars(); } virtual const QCString &initializer() const { return getMdAlias()->initializer(); } @@ -429,15 +433,15 @@ class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef> { return getMdAlias()->getNamespaceDef(); } virtual const ClassDef *accessorClass() const { return getMdAlias()->accessorClass(); } - virtual const char *getReadAccessor() const + virtual QCString getReadAccessor() const { return getMdAlias()->getReadAccessor(); } - virtual const char *getWriteAccessor() const + virtual QCString getWriteAccessor() const { return getMdAlias()->getWriteAccessor(); } virtual const GroupDef *getGroupDef() const { return getMdAlias()->getGroupDef(); } virtual Grouping::GroupPri_t getGroupPri() const { return getMdAlias()->getGroupPri(); } - virtual const char *getGroupFileName() const + virtual QCString getGroupFileName() const { return getMdAlias()->getGroupFileName(); } virtual int getGroupStartLine() const { return getMdAlias()->getGroupStartLine(); } @@ -735,6 +739,8 @@ class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef> { return getMdAlias()->getDeclLine(); } virtual int getDeclColumn() const { return getMdAlias()->getDeclColumn(); } + virtual QCString requiresClause() const + { return getMdAlias()->requiresClause(); } virtual void warnIfUndocumented() const {} virtual void warnIfUndocumentedParams() const {} @@ -746,7 +752,7 @@ class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef> virtual void writeDeclaration(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, - bool inGroup, const ClassDef *inheritFrom=0,const char *inheritId=0) const + bool inGroup, const ClassDef *inheritFrom=0,const QCString &inheritId=QCString()) const { getMdAlias()->writeDeclaration(ol,cd,nd,fd,gd,inGroup,inheritFrom,inheritId); } @@ -763,7 +769,7 @@ class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef> MemberDef *createMemberDefAlias(const Definition *newScope,const MemberDef *aliasMd) { MemberDef *amd = new MemberDefAliasImpl(newScope,aliasMd); - //printf("amd: name=%s displayName=%s\n",amd->name().data(),amd->displayName().data()); + //printf("amd: name=%s displayName=%s\n",qPrint(amd->name()),qPrint(amd->displayName())); return amd; } @@ -792,18 +798,18 @@ static QCString addTemplateNames(const QCString &s,const QCString &n,const QCStr uint j=clRealName.length()+i; if (s.length()==j || (s.at(j)!='<' && !isId(s.at(j)))) { // add template names - //printf("Adding %s+%s\n",clRealName.data(),t.data()); + //printf("Adding %s+%s\n",qPrint(clRealName),qPrint(t)); result+=clRealName+t; } else { // template names already present - //printf("Adding %s\n",clRealName.data()); + //printf("Adding %s\n",qPrint(clRealName)); result+=clRealName; } p=i+clRealName.length(); } result+=s.right(s.length()-p); - //printf("addTemplateNames(%s,%s,%s)=%s\n",s.data(),n.data(),t.data(),result.data()); + //printf("addTemplateNames(%s,%s,%s)=%s\n",qPrint(s),qPrint(n),qPrint(t),qPrint(result)); return result; } @@ -844,7 +850,7 @@ static bool writeDefArgumentList(OutputList &ol,const Definition *scope,const Me { const ArgumentList &defArgList=(md->isDocsForDefinition()) ? md->argumentList() : md->declArgumentList(); - //printf("writeDefArgumentList '%s' isDocsForDefinition()=%d\n",md->name().data(),md->isDocsForDefinition()); + //printf("writeDefArgumentList '%s' isDocsForDefinition()=%d\n",qPrint(md->name()),md->isDocsForDefinition()); if (!defArgList.hasParameters() || md->isProperty() || md->isTypedef()) { return FALSE; // member has no function like argument list @@ -877,7 +883,7 @@ static bool writeDefArgumentList(OutputList &ol,const Definition *scope,const Me ol.endMemberDocName(); } ol.popGeneratorState(); - //printf("===> name=%s isDefine=%d\n",md->name().data(),md->isDefine()); + //printf("===> name=%s isDefine=%d\n",qPrint(md->name()),md->isDefine()); QCString cName; if (scope) @@ -888,20 +894,20 @@ static bool writeDefArgumentList(OutputList &ol,const Definition *scope,const Me if (il!=-1 && ir!=-1 && ir>il) { cName=cName.mid(il,ir-il+1); - //printf("1. cName=%s\n",cName.data()); + //printf("1. cName=%s\n",qPrint(cName)); } else if (scope->definitionType()==Definition::TypeClass) { cName=tempArgListToString((toClassDef(scope))->templateArguments(), scope->getLanguage()); - //printf("2. cName=%s\n",cName.data()); + //printf("2. cName=%s\n",qPrint(cName)); } else // no template specifier { cName.resize(0); } } - //printf("~~~ %s cName=%s\n",md->name().data(),cName.data()); + //printf("~~~ %s cName=%s\n",qPrint(md->name()),qPrint(cName)); bool first=TRUE; bool paramTypeStarted=FALSE; @@ -912,7 +918,7 @@ static bool writeDefArgumentList(OutputList &ol,const Definition *scope,const Me Argument a = *alIt; if (isDefine || first) { - ol.startParameterType(first,0); + ol.startParameterType(first,QCString()); paramTypeStarted=TRUE; if (isDefine) { @@ -991,7 +997,7 @@ static bool writeDefArgumentList(OutputList &ol,const Definition *scope,const Me QCString key; if (md->isObjCMethod() && a.attrib.length()>=2) { - //printf("Found parameter keyword %s\n",a.attrib.data()); + //printf("Found parameter keyword %s\n",a.qPrint(attrib)); // strip [ and ] key=a.attrib.mid(1,a.attrib.length()-2); if (key!=",") key+=":"; // for normal keywords add colon @@ -1023,7 +1029,7 @@ static bool writeDefArgumentList(OutputList &ol,const Definition *scope,const Me if (first) ol.startParameterName(defArgList.size()<2); ol.endParameterName(TRUE,defArgList.size()<2,!md->isObjCMethod()); ol.popGeneratorState(); - if (md->extraTypeChars()) + if (!md->extraTypeChars().isEmpty()) { ol.docify(md->extraTypeChars()); } @@ -1061,7 +1067,7 @@ static void writeExceptionListImpl( OutputList &ol, const ClassDef *cd, const MemberDef *md, QCString const& exception) { // this is ordinary exception spec - there must be a '(' - //printf("exception='%s'\n",exception.data()); + //printf("exception='%s'\n",qPrint(exception)); int index = exception.find('('); if (index!=-1) { @@ -1072,7 +1078,7 @@ static void writeExceptionListImpl( ++comma; // include comma linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md, exception.mid(index,comma-index)); - ol.exceptionEntry(0,false); + ol.exceptionEntry(QCString(),false); index=comma; comma = exception.find(',', index); } @@ -1081,7 +1087,7 @@ static void writeExceptionListImpl( { QCString type=removeRedundantWhiteSpace(exception.mid(index,close-index)); linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md,type); - ol.exceptionEntry(0,true); + ol.exceptionEntry(QCString(),true); } else { @@ -1119,26 +1125,6 @@ static void writeExceptionList(OutputList &ol, const ClassDef *cd, const MemberD } } -static void writeTemplatePrefix(OutputList &ol,const ArgumentList &al) -{ - ol.docify("template<"); - for (auto it = al.begin(); it!=al.end();) - { - Argument a = *it; - ol.docify(a.type); - ol.docify(" "); - ol.docify(a.name); - if (a.defval.length()!=0) - { - ol.docify(" = "); - ol.docify(a.defval); - } - ++it; - if (it!=al.end()) ol.docify(", "); - } - ol.docify("> "); -} - //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -1148,10 +1134,10 @@ class MemberDefImpl::IMPL public: IMPL(); ~IMPL(); - void init(Definition *def,const char *t,const char *a,const char *e, + void init(Definition *def,const QCString &t,const QCString &a,const QCString &e, Protection p,Specifier v,bool s,Relationship r, MemberType mt,const ArgumentList &tal, - const ArgumentList &al,const char *meta + const ArgumentList &al,const QCString &meta ); const ClassDef *classDef = 0; // member of or related to @@ -1189,6 +1175,7 @@ class MemberDefImpl::IMPL QCString initializer; // initializer QCString extraTypeChars; // extra type info found after the argument list QCString enumBaseType; // base type of the enum (C++11) + QCString requiresClause; // requires clause (C++20) int initLines = 0; // number of lines in the initializer uint64 memSpec = 0; // The specifiers present for this member @@ -1280,10 +1267,10 @@ MemberDefImpl::IMPL::~IMPL() } void MemberDefImpl::IMPL::init(Definition *d, - const char *t,const char *a,const char *e, + const QCString &t,const QCString &a,const QCString &e, Protection p,Specifier v,bool s,Relationship r, MemberType mt,const ArgumentList &tal, - const ArgumentList &al,const char *meta + const ArgumentList &al,const QCString &meta ) { classDef=0; @@ -1342,8 +1329,8 @@ void MemberDefImpl::IMPL::init(Definition *d, if (!args.isEmpty()) { declArgList = *stringToArgumentList(d->getLanguage(),args,&extraTypeChars); - //printf("setDeclArgList %s to %s const=%d\n",args.data(), - // argListToString(declArgList).data(),declArgList->constSpecifier); + //printf("setDeclArgList %s to %s const=%d\n",qPrint(args), + // qPrint(argListToString(declArgList)),declArgList->constSpecifier); } metaData = meta; templateMaster = 0; @@ -1387,10 +1374,10 @@ void MemberDefImpl::IMPL::init(Definition *d, * \param meta Slice metadata. */ -MemberDefImpl::MemberDefImpl(const char *df,int dl,int dc, - const char *t,const char *na,const char *a,const char *e, +MemberDefImpl::MemberDefImpl(const QCString &df,int dl,int dc, + const QCString &t,const QCString &na,const QCString &a,const QCString &e, Protection p,Specifier v,bool s,Relationship r,MemberType mt, - const ArgumentList &tal,const ArgumentList &al,const char *meta + const ArgumentList &tal,const ArgumentList &al,const QCString &meta ) : DefinitionMixin(df,dl,dc,removeRedundantWhiteSpace(na)) { //printf("MemberDefImpl::MemberDef(%s)\n",na); @@ -1506,9 +1493,9 @@ void MemberDefImpl::insertEnumField(const MemberDef *md) m_impl->enumFields.push_back(md); } -bool MemberDefImpl::addExample(const char *anchor,const char *nameStr, const char *file) +bool MemberDefImpl::addExample(const QCString &anchor,const QCString &nameStr, const QCString &file) { - //printf("%s::addExample(%s,%s,%s)\n",name().data(),anchor,nameStr,file); + //printf("%s::addExample(%s,%s,%s)\n",qPrint(name()),anchor,nameStr,file); return m_impl->examples.inSort(Example(anchor,nameStr,file)); } @@ -1524,7 +1511,7 @@ QCString MemberDefImpl::getOutputFileBase() const QCString baseName; //printf("Member: %s: templateMaster=%p group=%p classDef=%p nspace=%p fileDef=%p\n", - // name().data(),m_impl->templateMaster,m_impl->group,m_impl->classDef, + // qPrint(name()),m_impl->templateMaster,m_impl->group,m_impl->classDef, // m_impl->nspace,m_impl->fileDef); const NamespaceDef *nspace = getNamespaceDef(); const FileDef *fileDef = getFileDef(); @@ -1643,7 +1630,7 @@ void MemberDefImpl::_computeLinkableInProject() static bool extractStatic = Config_getBool(EXTRACT_STATIC); static bool extractPrivateVirtual = Config_getBool(EXTRACT_PRIV_VIRTUAL); m_isLinkableCached = 2; // linkable - //printf("MemberDefImpl::isLinkableInProject(name=%s)\n",name().data()); + //printf("MemberDefImpl::isLinkableInProject(name=%s)\n",qPrint(name())); if (isHidden()) { //printf("is hidden\n"); @@ -1716,19 +1703,19 @@ void MemberDefImpl::_computeLinkableInProject() return; // linkable! } -void MemberDefImpl::setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace) +void MemberDefImpl::setDocumentation(const QCString &d,const QCString &docFile,int docLine,bool stripWhiteSpace) { DefinitionMixin::setDocumentation(d,docFile,docLine,stripWhiteSpace); m_isLinkableCached = 0; } -void MemberDefImpl::setBriefDescription(const char *b,const char *briefFile,int briefLine) +void MemberDefImpl::setBriefDescription(const QCString &b,const QCString &briefFile,int briefLine) { DefinitionMixin::setBriefDescription(b,briefFile,briefLine); m_isLinkableCached = 0; } -void MemberDefImpl::setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine) +void MemberDefImpl::setInbodyDocumentation(const QCString &d,const QCString &inbodyFile,int inbodyLine) { DefinitionMixin::setInbodyDocumentation(d,inbodyFile,inbodyLine); m_isLinkableCached = 0; @@ -1827,8 +1814,8 @@ void MemberDefImpl::writeLink(OutputList &ol, */ ClassDef *MemberDefImpl::getClassDefOfAnonymousType() const { - //printf("%s:getClassDefOfAnonymousType() cache=%s\n",name().data(), - // m_impl->cachedAnonymousType?m_impl->cachedAnonymousType->name().data():"<empty>"); + //printf("%s:getClassDefOfAnonymousType() cache=%s\n",qPrint(name()), + // m_impl->cachedAnonymousType?qPrint(m_impl->cachedAnonymousType->name()):"<empty>"); if (m_impl->cachedAnonymousType) return m_impl->cachedAnonymousType; QCString cname; @@ -1888,9 +1875,9 @@ bool MemberDefImpl::isBriefSectionVisible() const static bool hideFriendCompounds = Config_getBool(HIDE_FRIEND_COMPOUNDS); //printf("Member %s grpId=%d docs=%s file=%s args=%s\n", - // name().data(), + // qPrint(name()), // 0,"", //grpId,grpId==-1?"<none>":Doxygen::memberDocDict[grpId]->data(), - // "", //getFileDef()->name().data(), + // "", //qPrint(getFileDef()->name()), // argsString()); auto it = Doxygen::memberGroupInfoMap.find(m_impl->grpId); @@ -1898,7 +1885,7 @@ bool MemberDefImpl::isBriefSectionVisible() const if (it!=Doxygen::memberGroupInfoMap.end()) { auto &info = it->second; - //printf("name=%s m_impl->grpId=%d info=%p\n",name().data(),m_impl->grpId,info); + //printf("name=%s m_impl->grpId=%d info=%p\n",qPrint(name()),m_impl->grpId,info); //QCString *pMemGrp = Doxygen::memberDocDict[grpId]; hasDocs = hasDocs || // part of a documented member group @@ -2008,11 +1995,51 @@ QCString MemberDefImpl::getDeclType() const return ltype; } +void MemberDefImpl::_writeTemplatePrefix(OutputList &ol, const Definition *def, + const ArgumentList &al, bool writeReqClause) const +{ + ol.docify("template<"); + for (auto it = al.begin(); it!=al.end();) + { + Argument a = *it; + linkifyText(TextGeneratorOLImpl(ol), // out + def, // scope + getFileDef(), // fileScope + this, // self + a.type, // text + FALSE // autoBreak + ); + ol.docify(" "); + ol.docify(a.name); + if (a.defval.length()!=0) + { + ol.docify(" = "); + ol.docify(a.defval); + } + ++it; + if (it!=al.end()) ol.docify(", "); + } + ol.docify("> "); + if (writeReqClause && !m_impl->requiresClause.isEmpty()) + { + ol.lineBreak(); + ol.docify("requires "); + linkifyText(TextGeneratorOLImpl(ol), // out + def, // scope + getFileDef(), // fileScope + this, // self + m_impl->requiresClause, // text + FALSE // autoBreak + ); + } +} + + void MemberDefImpl::writeDeclaration(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, - bool inGroup, const ClassDef *inheritedFrom,const char *inheritId) const + bool inGroup, const ClassDef *inheritedFrom,const QCString &inheritId) const { - //printf("%s MemberDefImpl::writeDeclaration() inGroup=%d\n",qualifiedName().data(),inGroup); + //printf("%s MemberDefImpl::writeDeclaration() inGroup=%d\n",qPrint(qualifiedName()),inGroup); // hide enum value, since they appear already as part of the enum, unless they // are explicitly grouped. @@ -2042,7 +2069,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, // start a new member declaration bool isAnonType = annoClassDef || m_impl->annMemb || m_impl->annEnumType; - ///printf("startMemberItem for %s\n",name().data()); + ///printf("startMemberItem for %s\n",qPrint(name())); ol.startMemberItem(anchor(), isAnonType ? 1 : !m_impl->tArgList.empty() ? 3 : 0, inheritId @@ -2086,10 +2113,11 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, if (m_impl->tArgList.hasParameters() && getLanguage()==SrcLangExt_Cpp) { if (!isAnonType) ol.startMemberTemplateParams(); - writeTemplatePrefix(ol,m_impl->tArgList); + _writeTemplatePrefix(ol,d,m_impl->tArgList); if (!isAnonType) ol.endMemberTemplateParams(anchor(),inheritId); } + // *** write type QCString ltype(m_impl->type); if (isTypedef() && getLanguage() != SrcLangExt_Slice) @@ -2111,7 +2139,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, int i = (int)match.position(); int l = (int)match.length(); //printf("annoClassDef=%p annMemb=%p scopeName='%s' anonymous='%s'\n", - // annoClassDef,annMemb,cname.data(),ltype.mid(i,l).data()); + // annoClassDef,annMemb,qPrint(cname),qPrint(ltype.mid(i,l))); if (annoClassDef) // type is an anonymous compound { @@ -2127,7 +2155,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, ol.writeNonBreakableSpace(3); } QCString varName=ltype.right(ltype.length()-ir).stripWhiteSpace(); - //printf(">>>>>> ltype='%s' varName='%s'\n",ltype.data(),varName.data()); + //printf(">>>>>> ltype='%s' varName='%s'\n",qPrint(ltype),qPrint(varName)); ol.docify("}"); if (varName.isEmpty() && isAnonymous()) { @@ -2217,7 +2245,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, static bool extractPrivateVirtual = Config_getBool(EXTRACT_PRIV_VIRTUAL); static bool extractStatic = Config_getBool(EXTRACT_STATIC); MemberDefMutable *annMemb = toMemberDefMutable(m_impl->annMemb); - //printf("Member name=`%s gd=%p md->groupDef=%p inGroup=%d isLinkable()=%d hasDocumentation=%d\n",name().data(),gd,getGroupDef(),inGroup,isLinkable(),hasDocumentation()); + //printf("Member name=`%s gd=%p md->groupDef=%p inGroup=%d isLinkable()=%d hasDocumentation=%d\n",qPrint(name()),gd,getGroupDef(),inGroup,isLinkable(),hasDocumentation()); if (!name().isEmpty() && // name valid (hasDocumentation() || isReference()) && // has docs !(m_impl->prot==Private && !extractPrivate && (m_impl->virt==Normal || !extractPrivateVirtual) && m_impl->mtype!=MemberType_Friend) && // hidden due to protection @@ -2237,7 +2265,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, } else { - //printf("writeLink %s->%d\n",name.data(),hasDocumentation()); + //printf("writeLink %s->%d\n",qPrint(name),hasDocumentation()); const ClassDef *rcd = cd; if (isReference() && getClassDef()) rcd = getClassDef(); writeLink(ol,rcd,nd,fd,gd); @@ -2285,7 +2313,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, } // *** write arguments - if (argsString() && !isObjCMethod()) + if (!argsString().isEmpty() && !isObjCMethod()) { if (!isDefine() && !isTypedef()) ol.writeString(" "); linkifyText(TextGeneratorOLImpl(ol), // out @@ -2293,9 +2321,9 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, getBodyDef(), // fileScope this, // self isDefine() ? - (const char*)substitute(argsString(),",",", ") : + substitute(argsString(),",",", ") : isTypedef() ? - (const char*)substitute(argsString(),")(",") (") : + substitute(argsString(),")(",") (") : argsString(), // text m_impl->annMemb, // autoBreak TRUE, // external @@ -2304,7 +2332,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, ); } // *** write exceptions - if (excpString()) + if (!excpString().isEmpty()) { ol.writeString(" "); ol.docify(excpString()); @@ -2409,7 +2437,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, } //printf("endMember %s annoClassDef=%p annEnumType=%p\n", - // name().data(),annoClassDef,annEnumType); + // qPrint(name()),annoClassDef,annEnumType); ol.endMemberItem(); if (endAnonScopeNeeded) { @@ -2424,7 +2452,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, { DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(), getOuterScope()?getOuterScope():d,this,briefDescription(),TRUE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); if (rootNode && !rootNode->isEmpty()) { @@ -2536,7 +2564,7 @@ bool MemberDefImpl::isDetailedSectionVisible(bool inGroup,bool inFile) const !isReference(); bool result = visible || simpleFilter; //printf("%s::isDetailedSectionVisible: %d groupFilter=%d fileFilter=%d\n", - // name().data(),result,groupFilter,fileFilter); + // qPrint(name()),result,groupFilter,fileFilter); return result; } @@ -2750,7 +2778,7 @@ void MemberDefImpl::_writeReimplements(OutputList &ol) const else { ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(), - 0,bcd->displayName()); + QCString(),bcd->displayName()); if (bcd->isLinkableInProject()/* && !Config_getBool(PDF_HYPERLINKS)*/ ) { writePageRef(ol,bcd->getOutputFileBase(),bcd->anchor()); @@ -2843,11 +2871,11 @@ void MemberDefImpl::_writeCategoryRelation(OutputList &ol) const if (getClassDef()) // this should be a member of a class/category { //printf("%s: category %s relation %s class=%s categoryOf=%s\n", - // name().data(), - // m_impl->category ? m_impl->category->name().data() : "<none>", - // m_impl->categoryRelation ? m_impl->categoryRelation->name().data() : "<none>", - // m_impl->classDef->name().data(), - // m_impl->classDef->categoryOf() ? m_impl->classDef->categoryOf()->name().data() : "<none>" + // qPrint(name()), + // m_impl->category ? qPrint(m_impl->category->name()) : "<none>", + // m_impl->categoryRelation ? qPrint(m_impl->categoryRelation->name()) : "<none>", + // qPrint(m_impl->classDef->name()), + // m_impl->classDef->categoryOf() ? qPrint(m_impl->classDef->categoryOf()->name()) : "<none>" // ); QCString text; QCString ref; @@ -2920,7 +2948,7 @@ void MemberDefImpl::_writeEnumValues(OutputList &ol,const Definition *container, if (isEnumerate()) { bool first=TRUE; - //printf("** %s: enum values=%zu\n",name().data(),enumFieldList().size()); + //printf("** %s: enum values=%zu\n",qPrint(name()),enumFieldList().size()); for (const auto &fmd : enumFieldList()) { //printf("Enum %p: isLinkable()=%d\n",fmd,fmd->isLinkable()); @@ -2956,7 +2984,7 @@ void MemberDefImpl::_writeEnumValues(OutputList &ol,const Definition *container, ol.generateDoc(fmd->briefFile(),fmd->briefLine(), getOuterScope()?getOuterScope():container, fmd,fmd->briefDescription(),TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } // FIXME:PARA //if (!fmd->briefDescription().isEmpty() && @@ -2969,7 +2997,7 @@ void MemberDefImpl::_writeEnumValues(OutputList &ol,const Definition *container, ol.generateDoc(fmd->docFile(),fmd->docLine(), getOuterScope()?getOuterScope():container, fmd,fmd->documentation()+"\n",TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } ol.endDescTableData(); ol.endDescTableRow(); @@ -3043,7 +3071,7 @@ QCString MemberDefImpl::displayDefinition() const ldef=ldef.left(dp+1); } int l=ldef.length(); - //printf("start >%s<\n",ldef.data()); + //printf("start >%s<\n",qPrint(ldef)); int i=l-1; while (i>=0 && (isId(ldef.at(i)) || ldef.at(i)==':')) i--; while (i>=0 && isspace((uchar)ldef.at(i))) i--; @@ -3053,7 +3081,7 @@ QCString MemberDefImpl::displayDefinition() const QCString tmp("("+ldef.left(i+1)+")"+ldef.mid(i+1)); ldef=tmp; } - //printf("end >%s< i=%d\n",ldef.data(),i); + //printf("end >%s< i=%d\n",qPrint(ldef),i); if (isStatic()) ldef.prepend("+ "); else ldef.prepend("- "); } SrcLangExt lang = getLanguage(); @@ -3108,7 +3136,7 @@ void MemberDefImpl::_writeGroupInclude(OutputList &ol,bool inGroup) const void MemberDefImpl::writeDocumentation(const MemberList *ml, int memCount,int memTotal, OutputList &ol, - const char *scName, + const QCString &scName, const Definition *container, bool inGroup, bool showEnumValues, @@ -3119,13 +3147,13 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, bool hasParameterList = FALSE; //printf("MemberDefImpl::writeDocumentation(): name='%s' hasDocs='%d' containerType=%d inGroup=%d sectionLinkable=%d\n", - // name().data(),hasDocs,container->definitionType(),inGroup,isDetailedSectionLinkable()); + // qPrint(name()),hasDocs,container->definitionType(),inGroup,isDetailedSectionLinkable()); //if ( !hasDocs ) return; //if (isEnumValue() && !showEnumValues) return; SrcLangExt lang = getLanguage(); - //printf("member=%s lang=%d\n",name().data(),lang); + //printf("member=%s lang=%d\n",qPrint(name()),lang); bool optVhdl = lang==SrcLangExt_VHDL; QCString sep = getLanguageSpecificSeparator(lang,TRUE); @@ -3160,7 +3188,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, QCString ldef = definition(); QCString title = name(); - //printf("member '%s' def='%s'\n",name().data(),ldef.data()); + //printf("member '%s' def='%s'\n",qPrint(name()),qPrint(ldef)); if (isEnumerate()) { if (title.at(0)=='@') @@ -3234,7 +3262,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, } if (!found) // anonymous compound { - //printf("Anonymous compound '%s'\n",cname.data()); + //printf("Anonymous compound '%s'\n",qPrint(cname)); ol.startDoxyAnchor(cfname,cname,memAnchor,doxyName,doxyArgs); ol.startMemberDoc(ciname,name(),memAnchor,"",memCount,memTotal,showInline); // search for the last anonymous compound name in the definition @@ -3280,7 +3308,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, { if (!first) ol.docify(" "); ol.startMemberDocPrefixItem(); - writeTemplatePrefix(ol,tal); + _writeTemplatePrefix(ol,scopedContainer,tal); ol.endMemberDocPrefixItem(); } } @@ -3296,7 +3324,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, { if (!first) ol.docify(" "); ol.startMemberDocPrefixItem(); - writeTemplatePrefix(ol,tal); + _writeTemplatePrefix(ol,scopedContainer,tal,false); ol.endMemberDocPrefixItem(); } } @@ -3304,7 +3332,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, if (m_impl->tArgList.hasParameters() && lang==SrcLangExt_Cpp) // function template prefix { ol.startMemberDocPrefixItem(); - writeTemplatePrefix(ol,m_impl->tArgList); + _writeTemplatePrefix(ol,scopedContainer,m_impl->tArgList); ol.endMemberDocPrefixItem(); } } @@ -3344,7 +3372,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, ldef=ldef.left(dp+1); } int dl=ldef.length(); - //printf("start >%s<\n",ldef.data()); + //printf("start >%s<\n",qPrint(ldef)); int i=dl-1; while (i>=0 && (isId(ldef.at(i)) || ldef.at(i)==':')) i--; while (i>=0 && isspace((uchar)ldef.at(i))) i--; @@ -3354,7 +3382,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, QCString tmp("("+ldef.left(i+1)+")"+ldef.mid(i+1)); ldef=tmp; } - //printf("end >%s< i=%d\n",ldef.data(),i); + //printf("end >%s< i=%d\n",qPrint(ldef),i); if (isStatic()) ldef.prepend("+ "); else ldef.prepend("- "); } @@ -3405,7 +3433,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, linkifyText(TextGeneratorOLImpl(ol),scopedContainer,getBodyDef(),this,m_impl->initializer); } } - if (excpString()) // add exception list + if (!excpString().isEmpty()) // add exception list { writeExceptionList(ol,cd,this); hasParameterList=true; // call endParameterList below @@ -3474,7 +3502,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, // ) ) { - //printf("md=%s initLines=%d init='%s'\n",name().data(),initLines,init.data()); + //printf("md=%s initLines=%d init='%s'\n",qPrint(name()),initLines,qPrint(init)); ol.startBold(); if (m_impl->mtype==MemberType_Define) ol.parseText(theTranslator->trDefineValue()); @@ -3491,7 +3519,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, auto intf = Doxygen::parserManager->getCodeParser(langCorrected); intf->resetCodeParserState(); ol.startCodeFragment("DoxyCode"); - intf->parseCode(ol,scopeName,m_impl->initializer,srcLangExt,FALSE,0,const_cast<FileDef*>(getFileDef()), + intf->parseCode(ol,scopeName,m_impl->initializer,srcLangExt,FALSE,QCString(),const_cast<FileDef*>(getFileDef()), -1,-1,TRUE,this,FALSE,this); ol.endCodeFragment("DoxyCode"); } @@ -3517,7 +3545,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, ol.generateDoc(briefFile(),briefLine(), scopedContainer,this, brief,FALSE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endParagraph(); } @@ -3534,7 +3562,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, else { ol.generateDoc(docFile(),docLine(),scopedContainer,this,detailed+"\n",TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } if (!inbodyDocumentation().isEmpty()) @@ -3542,7 +3570,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, ol.generateDoc(inbodyFile(),inbodyLine(), scopedContainer,this, inbodyDocumentation()+"\n",TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } } else if (!brief.isEmpty() && (Config_getBool(REPEAT_BRIEF) || @@ -3551,7 +3579,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, if (!inbodyDocumentation().isEmpty()) { ol.generateDoc(inbodyFile(),inbodyLine(),scopedContainer,this,inbodyDocumentation()+"\n",TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } } @@ -3579,7 +3607,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, paramDocs, // docStr TRUE, // indexWords FALSE, // isExample - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT) + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT) ); } @@ -3631,7 +3659,7 @@ static QCString simplifyTypeForTable(const QCString &s) { ts = match[1].str(); // take the identifier after the last :: } - //printf("simplifyTypeForTable(%s)->%s\n",s.data(),ts.data()); + //printf("simplifyTypeForTable(%s)->%s\n",qPrint(s),qPrint(ts)); return ts; } @@ -3662,7 +3690,7 @@ void MemberDefImpl::writeMemberDocSimple(OutputList &ol, const Definition *conta } ClassDef *cd = m_impl->accessorClass; - //printf("===> %s::anonymous: %s\n",name().data(),cd?cd->name().data():"<none>"); + //printf("===> %s::anonymous: %s\n",qPrint(name()),cd?qPrint(cd->name()):"<none>"); if (container && container->definitionType()==Definition::TypeClass && !(toClassDef(container))->isJavaEnum()) @@ -3707,7 +3735,7 @@ void MemberDefImpl::writeMemberDocSimple(OutputList &ol, const Definition *conta ol.startInlineMemberName(); ol.docify(doxyName); - if (isVariable() && argsString() && !isObjCMethod()) + if (isVariable() && !argsString().isEmpty() && !isObjCMethod()) { linkifyText(TextGeneratorOLImpl(ol),getOuterScope(),getBodyDef(),this,argsString()); } @@ -3728,7 +3756,7 @@ void MemberDefImpl::writeMemberDocSimple(OutputList &ol, const Definition *conta ol.generateDoc(briefFile(),briefLine(), getOuterScope()?getOuterScope():container,this, brief,FALSE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } /* write detailed description */ @@ -3737,7 +3765,7 @@ void MemberDefImpl::writeMemberDocSimple(OutputList &ol, const Definition *conta ol.generateDoc(docFile(),docLine(), getOuterScope()?getOuterScope():container,this, detailed+"\n",FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } @@ -3794,7 +3822,7 @@ void MemberDefImpl::warnIfUndocumented() const static bool extractAll = Config_getBool(EXTRACT_ALL); //printf("%s:warnIfUndoc: hasUserDocs=%d isFriendClass=%d protection=%d isRef=%d isDel=%d\n", - // name().data(), + // qPrint(name()), // hasUserDocumentation(),isFriendClass(),protectionLevelVisible(m_impl->prot),isReference(),isDeleted()); if ((!hasUserDocumentation() && !extractAll) && !isFriendClass() && @@ -3811,7 +3839,7 @@ void MemberDefImpl::warnIfUndocumented() const warnIfUndocumentedParams(); } } -static QCString stripTrailingReturn(const QCString trailRet) +static QCString stripTrailingReturn(const QCString &trailRet) { QCString ret = trailRet; @@ -3845,7 +3873,7 @@ void MemberDefImpl::detectUndocumentedParams(bool hasParamCommand,bool hasReturn if (!m_impl->hasDocumentedParams && hasParamCommand) { - //printf("%s:hasDocumentedParams=TRUE;\n",name().data()); + //printf("%s:hasDocumentedParams=TRUE;\n",qPrint(name())); m_impl->hasDocumentedParams = TRUE; } else if (!m_impl->hasDocumentedParams) @@ -3868,7 +3896,7 @@ void MemberDefImpl::detectUndocumentedParams(bool hasParamCommand,bool hasReturn allDoc = !a.docs.isEmpty(); } //printf("a->type=%s a->name=%s doc=%s\n", - // a->type.data(),a->name.data(),a->docs.data()); + // qPrint(a->type),qPrint(a->name),qPrint(a->docs)); } if (!allDoc && declAl.empty()) // try declaration arguments as well { @@ -3882,19 +3910,19 @@ void MemberDefImpl::detectUndocumentedParams(bool hasParamCommand,bool hasReturn { allDoc = !a.docs.isEmpty(); } - //printf("a->name=%s doc=%s\n",a->name.data(),a->docs.data()); + //printf("a->name=%s doc=%s\n",qPrint(a->name),qPrint(a->docs)); } } } if (allDoc) { - //printf("%s:hasDocumentedParams=TRUE;\n",name().data()); + //printf("%s:hasDocumentedParams=TRUE;\n",qPrint(name())); m_impl->hasDocumentedParams = TRUE; } } //printf("Member %s hasDocumentedReturnType=%d hasReturnCommand=%d\n", - // name().data(),m_impl->hasDocumentedReturnType,hasReturnCommand); + // qPrint(name()),m_impl->hasDocumentedReturnType,hasReturnCommand); if (!m_impl->hasDocumentedReturnType && // docs not yet found hasReturnCommand) { @@ -3911,7 +3939,7 @@ void MemberDefImpl::detectUndocumentedParams(bool hasParamCommand,bool hasReturn ) { warn_doc_error(getDefFileName(),getDefLine(),"documented empty return type of %s", - qualifiedName().data()); + qPrint(qualifiedName())); } else if ( // see if return needs to documented m_impl->hasDocumentedReturnType || @@ -4046,20 +4074,24 @@ void MemberDefImpl::setAnchor() buf[19]='\0'; memAnchor.prepend(buf); } + if (!m_impl->requiresClause.isEmpty()) + { + memAnchor+=" "+m_impl->requiresClause; + } // convert to md5 hash uchar md5_sig[16]; - QCString sigStr(33); + char sigStr[33]; MD5Buffer((const unsigned char *)memAnchor.data(),memAnchor.length(),md5_sig); - MD5SigToString(md5_sig,sigStr.rawData(),33); - m_impl->anc = "a"+sigStr; + MD5SigToString(md5_sig,sigStr); + m_impl->anc = QCString("a")+sigStr; } void MemberDefImpl::setGroupDef(const GroupDef *gd,Grouping::GroupPri_t pri, const QCString &fileName,int startLine, bool hasDocs,MemberDef *member) { - //printf("%s MemberDefImpl::setGroupDef(%s)\n",name().data(),gd->name().data()); + //printf("%s MemberDefImpl::setGroupDef(%s)\n",qPrint(name()),qPrint(gd->name())); m_impl->group=gd; m_impl->grouppri=pri; m_impl->groupFileName=fileName; @@ -4101,36 +4133,36 @@ void MemberDefImpl::setNamespace(const NamespaceDef *nd) MemberDefMutable *MemberDefImpl::createTemplateInstanceMember( const ArgumentList &formalArgs,const std::unique_ptr<ArgumentList> &actualArgs) const { - //printf(" Member %s %s %s\n",typeString(),name().data(),argsString()); + //printf(" Member %s %s %s\n",typeString(),qPrint(name()),argsString()); std::unique_ptr<ArgumentList> actualArgList = std::make_unique<ArgumentList>(m_impl->defArgList); if (!m_impl->defArgList.empty()) { // replace formal arguments with actuals for (Argument &arg : *actualArgList) { - arg.type = substituteTemplateArgumentsInString(arg.type.str(),formalArgs,actualArgs); + arg.type = substituteTemplateArgumentsInString(arg.type,formalArgs,actualArgs); } actualArgList->setTrailingReturnType( - substituteTemplateArgumentsInString(actualArgList->trailingReturnType().str(),formalArgs,actualArgs)); + substituteTemplateArgumentsInString(actualArgList->trailingReturnType(),formalArgs,actualArgs)); } QCString methodName=name(); if (methodName.left(9)=="operator ") // conversion operator { - methodName=substituteTemplateArgumentsInString(methodName.str(),formalArgs,actualArgs); + methodName=substituteTemplateArgumentsInString(methodName,formalArgs,actualArgs); } MemberDefMutable *imd = createMemberDef( getDefFileName(),getDefLine(),getDefColumn(), - substituteTemplateArgumentsInString(m_impl->type.str(),formalArgs,actualArgs), + substituteTemplateArgumentsInString(m_impl->type,formalArgs,actualArgs), methodName, - substituteTemplateArgumentsInString(m_impl->args.str(),formalArgs,actualArgs), + substituteTemplateArgumentsInString(m_impl->args,formalArgs,actualArgs), m_impl->exception, m_impl->prot, m_impl->virt, m_impl->stat, m_impl->related, m_impl->mtype, ArgumentList(), ArgumentList(), "" ); imd->moveArgumentList(std::move(actualArgList)); - imd->setDefinition(substituteTemplateArgumentsInString(m_impl->def.str(),formalArgs,actualArgs)); + imd->setDefinition(substituteTemplateArgumentsInString(m_impl->def,formalArgs,actualArgs)); imd->setBodyDef(getBodyDef()); imd->setBodySegment(getDefLine(),getStartBodyLine(),getEndBodyLine()); //imd->setBodyMember(this); @@ -4143,7 +4175,7 @@ MemberDefMutable *MemberDefImpl::createTemplateInstanceMember( bool MemberDefImpl::hasOneLineInitializer() const { //printf("%s: init=%s, initLines=%d maxInitLines=%d userInitLines=%d\n", - // name().data(),m_impl->initializer.data(),m_impl->initLines, + // qPrint(name()),qPrint(m_impl->initializer),m_impl->initLines, // m_impl->maxInitLines,m_impl->userInitLines); return !m_impl->initializer.isEmpty() && m_impl->initLines==0 && // one line initializer ((m_impl->maxInitLines>0 && m_impl->userInitLines==-1) || m_impl->userInitLines>0); // enabled by default or explicitly @@ -4159,7 +4191,7 @@ bool MemberDefImpl::hasMultiLineInitializer() const ); } -void MemberDefImpl::setInitializer(const char *initializer) +void MemberDefImpl::setInitializer(const QCString &initializer) { m_impl->initializer=initializer; int l=m_impl->initializer.length(); @@ -4167,7 +4199,7 @@ void MemberDefImpl::setInitializer(const char *initializer) while (p>=0 && isspace((uchar)m_impl->initializer.at(p))) p--; m_impl->initializer=m_impl->initializer.left(p+1); m_impl->initLines=m_impl->initializer.contains('\n'); - //printf("%s::setInitializer(%s)\n",name().data(),m_impl->initializer.data()); + //printf("%s::setInitializer(%s)\n",qPrint(name()),qPrint(m_impl->initializer)); } void MemberDefImpl::addListReference(Definition *) @@ -4234,7 +4266,7 @@ const MemberList *MemberDefImpl::getSectionList(const Definition *container) con void MemberDefImpl::setSectionList(const Definition *container,const MemberList *sl) { - //printf("MemberDefImpl::setSectionList(%s,%p) name=%s\n",d->name().data(),sl,name().data()); + //printf("MemberDefImpl::setSectionList(%s,%p) name=%s\n",qPrint(d->name()),sl,qPrint(name())); m_impl->sectionMap.insert(std::make_pair(container,sl)); } @@ -4258,7 +4290,7 @@ Specifier MemberDefImpl::virtualness(int count) const return v; } -void MemberDefImpl::writeTagFile(std::ostream &tagFile) const +void MemberDefImpl::writeTagFile(TextStream &tagFile) const { if (!isLinkableInProject()) return; tagFile << " <member kind=\""; @@ -4562,12 +4594,12 @@ void MemberDefImpl::setTypeConstraints(const ArgumentList &al) m_impl->typeConstraints = al; } -void MemberDefImpl::setType(const char *t) +void MemberDefImpl::setType(const QCString &t) { m_impl->type = t; } -void MemberDefImpl::setAccessorType(ClassDef *cd,const char *t) +void MemberDefImpl::setAccessorType(ClassDef *cd,const QCString &t) { m_impl->accessorClass = cd; m_impl->accessorType = t; @@ -4619,8 +4651,8 @@ bool MemberDefImpl::protectionVisible() const #endif #if 0 -void MemberDefImpl::setInbodyDocumentation(const char *docs, - const char *docFile,int docLine) +void MemberDefImpl::setInbodyDocumentation(const QCString &docs, + const QCString &docFile,int docLine) { m_impl->inbodyDocs = docs; m_impl->inbodyDocs = m_impl->inbodyDocs.stripWhiteSpace(); @@ -4669,7 +4701,7 @@ void MemberDefImpl::setTagInfo(const TagInfo *ti) { if (ti) { - //printf("%s: Setting tag name=%s anchor=%s\n",name().data(),ti->tagName.data(),ti->anchor.data()); + //printf("%s: Setting tag name=%s anchor=%s\n",qPrint(name()),qPrint(ti->tagName),qPrint(ti->anchor)); m_impl->anc=ti->anchor; setReference(ti->tagName); m_impl->explicitOutputFileBase = stripExtension(ti->fileName); @@ -4693,37 +4725,37 @@ QCString MemberDefImpl::objCMethodName(bool localLink,bool showStatic) const return qm; } -const char *MemberDefImpl::declaration() const +QCString MemberDefImpl::declaration() const { return m_impl->decl; } -const char *MemberDefImpl::definition() const +QCString MemberDefImpl::definition() const { return m_impl->def; } -const char *MemberDefImpl::extraTypeChars() const +QCString MemberDefImpl::extraTypeChars() const { return m_impl->extraTypeChars; } -const char *MemberDefImpl::typeString() const +QCString MemberDefImpl::typeString() const { return m_impl->type; } -const char *MemberDefImpl::argsString() const +QCString MemberDefImpl::argsString() const { return m_impl->args; } -const char *MemberDefImpl::excpString() const +QCString MemberDefImpl::excpString() const { return m_impl->exception; } -const char *MemberDefImpl::bitfieldString() const +QCString MemberDefImpl::bitfieldString() const { return m_impl->bitfields; } @@ -4758,12 +4790,12 @@ const NamespaceDef* MemberDefImpl::getNamespaceDef() const return m_impl->nspace; } -const char *MemberDefImpl::getReadAccessor() const +QCString MemberDefImpl::getReadAccessor() const { return m_impl->read; } -const char *MemberDefImpl::getWriteAccessor() const +QCString MemberDefImpl::getWriteAccessor() const { return m_impl->write; } @@ -4778,7 +4810,7 @@ Grouping::GroupPri_t MemberDefImpl::getGroupPri() const return m_impl->grouppri; } -const char *MemberDefImpl::getGroupFileName() const +QCString MemberDefImpl::getGroupFileName() const { return m_impl->groupFileName; } @@ -5335,7 +5367,7 @@ QCString MemberDefImpl::getCachedTypedefTemplSpec() const QCString MemberDefImpl::getCachedResolvedTypedef() const { - //printf("MemberDefImpl::getCachedResolvedTypedef()=%s m_impl=%p\n",m_impl->cachedResolvedType.data(),m_impl); + //printf("MemberDefImpl::getCachedResolvedTypedef()=%s m_impl=%p\n",qPrint(m_impl->cachedResolvedType),m_impl); return m_impl->cachedResolvedType; } @@ -5383,7 +5415,7 @@ void MemberDefImpl::setMemberType(MemberType t) m_isLinkableCached = 0; } -void MemberDefImpl::setDefinition(const char *d) +void MemberDefImpl::setDefinition(const QCString &d) { m_impl->def=d; } @@ -5412,7 +5444,7 @@ void MemberDefImpl::mergeMemberSpecifiers(uint64 s) m_impl->memSpec|=s; } -void MemberDefImpl::setBitfields(const char *s) +void MemberDefImpl::setBitfields(const QCString &s) { m_impl->bitfields = QCString(s).simplifyWhiteSpace(); } @@ -5425,12 +5457,12 @@ void MemberDefImpl::setMaxInitLines(int lines) } } -void MemberDefImpl::setReadAccessor(const char *r) +void MemberDefImpl::setReadAccessor(const QCString &r) { m_impl->read=r; } -void MemberDefImpl::setWriteAccessor(const char *w) +void MemberDefImpl::setWriteAccessor(const QCString &w) { m_impl->write=w; } @@ -5457,7 +5489,7 @@ void MemberDefImpl::setInheritsDocsFrom(const MemberDef *md) m_impl->docProvider = md; } -void MemberDefImpl::setArgsString(const char *as) +void MemberDefImpl::setArgsString(const QCString &as) { m_impl->args = as; } @@ -5604,6 +5636,15 @@ QCString MemberDefImpl::enumBaseType() const return m_impl->enumBaseType; } +void MemberDefImpl::setRequiresClause(const QCString &req) +{ + m_impl->requiresClause = req; +} + +QCString MemberDefImpl::requiresClause() const +{ + return m_impl->requiresClause; +} void MemberDefImpl::cacheTypedefVal(const ClassDef*val, const QCString & templSpec, const QCString &resolvedType) { @@ -5611,7 +5652,7 @@ void MemberDefImpl::cacheTypedefVal(const ClassDef*val, const QCString & templSp m_impl->cachedTypedefValue=val; m_impl->cachedTypedefTemplSpec=templSpec; m_impl->cachedResolvedType=resolvedType; - //printf("MemberDefImpl::cacheTypedefVal=%s m_impl=%p\n",m_impl->cachedResolvedType.data(),m_impl); + //printf("MemberDefImpl::cacheTypedefVal=%s m_impl=%p\n",qPrint(m_impl->cachedResolvedType),m_impl); } void MemberDefImpl::copyArgumentNames(const MemberDef *bmd) @@ -5740,15 +5781,15 @@ static void transferArgumentDocumentation(ArgumentList &decAl,ArgumentList &defA void combineDeclarationAndDefinition(MemberDefMutable *mdec,MemberDefMutable *mdef) { - //printf("mdec=%s isPrototype()=%d\n",mdec->name().data(),mdec->isPrototype()); + //printf("mdec=%s isPrototype()=%d\n",qPrint(mdec->name()),mdec->isPrototype()); if ( (mdef->isFunction() && !mdef->isStatic() && !mdef->isPrototype()) || (mdef->isVariable() && !mdef->isExternal() && !mdef->isStatic()) ) { //printf("mdef=(%p,%s) mdec=(%p,%s)\n", - // mdef, mdef ? mdef->name().data() : "", - // mdec, mdec ? mdec->name().data() : ""); + // mdef, mdef ? qPrint(mdef->name()) : "", + // mdec, mdec ? qPrint(mdec->name()) : ""); ArgumentList &mdefAl = const_cast<ArgumentList&>(mdef->argumentList()); ArgumentList &mdecAl = const_cast<ArgumentList&>(mdec->argumentList()); @@ -5760,8 +5801,8 @@ void combineDeclarationAndDefinition(MemberDefMutable *mdec,MemberDefMutable *md { //printf("Found member %s: definition in %s (doc='%s') and declaration in %s (doc='%s')\n", // mn->memberName(), - // mdef->getFileDef()->name().data(),mdef->documentation().data(), - // mdec->getFileDef()->name().data(),mdec->documentation().data() + // qPrint(mdef->getFileDef()->name()),qPrint(mdef->documentation()), + // qPrint(mdec->getFileDef()->name()),qPrint(mdec->documentation()) // ); if (Config_getBool(RESOLVE_UNNAMED_PARAMS)) @@ -5946,7 +5987,7 @@ bool MemberDefImpl::isReference() const void addDocCrossReference(MemberDefMutable *src,MemberDefMutable *dst) { if (src==0 || dst==0) return; - //printf("--> addDocCrossReference src=%s,dst=%s\n",src->name().data(),dst->name().data()); + //printf("--> addDocCrossReference src=%s,dst=%s\n",qPrint(src->name()),qPrint(dst->name())); if (dst->isTypedef() || dst->isEnumerate()) return; // don't add types if ((dst->hasReferencedByRelation() || dst->hasCallerGraph()) && src->showInCallGraph() diff --git a/src/memberdef.h b/src/memberdef.h index 3f9fb92..91b0c6d 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -64,13 +64,13 @@ class MemberDef : public Definition virtual QCString getReference() const = 0; virtual QCString anchor() const = 0; - virtual const char *declaration() const = 0; - virtual const char *definition() const = 0; - virtual const char *typeString() const = 0; - virtual const char *argsString() const = 0; - virtual const char *excpString() const = 0; - virtual const char *bitfieldString() const = 0; - virtual const char *extraTypeChars() const = 0; + virtual QCString declaration() const = 0; + virtual QCString definition() const = 0; + virtual QCString typeString() const = 0; + virtual QCString argsString() const = 0; + virtual QCString excpString() const = 0; + virtual QCString bitfieldString() const = 0; + virtual QCString extraTypeChars() const = 0; virtual const QCString &initializer() const = 0; virtual int initializerLines() const = 0; virtual uint64 getMemberSpecifiers() const = 0; @@ -84,15 +84,16 @@ class MemberDef : public Definition virtual const ClassDef *accessorClass() const = 0; // grabbing the property read/write accessor names - virtual const char *getReadAccessor() const = 0; - virtual const char *getWriteAccessor() const = 0; + virtual QCString getReadAccessor() const = 0; + virtual QCString getWriteAccessor() const = 0; // querying the grouping definition virtual const GroupDef *getGroupDef() const = 0; virtual Grouping::GroupPri_t getGroupPri() const = 0; - virtual const char *getGroupFileName() const = 0; + virtual QCString getGroupFileName() const = 0; virtual int getGroupStartLine() const = 0; virtual bool getGroupHasDocs() const = 0; + virtual QCString qualifiedName() const = 0; virtual QCString objCMethodName(bool localLink,bool showStatic) const = 0; @@ -261,6 +262,8 @@ class MemberDef : public Definition virtual const ArgumentList &typeConstraints() const = 0; + virtual QCString requiresClause() const = 0; + // overrules virtual QCString documentation() const = 0; virtual QCString briefDescription(bool abbr=FALSE) const = 0; @@ -275,7 +278,7 @@ class MemberDef : public Definition const std::unique_ptr<ArgumentList> &actualArgs) const = 0; virtual void writeDeclaration(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, - bool inGroup, const ClassDef *inheritFrom=0,const char *inheritId=0) const = 0; + bool inGroup, const ClassDef *inheritFrom=0,const QCString &inheritId=QCString()) const = 0; virtual void writeEnumDeclaration(OutputList &typeDecl, const ClassDef *cd, const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd) const = 0; virtual void detectUndocumentedParams(bool hasParamCommand,bool hasReturnCommand) const = 0; @@ -296,29 +299,29 @@ class MemberDefMutable : public DefinitionMutable, public MemberDef // set functions virtual void setMemberType(MemberType t) = 0; - virtual void setDefinition(const char *d) = 0; + virtual void setDefinition(const QCString &d) = 0; virtual void setFileDef(const FileDef *fd) = 0; virtual void setAnchor() = 0; virtual void setProtection(Protection p) = 0; virtual void setMemberSpecifiers(uint64 s) = 0; virtual void mergeMemberSpecifiers(uint64 s) = 0; - virtual void setInitializer(const char *i) = 0; - virtual void setBitfields(const char *s) = 0; + virtual void setInitializer(const QCString &i) = 0; + virtual void setBitfields(const QCString &s) = 0; virtual void setMaxInitLines(int lines) = 0; virtual void setMemberClass(const ClassDef *cd) = 0; virtual void setSectionList(const Definition *container,const MemberList *sl) = 0; virtual void setGroupDef(const GroupDef *gd,Grouping::GroupPri_t pri, const QCString &fileName,int startLine,bool hasDocs, MemberDef *member=0) = 0; - virtual void setReadAccessor(const char *r) = 0; - virtual void setWriteAccessor(const char *w) = 0; + virtual void setReadAccessor(const QCString &r) = 0; + virtual void setWriteAccessor(const QCString &w) = 0; virtual void setTemplateSpecialization(bool b) = 0; virtual void makeRelated() = 0; virtual void makeForeign() = 0; virtual void setInheritsDocsFrom(const MemberDef *md) = 0; virtual void setTagInfo(const TagInfo *i) = 0; - virtual void setArgsString(const char *as) = 0; + virtual void setArgsString(const QCString &as) = 0; virtual void incrementFlowKeyWordCount() = 0; virtual void setEnumBaseType(const QCString &type) = 0; @@ -336,7 +339,7 @@ class MemberDefMutable : public DefinitionMutable, public MemberDef virtual void setAnonymousEnumType(const MemberDef *md) = 0; // example related members - virtual bool addExample(const char *anchor,const char *name,const char *file) = 0; + virtual bool addExample(const QCString &anchor,const QCString &name,const QCString &file) = 0; // prototype related members virtual void setPrototype(bool p,const QCString &df,int line, int column) = 0; @@ -349,8 +352,8 @@ class MemberDefMutable : public DefinitionMutable, public MemberDef virtual void resolveUnnamedParameters(const MemberDef *md) = 0; virtual void setDefinitionTemplateParameterLists(const ArgumentLists &lists) = 0; virtual void setTypeConstraints(const ArgumentList &al) = 0; - virtual void setType(const char *t) = 0; - virtual void setAccessorType(ClassDef *cd,const char *t) = 0; + virtual void setType(const QCString &t) = 0; + virtual void setAccessorType(ClassDef *cd,const QCString &t) = 0; // namespace related members virtual void setNamespace(const NamespaceDef *nd) = 0; @@ -387,12 +390,14 @@ class MemberDefMutable : public DefinitionMutable, public MemberDef virtual void setCategory(ClassDef *) = 0; virtual void setCategoryRelation(const MemberDef *) = 0; - virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE) = 0; - virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine) = 0; - virtual void setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine) = 0; + virtual void setDocumentation(const QCString &d,const QCString &docFile,int docLine,bool stripWhiteSpace=TRUE) = 0; + virtual void setBriefDescription(const QCString &b,const QCString &briefFile,int briefLine) = 0; + virtual void setInbodyDocumentation(const QCString &d,const QCString &inbodyFile,int inbodyLine) = 0; virtual void setHidden(bool b) = 0; + virtual void setRequiresClause(const QCString &req) = 0; + //----------------------------------------------------------------------------------- // --- actions ---- //----------------------------------------------------------------------------------- @@ -405,11 +410,11 @@ class MemberDefMutable : public DefinitionMutable, public MemberDef //----------------------------------------------------------------------------------- virtual void writeDocumentation(const MemberList *ml,int memCount,int memTotal,OutputList &ol, - const char *scopeName,const Definition *container, + const QCString &scopeName,const Definition *container, bool inGroup,bool showEnumValues=FALSE,bool showInline=FALSE) const = 0; virtual void writeMemberDocSimple(OutputList &ol,const Definition *container) const = 0; - virtual void writeTagFile(std::ostream &) const = 0; + virtual void writeTagFile(TextStream &) const = 0; virtual void writeLink(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, bool onlyText=FALSE) const = 0; @@ -437,11 +442,11 @@ MemberDefMutable *toMemberDefMutable(const Definition *d); /** Factory method to create a new instance of a MemberDef */ -MemberDefMutable *createMemberDef(const char *defFileName,int defLine,int defColumn, - const char *type,const char *name,const char *args, - const char *excp,Protection prot,Specifier virt,bool stat, +MemberDefMutable *createMemberDef(const QCString &defFileName,int defLine,int defColumn, + const QCString &type,const QCString &name,const QCString &args, + const QCString &excp,Protection prot,Specifier virt,bool stat, Relationship related,MemberType t,const ArgumentList &tal, - const ArgumentList &al,const char *metaData); + const ArgumentList &al,const QCString &metaData); MemberDef *createMemberDefAlias(const Definition *newScope,const MemberDef *aliasMd); diff --git a/src/membergroup.cpp b/src/membergroup.cpp index 38d5503..641a317 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -29,14 +29,14 @@ #include "entry.h" #include "md5.h" -MemberGroup::MemberGroup(const Definition *container,int id,const char *hdr,const char *d,const char *docFile,int docLine) +MemberGroup::MemberGroup(const Definition *container,int id,const QCString &hdr,const QCString &d,const QCString &docFile,int docLine) : m_container(container), memberList(std::make_unique<MemberList>(MemberListType_memberGroup)), grpId(id), grpHeader(hdr), doc(d), m_docFile(docFile), m_docLine(docLine) { //printf("New member group id=%d header=%s desc=%s\n",id,hdr,d); memberList->setNeedsSorting(Config_getBool(SORT_BRIEF_DOCS)); // detailed sections are already sorted elsewhere. - //printf("Member group docs='%s'\n",doc.data()); + //printf("Member group docs='%s'\n",qPrint(doc)); } MemberGroup::~MemberGroup() @@ -50,7 +50,7 @@ void MemberGroup::insertMember(const MemberDef *md) // memberList->first() ? memberList->first()->getSectionList() : 0, // memberList->count(), // md->getSectionList(), - // md,md->name().data()); + // md,qPrint(md->name())); const MemberDef *firstMd = memberList->empty() ? 0 : memberList->front(); if (inSameSection && firstMd && @@ -91,7 +91,7 @@ void MemberGroup::writeDeclarations(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, bool showInline) const { - //printf("MemberGroup::writeDeclarations() %s\n",grpHeader.data()); + //printf("MemberGroup::writeDeclarations() %s\n",qPrint(grpHeader)); QCString ldoc = doc; if (!ldoc.isEmpty()) ldoc.prepend("<a name=\""+anchor()+"\" id=\""+anchor()+"\"></a>"); memberList->writeDeclarations(ol,cd,nd,fd,gd,grpHeader,ldoc,FALSE,showInline); @@ -99,21 +99,21 @@ void MemberGroup::writeDeclarations(OutputList &ol, void MemberGroup::writePlainDeclarations(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, - const ClassDef *inheritedFrom,const char *inheritId + const ClassDef *inheritedFrom,const QCString &inheritId ) const { //printf("MemberGroup::writePlainDeclarations() memberList->count()=%d\n",memberList->count()); memberList->writePlainDeclarations(ol,cd,nd,fd,gd,inheritedFrom,inheritId); } -void MemberGroup::writeDocumentation(OutputList &ol,const char *scopeName, +void MemberGroup::writeDocumentation(OutputList &ol,const QCString &scopeName, const Definition *container,bool showEnumValues,bool showInline) const { - //printf("MemberGroup::writeDocumentation() %s\n",grpHeader.data()); - memberList->writeDocumentation(ol,scopeName,container,0,showEnumValues,showInline); + //printf("MemberGroup::writeDocumentation() %s\n",qPrint(grpHeader)); + memberList->writeDocumentation(ol,scopeName,container,QCString(),showEnumValues,showInline); } -void MemberGroup::writeDocumentationPage(OutputList &ol,const char *scopeName, +void MemberGroup::writeDocumentationPage(OutputList &ol,const QCString &scopeName, const DefinitionMutable *container) const { memberList->writeDocumentationPage(ol,scopeName,container); @@ -196,11 +196,11 @@ int MemberGroup::countInheritableMembers(const ClassDef *inheritedFrom) const void MemberGroup::distributeMemberGroupDocumentation() { - //printf("MemberGroup::distributeMemberGroupDocumentation() %s\n",grpHeader.data()); + //printf("MemberGroup::distributeMemberGroupDocumentation() %s\n",qPrint(grpHeader)); const MemberDef *md = 0; for (const auto &smd : *memberList) { - //printf("checking md=%s\n",md->name().data()); + //printf("checking md=%s\n",qPrint(md->name())); // find the first member of the group with documentation if (!smd->documentation().isEmpty() || !smd->briefDescription().isEmpty() || @@ -214,7 +214,7 @@ void MemberGroup::distributeMemberGroupDocumentation() } if (md) // distribute docs of md to other members of the list { - //printf("Member %s has documentation!\n",md->name().data()); + //printf("Member %s has documentation!\n",qPrint(md->name())); for (const auto &iomd : *memberList) { MemberDefMutable *omd = toMemberDefMutable(iomd); @@ -223,7 +223,7 @@ void MemberGroup::distributeMemberGroupDocumentation() omd->inbodyDocumentation().isEmpty() ) { - //printf("Copying documentation to member %s\n",omd->name().data()); + //printf("Copying documentation to member %s\n",qPrint(omd->name())); omd->setBriefDescription(md->briefDescription(),md->briefFile(),md->briefLine()); omd->setDocumentation(md->documentation(),md->docFile(),md->docLine()); omd->setInbodyDocumentation(md->inbodyDocumentation(),md->inbodyFile(),md->inbodyLine()); @@ -262,12 +262,12 @@ void MemberGroup::setInGroup(bool b) QCString MemberGroup::anchor() const { uchar md5_sig[16]; - QCString sigStr(33); + char sigStr[33]; QCString locHeader = grpHeader; if (locHeader.isEmpty()) locHeader="[NOHEADER]"; MD5Buffer((const unsigned char *)locHeader.data(),locHeader.length(),md5_sig); - MD5SigToString(md5_sig,sigStr.rawData(),33); - return "amgrp"+sigStr; + MD5SigToString(md5_sig,sigStr); + return QCString("amgrp")+sigStr; } void MemberGroup::addListReferences(Definition *def) @@ -280,7 +280,7 @@ void MemberGroup::addListReferences(Definition *def) name, theTranslator->trGroup(TRUE,TRUE), name, - grpHeader,0,def); + grpHeader,QCString(),def); } } @@ -295,7 +295,7 @@ void MemberGroup::setRefItems(const RefItemVector &sli) m_xrefListItems.insert(m_xrefListItems.end(), sli.cbegin(), sli.cend()); } -void MemberGroup::writeTagFile(std::ostream &tagFile) +void MemberGroup::writeTagFile(TextStream &tagFile) { memberList->writeTagFile(tagFile); } diff --git a/src/membergroup.h b/src/membergroup.h index 178a0f9..31705c0 100644 --- a/src/membergroup.h +++ b/src/membergroup.h @@ -37,14 +37,15 @@ class OutputList; class Definition; class DefinitionMutable; class RefItem; +class TextStream; /** A class representing a group of members. */ class MemberGroup { public: //MemberGroup(); - MemberGroup(const Definition *container,int id,const char *header, - const char *docs,const char *docFile,int docLine); + MemberGroup(const Definition *container,int id,const QCString &header, + const QCString &docs,const QCString &docFile,int docLine); ~MemberGroup(); QCString header() const { return grpHeader; } int groupId() const { return grpId; } @@ -52,15 +53,15 @@ class MemberGroup void setAnchors(); void writePlainDeclarations(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, - const ClassDef *inheritedFrom,const char *inheritId) const; + const ClassDef *inheritedFrom,const QCString &inheritId) const; void writeDeclarations(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, bool showInline=FALSE) const; - void writeDocumentation(OutputList &ol,const char *scopeName, + void writeDocumentation(OutputList &ol,const QCString &scopeName, const Definition *container,bool showEnumValues,bool showInline) const; - void writeDocumentationPage(OutputList &ol,const char *scopeName, + void writeDocumentationPage(OutputList &ol,const QCString &scopeName, const DefinitionMutable *container) const; - void writeTagFile(std::ostream &); + void writeTagFile(TextStream &); void addGroupedInheritedMembers(OutputList &ol,const ClassDef *cd, MemberListType lt, const ClassDef *inheritedFrom,const QCString &inheritId) const; diff --git a/src/memberlist.cpp b/src/memberlist.cpp index 26e3dea..bd89739 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -73,7 +73,7 @@ int genericCompareMembers(const MemberDef *c1,const MemberDef *c2) // sort on name int cmp = qstricmp(c1->name(),c2->name()); // then on argument list - if (cmp==0 && c1->argsString() && c2->argsString()) + if (cmp==0 && !c1->argsString().isEmpty() && !c2->argsString().isEmpty()) { cmp = qstricmp(c1->argsString(),c2->argsString()); } @@ -100,8 +100,8 @@ int MemberList::countInheritableMembers(const ClassDef *inheritedFrom) const if (md->memberType()!=MemberType_Friend && md->memberType()!=MemberType_EnumValue) { - //printf("member %s: isReimplementedBy(%s)=%d\n",md->name().data(), - // inheritedFrom->name().data(), + //printf("member %s: isReimplementedBy(%s)=%d\n",qPrint(md->name()), + // qPrint(inheritedFrom->name()), // md->isReimplementedBy(inheritedFrom)); if (md->memberType()==MemberType_Function) { @@ -119,8 +119,8 @@ int MemberList::countInheritableMembers(const ClassDef *inheritedFrom) const count+=mg->countInheritableMembers(inheritedFrom); } //printf("%s::countInheritableMembers(%s)=%d\n", - // listTypeAsString().data(), - // inheritedFrom->name().data(),count); + // qPrint(listTypeAsString()), + // qPrint(inheritedFrom->name()),count); return count; } @@ -139,7 +139,7 @@ void MemberList::countDecMembers() m_numDecMembers=0; for (const auto &md : m_members) { - //printf("MemberList::countDecMembers(md=%s,%d)\n",md->name().data(),md->isBriefSectionVisible()); + //printf("MemberList::countDecMembers(md=%s,%d)\n",qPrint(md->name()),md->isBriefSectionVisible()); if (md->isBriefSectionVisible()) { switch(md->memberType()) @@ -176,7 +176,7 @@ void MemberList::countDecMembers() break; //case MemberType_Prototype: m_protoCnt++,m_numDecMembers++; break; case MemberType_Define: if (Config_getBool(EXTRACT_ALL) || - md->argsString() || + !md->argsString().isEmpty() || !md->initializer().isEmpty() || md->hasDocumentation() ) /*m_defCnt++,*/ m_numDecMembers++; @@ -185,7 +185,7 @@ void MemberList::countDecMembers() m_numDecMembers++; break; default: - err("Unknown member type found for member '%s'\n!",md->name().data()); + err("Unknown member type found for member '%s'\n!",qPrint(md->name())); } } } @@ -340,7 +340,7 @@ bool MemberList::declVisible() const void MemberList::writePlainDeclarations(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd, - const GroupDef *gd,const ClassDef *inheritedFrom,const char *inheritId + const GroupDef *gd,const ClassDef *inheritedFrom,const QCString &inheritId ) const { //printf("----- writePlainDeclaration() ----\n"); @@ -363,7 +363,7 @@ void MemberList::writePlainDeclarations(OutputList &ol, for (const auto &md : m_members) { //printf(">>> Member '%s' type=%d visible=%d\n", - // md->name().data(),md->memberType(),md->isBriefSectionVisible()); + // qPrint(md->name()),md->memberType(),md->isBriefSectionVisible()); if ((inheritedFrom==0 || !md->isReimplementedBy(inheritedFrom)) && md->isBriefSectionVisible()) { @@ -406,7 +406,7 @@ void MemberList::writePlainDeclarations(OutputList &ol, bool detailsLinkable = md->isDetailedSectionLinkable(); if (!detailsLinkable) { - ol.startDoxyAnchor(md->getOutputFileBase(),0,md->anchor(),md->name(),QCString()); + ol.startDoxyAnchor(md->getOutputFileBase(),QCString(),md->anchor(),md->name(),QCString()); } if (md->isSliceLocal()) { @@ -431,7 +431,7 @@ void MemberList::writePlainDeclarations(OutputList &ol, cd,md, md->briefDescription(), TRUE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT) + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT) ); if (rootNode && !rootNode->isEmpty()) { @@ -532,7 +532,7 @@ void MemberList::writePlainDeclarations(OutputList &ol, */ void MemberList::writeDeclarations(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, - const char *title,const char *subtitle, bool showEnumValues, + const QCString &title,const QCString &subtitle, bool showEnumValues, bool showInline,const ClassDef *inheritedFrom,MemberListType lt) const { (void)showEnumValues; // unused @@ -561,7 +561,7 @@ void MemberList::writeDeclarations(OutputList &ol, ol.disableAllBut(OutputGenerator::Html); inheritId = substitute(listTypeAsString(lt),"-","_")+"_"+ stripPath(cd->getOutputFileBase()); - if (title) + if (!title.isEmpty()) { ol.writeInheritedSectionTitle(inheritId,cd->getReference(), cd->getOutputFileBase(), @@ -572,7 +572,7 @@ void MemberList::writeDeclarations(OutputList &ol, } else if (num>numEnumValues) { - if (title) + if (!title.isEmpty()) { if (showInline) { @@ -592,17 +592,12 @@ void MemberList::writeDeclarations(OutputList &ol, ol.endMemberHeader(); } } - if (subtitle) + if (!subtitle.stripWhiteSpace().isEmpty()) { - QCString st=subtitle; - st = st.stripWhiteSpace(); - if (!st.isEmpty()) - { - ol.startMemberSubtitle(); - ol.generateDoc("[generated]",-1,ctx,0,subtitle,FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); - ol.endMemberSubtitle(); - } + ol.startMemberSubtitle(); + ol.generateDoc("[generated]",-1,ctx,0,subtitle,FALSE,FALSE, + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + ol.endMemberSubtitle(); } } if (num>numEnumValues) @@ -628,7 +623,7 @@ void MemberList::writeDeclarations(OutputList &ol, bool hasHeader=!mg->header().isEmpty() && mg->header()!="[NOHEADER]"; if (inheritId.isEmpty()) { - //printf("mg->header=%s hasHeader=%d\n",mg->header().data(),hasHeader); + //printf("mg->header=%s hasHeader=%d\n",qPrint(mg->header()),hasHeader); ol.startMemberGroupHeader(hasHeader); if (hasHeader) { @@ -640,7 +635,7 @@ void MemberList::writeDeclarations(OutputList &ol, //printf("Member group has docs!\n"); ol.startMemberGroupDocs(); ol.generateDoc(mg->docFile(),mg->docLine(),ctx,0,mg->documentation()+"\n",FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberGroupDocs(); } ol.startMemberGroup(); @@ -667,8 +662,8 @@ void MemberList::writeDeclarations(OutputList &ol, } void MemberList::writeDocumentation(OutputList &ol, - const char *scopeName, const Definition *container, - const char *title,bool showEnumValues,bool showInline) const + const QCString &scopeName, const Definition *container, + const QCString &title,bool showEnumValues,bool showInline) const { if (numDocMembers()==-1) { @@ -679,7 +674,7 @@ void MemberList::writeDocumentation(OutputList &ol, if (numDocMembers()==0) return; if (!showEnumValues && numDocMembers()<=numDocEnumValues()) return; - if (title) + if (!title.isEmpty()) { ol.pushGeneratorState(); ol.disable(OutputGenerator::Html); @@ -703,7 +698,7 @@ void MemberList::writeDocumentation(OutputList &ol, if (md->isDetailedSectionVisible(m_inGroup,container->definitionType()==Definition::TypeFile) && !(md->isEnumValue() && !showInline)) { - auto it = overloadInfo.insert(std::make_pair(md->name(),OverloadInfo())).first; + auto it = overloadInfo.insert(std::make_pair(md->name().str(),OverloadInfo())).first; it->second.total++; } } @@ -758,7 +753,7 @@ void MemberList::writeSimpleDocumentation(OutputList &ol, // separate member pages void MemberList::writeDocumentationPage(OutputList &ol, - const char *scopeName, const DefinitionMutable *container) const + const QCString &scopeName, const DefinitionMutable *container) const { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); @@ -774,9 +769,9 @@ void MemberList::writeDocumentationPage(OutputList &ol, { MemberDefMutable *md = toMemberDefMutable(imd); - if (md->isDetailedSectionLinkable()) + if (md && md->isDetailedSectionLinkable()) { - auto it = overloadInfo.insert(std::make_pair(md->name(),OverloadInfo())).first; + auto it = overloadInfo.insert(std::make_pair(md->name().str(),OverloadInfo())).first; it->second.total++; } } @@ -785,7 +780,7 @@ void MemberList::writeDocumentationPage(OutputList &ol, { Definition *container_d = toDefinition(const_cast<DefinitionMutable*>(container)); MemberDefMutable *md = toMemberDefMutable(imd); - if (md->isDetailedSectionLinkable()) + if (md && md->isDetailedSectionLinkable()) { auto it = overloadInfo.find(md->name().str()); uint overloadCount = it->second.total; @@ -856,7 +851,7 @@ void MemberList::addListReferences(Definition *def) MemberDefMutable *vmdm = toMemberDefMutable(vmd); if (vmdm) { - //printf(" adding %s\n",vmd->name().data()); + //printf(" adding %s\n",qPrint(vmd->name())); vmdm->addListReference(def); } } @@ -948,7 +943,7 @@ QCString MemberList::listTypeAsString(MemberListType type) return ""; } -void MemberList::writeTagFile(std::ostream &tagFile) +void MemberList::writeTagFile(TextStream &tagFile) { for (const auto &imd : m_members) { diff --git a/src/memberlist.h b/src/memberlist.h index 149c05f..33920d5 100644 --- a/src/memberlist.h +++ b/src/memberlist.h @@ -88,19 +88,19 @@ class MemberList int countInheritableMembers(const ClassDef *inheritedFrom) const; void writePlainDeclarations(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd, const GroupDef *gd, - const ClassDef *inheritedFrom,const char *inheritId) const; + const ClassDef *inheritedFrom,const QCString &inheritId) const; void writeDeclarations(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, - const char *title,const char *subtitle, + const QCString &title,const QCString &subtitle, bool showEnumValues=FALSE,bool showInline=FALSE, const ClassDef *inheritedFrom=0,MemberListType lt=MemberListType_pubMethods) const; - void writeDocumentation(OutputList &ol,const char *scopeName, - const Definition *container,const char *title, + void writeDocumentation(OutputList &ol,const QCString &scopeName, + const Definition *container,const QCString &title, bool showEnumValues=FALSE,bool showInline=FALSE) const; void writeSimpleDocumentation(OutputList &ol,const Definition *container) const; void writeDocumentationPage(OutputList &ol, - const char *scopeName, const DefinitionMutable *container) const; - void writeTagFile(std::ostream &); + const QCString &scopeName, const DefinitionMutable *container) const; + void writeTagFile(TextStream &); bool declVisible() const; void addMemberGroup(MemberGroup *mg); void setInGroup(bool inGroup) { m_inGroup=inGroup; } diff --git a/src/membername.h b/src/membername.h index 2141d22..f600c8b 100644 --- a/src/membername.h +++ b/src/membername.h @@ -31,8 +31,8 @@ class MemberName using reverse_iterator = typename Vec::reverse_iterator; using const_reverse_iterator = typename Vec::const_reverse_iterator; - MemberName(const char *name) : m_name(name) {} - const char *memberName() const { return m_name; } + MemberName(const QCString &name) : m_name(name) {} + QCString memberName() const { return m_name; } iterator begin() { return m_members.begin(); } iterator end() { return m_members.end(); } @@ -103,8 +103,8 @@ class MemberNameInfo using iterator = typename Vec::iterator; using const_iterator = typename Vec::const_iterator; - MemberNameInfo(const char *name) : m_name(name) {} - const char *memberName() const { return m_name; } + MemberNameInfo(const QCString &name) : m_name(name) {} + QCString memberName() const { return m_name; } iterator begin() { return m_members.begin(); } iterator end() { return m_members.end(); } diff --git a/src/message.cpp b/src/message.cpp index eb20c19..c973de6 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -45,7 +45,7 @@ void initWarningFormat() if (!Config_getString(WARN_LOGFILE).isEmpty()) { - warnFile = Portable::fopen(Config_getString(WARN_LOGFILE),"w"); + warnFile = Portable::fopen(Config_getString(WARN_LOGFILE).data(),"w"); } if (!warnFile) // point it to something valid, because warn() relies on it { @@ -79,9 +79,9 @@ void msg(const char *fmt, ...) } } -static void format_warn(const char *file,int line,const char *text) +static void format_warn(const QCString &file,int line,const QCString &text) { - QCString fileSubst = file==0 ? "<unknown>" : file; + QCString fileSubst = file.isEmpty() ? "<unknown>" : file; QCString lineSubst; lineSubst.setNum(line); QCString textSubst = text; QCString versionSubst; @@ -132,7 +132,7 @@ static void handle_warn_as_error() warnStat = true; } -static void do_warn(bool enabled, const char *file, int line, const char *prefix, const char *fmt, va_list args) +static void do_warn(bool enabled, const QCString &file, int line, const char *prefix, const char *fmt, va_list args) { if (!enabled) return; // warning type disabled @@ -149,18 +149,17 @@ static void do_warn(bool enabled, const char *file, int line, const char *prefix // prefix // 1 position for `\0` int bufSize = vsnprintf(NULL, 0, fmt, args) + l + 1; - char *text = (char *)malloc(sizeof(char) * bufSize); + QCString text(bufSize); if (prefix) { - qstrncpy(text,prefix,bufSize); + qstrncpy(text.rawData(),prefix,bufSize); } - vsnprintf(text+l, bufSize-l, fmt, argsCopy); + vsnprintf(text.rawData()+l, bufSize-l, fmt, argsCopy); text[bufSize-1]='\0'; format_warn(file,line,text); - free(text); } -void warn(const char *file,int line,const char *fmt, ...) +void warn(const QCString &file,int line,const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -168,18 +167,18 @@ void warn(const char *file,int line,const char *fmt, ...) va_end(args); } -void va_warn(const char *file,int line,const char *fmt,va_list args) +void va_warn(const QCString &file,int line,const char *fmt,va_list args) { do_warn(Config_getBool(WARNINGS), file, line, warning_str, fmt, args); } -void warn_simple(const char *file,int line,const char *text) +void warn_simple(const QCString &file,int line,const char *text) { if (!Config_getBool(WARNINGS)) return; // warning type disabled format_warn(file,line,QCString(warning_str) + text); } -void warn_undoc(const char *file,int line,const char *fmt, ...) +void warn_undoc(const QCString &file,int line,const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -187,7 +186,7 @@ void warn_undoc(const char *file,int line,const char *fmt, ...) va_end(args); } -void warn_incomplete_doc(const char *file,int line,const char *fmt, ...) +void warn_incomplete_doc(const QCString &file,int line,const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -195,7 +194,7 @@ void warn_incomplete_doc(const char *file,int line,const char *fmt, ...) va_end(args); } -void warn_doc_error(const char *file,int line,const char *fmt, ...) +void warn_doc_error(const QCString &file,int line,const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -221,7 +220,7 @@ void err(const char *fmt, ...) handle_warn_as_error(); } -extern void err_full(const char *file,int line,const char *fmt, ...) +extern void err_full(const QCString &file,int line,const char *fmt, ...) { va_list args; va_start(args, fmt); diff --git a/src/message.h b/src/message.h index aa63ecb..3c3ccd9 100644 --- a/src/message.h +++ b/src/message.h @@ -17,6 +17,7 @@ #define MESSAGE_H #include <cstdarg> +#include "qcstring.h" #ifdef __GNUC__ #define PRINTFLIKE(FORMAT, PARAM ) __attribute__((format(printf, FORMAT, PARAM))) @@ -25,15 +26,15 @@ #endif extern void msg(const char *fmt, ...) PRINTFLIKE(1,2); -extern void warn(const char *file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); -extern void va_warn(const char* file, int line, const char* fmt, va_list args); -extern void warn_simple(const char *file,int line,const char *text); -extern void warn_undoc(const char *file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); -extern void warn_incomplete_doc(const char *file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); -extern void warn_doc_error(const char *file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void warn(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void va_warn(const QCString &file, int line, const char* fmt, va_list args); +extern void warn_simple(const QCString &file,int line,const char *text); +extern void warn_undoc(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void warn_incomplete_doc(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void warn_doc_error(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); extern void warn_uncond(const char *fmt, ...) PRINTFLIKE(1, 2); extern void err(const char *fmt, ...) PRINTFLIKE(1, 2); -extern void err_full(const char *file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void err_full(const QCString &file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); extern void term(const char *fmt, ...) PRINTFLIKE(1, 2); void initWarningFormat(); void warn_flush(); diff --git a/src/msc.cpp b/src/msc.cpp index 8b45faa..b486389 100644 --- a/src/msc.cpp +++ b/src/msc.cpp @@ -25,18 +25,19 @@ #include "util.h" #include "mscgen_api.h" #include "dir.h" +#include "textstream.h" static const int maxCmdLine = 40960; -static bool convertMapFile(std::ostream &t,const char *mapName,const QCString relPath, +static bool convertMapFile(TextStream &t,const QCString &mapName,const QCString &relPath, const QCString &context) { - std::ifstream f(mapName,std::ifstream::in); + std::ifstream f(mapName.str(),std::ifstream::in); if (!f.is_open()) { err("failed to open map file %s for inclusion in the docs!\n" "If you installed Graphviz/dot after a previous failing run, \n" - "try deleting the output directory and rerun doxygen.\n",mapName); + "try deleting the output directory and rerun doxygen.\n",qPrint(mapName)); return false; } const int maxLineLen=1024; @@ -87,8 +88,8 @@ static bool convertMapFile(std::ostream &t,const char *mapName,const QCString re return true; } -void writeMscGraphFromFile(const char *inFile,const char *outDir, - const char *outFile,MscOutputFormat format) +void writeMscGraphFromFile(const QCString &inFile,const QCString &outDir, + const QCString &outFile,MscOutputFormat format) { QCString absOutFile = outDir; absOutFile+=Portable::pathSeparator(); @@ -114,10 +115,10 @@ void writeMscGraphFromFile(const char *inFile,const char *outDir, return; } int code; - if ((code=mscgen_generate(inFile,imgName,msc_format))!=0) + if ((code=mscgen_generate(inFile.data(),imgName.data(),msc_format))!=0) { err("Problems generating msc output (error=%s). Look for typos in you msc file %s\n", - mscgen_error2str(code),inFile); + mscgen_error2str(code),qPrint(inFile)); return; } @@ -125,7 +126,7 @@ void writeMscGraphFromFile(const char *inFile,const char *outDir, { QCString epstopdfArgs(maxCmdLine); epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"", - absOutFile.data(),absOutFile.data()); + qPrint(absOutFile),qPrint(absOutFile)); Portable::sysTimerStart(); if (Portable::system("epstopdf",epstopdfArgs)!=0) { @@ -145,24 +146,23 @@ static QCString getMscImageMapFromFile(const QCString& inFile, const QCString& o QCString outFile = inFile + ".map"; int code; - if ((code=mscgen_generate(inFile,outFile, + if ((code=mscgen_generate(inFile.data(),outFile.data(), writeSVGMap ? mscgen_format_svgmap : mscgen_format_pngmap))!=0) { err("Problems generating msc output (error=%s). Look for typos in you msc file %s\n", - mscgen_error2str(code),inFile.data()); + mscgen_error2str(code),qPrint(inFile)); return ""; } - std::ostringstream t(std::ios_base::ate); + TextStream t; convertMapFile(t, outFile, relPath, context); - QCString result = t.str(); Dir().remove(outFile.str()); - return result; + return t.str(); } -void writeMscImageMapFromFile(std::ostream &t,const QCString &inFile, +void writeMscImageMapFromFile(TextStream &t,const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, @@ -16,19 +16,18 @@ #ifndef _MSC_H #define _MSC_H -#include <iostream> - class QCString; +class TextStream; enum MscOutputFormat { MSC_BITMAP , MSC_EPS, MSC_SVG }; -void writeMscGraphFromFile(const char *inFile,const char *outDir, - const char *outFile,MscOutputFormat format); +void writeMscGraphFromFile(const QCString &inFile,const QCString &outDir, + const QCString &outFile,MscOutputFormat format); QCString getMscImageMapFromFile(const QCString& inFile, const QCString& outDir, const QCString& relPath,const QCString& context); -void writeMscImageMapFromFile(std::ostream &t,const QCString &inFile, +void writeMscImageMapFromFile(TextStream &t,const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, const QCString &context, MscOutputFormat format diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 5dc36be..db855ba 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -32,6 +32,7 @@ #include "config.h" #include "definitionimpl.h" #include "membername.h" +#include "conceptdef.h" //------------------------------------------------------------------ static QCString makeDisplayName(const NamespaceDef *nd,bool includeScope) @@ -43,7 +44,7 @@ static QCString makeDisplayName(const NamespaceDef *nd,bool includeScope) { result = substitute(result,"::",sep); } - //printf("makeDisplayName() %s->%s lang=%d\n",name().data(),result.data(),lang); + //printf("makeDisplayName() %s->%s lang=%d\n",qPrint(name()),qPrint(result),lang); return result; } //------------------------------------------------------------------ @@ -51,9 +52,9 @@ static QCString makeDisplayName(const NamespaceDef *nd,bool includeScope) class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> { public: - NamespaceDefImpl(const char *defFileName,int defLine,int defColumn, - const char *name,const char *ref=0, - const char *refFile=0,const char*type=0, + NamespaceDefImpl(const QCString &defFileName,int defLine,int defColumn, + const QCString &name,const QCString &ref=QCString(), + const QCString &refFile=QCString(),const QCString &type=QCString(), bool isPublished=false); virtual ~NamespaceDefImpl(); virtual DefType definitionType() const { return TypeNamespace; } @@ -63,8 +64,9 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> virtual void writeDocumentation(OutputList &ol); virtual void writeMemberPages(OutputList &ol); virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const; - virtual void writeTagFile(std::ostream &); + virtual void writeTagFile(TextStream &); virtual void insertClass(const ClassDef *cd); + virtual void insertConcept(const ConceptDef *cd); virtual void insertNamespace(const NamespaceDef *nd); virtual void insertMember(MemberDef *md); virtual void computeAnchors(); @@ -89,7 +91,7 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> virtual void distributeMemberGroupDocumentation(); virtual void findSectionsInDocumentation(); virtual void sortMemberLists(); - virtual const Definition *findInnerCompound(const char *name) const; + virtual const Definition *findInnerCompound(const QCString &name) const; virtual void addInnerCompound(const Definition *d); virtual void addListReferences(); virtual void setFileName(const QCString &fn); @@ -103,6 +105,7 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> virtual ClassLinkedRefMap getStructs() const { return structs; } virtual ClassLinkedRefMap getExceptions() const { return exceptions; } virtual NamespaceLinkedRefMap getNamespaces() const { return namespaces; } + virtual ConceptLinkedRefMap getConcepts() const { return m_concepts; } virtual QCString title() const; virtual QCString compoundTypeString() const; @@ -118,6 +121,7 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> void startMemberDeclarations(OutputList &ol); void endMemberDeclarations(OutputList &ol); void writeClassDeclarations(OutputList &ol,const QCString &title,const ClassLinkedRefMap &d); + void writeConcepts(OutputList &ol,const QCString &title); void writeInlineClasses(OutputList &ol); void writeMemberGroups(OutputList &ol); void writeAuthorSection(OutputList &ol); @@ -125,7 +129,8 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> void endMemberDocumentation(OutputList &ol); void writeSummaryLinks(OutputList &ol) const; void addNamespaceAttributes(OutputList &ol); - void writeClassesToTagFile(std::ostream &,const ClassLinkedRefMap &d); + void writeClassesToTagFile(TextStream &,const ClassLinkedRefMap &d); + void writeConceptsToTagFile(TextStream &); void writeNamespaceDeclarations(OutputList &ol,const QCString &title, bool isConstantGroup=false); @@ -144,6 +149,7 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> ClassLinkedRefMap interfaces; ClassLinkedRefMap structs; ClassLinkedRefMap exceptions; + ConceptLinkedRefMap m_concepts; NamespaceLinkedRefMap namespaces; bool m_subGrouping = false; enum { NAMESPACE, MODULE, CONSTANT_GROUP, LIBRARY } m_type; @@ -152,9 +158,9 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> bool m_inline = false; }; -NamespaceDefMutable *createNamespaceDef(const char *defFileName,int defLine,int defColumn, - const char *name,const char *ref, - const char *refFile,const char*type, +NamespaceDefMutable *createNamespaceDef(const QCString &defFileName,int defLine,int defColumn, + const QCString &name,const QCString &ref, + const QCString &refFile,const QCString &type, bool isPublished) { return new NamespaceDefImpl(defFileName,defLine,defColumn,name,ref,refFile,type,isPublished); @@ -201,7 +207,7 @@ class NamespaceDefAliasImpl : public DefinitionAliasMixin<NamespaceDef> { return getNSAlias()->isLinkable(); } virtual bool hasDetailedDescription() const { return getNSAlias()->hasDetailedDescription(); } - virtual const Definition *findInnerCompound(const char *name) const + virtual const Definition *findInnerCompound(const QCString &name) const { return getNSAlias()->findInnerCompound(name); } virtual bool subGrouping() const { return getNSAlias()->subGrouping(); } @@ -223,6 +229,8 @@ class NamespaceDefAliasImpl : public DefinitionAliasMixin<NamespaceDef> { return getNSAlias()->getExceptions(); } virtual NamespaceLinkedRefMap getNamespaces() const { return getNSAlias()->getNamespaces(); } + virtual ConceptLinkedRefMap getConcepts() const + { return getNSAlias()->getConcepts(); } virtual QCString title() const { return getNSAlias()->title(); } virtual QCString compoundTypeString() const @@ -233,23 +241,23 @@ NamespaceDef *createNamespaceDefAlias(const Definition *newScope,const Namespace { NamespaceDef *alnd = new NamespaceDefAliasImpl(newScope,nd); //printf("alnd name=%s localName=%s qualifiedName=%s displayName()=%s\n", - // alnd->name().data(),alnd->localName().data(),alnd->qualifiedName().data(), - // alnd->displayName().data()); + // qPrint(alnd->name()),qPrint(alnd->localName()),qPrint(alnd->qualifiedName()), + // qPrint(alnd->displayName())); return alnd; } //------------------------------------------------------------------ -NamespaceDefImpl::NamespaceDefImpl(const char *df,int dl,int dc, - const char *name,const char *lref, - const char *fName, const char*type, +NamespaceDefImpl::NamespaceDefImpl(const QCString &df,int dl,int dc, + const QCString &name,const QCString &lref, + const QCString &fName, const QCString &type, bool isPublished) : DefinitionMixin(df,dl,dc,name) ,m_isPublished(isPublished) { - if (fName) + if (!fName.isEmpty()) { - if (lref) + if (!lref.isEmpty()) { fileName = stripExtension(fName); } @@ -265,15 +273,15 @@ NamespaceDefImpl::NamespaceDefImpl(const char *df,int dl,int dc, setReference(lref); m_inline=FALSE; m_subGrouping=Config_getBool(SUBGROUPING); - if (type && !strcmp("module", type)) + if (type=="module") { m_type = MODULE; } - else if (type && !strcmp("constants", type)) + else if (type=="constants") { m_type = CONSTANT_GROUP; } - else if (type && !strcmp("library", type)) + else if (type=="library") { m_type = LIBRARY; } @@ -345,6 +353,10 @@ void NamespaceDefImpl::addInnerCompound(const Definition *d) { insertClass(toClassDef(d)); } + else if (d->definitionType()==Definition::TypeConcept) + { + insertConcept(toConceptDef(d)); + } } void NamespaceDefImpl::insertClass(const ClassDef *cd) @@ -370,6 +382,11 @@ void NamespaceDefImpl::insertClass(const ClassDef *cd) d.add(cd->name(),cd); } +void NamespaceDefImpl::insertConcept(const ConceptDef *cd) +{ + m_concepts.add(cd->name(),cd); +} + void NamespaceDefImpl::insertNamespace(const NamespaceDef *nd) { namespaces.add(nd->name(),nd); @@ -391,7 +408,7 @@ void NamespaceDefImpl::addMembersToMemberGroup() { if (mg->allMembersInSameSection() && m_subGrouping) { - //printf("----> addToDeclarationSection(%s)\n",mg->header().data()); + //printf("----> addToDeclarationSection(%s)\n",qPrint(mg->header())); mg->addToDeclarationSection(); } } @@ -444,7 +461,7 @@ void NamespaceDefImpl::insertMember(MemberDef *md) allMemberList = m_memberLists.back().get(); } allMemberList->push_back(md); - //printf("%s::m_allMembersDict->append(%s)\n",name().data(),md->localName().data()); + //printf("%s::m_allMembersDict->append(%s)\n",qPrint(name()),qPrint(md->localName())); m_allMembers.add(md->localName(),md); //::addNamespaceMemberNameToIndex(md); //static bool sortBriefDocs=Config_getBool(SORT_BRIEF_DOCS); @@ -483,9 +500,9 @@ void NamespaceDefImpl::insertMember(MemberDef *md) default: err("NamespaceDefImpl::insertMembers(): " "member '%s' with class scope '%s' inserted in namespace scope '%s'!\n", - md->name().data(), - md->getClassDef() ? md->getClassDef()->name().data() : "", - name().data()); + qPrint(md->name()), + md->getClassDef() ? qPrint(md->getClassDef()->name()) : "", + qPrint(name())); } // if this is an inline namespace, then insert an alias of this member in the outer scope. if (isInline()) @@ -533,7 +550,7 @@ bool NamespaceDefImpl::hasDetailedDescription() const !documentation().isEmpty()); } -void NamespaceDefImpl::writeTagFile(std::ostream &tagFile) +void NamespaceDefImpl::writeTagFile(TextStream &tagFile) { tagFile << " <compound kind=\"namespace\">\n"; tagFile << " <name>" << convertToXML(name()) << "</name>\n"; @@ -578,6 +595,11 @@ void NamespaceDefImpl::writeTagFile(std::ostream &tagFile) writeClassesToTagFile(tagFile, exceptions); } break; + case LayoutDocEntry::NamespaceConcepts: + { + writeConceptsToTagFile(tagFile); + } + break; case LayoutDocEntry::MemberDecl: { const LayoutDocEntryMemberDecl *lmd = (const LayoutDocEntryMemberDecl*)lde.get(); @@ -614,7 +636,7 @@ void NamespaceDefImpl::writeDetailedDescription(OutputList &ol,const QCString &t ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - ol.writeAnchor(0,"details"); + ol.writeAnchor(QCString(),"details"); ol.popGeneratorState(); ol.startGroupHeader(); ol.parseText(title); @@ -624,7 +646,7 @@ void NamespaceDefImpl::writeDetailedDescription(OutputList &ol,const QCString &t if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) { ol.generateDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) && !documentation().isEmpty()) @@ -642,7 +664,7 @@ void NamespaceDefImpl::writeDetailedDescription(OutputList &ol,const QCString &t if (!documentation().isEmpty()) { ol.generateDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } ol.endTextBlock(); } @@ -654,7 +676,7 @@ void NamespaceDefImpl::writeBriefDescription(OutputList &ol) { DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0, briefDescription(),TRUE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); if (rootNode && !rootNode->isEmpty()) { ol.startParagraph(); @@ -740,6 +762,11 @@ void NamespaceDefImpl::writeClassDeclarations(OutputList &ol,const QCString &tit d.writeDeclaration(ol,0,title,TRUE); } +void NamespaceDefImpl::writeConcepts(OutputList &ol,const QCString &title) +{ + m_concepts.writeDeclaration(ol,title,TRUE); +} + void NamespaceDefImpl::writeInlineClasses(OutputList &ol) { classes.writeDocumentation(ol,this); @@ -788,35 +815,42 @@ void NamespaceDefImpl::writeSummaryLinks(OutputList &ol) const { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "nested-classes"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceInterfaces && interfaces.declVisible()) { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "interfaces"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceStructs && structs.declVisible()) { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "structs"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceExceptions && exceptions.declVisible()) { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "exceptions"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceNestedNamespaces && namespaces.declVisible()) { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); QCString label = "namespaces"; - ol.writeSummaryLink(0,label,ls->title(lang),first); + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); + first=FALSE; + } + else if (lde->kind()==LayoutDocEntry::NamespaceConcepts && m_concepts.declVisible()) + { + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); + QCString label = "concepts"; + ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()== LayoutDocEntry::MemberDecl) @@ -825,7 +859,7 @@ void NamespaceDefImpl::writeSummaryLinks(OutputList &ol) const MemberList * ml = getMemberList(lmd->type); if (ml && ml->declVisible()) { - ol.writeSummaryLink(0,MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first); + ol.writeSummaryLink(QCString(),MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first); first=FALSE; } } @@ -851,7 +885,7 @@ void NamespaceDefImpl::addNamespaceAttributes(OutputList &ol) } } -void NamespaceDefImpl::writeClassesToTagFile(std::ostream &tagFile,const ClassLinkedRefMap &list) +void NamespaceDefImpl::writeClassesToTagFile(TextStream &tagFile,const ClassLinkedRefMap &list) { for (const auto &cd : list) { @@ -863,6 +897,17 @@ void NamespaceDefImpl::writeClassesToTagFile(std::ostream &tagFile,const ClassLi } } +void NamespaceDefImpl::writeConceptsToTagFile(TextStream &tagFile) +{ + for (const auto &cd : m_concepts) + { + if (cd->isLinkableInProject()) + { + tagFile << " <concept>" << convertToXML(cd->name()) << "</concept>\n"; + } + } +} + void NamespaceDefImpl::writeDocumentation(OutputList &ol) { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); @@ -933,6 +978,12 @@ void NamespaceDefImpl::writeDocumentation(OutputList &ol) writeClassDeclarations(ol,ls->title(lang),exceptions); } break; + case LayoutDocEntry::NamespaceConcepts: + { + const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); + writeConcepts(ol,ls->title(lang)); + } + break; case LayoutDocEntry::NamespaceNestedNamespaces: { const LayoutDocEntrySection *ls = (const LayoutDocEntrySection*)lde.get(); @@ -988,7 +1039,9 @@ void NamespaceDefImpl::writeDocumentation(OutputList &ol) case LayoutDocEntry::ClassAllMembersLink: case LayoutDocEntry::ClassUsedFiles: case LayoutDocEntry::ClassInlineClasses: + case LayoutDocEntry::ConceptDefinition: case LayoutDocEntry::FileClasses: + case LayoutDocEntry::FileConcepts: case LayoutDocEntry::FileInterfaces: case LayoutDocEntry::FileStructs: case LayoutDocEntry::FileExceptions: @@ -1000,6 +1053,7 @@ void NamespaceDefImpl::writeDocumentation(OutputList &ol) case LayoutDocEntry::FileSourceLink: case LayoutDocEntry::FileInlineClasses: case LayoutDocEntry::GroupClasses: + case LayoutDocEntry::GroupConcepts: case LayoutDocEntry::GroupInlineClasses: case LayoutDocEntry::GroupNamespaces: case LayoutDocEntry::GroupDirs: @@ -1109,7 +1163,7 @@ int NamespaceDefImpl::numDocMembers() const void NamespaceDefImpl::addUsingDirective(const NamespaceDef *nd) { m_usingDirList.add(nd->qualifiedName(),nd); - //printf("%p: NamespaceDefImpl::addUsingDirective: %s:%d\n",this,name().data(),m_usingDirList->count()); + //printf("%p: NamespaceDefImpl::addUsingDirective: %s:%d\n",this,qPrint(name()),m_usingDirList->count()); } void NamespaceDefImpl::addUsingDeclaration(const ClassDef *cd) @@ -1122,7 +1176,7 @@ QCString NamespaceDefImpl::getOutputFileBase() const return fileName; } -const Definition *NamespaceDefImpl::findInnerCompound(const char *n) const +const Definition *NamespaceDefImpl::findInnerCompound(const QCString &n) const { if (n==0) return 0; const Definition *d = m_innerCompounds.find(n); @@ -1151,7 +1205,7 @@ void NamespaceDefImpl::addListReferences() theTranslator->trModule(TRUE,TRUE) : theTranslator->trNamespace(TRUE,TRUE), getOutputFileBase(),displayName(), - 0, + QCString(), this ); } @@ -1228,7 +1282,7 @@ bool NamespaceLinkedRefMap::declVisible() const return FALSE; } -void NamespaceLinkedRefMap::writeDeclaration(OutputList &ol,const char *title, +void NamespaceLinkedRefMap::writeDeclaration(OutputList &ol,const QCString &title, bool const isConstantGroup,bool localName) { @@ -1293,16 +1347,16 @@ void NamespaceLinkedRefMap::writeDeclaration(OutputList &ol,const char *title, { name = nd->displayName(); } - ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),0,name); + ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),QCString(),name); ol.endMemberItem(); if (!nd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { ol.startMemberDescription(nd->getOutputFileBase()); ol.generateDoc(nd->briefFile(),nd->briefLine(),nd,0,nd->briefDescription(),FALSE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberDescription(); } - ol.endMemberDeclaration(0,0); + ol.endMemberDeclaration(QCString(),QCString()); } } ol.endMemberList(); @@ -1337,23 +1391,19 @@ void NamespaceDefImpl::sortMemberLists() if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } } - if (Config_getBool(SORT_BRIEF_DOCS)) + auto classComp = [](const ClassLinkedRefMap::Ptr &c1,const ClassLinkedRefMap::Ptr &c2) { - auto classComp = [](const ClassLinkedRefMap::Ptr &c1,const ClassLinkedRefMap::Ptr &c2) - { - return Config_getBool(SORT_BY_SCOPE_NAME) ? - qstricmp(c1->name(), c2->name())<0 : - qstricmp(c1->className(), c2->className())<0; - }; + return Config_getBool(SORT_BY_SCOPE_NAME) ? + qstricmp(c1->name(), c2->name())<0 : + qstricmp(c1->className(), c2->className())<0; + }; - std::sort(classes.begin(), classes.end(), classComp); - std::sort(interfaces.begin(),interfaces.end(),classComp); - std::sort(structs.begin(), structs.end(), classComp); - std::sort(exceptions.begin(),exceptions.end(),classComp); + std::sort(classes.begin(), classes.end(), classComp); + std::sort(interfaces.begin(),interfaces.end(),classComp); + std::sort(structs.begin(), structs.end(), classComp); + std::sort(exceptions.begin(),exceptions.end(),classComp); - } - // TODO: inconsistent: should be only done when SORT_BRIEF_DOCS is enabled... auto namespaceComp = [](const NamespaceLinkedRefMap::Ptr &n1,const NamespaceLinkedRefMap::Ptr &n2) { return qstricmp(n1->name(),n2->name())<0; @@ -1377,7 +1427,7 @@ MemberList *NamespaceDefImpl::getMemberList(MemberListType lt) const void NamespaceDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title) { MemberList * ml = getMemberList(lt); - if (ml) ml->writeDeclarations(ol,0,this,0,0,title,0); + if (ml) ml->writeDeclarations(ol,0,this,0,0,title,QCString()); } void NamespaceDefImpl::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title) @@ -1449,7 +1499,7 @@ QCString NamespaceDefImpl::compoundTypeString() const } else if(lang==SrcLangExt_CSharp) { - return "namespace"; + return "namespace"; } else if (lang==SrcLangExt_Fortran) { @@ -1474,7 +1524,7 @@ QCString NamespaceDefImpl::compoundTypeString() const err_full(getDefFileName(),getDefLine(),"Internal inconsistency: namespace in IDL not module, library or constant group"); } } - return ""; + return "namespace"; } void NamespaceDefImpl::setMetaData(const QCString &m) diff --git a/src/namespacedef.h b/src/namespacedef.h index dfe43a7..93fff75 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -25,8 +25,10 @@ class MemberList; class ClassDef; +class ConceptDef; class OutputList; class ClassLinkedRefMap; +class ConceptLinkedRefMap; class MemberDef; class NamespaceDef; class NamespaceDef; @@ -43,7 +45,7 @@ class NamespaceLinkedMap : public LinkedMap<NamespaceDef> class NamespaceLinkedRefMap : public LinkedRefMap<const NamespaceDef> { public: - void writeDeclaration(OutputList &ol,const char *title, + void writeDeclaration(OutputList &ol,const QCString &title, bool isConstantGroup=false, bool localName=FALSE); bool declVisible() const; }; @@ -70,7 +72,7 @@ class NamespaceDef : public Definition virtual bool isLinkableInProject() const = 0; virtual bool isLinkable() const = 0; virtual bool hasDetailedDescription() const = 0; - virtual const Definition *findInnerCompound(const char *name) const = 0; + virtual const Definition *findInnerCompound(const QCString &name) const = 0; virtual bool subGrouping() const = 0; virtual MemberList *getMemberList(MemberListType lt) const = 0; virtual const MemberLists &getMemberLists() const = 0; @@ -94,6 +96,9 @@ class NamespaceDef : public Definition /*! Returns the namespaces contained in this namespace */ virtual NamespaceLinkedRefMap getNamespaces() const = 0; + /*! Returns the concepts contained in this namespace */ + virtual ConceptLinkedRefMap getConcepts() const = 0; + virtual QCString title() const = 0; virtual QCString compoundTypeString() const = 0; }; @@ -108,8 +113,9 @@ class NamespaceDefMutable : public DefinitionMutable, public NamespaceDef virtual void writeDocumentation(OutputList &ol) = 0; virtual void writeMemberPages(OutputList &ol) = 0; virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const = 0; - virtual void writeTagFile(std::ostream &) = 0; + virtual void writeTagFile(TextStream &) = 0; virtual void insertClass(const ClassDef *cd) = 0; + virtual void insertConcept(const ConceptDef *cd) = 0; virtual void insertNamespace(const NamespaceDef *nd) = 0; virtual void insertMember(MemberDef *md) = 0; // md cannot be const, since setSectionList is called on it virtual void computeAnchors() = 0; @@ -128,9 +134,9 @@ class NamespaceDefMutable : public DefinitionMutable, public NamespaceDef }; /** Factory method to create new NamespaceDef instance */ -NamespaceDefMutable *createNamespaceDef(const char *defFileName,int defLine,int defColumn, - const char *name,const char *ref=0, - const char *refFile=0,const char*type=0, +NamespaceDefMutable *createNamespaceDef(const QCString &defFileName,int defLine,int defColumn, + const QCString &name,const QCString &ref=QCString(), + const QCString &refFile=QCString(),const QCString &type=QCString(), bool isPublished=false); /** Factory method to create an alias of an existing namespace. Used for inline namespaces. */ diff --git a/src/outputgen.cpp b/src/outputgen.cpp index d922a93..709d000 100644 --- a/src/outputgen.cpp +++ b/src/outputgen.cpp @@ -24,7 +24,7 @@ #include "message.h" #include "portable.h" -OutputGenerator::OutputGenerator(const char *dir) : t(nullptr), m_dir(dir) +OutputGenerator::OutputGenerator(const QCString &dir) : m_t(nullptr), m_dir(dir) { //printf("OutputGenerator::OutputGenerator()\n"); } @@ -34,12 +34,12 @@ OutputGenerator::~OutputGenerator() //printf("OutputGenerator::~OutputGenerator()\n"); } -OutputGenerator::OutputGenerator(const OutputGenerator &og) : t(nullptr) +OutputGenerator::OutputGenerator(const OutputGenerator &og) : m_t(nullptr) { m_dir = og.m_dir; // we don't copy the other fields. // after copying startPlainFile() should be called - if (og.t.rdbuf()!=nullptr) + if (og.m_t.stream()!=nullptr) { throw std::runtime_error("OutputGenerator copy constructor called while a file is processing"); } @@ -50,29 +50,30 @@ OutputGenerator &OutputGenerator::operator=(const OutputGenerator &og) m_dir = og.m_dir; // we don't copy the other fields. // after assignment startPlainFile() should be called - if (og.t.rdbuf()!=nullptr) + if (og.m_t.stream()!=nullptr) { throw std::runtime_error("OutputGenerator assignment operator called while a file is processing"); } return *this; } -void OutputGenerator::startPlainFile(const char *name) +void OutputGenerator::startPlainFile(const QCString &name) { - //printf("startPlainFile(%s)\n",name); + //printf("startPlainFile(%s)\n",qPrint(name)); m_fileName=m_dir+"/"+name; - m_file.open(m_fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!m_file.is_open()) + m_file = Portable::fopen(m_fileName.data(),"wb"); + if (m_file==0) { - term("Could not open file %s for writing\n",m_fileName.data()); + term("Could not open file %s for writing\n",qPrint(m_fileName)); } - t.rdbuf(m_file.rdbuf()); + m_t.setFile(m_file); } void OutputGenerator::endPlainFile() { - t.rdbuf(nullptr); - m_file.close(); + m_t.flush(); + m_t.setStream(nullptr); + Portable::fclose(m_file); m_fileName.resize(0); } diff --git a/src/outputgen.h b/src/outputgen.h index 7a4571d..53972d4 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -25,6 +25,7 @@ #include "index.h" #include "section.h" +#include "textstream.h" class ClassDiagram; class DotClassGraph; @@ -68,7 +69,7 @@ class CodeOutputInterface * spaces visible, should break lines at a newline and should convert * tabs to the right number of spaces. */ - virtual void codify(const char *s) = 0; + virtual void codify(const QCString &s) = 0; /*! Writes a link to an object in a code fragment. * \param ref If this is non-zero, the object is to be found in @@ -79,9 +80,9 @@ class CodeOutputInterface * \param name The text to display as a placeholder for the link. * \param tooltip The tooltip to display when the mouse is on the link. */ - virtual void writeCodeLink(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip) = 0; + virtual void writeCodeLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip) = 0; /*! Writes the line number of a source listing * \param ref External reference (when imported from a tag file) @@ -89,8 +90,8 @@ class CodeOutputInterface * \param anchor The anchor part of the URL pointing to the docs. * \param lineNumber The line number to write */ - virtual void writeLineNumber(const char *ref,const char *file, - const char *anchor,int lineNumber) = 0; + virtual void writeLineNumber(const QCString &ref,const QCString &file, + const QCString &anchor,int lineNumber) = 0; /*! Writes a tool tip definition * \param id unique identifier for the tooltip @@ -100,10 +101,10 @@ class CodeOutputInterface * \param defInfo Info about the symbol's definition in the source code * \param declInfo Info about the symbol's declaration in the source code */ - virtual void writeTooltip(const char *id, + virtual void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, - const char *decl, - const char *desc, + const QCString &decl, + const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo ) = 0; @@ -117,7 +118,7 @@ class CodeOutputInterface * which elements of the same type are rendered using the same 'font class'. * \param clsName The category name. */ - virtual void startFontClass(const char *clsName) = 0; + virtual void startFontClass(const QCString &clsName) = 0; /*! Ends a block started with startFontClass() */ virtual void endFontClass() = 0; @@ -125,10 +126,10 @@ class CodeOutputInterface /*! Write an anchor to a source listing. * \param name The name of the anchor. */ - virtual void writeCodeAnchor(const char *name) = 0; + virtual void writeCodeAnchor(const QCString &name) = 0; - virtual void setCurrentDoc(const Definition *context,const char *anchor,bool isSourceFile) = 0; - virtual void addWord(const char *word,bool hiPriority) = 0; + virtual void setCurrentDoc(const Definition *context,const QCString &anchor,bool isSourceFile) = 0; + virtual void addWord(const QCString &word,bool hiPriority) = 0; /*! Starts a source code fragment. The fragment will be * fed to the code parser (see code.h) for syntax highlighting @@ -136,9 +137,9 @@ class CodeOutputInterface * endCodeFragment() * @param style The kind of code fragment. */ - virtual void startCodeFragment(const char *style) = 0; + virtual void startCodeFragment(const QCString &style) = 0; /*! Ends a block of code */ - virtual void endCodeFragment(const char *style) = 0; + virtual void endCodeFragment(const QCString &style) = 0; }; /** Base Interface used for generating output outside of the @@ -186,7 +187,7 @@ class BaseOutputDocInterface : public CodeOutputInterface /*! Writes an ASCII string to the output. Converts characters that have * A special meaning, like \c & in html. */ - virtual void docify(const char *s) = 0; + virtual void docify(const QCString &s) = 0; /*! Writes a single ASCII character to the output. Converts characters * that have a special meaning. @@ -196,13 +197,13 @@ class BaseOutputDocInterface : public CodeOutputInterface /*! Writes an ASCII string to the output, \e without converting * special characters. */ - virtual void writeString(const char *text) = 0; + virtual void writeString(const QCString &text) = 0; /*! Starts a new paragraph */ //virtual void newParagraph() = 0; /*! Starts a new paragraph */ - virtual void startParagraph(const char *classDef) = 0; + virtual void startParagraph(const QCString &classDef) = 0; /*! Ends a paragraph */ virtual void endParagraph() = 0; @@ -214,14 +215,14 @@ class BaseOutputDocInterface : public CodeOutputInterface * the file. * \param name The text to display as a placeholder for the link. */ - virtual void writeObjectLink(const char *ref,const char *file, - const char *anchor, const char *name) = 0; + virtual void writeObjectLink(const QCString &ref,const QCString &file, + const QCString &anchor, const QCString &name) = 0; /*! Starts a (link to an) URL found in the documentation. * \param url The URL to link to. */ - virtual void startHtmlLink(const char *url) = 0; + virtual void startHtmlLink(const QCString &url) = 0; /*! Ends a link started by startHtmlLink(). */ @@ -281,22 +282,22 @@ class BaseOutputDocInterface : public CodeOutputInterface virtual void startExamples() = 0; virtual void endExamples() = 0; - virtual void startParamList(ParamListTypes t,const char *title) = 0; + virtual void startParamList(ParamListTypes t,const QCString &title) = 0; virtual void endParamList() = 0; //virtual void writeDescItem() = 0; virtual void startTitle() = 0; virtual void endTitle() = 0; - virtual void writeAnchor(const char *fileName,const char *name) = 0; - virtual void startSection(const char *,const char *,SectionType) = 0; - virtual void endSection(const char *,SectionType) = 0; + virtual void writeAnchor(const QCString &fileName,const QCString &name) = 0; + virtual void startSection(const QCString &,const QCString &,SectionType) = 0; + virtual void endSection(const QCString &,SectionType) = 0; - virtual void lineBreak(const char *style) = 0; - virtual void addIndexItem(const char *s1,const char *s2) = 0; + virtual void lineBreak(const QCString &style) = 0; + virtual void addIndexItem(const QCString &s1,const QCString &s2) = 0; virtual void writeNonBreakableSpace(int) = 0; - virtual void startDescTable(const char *title) = 0; + virtual void startDescTable(const QCString &title) = 0; virtual void endDescTable() = 0; virtual void startDescTableRow() = 0; virtual void endDescTableRow() = 0; @@ -304,10 +305,10 @@ class BaseOutputDocInterface : public CodeOutputInterface virtual void endDescTableTitle() = 0; virtual void startDescTableData() = 0; virtual void endDescTableData() = 0; - virtual void startTextLink(const char *file,const char *anchor) = 0; + virtual void startTextLink(const QCString &file,const QCString &anchor) = 0; virtual void endTextLink() = 0; virtual void startPageRef() = 0; - virtual void endPageRef(const char *,const char *) = 0; + virtual void endPageRef(const QCString &,const QCString &) = 0; virtual void startSubsection() = 0; virtual void endSubsection() = 0; virtual void startSubsubsection() = 0; @@ -323,7 +324,7 @@ class OutputGenerator : public BaseOutputDocInterface public: enum OutputType { Html, Latex, Man, RTF, XML, DEF, Perl , Docbook}; - OutputGenerator(const char *dir); + OutputGenerator(const QCString &dir); OutputGenerator(const OutputGenerator &o); OutputGenerator &operator=(const OutputGenerator &o); virtual ~OutputGenerator(); @@ -344,7 +345,7 @@ class OutputGenerator : public BaseOutputDocInterface QCString dir() const; QCString fileName() const; - void startPlainFile(const char *name); + void startPlainFile(const QCString &name); void endPlainFile(); //QCString getContents() const; bool isEnabled() const { return m_active; } @@ -358,19 +359,19 @@ class OutputGenerator : public BaseOutputDocInterface /////////////////////////////////////////////////////////////// // structural output interface /////////////////////////////////////////////////////////////// - virtual void startFile(const char *name,const char *manName, - const char *title,int id=0) = 0; + virtual void startFile(const QCString &name,const QCString &manName, + const QCString &title,int id=0) = 0; virtual void writeSearchInfo() = 0; - virtual void writeFooter(const char *navPath) = 0; + virtual void writeFooter(const QCString &navPath) = 0; virtual void endFile() = 0; virtual void startIndexSection(IndexSections) = 0; virtual void endIndexSection(IndexSections) = 0; - virtual void writePageLink(const char *,bool) = 0; + virtual void writePageLink(const QCString &,bool) = 0; virtual void startProjectNumber() = 0; virtual void endProjectNumber() = 0; virtual void writeStyleInfo(int part) = 0; - virtual void startTitleHead(const char *) = 0; - virtual void endTitleHead(const char *fileName,const char *name) = 0; + virtual void startTitleHead(const QCString &) = 0; + virtual void endTitleHead(const QCString &fileName,const QCString &name) = 0; virtual void startIndexListItem() = 0; virtual void endIndexListItem() = 0; virtual void startIndexList() = 0; @@ -378,16 +379,16 @@ class OutputGenerator : public BaseOutputDocInterface virtual void startIndexKey() = 0; virtual void endIndexKey() = 0; virtual void startIndexValue(bool) = 0; - virtual void endIndexValue(const char *,bool) = 0; - virtual void startIndexItem(const char *ref,const char *file) = 0; - virtual void endIndexItem(const char *ref,const char *file) = 0; + virtual void endIndexValue(const QCString &,bool) = 0; + virtual void startIndexItem(const QCString &ref,const QCString &file) = 0; + virtual void endIndexItem(const QCString &ref,const QCString &file) = 0; virtual void startGroupHeader(int) = 0; virtual void endGroupHeader(int) = 0; virtual void startMemberSections() = 0; virtual void endMemberSections() = 0; virtual void startHeaderSection() = 0; virtual void endHeaderSection() = 0; - virtual void startMemberHeader(const char *anchor, int typ) = 0; + virtual void startMemberHeader(const QCString &anchor, int typ) = 0; virtual void endMemberHeader() = 0; virtual void startMemberSubtitle() = 0; virtual void endMemberSubtitle() = 0; @@ -399,10 +400,12 @@ class OutputGenerator : public BaseOutputDocInterface virtual void endInlineHeader() = 0; virtual void startAnonTypeScope(int) = 0; virtual void endAnonTypeScope(int) = 0; - virtual void startMemberItem(const char *,int,const char *) = 0; + virtual void startMemberItem(const QCString &,int,const QCString &) = 0; virtual void endMemberItem() = 0; virtual void startMemberTemplateParams() = 0; - virtual void endMemberTemplateParams(const char *,const char *) = 0; + virtual void endMemberTemplateParams(const QCString &,const QCString &) = 0; + virtual void startCompoundTemplateParams() = 0; + virtual void endCompoundTemplateParams() = 0; virtual void startMemberGroupHeader(bool) = 0; virtual void endMemberGroupHeader() = 0; virtual void startMemberGroupDocs() = 0; @@ -411,29 +414,29 @@ class OutputGenerator : public BaseOutputDocInterface virtual void endMemberGroup(bool) = 0; virtual void insertMemberAlign(bool) = 0; virtual void insertMemberAlignLeft(int,bool) = 0; - virtual void startMemberDoc(const char *,const char *, - const char *,const char *,int,int,bool) = 0; + virtual void startMemberDoc(const QCString &,const QCString &, + const QCString &,const QCString &,int,int,bool) = 0; virtual void endMemberDoc(bool) = 0; - virtual void startDoxyAnchor(const char *fName,const char *manName, - const char *anchor,const char *name, - const char *args) = 0; - virtual void endDoxyAnchor(const char *fileName,const char *anchor) = 0; + virtual void startDoxyAnchor(const QCString &fName,const QCString &manName, + const QCString &anchor,const QCString &name, + const QCString &args) = 0; + virtual void endDoxyAnchor(const QCString &fileName,const QCString &anchor) = 0; virtual void writeLatexSpacing() = 0; - virtual void writeStartAnnoItem(const char *type,const char *file, - const char *path,const char *name) = 0; - virtual void writeEndAnnoItem(const char *name) = 0; - virtual void startMemberDescription(const char *anchor,const char *inheritId, bool typ) = 0; + virtual void writeStartAnnoItem(const QCString &type,const QCString &file, + const QCString &path,const QCString &name) = 0; + virtual void writeEndAnnoItem(const QCString &name) = 0; + virtual void startMemberDescription(const QCString &anchor,const QCString &inheritId, bool typ) = 0; virtual void endMemberDescription() = 0; virtual void startMemberDeclaration() = 0; - virtual void endMemberDeclaration(const char *anchor,const char *inheritId) = 0; - virtual void writeInheritedSectionTitle(const char *id,const char *ref, - const char *file,const char *anchor, - const char *title,const char *name) = 0; + virtual void endMemberDeclaration(const QCString &anchor,const QCString &inheritId) = 0; + virtual void writeInheritedSectionTitle(const QCString &id,const QCString &ref, + const QCString &file,const QCString &anchor, + const QCString &title,const QCString &name) = 0; virtual void startIndent() = 0; virtual void endIndent() = 0; virtual void writeSynopsis() = 0; virtual void startClassDiagram() = 0; - virtual void endClassDiagram(const ClassDiagram &,const char *,const char *) = 0; + virtual void endClassDiagram(const ClassDiagram &,const QCString &,const QCString &) = 0; virtual void startDotGraph() = 0; virtual void endDotGraph(DotClassGraph &g) = 0; virtual void startInclDepGraph() = 0; @@ -447,14 +450,14 @@ class OutputGenerator : public BaseOutputDocInterface virtual void writeGraphicalHierarchy(DotGfxHierarchyTable &g) = 0; virtual void startQuickIndices() = 0; virtual void endQuickIndices() = 0; - virtual void writeSplitBar(const char *) = 0; - virtual void writeNavigationPath(const char *) = 0; + virtual void writeSplitBar(const QCString &) = 0; + virtual void writeNavigationPath(const QCString &) = 0; virtual void writeLogo() = 0; - virtual void writeQuickLinks(bool compact,HighlightedItem hli,const char *file) = 0; - virtual void writeSummaryLink(const char *file,const char *anchor,const char *title,bool first) = 0; + virtual void writeQuickLinks(bool compact,HighlightedItem hli,const QCString &file) = 0; + virtual void writeSummaryLink(const QCString &file,const QCString &anchor,const QCString &title,bool first) = 0; virtual void startContents() = 0; virtual void endContents() = 0; - virtual void startPageDoc(const char *) {} + virtual void startPageDoc(const QCString &) {} virtual void endPageDoc() {} virtual void startTextBlock(bool) = 0; virtual void endTextBlock(bool) = 0; @@ -463,15 +466,15 @@ class OutputGenerator : public BaseOutputDocInterface virtual void endMemberDocPrefixItem() = 0; virtual void startMemberDocName(bool) = 0; virtual void endMemberDocName() = 0; - virtual void startParameterType(bool,const char *key) = 0; + virtual void startParameterType(bool,const QCString &key) = 0; virtual void endParameterType() = 0; virtual void startParameterName(bool) = 0; virtual void endParameterName(bool,bool,bool) = 0; virtual void startParameterList(bool) = 0; virtual void endParameterList() = 0; - virtual void exceptionEntry(const char*,bool) = 0; + virtual void exceptionEntry(const QCString &,bool) = 0; - virtual void startConstraintList(const char *) = 0; + virtual void startConstraintList(const QCString &) = 0; virtual void startConstraintParam() = 0; virtual void endConstraintParam() = 0; virtual void startConstraintType() = 0; @@ -491,15 +494,15 @@ class OutputGenerator : public BaseOutputDocInterface virtual void startLabels() = 0; - virtual void writeLabel(const char *,bool) = 0; + virtual void writeLabel(const QCString &,bool) = 0; virtual void endLabels() = 0; protected: - std::ostream t; + TextStream m_t; private: QCString m_dir; QCString m_fileName; - std::ofstream m_file; + FILE *m_file; bool m_active = true; std::stack<bool> m_genStack; }; diff --git a/src/outputlist.cpp b/src/outputlist.cpp index 0226a10..e4f0fe2 100644 --- a/src/outputlist.cpp +++ b/src/outputlist.cpp @@ -139,10 +139,10 @@ void OutputList::popGeneratorState() } } -void OutputList::generateDoc(const char *fileName,int startLine, +void OutputList::generateDoc(const QCString &fileName,int startLine, const Definition *ctx,const MemberDef * md, const QCString &docStr,bool indexWords, - bool isExample,const char *exampleName, + bool isExample,const QCString &exampleName, bool singleLine,bool linkFromIndex, bool markdownSupport) { @@ -171,7 +171,7 @@ void OutputList::writeDoc(DocRoot *root,const Definition *ctx,const MemberDef *m for (const auto &og : m_outputs) { //printf("og->printDoc(extension=%s)\n", - // ctx?ctx->getDefFileExtension().data():"<null>"); + // ctx?qPrint(ctx->getDefFileExtension()):"<null>"); if (og->isEnabled()) og->writeDoc(root,ctx,md,m_id); } VhdlDocGen::setFlowMember(0); diff --git a/src/outputlist.h b/src/outputlist.h index 7baef7a..eadf85f 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -65,9 +65,9 @@ class OutputList : public OutputDocInterface // OutputDocInterface implementation ////////////////////////////////////////////////// - void generateDoc(const char *fileName,int startLine, + void generateDoc(const QCString &fileName,int startLine, const Definition *ctx,const MemberDef *md,const QCString &docStr, - bool indexWords,bool isExample,const char *exampleName /*=0*/, + bool indexWords,bool isExample,const QCString &exampleName /*=0*/, bool singleLine /*=FALSE*/,bool linkFromIndex /*=FALSE*/, bool markdownSupport /*=FALSE*/); void writeDoc(DocRoot *root,const Definition *ctx,const MemberDef *md,int id=0); @@ -77,7 +77,7 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::startIndexSection,is); } void endIndexSection(IndexSections is) { forall(&OutputGenerator::endIndexSection,is); } - void writePageLink(const char *name,bool first) + void writePageLink(const QCString &name,bool first) { forall(&OutputGenerator::writePageLink,name,first); } void startProjectNumber() { forall(&OutputGenerator::startProjectNumber); } @@ -85,30 +85,30 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::endProjectNumber); } void writeStyleInfo(int part) { forall(&OutputGenerator::writeStyleInfo,part); } - void startFile(const char *name,const char *manName,const char *title) + void startFile(const QCString &name,const QCString &manName,const QCString &title) { newId(); forall(&OutputGenerator::startFile,name,manName,title,m_id); } void writeSearchInfo() { forall(&OutputGenerator::writeSearchInfo); } - void writeFooter(const char *navPath) + void writeFooter(const QCString &navPath) { forall(&OutputGenerator::writeFooter,navPath); } void endFile() { forall(&OutputGenerator::endFile); } - void startTitleHead(const char *fileName) + void startTitleHead(const QCString &fileName) { forall(&OutputGenerator::startTitleHead,fileName); } - void endTitleHead(const char *fileName,const char *name) + void endTitleHead(const QCString &fileName,const QCString &name) { forall(&OutputGenerator::endTitleHead,fileName,name); } void startTitle() { forall(&OutputGenerator::startTitle); } void endTitle() { forall(&OutputGenerator::endTitle); } - void startParagraph(const char *classDef=0) + void startParagraph(const QCString &classDef=QCString()) { forall(&OutputGenerator::startParagraph,classDef); } void endParagraph() { forall(&OutputGenerator::endParagraph); } - void writeString(const char *text) + void writeString(const QCString &text) { forall(&OutputGenerator::writeString,text); } void startIndexListItem() { forall(&OutputGenerator::startIndexListItem); } @@ -124,42 +124,42 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::endIndexKey); } void startIndexValue(bool b) { forall(&OutputGenerator::startIndexValue,b); } - void endIndexValue(const char *name,bool b) + void endIndexValue(const QCString &name,bool b) { forall(&OutputGenerator::endIndexValue,name,b); } void startItemList() { forall(&OutputGenerator::startItemList); } void endItemList() { forall(&OutputGenerator::endItemList); } - void startIndexItem(const char *ref,const char *file) + void startIndexItem(const QCString &ref,const QCString &file) { forall(&OutputGenerator::startIndexItem,ref,file); } - void endIndexItem(const char *ref,const char *file) + void endIndexItem(const QCString &ref,const QCString &file) { forall(&OutputGenerator::endIndexItem,ref,file); } - void docify(const char *s) + void docify(const QCString &s) { forall(&OutputGenerator::docify,s); } - void codify(const char *s) + void codify(const QCString &s) { forall(&OutputGenerator::codify,s); } - void writeObjectLink(const char *ref,const char *file, - const char *anchor, const char *name) + void writeObjectLink(const QCString &ref,const QCString &file, + const QCString &anchor, const QCString &name) { forall(&OutputGenerator::writeObjectLink,ref,file,anchor,name); } - void writeCodeLink(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip) + void writeCodeLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip) { forall(&OutputGenerator::writeCodeLink,ref,file,anchor,name,tooltip); } - void writeTooltip(const char *id, const DocLinkInfo &docInfo, const char *decl, - const char *desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo) + void writeTooltip(const QCString &id, const DocLinkInfo &docInfo, const QCString &decl, + const QCString &desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo) { forall(&OutputGenerator::writeTooltip,id,docInfo,decl,desc,defInfo,declInfo); } - void startTextLink(const char *file,const char *anchor) + void startTextLink(const QCString &file,const QCString &anchor) { forall(&OutputGenerator::startTextLink,file,anchor); } void endTextLink() { forall(&OutputGenerator::endTextLink); } - void startHtmlLink(const char *url) + void startHtmlLink(const QCString &url) { forall(&OutputGenerator::startHtmlLink,url); } void endHtmlLink() { forall(&OutputGenerator::endHtmlLink); } - void writeStartAnnoItem(const char *type,const char *file, - const char *path,const char *name) + void writeStartAnnoItem(const QCString &type,const QCString &file, + const QCString &path,const QCString &name) { forall(&OutputGenerator::writeStartAnnoItem,type,file,path,name); } - void writeEndAnnoItem(const char *name) + void writeEndAnnoItem(const QCString &name) { forall(&OutputGenerator::writeEndAnnoItem,name); } void startTypewriter() { forall(&OutputGenerator::startTypewriter); } @@ -181,7 +181,7 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::startHeaderSection); } void endHeaderSection() { forall(&OutputGenerator::endHeaderSection); } - void startMemberHeader(const char *anchor, int typ = 2) + void startMemberHeader(const QCString &anchor, int typ = 2) { forall(&OutputGenerator::startMemberHeader,anchor,typ); } void endMemberHeader() { forall(&OutputGenerator::endMemberHeader); } @@ -205,14 +205,18 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::startAnonTypeScope,i1); } void endAnonTypeScope(int i1) { forall(&OutputGenerator::endAnonTypeScope,i1); } - void startMemberItem(const char *anchor,int i1,const char *id=0) + void startMemberItem(const QCString &anchor,int i1,const QCString &id=QCString()) { forall(&OutputGenerator::startMemberItem,anchor,i1,id); } void endMemberItem() { forall(&OutputGenerator::endMemberItem); } void startMemberTemplateParams() { forall(&OutputGenerator::startMemberTemplateParams); } - void endMemberTemplateParams(const char *anchor,const char *inheritId) + void endMemberTemplateParams(const QCString &anchor,const QCString &inheritId) { forall(&OutputGenerator::endMemberTemplateParams,anchor,inheritId); } + void startCompoundTemplateParams() + { forall(&OutputGenerator::startCompoundTemplateParams); } + void endCompoundTemplateParams() + { forall(&OutputGenerator::endCompoundTemplateParams); } void startMemberGroupHeader(bool b) { forall(&OutputGenerator::startMemberGroupHeader,b); } void endMemberGroupHeader() @@ -231,17 +235,17 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::insertMemberAlignLeft,typ,templ); } void writeRuler() { forall(&OutputGenerator::writeRuler); } - void writeAnchor(const char *fileName,const char *name) + void writeAnchor(const QCString &fileName,const QCString &name) { forall(&OutputGenerator::writeAnchor,fileName,name); } - void startCodeFragment(const char *style) + void startCodeFragment(const QCString &style) { forall(&OutputGenerator::startCodeFragment,style); } - void endCodeFragment(const char *style) + void endCodeFragment(const QCString &style) { forall(&OutputGenerator::endCodeFragment,style); } void startCodeLine(bool hasLineNumbers) { forall(&OutputGenerator::startCodeLine,hasLineNumbers); } void endCodeLine() { forall(&OutputGenerator::endCodeLine); } - void writeLineNumber(const char *ref,const char *file,const char *anchor, + void writeLineNumber(const QCString &ref,const QCString &file,const QCString &anchor, int lineNumber) { forall(&OutputGenerator::writeLineNumber,ref,file,anchor,lineNumber); } void startEmphasis() @@ -250,17 +254,17 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::endEmphasis); } void writeChar(char c) { forall(&OutputGenerator::writeChar,c); } - void startMemberDoc(const char *clName,const char *memName, - const char *anchor,const char *title, + void startMemberDoc(const QCString &clName,const QCString &memName, + const QCString &anchor,const QCString &title, int memCount,int memTotal,bool showInline) { forall(&OutputGenerator::startMemberDoc,clName,memName,anchor,title,memCount,memTotal,showInline); } void endMemberDoc(bool hasArgs) { forall(&OutputGenerator::endMemberDoc,hasArgs); } - void startDoxyAnchor(const char *fName,const char *manName, - const char *anchor, const char *name, - const char *args) + void startDoxyAnchor(const QCString &fName,const QCString &manName, + const QCString &anchor, const QCString &name, + const QCString &args) { forall(&OutputGenerator::startDoxyAnchor,fName,manName,anchor,name,args); } - void endDoxyAnchor(const char *fn,const char *anchor) + void endDoxyAnchor(const QCString &fn,const QCString &anchor) { forall(&OutputGenerator::endDoxyAnchor,fn,anchor); } void writeLatexSpacing() { forall(&OutputGenerator::writeLatexSpacing); } @@ -292,30 +296,30 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::startSmall); } void endSmall() { forall(&OutputGenerator::endSmall); } - void lineBreak(const char *style=0) + void lineBreak(const QCString &style=QCString()) { forall(&OutputGenerator::lineBreak,style); } void startBold() { forall(&OutputGenerator::startBold); } void endBold() { forall(&OutputGenerator::endBold); } - void startMemberDescription(const char *anchor,const char *inheritId=0, bool typ = false) + void startMemberDescription(const QCString &anchor,const QCString &inheritId=QCString(), bool typ = false) { forall(&OutputGenerator::startMemberDescription,anchor,inheritId, typ); } void endMemberDescription() { forall(&OutputGenerator::endMemberDescription); } void startMemberDeclaration() { forall(&OutputGenerator::startMemberDeclaration); } - void endMemberDeclaration(const char *anchor,const char *inheritId) + void endMemberDeclaration(const QCString &anchor,const QCString &inheritId) { forall(&OutputGenerator::endMemberDeclaration,anchor,inheritId); } - void writeInheritedSectionTitle(const char *id, const char *ref, - const char *file, const char *anchor, - const char *title,const char *name) + void writeInheritedSectionTitle(const QCString &id, const QCString &ref, + const QCString &file, const QCString &anchor, + const QCString &title,const QCString &name) { forall(&OutputGenerator::writeInheritedSectionTitle,id,ref, file,anchor,title,name); } void startExamples() { forall(&OutputGenerator::startExamples); } void endExamples() { forall(&OutputGenerator::endExamples); } - void startParamList(ParamListTypes t,const char *title) + void startParamList(ParamListTypes t,const QCString &title) { forall(&OutputGenerator::startParamList,t,title); } void endParamList() { forall(&OutputGenerator::endParamList); } @@ -323,47 +327,47 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::startIndent); } void endIndent() { forall(&OutputGenerator::endIndent); } - void startSection(const char *lab,const char *title,SectionType t) + void startSection(const QCString &lab,const QCString &title,SectionType t) { forall(&OutputGenerator::startSection,lab,title,t); } - void endSection(const char *lab,SectionType t) + void endSection(const QCString &lab,SectionType t) { forall(&OutputGenerator::endSection,lab,t); } - void addIndexItem(const char *s1,const char *s2) + void addIndexItem(const QCString &s1,const QCString &s2) { forall(&OutputGenerator::addIndexItem,s1,s2); } void writeSynopsis() { forall(&OutputGenerator::writeSynopsis); } void startClassDiagram() { forall(&OutputGenerator::startClassDiagram); } - void endClassDiagram(const ClassDiagram &d,const char *f,const char *n) + void endClassDiagram(const ClassDiagram &d,const QCString &f,const QCString &n) { forall(&OutputGenerator::endClassDiagram,d,f,n); } void startPageRef() { forall(&OutputGenerator::startPageRef); } - void endPageRef(const char *c,const char *a) + void endPageRef(const QCString &c,const QCString &a) { forall(&OutputGenerator::endPageRef,c,a); } void startQuickIndices() { forall(&OutputGenerator::startQuickIndices); } void endQuickIndices() { forall(&OutputGenerator::endQuickIndices); } - void writeSplitBar(const char *name) + void writeSplitBar(const QCString &name) { forall(&OutputGenerator::writeSplitBar,name); } - void writeNavigationPath(const char *s) + void writeNavigationPath(const QCString &s) { forall(&OutputGenerator::writeNavigationPath,s); } void writeLogo() { forall(&OutputGenerator::writeLogo); } - void writeQuickLinks(bool compact,HighlightedItem hli,const char *file) + void writeQuickLinks(bool compact,HighlightedItem hli,const QCString &file) { forall(&OutputGenerator::writeQuickLinks,compact,hli,file); } - void writeSummaryLink(const char *file,const char *anchor,const char *title,bool first) + void writeSummaryLink(const QCString &file,const QCString &anchor,const QCString &title,bool first) { forall(&OutputGenerator::writeSummaryLink,file,anchor,title,first); } void startContents() { forall(&OutputGenerator::startContents); } void endContents() { forall(&OutputGenerator::endContents); } - void startPageDoc(const char *pageTitle) + void startPageDoc(const QCString &pageTitle) { forall(&OutputGenerator::startPageDoc, pageTitle); } void endPageDoc() { forall(&OutputGenerator::endPageDoc); } void writeNonBreakableSpace(int num) { forall(&OutputGenerator::writeNonBreakableSpace,num); } - void startDescTable(const char *title) + void startDescTable(const QCString &title) { forall(&OutputGenerator::startDescTable,title); } void endDescTable() { forall(&OutputGenerator::endDescTable); } @@ -415,7 +419,7 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::startMemberDocName,align); } void endMemberDocName() { forall(&OutputGenerator::endMemberDocName); } - void startParameterType(bool first,const char *key) + void startParameterType(bool first,const QCString &key) { forall(&OutputGenerator::startParameterType,first,key); } void endParameterType() { forall(&OutputGenerator::endParameterType); } @@ -427,10 +431,10 @@ class OutputList : public OutputDocInterface { forall(&OutputGenerator::startParameterList,openBracket); } void endParameterList() { forall(&OutputGenerator::endParameterList); } - void exceptionEntry(const char* prefix,bool closeBracket) + void exceptionEntry(const QCString &prefix,bool closeBracket) { forall(&OutputGenerator::exceptionEntry,prefix,closeBracket); } - void startConstraintList(const char *header) + void startConstraintList(const QCString &header) { forall(&OutputGenerator::startConstraintList,header); } void startConstraintParam() { forall(&OutputGenerator::startConstraintParam); } @@ -466,23 +470,23 @@ class OutputList : public OutputDocInterface void startLabels() { forall(&OutputGenerator::startLabels); } - void writeLabel(const char *l,bool isLast) + void writeLabel(const QCString &l,bool isLast) { forall(&OutputGenerator::writeLabel,l,isLast); } void endLabels() { forall(&OutputGenerator::endLabels); } - void startFontClass(const char *c) + void startFontClass(const QCString &c) { forall(&OutputGenerator::startFontClass,c); } void endFontClass() { forall(&OutputGenerator::endFontClass); } - void writeCodeAnchor(const char *name) + void writeCodeAnchor(const QCString &name) { forall(&OutputGenerator::writeCodeAnchor,name); } - void setCurrentDoc(const Definition *context,const char *anchor,bool isSourceFile) + void setCurrentDoc(const Definition *context,const QCString &anchor,bool isSourceFile) { forall(&OutputGenerator::setCurrentDoc,context,anchor,isSourceFile); } - void addWord(const char *word,bool hiPriority) + void addWord(const QCString &word,bool hiPriority) { forall(&OutputGenerator::addWord,word,hiPriority); } - void startPlainFile(const char *name) + void startPlainFile(const QCString &name) { forall(&OutputGenerator::startPlainFile,name); } void endPlainFile() { forall(&OutputGenerator::endPlainFile); } diff --git a/src/pagedef.cpp b/src/pagedef.cpp index 59055a3..07a1f9e 100644 --- a/src/pagedef.cpp +++ b/src/pagedef.cpp @@ -30,10 +30,10 @@ class PageDefImpl : public DefinitionMixin<PageDef> { public: - PageDefImpl(const char *f,int l,const char *n,const char *d,const char *t); + PageDefImpl(const QCString &f,int l,const QCString &n,const QCString &d,const QCString &t); virtual ~PageDefImpl(); - virtual void setFileName(const char *name); + virtual void setFileName(const QCString &name); virtual void setLocalToc(const LocalToc &tl); virtual void setShowLineNo(bool); virtual DefType definitionType() const { return TypePage; } @@ -57,7 +57,7 @@ class PageDefImpl : public DefinitionMixin<PageDef> virtual QCString displayName(bool=TRUE) const { return hasTitle() ? m_title : DefinitionMixin::name(); } virtual bool showLineNo() const; virtual void writeDocumentation(OutputList &ol); - virtual void writeTagFile(std::ostream &); + virtual void writeTagFile(TextStream &); virtual void setNestingLevel(int l); virtual void writePageDocumentation(OutputList &ol) const; @@ -71,16 +71,16 @@ class PageDefImpl : public DefinitionMixin<PageDef> bool m_showLineNo; }; -PageDef *createPageDef(const char *f,int l,const char *n,const char *d,const char *t) +PageDef *createPageDef(const QCString &f,int l,const QCString &n,const QCString &d,const QCString &t) { return new PageDefImpl(f,l,n,d,t); } //------------------------------------------------------------------------------------------ -PageDefImpl::PageDefImpl(const char *f,int l,const char *n, - const char *d,const char *t) - : DefinitionMixin(f,l,1,n), m_title(t?t:n) +PageDefImpl::PageDefImpl(const QCString &f,int l,const QCString &n, + const QCString &d,const QCString &t) + : DefinitionMixin(f,l,1,n), m_title(!t.isEmpty() ? t : n) { setDocumentation(d,f,l); m_pageScope = 0; @@ -112,7 +112,7 @@ QCString PageDefImpl::getOutputFileBase() const return m_fileName; } -void PageDefImpl::setFileName(const char *name) +void PageDefImpl::setFileName(const QCString &name) { m_fileName = name; } @@ -144,7 +144,7 @@ bool PageDefImpl::hasParentPage() const getOuterScope()->definitionType()==Definition::TypePage; } -void PageDefImpl::writeTagFile(std::ostream &tagFile) +void PageDefImpl::writeTagFile(TextStream &tagFile) { bool found = name()=="citelist"; for (RefListManager::Ptr &rl : RefListManager::instance()) @@ -232,7 +232,7 @@ void PageDefImpl::writeDocumentation(OutputList &ol) if (si->title() != manPageName) { ol.generateDoc(docFile(),getStartBodyLine(),this,0,si->title(),TRUE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endSection(si->label(),si->type()); } } @@ -252,7 +252,7 @@ void PageDefImpl::writeDocumentation(OutputList &ol) //ol.startSection(si->label,si->title,si->type); startTitle(ol,getOutputFileBase(),this); ol.generateDoc(docFile(),getStartBodyLine(),this,0,si->title(),TRUE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); //stringToSearchIndex(getOutputFileBase(), // theTranslator->trPage(TRUE,TRUE)+" "+si->title, // si->title); @@ -286,7 +286,7 @@ void PageDefImpl::writeDocumentation(OutputList &ol) ol.popGeneratorState(); //1.} - Doxygen::indexList->addIndexItem(this,0,0,filterTitle(title().str())); + Doxygen::indexList->addIndexItem(this,0,QCString(),filterTitle(title().str())); } void PageDefImpl::writePageDocumentation(OutputList &ol) const @@ -308,7 +308,7 @@ void PageDefImpl::writePageDocumentation(OutputList &ol) const docStr, // docStr TRUE, // index words FALSE, // not an example - 0, // exampleName + QCString(), // exampleName FALSE, // singleLine FALSE, // linkFromIndex TRUE // markdown support diff --git a/src/pagedef.h b/src/pagedef.h index 0da42dd..1a7b301 100644 --- a/src/pagedef.h +++ b/src/pagedef.h @@ -28,7 +28,7 @@ class PageDef : public DefinitionMutable, public Definition virtual ~PageDef() {} // setters - virtual void setFileName(const char *name) = 0; + virtual void setFileName(const QCString &name) = 0; virtual void setLocalToc(const LocalToc &tl) = 0; virtual void setShowLineNo(bool) = 0; @@ -55,13 +55,13 @@ class PageDef : public DefinitionMutable, public Definition virtual bool showLineNo() const = 0; virtual void writeDocumentation(OutputList &) = 0; - virtual void writeTagFile(std::ostream &) = 0; + virtual void writeTagFile(TextStream &) = 0; virtual void setNestingLevel(int) = 0; virtual void writePageDocumentation(OutputList &) const = 0; }; -PageDef *createPageDef(const char *f,int l,const char *n,const char *d,const char *t); +PageDef *createPageDef(const QCString &f,int l,const QCString &n,const QCString &d,const QCString &t); // --- Cast functions diff --git a/src/parserintf.h b/src/parserintf.h index 05b3adf..ccb4359 100644 --- a/src/parserintf.h +++ b/src/parserintf.h @@ -52,7 +52,7 @@ class OutlineParserInterface * @param[in] clangParser The clang translation unit parser object * or nullptr if disabled. */ - virtual void parseInput(const char *fileName, + virtual void parseInput(const QCString &fileName, const char *fileBuf, const std::shared_ptr<Entry> &root, ClangTUParser *clangParser) = 0; @@ -70,7 +70,7 @@ class OutlineParserInterface * in the Entry node that corresponds with the node for which the * comment block parser was invoked. */ - virtual void parsePrototype(const char *text) = 0; + virtual void parsePrototype(const QCString &text) = 0; }; @@ -88,9 +88,9 @@ class CodeParserInterface /** Parses a source file or fragment with the goal to produce * highlighted and cross-referenced output. * @param[in] codeOutIntf Abstract interface for writing the result. - * @param[in] lang The programming language of the code fragment. * @param[in] scopeName Name of scope to which the code belongs. * @param[in] input Actual code in the form of a string + * @param[in] lang The programming language of the code fragment. * @param[in] isExampleBlock TRUE iff the code is part of an example. * @param[in] exampleName Name of the example. * @param[in] fileDef File definition to which the code @@ -108,11 +108,11 @@ class CodeParserInterface * @param[in] collectXRefs collect cross-reference relations. */ virtual void parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt lang, bool isExampleBlock, - const char *exampleName=0, + const QCString &exampleName=QCString(), FileDef *fileDef=0, int startLine=-1, int endLine=-1, @@ -147,7 +147,7 @@ class ParserManager struct ParserPair { - ParserPair(OutlineParserFactory opf, CodeParserFactory cpf, const QCString pn) + ParserPair(OutlineParserFactory opf, CodeParserFactory cpf, const QCString &pn) : outlineParserFactory(opf), codeParserFactory(cpf), parserName(pn) { } @@ -164,7 +164,7 @@ class ParserManager */ ParserManager(OutlineParserFactory outlineParserFactory, CodeParserFactory codeParserFactory) - : m_defaultParsers(outlineParserFactory,codeParserFactory, "") + : m_defaultParsers(outlineParserFactory,codeParserFactory, QCString()) { } @@ -176,28 +176,28 @@ class ParserManager * @param[in] codeParserFactory A factory method to create a code parser that is to be used * for the given name. */ - void registerParser(const char *name,OutlineParserFactory outlineParserFactory, + void registerParser(const QCString &name,OutlineParserFactory outlineParserFactory, CodeParserFactory codeParserFactory) { - m_parsers.emplace(std::string(name),ParserPair(outlineParserFactory,codeParserFactory,name)); + m_parsers.emplace(name.str(),ParserPair(outlineParserFactory,codeParserFactory,name)); } /** Registers a file \a extension with a parser with name \a parserName. * Returns TRUE if the extension was successfully registered. */ - bool registerExtension(const char *extension, const char *parserName) + bool registerExtension(const QCString &extension, const QCString &parserName) { - if (parserName==0 || extension==0) return FALSE; + if (parserName.isEmpty() || extension.isEmpty()) return FALSE; - const auto &parserIt = m_parsers.find(parserName); + const auto &parserIt = m_parsers.find(parserName.str()); if (parserIt == m_parsers.end()) return FALSE; - auto extensionIt = m_extensions.find(extension); + auto extensionIt = m_extensions.find(extension.str()); if (extensionIt != m_extensions.end()) // extension already exists { m_extensions.erase(extensionIt); // remove it (e.g. user specified extension overrules built in one) } - m_extensions.emplace(std::string(extension),parserIt->second); // add new mapping + m_extensions.emplace(extension.str(),parserIt->second); // add new mapping return TRUE; } @@ -205,7 +205,7 @@ class ParserManager * If there is no parser explicitly registered for the supplied extension, * the interface to the default parser will be returned. */ - std::unique_ptr<OutlineParserInterface> getOutlineParser(const char *extension) + std::unique_ptr<OutlineParserInterface> getOutlineParser(const QCString &extension) { return getParsers(extension).outlineParserFactory(); } @@ -214,14 +214,14 @@ class ParserManager * If there is no parser explicitly registered for the supplied extension, * the interface to the default parser will be returned. */ - std::unique_ptr<CodeParserInterface> getCodeParser(const char *extension) + std::unique_ptr<CodeParserInterface> getCodeParser(const QCString &extension) { auto factory = getCodeParserFactory(extension); return factory(); } /** Get the factory for create code parser objects with a given \a extension. */ - CodeParserFactory &getCodeParserFactory(const char *extension) + CodeParserFactory &getCodeParserFactory(const QCString &extension) { return getParsers(extension).codeParserFactory; } @@ -230,15 +230,15 @@ class ParserManager * If there is no parser explicitly registered for the supplied extension, * te empty string will be reurned. */ - QCString getParserName(const char *extension) + QCString getParserName(const QCString &extension) { return getParsers(extension).parserName; } private: - ParserPair &getParsers(const char *extension) + ParserPair &getParsers(const QCString &extension) { - QCString ext = QCString(extension).lower().data(); + QCString ext = extension.lower(); if (ext.isEmpty()) ext=".no_extension"; auto it = m_extensions.find(ext.data()); if (it==m_extensions.end() && ext.length()>4) diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index ab931f9..3954daa 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -55,8 +55,7 @@ class PerlModOutputStream PerlModOutputStream(std::ostream &t) : m_t(t) { } void add(char c); - void add(const char *s); - void add(QCString &s); + void add(const QCString &s); void add(int n); void add(unsigned int n); }; @@ -70,7 +69,7 @@ void PerlModOutputStream::add(char c) // m_s += c; } -void PerlModOutputStream::add(const char *s) +void PerlModOutputStream::add(const QCString &s) { m_t << s; //if (m_t != 0) @@ -79,15 +78,6 @@ void PerlModOutputStream::add(const char *s) // m_s += s; } -void PerlModOutputStream::add(QCString &s) -{ - m_t << s.str(); - //if (m_t != 0) - // (*m_t) << s; - //else - // m_s += s; -} - void PerlModOutputStream::add(int n) { m_t << n; @@ -136,12 +126,12 @@ public: } inline PerlModOutput &add(char c) { m_stream->add(c); return *this; } - inline PerlModOutput &add(const char *s) { m_stream->add(s); return *this; } + inline PerlModOutput &add(const QCString &s) { m_stream->add(s); return *this; } inline PerlModOutput &add(QCString &s) { m_stream->add(s); return *this; } inline PerlModOutput &add(int n) { m_stream->add(n); return *this; } inline PerlModOutput &add(unsigned int n) { m_stream->add(n); return *this; } - PerlModOutput &addQuoted(const char *s) { iaddQuoted(s); return *this; } + PerlModOutput &addQuoted(const QCString &s) { iaddQuoted(s); return *this; } inline PerlModOutput &indent() { @@ -152,25 +142,25 @@ public: return *this; } - inline PerlModOutput &open(char c, const char *s = 0) { iopen(c, s); return *this; } + inline PerlModOutput &open(char c, const QCString &s = QCString()) { iopen(c, s); return *this; } inline PerlModOutput &close(char c = 0) { iclose(c); return *this; } - inline PerlModOutput &addField(const char *s) { iaddField(s); return *this; } - inline PerlModOutput &addFieldQuotedChar(const char *field, char content) + inline PerlModOutput &addField(const QCString &s) { iaddField(s); return *this; } + inline PerlModOutput &addFieldQuotedChar(const QCString &field, char content) { iaddFieldQuotedChar(field, content); return *this; } - inline PerlModOutput &addFieldQuotedString(const char *field, const char *content) + inline PerlModOutput &addFieldQuotedString(const QCString &field, const QCString &content) { iaddFieldQuotedString(field, content); return *this; } - inline PerlModOutput &addFieldBoolean(const char *field, bool content) + inline PerlModOutput &addFieldBoolean(const QCString &field, bool content) { return addFieldQuotedString(field, content ? "yes" : "no"); } - inline PerlModOutput &openList(const char *s = 0) { open('[', s); return *this; } + inline PerlModOutput &openList(const QCString &s = QCString()) { open('[', s); return *this; } inline PerlModOutput &closeList() { close(']'); return *this; } - inline PerlModOutput &openHash(const char *s = 0 ) { open('{', s); return *this; } + inline PerlModOutput &openHash(const QCString &s = QCString() ) { open('{', s); return *this; } inline PerlModOutput &closeHash() { close('}'); return *this; } protected: @@ -181,12 +171,12 @@ protected: void incIndent(); void decIndent(); - void iaddQuoted(const char *); - void iaddFieldQuotedChar(const char *, char); - void iaddFieldQuotedString(const char *, const char *); - void iaddField(const char *); + void iaddQuoted(const QCString &); + void iaddFieldQuotedChar(const QCString &, char); + void iaddFieldQuotedString(const QCString &, const QCString &); + void iaddField(const QCString &); - void iopen(char, const char *); + void iopen(char, const QCString &); void iclose(char); private: @@ -230,24 +220,29 @@ void PerlModOutput::decIndent() m_spaces[m_indentation * 2] = 0; } -void PerlModOutput::iaddQuoted(const char *s) +void PerlModOutput::iaddQuoted(const QCString &str) { + if (str.isEmpty()) return; + const char *s = str.data(); char c; - while ((c = *s++) != 0) { + while ((c = *s++) != 0) + { if ((c == '\'') || (c == '\\')) + { m_stream->add('\\'); + } m_stream->add(c); } } -void PerlModOutput::iaddField(const char *s) +void PerlModOutput::iaddField(const QCString &s) { continueBlock(); m_stream->add(s); m_stream->add(m_pretty ? " => " : "=>"); } -void PerlModOutput::iaddFieldQuotedChar(const char *field, char content) +void PerlModOutput::iaddFieldQuotedChar(const QCString &field, char content) { iaddField(field); m_stream->add('\''); @@ -257,7 +252,7 @@ void PerlModOutput::iaddFieldQuotedChar(const char *field, char content) m_stream->add('\''); } -void PerlModOutput::iaddFieldQuotedString(const char *field, const char *content) +void PerlModOutput::iaddFieldQuotedString(const QCString &field, const QCString &content) { if (content == 0) return; @@ -267,7 +262,7 @@ void PerlModOutput::iaddFieldQuotedString(const char *field, const char *content m_stream->add('\''); } -void PerlModOutput::iopen(char c, const char *s) +void PerlModOutput::iopen(char c, const QCString &s) { if (s != 0) iaddField(s); @@ -413,10 +408,10 @@ private: void enterText(); void leaveText(); - void openItem(const char *); + void openItem(const QCString &); void closeItem(); - void singleItem(const char *); - void openSubBlock(const char * = 0); + void singleItem(const QCString &); + void openSubBlock(const QCString & = QCString()); void closeSubBlock(); //void openOther(); //void closeOther(); @@ -452,7 +447,7 @@ void PerlModDocVisitor::addLink(const QCString &,const QCString &file,const QCSt m_output.addFieldQuotedString("link", link); } -void PerlModDocVisitor::openItem(const char *name) +void PerlModDocVisitor::openItem(const QCString &name) { leaveText(); m_output.openHash().addFieldQuotedString("type", name); @@ -483,13 +478,13 @@ void PerlModDocVisitor::leaveText() .closeHash(); } -void PerlModDocVisitor::singleItem(const char *name) +void PerlModDocVisitor::singleItem(const QCString &name) { openItem(name); closeItem(); } -void PerlModDocVisitor::openSubBlock(const char *s) +void PerlModDocVisitor::openSubBlock(const QCString &s) { leaveText(); m_output.openList(s); @@ -935,6 +930,17 @@ void PerlModDocVisitor::visitPre(DocHtmlList *l) { openItem("list"); m_output.addFieldQuotedString("style", (l->type() == DocHtmlList::Ordered) ? "ordered" : "itemized"); + for (const auto &opt : l->attribs()) + { + if (opt.name=="type") + { + m_output.addFieldQuotedString("list_type", qPrint(opt.value)); + } + if (opt.name=="start") + { + m_output.addFieldQuotedString("start", qPrint(opt.value)); + } + } openSubBlock("content"); } @@ -1363,7 +1369,7 @@ void PerlModDocVisitor::visitPost(DocXRefItem *x) void PerlModDocVisitor::visitPre(DocInternalRef *ref) { openItem("ref"); - addLink(0,ref->file(),ref->anchor()); + addLink(QCString(),ref->file(),ref->anchor()); openSubBlock("content"); } @@ -1410,7 +1416,7 @@ void PerlModDocVisitor::visitPost(DocParBlock *) } -static void addTemplateArgumentList(const ArgumentList &al,PerlModOutput &output,const char *) +static void addTemplateArgumentList(const ArgumentList &al,PerlModOutput &output,const QCString &) { if (!al.hasParameters()) return; output.openList("template_parameters"); @@ -1434,8 +1440,13 @@ static void addTemplateList(const ClassDef *cd,PerlModOutput &output) addTemplateArgumentList(cd->templateArguments(),output,cd->name()); } +static void addTemplateList(const ConceptDef *cd,PerlModOutput &output) +{ + addTemplateArgumentList(cd->getTemplateParameterList(),output,cd->name()); +} + static void addPerlModDocBlock(PerlModOutput &output, - const char *name, + const QCString &name, const QCString &fileName, int lineNr, const Definition *scope, @@ -1447,7 +1458,7 @@ static void addPerlModDocBlock(PerlModOutput &output, output.addField(name).add("{}"); else { DocNode *root = validatingParseDoc(fileName,lineNr,scope,md,stext,FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); output.openHash(name); PerlModDocVisitor *visitor = new PerlModDocVisitor(output); root->accept(visitor); @@ -1514,15 +1525,17 @@ public: void generatePerlModForMember(const MemberDef *md, const Definition *); void generatePerlUserDefinedSection(const Definition *d, const MemberGroupList &mgl); void generatePerlModSection(const Definition *d, MemberList *ml, - const char *name, const char *header=0); + const QCString &name, const QCString &header=QCString()); void addListOfAllMembers(const ClassDef *cd); + void addIncludeInfo(const IncludeInfo *ii); void generatePerlModForClass(const ClassDef *cd); + void generatePerlModForConcept(const ConceptDef *cd); void generatePerlModForNamespace(const NamespaceDef *nd); void generatePerlModForFile(const FileDef *fd); void generatePerlModForGroup(const GroupDef *gd); void generatePerlModForPage(PageDef *pi); - bool createOutputFile(std::ofstream &f, const char *s); + bool createOutputFile(std::ofstream &f, const QCString &s); bool createOutputDir(Dir &perlModDir); bool generateDoxyLatexTex(); bool generateDoxyFormatTex(); @@ -1654,7 +1667,7 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini if (!md->initializer().isEmpty()) m_output.addFieldQuotedString("initializer", md->initializer()); - if (md->excpString()) + if (!md->excpString().isEmpty()) m_output.addFieldQuotedString("exceptions", md->excpString()); if (md->memberType()==MemberType_Enumeration) // enum @@ -1681,7 +1694,7 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini } } - if (md->memberType() == MemberType_Variable && md->bitfieldString()) + if (md->memberType() == MemberType_Variable && !md->bitfieldString().isEmpty()) { QCString bitfield = md->bitfieldString(); if (bitfield.at(0) == ':') bitfield = bitfield.mid(1); @@ -1709,13 +1722,13 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini } void PerlModGenerator::generatePerlModSection(const Definition *d, - MemberList *ml,const char *name,const char *header) + MemberList *ml,const QCString &name,const QCString &header) { if (ml==0) return; // empty list m_output.openHash(name); - if (header) + if (!header.isEmpty()) m_output.addFieldQuotedString("header", header); m_output.openList("members"); @@ -1762,8 +1775,10 @@ void PerlModGenerator::generatePerlUserDefinedSection(const Definition *d, const for (const auto &mg : mgl) { m_output.openHash(); - if (mg->header()) + if (!mg->header().isEmpty()) + { m_output.addFieldQuotedString("header", mg->header()); + } if (!mg->members().empty()) { @@ -1780,6 +1795,22 @@ void PerlModGenerator::generatePerlUserDefinedSection(const Definition *d, const } } +void PerlModGenerator::addIncludeInfo(const IncludeInfo *ii) +{ + if (ii) + { + QCString nm = ii->includeName; + if (nm.isEmpty() && ii->fileDef) nm = ii->fileDef->docName(); + if (!nm.isEmpty()) + { + m_output.openHash("includes"); + m_output.addFieldBoolean("local", ii->local) + .addFieldQuotedString("name", nm) + .closeHash(); + } + } +} + void PerlModGenerator::generatePerlModForClass(const ClassDef *cd) { // + brief description @@ -1844,23 +1875,7 @@ void PerlModGenerator::generatePerlModForClass(const ClassDef *cd) m_output.closeList(); } - const IncludeInfo *ii=cd->includeInfo(); - if (ii) - { - QCString nm = ii->includeName; - if (nm.isEmpty() && ii->fileDef) nm = ii->fileDef->docName(); - if (!nm.isEmpty()) - { - m_output.openHash("includes"); -#if 0 - if (ii->fileDef && !ii->fileDef->isReference()) // TODO: support external references - t << " id=\"" << ii->fileDef->getOutputFileBase() << "\""; -#endif - m_output.addFieldBoolean("local", ii->local) - .addFieldQuotedString("name", nm) - .closeHash(); - } - } + addIncludeInfo(cd->includeInfo()); addTemplateList(cd,m_output); addListOfAllMembers(cd); @@ -1922,6 +1937,22 @@ void PerlModGenerator::generatePerlModForClass(const ClassDef *cd) m_output.closeHash(); } +void PerlModGenerator::generatePerlModForConcept(const ConceptDef *cd) +{ + if (cd->isReference()) return; // skip external references + + m_output.openHash() + .addFieldQuotedString("name", cd->name()); + + addIncludeInfo(cd->includeInfo()); + addTemplateList(cd,m_output); + m_output.addFieldQuotedString("initializer", cd->initializer()); + addPerlModDocBlock(m_output,"brief",cd->getDefFileName(),cd->getDefLine(),0,0,cd->briefDescription()); + addPerlModDocBlock(m_output,"detailed",cd->getDefFileName(),cd->getDefLine(),0,0,cd->documentation()); + + m_output.closeHash(); +} + void PerlModGenerator::generatePerlModForNamespace(const NamespaceDef *nd) { // + contained class definitions @@ -2154,6 +2185,11 @@ bool PerlModGenerator::generatePerlModOutput() generatePerlModForClass(cd.get()); m_output.closeList(); + m_output.openList("concepts"); + for (const auto &cd : *Doxygen::conceptLinkedMap) + generatePerlModForConcept(cd.get()); + m_output.closeList(); + m_output.openList("namespaces"); for (const auto &nd : *Doxygen::namespaceLinkedMap) generatePerlModForNamespace(nd.get()); @@ -2191,12 +2227,12 @@ bool PerlModGenerator::generatePerlModOutput() return true; } -bool PerlModGenerator::createOutputFile(std::ofstream &f, const char *s) +bool PerlModGenerator::createOutputFile(std::ofstream &f, const QCString &s) { - f.open(s,std::ofstream::out | std::ofstream::binary); + f.open(s.str(),std::ofstream::out | std::ofstream::binary); if (!f.is_open()) { - err("Cannot open file %s for writing!\n", s); + err("Cannot open file %s for writing!\n", qPrint(s)); return false; } return true; diff --git a/src/plantuml.cpp b/src/plantuml.cpp index da26ba7..81f7df8 100644 --- a/src/plantuml.cpp +++ b/src/plantuml.cpp @@ -85,7 +85,7 @@ QCString PlantumlManager::writePlantUMLSource(const QCString &outDirArg,const QC return baseName; } -void PlantumlManager::generatePlantUMLOutput(const char *baseName,const char *outDir,OutputFormat format) +void PlantumlManager::generatePlantUMLOutput(const QCString &baseName,const QCString &outDir,OutputFormat format) { QCString plantumlJarPath = Config_getString(PLANTUML_JAR_PATH); QCString plantumlConfigFile = Config_getString(PLANTUML_CFG_FILE); @@ -239,7 +239,7 @@ static void runPlantumlContent(const PlantumlManager::FilesMap &plantumlFiles, Debug::print(Debug::Plantuml,0,"*** %s Running Plantuml arguments:%s\n","PlantumlManager::runPlantumlContent",qPrint(pumlArguments)); Portable::sysTimerStart(); - if ((exitCode=Portable::system(pumlExe,pumlArguments,TRUE))!=0) + if ((exitCode=Portable::system(pumlExe.data(),pumlArguments.data(),TRUE))!=0) { err("Problems running PlantUML. Verify that the command 'java -jar \"%splantuml.jar\" -h' works from the command line. Exit code: %d\n", plantumlJarPath.data(),exitCode); @@ -264,7 +264,7 @@ static void runPlantumlContent(const PlantumlManager::FilesMap &plantumlFiles, epstopdfArgs.sprintf("\"%s%s.eps\" --outfile=\"%s%s.pdf\"", pumlOutDir.data(),str.c_str(), pumlOutDir.data(),str.c_str()); Portable::sysTimerStart(); - if ((exitCode=Portable::system("epstopdf",epstopdfArgs))!=0) + if ((exitCode=Portable::system("epstopdf",epstopdfArgs.data()))!=0) { err("Problems running epstopdf. Check your TeX installation! Exit code: %d\n",exitCode); } diff --git a/src/plantuml.h b/src/plantuml.h index b92cd0c..6b439f4 100644 --- a/src/plantuml.h +++ b/src/plantuml.h @@ -29,14 +29,10 @@ class QCString; struct PlantumlContent { - QCString outDir; + PlantumlContent(const QCString &content_, const QCString &outDir_) + : content(content_), outDir(outDir_) {} QCString content; - PlantumlContent(const QCString Content, const QCString OutDir) - { - outDir = OutDir; - content = Content; - }; - ~PlantumlContent(){}; + QCString outDir; }; /** Singleton that manages plantuml relation actions */ @@ -65,7 +61,7 @@ class PlantumlManager * @param[in] outDir the directory to write the resulting image into. * @param[in] format the image format to generate. */ - void generatePlantUMLOutput(const char *baseName,const char *outDir,OutputFormat format); + void generatePlantUMLOutput(const QCString &baseName,const QCString &outDir,OutputFormat format); using FilesMap = std::map< std::string, StringVector >; using ContentMap = std::map< std::string, PlantumlContent >; diff --git a/src/portable.cpp b/src/portable.cpp index 98c7465..60c5189 100644 --- a/src/portable.cpp +++ b/src/portable.cpp @@ -39,10 +39,10 @@ static double g_sysElapsedTime; static std::chrono::steady_clock::time_point g_startTime; -int Portable::system(const char *command,const char *args,bool commandHasConsole) +int Portable::system(const QCString &command,const QCString &args,bool commandHasConsole) { - if (command==0) return 1; + if (command.isEmpty()) return 1; #if defined(_WIN32) && !defined(__CYGWIN__) QCString commandCorrectedPath = substitute(command,'/','\\'); @@ -136,7 +136,7 @@ int Portable::system(const char *command,const char *args,bool commandHasConsole #else // Win32 specific if (commandHasConsole) { - return ::system(fullCmd); + return ::system(fullCmd.data()); } else { @@ -243,56 +243,56 @@ void loadEnvironment() } #endif -void Portable::setenv(const char *name,const char *value) +void Portable::setenv(const QCString &name,const QCString &value) { - if (value==0) value=""; #if defined(_WIN32) && !defined(__CYGWIN__) - SetEnvironmentVariable(name,value); + SetEnvironmentVariable(name.data(),!value.isEmpty() ? value.data() : ""); #else if(!environmentLoaded) // if the environment variables are not loaded already... { // ...call loadEnvironment to store them in class loadEnvironment(); } - proc_env[name] = std::string(value); // create or replace existing value + proc_env[name.str()] = value.str(); // create or replace existing value #endif } -void Portable::unsetenv(const char *variable) +void Portable::unsetenv(const QCString &variable) { #if defined(_WIN32) && !defined(__CYGWIN__) - SetEnvironmentVariable(variable,0); + SetEnvironmentVariable(variable.data(),0); #else /* Some systems don't have unsetenv(), so we do it ourselves */ - if (variable == NULL || *variable == '\0' || strchr (variable, '=') != NULL) + if (variable.isEmpty() || variable.find('=')!=-1) { return; // not properly formatted } - if(proc_env.find(variable) != proc_env.end()) + auto it = proc_env.find(variable.str()); + if (it != proc_env.end()) { - proc_env[variable].erase(); + proc_env.erase(it); } #endif } -const char *Portable::getenv(const char *variable) +QCString Portable::getenv(const QCString &variable) { #if defined(_WIN32) && !defined(__CYGWIN__) - return ::getenv(variable); + return ::getenv(variable.data()); #else if(!environmentLoaded) // if the environment variables are not loaded already... - { // ...call loadEnvironment to store them in class + { // ...call loadEnvironment to store them in class loadEnvironment(); } - if(proc_env.find(variable) != proc_env.end()) + if (proc_env.find(variable.str()) != proc_env.end()) { - return proc_env[variable].c_str(); + return QCString(proc_env[variable.str()]); } else { - return NULL; + return QCString(); } #endif } @@ -319,7 +319,7 @@ portable_off_t Portable::ftell(FILE *f) #endif } -FILE *Portable::fopen(const char *fileName,const char *mode) +FILE *Portable::fopen(const QCString &fileName,const QCString &mode) { #if defined(_WIN32) && !defined(__CYGWIN__) uint16_t *fn = 0; @@ -335,37 +335,41 @@ FILE *Portable::fopen(const char *fileName,const char *mode) delete[] m; return result; #else - return ::fopen(fileName,mode); + return ::fopen(fileName.data(),mode.data()); #endif } -char Portable::pathSeparator() +int Portable::fclose(FILE *f) +{ + return ::fclose(f); +} + +QCString Portable::pathSeparator() { #if defined(_WIN32) && !defined(__CYGWIN__) - return '\\'; + return "\\"; #else - return '/'; + return "/"; #endif } -char Portable::pathListSeparator() +QCString Portable::pathListSeparator() { #if defined(_WIN32) && !defined(__CYGWIN__) - return ';'; + return ";"; #else - return ':'; + return ":"; #endif } -static bool ExistsOnPath(const char *fileName) +static bool ExistsOnPath(const QCString &fileName) { - FileInfo fi1(fileName); + FileInfo fi1(fileName.str()); if (fi1.exists()) return true; - const char *p = Portable::getenv("PATH"); - char listSep = Portable::pathListSeparator(); - char pathSep = Portable::pathSeparator(); - QCString paths(p); + QCString paths = Portable::getenv("PATH"); + char listSep = Portable::pathListSeparator()[0]; + char pathSep = Portable::pathSeparator()[0]; int strt = 0; int idx; while ((idx = paths.find(listSep,strt)) != -1) @@ -389,13 +393,13 @@ static bool ExistsOnPath(const char *fileName) return false; } -bool Portable::checkForExecutable(const char *fileName) +bool Portable::checkForExecutable(const QCString &fileName) { #if defined(_WIN32) && !defined(__CYGWIN__) char *extensions[] = {".bat",".com",".exe"}; for (int i = 0; i < sizeof(extensions) / sizeof(*extensions); i++) { - if (ExistsOnPath(QCString(fileName) + extensions[i])) return true; + if (ExistsOnPath(fileName + extensions[i])) return true; } return false; #else @@ -445,12 +449,12 @@ bool Portable::fileSystemIsCaseSensitive() #endif } -FILE * Portable::popen(const char *name,const char *type) +FILE * Portable::popen(const QCString &name,const QCString &type) { #if defined(_MSC_VER) || defined(__BORLANDC__) - return ::_popen(name,type); + return ::_popen(name.data(),type.data()); #else - return ::popen(name,type); + return ::popen(name.data(),type.data()); #endif } @@ -489,19 +493,16 @@ void Portable::sleep(int ms) #endif } -bool Portable::isAbsolutePath(const char *fileName) +bool Portable::isAbsolutePath(const QCString &fileName) { + const char *fn = fileName.data(); # ifdef _WIN32 - if (isalpha (fileName [0]) && fileName[1] == ':') - fileName += 2; + if (fileName.length()>1 && isalpha(fileName[0]) && fileName[1]==':') fn+=2; # endif - char const fst = fileName [0]; - if (fst == '/') { - return true; - } + char const fst = fn[0]; + if (fst == '/') return true; # ifdef _WIN32 - if (fst == '\\') - return true; + if (fst == '\\') return true; # endif return false; } @@ -514,19 +515,19 @@ bool Portable::isAbsolutePath(const char *fileName) void Portable::correct_path() { #if defined(_WIN32) && !defined(__CYGWIN__) - const char *p = Portable::getenv("PATH"); - if (!p) return; // no path nothing to correct - QCString result = substitute(p,'/','\\'); + QCString p = Portable::getenv("PATH"); + if (p.isEmpty()) return; // no path nothing to correct + QCString result = substitute(p,"/","\\"); if (result!=p) Portable::setenv("PATH",result.data()); #endif } -void Portable::unlink(const char *fileName) +void Portable::unlink(const QCString &fileName) { #if defined(_WIN32) && !defined(__CYGWIN__) - _unlink(fileName); + _unlink(fileName.data()); #else - ::unlink(fileName); + ::unlink(fileName.data()); #endif } @@ -600,17 +601,18 @@ const char *Portable::devNull() #endif } -size_t Portable::recodeUtf8StringToW(const char *inputStr,uint16_t **outBuf) +size_t Portable::recodeUtf8StringToW(const QCString &inputStr,uint16_t **outBuf) { - if (inputStr==0 || outBuf==0) return 0; // empty input or invalid output + if (inputStr.isEmpty() || outBuf==0) return 0; // empty input or invalid output void *handle = portable_iconv_open("UTF-16LE","UTF-8"); if (handle==(void *)(-1)) return 0; // invalid encoding - size_t len = strlen(inputStr); + size_t len = inputStr.length(); uint16_t *buf = new uint16_t[len+1]; *outBuf = buf; size_t inRemains = len; size_t outRemains = len*sizeof(uint16_t)+2; // chars + \0 - portable_iconv(handle,(char**)&inputStr,&inRemains,(char**)&buf,&outRemains); + const char *p = inputStr.data(); + portable_iconv(handle,&p,&inRemains,(char**)&buf,&outRemains); *buf=0; portable_iconv_close(handle); return len; diff --git a/src/portable.h b/src/portable.h index d1bfed1..86b1bed 100644 --- a/src/portable.h +++ b/src/portable.h @@ -5,6 +5,8 @@ #include <sys/types.h> #include <stdint.h> +#include "qcstring.h" + class Buf; #if defined(_WIN32) @@ -19,39 +21,40 @@ typedef off_t portable_off_t; namespace Portable { - int system(const char *command,const char *args,bool commandHasConsole=true); + int system(const QCString &command,const QCString &args,bool commandHasConsole=true); unsigned int pid(); - const char * getenv(const char *variable); - void setenv(const char *variable,const char *value); - void unsetenv(const char *variable); + QCString getenv(const QCString &variable); + void setenv(const QCString &variable,const QCString &value); + void unsetenv(const QCString &variable); portable_off_t fseek(FILE *f,portable_off_t offset, int whence); portable_off_t ftell(FILE *f); - FILE * fopen(const char *fileName,const char *mode); - void unlink(const char *fileName); - char pathSeparator(); - char pathListSeparator(); + FILE * fopen(const QCString &fileName,const QCString &mode); + int fclose(FILE *f); + void unlink(const QCString &fileName); + QCString pathSeparator(); + QCString pathListSeparator(); const char * ghostScriptCommand(); const char * commandExtension(); bool fileSystemIsCaseSensitive(); - FILE * popen(const char *name,const char *type); + FILE * popen(const QCString &name,const QCString &type); int pclose(FILE *stream); void sysTimerStart(); void sysTimerStop(); double getSysElapsedTime(); void sleep(int ms); - bool isAbsolutePath(const char *fileName); + bool isAbsolutePath(const QCString &fileName); void correct_path(); void setShortDir(); const char * strnstr(const char *haystack, const char *needle, size_t haystack_len); const char * devNull(); - bool checkForExecutable(const char *fileName); - size_t recodeUtf8StringToW(const char *inputStr,uint16_t **buf); + bool checkForExecutable(const QCString &fileName); + size_t recodeUtf8StringToW(const QCString &inputStr,uint16_t **buf); } extern "C" { - void * portable_iconv_open(const char* tocode, const char* fromcode); - size_t portable_iconv (void *cd, char** inbuf, size_t *inbytesleft, + void * portable_iconv_open(const char *tocode, const char *fromcode); + size_t portable_iconv (void *cd, const char** inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); int portable_iconv_close (void *cd); } diff --git a/src/portable_c.c b/src/portable_c.c index 3a79741..fe81844 100644 --- a/src/portable_c.c +++ b/src/portable_c.c @@ -13,7 +13,7 @@ // These functions are implemented in a C file, because there are different // versions of the iconv() prototype, some with a const pointer and some // without. In C this is just a warning, but in C++ breaks the compilation. -// Looking at the LIBICONV_VERSION is not enough, since for MACOSX the +// Looking at the LIBICONV_VERSION is not enough, since for MACOSX the // const and non-const version exist with the same version of the file. void * portable_iconv_open(const char* tocode, const char* fromcode) @@ -21,10 +21,10 @@ void * portable_iconv_open(const char* tocode, const char* fromcode) return iconv_open(tocode,fromcode); } -size_t portable_iconv (void *cd, char** inbuf, size_t *inbytesleft, +size_t portable_iconv (void *cd, const char** inbuf, size_t *inbytesleft, char** outbuf, size_t *outbytesleft) { - return iconv((iconv_t)cd,inbuf,inbytesleft,outbuf,outbytesleft); + return iconv((iconv_t)cd,(char**)inbuf,inbytesleft,outbuf,outbytesleft); } int portable_iconv_close (void *cd) @@ -1,12 +1,12 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -21,14 +21,15 @@ #include <memory> class BufStr; +class QCString; class Preprocessor { public: Preprocessor(); ~Preprocessor(); - void processFile(const char *fileName,BufStr &input,BufStr &output); - void addSearchDir(const char *dir); + void processFile(const QCString &fileName,BufStr &input,BufStr &output); + void addSearchDir(const QCString &dir); private: struct Private; std::unique_ptr<Private> p; @@ -96,7 +96,7 @@ struct FileState struct PreIncludeInfo { - PreIncludeInfo(const char *fn,FileDef *srcFd, FileDef *dstFd,const char *iName,bool loc, bool imp) + PreIncludeInfo(const QCString &fn,FileDef *srcFd, FileDef *dstFd,const QCString &iName,bool loc, bool imp) : fileName(fn), fromFileDef(srcFd), toFileDef(dstFd), includeName(iName), local(loc), imported(imp) { } @@ -154,7 +154,7 @@ class DefineManager { includeStack.insert(incFile); dpf->retrieveRec(toMap,includeStack); - //printf(" retrieveRec: processing include %s: #toMap=%zu\n",incFile.data(),toMap.size()); + //printf(" retrieveRec: processing include %s: #toMap=%zu\n",qPrint(incFile),toMap.size()); } } for (auto &kv : m_defines) @@ -307,12 +307,13 @@ struct preYY_state }; // stateless functions -static QCString escapeAt(const char *text); -static QCString extractTrailingComment(const char *s); +static QCString escapeAt(const QCString &text); +static QCString extractTrailingComment(const QCString &s); static char resolveTrigraph(char c); // statefull functions -static inline void outputArray(yyscan_t yyscanner,const char *a,int len); +static inline void outputArray(yyscan_t yyscanner,const char *a,yy_size_t len); +static inline void outputString(yyscan_t yyscanner,const QCString &s); static inline void outputChar(yyscan_t yyscanner,char c); static QCString expandMacro(yyscan_t yyscanner,const QCString &name); static void readIncludeFile(yyscan_t yyscanner,const QCString &inc); @@ -321,13 +322,13 @@ static void decrLevel(yyscan_t yyscanner); static void setCaseDone(yyscan_t yyscanner,bool value); static bool otherCaseDone(yyscan_t yyscanner); static bool computeExpression(yyscan_t yyscanner,const QCString &expr); -static void startCondSection(yyscan_t yyscanner,const char *sectId); +static void startCondSection(yyscan_t yyscanner,const QCString §Id); static void endCondSection(yyscan_t yyscanner); static void addMacroDefinition(yyscan_t yyscanner); static void addDefine(yyscan_t yyscanner); -static void setFileName(yyscan_t yyscanner,const char *name); +static void setFileName(yyscan_t yyscanner,const QCString &name); static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); -static Define * isDefined(yyscan_t yyscanner,const char *name); +static Define * isDefined(yyscan_t yyscanner,const QCString &name); /* ----------------------------------------------------------------- */ @@ -411,11 +412,11 @@ WSopt [ \t\r]* <Start>^{B}*"#" { BEGIN(Command); yyextra->yyColNr+=(int)yyleng; yyextra->yyMLines=0;} <Start>^("%top{"|"%{") { if (getLanguageFromFileName(yyextra->yyFileName)!=SrcLangExt_Lex) REJECT - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); BEGIN(LexCopyLine); } <Start>^{Bopt}/[^#] { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); BEGIN(CopyLine); } <Start>^{B}*[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] { // constructors? @@ -460,12 +461,12 @@ WSopt [ \t\r]* <CopyLine,LexCopyLine>"extern"{BN}{0,80}"\"C\""*{BN}{0,80}"{" { QCString text=yytext; yyextra->yyLineNr+=text.contains('\n'); - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <CopyLine,LexCopyLine>{RAWBEGIN} { yyextra->delimiter = yytext+2; yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1); - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); BEGIN(CopyRawString); } <CopyLine,LexCopyLine>"{" { // count brackets inside the main file @@ -476,7 +477,7 @@ WSopt [ \t\r]* outputChar(yyscanner,*yytext); } <LexCopyLine>^"%}" { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <CopyLine,LexCopyLine>"}" { // count brackets inside the main file if (yyextra->includeStack.empty() && yyextra->curlyCount>0) @@ -486,17 +487,17 @@ WSopt [ \t\r]* outputChar(yyscanner,*yytext); } <CopyLine,LexCopyLine>"'"\\[0-7]{1,3}"'" { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <CopyLine,LexCopyLine>"'"\\."'" { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <CopyLine,LexCopyLine>"'"."'" { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <CopyLine,LexCopyLine>@\" { if (getLanguageFromFileName(yyextra->yyFileName)!=SrcLangExt_CSharp) REJECT; - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); BEGIN( CopyStringCs ); } <CopyLine,LexCopyLine>\" { @@ -516,40 +517,40 @@ WSopt [ \t\r]* BEGIN( CopyStringFtn ); } <CopyString>[^\"\\\r\n]+ { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <CopyStringCs>[^\"\r\n]+ { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <CopyString>\\. { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <CopyString,CopyStringCs>\" { outputChar(yyscanner,*yytext); BEGIN( CopyLine ); } <CopyStringFtnDouble>[^\"\\\r\n]+ { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <CopyStringFtnDouble>\\. { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <CopyStringFtnDouble>\" { outputChar(yyscanner,*yytext); BEGIN( CopyLine ); } <CopyStringFtn>[^\'\\\r\n]+ { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <CopyStringFtn>\\. { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <CopyStringFtn>\' { outputChar(yyscanner,*yytext); BEGIN( CopyLine ); } <CopyRawString>{RAWEND} { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); QCString delimiter = yytext+1; delimiter=delimiter.left(delimiter.length()-1); if (delimiter==yyextra->delimiter) @@ -558,7 +559,7 @@ WSopt [ \t\r]* } } <CopyRawString>[^)]+ { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <CopyRawString>. { outputChar(yyscanner,*yytext); @@ -587,7 +588,7 @@ WSopt [ \t\r]* if (def->nargs==-1) // no function macro { QCString result = def->isPredefined ? def->definition : expandMacro(yyscanner,yyextra->defArgsStr); - outputArray(yyscanner,result,result.length()); + outputString(yyscanner,result); } else // zero or more arguments { @@ -597,7 +598,7 @@ WSopt [ \t\r]* } else { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } } <CopyLine,LexCopyLine>{ID} { @@ -611,11 +612,11 @@ WSopt [ \t\r]* ) { QCString result=def->isPredefined ? def->definition : expandMacro(yyscanner,yytext); - outputArray(yyscanner,result,result.length()); + outputString(yyscanner,result); } else { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } } <CopyLine,LexCopyLine>"\\"\r?/\n { // strip line continuation characters @@ -640,10 +641,10 @@ WSopt [ \t\r]* if (yyextra->roundCount==0) { QCString result=expandMacro(yyscanner,yyextra->defArgsStr); - //printf("yyextra->defArgsStr='%s'->'%s'\n",yyextra->defArgsStr.data(),result.data()); + //printf("yyextra->defArgsStr='%s'->'%s'\n",qPrint(yyextra->defArgsStr),qPrint(result)); if (yyextra->findDefArgContext==CopyLine) { - outputArray(yyscanner,result,result.length()); + outputString(yyscanner,result); BEGIN(yyextra->findDefArgContext); } else // yyextra->findDefArgContext==IncludeID @@ -848,7 +849,7 @@ WSopt [ \t\r]* <Guard>\n { unput(*yytext); //printf("Guard: '%s'\n", - // yyextra->guardExpr.data()); + // qPrint(yyextra->guardExpr)); bool guard=computeExpression(yyscanner,yyextra->guardExpr); setCaseDone(yyscanner,guard); if (guard) @@ -1020,11 +1021,11 @@ WSopt [ \t\r]* yyextra->defName = yyextra->defName.left(yyextra->defName.length()-1).stripWhiteSpace(); yyextra->defVarArgs = FALSE; //printf("Guard check: %s!=%s || %d\n", - // yyextra->defName.data(),yyextra->lastGuardName.data(),yyextra->expectGuard); + // qPrint(yyextra->defName),qPrint(yyextra->lastGuardName),yyextra->expectGuard); if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard) { // define may appear in the output QCString tmp=(QCString)"#define "+yyextra->defName; - outputArray(yyscanner,tmp.data(),tmp.length()); + outputString(yyscanner,tmp); yyextra->quoteArg=FALSE; yyextra->insideComment=FALSE; yyextra->lastGuardName.resize(0); @@ -1050,11 +1051,11 @@ WSopt [ \t\r]* yyextra->defLitText.resize(0); yyextra->defVarArgs = FALSE; //printf("Guard check: %s!=%s || %d\n", - // yyextra->defName.data(),yyextra->lastGuardName.data(),yyextra->expectGuard); + // qPrint(yyextra->defName),qPrint(yyextra->lastGuardName),yyextra->expectGuard); if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard) { // define may appear in the output QCString tmp=(QCString)"#define "+yyextra->defName; - outputArray(yyscanner,tmp.data(),tmp.length()); + outputString(yyscanner,tmp); yyextra->quoteArg=FALSE; yyextra->insideComment=FALSE; if (yyextra->insideCS) yyextra->defText="1"; // for C#, use "1" as define text @@ -1079,7 +1080,7 @@ WSopt [ \t\r]* yyextra->defName = yytext; yyextra->defVarArgs = FALSE; QCString tmp=(QCString)"#define "+yyextra->defName+yyextra->defArgsStr; - outputArray(yyscanner,tmp.data(),tmp.length()); + outputString(yyscanner,tmp); yyextra->quoteArg=FALSE; yyextra->insideComment=FALSE; BEGIN(DefineText); @@ -1093,7 +1094,7 @@ WSopt [ \t\r]* <DefineArg>{B}*")"{B}* { yyextra->defArgsStr+=yytext; QCString tmp=(QCString)"#define "+yyextra->defName+yyextra->defArgsStr+yyextra->defExtraSpacing; - outputArray(yyscanner,tmp.data(),tmp.length()); + outputString(yyscanner,tmp); yyextra->quoteArg=FALSE; yyextra->insideComment=FALSE; BEGIN(DefineText); @@ -1137,7 +1138,7 @@ WSopt [ \t\r]* BEGIN(CopyCComment); } <DefineText>{CPPC}[!/]? { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); yyextra->lastCPPContext=YY_START; yyextra->defLitText+=' '; BEGIN(SkipCPPComment); @@ -1157,14 +1158,14 @@ WSopt [ \t\r]* } } <SkipCComment>{CPPC}("/")* { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <SkipCComment>{CCS} { outputChar(yyscanner,'/');outputChar(yyscanner,'*'); //yyextra->commentCount++; } <SkipCComment>[\\@][\\@]("f{"|"f$"|"f[") { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* { bool markdownSupport = Config_getBool(MARKDOWN_SUPPORT); @@ -1174,7 +1175,7 @@ WSopt [ \t\r]* } else { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); yyextra->fenceSize=(int)yyleng; BEGIN(SkipVerbatim); } @@ -1187,17 +1188,17 @@ WSopt [ \t\r]* } else { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); yyextra->fenceSize=(int)yyleng; BEGIN(SkipVerbatim); } } <SkipCComment>[\\@][\\@]("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly"|"dot"|"code"("{"[^}]*"}")?){BN}+ { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); yyextra->yyLineNr+=QCString(yytext).contains('\n'); } <SkipCComment>[\\@]("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly"|"dot"|"code"("{"[^}]*"}")?){BN}+ { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); yyextra->yyLineNr+=QCString(yytext).contains('\n'); yyextra->fenceSize=0; if (yytext[1]=='f') @@ -1214,7 +1215,7 @@ WSopt [ \t\r]* BEGIN(SkipVerbatim); } <SkipCComment,SkipCPPComment>[\\@][\\@]"cond"[ \t]+ { // escaped @cond - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <SkipCPPComment>[\\@]"cond"[ \t]+ { // conditional section yyextra->ccomment=TRUE; @@ -1292,7 +1293,7 @@ WSopt [ \t\r]* <SkipCond,SkipCComment,SkipCPPComment>[\\@][\\@]"endcond"/[^a-z_A-Z0-9\x80-\xFF] { if (!yyextra->skip) { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } } <SkipCond>[\\@]"endcond"/[^a-z_A-Z0-9\x80-\xFF] { @@ -1316,7 +1317,7 @@ WSopt [ \t\r]* } } <SkipVerbatim>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endcode"|"f$"|"f]"|"f}") { /* end of verbatim block */ - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); if (yytext[1]=='f' && yyextra->blockName=="f") { BEGIN(SkipCComment); @@ -1327,24 +1328,24 @@ WSopt [ \t\r]* } } <SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); if (yyextra->fenceSize==(yy_size_t)yyleng) { BEGIN(SkipCComment); } } <SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); if (yyextra->fenceSize==(yy_size_t)yyleng) { BEGIN(SkipCComment); } } <SkipVerbatim>{CCE}|{CCS} { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <SkipCComment,SkipVerbatim>[^*\\@\x06~`\n\/]+ { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <SkipCComment,SkipVerbatim>\n { yyextra->yyLineNr++; @@ -1390,7 +1391,7 @@ WSopt [ \t\r]* <RemoveCComment>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); } <RemoveCComment>. <SkipCPPComment>[^\n\/\\@]+ { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <SkipCPPComment,RemoveCPPComment>\n { unput(*yytext); @@ -1403,7 +1404,7 @@ WSopt [ \t\r]* outputChar(yyscanner,'/');outputChar(yyscanner,'/'); } <SkipCPPComment>[^\x06\@\\\n]+ { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); } <SkipCPPComment>. { outputChar(yyscanner,*yytext); @@ -1462,12 +1463,12 @@ WSopt [ \t\r]* yyextra->defLitText+=yytext; if (!comment.isEmpty()) { - outputArray(yyscanner,comment,comment.length()); + outputString(yyscanner,comment); yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-comment.length()-1); } outputChar(yyscanner,'\n'); Define *def=0; - //printf("Define name='%s' text='%s' litTexti='%s'\n",yyextra->defName.data(),yyextra->defText.data(),yyextra->defLitText.data()); + //printf("Define name='%s' text='%s' litTexti='%s'\n",qPrint(yyextra->defName),qPrint(yyextra->defText),qPrint(yyextra->defLitText)); if (yyextra->includeStack.empty() || yyextra->curlyCount>0) { addMacroDefinition(yyscanner); @@ -1475,7 +1476,7 @@ WSopt [ \t\r]* def=isDefined(yyscanner,yyextra->defName); if (def==0) // new define { - //printf("new define '%s'!\n",yyextra->defName.data()); + //printf("new define '%s'!\n",qPrint(yyextra->defName)); addDefine(yyscanner); } else if (def /*&& macroIsAccessible(def)*/) @@ -1489,13 +1490,13 @@ WSopt [ \t\r]* def->name = yyextra->defName; def->definition = yyextra->defText.stripWhiteSpace(); def->nargs = yyextra->defArgs; - def->fileName = yyextra->yyFileName.copy(); + def->fileName = yyextra->yyFileName; def->lineNr = yyextra->yyLineNr-yyextra->yyMLines; def->columnNr = yyextra->yyColNr; } else { - //printf("error: define %s is defined more than once!\n",yyextra->defName.data()); + //printf("error: define %s is defined more than once!\n",qPrint(yyextra->defName)); } } yyextra->argMap.clear(); @@ -1560,13 +1561,13 @@ WSopt [ \t\r]* yyextra->inputBufPos = fs->oldFileBufPos; yyextra->curlyCount = fs->curlyCount; setFileName(yyscanner,fs->fileName); - DBG_CTX((stderr,"######## FileName %s\n",yyextra->yyFileName.data())); + DBG_CTX((stderr,"######## FileName %s\n",qPrint(yyextra->yyFileName))); // Deal with file changes due to // #include's within { .. } blocks QCString lineStr(15+yyextra->yyFileName.length()); - lineStr.sprintf("# %d \"%s\" 2",yyextra->yyLineNr,yyextra->yyFileName.data()); - outputArray(yyscanner,lineStr.data(),lineStr.length()); + lineStr.sprintf("# %d \"%s\" 2",yyextra->yyLineNr,qPrint(yyextra->yyFileName)); + outputString(yyscanner,lineStr); yyextra->includeStack.pop_back(); @@ -1611,7 +1612,7 @@ WSopt [ \t\r]* } else { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); yyextra->lastCContext=YY_START; yyextra->commentCount=1; if (yyleng==3) @@ -1633,7 +1634,7 @@ WSopt [ \t\r]* } else { - outputArray(yyscanner,yytext,(int)yyleng); + outputArray(yyscanner,yytext,yyleng); yyextra->lastCPPContext=YY_START; if (yyleng==3) { @@ -1670,11 +1671,11 @@ static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) return bytesToCopy; } -static void setFileName(yyscan_t yyscanner,const char *name) +static void setFileName(yyscan_t yyscanner,const QCString &name) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); bool ambig; - FileInfo fi(name); + FileInfo fi(name.str()); state->yyFileName=fi.absFilePath(); state->yyFileDef=findFileDef(Doxygen::inputNameLinkedMap,state->yyFileName,ambig); if (state->yyFileDef==0) // if this is not an input file check if it is an @@ -1683,7 +1684,7 @@ static void setFileName(yyscan_t yyscanner,const char *name) state->yyFileDef=findFileDef(Doxygen::includeNameLinkedMap,state->yyFileName,ambig); } //printf("setFileName(%s) state->yyFileName=%s state->yyFileDef=%p\n", - // name,state->yyFileName.data(),state->yyFileDef); + // name,qPrint(state->yyFileName),state->yyFileDef); if (state->yyFileDef && state->yyFileDef->isReference()) state->yyFileDef=0; state->insideCS = getLanguageFromFileName(state->yyFileName)==SrcLangExt_CSharp; state->insideFtn = getLanguageFromFileName(state->yyFileName)==SrcLangExt_Fortran; @@ -1694,13 +1695,13 @@ static void incrLevel(yyscan_t yyscanner) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); state->levelGuard.push(false); - //printf("%s line %d: incrLevel %d\n",yyextra->yyFileName.data(),yyextra->yyLineNr,yyextra->levelGuard.size()); + //printf("%s line %d: incrLevel %d\n",qPrint(yyextra->yyFileName),yyextra->yyLineNr,yyextra->levelGuard.size()); } static void decrLevel(yyscan_t yyscanner) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - //printf("%s line %d: decrLevel %d\n",state->yyFileName.data(),state->yyLineNr,state->levelGuard.size()); + //printf("%s line %d: decrLevel %d\n",qPrint(state->yyFileName),state->yyLineNr,state->levelGuard.size()); if (!state->levelGuard.empty()) { state->levelGuard.pop(); @@ -1737,7 +1738,7 @@ static FileState *checkAndOpenFile(yyscan_t yyscanner,const QCString &fileName,b YY_EXTRA_TYPE state = preYYget_extra(yyscanner); alreadyProcessed = FALSE; FileState *fs = 0; - //printf("checkAndOpenFile(%s)\n",fileName.data()); + //printf("checkAndOpenFile(%s)\n",qPrint(fileName)); FileInfo fi(fileName.str()); if (fi.exists() && fi.isFile()) { @@ -1771,7 +1772,7 @@ static FileState *checkAndOpenFile(yyscan_t yyscanner,const QCString &fileName,b //printf(" already included 2\n"); return 0; } - //printf("#include %s\n",absName.data()); + //printf("#include %s\n",qPrint(absName)); fs = new FileState(fi.size()+4096); if (!readInputFile(absName,fs->fileBuf)) @@ -1789,10 +1790,10 @@ static FileState *checkAndOpenFile(yyscan_t yyscanner,const QCString &fileName,b return fs; } -static FileState *findFile(yyscan_t yyscanner, const char *fileName,bool localInclude,bool &alreadyProcessed) +static FileState *findFile(yyscan_t yyscanner, const QCString &fileName,bool localInclude,bool &alreadyProcessed) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - //printf("** findFile(%s,%d) state->yyFileName=%s\n",fileName,localInclude,state->yyFileName.data()); + //printf("** findFile(%s,%d) state->yyFileName=%s\n",qPrint(fileName),localInclude,qPrint(state->yyFileName)); if (Portable::isAbsolutePath(fileName)) { FileState *fs = checkAndOpenFile(yyscanner,fileName,alreadyProcessed); @@ -1812,7 +1813,7 @@ static FileState *findFile(yyscan_t yyscanner, const char *fileName,bool localIn FileInfo fi(state->yyFileName.str()); if (fi.exists()) { - QCString absName = QCString(fi.dirPath(TRUE).data())+"/"+fileName; + QCString absName = QCString(fi.dirPath(TRUE))+"/"+fileName; FileState *fs = checkAndOpenFile(yyscanner,absName,alreadyProcessed); if (fs) { @@ -1832,7 +1833,7 @@ static FileState *findFile(yyscan_t yyscanner, const char *fileName,bool localIn } for (auto path : state->pathList) { - std::string absName = path+"/"+fileName; + std::string absName = (path+"/"+fileName).str(); //printf(" Looking for %s in %s\n",fileName,path.c_str()); FileState *fs = checkAndOpenFile(yyscanner,absName.c_str(),alreadyProcessed); if (fs) @@ -1850,10 +1851,10 @@ static FileState *findFile(yyscan_t yyscanner, const char *fileName,bool localIn return 0; } -static QCString extractTrailingComment(const char *s) +static QCString extractTrailingComment(const QCString &s) { - if (s==0) return ""; - int i=(int)strlen(s)-1; + if (s.isEmpty()) return ""; + int i=(int)s.length()-1; while (i>=0) { char c=s[i]; @@ -1969,7 +1970,7 @@ static QCString stringize(const QCString &s) } } } - //printf("stringize '%s'->'%s'\n",s.data(),result.data()); + //printf("stringize '%s'->'%s'\n",qPrint(s),qPrint(result)); return result; } @@ -1981,7 +1982,7 @@ static QCString stringize(const QCString &s) static void processConcatOperators(QCString &expr) { if (expr.isEmpty()) return; - //printf("processConcatOperators: in='%s'\n",expr.data()); + //printf("processConcatOperators: in='%s'\n",qPrint(expr)); std::string e = expr.str(); static const reg::Ex r(R"(\s*##\s*)"); reg::Iterator end; @@ -1995,13 +1996,13 @@ static void processConcatOperators(QCString &expr) const auto &match = *it; size_t n = match.position(); size_t l = match.length(); - //printf("Match: '%s'\n",expr.data()+i); + //printf("Match: '%s'\n",qPrint(expr.mid(i))); if (n+l+1<e.length() && e[static_cast<int>(n+l)]=='@' && expr[static_cast<int>(n+l+1)]=='-') { // remove no-rescan marker after ID l+=2; } - //printf("found '%s'\n",expr.mid(n,l).data()); + //printf("found '%s'\n",qPrint(expr.mid(n,l))); // remove the ## operator and the surrounding whitespace e=e.substr(0,n)+e.substr(n+l); int k=static_cast<int>(n)-1; @@ -2022,7 +2023,7 @@ static void processConcatOperators(QCString &expr) expr = e; - //printf("processConcatOperators: out='%s'\n",expr.data()); + //printf("processConcatOperators: out='%s'\n",qPrint(expr)); } static void returnCharToStream(yyscan_t yyscanner,char c) @@ -2053,7 +2054,7 @@ static inline void addTillEndOfString(yyscan_t yyscanner,const QCString &expr,QC static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCString *rest,int pos,int &len,const Define *def,QCString &result,int level) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - //printf(">replaceFunctionMacro(expr='%s',rest='%s',pos=%d,def='%s') level=%d\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),state->levelGuard.size()); + //printf(">replaceFunctionMacro(expr='%s',rest='%s',pos=%d,def='%s') level=%d\n",qPrint(expr),rest ? qPrint(*rest) : 0,pos,qPrint(def->name),state->levelGuard.size()); uint j=pos; len=0; result.resize(0); @@ -2065,7 +2066,7 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin } if (cc!='(') { - unputChar(yyscanner,expr,rest,j,(char)cc); + unputChar(yyscanner,expr,rest,j,' '); return FALSE; } getNextChar(yyscanner,expr,rest,j); // eat the '(' character @@ -2206,7 +2207,7 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin // substitution of all formal arguments QCString resExpr; const QCString d=def->definition.stripWhiteSpace(); - //printf("Macro definition: '%s'\n",d.data()); + //printf("Macro definition: '%s'\n",qPrint(d)); bool inString=FALSE; while (k<d.length()) { @@ -2242,12 +2243,12 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin while (l<(int)d.length() && d.at(l)==' ') l++; if (l<(int)d.length()-1 && d.at(l)=='#' && d.at(l+1)=='#') hash=TRUE; } - //printf("request key %s result %s\n",key.data(),argTable[key]->data()); - auto it = argTable.find(key.data()); + //printf("request key %s result %s\n",qPrint(key),argTable[key]->data()); + auto it = argTable.find(key.str()); if (it!=argTable.end()) { QCString substArg = it->second.c_str(); - //printf("substArg='%s'\n",substArg.data()); + //printf("substArg='%s'\n",qPrint(substArg)); // only if no ## operator is before or after the argument // marker we do macro expansion. if (!hash) @@ -2256,7 +2257,7 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin } if (inString) { - //printf("'%s'=stringize('%s')\n",stringize(*subst).data(),subst->data()); + //printf("'%s'=stringize('%s')\n",qPrint(stringize(*subst)),subst->data()); // if the marker is inside a string (because a # was put // before the macro name) we must escape " and \ characters @@ -2295,10 +2296,10 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin } len=j-pos; result=resExpr; - //printf("<replaceFunctionMacro(expr='%s',rest='%s',pos=%d,def='%s',result='%s') level=%d return=TRUE\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),result.data(),state->levelGuard.size()); + //printf("<replaceFunctionMacro(expr='%s',rest='%s',pos=%d,def='%s',result='%s') level=%d return=TRUE\n",qPrint(expr),rest ? qPrint(*rest) : 0,pos,qPrint(def->name),qPrint(result),state->levelGuard.size()); return TRUE; } - //printf("<replaceFunctionMacro(expr='%s',rest='%s',pos=%d,def='%s',result='%s') level=%d return=FALSE\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),result.data(),state->levelGuard.size()); + //printf("<replaceFunctionMacro(expr='%s',rest='%s',pos=%d,def='%s',result='%s') level=%d return=FALSE\n",qPrint(expr),rest ? qPrint(*rest) : 0,pos,qPrint(def->name),qPrint(result),state->levelGuard.size()); return FALSE; } @@ -2370,21 +2371,21 @@ static int getNextId(const QCString &expr,int p,int *l) static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - //printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : "", pos, level); + //printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",qPrint(expr),rest ? qPrint(*rest) : "", pos, level); if (expr.isEmpty()) { //printf("<expandExpression: empty\n"); return TRUE; } - if (state->expanded.find(expr.data())!=state->expanded.end() && + if (state->expanded.find(expr.str())!=state->expanded.end() && level>MAX_EXPANSION_DEPTH) // check for too deep recursive expansions { - //printf("<expandExpression: already expanded expr='%s'\n",expr.data()); + //printf("<expandExpression: already expanded expr='%s'\n",qPrint(expr)); return FALSE; } else { - state->expanded.insert(expr.data()); + state->expanded.insert(expr.str()); } QCString macroName; QCString expMacro; @@ -2396,15 +2397,15 @@ static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in { bool replaced=FALSE; macroName=expr.mid(p,l); - //printf(" p=%d macroName=%s\n",p,macroName.data()); + //printf(" p=%d macroName=%s\n",p,qPrint(macroName)); if (p<2 || !(expr.at(p-2)=='@' && expr.at(p-1)=='-')) // no-rescan marker? { - if (state->expandedDict.find(macroName.data())==state->expandedDict.end()) // expand macro + if (state->expandedDict.find(macroName.str())==state->expandedDict.end()) // expand macro { Define *def=isDefined(yyscanner,macroName); if (macroName=="defined") { - //printf("found defined inside macro definition '%s'\n",expr.right(expr.length()-p).data()); + //printf("found defined inside macro definition '%s'\n",qPrint(expr.right(expr.length()-p))); definedTest=TRUE; } else if (definedTest) // macro name was found after defined @@ -2417,7 +2418,7 @@ static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in else if (def && def->nargs==-1) // simple macro { // substitute the definition of the macro - //printf("macro '%s'->'%s'\n",macroName.data(),def->definition.data()); + //printf("macro '%s'->'%s'\n",qPrint(macroName),qPrint(def->definition)); if (state->nospaces) { expMacro=def->definition.stripWhiteSpace(); @@ -2429,7 +2430,7 @@ static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in //expMacro=def->definition.stripWhiteSpace(); replaced=TRUE; len=l; - //printf("simple macro expansion='%s'->'%s'\n",macroName.data(),expMacro.data()); + //printf("simple macro expansion='%s'->'%s'\n",qPrint(macroName),qPrint(expMacro)); } else if (def && def->nargs>=0) // function macro { @@ -2438,15 +2439,15 @@ static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in //printf(" <<<< call replaceFunctionMacro: replaced=%d\n",replaced); len+=l; } - //printf(" macroName='%s' expMacro='%s' replaced=%d\n",macroName.data(),expMacro.data(),replaced); + //printf(" macroName='%s' expMacro='%s' replaced=%d\n",qPrint(macroName),qPrint(expMacro),replaced); if (replaced) // expand the macro and rescan the expression { - //printf(" replacing '%s'->'%s'\n",expr.mid(p,len).data(),expMacro.data()); + //printf(" replacing '%s'->'%s'\n",expr.mid(p,qPrint(len)),qPrint(expMacro)); QCString resultExpr=expMacro; QCString restExpr=expr.right(expr.length()-len-p); processConcatOperators(resultExpr); - //printf(" macroName=%s restExpr='%s' def->nonRecursive=%d\n",macroName.data(),restExpr.data(),def->nonRecursive); + //printf(" macroName=%s restExpr='%s' def->nonRecursive=%d\n",qPrint(macroName),qPrint(restExpr),def->nonRecursive); bool expanded=false; if (def && !def->nonRecursive) { @@ -2461,7 +2462,7 @@ static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in if (expanded) { expr=expr.left(p)+resultExpr+restExpr; - //printf(" new expression: '%s' old i=%d new i=%d\n",expr.data(),i,p); + //printf(" new expression: '%s' old i=%d new i=%d\n",qPrint(expr),i,p); i=p; } else @@ -2479,7 +2480,7 @@ static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in else // move to the next macro name { expr=expr.left(p)+"@-"+expr.right(expr.length()-p); - //printf("macro already expanded, moving to the next macro expr=%s\n",expr.data()); + //printf("macro already expanded, moving to the next macro expr=%s\n",qPrint(expr)); i=p+l+2; //i=p+l; } @@ -2504,7 +2505,7 @@ static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in i=p+l; } } - //printf("<expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos,level); + //printf("<expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",qPrint(expr),rest ? qPrint(*rest) : "", pos,level); return TRUE; } @@ -2550,10 +2551,11 @@ static const char *processUntilMatchingTerminator(const char *inputStr,QCString * and removes all occurrences of @@E. * All identifiers found are replaced by 0L */ -static QCString removeIdsAndMarkers(const char *s) +static QCString removeIdsAndMarkers(const QCString &s) { //printf("removeIdsAndMarkers(%s)\n",s); - const char *p=s; + if (s.isEmpty()) return s; + const char *p=s.data(); char c; bool inNum=FALSE; QCString result; @@ -2661,7 +2663,7 @@ nextChar: } } } - //printf("removeIdsAndMarkers(%s)=%s\n",s,result.data()); + //printf("removeIdsAndMarkers(%s)=%s\n",s,qPrint(result)); return result; } @@ -2669,9 +2671,10 @@ nextChar: * \par assumption: * \a s only contains pairs of @@'s */ -static QCString removeMarkers(const char *s) +static QCString removeMarkers(const QCString &s) { - const char *p=s; + if (s.isEmpty()) return s; + const char *p=s.data(); char c; QCString result; if (p) @@ -2722,7 +2725,7 @@ static QCString removeMarkers(const char *s) } } } - //printf("RemoveMarkers(%s)=%s\n",s,result.data()); + //printf("RemoveMarkers(%s)=%s\n",s,qPrint(result)); return result; } @@ -2736,11 +2739,11 @@ static bool computeExpression(yyscan_t yyscanner,const QCString &expr) QCString e=expr; state->expanded.clear(); expandExpression(yyscanner,e,0,0,0); - //printf("after expansion '%s'\n",e.data()); + //printf("after expansion '%s'\n",qPrint(e)); e = removeIdsAndMarkers(e); if (e.isEmpty()) return FALSE; - //printf("parsing '%s'\n",e.data()); - return state->constExpParser.parse(state->yyFileName,state->yyLineNr,e.str()); + //printf("parsing '%s'\n",qPrint(e)); + return state->constExpParser.parse(state->yyFileName.data(),state->yyLineNr,e.str()); } /*! expands the macro definition in \a name @@ -2754,7 +2757,7 @@ static QCString expandMacro(yyscan_t yyscanner,const QCString &name) state->expanded.clear(); expandExpression(yyscanner,n,0,0,0); n=removeMarkers(n); - //printf("expandMacro '%s'->'%s'\n",name.data(),n.data()); + //printf("expandMacro '%s'->'%s'\n",qPrint(name),qPrint(n)); return n; } @@ -2770,9 +2773,9 @@ static void addDefine(yyscan_t yyscanner) def.lineNr = state->yyLineNr-state->yyMLines; def.columnNr = state->yyColNr; def.varArgs = state->defVarArgs; - //printf("newDefine: %s %s file: %s\n",def.name.data(),def.definition.data(), - // def.fileDef ? def.fileDef->name().data() : def.fileName.data()); - //printf("newDefine: '%s'->'%s'\n",def.name.data(),def.definition.data()); + //printf("newDefine: %s %s file: %s\n",qPrint(def.name),qPrint(def.definition), + // def.fileDef ? qPrint(def.fileDef->name()) : qPrint(def.fileName)); + //printf("newDefine: '%s'->'%s'\n",qPrint(def.name),qPrint(def.definition)); if (!def.name.isEmpty() && Doxygen::expandAsDefinedSet.find(def.name.str())!=Doxygen::expandAsDefinedSet.end()) { @@ -2836,12 +2839,18 @@ static inline void outputChar(yyscan_t yyscanner,char c) if (state->includeStack.empty() || state->curlyCount>0) state->outputBuf->addChar(c); } -static inline void outputArray(yyscan_t yyscanner,const char *a,int len) +static inline void outputArray(yyscan_t yyscanner,const char *a,yy_size_t len) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); if (state->includeStack.empty() || state->curlyCount>0) state->outputBuf->addArray(a,len); } +static inline void outputString(yyscan_t yyscanner,const QCString &a) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + if (state->includeStack.empty() || state->curlyCount>0) state->outputBuf->addArray(a.data(),a.length()); +} + static QCString determineAbsoluteIncludeName(const QCString &curFile,const QCString &incFileName) { bool searchIncludes = Config_getBool(SEARCH_INCLUDES); @@ -2849,7 +2858,7 @@ static QCString determineAbsoluteIncludeName(const QCString &curFile,const QCStr FileInfo fi(curFile.str()); if (fi.exists()) { - QCString absName = QCString(fi.dirPath(TRUE).data())+"/"+incFileName; + QCString absName = QCString(fi.dirPath(TRUE))+"/"+incFileName; FileInfo fi2(absName.str()); if (fi2.exists()) { @@ -2864,18 +2873,18 @@ static QCString determineAbsoluteIncludeName(const QCString &curFile,const QCStr if (fi3.exists() && fi3.isDir()) { absName = QCString(fi3.absFilePath())+"/"+incFileName; - //printf("trying absName=%s\n",absName.data()); + //printf("trying absName=%s\n",qPrint(absName)); FileInfo fi4(absName.str()); if (fi4.exists()) { absIncFileName=fi4.absFilePath(); break; } - //printf( "absIncFileName = %s\n", absIncFileName.data() ); + //printf( "absIncFileName = %s\n", qPrint(absIncFileName) ); } } } - //printf( "absIncFileName = %s\n", absIncFileName.data() ); + //printf( "absIncFileName = %s\n", qPrint(absIncFileName) ); } return absIncFileName; } @@ -2912,14 +2921,14 @@ static void readIncludeFile(yyscan_t yyscanner,const QCString &inc) QCString oldFileName = state->yyFileName; FileDef *oldFileDef = state->yyFileDef; int oldLineNr = state->yyLineNr; - //printf("Searching for '%s'\n",incFileName.data()); + //printf("Searching for '%s'\n",qPrint(incFileName)); QCString absIncFileName = determineAbsoluteIncludeName(state->yyFileName,incFileName); // findFile will overwrite state->yyFileDef if found FileState *fs; bool alreadyProcessed = FALSE; - //printf("calling findFile(%s)\n",incFileName.data()); + //printf("calling findFile(%s)\n",qPrint(incFileName)); if ((fs=findFile(yyscanner,incFileName,localInclude,alreadyProcessed))) // see if the include file can be found { { @@ -2934,7 +2943,7 @@ static void readIncludeFile(yyscan_t yyscanner,const QCString &inc) { Debug::print(Debug::Preprocessor,0," "); } - Debug::print(Debug::Preprocessor,0,"#include %s: parsing...\n",incFileName.data()); + Debug::print(Debug::Preprocessor,0,"#include %s: parsing...\n",qPrint(incFileName)); } if (state->includeStack.empty() && oldFileDef) @@ -2968,10 +2977,10 @@ static void readIncludeFile(yyscan_t yyscanner,const QCString &inc) // Deal with file changes due to // #include's within { .. } blocks QCString lineStr(state->yyFileName.length()+20); - lineStr.sprintf("# 1 \"%s\" 1\n",state->yyFileName.data()); - outputArray(yyscanner,lineStr.data(),lineStr.length()); + lineStr.sprintf("# 1 \"%s\" 1\n",qPrint(state->yyFileName)); + outputString(yyscanner,lineStr); - DBG_CTX((stderr,"Switching to include file %s\n",incFileName.data())); + DBG_CTX((stderr,"Switching to include file %s\n",qPrint(incFileName))); state->expectGuard=TRUE; state->inputBuf = &fs->fileBuf; state->inputBufPos=0; @@ -3022,7 +3031,7 @@ static void readIncludeFile(yyscan_t yyscanner,const QCString &inc) } if (state->curlyCount>0 && !alreadyProcessed) // failed to find #include inside { ... } { - warn(state->yyFileName,state->yyLineNr,"include file %s not found, perhaps you forgot to add its directory to INCLUDE_PATH?",incFileName.data()); + warn(state->yyFileName,state->yyLineNr,"include file %s not found, perhaps you forgot to add its directory to INCLUDE_PATH?",qPrint(incFileName)); } } } @@ -3030,12 +3039,12 @@ static void readIncludeFile(yyscan_t yyscanner,const QCString &inc) /* ----------------------------------------------------------------- */ -static void startCondSection(yyscan_t yyscanner,const char *sectId) +static void startCondSection(yyscan_t yyscanner,const QCString §Id) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); //printf("startCondSection: skip=%d stack=%d\n",state->skip,state->condStack.size()); CondParser prs; - bool expResult = prs.parse(state->yyFileName,state->yyLineNr,sectId); + bool expResult = prs.parse(state->yyFileName.data(),state->yyLineNr,sectId.data()); state->condStack.emplace(std::make_unique<CondCtx>(state->yyLineNr,sectId,state->skip)); if (!expResult) { @@ -3070,13 +3079,13 @@ static void forceEndCondSection(yyscan_t yyscanner) state->skip=FALSE; } -static QCString escapeAt(const char *text) +static QCString escapeAt(const QCString &text) { QCString result; - if (text) + if (!text.isEmpty()) { char c; - const char *p=text; + const char *p=text.data(); while ((c=*p++)) { if (c=='@') result+="@@"; else result+=c; @@ -3107,7 +3116,7 @@ static char resolveTrigraph(char c) static int getNextChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos) { - //printf("getNextChar(%s,%s,%d)\n",expr.data(),rest ? rest->data() : 0,pos); + //printf("getNextChar(%s,%s,%d)\n",qPrint(expr),rest ? rest->data() : 0,pos); if (pos<expr.length()) { //printf("%c=expr()\n",expr.at(pos)); @@ -3130,7 +3139,7 @@ static int getNextChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,ui static int getCurrentChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint pos) { - //printf("getCurrentChar(%s,%s,%d)\n",expr.data(),rest ? rest->data() : 0,pos); + //printf("getCurrentChar(%s,%s,%d)\n",qPrint(expr),rest ? rest->data() : 0,pos); if (pos<expr.length()) { //printf("%c=expr()\n",expr.at(pos)); @@ -3153,7 +3162,7 @@ static int getCurrentChar(yyscan_t yyscanner,const QCString &expr,QCString *rest static void unputChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos,char c) { - //printf("unputChar(%s,%s,%d,%c)\n",expr.data(),rest ? rest->data() : 0,pos,c); + //printf("unputChar(%s,%s,%d,%c)\n",qPrint(expr),rest ? rest->data() : 0,pos,c); if (pos<expr.length()) { pos++; @@ -3169,13 +3178,13 @@ static void unputChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uin //unput(c); returnCharToStream(yyscanner,c); } - //printf("result: unputChar(%s,%s,%d,%c)\n",expr.data(),rest ? rest->data() : 0,pos,c); + //printf("result: unputChar(%s,%s,%d,%c)\n",qPrint(expr),rest ? rest->data() : 0,pos,c); } /** Returns a reference to a Define object given its name or 0 if the Define does * not exist. */ -static Define *isDefined(yyscan_t yyscanner,const char *name) +static Define *isDefined(yyscan_t yyscanner,const QCString &name) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); @@ -3183,7 +3192,7 @@ static Define *isDefined(yyscan_t yyscanner,const char *name) auto findDefine = [&undef,&name](DefineMap &map) { Define *d=0; - auto it = map.find(name); + auto it = map.find(name.str()); if (it!=map.end()) { d = &it->second; @@ -3204,7 +3213,7 @@ static Define *isDefined(yyscan_t yyscanner,const char *name) return def; } -static void initPredefined(yyscan_t yyscanner,const char *fileName) +static void initPredefined(yyscan_t yyscanner,const QCString &fileName) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); @@ -3282,7 +3291,7 @@ static void initPredefined(yyscan_t yyscanner,const char *fileName) int argIndex = it->second; QCString marker; marker.sprintf(" @%d ",argIndex); - definition+=marker; + definition+=marker.str(); } else { @@ -3308,7 +3317,7 @@ static void initPredefined(yyscan_t yyscanner,const char *fileName) state->contextDefines.insert(std::make_pair(def.name.str(),def)); //printf("#define '%s' '%s' #nargs=%d\n", - // def->name.data(),def->definition.data(),def->nargs); + // qPrint(def->name),qPrint(def->definition),def->nargs); } } else if (!ds.empty()) // predefined non-function macro definition @@ -3347,10 +3356,10 @@ struct Preprocessor::Private preYY_state state; }; -void Preprocessor::addSearchDir(const char *dir) +void Preprocessor::addSearchDir(const QCString &dir) { YY_EXTRA_TYPE state = preYYget_extra(p->yyscanner); - FileInfo fi(dir); + FileInfo fi(dir.str()); if (fi.isDir()) state->pathList.push_back(fi.absFilePath()); } @@ -3365,7 +3374,7 @@ Preprocessor::~Preprocessor() preYYlex_destroy(p->yyscanner); } -void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output) +void Preprocessor::processFile(const QCString &fileName,BufStr &input,BufStr &output) { // printf("Preprocessor::processFile(%s)\n",fileName); yyscan_t yyscanner = p->yyscanner; @@ -3376,10 +3385,10 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output preYYset_debug(1,yyscanner); #endif - printlex(yy_flex_debug, TRUE, __FILE__, fileName); + printlex(yy_flex_debug, TRUE, __FILE__, qPrint(fileName)); uint orgOffset=output.curPos(); //printf("##########################\n%s\n####################\n", - // input.data()); + // qPrint(input)); state->macroExpansion = Config_getBool(MACRO_EXPANSION); state->expandOnlyPredef = Config_getBool(EXPAND_ONLY_PREDEF); @@ -3418,9 +3427,9 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output { const std::unique_ptr<CondCtx> &ctx = state->condStack.top(); QCString sectionInfo = " "; - if (ctx->sectionId!=" ") sectionInfo.sprintf(" with label '%s' ",ctx->sectionId.stripWhiteSpace().data()); + if (ctx->sectionId!=" ") sectionInfo.sprintf(" with label '%s' ",qPrint(ctx->sectionId.stripWhiteSpace())); warn(fileName,ctx->lineNr,"Conditional section%sdoes not have " - "a corresponding \\endcond command within this file.",sectionInfo.data()); + "a corresponding \\endcond command within this file.",qPrint(sectionInfo)); state->condStack.pop(); } // make sure we don't extend a \cond with missing \endcond over multiple files (see bug 624829) @@ -3431,7 +3440,7 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output std::lock_guard<std::mutex> lock(g_debugMutex); char *orgPos=output.data()+orgOffset; char *newPos=output.data()+output.curPos(); - Debug::print(Debug::Preprocessor,0,"Preprocessor output of %s (size: %d bytes):\n",fileName,newPos-orgPos); + Debug::print(Debug::Preprocessor,0,"Preprocessor output of %s (size: %d bytes):\n",qPrint(fileName),newPos-orgPos); int line=1; Debug::print(Debug::Preprocessor,0,"---------\n"); if (!Debug::isFlagSet(Debug::NoLineNo)) Debug::print(Debug::Preprocessor,0,"00001 "); @@ -3444,7 +3453,7 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output Debug::print(Debug::Preprocessor,0,"\n---------\n"); if (yyextra->contextDefines.size()>0) { - Debug::print(Debug::Preprocessor,0,"Macros accessible in this file (%s):\n", fileName); + Debug::print(Debug::Preprocessor,0,"Macros accessible in this file (%s):\n", qPrint(fileName)); Debug::print(Debug::Preprocessor,0,"---------\n"); for (auto &kv : yyextra->contextDefines) { @@ -3458,7 +3467,7 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output } else { - Debug::print(Debug::Preprocessor,0,"No macros accessible in this file (%s).\n", fileName); + Debug::print(Debug::Preprocessor,0,"No macros accessible in this file (%s).\n", qPrint(fileName)); } } @@ -3480,7 +3489,7 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output } //yyextra->defineManager.endContext(); - printlex(yy_flex_debug, FALSE, __FILE__, fileName); + printlex(yy_flex_debug, FALSE, __FILE__, qPrint(fileName)); // printf("Preprocessor::processFile(%s) finished\n",fileName); } diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h index 2992717..d1e6fab 100644 --- a/src/printdocvisitor.h +++ b/src/printdocvisitor.h @@ -36,19 +36,19 @@ class PrintDocVisitor : public DocVisitor void visit(DocWord *w) { indent_leaf(); - printf("%s",w->word().data()); + printf("%s",qPrint(w->word())); } void visit(DocLinkedWord *w) { indent_leaf(); - printf("%s",w->word().data()); + printf("%s",qPrint(w->word())); } void visit(DocWhiteSpace *w) { indent_leaf(); if (m_insidePre) { - printf("%s",w->chars().data()); + printf("%s",qPrint(w->chars())); } else { @@ -84,7 +84,7 @@ class PrintDocVisitor : public DocVisitor void visit(DocURL *u) { indent_leaf(); - printf("%s",u->url().data()); + printf("%s",qPrint(u->url())); } void visit(DocLineBreak *) { @@ -165,7 +165,7 @@ class PrintDocVisitor : public DocVisitor case DocVerbatim::Msc: printf("<msc>"); break; case DocVerbatim::PlantUML: printf("<plantuml>"); break; } - printf("%s",s->text().data()); + printf("%s",qPrint(s->text())); switch(s->type()) { case DocVerbatim::Code: printf("</code>"); break; @@ -184,12 +184,12 @@ class PrintDocVisitor : public DocVisitor void visit(DocAnchor *a) { indent_leaf(); - printf("<anchor name=\"%s\"/>",a->anchor().data()); + printf("<anchor name=\"%s\"/>",qPrint(a->anchor())); } void visit(DocInclude *inc) { indent_leaf(); - printf("<include file=\"%s\" type=\"",inc->file().data()); + printf("<include file=\"%s\" type=\"",qPrint(inc->file())); switch(inc->type()) { case DocInclude::Include: printf("include"); break; @@ -219,7 +219,7 @@ class PrintDocVisitor : public DocVisitor void visit(DocIncOperator *op) { indent_leaf(); - printf("<incoperator pattern=\"%s\" type=\"",op->pattern().data()); + printf("<incoperator pattern=\"%s\" type=\"",qPrint(op->pattern())); switch(op->type()) { case DocIncOperator::Line: printf("line"); break; @@ -232,12 +232,12 @@ class PrintDocVisitor : public DocVisitor void visit(DocFormula *f) { indent_leaf(); - printf("<formula name=%s text=%s/>",f->name().data(),f->text().data()); + printf("<formula name=%s text=%s/>",qPrint(f->name()),qPrint(f->text())); } void visit(DocIndexEntry *i) { indent_leaf(); - printf("<indexentry>%s</indexentry\n",i->entry().data()); + printf("<indexentry>%s</indexentry\n",qPrint(i->entry())); } void visit(DocSimpleSectSep *) { @@ -250,8 +250,8 @@ class PrintDocVisitor : public DocVisitor printf("<cite ref=\"%s\" file=\"%s\" " "anchor=\"%s\" text=\"%s\"" "/>\n", - cite->ref().data(),cite->file().data(),cite->anchor().data(), - cite->text().data()); + qPrint(cite->ref()),qPrint(cite->file()),qPrint(cite->anchor()), + qPrint(cite->text())); } //-------------------------------------- @@ -385,7 +385,17 @@ class PrintDocVisitor : public DocVisitor void visitPre(DocHtmlList *s) { indent_pre(); - if (s->type()==DocHtmlList::Ordered) printf("<ol>\n"); else printf("<ul>\n"); + if (s->type()==DocHtmlList::Ordered) + { + printf("<ol"); + for (const auto &opt : s->attribs()) + { + printf(" %s=\"%s\"",qPrint(opt.name),qPrint(opt.value)); + } + printf(">\n"); + } + else printf("<ul>\n"); + } void visitPost(DocHtmlList *s) { @@ -498,7 +508,7 @@ class PrintDocVisitor : public DocVisitor void visitPre(DocHRef *href) { indent_pre(); - printf("<a url=\"%s\">\n",href->url().data()); + printf("<a url=\"%s\">\n",qPrint(href->url())); } void visitPost(DocHRef *) { @@ -518,7 +528,7 @@ class PrintDocVisitor : public DocVisitor void visitPre(DocImage *img) { indent_pre(); - printf("<image src=\"%s\" type=\"",img->name().data()); + printf("<image src=\"%s\" type=\"",qPrint(img->name())); switch(img->type()) { case DocImage::Html: printf("html"); break; @@ -526,7 +536,7 @@ class PrintDocVisitor : public DocVisitor case DocImage::Rtf: printf("rtf"); break; case DocImage::DocBook: printf("docbook"); break; } - printf("\" %s %s inline=\"%s\">\n",img->width().data(),img->height().data(),img->isInlineImage() ? "yes" : "no"); + printf("\" %s %s inline=\"%s\">\n",qPrint(img->width()),qPrint(img->height()),img->isInlineImage() ? "yes" : "no"); } void visitPost(DocImage *) { @@ -536,7 +546,7 @@ class PrintDocVisitor : public DocVisitor void visitPre(DocDotFile *df) { indent_pre(); - printf("<dotfile src=\"%s\">\n",df->name().data()); + printf("<dotfile src=\"%s\">\n",qPrint(df->name())); } void visitPost(DocDotFile *) { @@ -546,7 +556,7 @@ class PrintDocVisitor : public DocVisitor void visitPre(DocMscFile *df) { indent_pre(); - printf("<mscfile src=\"%s\">\n",df->name().data()); + printf("<mscfile src=\"%s\">\n",qPrint(df->name())); } void visitPost(DocMscFile *) { @@ -556,7 +566,7 @@ class PrintDocVisitor : public DocVisitor void visitPre(DocDiaFile *df) { indent_pre(); - printf("<diafile src=\"%s\">\n",df->name().data()); + printf("<diafile src=\"%s\">\n",qPrint(df->name())); } void visitPost(DocDiaFile *) { @@ -567,7 +577,7 @@ class PrintDocVisitor : public DocVisitor { indent_pre(); printf("<link ref=\"%s\" file=\"%s\" anchor=\"%s\">\n", - lnk->ref().data(),lnk->file().data(),lnk->anchor().data()); + qPrint(lnk->ref()),qPrint(lnk->file()),qPrint(lnk->anchor())); } void visitPost(DocLink *) { @@ -580,8 +590,8 @@ class PrintDocVisitor : public DocVisitor printf("<ref ref=\"%s\" file=\"%s\" " "anchor=\"%s\" targetTitle=\"%s\"" " hasLinkText=\"%s\" refToAnchor=\"%s\" refToSection=\"%s\" refToTable=\"%s\">\n", - ref->ref().data(),ref->file().data(),ref->anchor().data(), - ref->targetTitle().data(),ref->hasLinkText()?"yes":"no", + qPrint(ref->ref()),qPrint(ref->file()),qPrint(ref->anchor()), + qPrint(ref->targetTitle()),ref->hasLinkText()?"yes":"no", ref->refToAnchor()?"yes":"no", ref->refToSection()?"yes":"no", ref->refToTable()?"yes":"no"); } @@ -593,7 +603,7 @@ class PrintDocVisitor : public DocVisitor void visitPre(DocSecRefItem *ref) { indent_pre(); - printf("<secrefitem target=\"%s\">\n",ref->target().data()); + printf("<secrefitem target=\"%s\">\n",qPrint(ref->target())); } void visitPost(DocSecRefItem *) { @@ -613,7 +623,7 @@ class PrintDocVisitor : public DocVisitor //void visitPre(DocLanguage *l) //{ // indent_pre(); - // printf("<language id=%s>\n",l->id().data()); + // printf("<language id=%s>\n",qPrint(l->id())); //} //void visitPost(DocLanguage *) //{ @@ -675,7 +685,7 @@ class PrintDocVisitor : public DocVisitor { indent_pre(); printf("<xrefitem file=\"%s\" anchor=\"%s\" title=\"%s\">\n", - x->file().data(),x->anchor().data(),x->title().data()); + qPrint(x->file()),qPrint(x->anchor()),qPrint(x->title())); } void visitPost(DocXRefItem *) { @@ -685,7 +695,7 @@ class PrintDocVisitor : public DocVisitor void visitPre(DocInternalRef *r) { indent_pre(); - printf("<internalref file=%s anchor=%s>\n",r->file().data(),r->anchor().data()); + printf("<internalref file=%s anchor=%s>\n",qPrint(r->file()),qPrint(r->anchor())); } void visitPost(DocInternalRef *) { diff --git a/src/pycode.h b/src/pycode.h index 8bce2a9..43179da 100644 --- a/src/pycode.h +++ b/src/pycode.h @@ -37,11 +37,11 @@ class PythonCodeParser : public CodeParserInterface PythonCodeParser(); virtual ~PythonCodeParser(); void parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt lang, bool isExampleBlock, - const char *exampleName=0, + const QCString &exampleName=QCString(), FileDef *fileDef=0, int startLine=-1, int endLine=-1, diff --git a/src/pycode.l b/src/pycode.l index 107d855..6acf333 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -118,27 +118,27 @@ static const char *stateToString(int state); static void startCodeLine(yyscan_t yyscanner); static int countLines(yyscan_t yyscanner); static void setCurrentDoc(yyscan_t yyscanner, const QCString &anchor); -static void addToSearchIndex(yyscan_t yyscanner, const char *text); -static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,Definition *d); -static void codify(yyscan_t yyscanner,const char* text); +static void addToSearchIndex(yyscan_t yyscanner, const QCString &text); +static const ClassDef *stripClassName(yyscan_t yyscanner,const QCString &s,Definition *d); +static void codify(yyscan_t yyscanner,const QCString &text); static void endCodeLine(yyscan_t yyscanner); static void nextCodeLine(yyscan_t yyscanner); -static void writeMultiLineCodeLink(yyscan_t yyscanner, CodeOutputInterface &ol, const Definition *d, const char *text); +static void writeMultiLineCodeLink(yyscan_t yyscanner, CodeOutputInterface &ol, const Definition *d, const QCString &text); static void startFontClass(yyscan_t yyscanner,const char *s); static void endFontClass(yyscan_t yyscanner); -static void codifyLines(yyscan_t yyscanner,const char *text); +static void codifyLines(yyscan_t yyscanner,const QCString &text); static bool getLinkInScope(yyscan_t yyscanner, const QCString &c, const QCString &m, - const char *memberText, CodeOutputInterface &ol, const char *text); -static bool getLink(yyscan_t yyscanner, const char *className, const char *memberName, - CodeOutputInterface &ol, const char *text=0); + const QCString &memberText, CodeOutputInterface &ol, const QCString &text); +static bool getLink(yyscan_t yyscanner, const QCString &className, const QCString &memberName, + CodeOutputInterface &ol, const QCString &text=QCString()); static void generateClassOrGlobalLink(yyscan_t yyscanner, CodeOutputInterface &ol, - const char *clName, bool typeOnly=FALSE); + const QCString &clName, bool typeOnly=FALSE); static void generateFunctionLink(yyscan_t yyscanner, CodeOutputInterface &ol, - const char *funcName); + const QCString &funcName); static bool findMemberLink(yyscan_t yyscanner, CodeOutputInterface &ol, - Definition *sym, const char *symName); + Definition *sym, const QCString &symName); static void findMemberLink(yyscan_t yyscanner, CodeOutputInterface &ol, - const char *symName); + const QCString &symName); static void adjustScopesAndSuites(yyscan_t yyscanner,unsigned indentLength); static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); @@ -172,7 +172,7 @@ NONEMPTYEXP [^ \t\n:] PARAMNONEMPTY [^ \t\n():] IDENTIFIER ({LETTER}|"_")({LETTER}|{DIGIT}|"_")* SCOPE {IDENTIFIER}("."{IDENTIFIER})* -CALLANY "("[^)]*")" +CALLANY "("[^)\n]*")" BORDER ([^A-Za-z0-9]) POUNDCOMMENT "##" @@ -190,7 +190,7 @@ SHORTSTRINGITEM ({SHORTSTRINGCHAR}|{ESCAPESEQ}) SHORTSTRINGCHAR [^\\\n"] STRINGLITERAL {STRINGPREFIX}?( {SHORTSTRING} | {LONGSTRING}) STRINGPREFIX ("r"|"u"|"ur"|"R"|"U"|"UR"|"Ur"|"uR") -KEYWORD ("lambda"|"import"|"class"|"assert"|"with"|"as"|"from"|"global"|"def"|"True"|"False") +KEYWORD ("lambda"|"import"|"class"|"assert"|"with"|"as"|"from"|"global"|"async"|"def"|"True"|"False") FLOWKW ("or"|"and"|"is"|"not"|"print"|"for"|"in"|"if"|"try"|"except"|"yield"|"raise"|"break"|"continue"|"pass"|"if"|"return"|"while"|"elif"|"else"|"finally") QUOTES ("\""[^"]*"\"") SINGLEQUOTES ("'"[^']*"'") @@ -302,6 +302,12 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBU endFontClass(yyscanner); BEGIN( FunctionDec ); } + "async"{BB}"def"{BB} { + startFontClass(yyscanner,"keyword"); + codify(yyscanner,yytext); + endFontClass(yyscanner); + BEGIN( FunctionDec ); + } "class"{BB} { startFontClass(yyscanner,"keyword"); @@ -395,7 +401,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBU // Push a class scope - std::unique_ptr<ClassDef> classDefToAdd { createClassDef("<code>",1,1,yyextra->curClassName,ClassDef::Class,0,0,FALSE) }; + std::unique_ptr<ClassDef> classDefToAdd { createClassDef("<code>",1,1,yyextra->curClassName,ClassDef::Class,QCString(),QCString(),FALSE) }; ScopedTypeVariant var(yyextra->curClassName); for (const auto &s : yyextra->curClassBases) { @@ -829,7 +835,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBU static void addVariable(yyscan_t yyscanner, QCString type, QCString name) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - //printf("PyVariableContext::addVariable(%s,%s)\n",type.data(),name.data()); + //printf("PyVariableContext::addVariable(%s,%s)\n",qPrint(type),qPrint(name)); QCString ltype = type.simplifyWhiteSpace(); QCString lname = name.simplifyWhiteSpace(); @@ -951,7 +957,7 @@ static void setCurrentDoc(yyscan_t yyscanner, const QCString &anchor) //------------------------------------------------------------------------------- -static void addToSearchIndex(yyscan_t yyscanner, const char *text) +static void addToSearchIndex(yyscan_t yyscanner, const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (Doxygen::searchIndex) @@ -963,7 +969,7 @@ static void addToSearchIndex(yyscan_t yyscanner, const char *text) //------------------------------------------------------------------------------- -static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,Definition *d) +static const ClassDef *stripClassName(yyscan_t yyscanner,const QCString &s,Definition *d) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; int pos=0; @@ -1018,9 +1024,9 @@ static void startCodeLine(yyscan_t yyscanner) //yyextra->insideBody = FALSE; yyextra->endComment = FALSE; yyextra->searchingForBody = TRUE; - yyextra->realScope = d->name().copy(); - yyextra->classScope = d->name().copy(); - //printf("Real scope: '%s'\n",yyextra->realScope.data()); + yyextra->realScope = d->name(); + yyextra->classScope = d->name(); + //printf("Real scope: '%s'\n",qPrint(yyextra->realScope)); yyextra->bodyCurlyCount = 0; QCString lineAnchor; lineAnchor.sprintf("l%05d",yyextra->yyLineNr); @@ -1035,14 +1041,14 @@ static void startCodeLine(yyscan_t yyscanner) { yyextra->code->writeLineNumber(d->getReference(), d->getOutputFileBase(), - 0,yyextra->yyLineNr); + QCString(),yyextra->yyLineNr); setCurrentDoc(yyscanner,lineAnchor); } } else { //yyextra->code->codify(lineNumber); - yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr); + yyextra->code->writeLineNumber(QCString(),QCString(),QCString(),yyextra->yyLineNr); } //yyextra->code->endLineNumber(); } @@ -1055,7 +1061,7 @@ static void startCodeLine(yyscan_t yyscanner) //------------------------------------------------------------------------------- -static void codify(yyscan_t yyscanner,const char* text) +static void codify(yyscan_t yyscanner,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yyextra->code->codify(text); @@ -1093,9 +1099,10 @@ static void nextCodeLine(yyscan_t yyscanner) static void writeMultiLineCodeLink(yyscan_t yyscanner, CodeOutputInterface &ol, const Definition *d, - const char *text) + const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (text.isEmpty()) return; bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS); TooltipManager::instance().addTooltip(ol,d); QCString ref = d->getReference(); @@ -1107,18 +1114,17 @@ static void writeMultiLineCodeLink(yyscan_t yyscanner, tooltip = d->briefDescriptionAsTooltip(); } bool done=FALSE; - char *p=(char *)text; + const char *p=text.data(); while (!done) { - char *sp=p; + const char *sp=p; char c; while ((c=*p++) && c!='\n') { } if (c=='\n') { yyextra->yyLineNr++; - *(p-1)='\0'; //printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp); - ol.writeCodeLink(ref,file,anchor,sp,tooltip); + ol.writeCodeLink(ref,file,anchor,QCString(sp,p-sp-1),tooltip); nextCodeLine(yyscanner); } else @@ -1159,11 +1165,12 @@ static void endFontClass(yyscan_t yyscanner) //------------------------------------------------------------------------------- -static void codifyLines(yyscan_t yyscanner,const char *text) +static void codifyLines(yyscan_t yyscanner,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (text.isEmpty()) return; //printf("codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,text); - const char *p=text,*sp=p; + const char *p=text.data(),*sp=p; char c; bool done=FALSE; while (!done) @@ -1194,9 +1201,9 @@ static void codifyLines(yyscan_t yyscanner,const char *text) static bool getLinkInScope(yyscan_t yyscanner, const QCString &c, // scope const QCString &m, // member - const char *memberText, // exact text + const QCString &memberText, // exact text CodeOutputInterface &ol, - const char *text + const QCString &text ) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; @@ -1205,7 +1212,7 @@ static bool getLinkInScope(yyscan_t yyscanner, const FileDef *fd = 0; const NamespaceDef *nd = 0; const GroupDef *gd = 0; - //printf("Trying '%s'::'%s'\n",c.data(),m.data()); + //printf("Trying '%s'::'%s'\n",qPrint(c),qPrint(m)); if (getDefs(c,m,"()",md,cd,fd,nd,gd,FALSE,yyextra->sourceFileDef) && md->isLinkable()) { @@ -1214,7 +1221,7 @@ static bool getLinkInScope(yyscan_t yyscanner, const Definition *d = md->getOuterScope()==Doxygen::globalScope ? md->getBodyDef() : md->getOuterScope(); - //printf("Found! d=%s\n",d?d->name().data():"<none>"); + //printf("Found! d=%s\n",d?qPrint(d->name()):"<none>"); if (md->getGroupDef()) d = md->getGroupDef(); if (d && d->isLinkable()) { @@ -1228,10 +1235,10 @@ static bool getLinkInScope(yyscan_t yyscanner, std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex); addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md)); } - //printf("d->getReference()='%s' d->getOutputBase()='%s' name='%s' member name='%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data()); + //printf("d->getReference()='%s' d->getOutputBase()='%s' name='%s' member name='%s'\n",qPrint(d->getReference()),qPrint(d->getOutputFileBase()),qPrint(d->name()),qPrint(md->name())); - writeMultiLineCodeLink(yyscanner,ol,md, text ? text : memberText); - addToSearchIndex(yyscanner,text ? text : memberText); + writeMultiLineCodeLink(yyscanner,ol,md, !text.isEmpty() ? text : memberText); + addToSearchIndex(yyscanner,!text.isEmpty() ? text : memberText); return TRUE; } } @@ -1241,10 +1248,10 @@ static bool getLinkInScope(yyscan_t yyscanner, //------------------------------------------------------------------------------- static bool getLink(yyscan_t yyscanner, - const char *className, - const char *memberName, + const QCString &className, + const QCString &memberName, CodeOutputInterface &ol, - const char *text) + const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; QCString m=removeRedundantWhiteSpace(memberName); @@ -1270,7 +1277,7 @@ static bool getLink(yyscan_t yyscanner, */ static void generateClassOrGlobalLink(yyscan_t yyscanner, CodeOutputInterface &ol, - const char *clName, + const QCString &clName, bool typeOnly) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; @@ -1279,7 +1286,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner, // Don't do anything for empty text if (className.isEmpty()) return; - DBG_CTX((stderr,"generateClassOrGlobalLink(className=%s)\n",className.data())); + DBG_CTX((stderr,"generateClassOrGlobalLink(className=%s)\n",qPrint(className))); const ScopedTypeVariant *lcd = 0; const ClassDef *cd=0; // Class def that we may find @@ -1295,9 +1302,9 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner, md = yyextra->symbolResolver.getTypedef(); DBG_CTX((stderr,"d=%s yyextra->sourceFileDef=%s\n", - d?d->displayName().data():"<null>", - yyextra->currentDefinition?yyextra->currentDefinition->displayName().data():"<null>")); - DBG_CTX((stderr,"is found as a type %s\n",cd?cd->name().data():"<null>")); + d?qPrint(d->displayName()):"<null>", + yyextra->currentDefinition?qPrint(yyextra->currentDefinition->displayName()):"<null>")); + DBG_CTX((stderr,"is found as a type %s\n",cd?qPrint(cd->name()):"<null>")); if (cd==0 && md==0) // also see if it is variable or enum or enum value { @@ -1349,7 +1356,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner, QCString scope = substitute(className.left(scopeEnd),".","::"); QCString locName = className.right(className.length()-scopeEnd-1); ClassDef *mcd = getClass(scope); - DBG_CTX((stderr,"scope=%s locName=%s mcd=%p\n",scope.data(),locName.data(),mcd)); + DBG_CTX((stderr,"scope=%s locName=%s mcd=%p\n",qPrint(scope),qPrint(locName),mcd)); if (mcd) { const MemberDef *mmd = mcd->getMemberByName(locName); @@ -1378,7 +1385,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner, const MemberDef *mmd=mnd->getMemberByName(locName); if (mmd) { - //printf("name=%s scope=%s\n",locName.data(),scope.data()); + //printf("name=%s scope=%s\n",qPrint(locName),qPrint(scope)); yyextra->theCallContext.setScope(ScopedTypeVariant(stripClassName(yyscanner,mmd->typeString(),mmd->getOuterScope()))); writeMultiLineCodeLink(yyscanner,ol,mmd,clName); addToSearchIndex(yyscanner,className); @@ -1414,26 +1421,26 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner, */ static void generateFunctionLink(yyscan_t yyscanner, CodeOutputInterface &ol, - const char *funcName) + const QCString &funcName) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; QCString locScope=yyextra->classScope; QCString locFunc=removeRedundantWhiteSpace(funcName); - DBG_CTX((stdout,"*** locScope=%s locFunc=%s\n",locScope.data(),locFunc.data())); + DBG_CTX((stdout,"*** locScope=%s locFunc=%s\n",qPrint(locScope),qPrint(locFunc))); int i=locFunc.findRev("::"); if (i>0) { locScope=locFunc.left(i); locFunc=locFunc.right(locFunc.length()-i-2).stripWhiteSpace(); } - //printf("generateFunctionLink(%s) classScope='%s'\n",locFunc.data(),locScope.data()); + //printf("generateFunctionLink(%s) classScope='%s'\n",qPrint(locFunc),qPrint(locScope)); if (!locScope.isEmpty()) { auto it = yyextra->codeClassMap.find(locScope.str()); if (it!=yyextra->codeClassMap.end()) { ScopedTypeVariant ccd = it->second; - //printf("using classScope %s\n",yyextra->classScope.data()); + //printf("using classScope %s\n",qPrint(yyextra->classScope)); if (ccd.localDef() && !ccd.localDef()->baseClasses().empty()) { for (const auto &bcName : ccd.localDef()->baseClasses()) @@ -1458,11 +1465,11 @@ static void generateFunctionLink(yyscan_t yyscanner, static bool findMemberLink(yyscan_t yyscanner, CodeOutputInterface &ol, Definition *sym, - const char *symName) + const QCString &symName) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("sym %s outerScope=%s equal=%d\n", - // sym->name().data(),sym->getOuterScope()->name().data(), + // qPrint(sym->name()),qPrint(sym->getOuterScope()->name()), // sym->getOuterScope()==yyextra->currentDefinition); if (sym->getOuterScope() && @@ -1479,7 +1486,7 @@ static bool findMemberLink(yyscan_t yyscanner, addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(toMemberDef(sym))); } } - DBG_CTX((stderr,"cd=%s thisCd=%s\n",cd?cd->name().data():"<none>",thisCd?thisCd->name().data():"<none>")); + DBG_CTX((stderr,"cd=%s thisCd=%s\n",cd?qPrint(cd->name()):"<none>",thisCd?qPrint(thisCd->name()):"<none>")); // TODO: find the nearest base class in case cd is a base class of // thisCd @@ -1496,13 +1503,13 @@ static bool findMemberLink(yyscan_t yyscanner, static void findMemberLink(yyscan_t yyscanner, CodeOutputInterface &ol, - const char *symName) + const QCString &symName) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("Member reference: %s scope=%s member=%s\n", // yytext, - // yyextra->currentDefinition?yyextra->currentDefinition->name().data():"<none>", - // yyextra->currentMemberDef?yyextra->currentMemberDef->name().data():"<none>" + // yyextra->currentDefinition?qPrint(yyextra->currentDefinition->name()):"<none>", + // yyextra->currentMemberDef?qPrint(yyextra->currentMemberDef->name()):"<none>" // ); if (yyextra->currentDefinition) { @@ -1552,11 +1559,11 @@ void PythonCodeParser::resetCodeParserState() } void PythonCodeParser::parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt /*lang*/, bool isExampleBlock, - const char *exampleName, + const QCString &exampleName, FileDef *fileDef, int startLine, int endLine, @@ -1573,9 +1580,9 @@ void PythonCodeParser::parseCode(CodeOutputInterface &codeOutIntf, //printf("***parseCode()\n"); if (input.isEmpty()) return; - printlex(yy_flex_debug, TRUE, __FILE__, fileDef ? fileDef->fileName().data(): NULL); + printlex(yy_flex_debug, TRUE, __FILE__, fileDef ? qPrint(fileDef->fileName()): NULL); yyextra->code = &codeOutIntf; - yyextra->inputString = input; + yyextra->inputString = input.data(); yyextra->inputPosition = 0; yyextra->currentFontClass = 0; yyextra->needsTermination = FALSE; @@ -1600,7 +1607,7 @@ void PythonCodeParser::parseCode(CodeOutputInterface &codeOutIntf, if (yyextra->exampleBlock && fileDef==0) { // create a dummy filedef for the example - yyextra->sourceFileDef = createFileDef("",(exampleName?exampleName:"generated")); + yyextra->sourceFileDef = createFileDef("",(!exampleName.isEmpty()?qPrint(exampleName):"generated")); cleanupSourceDef = TRUE; } if (yyextra->sourceFileDef) @@ -1633,7 +1640,7 @@ void PythonCodeParser::parseCode(CodeOutputInterface &codeOutIntf, } // write the tooltips TooltipManager::instance().writeTooltips(codeOutIntf); - printlex(yy_flex_debug, FALSE, __FILE__, fileDef ? fileDef->fileName().data(): NULL); + printlex(yy_flex_debug, FALSE, __FILE__, fileDef ? qPrint(fileDef->fileName()): NULL); } #if USE_STATE2STRING diff --git a/src/pyscanner.h b/src/pyscanner.h index 4f0ae38..dc7ea1c 100644 --- a/src/pyscanner.h +++ b/src/pyscanner.h @@ -36,12 +36,12 @@ class PythonOutlineParser : public OutlineParserInterface public: PythonOutlineParser(); virtual ~PythonOutlineParser(); - void parseInput(const char * fileName, + void parseInput(const QCString &fileName, const char *fileBuf, const std::shared_ptr<Entry> &root, ClangTUParser *clangParser); bool needsPreprocessing(const QCString &extension) const; - void parsePrototype(const char *text); + void parsePrototype(const QCString &text); private: struct Private; std::unique_ptr<Private> p; diff --git a/src/pyscanner.l b/src/pyscanner.l index 23bdb0b..4f331c9 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -63,7 +63,6 @@ struct pyscannerYY_state { - pyscannerYY_state() : defVal(std::ios_base::ate) {} CommentScanner commentScanner; OutlineParserInterface *thisParser = 0; const char * inputString = 0; @@ -87,7 +86,7 @@ struct pyscannerYY_state bool doubleQuote = FALSE; bool specialBlock = FALSE; int stringContext = 0; - std::ostringstream * copyString = 0; + TextStream * copyString = 0; int indent = 0; int curIndent = 0; int commentIndent = 0; @@ -98,7 +97,7 @@ struct pyscannerYY_state int atomCount = 0; QCString moduleScope; QCString packageName; - std::ostringstream defVal; + TextStream defVal; int braceCount = 0; bool lexInit = FALSE; bool packageCommentAllowed = FALSE; @@ -135,7 +134,7 @@ static void initTriSingleQuoteBlock(yyscan_t yyscanner); static void initSpecialBlock(yyscan_t yyscanner); static void searchFoundDef(yyscan_t yyscanner); static void searchFoundClass(yyscan_t yyscanner); -static QCString findPackageScope(yyscan_t yyscanner,const char *fileName); +static QCString findPackageScope(yyscan_t yyscanner,const QCString &fileName); static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); @@ -255,10 +254,20 @@ STARTDOCSYMS "##" searchFoundDef(yyscanner); BEGIN( FunctionDec ); } + ^{B}"async"{BB}"def"{BB} { // start of an async function/method definition with indent + DBG_CTX((stderr,"Found async def at %d\n",yyextra->yyLineNr)); + yyextra->indent=computeIndent(yytext); + searchFoundDef(yyscanner); + BEGIN( FunctionDec ); + } "def"{BB} { // start of a function/method definition searchFoundDef(yyscanner); BEGIN( FunctionDec ); } + "async"{BB}"def"{BB} { // start of a function/method definition + searchFoundDef(yyscanner); + BEGIN( FunctionDec ); + } ^{B}"class"{BB} { // start of a class definition with indent DBG_CTX((stderr,"Found class at %d\n",yyextra->yyLineNr)); @@ -332,6 +341,7 @@ STARTDOCSYMS "##" yyextra->stat=TRUE; } "@"{SCOPE}{CALL}? { // decorator + lineCount(yyscanner); } {SCRIPTCOMMENT} { // Unix type script comment if (yyextra->yyLineNr != 1) REJECT; @@ -449,7 +459,7 @@ STARTDOCSYMS "##" {IDENTIFIER}({B}"."{B}{IDENTIFIER})* { yyextra->current->name=removeRedundantWhiteSpace(substitute(yytext,".","::")); yyextra->current->fileName = yyextra->yyFileName; - //printf("Adding using declaration: found:%s:%d name=%s\n",yyextra->yyFileName.data(),yyextra->yyLineNr,yyextra->current->name.data()); + //printf("Adding using declaration: found:%s:%d name=%s\n",qPrint(yyextra->yyFileName),yyextra->yyLineNr,qPrint(yyextra->current->name)); yyextra->current->section=Entry::USINGDECL_SEC; yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); initEntry(yyscanner); @@ -469,7 +479,7 @@ STARTDOCSYMS "##" <SearchMemVars>{ "self."{IDENTIFIER}/{B}"=" { - DBG_CTX((stderr,"Found instance method variable %s in %s at %d\n",&yytext[5],yyextra->current_root->name.data(),yyextra->yyLineNr)); + DBG_CTX((stderr,"Found instance method variable %s in %s at %d\n",&yytext[5],qPrint(yyextra->current_root->name.data(),yyextra->yyLineNr))); yyextra->current->name=&yytext[5]; yyextra->current->section=Entry::VARIABLE_SEC; yyextra->current->fileName = yyextra->yyFileName; @@ -483,7 +493,7 @@ STARTDOCSYMS "##" newEntry(yyscanner); } "cls."{IDENTIFIER}/{B}"=" { - DBG_CTX((stderr,"Found class method variable %s in %s at %d\n",&yytext[4],yyextra->current_root->name.data(),yyextra->yyLineNr)); + DBG_CTX((stderr,"Found class method variable %s in %s at %d\n",&yytext[4],qPrint(yyextra->current_root->name),yyextra->yyLineNr)); yyextra->current->name=&yytext[4]; yyextra->current->section=Entry::VARIABLE_SEC; yyextra->current->fileName = yyextra->yyFileName; @@ -955,7 +965,7 @@ STARTDOCSYMS "##" // prepend scope in case of nested classes if (yyextra->current_root->section&Entry::SCOPE_MASK) { - //printf("*** Prepending scope %s to class %s\n",yyextra->current_root->name.data(),yyextra->current->name.data()); + //printf("*** Prepending scope %s to class %s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->current->name)); yyextra->current->name.prepend(yyextra->current_root->name+"::"); } @@ -1038,7 +1048,7 @@ STARTDOCSYMS "##" yyextra->curIndent=computeIndent(yytext); yyextra->bodyEntry = yyextra->current; DBG_CTX((stderr,"setting indent %d\n",yyextra->curIndent)); - //printf("yyextra->current->program=[%s]\n",yyextra->current->program.data()); + //printf("yyextra->current->program=[%s]\n",qPrint(yyextra->current->program)); //yyextra->hideClassDocs = TRUE; BEGIN(ClassBody); } @@ -1527,7 +1537,7 @@ static QCString findPackageScopeFromPath(yyscan_t yyscanner,const QCString &path auto it = yyextra->packageNameCache.find(path.str()); if (it!=yyextra->packageNameCache.end()) { - return it->second; + return QCString(it->second); } FileInfo pf(path.str()+"/__init__.py"); // found package initialization file if (pf.exists()) @@ -1547,11 +1557,11 @@ static QCString findPackageScopeFromPath(yyscan_t yyscanner,const QCString &path } return ""; } - -static QCString findPackageScope(yyscan_t yyscanner,const char *fileName) + +static QCString findPackageScope(yyscan_t yyscanner,const QCString &fileName) { - if (fileName==0) return ""; - FileInfo fi(fileName); + if (fileName.isEmpty()) return fileName; + FileInfo fi(fileName.str()); return findPackageScopeFromPath(yyscanner,fi.dirPath(true).c_str()); } @@ -1561,7 +1571,7 @@ static void addFrom(yyscan_t yyscanner,bool all) QCString item=all ? yyextra->packageName : yyextra->packageName+"."+yytext; yyextra->current->name=removeRedundantWhiteSpace(substitute(item,".","::")); yyextra->current->fileName = yyextra->yyFileName; - //printf("Adding using declaration: found:%s:%d name=%s\n",yyextra->yyFileName.data(),yyextra->yyLineNr,yyextra->current->name.data()); + //printf("Adding using declaration: found:%s:%d name=%s\n",qPrint(yyextra->yyFileName),yyextra->yyLineNr,qPrint(yyextra->current->name)); yyextra->current->section=all ? Entry::USINGDIR_SEC : Entry::USINGDECL_SEC; yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); initEntry(yyscanner); @@ -1605,7 +1615,7 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("handleCommentBlock(doc=[%s] brief=%d yyextra->docBlockInBody=%d yyextra->docBlockJavaStyle=%d\n", - // doc.data(),brief,yyextra->docBlockInBody,yyextra->docBlockJavaStyle); + // qPrint(doc),brief,yyextra->docBlockInBody,yyextra->docBlockJavaStyle); // TODO: Fix me yyextra->docBlockInBody=FALSE; @@ -1745,17 +1755,17 @@ static void searchFoundClass(yyscan_t yyscanner) static void parseCompounds(yyscan_t yyscanner,std::shared_ptr<Entry> rt) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - //printf("parseCompounds(%s)\n",rt->name.data()); + //printf("parseCompounds(%s)\n",qPrint(rt->name)); for (size_t i=0; i<rt->children().size(); ++i) { std::shared_ptr<Entry> ce = rt->children()[i]; - if (ce->program.tellp() != std::streampos(0)) + if (!ce->program.empty()) { //fprintf(stderr,"parseCompounds: -- %s (line %d) ---------\n%s\n---------------\n", - // ce->name.data(), ce->bodyLine, ce->program.data()); + // qPrint(ce->name), ce->bodyLine, qPrint(ce->program)); // init scanner state yyextra->programStr = ce->program.str(); - yyextra->inputString = yyextra->programStr; + yyextra->inputString = yyextra->programStr.data(); yyextra->inputPosition = 0; pyscannerYYrestart( 0, yyscanner ); if (ce->section&Entry::COMPOUND_MASK) @@ -1767,7 +1777,7 @@ static void parseCompounds(yyscan_t yyscanner,std::shared_ptr<Entry> rt) { yyextra->current_root = rt; //printf("Searching for member variables in %s parent=%s\n", - // ce->name.data(),ce->parent->name.data()); + // qPrint(ce->name),qPrint(ce->parent->name)); BEGIN( SearchMemVars ); } yyextra->yyFileName = ce->fileName; @@ -1794,11 +1804,13 @@ static void parseCompounds(yyscan_t yyscanner,std::shared_ptr<Entry> rt) //---------------------------------------------------------------------------- -static void parseMain(yyscan_t yyscanner, const char *fileName,const char *fileBuf,const std::shared_ptr<Entry> &rt) +static void parseMain(yyscan_t yyscanner, const QCString &fileName,const char *fileBuf,const std::shared_ptr<Entry> &rt) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; initParser(yyscanner); + if (fileBuf==0 || fileBuf[0]=='\0') return; + yyextra->inputString = fileBuf; yyextra->inputPosition = 0; @@ -1809,13 +1821,12 @@ static void parseMain(yyscan_t yyscanner, const char *fileName,const char *fileB yyextra->current_root = rt; yyextra->specialBlock = FALSE; - yyextra->yyLineNr= 1 ; yyextra->yyFileName = fileName; //setContext(); - msg("Parsing file %s...\n",yyextra->yyFileName.data()); + msg("Parsing file %s...\n",qPrint(yyextra->yyFileName)); - FileInfo fi(fileName); + FileInfo fi(fileName.str()); yyextra->moduleScope = findPackageScope(yyscanner,fileName); QCString baseName=fi.baseName(); if (baseName!="__init__") // package initializer file is not a package itself @@ -1864,7 +1875,7 @@ static void parseMain(yyscan_t yyscanner, const char *fileName,const char *fileB static void parsePrototype(yyscan_t yyscanner,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - //printf("**** parsePrototype(%s) begin\n",text.data()); + //printf("**** parsePrototype(%s) begin\n",qPrint(text)); if (text.isEmpty()) { warn(yyextra->yyFileName,yyextra->yyLineNr,"Empty prototype found!"); @@ -1885,7 +1896,7 @@ static void parsePrototype(yyscan_t yyscanner,const QCString &text) orgInputPosition = yyextra->inputPosition; // set new string - yyextra->inputString = text; + yyextra->inputString = text.data(); yyextra->inputPosition = 0; pyscannerYYrestart( 0, yyscanner ); @@ -1932,16 +1943,16 @@ PythonOutlineParser::~PythonOutlineParser() } -void PythonOutlineParser::parseInput(const char *fileName, - const char *fileBuf, - const std::shared_ptr<Entry> &root, - ClangTUParser * /*clangParser*/) +void PythonOutlineParser::parseInput(const QCString &fileName, + const char *fileBuf, + const std::shared_ptr<Entry> &root, + ClangTUParser * /*clangParser*/) { struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; yyextra->thisParser = this; - printlex(yy_flex_debug, TRUE, __FILE__, fileName); + printlex(yy_flex_debug, TRUE, __FILE__, qPrint(fileName)); ::parseMain(p->yyscanner, fileName,fileBuf,root); - printlex(yy_flex_debug, FALSE, __FILE__, fileName); + printlex(yy_flex_debug, FALSE, __FILE__, qPrint(fileName)); // May print the AST for debugging purposes // printAST(global_root); @@ -1952,10 +1963,9 @@ bool PythonOutlineParser::needsPreprocessing(const QCString &) const return FALSE; } -void PythonOutlineParser::parsePrototype(const char *text) +void PythonOutlineParser::parsePrototype(const QCString &text) { ::parsePrototype(p->yyscanner,text); - } //---------------------------------------------------------------------------- diff --git a/src/qcstring.cpp b/src/qcstring.cpp index 0ed5a99..d95687d 100644 --- a/src/qcstring.cpp +++ b/src/qcstring.cpp @@ -46,7 +46,7 @@ int QCString::find( char c, int index, bool cs ) const else { pos = data()+index; - c = tolower((unsigned char)c); + c = (char)tolower((unsigned char)c); while (*pos && tolower((unsigned char)*pos)!=c) pos++; if (!*pos && c) pos=0; // not found } @@ -109,7 +109,7 @@ int QCString::findRev( char c, int index, bool cs) const } else { - c = tolower((unsigned char)c); + c = (char)tolower((unsigned char)c); while ( pos>=b && tolower((unsigned char)*pos)!=c) pos--; } return pos>=b ? (int)(pos - b) : -1; @@ -146,7 +146,7 @@ int QCString::contains( char c, bool cs ) const } else { - c = tolower((unsigned char)c); + c = (char)tolower((unsigned char)c); while (*pos) { if (tolower((unsigned char)*pos)==c) count++; @@ -438,7 +438,7 @@ int qstricmp( const char *str1, const char *str2 ) uchar c; if ( !s1 || !s2 ) return s1 == s2 ? 0 : (int)(s2 - s1); - for ( ; !(res = (c=tolower(*s1)) - tolower(*s2)); s1++, s2++ ) + for ( ; !(res = (c=(char)tolower(*s1)) - tolower(*s2)); s1++, s2++ ) if ( !c ) // strings are equal break; return res; @@ -453,7 +453,7 @@ int qstrnicmp( const char *str1, const char *str2, uint len ) if ( !s1 || !s2 ) return (int)(s2 - s1); for ( ; len--; s1++, s2++ ) { - if ( (res = (c=tolower(*s1)) - tolower(*s2)) ) + if ( (res = (c=(char)tolower(*s1)) - tolower(*s2)) ) return res; if ( !c ) // strings are equal break; @@ -472,7 +472,7 @@ QCString substitute(const QCString &s,const QCString &src,const QCString &dst) if (srcLen!=dstLen) { int count; - for (count=0, p=s.data(); (q=strstr(p,src))!=0; p=q+srcLen) count++; + for (count=0, p=s.data(); (q=strstr(p,src.data()))!=0; p=q+srcLen) count++; resLen = s.length()+count*(dstLen-srcLen); } else // result has same size as s @@ -481,13 +481,13 @@ QCString substitute(const QCString &s,const QCString &src,const QCString &dst) } QCString result(resLen+1); char *r; - for (r=result.rawData(), p=s; (q=strstr(p,src))!=0; p=q+srcLen) + for (r=result.rawData(), p=s.data(); (q=strstr(p,src.data()))!=0; p=q+srcLen) { int l = (int)(q-p); memcpy(r,p,l); r+=l; - if (dst) memcpy(r,dst,dstLen); + if (dstLen>0) memcpy(r,dst.data(),dstLen); r+=dstLen; } if (r) @@ -513,7 +513,7 @@ QCString substitute(const QCString &s,const QCString &src,const QCString &dst,in if (srcLen!=dstLen) { int count; - for (count=0, p=s.data(); (q=strstr(p,src))!=0; p=q+srcLen) count++; + for (count=0, p=s.data(); (q=strstr(p,src.data()))!=0; p=q+srcLen) count++; resLen = s.length()+count*(dstLen-srcLen); } else // result has same size as s @@ -522,13 +522,13 @@ QCString substitute(const QCString &s,const QCString &src,const QCString &dst,in } QCString result(resLen+1); char *r; - for (r=result.rawData(), p=s; (q=strstr(p,src))!=0; p=q+srcLen) + for (r=result.rawData(), p=s.data(); (q=strstr(p,src.data()))!=0; p=q+srcLen) { // search a consecutive sequence of src int seq = 0, skip = 0; if (skip_seq) { - for (const char *n=q+srcLen; qstrncmp(n,src,srcLen)==0; seq=1+skip, n+=srcLen) + for (const char *n=q+srcLen; qstrncmp(n,src.data(),srcLen)==0; seq=1+skip, n+=srcLen) ++skip; // number of consecutive src after the current one // verify the allowed number of consecutive src to skip @@ -549,7 +549,7 @@ QCString substitute(const QCString &s,const QCString &src,const QCString &dst,in continue; } - if (dst) memcpy(r,dst,dstLen); + if (dstLen>0) memcpy(r,dst.data(),dstLen); r+=dstLen; } qstrcpy(r,p); diff --git a/src/qcstring.h b/src/qcstring.h index 3efda9a..ba5ac95 100644 --- a/src/qcstring.h +++ b/src/qcstring.h @@ -27,6 +27,8 @@ #include <cstdint> #include <ostream> +#include "utf8.h" + #ifndef FALSE #define FALSE false #endif @@ -40,7 +42,7 @@ typedef unsigned long ulong; typedef int64_t int64; typedef uint64_t uint64; #define ASSERT(x) if ( !(x) )\ - fprintf(stderr,"ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__) + fprintf(stderr,"ASSERT: \"%s\" in %s (%d)\n",#x,__FILE__,__LINE__) /***************************************************************************** @@ -74,15 +76,23 @@ char * qstrncpy(char *dst,const char *src, uint len); inline int cstrcmp( const char *str1, const char *str2 ) { return strcmp(str1,str2); } +inline bool qisempty( const char *s) +{ return s==0 || *s==0; } + inline int qstrcmp( const char *str1, const char *str2 ) -{ return (str1 && str2) ? strcmp(str1,str2) : (int)((intptr_t)str2 - (intptr_t)str1); } +{ return (str1 && str2) ? strcmp(str1,str2) : // both non-empty + (qisempty(str1) && qisempty(str2)) ? 0 : // both empty + qisempty(str1) ? -1 : 1; // one empty, other non-empty +} inline int cstrncmp( const char *str1, const char *str2, uint len ) { return strncmp(str1,str2,len); } inline int qstrncmp( const char *str1, const char *str2, uint len ) -{ return (str1 && str2) ? strncmp(str1,str2,len) : - (int)((intptr_t)str2 - (intptr_t)str1); } +{ return (str1 && str2) ? strncmp(str1,str2,len) : // both non-empty + (qisempty(str1) && qisempty(str2)) ? 0 : // both empty + qisempty(str1) ? -1 : 1; // one empty other non-empty +} inline bool qisspace(char c) { return c==' ' || c=='\t' || c=='\n' || c=='\r'; } @@ -105,7 +115,9 @@ class QCString QCString( QCString &&s ) = default; QCString &operator=( QCString &&s ) = default; - QCString( const std::string &s ) : m_rep(s) {} + explicit QCString( const std::string &s ) : m_rep(s) {} + + QCString( std::string &&s) { m_rep = std::move(s); } /** creates a string with room for size characters * @param[in] size the number of character to allocate (also counting the 0-terminator!) @@ -120,11 +132,11 @@ class QCString /** creates a string from \a str and copies over the first \a maxlen characters. */ QCString( const char *str, uint maxlen ) : m_rep(str?str:"") { m_rep.resize(maxlen); } - /** replaces the contents by that of string \a s. */ - /** replaces the contents by that of C string \a str. */ QCString &operator=( const char *str) { m_rep = str?str:""; return *this; } + QCString &operator=( const std::string &s) { m_rep = s; return *this; } + /** Returns TRUE iff the string is empty. Equivalent to isEmpty(). */ bool isNull() const { return m_rep.empty(); } @@ -138,13 +150,11 @@ class QCString uint size() const { return (uint)m_rep.size(); } /** Returns a pointer to the contents of the string in the form of a 0-terminated C string */ - const char *data() const { return m_rep.empty() ? 0 : m_rep.c_str(); } + const char *data() const { return m_rep.c_str(); } /** Returns a writable pointer to the data. - * @warning if the string is shared it will modifying the string directly and - * this will overwrite all copies as well! */ - char *rawData() const { return m_rep.empty() ? 0 : const_cast<char*>(&m_rep[0]); } + char *rawData() { return &m_rep[0]; } /** Resizes the string to hold \a newlen characters * (this value should also count the 0-terminator). @@ -169,9 +179,6 @@ class QCString return TRUE; } - /** Returns a deep copy of the string. */ - QCString copy() const { return *this; } - QCString &sprintf( const char *format, ... ); int find( char c, int index=0, bool cs=TRUE ) const; @@ -187,16 +194,20 @@ class QCString int contains( const char *str, bool cs=TRUE ) const; //int contains( const QRegExp &rx ) const; - bool stripPrefix(const char *prefix) + bool stripPrefix(const QCString &prefix) { - if (prefix==0 || m_rep.empty()) return FALSE; - if (m_rep.rfind(prefix,0)==0) // string starts with prefix + if (prefix.isEmpty() || m_rep.empty()) return FALSE; + if (m_rep.rfind(prefix.data(),0)==0) // string starts with prefix { - m_rep.erase(0,qstrlen(prefix)); + m_rep.erase(0,prefix.length()); return TRUE; } return FALSE; } + bool stripPrefix(const char *prefix) + { + return stripPrefix(QCString(prefix)); + } QCString left( uint len ) const { @@ -220,18 +231,12 @@ class QCString QCString lower() const { - std::string s = m_rep; - std::transform(s.begin(),s.end(),s.begin(), - [](unsigned char c){ return (unsigned char)std::tolower(c); }); - return s; + return QCString(convertUTF8ToLower(m_rep)); } QCString upper() const { - std::string s = m_rep; - std::transform(s.begin(),s.end(),s.begin(), - [](unsigned char c){ return (unsigned char)std::toupper(c); }); - return s; + return QCString(convertUTF8ToUpper(m_rep)); } QCString stripWhiteSpace() const @@ -247,6 +252,24 @@ class QCString QCString simplifyWhiteSpace() const; + QCString &insert( uint index, const QCString &s ) + { + if (s.length()>0) + { + uint ol = (uint)m_rep.size(); + if (index>ol) // insert beyond end of string and fill gap with spaces + { + m_rep.resize(index+s.length()); + std::memset(&m_rep[ol],' ',index-ol); + std::memcpy(&m_rep[index],s.data(),s.length()+1); + } + else // insert inside the string + { + m_rep.insert(index,s.str()); + } + } + return *this; + } QCString &insert( uint index, const char *s ) { uint len = s ? qstrlen(s) : 0; @@ -273,16 +296,42 @@ class QCString return insert(index,s); } + QCString &append( char c) + { + m_rep+=c; + return *this; + } + QCString &append( const char *s ) { return operator+=(s); } + QCString &append( const QCString &s ) + { + return operator+=(s); + } + + QCString &append( const std::string &s ) + { + return operator+=(s); + } + QCString &prepend( const char *s ) { return insert(0,s); } + QCString &prepend( const QCString &s ) + { + return insert(0,s.data()); + } + + QCString &prepend( const std::string &s ) + { + return insert(0,s.c_str()); + } + QCString &remove( uint index, uint len ) { uint ol = (uint)m_rep.size(); @@ -343,11 +392,20 @@ class QCString return m_rep.rfind(s,0)==0; // looking "backward" starting and ending at index 0 } + bool startsWith( const QCString &s ) const + { + if (m_rep.empty() || s.isEmpty()) return s.isEmpty(); + return m_rep.rfind(s.str(),0)==0; // looking "backward" starting and ending at index 0 + } + +#define HAS_IMPLICIT_CAST_TO_PLAIN_C_STRING 0 +#if HAS_IMPLICIT_CAST_TO_PLAIN_C_STRING /** Converts the string to a plain C string */ operator const char *() const { return data(); } +#endif std::string str() const { @@ -373,23 +431,36 @@ class QCString return *this; } +#define HAS_CHARACTER_APPEND_OPERATOR 1 +#if HAS_CHARACTER_APPEND_OPERATOR /** Appends character \a c to this string and returns a reference to the result. */ QCString &operator+=( char c ) { m_rep+=c; return *this; } +#endif /** Returns a reference to the character at index \a i. */ - char &at( uint i) const + char &at( uint i) { - return const_cast<char&>(m_rep[i]); + return m_rep[i]; + } + + const char &at( uint i) const + { + return m_rep[i]; } /** Indexing operator. Equivalent to at(). */ - char &operator[]( int i ) const + char &operator[]( int i ) { - return const_cast<char&>(m_rep[i]); + return m_rep[i]; + } + + const char &operator[]( int i ) const + { + return m_rep[i]; } private: @@ -454,31 +525,34 @@ inline QCString operator+( const QCString &s1, const QCString &s2 ) inline QCString operator+( const QCString &s1, const char *s2 ) { QCString tmp(s1); - tmp += s2; + tmp.append(s2); return tmp; } inline QCString operator+( const char *s1, const QCString &s2 ) { QCString tmp(s1); - tmp += s2; + tmp.append(s2); return tmp; } +#define HAD_PLUS_OPERATOR_FOR_CHAR 0 +#if HAS_PLUS_OPERATOR_FOR_CHAR inline QCString operator+( const QCString &s1, char c2 ) { QCString tmp( s1.data() ); - tmp += c2; + tmp.append(c2); return tmp; } inline QCString operator+( char c1, const QCString &s2 ) { QCString tmp; - tmp += c1; - tmp += s2; + tmp.append(c1); + tmp.append(s2); return tmp; } +#endif inline const char *qPrint(const char *s) { @@ -500,15 +574,51 @@ inline std::string toStdString(const QCString &s) return s.str(); } +//---- overloads + +inline int qstricmp( const QCString &str1, const char *str2 ) +{ + return qstricmp(str1.data(),str2); +} + +inline int qstricmp( const char *str1, const QCString &str2 ) +{ + return qstricmp(str1,str2.data()); +} + +inline int qstricmp( const QCString &str1, const QCString &str2 ) +{ + return qstricmp(str1.data(),str2.data()); +} + +inline int qstrnicmp( const QCString &str1, const char *str2, uint len ) +{ + return qstrnicmp(str1.data(),str2,len); +} + +inline int qstrnicmp( const char *str1, const QCString &str2, uint len ) +{ + return qstrnicmp(str1,str2.data(),len); +} + +inline int qstrnicmp( const QCString &str1, const QCString &str2, uint len ) +{ + return qstrnicmp(str1.data(),str2.data(),len); +} + // helper functions QCString substitute(const QCString &str,const QCString &find,const QCString &replace); +inline QCString substitute(const QCString &str,const char *find,const char *replace) +{ + return substitute(str,QCString(find),QCString(replace)); +} QCString substitute(const QCString &s,const QCString &src,const QCString &dst,int skip_seq); inline QCString substitute(const QCString &s,char srcChar,char dstChar) { std::string ss = s.str(); std::replace(ss.begin(),ss.end(),srcChar,dstChar); - return ss; + return QCString(ss); } inline std::ostream& operator<<(std::ostream& os, const QCString& s) diff --git a/src/qhp.cpp b/src/qhp.cpp index dd199ad..fc2f215 100644 --- a/src/qhp.cpp +++ b/src/qhp.cpp @@ -27,7 +27,7 @@ #include <fstream> #include <string.h> -static QCString makeFileName(const char * withoutExtension) +static QCString makeFileName(const QCString & withoutExtension) { QCString result=withoutExtension; if (!result.isEmpty()) @@ -44,12 +44,12 @@ static QCString makeFileName(const char * withoutExtension) return result; } -static QCString makeRef(const char * withoutExtension, const char * anchor) +static QCString makeRef(const QCString & withoutExtension, const QCString & anchor) { //printf("QHP::makeRef(%s,%s)\n",withoutExtension,anchor); - if (!withoutExtension) return QCString(); + if (withoutExtension.isEmpty()) return QCString(); QCString result = makeFileName(withoutExtension); - if (!anchor) return result; + if (anchor.isEmpty()) return result; return result+"#"+anchor; } @@ -98,7 +98,7 @@ void Qhp::initialize() if (!filterName.isEmpty()) { const char * tagAttributes[] = - { "name", filterName, 0 }; + { "name", filterName.data(), 0 }; m_doc.open("customFilter", tagAttributes); StringVector customFilterAttributes = @@ -131,8 +131,8 @@ void Qhp::initialize() QCString fullProjectname = getFullProjectName(); QCString indexFile = "index"+Doxygen::htmlFileExtension; const char * const attributes[] = - { "title", fullProjectname, - "ref", indexFile, + { "title", fullProjectname.data(), + "ref", indexFile.data(), NULL }; m_toc.open("section", attributes); @@ -172,7 +172,8 @@ void Qhp::finalize() { term("Could not open file %s for writing\n", fileName.data()); } - m_doc.dumpTo(file); + TextStream t(&file); + m_doc.dumpTo(t); } void Qhp::incContentsDepth() @@ -190,9 +191,9 @@ void Qhp::decContentsDepth() m_sectionLevel--; } -void Qhp::addContentsItem(bool /*isDir*/, const char * name, - const char * /*ref*/, const char * file, - const char *anchor, bool /* separateIndex */, +void Qhp::addContentsItem(bool /*isDir*/, const QCString & name, + const QCString & /*ref*/, const QCString & file, + const QCString &anchor, bool /* separateIndex */, bool /* addToNavIndex */, const Definition * /*def*/) { @@ -216,7 +217,7 @@ void Qhp::addContentsItem(bool /*isDir*/, const char * name, } void Qhp::addIndexItem(const Definition *context,const MemberDef *md, - const char *sectionAnchor,const char *word) + const QCString §ionAnchor,const QCString &word) { (void)word; //printf("addIndexItem(%s %s %s\n", @@ -238,9 +239,9 @@ void Qhp::addIndexItem(const Definition *context,const MemberDef *md, QCString cfname = md->getOutputFileBase(); QCString cfiname = context->getOutputFileBase(); QCString level1 = context->name(); - QCString level2 = word ? QCString(word) : md->name(); + QCString level2 = !word.isEmpty() ? word : md->name(); QCString contRef = separateMemberPages ? cfname : cfiname; - QCString anchor = sectionAnchor ? QCString(sectionAnchor) : md->anchor(); + QCString anchor = !sectionAnchor.isEmpty() ? sectionAnchor : md->anchor(); QCString ref; @@ -249,9 +250,9 @@ void Qhp::addIndexItem(const Definition *context,const MemberDef *md, QCString id = level1+"::"+level2; const char * attributes[] = { - "name", level2, - "id", id, - "ref", ref, + "name", level2.data(), + "id", id.data(), + "ref", ref.data(), 0 }; m_index.openClose("keyword", attributes); @@ -260,20 +261,20 @@ void Qhp::addIndexItem(const Definition *context,const MemberDef *md, { // <keyword name="Foo" id="Foo" ref="doc.html#Foo"/> QCString contRef = context->getOutputFileBase(); - QCString level1 = word ? QCString(word) : context->name(); + QCString level1 = !word.isEmpty() ? word : context->name(); QCString ref = makeRef(contRef,sectionAnchor); const char * attributes[] = { - "name", level1, - "id", level1, - "ref", ref, + "name", level1.data(), + "id", level1.data(), + "ref", ref.data(), 0 }; m_index.openClose("keyword", attributes); } } -void Qhp::addIndexFile(const char * name) +void Qhp::addIndexFile(const QCString & name) { addFile(name); } @@ -316,8 +317,8 @@ void Qhp::handlePrevSection() QCString finalRef = makeRef(m_prevSectionBaseName, m_prevSectionAnchor); const char * const attributes[] = - { "title", m_prevSectionTitle, - "ref", finalRef, + { "title", m_prevSectionTitle.data(), + "ref", finalRef.data(), NULL }; @@ -340,7 +341,7 @@ void Qhp::handlePrevSection() clearPrevSection(); } -void Qhp::setPrevSection(const char * title, const char * basename, const char * anchor, int level) +void Qhp::setPrevSection(const QCString & title, const QCString & basename, const QCString & anchor, int level) { m_prevSectionTitle = title; m_prevSectionBaseName = basename; @@ -355,17 +356,17 @@ void Qhp::clearPrevSection() m_prevSectionAnchor.resize(0); } -void Qhp::addFile(const char * fileName) +void Qhp::addFile(const QCString & fileName) { m_files.openCloseContent("file", fileName); } -void Qhp::addImageFile(const char *fileName) +void Qhp::addImageFile(const QCString &fileName) { addFile(fileName); } -void Qhp::addStyleSheetFile(const char *fileName) +void Qhp::addStyleSheetFile(const QCString &fileName) { addFile(fileName); } @@ -3,8 +3,8 @@ * Copyright (C) 2008 Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -31,15 +31,15 @@ class Qhp : public IndexIntf void finalize(); void incContentsDepth(); void decContentsDepth(); - void addContentsItem(bool isDir, const char * name, const char * ref, - const char * file, const char * anchor, + void addContentsItem(bool isDir, const QCString & name, const QCString & ref, + const QCString & file, const QCString & anchor, bool separateIndex,bool addToNavIndex, const Definition *def); void addIndexItem(const Definition *context, const MemberDef *md, - const char *sectionAnchor, const char *title); - void addIndexFile(const char * name); - void addImageFile(const char * name); - void addStyleSheetFile(const char * name); + const QCString §ionAnchor, const QCString &title); + void addIndexFile(const QCString & name); + void addImageFile(const QCString & name); + void addStyleSheetFile(const QCString & name); // END IndexIntf static QCString getQhpFileName(); @@ -47,8 +47,8 @@ class Qhp : public IndexIntf private: void handlePrevSection(); void clearPrevSection(); - void setPrevSection(const char * title, const char * basename, const char * anchor, int level); - void addFile(const char * fileName); + void setPrevSection(const QCString & title, const QCString & basename, const QCString & anchor, int level); + void addFile(const QCString & fileName); static QCString getFullProjectName(); diff --git a/src/qhpxmlwriter.cpp b/src/qhpxmlwriter.cpp index f495aaa..b3ab95a 100644 --- a/src/qhpxmlwriter.cpp +++ b/src/qhpxmlwriter.cpp @@ -16,10 +16,10 @@ #include "qhpxmlwriter.h" #include "util.h" +#include "qcstring.h" QhpXmlWriter::QhpXmlWriter() - : m_backend(std::ios_base::ate), m_indentLevel(0), - m_curLineIndented(false), m_compress(false) + : m_indentLevel(0), m_curLineIndented(false), m_compress(false) { } @@ -42,13 +42,13 @@ void QhpXmlWriter::insert(QhpXmlWriter const & source) m_backend << source.m_backend.str(); } -void QhpXmlWriter::dumpTo(std::ostream & file) +void QhpXmlWriter::dumpTo(TextStream & file) { file << m_backend.str(); } -void QhpXmlWriter::open(char const * elementName, - char const * const * attributes) +void QhpXmlWriter::open(const QCString &elementName, + const char * const attributes[]) { indent(); openPure(elementName, attributes); @@ -56,16 +56,16 @@ void QhpXmlWriter::open(char const * elementName, m_indentLevel++; } -void QhpXmlWriter::openClose(char const * elementName, - char const * const * attributes) +void QhpXmlWriter::openClose(const QCString &elementName, + const char * const attributes[]) { indent(); openClosePure(elementName, attributes); newLine(); } -void QhpXmlWriter::openCloseContent(char const * elementName, - char const * content) +void QhpXmlWriter::openCloseContent(const QCString &elementName, + const QCString &content) { indent(); openPure(elementName); @@ -74,7 +74,7 @@ void QhpXmlWriter::openCloseContent(char const * elementName, newLine(); } -void QhpXmlWriter::close(char const * elementName) +void QhpXmlWriter::close(const QCString &elementName) { m_indentLevel--; indent(); @@ -82,7 +82,7 @@ void QhpXmlWriter::close(char const * elementName) newLine(); } -void QhpXmlWriter::declaration(char const * version, char const * encoding) +void QhpXmlWriter::declaration(const QCString &version, const QCString &encoding) { m_backend << "<?xml version=\"" << version << "\" encoding=\"" << encoding << "\"?>"; newLine(); @@ -110,17 +110,17 @@ void QhpXmlWriter::newLine() } } -void QhpXmlWriter::openPureHelper(char const * elementName, - char const * const * attributes, bool close) +void QhpXmlWriter::openPureHelper(const QCString &elementName, + const char * const attributes[], bool close) { m_backend << "<" << elementName; if (attributes) { - for (char const * const * walker = attributes; + for (const char * const * walker = attributes; walker[0]; walker += 2) { - char const * const key = walker[0]; - char const * const value = walker[1]; + const char *const key = walker[0]; + const char *const value = walker[1]; if (!value) { continue; @@ -136,19 +136,19 @@ void QhpXmlWriter::openPureHelper(char const * elementName, m_backend << ">"; } -void QhpXmlWriter::openPure(char const * elementName, - char const * const * attributes) +void QhpXmlWriter::openPure(const QCString &elementName, + const char * const attributes[]) { openPureHelper(elementName, attributes, false); } -void QhpXmlWriter::openClosePure(char const * elementName, - char const * const * attributes) +void QhpXmlWriter::openClosePure(const QCString &elementName, + const char * const attributes[]) { openPureHelper(elementName, attributes, true); } -void QhpXmlWriter::closePure(char const * elementName) +void QhpXmlWriter::closePure(const QCString &elementName) { m_backend << "</" << elementName << ">"; } diff --git a/src/qhpxmlwriter.h b/src/qhpxmlwriter.h index f883ba6..7b591eb 100644 --- a/src/qhpxmlwriter.h +++ b/src/qhpxmlwriter.h @@ -17,8 +17,8 @@ #ifndef QHPXMLWRITER_H #define QHPXMLWRITER_H -#include <iostream> #include <sstream> +#include "textstream.h" class QhpXmlWriter { @@ -29,29 +29,27 @@ class QhpXmlWriter void setIndentLevel(int level); void setCompressionEnabled(bool enabled); void insert(QhpXmlWriter const & source); - void dumpTo(std::ostream & file); - void open(char const * elementName, - char const * const * attributes = 0); - void openClose(char const * elementName, - char const * const * attributes = 0); - void openCloseContent(char const * elementName, char const * content); - void close(char const * elementName); - void declaration(char const * version, char const * encoding); - - static char * dupEscaped(const char * source); + void dumpTo(TextStream & file); + void open(const QCString &elementName, + const char * const attributes[] = 0); + void openClose(const QCString &elementName, + const char * const attributes[] = 0); + void openCloseContent(const QCString &elementName, const QCString &content); + void close(const QCString &elementName); + void declaration(const QCString &version, const QCString &encoding); private: void indent(); void newLine(); - void openPureHelper(char const * elementName, - char const * const * attributes, bool close); - void openPure(char const * elementName, - char const * const * attributes = 0); - void openClosePure(char const * elementName, - char const * const * attributes = 0); - void closePure(char const * elementName); - - std::ostringstream m_backend; + void openPureHelper(const QCString &elementName, + const char * const attributes[], bool close); + void openPure(const QCString &elementName, + const char * const attributes[] = 0); + void openClosePure(const QCString &elementName, + const char * const attributes[] = 0); + void closePure(const QCString &elementName); + + TextStream m_backend; int m_indentLevel; bool m_curLineIndented; bool m_compress; diff --git a/src/reflist.cpp b/src/reflist.cpp index 90bac91..9a32449 100644 --- a/src/reflist.cpp +++ b/src/reflist.cpp @@ -21,7 +21,7 @@ #include "definition.h" #include "config.h" -RefList::RefList(const char *listName, const char *pageTitle, const char *secTitle) : +RefList::RefList(const QCString &listName, const QCString &pageTitle, const QCString &secTitle) : m_listName(listName), m_fileName(convertNameToFile(listName,FALSE,TRUE)), m_pageTitle(pageTitle), m_secTitle(secTitle) { @@ -67,7 +67,7 @@ void RefList::generatePage() bool first=true; for (const std::unique_ptr<RefItem> &item : m_entries) { - if (!item->name()) continue; + if (item->name().isEmpty()) continue; cnt++; bool startNewGroup = item->group()!=lastGroup; if (startNewGroup) diff --git a/src/reflist.h b/src/reflist.h index f6444c5..6ab360b 100644 --- a/src/reflist.h +++ b/src/reflist.h @@ -32,13 +32,13 @@ class RefItem public: RefItem(int id,RefList *list) : m_id(id), m_list(list) {} - void setText (const char *text) { m_text = text; } - void setAnchor(const char *anchor) { m_anchor = anchor; } - void setPrefix(const char *prefix) { m_prefix = prefix; } - void setName (const char *name) { m_name = name; } - void setTitle (const char *title) { m_title = title; } - void setArgs (const char *args) { m_args = args; } - void setGroup (const char *group) { m_group = group; } + void setText (const QCString &text) { m_text = text; } + void setAnchor(const QCString &anchor) { m_anchor = anchor; } + void setPrefix(const QCString &prefix) { m_prefix = prefix; } + void setName (const QCString &name) { m_name = name; } + void setTitle (const QCString &title) { m_title = title; } + void setArgs (const QCString &args) { m_args = args; } + void setGroup (const QCString &group) { m_group = group; } void setScope (const Definition *scope) { m_scope = scope; } QCString text() const { return m_text; } @@ -83,7 +83,7 @@ class RefList * @param pageTitle String representing the title of the list page. * @param secTitle String representing the title of the section. */ - RefList(const char *listName, const char *pageTitle, const char *secTitle); + RefList(const QCString &listName, const QCString &pageTitle, const QCString &secTitle); bool isEnabled() const; /*! Adds a new item to the list. diff --git a/src/regex.cpp b/src/regex.cpp index ae5476e..2a39f63 100644 --- a/src/regex.cpp +++ b/src/regex.cpp @@ -37,7 +37,7 @@ static inline bool isspace(char c) static inline bool isalpha(char c) { - return c<0 || (c>='a' && c<='z') || (c>='A' && c<='Z'); + return static_cast<unsigned char>(c)>=128 || (c>='a' && c<='z') || (c>='A' && c<='Z'); } static inline bool isdigit(char c) diff --git a/src/resourcemgr.cpp b/src/resourcemgr.cpp index 01494d8..161e480 100644 --- a/src/resourcemgr.cpp +++ b/src/resourcemgr.cpp @@ -51,14 +51,14 @@ void ResourceMgr::registerResources(std::initializer_list<Resource> resources) } } -bool ResourceMgr::writeCategory(const char *categoryName,const char *targetDir) const +bool ResourceMgr::writeCategory(const QCString &categoryName,const QCString &targetDir) const { for (auto &kv : p->resources) { Resource &res = kv.second; - if (qstrcmp(res.category,categoryName)==0) + if (res.category==categoryName) { - std::string pathName = std::string(targetDir)+"/"+res.name; + std::string pathName = targetDir.str()+"/"+res.name; std::ofstream f(pathName,std::ofstream::out | std::ofstream::binary); bool ok=false; if (f.is_open()) @@ -68,7 +68,7 @@ bool ResourceMgr::writeCategory(const char *categoryName,const char *targetDir) } if (!ok) { - err("Failed to write resource '%s' to directory '%s'\n",res.name,targetDir); + err("Failed to write resource '%s' to directory '%s'\n",res.name,qPrint(targetDir)); return FALSE; } } @@ -76,9 +76,9 @@ bool ResourceMgr::writeCategory(const char *categoryName,const char *targetDir) return TRUE; } -bool ResourceMgr::copyResourceAs(const char *name,const char *targetDir,const char *targetName) const +bool ResourceMgr::copyResourceAs(const QCString &name,const QCString &targetDir,const QCString &targetName) const { - std::string pathName = std::string(targetDir)+"/"+targetName; + std::string pathName = targetDir.str()+"/"+targetName.str(); const Resource *res = get(name); if (res) { @@ -107,7 +107,7 @@ bool ResourceMgr::copyResourceAs(const char *name,const char *targetDir,const ch ushort width = (data[0]<<8)+data[1]; ushort height = (data[2]<<8)+data[3]; ColoredImgDataItem images[2]; - images[0].name = n; + images[0].name = n.data(); images[0].width = width; images[0].height = height; images[0].content = &data[4]; @@ -125,7 +125,7 @@ bool ResourceMgr::copyResourceAs(const char *name,const char *targetDir,const ch ushort width = (data[0]<<8)+data[1]; ushort height = (data[2]<<8)+data[3]; ColoredImgDataItem images[2]; - images[0].name = n; + images[0].name = n.data(); images[0].width = width; images[0].height = height; images[0].content = &data[4]; @@ -143,7 +143,7 @@ bool ResourceMgr::copyResourceAs(const char *name,const char *targetDir,const ch QCString buf(res->size+1); memcpy(buf.rawData(),res->data,res->size); buf = replaceColorMarkers(buf); - if (qstrcmp(name,"navtree.css")==0) + if (name=="navtree.css") { t << substitute(buf,"$width",QCString().setNum(Config_getInt(TREEVIEW_WIDTH))+"px"); } @@ -170,24 +170,24 @@ bool ResourceMgr::copyResourceAs(const char *name,const char *targetDir,const ch } else { - err("requested resource '%s' not compiled in!\n",name); + err("requested resource '%s' not compiled in!\n",qPrint(name)); } return FALSE; } -bool ResourceMgr::copyResource(const char *name,const char *targetDir) const +bool ResourceMgr::copyResource(const QCString &name,const QCString &targetDir) const { return copyResourceAs(name,targetDir,name); } -const Resource *ResourceMgr::get(const char *name) const +const Resource *ResourceMgr::get(const QCString &name) const { - auto it = p->resources.find(name); + auto it = p->resources.find(name.str()); if (it!=p->resources.end()) return &it->second; return 0; } -QCString ResourceMgr::getAsString(const char *name) const +QCString ResourceMgr::getAsString(const QCString &name) const { const Resource *res = get(name); if (res) diff --git a/src/resourcemgr.h b/src/resourcemgr.h index 851f8b0..7978e09 100644 --- a/src/resourcemgr.h +++ b/src/resourcemgr.h @@ -42,20 +42,20 @@ class ResourceMgr void registerResources(std::initializer_list<Resource> resources); /** Writes all resource belonging to a given category to a given target directory */ - bool writeCategory(const char *categoryName,const char *targetDir) const; + bool writeCategory(const QCString &categoryName,const QCString &targetDir) const; /** Copies a registered resource to a given target directory */ - bool copyResource(const char *name,const char *targetDir) const; + bool copyResource(const QCString &name,const QCString &targetDir) const; /** Copies a registered resource to a given target directory under a given target name */ - bool copyResourceAs(const char *name,const char *targetDir,const char *targetName) const; + bool copyResourceAs(const QCString &name,const QCString &targetDir,const QCString &targetName) const; /** Gets the resource data as a C string */ - QCString getAsString(const char *name) const; + QCString getAsString(const QCString &name) const; private: /** Returns a pointer to the resource object with the given name. */ - const Resource *get(const char *name) const; + const Resource *get(const QCString &name) const; ResourceMgr(); ~ResourceMgr(); diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index 5a19fc0..4e7cfda 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -55,17 +55,16 @@ static QCString align(DocHtmlCell *cell) return ""; } -RTFDocVisitor::RTFDocVisitor(std::ostream &t,CodeOutputInterface &ci, - const char *langExt) +RTFDocVisitor::RTFDocVisitor(TextStream &t,CodeOutputInterface &ci, + const QCString &langExt) : DocVisitor(DocVisitor_RTF), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_indentLevel(0), m_lastIsPara(FALSE), m_langExt(langExt) { } -QCString RTFDocVisitor::getStyle(const char *name) +QCString RTFDocVisitor::getStyle(const QCString &name) { - QCString n; - n.sprintf("%s%d",name,m_indentLevel); + QCString n = name + QCString().setNum(m_indentLevel); StyleData &sd = rtf_Style[n.str()]; return sd.reference(); } @@ -329,14 +328,14 @@ void RTFDocVisitor::visit(DocVerbatim *s) QCString fileName(4096); fileName.sprintf("%s%d%s", - (Config_getString(RTF_OUTPUT)+"/inline_dotgraph_").data(), + qPrint(Config_getString(RTF_OUTPUT)+"/inline_dotgraph_"), dotindex++, ".dot" ); std::ofstream file(fileName.str(),std::ofstream::out | std::ofstream::binary); if (!file.is_open()) { - err("Could not open file %s for writing\n",fileName.data()); + err("Could not open file %s for writing\n",qPrint(fileName)); } else { @@ -358,14 +357,14 @@ void RTFDocVisitor::visit(DocVerbatim *s) QCString baseName(4096); baseName.sprintf("%s%d%s", - (Config_getString(RTF_OUTPUT)+"/inline_mscgraph_").data(), + qPrint(Config_getString(RTF_OUTPUT)+"/inline_mscgraph_"), mscindex++, ".msc" ); std::ofstream file(baseName.str(),std::ofstream::out | std::ofstream::binary); if (!file.is_open()) { - err("Could not open file %s for writing\n",baseName.data()); + err("Could not open file %s for writing\n",qPrint(baseName)); } QCString text = "msc {"; text+=s->text(); @@ -532,7 +531,7 @@ void RTFDocVisitor::visit(DocInclude *inc) void RTFDocVisitor::visit(DocIncOperator *op) { //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n", - // op->type(),op->isFirst(),op->isLast(),op->text().data()); + // op->type(),op->isFirst(),op->isLast(),qPrint(op->text())); DBG_RTF("{\\comment RTFDocVisitor::visit(DocIncOperator)}\n"); QCString locLangExt = getFileNameExtension(op->includeFileName()); if (locLangExt.isEmpty()) locLangExt = m_langExt; @@ -892,6 +891,20 @@ void RTFDocVisitor::visitPre(DocHtmlList *l) m_t << "{\n"; rtf_listItemInfo[m_indentLevel].isEnum = l->type()==DocHtmlList::Ordered; rtf_listItemInfo[m_indentLevel].number = 1; + rtf_listItemInfo[m_indentLevel].type = '1'; + for (const auto &opt : l->attribs()) + { + if (opt.name=="type") + { + rtf_listItemInfo[m_indentLevel].type = opt.value[0]; + } + if (opt.name=="start") + { + bool ok; + int val = opt.value.toInt(&ok); + if (ok) rtf_listItemInfo[m_indentLevel].number = val; + } + } m_lastIsPara=FALSE; } @@ -912,7 +925,28 @@ void RTFDocVisitor::visitPre(DocHtmlListItem *) if (rtf_listItemInfo[m_indentLevel].isEnum) { m_t << getStyle("ListEnum") << "\n"; - m_t << rtf_listItemInfo[m_indentLevel].number << ".\\tab "; + switch (rtf_listItemInfo[m_indentLevel].type) + { + case '1': + m_t << rtf_listItemInfo[m_indentLevel].number; + break; + case 'a': + m_t << integerToAlpha(rtf_listItemInfo[m_indentLevel].number,false); + break; + case 'A': + m_t << integerToAlpha(rtf_listItemInfo[m_indentLevel].number); + break; + case 'i': + m_t << integerToRoman(rtf_listItemInfo[m_indentLevel].number,false); + break; + case 'I': + m_t << integerToRoman(rtf_listItemInfo[m_indentLevel].number); + break; + default: + m_t << rtf_listItemInfo[m_indentLevel].number; + break; + } + m_t << ".\\tab "; rtf_listItemInfo[m_indentLevel].number++; } else @@ -1179,7 +1213,7 @@ void RTFDocVisitor::visitPre(DocImage *img) DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocImage)}\n"); includePicturePreRTF(img->name(), img->type()==DocImage::Rtf, img->hasCaption(), img->isInlineImage()); } -void RTFDocVisitor::includePicturePreRTF(const QCString name, bool isTypeRTF, bool hasCaption, bool inlineImage) +void RTFDocVisitor::includePicturePreRTF(const QCString &name, bool isTypeRTF, bool hasCaption, bool inlineImage) { if (isTypeRTF) { @@ -1307,7 +1341,7 @@ void RTFDocVisitor::visitPre(DocRef *ref) // ref->anchor() for LaTeX/RTF if (ref->isSubPage()) { - startLink(ref->ref(),0,ref->anchor()); + startLink(ref->ref(),QCString(),ref->anchor()); } else { @@ -1710,11 +1744,11 @@ void RTFDocVisitor::visitPost(DocParBlock *) // return s; //} -void RTFDocVisitor::filter(const char *str,bool verbatim) +void RTFDocVisitor::filter(const QCString &str,bool verbatim) { - if (str) + if (!str.isEmpty()) { - const unsigned char *p=(const unsigned char *)str; + const unsigned char *p=(const unsigned char *)str.data(); unsigned char c; //unsigned char pc='\0'; while (*p) @@ -1765,11 +1799,11 @@ void RTFDocVisitor::startLink(const QCString &ref,const QCString &file,const QCS { refName+=file; } - if (!file.isEmpty() && anchor) + if (!file.isEmpty() && !anchor.isEmpty()) { refName+='_'; } - if (anchor) + if (!anchor.isEmpty()) { refName+=anchor; } diff --git a/src/rtfdocvisitor.h b/src/rtfdocvisitor.h index 290746a..01be1aa 100644 --- a/src/rtfdocvisitor.h +++ b/src/rtfdocvisitor.h @@ -25,12 +25,13 @@ #include "qcstring.h" class CodeOutputInterface; +class TextStream; /*! @brief Concrete visitor implementation for RTF output. */ class RTFDocVisitor : public DocVisitor { public: - RTFDocVisitor(std::ostream &t,CodeOutputInterface &ci,const char *langExt); + RTFDocVisitor(TextStream &t,CodeOutputInterface &ci,const QCString &langExt); //-------------------------------------- // visitor functions for leaf nodes @@ -141,15 +142,15 @@ class RTFDocVisitor : public DocVisitor // helper functions //-------------------------------------- - void filter(const char *str,bool verbatim=FALSE); + void filter(const QCString &str,bool verbatim=FALSE); void startLink(const QCString &ref,const QCString &file, const QCString &anchor); void endLink(const QCString &ref); - QCString getStyle(const char *name); + QCString getStyle(const QCString &name); void incIndentLevel(); void decIndentLevel(); - void includePicturePreRTF(const QCString name, bool isTypeRTF, bool hasCaption, bool inlineImage = FALSE); + void includePicturePreRTF(const QCString &name, bool isTypeRTF, bool hasCaption, bool inlineImage = FALSE); void includePicturePostRTF(bool isTypeRTF, bool hasCaption, bool inlineImage = FALSE); void writeDotFile(const QCString &fileName, bool hasCaption); void writeDotFile(DocDotFile *); @@ -162,7 +163,7 @@ class RTFDocVisitor : public DocVisitor // state variables //-------------------------------------- - std::ostream &m_t; + TextStream &m_t; CodeOutputInterface &m_ci; bool m_insidePre; bool m_hide; diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index bb49a18..0fac0b4 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -98,7 +98,7 @@ void RTFGenerator::setSourceFileName(const QCString &name) m_sourceFileName = name; } -void RTFGenerator::writeStyleSheetFile(std::ostream &t) +void RTFGenerator::writeStyleSheetFile(TextStream &t) { t << "# Generated by doxygen " << getDoxygenVersion() << "\n\n"; t << "# This file describes styles used for generating RTF output.\n"; @@ -114,7 +114,7 @@ void RTFGenerator::writeStyleSheetFile(std::ostream &t) } } -void RTFGenerator::writeExtensionsFile(std::ostream &t) +void RTFGenerator::writeExtensionsFile(TextStream &t) { t << "# Generated by doxygen " << getDoxygenVersion() << "\n\n"; t << "# This file describes extensions used for generating RTF output.\n"; @@ -172,7 +172,7 @@ void RTFGenerator::init() Dir d(dir.str()); if (!d.exists() && !d.mkdir(dir.str())) { - term("Could not create output directory %s\n",dir.data()); + term("Could not create output directory %s\n",qPrint(dir)); } // first duplicate strings of rtf_Style_Default @@ -207,7 +207,7 @@ void RTFGenerator::init() createSubDirs(d); } -static QCString makeIndexName(const char *s,int i) +static QCString makeIndexName(const QCString &s,int i) { QCString result=s; result+=(char)(i+'0'); @@ -219,77 +219,77 @@ void RTFGenerator::beginRTFDocument() /* all the included RTF files should begin with the * same header */ - t <<"{\\rtf1\\ansi\\ansicpg" << theTranslator->trRTFansicp(); - t <<"\\uc1 \\deff0\\deflang1033\\deflangfe1033\n"; - - DBG_RTF(t <<"{\\comment Beginning font list}\n") - t <<"{\\fonttbl "; - t <<"{\\f0\\froman\\fcharset" << theTranslator->trRTFCharSet(); - t <<"\\fprq2{\\*\\panose 02020603050405020304}Times New Roman;}\n"; - t <<"{\\f1\\fswiss\\fcharset" << theTranslator->trRTFCharSet(); - t <<"\\fprq2{\\*\\panose 020b0604020202020204}Arial;}\n"; - t <<"{\\f2\\fmodern\\fcharset" << theTranslator->trRTFCharSet(); - t <<"\\fprq1{\\*\\panose 02070309020205020404}Courier New;}\n"; - t <<"{\\f3\\froman\\fcharset2\\fprq2{\\*\\panose 05050102010706020507}Symbol;}\n"; - t <<"}\n"; - DBG_RTF(t <<"{\\comment begin colors}\n") - t <<"{\\colortbl;"; - t <<"\\red0\\green0\\blue0;"; - t <<"\\red0\\green0\\blue255;"; - t <<"\\red0\\green255\\blue255;"; - t <<"\\red0\\green255\\blue0;"; - t <<"\\red255\\green0\\blue255;"; - t <<"\\red255\\green0\\blue0;"; - t <<"\\red255\\green255\\blue0;"; - t <<"\\red255\\green255\\blue255;"; - t <<"\\red0\\green0\\blue128;"; - t <<"\\red0\\green128\\blue128;"; - t <<"\\red0\\green128\\blue0;"; - t <<"\\red128\\green0\\blue128;"; - t <<"\\red128\\green0\\blue0;"; - t <<"\\red128\\green128\\blue0;"; - t <<"\\red128\\green128\\blue128;"; - t <<"\\red192\\green192\\blue192;"; + m_t << "{\\rtf1\\ansi\\ansicpg" << theTranslator->trRTFansicp(); + m_t << "\\uc1 \\deff0\\deflang1033\\deflangfe1033\n"; + + DBG_RTF(m_t << "{\\comment Beginning font list}\n") + m_t << "{\\fonttbl "; + m_t << "{\\f0\\froman\\fcharset" << theTranslator->trRTFCharSet(); + m_t << "\\fprq2{\\*\\panose 02020603050405020304}Times New Roman;}\n"; + m_t << "{\\f1\\fswiss\\fcharset" << theTranslator->trRTFCharSet(); + m_t << "\\fprq2{\\*\\panose 020b0604020202020204}Arial;}\n"; + m_t << "{\\f2\\fmodern\\fcharset" << theTranslator->trRTFCharSet(); + m_t << "\\fprq1{\\*\\panose 02070309020205020404}Courier New;}\n"; + m_t << "{\\f3\\froman\\fcharset2\\fprq2{\\*\\panose 05050102010706020507}Symbol;}\n"; + m_t << "}\n"; + DBG_RTF(m_t << "{\\comment begin colors}\n") + m_t << "{\\colortbl;"; + m_t << "\\red0\\green0\\blue0;"; + m_t << "\\red0\\green0\\blue255;"; + m_t << "\\red0\\green255\\blue255;"; + m_t << "\\red0\\green255\\blue0;"; + m_t << "\\red255\\green0\\blue255;"; + m_t << "\\red255\\green0\\blue0;"; + m_t << "\\red255\\green255\\blue0;"; + m_t << "\\red255\\green255\\blue255;"; + m_t << "\\red0\\green0\\blue128;"; + m_t << "\\red0\\green128\\blue128;"; + m_t << "\\red0\\green128\\blue0;"; + m_t << "\\red128\\green0\\blue128;"; + m_t << "\\red128\\green0\\blue0;"; + m_t << "\\red128\\green128\\blue0;"; + m_t << "\\red128\\green128\\blue128;"; + m_t << "\\red192\\green192\\blue192;"; // code highlighting colors. Note order is important see also RTFGenerator::startFontClass - t <<"\\red0\\green128\\blue0;"; // keyword = index 17 - t <<"\\red96\\green64\\blue32;"; // keywordtype - t <<"\\rede0\\green128\\blue0;"; // keywordflow - t <<"\\red128\\green0\\blue0;"; // comment - t <<"\\red128\\green96\\blue32;"; // preprocessor - t <<"\\red0\\green32\\blue128;"; // stringliteral - t <<"\\red0\\green128\\blue128;"; // charliteral - t <<"\\red255\\green0\\blue255;"; // vhdldigit - t <<"\\red0\\green0\\blue0;"; // vhdlchar - t <<"\\red112\\green0\\blue112;"; // vhdlkeyword - t <<"\\red255\\green0\\blue0;"; // vhdllogic - - t <<"}\n"; - - DBG_RTF(t <<"{\\comment Beginning style list}\n") - t <<"{\\stylesheet\n"; - t <<"{\\widctlpar\\adjustright \\fs20\\cgrid \\snext0 Normal;}\n"; + m_t << "\\red0\\green128\\blue0;"; // keyword = index 17 + m_t << "\\red96\\green64\\blue32;"; // keywordtype + m_t << "\\rede0\\green128\\blue0;"; // keywordflow + m_t << "\\red128\\green0\\blue0;"; // comment + m_t << "\\red128\\green96\\blue32;"; // preprocessor + m_t << "\\red0\\green32\\blue128;"; // stringliteral + m_t << "\\red0\\green128\\blue128;"; // charliteral + m_t << "\\red255\\green0\\blue255;"; // vhdldigit + m_t << "\\red0\\green0\\blue0;"; // vhdlchar + m_t << "\\red112\\green0\\blue112;"; // vhdlkeyword + m_t << "\\red255\\green0\\blue0;"; // vhdllogic + + m_t << "}\n"; + + DBG_RTF(m_t << "{\\comment Beginning style list}\n") + m_t << "{\\stylesheet\n"; + m_t << "{\\widctlpar\\adjustright \\fs20\\cgrid \\snext0 Normal;}\n"; // set the paper dimensions according to PAPER_TYPE QCString paperName = Config_getEnum(PAPER_TYPE); - t << "{"; + m_t << "{"; if (paperName=="a4") { - t << "\\paperw11900\\paperh16840"; // width & height values are inches * 1440 + m_t << "\\paperw11900\\paperh16840"; // width & height values are inches * 1440 } else if (paperName=="letter") { - t << "\\paperw12240\\paperh15840"; + m_t << "\\paperw12240\\paperh15840"; } else if (paperName=="legal") { - t << "\\paperw12240\\paperh20160"; + m_t << "\\paperw12240\\paperh20160"; } else if (paperName=="executive") { - t << "\\paperw10440\\paperh15120"; + m_t << "\\paperw10440\\paperh15120"; } - t << "\\margl1800\\margr1800\\margt1440\\margb1440\\gutter0\\ltrsect}\n"; + m_t << "\\margl1800\\margr1800\\margt1440\\margb1440\\gutter0\\ltrsect}\n"; // sort styles ascending by \s-number via an intermediate QArray unsigned maxIndex = 0; @@ -318,57 +318,57 @@ void RTFGenerator::beginRTFDocument() const StyleData *pStyle = array[i]; if (pStyle) { - t <<"{" << pStyle->reference() << pStyle->definition() << ";}\n"; + m_t << "{" << pStyle->reference() << pStyle->definition() << ";}\n"; } } - t <<"}\n"; + m_t << "}\n"; // this comment is needed for postprocessing! - t <<"{\\comment begin body}\n"; + m_t << "{\\comment begin body}\n"; } void RTFGenerator::beginRTFChapter() { - t <<"\n"; - DBG_RTF(t << "{\\comment BeginRTFChapter}\n") - t << rtf_Style_Reset; + m_t << "\n"; + DBG_RTF(m_t << "{\\comment BeginRTFChapter}\n") + m_t << rtf_Style_Reset; // if we are compact, no extra page breaks... if (Config_getBool(COMPACT_RTF)) { - // t <<"\\sect\\sectd\\sbknone\n"; - t <<"\\sect\\sbknone\n"; + // m_t << "\\sect\\sectd\\sbknone\n"; + m_t << "\\sect\\sbknone\n"; rtfwriteRuler_thick(); } else - t <<"\\sect\\sbkpage\n"; - //t <<"\\sect\\sectd\\sbkpage\n"; + m_t << "\\sect\\sbkpage\n"; + //m_t << "\\sect\\sectd\\sbkpage\n"; - t << rtf_Style["Heading1"].reference() << "\n"; + m_t << rtf_Style["Heading1"].reference() << "\n"; } void RTFGenerator::beginRTFSection() { - t <<"\n"; - DBG_RTF(t << "{\\comment BeginRTFSection}\n") - t << rtf_Style_Reset; + m_t << "\n"; + DBG_RTF(m_t << "{\\comment BeginRTFSection}\n") + m_t << rtf_Style_Reset; // if we are compact, no extra page breaks... if (Config_getBool(COMPACT_RTF)) { - t <<"\\sect\\sbknone\n"; + m_t << "\\sect\\sbknone\n"; rtfwriteRuler_emboss(); } else { - t <<"\\sect\\sbkpage\n"; + m_t << "\\sect\\sbkpage\n"; } - t << rtf_Style["Heading2"].reference() << "\n"; + m_t << rtf_Style["Heading2"].reference() << "\n"; } -void RTFGenerator::startFile(const char *name,const char *,const char *,int) +void RTFGenerator::startFile(const QCString &name,const QCString &,const QCString &,int) { //setEncoding(QCString().sprintf("CP%s",theTranslator->trRTFansicp())); QCString fileName=name; @@ -383,8 +383,8 @@ void RTFGenerator::startFile(const char *name,const char *,const char *,int) void RTFGenerator::endFile() { - DBG_RTF(t << "{\\comment endFile}\n") - t << "}"; + DBG_RTF(m_t << "{\\comment endFile}\n") + m_t << "}"; endPlainFile(); setSourceFileName(""); @@ -392,13 +392,13 @@ void RTFGenerator::endFile() void RTFGenerator::startProjectNumber() { - DBG_RTF(t <<"{\\comment startProjectNumber }\n") - t << " "; + DBG_RTF(m_t << "{\\comment startProjectNumber }\n") + m_t << " "; } void RTFGenerator::endProjectNumber() { - DBG_RTF(t <<"{\\comment endProjectNumber }\n") + DBG_RTF(m_t << "{\\comment endProjectNumber }\n") } void RTFGenerator::startIndexSection(IndexSections is) @@ -413,19 +413,19 @@ void RTFGenerator::startIndexSection(IndexSections is) // basic RTFstart // get readyfor author etc - t << "{\\info \n"; - t << "{\\title {\\comment "; + m_t << "{\\info \n"; + m_t << "{\\title {\\comment "; break; case isTitlePageAuthor: - t << "}\n"; - if (rtf_subject) t << "{\\subject " << rtf_subject << "}\n"; - if (rtf_comments) t << "{\\comment " << rtf_comments << "}\n"; - if (rtf_company) t << "{\\company " << rtf_company << "}\n"; - if (rtf_author) t << "{\\author " << rtf_author << "}\n"; - if (rtf_manager) t << "{\\manager " << rtf_manager << "}\n"; - if (rtf_documentType) t << "{\\category " << rtf_documentType << "}\n"; - if (rtf_keywords) t << "{\\keywords " << rtf_keywords << "}\n"; - t << "{\\comment "; + m_t << "}\n"; + if (!rtf_subject.isEmpty()) m_t << "{\\subject " << rtf_subject << "}\n"; + if (!rtf_comments.isEmpty()) m_t << "{\\comment " << rtf_comments << "}\n"; + if (!rtf_company.isEmpty()) m_t << "{\\company " << rtf_company << "}\n"; + if (!rtf_author.isEmpty()) m_t << "{\\author " << rtf_author << "}\n"; + if (!rtf_manager.isEmpty()) m_t << "{\\manager " << rtf_manager << "}\n"; + if (!rtf_documentType.isEmpty()) m_t << "{\\category " << rtf_documentType << "}\n"; + if (!rtf_keywords.isEmpty()) m_t << "{\\keywords " << rtf_keywords << "}\n"; + m_t << "{\\comment "; break; case isMainPage: //Introduction @@ -447,9 +447,13 @@ void RTFGenerator::startIndexSection(IndexSections is) //Namespace Index beginRTFChapter(); break; + case isConceptIndex: + //Concept Index + beginRTFChapter(); + break; case isClassHierarchyIndex: //Hierarchical Index - DBG_RTF(t << "{\\comment start classhierarchy}\n") + DBG_RTF(m_t << "{\\comment start classhierarchy}\n") beginRTFChapter(); break; case isCompoundIndex: @@ -503,6 +507,19 @@ void RTFGenerator::startIndexSection(IndexSections is) } } break; + case isConceptDocumentation: + { + // Concept Documentation + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + if (cd->isLinkableInProject()) + { + beginRTFChapter(); + break; + } + } + } + break; case isClassDocumentation: { //Compound Documentation @@ -559,7 +576,7 @@ void RTFGenerator::startIndexSection(IndexSections is) break; case isPageDocumentation2: { - t << "{\\tc \\v "; + m_t << "{\\tc \\v "; } break; case isEndIndex: @@ -577,177 +594,187 @@ void RTFGenerator::endIndexSection(IndexSections is) switch (is) { case isTitlePageStart: - if (rtf_title) + if (!rtf_title.isEmpty()) // User has overridden document title in extensions file - t << "}" << rtf_title; + m_t << "}" << rtf_title; else - t << "}" << projectName; + m_t << "}" << projectName; break; case isTitlePageAuthor: { - t << " doxygen" << getDoxygenVersion() << ".}\n"; - t << "{\\creatim " << dateToRTFDateString() << "}\n}"; - DBG_RTF(t << "{\\comment end of infoblock}\n"); + m_t << " doxygen" << getDoxygenVersion() << ".}\n"; + m_t << "{\\creatim " << dateToRTFDateString() << "}\n}"; + DBG_RTF(m_t << "{\\comment end of infoblock}\n"); // setup for this section - t << rtf_Style_Reset <<"\n"; - t <<"\\sectd\\pgnlcrm\n"; - t <<"{\\footer "<<rtf_Style["Footer"].reference() << "{\\chpgn}}\n"; + m_t << rtf_Style_Reset <<"\n"; + m_t << "\\sectd\\pgnlcrm\n"; + m_t << "{\\footer "<<rtf_Style["Footer"].reference() << "{\\chpgn}}\n"; // the title entry - DBG_RTF(t << "{\\comment begin title page}\n") + DBG_RTF(m_t << "{\\comment begin title page}\n") - t << rtf_Style_Reset << rtf_Style["SubTitle"].reference() << "\n"; // set to title style + m_t << rtf_Style_Reset << rtf_Style["SubTitle"].reference() << "\n"; // set to title style - t << "\\vertalc\\qc\\par\\par\\par\\par\\par\\par\\par\n"; - if (rtf_logoFilename) + m_t << "\\vertalc\\qc\\par\\par\\par\\par\\par\\par\\par\n"; + if (!rtf_logoFilename.isEmpty()) { - t << "{\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"" << rtf_logoFilename; - t << "\" \\\\d \\\\*MERGEFORMAT} {\\fldrslt IMAGE }}\\par\\par\n"; + m_t << "{\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"" << rtf_logoFilename; + m_t << "\" \\\\d \\\\*MERGEFORMAT} {\\fldrslt IMAGE }}\\par\\par\n"; } - if (rtf_company) + if (!rtf_company.isEmpty()) { - t << rtf_company << "\\par\\par\n"; + m_t << rtf_company << "\\par\\par\n"; } - t << rtf_Style_Reset << rtf_Style["Title"].reference() << "\n"; // set to title style - if (rtf_title) + m_t << rtf_Style_Reset << rtf_Style["Title"].reference() << "\n"; // set to title style + if (!rtf_title.isEmpty()) + { // User has overridden document title in extensions file - t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt " << rtf_title << "}}\\par\n"; + m_t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt " << rtf_title << "}}\\par\n"; + } else { DocText *root = validatingParseText(projectName); - t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt "; + m_t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt "; writeDoc(root,0,0,0); - t << "}}\\par\n"; - + m_t << "}}\\par\n"; } - t << rtf_Style_Reset << rtf_Style["SubTitle"].reference() << "\n"; // set to title style - t << "\\par\n"; - if (rtf_documentType) + m_t << rtf_Style_Reset << rtf_Style["SubTitle"].reference() << "\n"; // set to title style + m_t << "\\par\n"; + if (!rtf_documentType.isEmpty()) { - t << rtf_documentType << "\\par\n"; + m_t << rtf_documentType << "\\par\n"; } - if (rtf_documentId) + if (!rtf_documentId.isEmpty()) { - t << rtf_documentId << "\\par\n"; + m_t << rtf_documentId << "\\par\n"; } - t << "\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\n"; + m_t << "\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\n"; - t << rtf_Style_Reset << rtf_Style["SubTitle"].reference() << "\n"; // set to subtitle style - if (rtf_author) - t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt "<< rtf_author << " }}\\par\n"; + m_t << rtf_Style_Reset << rtf_Style["SubTitle"].reference() << "\n"; // set to subtitle style + if (!rtf_author.isEmpty()) + { + m_t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt "<< rtf_author << " }}\\par\n"; + } else - t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt AUTHOR}}\\par\n"; + { + m_t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt AUTHOR}}\\par\n"; + } - t << theTranslator->trVersion() << " " << Config_getString(PROJECT_NUMBER) << "\\par"; - t << "{\\field\\fldedit {\\*\\fldinst CREATEDATE \\\\*MERGEFORMAT}" + m_t << theTranslator->trVersion() << " " << Config_getString(PROJECT_NUMBER) << "\\par"; + m_t << "{\\field\\fldedit {\\*\\fldinst CREATEDATE \\\\*MERGEFORMAT}" "{\\fldrslt "<< dateToString(FALSE) << " }}\\par\n"; - t << "\\page\\page"; - DBG_RTF(t << "{\\comment End title page}\n") + m_t << "\\page\\page"; + DBG_RTF(m_t << "{\\comment End title page}\n") // table of contents section - DBG_RTF(t << "{\\comment Table of contents}\n") - t << "\\vertalt\n"; - t << rtf_Style_Reset << "\n"; - t << rtf_Style["Heading1"].reference(); - t << theTranslator->trRTFTableOfContents() << "\\par\n"; - t << rtf_Style_Reset << "\\par\n"; - t << "{\\field\\fldedit {\\*\\fldinst TOC \\\\f \\\\*MERGEFORMAT}{\\fldrslt Table of contents}}\\par\n"; - t << rtf_Style_Reset << "\n"; + DBG_RTF(m_t << "{\\comment Table of contents}\n") + m_t << "\\vertalt\n"; + m_t << rtf_Style_Reset << "\n"; + m_t << rtf_Style["Heading1"].reference(); + m_t << theTranslator->trRTFTableOfContents() << "\\par\n"; + m_t << rtf_Style_Reset << "\\par\n"; + m_t << "{\\field\\fldedit {\\*\\fldinst TOC \\\\f \\\\*MERGEFORMAT}{\\fldrslt Table of contents}}\\par\n"; + m_t << rtf_Style_Reset << "\n"; } break; case isMainPage: - t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; if (!mainPageHasTitle()) { - t << "{\\tc \\v " << theTranslator->trMainPage() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trMainPage() << "}\n"; } else { - t << "{\\tc \\v " << substitute(Doxygen::mainPage->title(),"%","") << "}\n"; + m_t << "{\\tc \\v " << substitute(Doxygen::mainPage->title(),"%","") << "}\n"; } - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; - //if (Config_getBool(GENERATE_TREEVIEW)) t << "main"; else t << "index"; - t << "index"; - t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; + //if (Config_getBool(GENERATE_TREEVIEW)) m_t << "main"; else m_t << "index"; + m_t << "index"; + m_t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; //case isPackageIndex: - // t << "\\par " << rtf_Style_Reset << "\n"; - // t << "{\\tc \\v " << theTranslator->trPackageList() << "}\n"; - // t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"packages.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + // m_t << "\\par " << rtf_Style_Reset << "\n"; + // m_t << "{\\tc \\v " << theTranslator->trPackageList() << "}\n"; + // m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"packages.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; // break; case isModuleIndex: - t << "\\par " << rtf_Style_Reset << "\n"; - t << "{\\tc \\v " << theTranslator->trModuleIndex() << "}\n"; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"modules.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "{\\tc \\v " << theTranslator->trModuleIndex() << "}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"modules.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isDirIndex: - t << "\\par " << rtf_Style_Reset << "\n"; - t << "{\\tc \\v " << theTranslator->trDirIndex() << "}\n"; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"dirs.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "{\\tc \\v " << theTranslator->trDirIndex() << "}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"dirs.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isNamespaceIndex: - t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; if (fortranOpt) { - t << "{\\tc \\v " << theTranslator->trModulesIndex() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trModulesIndex() << "}\n"; } else { - t << "{\\tc \\v " << theTranslator->trNamespaceIndex() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trNamespaceIndex() << "}\n"; } - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"namespaces.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"namespaces.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + break; + case isConceptIndex: + m_t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "{\\tc \\v " << theTranslator->trConceptIndex() << "}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"concepts.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isClassHierarchyIndex: - t << "\\par " << rtf_Style_Reset << "\n"; - t << "{\\tc \\v " << theTranslator->trHierarchicalIndex() << "}\n"; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"hierarchy.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "{\\tc \\v " << theTranslator->trHierarchicalIndex() << "}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"hierarchy.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isCompoundIndex: - t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; if (fortranOpt) { - t << "{\\tc \\v " << theTranslator->trCompoundIndexFortran() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trCompoundIndexFortran() << "}\n"; } else if (vhdlOpt) { - t << "{\\tc \\v " << theTranslator->trDesignUnitIndex() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trDesignUnitIndex() << "}\n"; } else { - t << "{\\tc \\v " << theTranslator->trCompoundIndex() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trCompoundIndex() << "}\n"; } - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"annotated.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"annotated.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isFileIndex: - t << "\\par " << rtf_Style_Reset << "\n"; - t << "{\\tc \\v " << theTranslator->trFileIndex() << "}\n"; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"files.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "{\\tc \\v " << theTranslator->trFileIndex() << "}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"files.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isPageIndex: - t << "\\par " << rtf_Style_Reset << "\n"; - t << "{\\tc \\v " << theTranslator->trPageIndex() << "}\n"; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"pages.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "{\\tc \\v " << theTranslator->trPageIndex() << "}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"pages.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isModuleDocumentation: { bool first=true; - t << "{\\tc \\v " << theTranslator->trModuleDocumentation() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trModuleDocumentation() << "}\n"; for (const auto &gd : *Doxygen::groupLinkedMap) { if (!gd->isReference()) { - t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; if (!first) { beginRTFSection(); } first=false; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; - t << gd->getOutputFileBase(); - t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; + m_t << gd->getOutputFileBase(); + m_t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; } } } @@ -755,20 +782,20 @@ void RTFGenerator::endIndexSection(IndexSections is) case isDirDocumentation: { bool first=true; - t << "{\\tc \\v " << theTranslator->trDirDocumentation() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trDirDocumentation() << "}\n"; for (const auto &dd : *Doxygen::dirLinkedMap) { if (dd->isLinkableInProject()) { - t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; if (!first) { beginRTFSection(); } first=false; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; - t << dd->getOutputFileBase(); - t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; + m_t << dd->getOutputFileBase(); + m_t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; } } } @@ -780,15 +807,35 @@ void RTFGenerator::endIndexSection(IndexSections is) { if (nd->isLinkableInProject() && !nd->isAlias()) { - t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; if (!first) { beginRTFSection(); } first=false; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; - t << nd->getOutputFileBase(); - t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; + m_t << nd->getOutputFileBase(); + m_t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + } + } + } + break; + case isConceptDocumentation: + { + bool first=true; + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + if (cd->isLinkableInProject() && !cd->isAlias()) + { + m_t << "\\par " << rtf_Style_Reset << "\n"; + if (!first) + { + beginRTFSection(); + } + first=false; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; + m_t << cd->getOutputFileBase(); + m_t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; } } } @@ -798,11 +845,11 @@ void RTFGenerator::endIndexSection(IndexSections is) bool first=true; if (fortranOpt) { - t << "{\\tc \\v " << theTranslator->trTypeDocumentation() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trTypeDocumentation() << "}\n"; } else { - t << "{\\tc \\v " << theTranslator->trClassDocumentation() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trClassDocumentation() << "}\n"; } for (const auto &cd : *Doxygen::classLinkedMap) { @@ -812,15 +859,15 @@ void RTFGenerator::endIndexSection(IndexSections is) !cd->isAlias() ) { - t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; if (!first) { beginRTFSection(); } first=false; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; - t << cd->getOutputFileBase(); - t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; + m_t << cd->getOutputFileBase(); + m_t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; } } } @@ -829,26 +876,26 @@ void RTFGenerator::endIndexSection(IndexSections is) { bool isFirst=TRUE; - t << "{\\tc \\v " << theTranslator->trFileDocumentation() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trFileDocumentation() << "}\n"; for (const auto &fn : *Doxygen::inputNameLinkedMap) { for (const auto &fd : *fn) { if (fd->isLinkableInProject()) { - t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; if (!isFirst) { beginRTFSection(); } isFirst=FALSE; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; - t << fd->getOutputFileBase(); - t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; + m_t << fd->getOutputFileBase(); + m_t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; if (sourceBrowser && m_prettyCode && fd->generateSourceFile()) { - t << "\\par " << rtf_Style_Reset << "\n"; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"" << fd->getSourceFileBase() << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"" << fd->getSourceFileBase() << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; } } } @@ -857,37 +904,37 @@ void RTFGenerator::endIndexSection(IndexSections is) break; case isExampleDocumentation: { - //t << "}\n"; + //m_t << "}\n"; bool isFirst=true; - t << "{\\tc \\v " << theTranslator->trExampleDocumentation() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trExampleDocumentation() << "}\n"; for (const auto &pd : *Doxygen::exampleLinkedMap) { - t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; if (!isFirst) { beginRTFSection(); } isFirst=false; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; - t << pd->getOutputFileBase(); - t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; + m_t << pd->getOutputFileBase(); + m_t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; } } break; case isPageDocumentation: { //#error "fix me in the same way as the latex index..." - //t << "{\\tc \\v " << theTranslator->trPageDocumentation() << "}\n"; - //t << "}\n"; + //m_t << "{\\tc \\v " << theTranslator->trPageDocumentation() << "}\n"; + //m_t << "}\n"; //bool first=TRUE; //for (const auto *pd : Doxygen::pageLinkedMap) //{ // if (!pd->getGroupDef() && !pd->isReference()) // { - // if (first) t << "\\par " << rtf_Style_Reset << "\n"; - // t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; - // t << pd->getOutputFileBase(); - // t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + // if (first) m_t << "\\par " << rtf_Style_Reset << "\n"; + // m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; + // m_t << pd->getOutputFileBase(); + // m_t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; // first=FALSE; // } //} @@ -895,39 +942,39 @@ void RTFGenerator::endIndexSection(IndexSections is) break; case isPageDocumentation2: { - t << "}"; - t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "}"; + m_t << "\\par " << rtf_Style_Reset << "\n"; } break; case isEndIndex: beginRTFChapter(); - t << rtf_Style["Heading1"].reference(); - t << theTranslator->trRTFGeneralIndex() << "\\par \n"; - t << rtf_Style_Reset << "\n"; - t << "{\\tc \\v " << theTranslator->trRTFGeneralIndex() << "}\n"; - t << "{\\field\\fldedit {\\*\\fldinst INDEX \\\\c2 \\\\*MERGEFORMAT}{\\fldrslt INDEX}}\n"; + m_t << rtf_Style["Heading1"].reference(); + m_t << theTranslator->trRTFGeneralIndex() << "\\par \n"; + m_t << rtf_Style_Reset << "\n"; + m_t << "{\\tc \\v " << theTranslator->trRTFGeneralIndex() << "}\n"; + m_t << "{\\field\\fldedit {\\*\\fldinst INDEX \\\\c2 \\\\*MERGEFORMAT}{\\fldrslt INDEX}}\n"; break; } } -void RTFGenerator::writePageLink(const char *name,bool first) +void RTFGenerator::writePageLink(const QCString &name,bool first) { - if (first) t << "\\par " << rtf_Style_Reset << "\n"; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; - t << name; - t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + if (first) m_t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; + m_t << name; + m_t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; } void RTFGenerator::lastIndexPage() { - DBG_RTF(t <<"{\\comment Beginning Body of RTF Document}\n") + DBG_RTF(m_t << "{\\comment Beginning Body of RTF Document}\n") // end page and setup for rest of document - t <<"\\sect \\sbkpage \\pgndec \\pgnrestart\n"; - t <<"\\sect \\sectd \\sbknone\n"; + m_t << "\\sect \\sbkpage \\pgndec \\pgnrestart\n"; + m_t << "\\sect \\sectd \\sbknone\n"; // set new footer with arabic numbers - t <<"{\\footer "<< rtf_Style["Footer"].reference() << "{\\chpgn}}\n"; + m_t << "{\\footer "<< rtf_Style["Footer"].reference() << "{\\chpgn}}\n"; } @@ -935,37 +982,37 @@ void RTFGenerator::writeStyleInfo(int) { } -void RTFGenerator::lineBreak(const char *) +void RTFGenerator::lineBreak(const QCString &) { - DBG_RTF(t << "{\\comment (lineBreak)}" << "\n") - t << "\\par\n"; + DBG_RTF(m_t << "{\\comment (lineBreak)}" << "\n") + m_t << "\\par\n"; m_omitParagraph = TRUE; } -void RTFGenerator::writeString(const char *text) +void RTFGenerator::writeString(const QCString &text) { - t << text; + m_t << text; } void RTFGenerator::startIndexList() { - DBG_RTF(t << "{\\comment (startIndexList)}\n") - t << "{\n"; - t << "\\par\n"; + DBG_RTF(m_t << "{\\comment (startIndexList)}\n") + m_t << "{\n"; + m_t << "\\par\n"; incrementIndentLevel(); - t << rtf_Style_Reset << rtf_LCList_DepthStyle() << "\n"; + m_t << rtf_Style_Reset << rtf_LCList_DepthStyle() << "\n"; m_omitParagraph = TRUE; } void RTFGenerator::endIndexList() { - DBG_RTF(t << "{\\comment (endIndexList)}\n") + DBG_RTF(m_t << "{\\comment (endIndexList)}\n") if (!m_omitParagraph) { - t << "\\par"; + m_t << "\\par"; m_omitParagraph = TRUE; } - t << "}"; + m_t << "}"; decrementIndentLevel(); } @@ -973,8 +1020,8 @@ void RTFGenerator::endIndexList() void RTFGenerator::startItemList() { newParagraph(); - DBG_RTF(t << "{\\comment (startItemList level=" << m_listLevel << ") }\n") - t << "{"; + DBG_RTF(m_t << "{\\comment (startItemList level=" << m_listLevel << ") }\n") + m_t << "{"; incrementIndentLevel(); rtf_listItemInfo[m_listLevel].isEnum = FALSE; } @@ -983,8 +1030,8 @@ void RTFGenerator::startItemList() void RTFGenerator::endItemList() { newParagraph(); - DBG_RTF(t << "{\\comment (endItemList level=" << m_listLevel << ")}\n") - t << "}"; + DBG_RTF(m_t << "{\\comment (endItemList level=" << m_listLevel << ")}\n") + m_t << "}"; decrementIndentLevel(); m_omitParagraph = TRUE; } @@ -992,8 +1039,8 @@ void RTFGenerator::endItemList() ///*! start enumeration list */ //void RTFGenerator::startEnumList() // starts an enumeration list //{ -// DBG_RTF(t << "{\\comment (startEnumList)}\n") -// t << "{\n"; +// DBG_RTF(m_t << "{\\comment (startEnumList)}\n") +// m_t << "{\n"; // incrementIndentLevel(); // rtf_listItemInfo[m_listLevel].isEnum = TRUE; // rtf_listItemInfo[m_listLevel].number = 1; @@ -1003,8 +1050,8 @@ void RTFGenerator::endItemList() //void RTFGenerator::endEnumList() //{ // newParagraph(); -// DBG_RTF(t << "{\\comment (endEnumList)}\n") -// t << "}"; +// DBG_RTF(m_t << "{\\comment (endEnumList)}\n") +// m_t << "}"; // decrementIndentLevel(); // m_omitParagraph = TRUE; //} @@ -1012,70 +1059,70 @@ void RTFGenerator::endItemList() /*! write bullet or enum item */ void RTFGenerator::startItemListItem() { - DBG_RTF(t << "{\\comment (startItemListItem)}\n") + DBG_RTF(m_t << "{\\comment (startItemListItem)}\n") newParagraph(); - t << rtf_Style_Reset; + m_t << rtf_Style_Reset; if (rtf_listItemInfo[m_listLevel].isEnum) { - t << rtf_EList_DepthStyle() << "\n"; - t << rtf_listItemInfo[m_listLevel].number << ".\\tab "; + m_t << rtf_EList_DepthStyle() << "\n"; + m_t << rtf_listItemInfo[m_listLevel].number << ".\\tab "; rtf_listItemInfo[m_listLevel].number++; } else { - t << rtf_BList_DepthStyle() << "\n"; + m_t << rtf_BList_DepthStyle() << "\n"; } m_omitParagraph = TRUE; } void RTFGenerator::endItemListItem() { - DBG_RTF(t << "{\\comment (endItemListItem)}\n") + DBG_RTF(m_t << "{\\comment (endItemListItem)}\n") } -void RTFGenerator::startIndexItem(const char *,const char *) +void RTFGenerator::startIndexItem(const QCString &,const QCString &) { - DBG_RTF(t << "{\\comment (startIndexItem)}\n") + DBG_RTF(m_t << "{\\comment (startIndexItem)}\n") if (!m_omitParagraph) { - t << "\\par\n"; + m_t << "\\par\n"; m_omitParagraph = TRUE; } } -void RTFGenerator::endIndexItem(const char *ref,const char *fn) +void RTFGenerator::endIndexItem(const QCString &ref,const QCString &fn) { - DBG_RTF(t << "{\\comment (endIndexItem)}\n") - if (!ref && fn) + DBG_RTF(m_t << "{\\comment (endIndexItem)}\n") + if (ref.isEmpty() && !fn.isEmpty()) { - t << "\\tab "; + m_t << "\\tab "; writeRTFReference(fn); - t << "\n"; + m_t << "\n"; } else { - t << "\n"; + m_t << "\n"; } m_omitParagraph = TRUE; } -//void RTFGenerator::writeIndexFileItem(const char *,const char *text) +//void RTFGenerator::writeIndexFileItem(const QCString &,const QCString &text) //{ -// t << "\\item\\contentsline{section}{"; +// m_t << "\\item\\contentsline{section}{"; // docify(text); -// t << "}{\\pageref{" << text << "}}\n"; +// m_t << "}{\\pageref{" << texm_t << "}}\n"; //} -void RTFGenerator::startHtmlLink(const char *url) +void RTFGenerator::startHtmlLink(const QCString &url) { if (Config_getBool(RTF_HYPERLINKS)) { - t << "{\\field {\\*\\fldinst { HYPERLINK \""; - t << url; - t << "\" }{}"; - t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; + m_t << "{\\field {\\*\\fldinst { HYPERLINK \""; + m_t << url; + m_t << "\" }{}"; + m_t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; } else { @@ -1087,7 +1134,7 @@ void RTFGenerator::endHtmlLink() { if (Config_getBool(RTF_HYPERLINKS)) { - t << "}}}\n"; + m_t << "}}}\n"; } else { @@ -1095,85 +1142,85 @@ void RTFGenerator::endHtmlLink() } } -//void RTFGenerator::writeMailLink(const char *url) +//void RTFGenerator::writeMailLink(const QCString &url) //{ // startTypewriter(); // docify(url); // endTypewriter(); //} -void RTFGenerator::writeStartAnnoItem(const char *,const char *f, - const char *path,const char *name) +void RTFGenerator::writeStartAnnoItem(const QCString &,const QCString &f, + const QCString &path,const QCString &name) { - DBG_RTF(t << "{\\comment (writeStartAnnoItem)}\n") - t << "{\\b "; - if (path) docify(path); - if (f && Config_getBool(RTF_HYPERLINKS)) + DBG_RTF(m_t << "{\\comment (writeStartAnnoItem)}\n") + m_t << "{\\b "; + if (!path.isEmpty()) docify(path); + if (!f.isEmpty() && Config_getBool(RTF_HYPERLINKS)) { - t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; - t << rtfFormatBmkStr(f); - t << "\" }{}"; - t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; + m_t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; + m_t << rtfFormatBmkStr(f); + m_t << "\" }{}"; + m_t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; docify(name); - t << "}}}\n"; + m_t << "}}}\n"; } else { docify(name); } - t << "} "; + m_t << "} "; } -void RTFGenerator::writeEndAnnoItem(const char *name) +void RTFGenerator::writeEndAnnoItem(const QCString &name) { - DBG_RTF(t << "{\\comment (writeEndAnnoItem)}\n") - if (name) + DBG_RTF(m_t << "{\\comment (writeEndAnnoItem)}\n") + if (!name.isEmpty()) { - t << "\\tab "; + m_t << "\\tab "; writeRTFReference(name); - t << "\n"; + m_t << "\n"; } else { - t << "\n"; + m_t << "\n"; } newParagraph(); } void RTFGenerator::startIndexKey() { - DBG_RTF(t << "{\\comment (startIndexKey)}\n") - t << "{\\b "; + DBG_RTF(m_t << "{\\comment (startIndexKey)}\n") + m_t << "{\\b "; } void RTFGenerator::endIndexKey() { - DBG_RTF(t << "{\\comment (endIndexKey)}\n") + DBG_RTF(m_t << "{\\comment (endIndexKey)}\n") } void RTFGenerator::startIndexValue(bool hasBrief) { - DBG_RTF(t << "{\\comment (startIndexValue)}\n") - t << " "; - if (hasBrief) t << "("; + DBG_RTF(m_t << "{\\comment (startIndexValue)}\n") + m_t << " "; + if (hasBrief) m_t << "("; } -void RTFGenerator::endIndexValue(const char *name,bool hasBrief) +void RTFGenerator::endIndexValue(const QCString &name,bool hasBrief) { - DBG_RTF(t << "{\\comment (endIndexValue)}\n") - if (hasBrief) t << ")"; - t << "} "; - if (name) + DBG_RTF(m_t << "{\\comment (endIndexValue)}\n") + if (hasBrief) m_t << ")"; + m_t << "} "; + if (!name.isEmpty()) { - t << "\\tab "; + m_t << "\\tab "; writeRTFReference(name); - t << "\n"; + m_t << "\n"; } else { - t << "\n"; + m_t << "\n"; } m_omitParagraph=FALSE; newParagraph(); @@ -1182,128 +1229,128 @@ void RTFGenerator::endIndexValue(const char *name,bool hasBrief) void RTFGenerator::startSubsection() { //beginRTFSubSection(); - t <<"\n"; - DBG_RTF(t << "{\\comment Begin SubSection}\n") - t << rtf_Style_Reset; - t << rtf_Style["Heading3"].reference() << "\n"; + m_t << "\n"; + DBG_RTF(m_t << "{\\comment Begin SubSection}\n") + m_t << rtf_Style_Reset; + m_t << rtf_Style["Heading3"].reference() << "\n"; } void RTFGenerator::endSubsection() { newParagraph(); - t << rtf_Style_Reset << "\n"; + m_t << rtf_Style_Reset << "\n"; } void RTFGenerator::startSubsubsection() { //beginRTFSubSubSection(); - t << "\n"; - DBG_RTF(t << "{\\comment Begin SubSubSection}\n") - t << "{\n"; - t << rtf_Style_Reset << rtf_Style["Heading4"].reference() << "\n"; + m_t << "\n"; + DBG_RTF(m_t << "{\\comment Begin SubSubSection}\n") + m_t << "{\n"; + m_t << rtf_Style_Reset << rtf_Style["Heading4"].reference() << "\n"; } void RTFGenerator::endSubsubsection() { newParagraph(); - t << "}\n"; + m_t << "}\n"; } -//void RTFGenerator::writeClassLink(const char *,const char *, -// const char *,const char *name) +//void RTFGenerator::writeClassLink(const QCString &,const QCString &, +// const QCString &,const QCString &name) //{ -// t << "{\\bf "; +// m_t << "{\\bf "; // docify(name); -// t << "}"; +// m_t << "}"; //} //void RTFGenerator::startTable(bool,int colNumbers) //{ -// DBG_RTF(t << "{\\comment startTable}\n";) +// DBG_RTF(m_t << "{\\comment startTable}\n";) // m_numCols=colNumbers; -// t << "\\par\n"; +// m_t << "\\par\n"; //} // //void RTFGenerator::endTable(bool hasCaption) //{ -// DBG_RTF(t << "{\\comment endTable}\n";) +// DBG_RTF(m_t << "{\\comment endTable}\n";) // if (!hasCaption) -// t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; -// t << "\\pard\n\n"; +// m_t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; +// m_t << "\\pard\n\n"; //} // //void RTFGenerator::startCaption() //{ -// DBG_RTF(t << "{\\comment startCaption}\n";) +// DBG_RTF(m_t << "{\\comment startCaption}\n";) // endTableRow(); -// t << "\\trowd \\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 \\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 \\trbrdrr\\brdrs\\brdrw10 \\trbrdrh\\brdrs\\brdrw10 \\trbrdrv\\brdrs\\brdrw10\n"; -// t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 \\clbrdrb\\brdrs\\brdrw10 \\clbrdrr \\brdrs\\brdrw10 \\cltxlrtb \\cellx"<<rtf_pageWidth<<"\\pard \\qc\\nowidctlpar\\widctlpar\\intbl\\adjustright \n"; +// m_t << "\\trowd \\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 \\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 \\trbrdrr\\brdrs\\brdrw10 \\trbrdrh\\brdrs\\brdrw10 \\trbrdrv\\brdrs\\brdrw10\n"; +// m_t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 \\clbrdrb\\brdrs\\brdrw10 \\clbrdrr \\brdrs\\brdrw10 \\cltxlrtb \\cellx"<<rtf_pageWidth<<"\\pard \\qc\\nowidctlpar\\widctlpar\\intbl\\adjustright \n"; // nextTableColumn(); //} // //void RTFGenerator::endCaption() //{ -// DBG_RTF(t << "{\\comment endCaption}\n";) +// DBG_RTF(m_t << "{\\comment endCaption}\n";) // endTableColumn(); // endTableRow(); //} // //void RTFGenerator::nextTableRow() //{ -// DBG_RTF(t << "{\\comment nextTableRow}\n";) +// DBG_RTF(m_t << "{\\comment nextTableRow}\n";) // ASSERT(m_numCols>0 && m_numCols<25); // uint columnWidth=rtf_pageWidth/m_numCols; -// t << "\\trowd \\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 " +// m_t << "\\trowd \\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 " // "\\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 " // "\\trbrdrr\\brdrs\\brdrw10 \\trbrdrh\\brdrs\\brdrw10 " // "\\trbrdrv\\brdrs\\brdrw10 \n"; // for (int i=0;i<m_numCols;i++) // { -// t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 " +// m_t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 " // "\\clbrdrb\\brdrs\\brdrw10 \\clbrdrr \\brdrs\\brdrw10 \\cltxlrtb " // "\\cellx" << (i*columnWidth) << "\n"; // } -// t << "\\pard \\widctlpar\\intbl\\adjustright\n{"; +// m_t << "\\pard \\widctlpar\\intbl\\adjustright\n{"; //} // //void RTFGenerator::endTableRow() //{ -// DBG_RTF(t << "{\\comment endTableRow}\n";) -// t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; +// DBG_RTF(m_t << "{\\comment endTableRow}\n";) +// m_t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; //} // //void RTFGenerator::nextTableColumn() //{ -// DBG_RTF(t << "{\\comment nextTableColumn}\n";) -// t << "{ "; +// DBG_RTF(m_t << "{\\comment nextTableColumn}\n";) +// m_t << "{ "; //} // //void RTFGenerator::endTableColumn() //{ -// DBG_RTF(t << "{\\comment endTableColumn}\n";) -// t << " \\cell }"; +// DBG_RTF(m_t << "{\\comment endTableColumn}\n";) +// m_t << " \\cell }"; //} // -void RTFGenerator::startTextLink(const char *f,const char *anchor) +void RTFGenerator::startTextLink(const QCString &f,const QCString &anchor) { if (Config_getBool(RTF_HYPERLINKS)) { QCString ref; - if (f) + if (!f.isEmpty()) { ref+=f; } - if (anchor) + if (!anchor.isEmpty()) { ref+='_'; ref+=anchor; } - t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; - t << rtfFormatBmkStr(ref); - t << "\" }{}"; - t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; + m_t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; + m_t << rtfFormatBmkStr(ref); + m_t << "\" }{}"; + m_t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; } } @@ -1311,34 +1358,34 @@ void RTFGenerator::endTextLink() { if (Config_getBool(RTF_HYPERLINKS)) { - t << "}}}\n"; + m_t << "}}}\n"; } } -void RTFGenerator::writeObjectLink(const char *ref, const char *f, - const char *anchor, const char *text) +void RTFGenerator::writeObjectLink(const QCString &ref, const QCString &f, + const QCString &anchor, const QCString &text) { - if (!ref && Config_getBool(RTF_HYPERLINKS)) + if (ref.isEmpty() && Config_getBool(RTF_HYPERLINKS)) { QCString refName; - if (f) + if (!f.isEmpty()) { refName+=f; } - if (anchor) + if (!anchor.isEmpty()) { refName+='_'; refName+=anchor; } - t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; - t << rtfFormatBmkStr(refName); - t << "\" }{}"; - t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; + m_t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; + m_t << rtfFormatBmkStr(refName); + m_t << "\" }{}"; + m_t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; docify(text); - t << "}}}\n"; + m_t << "}}}\n"; } else { @@ -1350,52 +1397,52 @@ void RTFGenerator::writeObjectLink(const char *ref, const char *f, void RTFGenerator::startPageRef() { - t << " ("; + m_t << " ("; startEmphasis(); } -void RTFGenerator::endPageRef(const char *clname, const char *anchor) +void RTFGenerator::endPageRef(const QCString &clname, const QCString &anchor) { QCString ref; - if (clname) + if (!clname.isEmpty()) { ref+=clname; } - if (anchor) + if (!anchor.isEmpty()) { ref+='_'; ref+=anchor; } writeRTFReference(ref); endEmphasis(); - t << ")"; + m_t << ")"; } -void RTFGenerator::writeCodeLink(const char *ref,const char *f, - const char *anchor,const char *name, - const char *) +void RTFGenerator::writeCodeLink(const QCString &ref,const QCString &f, + const QCString &anchor,const QCString &name, + const QCString &) { - if (!ref && Config_getBool(RTF_HYPERLINKS)) + if (ref.isEmpty() && Config_getBool(RTF_HYPERLINKS)) { QCString refName; - if (f) + if (!f.isEmpty()) { refName+=f; } - if (anchor) + if (!anchor.isEmpty()) { refName+='_'; refName+=anchor; } - t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; - t << rtfFormatBmkStr(refName); - t << "\" }{}"; - t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; + m_t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; + m_t << rtfFormatBmkStr(refName); + m_t << "\" }{}"; + m_t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; codify(name); - t << "}}}\n"; + m_t << "}}}\n"; } else { @@ -1403,27 +1450,27 @@ void RTFGenerator::writeCodeLink(const char *ref,const char *f, } } -void RTFGenerator::startTitleHead(const char *) +void RTFGenerator::startTitleHead(const QCString &) { - DBG_RTF(t <<"{\\comment startTitleHead}\n") + DBG_RTF(m_t << "{\\comment startTitleHead}\n") // beginRTFSection(); - t << rtf_Style_Reset << rtf_Style["Heading2"].reference() << "\n"; + m_t << rtf_Style_Reset << rtf_Style["Heading2"].reference() << "\n"; } -void RTFGenerator::endTitleHead(const char *fileName,const char *name) +void RTFGenerator::endTitleHead(const QCString &fileName,const QCString &name) { - DBG_RTF(t <<"{\\comment endTitleHead}\n") - t << "\\par " << rtf_Style_Reset << "\n"; - if (name) + DBG_RTF(m_t << "{\\comment endTitleHead}\n") + m_t << "\\par " << rtf_Style_Reset << "\n"; + if (!name.isEmpty()) { // make table of contents entry - t << "{\\tc\\tcl2 \\v "; + m_t << "{\\tc\\tcl2 \\v "; docify(name); - t << "}\n"; + m_t << "}\n"; // make an index entry - addIndexItem(name,0); + addIndexItem(name,QCString()); //if (name) //{ @@ -1432,14 +1479,14 @@ void RTFGenerator::endTitleHead(const char *fileName,const char *name) // //if (Config_getBool(RTF_HYPERLINKS) && fileName) //{ - writeAnchor(fileName,0); + writeAnchor(fileName,QCString()); //} } } void RTFGenerator::startTitle() { - DBG_RTF(t <<"{\\comment startTitle}\n") + DBG_RTF(m_t << "{\\comment startTitle}\n") if (Config_getBool(COMPACT_RTF)) beginRTFSection(); else @@ -1448,222 +1495,222 @@ void RTFGenerator::startTitle() void RTFGenerator::startGroupHeader(int extraIndent) { - DBG_RTF(t <<"{\\comment startGroupHeader}\n") + DBG_RTF(m_t << "{\\comment startGroupHeader}\n") //newParagraph(); - t << rtf_Style_Reset; + m_t << rtf_Style_Reset; if (extraIndent==2) { - t << rtf_Style["Heading5"].reference(); + m_t << rtf_Style["Heading5"].reference(); } else if (extraIndent==1) { - t << rtf_Style["Heading4"].reference(); + m_t << rtf_Style["Heading4"].reference(); } else // extraIndent==0 { - t << rtf_Style["Heading3"].reference(); + m_t << rtf_Style["Heading3"].reference(); } - t << "\n"; + m_t << "\n"; } void RTFGenerator::endGroupHeader(int) { - DBG_RTF(t <<"{\\comment endGroupHeader}\n") - t << "\\par\n"; - t << rtf_Style_Reset << "\n"; + DBG_RTF(m_t << "{\\comment endGroupHeader}\n") + m_t << "\\par\n"; + m_t << rtf_Style_Reset << "\n"; } -void RTFGenerator::startMemberDoc(const char *clname, - const char *memname, - const char *, - const char *, +void RTFGenerator::startMemberDoc(const QCString &clname, + const QCString &memname, + const QCString &, + const QCString &, int, int, bool showInline) { - DBG_RTF(t << "{\\comment startMemberDoc}\n") - if (memname && memname[0]!='@') + DBG_RTF(m_t << "{\\comment startMemberDoc}\n") + if (!memname.isEmpty() && memname[0]!='@') { addIndexItem(memname,clname); addIndexItem(clname,memname); } - t << rtf_Style_Reset << rtf_Style[showInline ? "Heading5" : "Heading4"].reference(); + m_t << rtf_Style_Reset << rtf_Style[showInline ? "Heading5" : "Heading4"].reference(); //styleStack.push(rtf_Style_Heading4); - t << "{\n"; + m_t << "{\n"; //printf("RTFGenerator::startMemberDoc() '%s'\n",rtf_Style["Heading4"].reference()); startBold(); - t << "\n"; + m_t << "\n"; } void RTFGenerator::endMemberDoc(bool) { - DBG_RTF(t << "{\\comment endMemberDoc}\n") - //const char *style = styleStack.pop(); + DBG_RTF(m_t << "{\\comment endMemberDoc}\n") + //const QCString &style = styleStack.pop(); //printf("RTFGenerator::endMemberDoc() '%s'\n",style); //ASSERT(style==rtf_Style["Heading4"].reference()); endBold(); - t << "}\n"; + m_t << "}\n"; newParagraph(); } -void RTFGenerator::startDoxyAnchor(const char *,const char *, - const char *,const char *, - const char * +void RTFGenerator::startDoxyAnchor(const QCString &,const QCString &, + const QCString &,const QCString &, + const QCString & ) { - DBG_RTF(t << "{\\comment startDoxyAnchor}\n") + DBG_RTF(m_t << "{\\comment startDoxyAnchor}\n") } -void RTFGenerator::endDoxyAnchor(const char *fName,const char *anchor) +void RTFGenerator::endDoxyAnchor(const QCString &fName,const QCString &anchor) { QCString ref; - if (fName) + if (!fName.isEmpty()) { ref+=fName; } - if (anchor) + if (!anchor.isEmpty()) { ref+='_'; ref+=anchor; } - DBG_RTF(t << "{\\comment endDoxyAnchor}\n") - t << "{\\bkmkstart "; - t << rtfFormatBmkStr(ref); - t << "}\n"; - t << "{\\bkmkend "; - t << rtfFormatBmkStr(ref); - t << "}\n"; + DBG_RTF(m_t << "{\\comment endDoxyAnchor}\n") + m_t << "{\\bkmkstart "; + m_t << rtfFormatBmkStr(ref); + m_t << "}\n"; + m_t << "{\\bkmkend "; + m_t << rtfFormatBmkStr(ref); + m_t << "}\n"; } -//void RTFGenerator::writeLatexLabel(const char *clName,const char *anchor) +//void RTFGenerator::writeLatexLabel(const QCString &clName,const QCString &anchor) //{ // writeDoxyAnchor(0,clName,anchor,0); //} -void RTFGenerator::addIndexItem(const char *s1,const char *s2) +void RTFGenerator::addIndexItem(const QCString &s1,const QCString &s2) { - if (s1) + if (!s1.isEmpty()) { - t << "{\\xe \\v "; + m_t << "{\\xe \\v "; docify(s1); - if (s2) + if (!s2.isEmpty()) { - t << "\\:"; + m_t << "\\:"; docify(s2); } - t << "}\n"; + m_t << "}\n"; } } void RTFGenerator::startIndent() { incrementIndentLevel(); - DBG_RTF(t << "{\\comment (startIndent) }\n") - t << "{\n"; - t << rtf_Style_Reset << rtf_CList_DepthStyle() << "\n"; + DBG_RTF(m_t << "{\\comment (startIndent) }\n") + m_t << "{\n"; + m_t << rtf_Style_Reset << rtf_CList_DepthStyle() << "\n"; } void RTFGenerator::endIndent() { - t << "}\n"; + m_t << "}\n"; decrementIndentLevel(); } void RTFGenerator::startDescription() { - DBG_RTF(t << "{\\comment (startDescription)}" << "\n") - t << "{\n"; - t << rtf_Style_Reset << rtf_DList_DepthStyle(); + DBG_RTF(m_t << "{\\comment (startDescription)}" << "\n") + m_t << "{\n"; + m_t << rtf_Style_Reset << rtf_DList_DepthStyle(); } void RTFGenerator::endDescription() { - DBG_RTF(t << "{\\comment (endDescription)}" << "\n") + DBG_RTF(m_t << "{\\comment (endDescription)}" << "\n") newParagraph(); - t << "}"; + m_t << "}"; } void RTFGenerator::startDescItem() { newParagraph(); - DBG_RTF(t << "{\\comment (startDescItem)}\n") - t << "{\\b "; + DBG_RTF(m_t << "{\\comment (startDescItem)}\n") + m_t << "{\\b "; } void RTFGenerator::endDescItem() { - DBG_RTF(t << "{\\comment (endDescItem)}\n") - t << "}\n"; + DBG_RTF(m_t << "{\\comment (endDescItem)}\n") + m_t << "}\n"; newParagraph(); } -void RTFGenerator::startMemberDescription(const char *,const char *,bool) +void RTFGenerator::startMemberDescription(const QCString &,const QCString &,bool) { - DBG_RTF(t << "{\\comment (startMemberDescription)}\n") - t << "{\n"; + DBG_RTF(m_t << "{\\comment (startMemberDescription)}\n") + m_t << "{\n"; incrementIndentLevel(); - t << rtf_Style_Reset << rtf_CList_DepthStyle(); + m_t << rtf_Style_Reset << rtf_CList_DepthStyle(); startEmphasis(); } void RTFGenerator::endMemberDescription() { - DBG_RTF(t << "{\\comment (endMemberDescription)}\n") + DBG_RTF(m_t << "{\\comment (endMemberDescription)}\n") endEmphasis(); //newParagraph(); decrementIndentLevel(); - t << "\\par"; - t << "}\n"; + m_t << "\\par"; + m_t << "}\n"; m_omitParagraph = TRUE; } void RTFGenerator::startDescList(SectionTypes) { - DBG_RTF(t << "{\\comment (startDescList)}\n") - t << "{"; // ends at endDescList - t << "{"; // ends at endDescTitle + DBG_RTF(m_t << "{\\comment (startDescList)}\n") + m_t << "{"; // ends at endDescList + m_t << "{"; // ends at endDescTitle startBold(); newParagraph(); } //void RTFGenerator::endDescTitle() //{ -// DBG_RTF(t << "{\\comment (endDescTitle) }\n") +// DBG_RTF(m_t << "{\\comment (endDescTitle) }\n") // endBold(); -// t << "}"; +// m_t << "}"; // newParagraph(); // incrementIndentLevel(); -// t << rtf_Style_Reset << rtf_DList_DepthStyle(); +// m_t << rtf_Style_Reset << rtf_DList_DepthStyle(); //} void RTFGenerator::startDescForItem() { - DBG_RTF(t << "{\\comment (startDescForItem) }\n") + DBG_RTF(m_t << "{\\comment (startDescForItem) }\n") } void RTFGenerator::endDescForItem() { - DBG_RTF(t << "{\\comment (endDescForItem) }\n") + DBG_RTF(m_t << "{\\comment (endDescForItem) }\n") } //void RTFGenerator::endDescList() //{ -// DBG_RTF(t << "{\\comment (endDescList)}\n") +// DBG_RTF(m_t << "{\\comment (endDescList)}\n") // newParagraph(); // decrementIndentLevel(); // m_omitParagraph = TRUE; -// t << "}"; +// m_t << "}"; //} -void RTFGenerator::startSection(const char *,const char *title,SectionType type) +void RTFGenerator::startSection(const QCString &,const QCString &title,SectionType type) { - DBG_RTF(t << "{\\comment (startSection)}\n") - t << "{"; - t<< rtf_Style_Reset; + DBG_RTF(m_t << "{\\comment (startSection)}\n") + m_t << "{"; + m_t << rtf_Style_Reset; int num=4; switch(type) { @@ -1677,25 +1724,25 @@ void RTFGenerator::startSection(const char *,const char *title,SectionType type) QCString heading; heading.sprintf("Heading%d",num); // set style - t << rtf_Style[heading.str()].reference(); + m_t << rtf_Style[heading.str()].reference(); // make table of contents entry - t << "{\\tc\\tcl" << num << " \\v "; + m_t << "{\\tc\\tcl" << num << " \\v "; docify(title); - t << "}\n"; + m_t << "}\n"; } -void RTFGenerator::endSection(const char *lab,SectionType) +void RTFGenerator::endSection(const QCString &lab,SectionType) { - DBG_RTF(t << "{\\comment (endSection)}\n") + DBG_RTF(m_t << "{\\comment (endSection)}\n") // make bookmark m_omitParagraph=FALSE; newParagraph(); - writeAnchor(0,lab); - t << "}"; + writeAnchor(QCString(),lab); + m_t << "}"; } -//void RTFGenerator::writeSectionRef(const char *ref,const char *, -// const char *lab,const char *title) +//void RTFGenerator::writeSectionRef(const QCString &ref,const QCString &, +// const QCString &lab,const QCString &title) //{ // if (ref) // { @@ -1706,24 +1753,24 @@ void RTFGenerator::endSection(const char *lab,SectionType) // startBold(); // docify(title); // endBold(); -// t << " ("; +// m_t << " ("; // docify(theTranslator->trPageAbbreviation()); // writeRTFReference(lab); -// t << ")\n"; +// m_t << ")\n"; // } //} // -//void RTFGenerator::writeSectionRefItem(const char *,const char *lab, -// const char *title) +//void RTFGenerator::writeSectionRefItem(const QCString &,const QCString &lab, +// const QCString &title) //{ // docify(title); -// t << "\\tab"; +// m_t << "\\tab"; // writeRTFReference(lab); -// t << "\n"; +// m_t << "\n"; //} // -//void RTFGenerator::writeSectionRefAnchor(const char *name,const char *lab, -// const char *title) +//void RTFGenerator::writeSectionRefAnchor(const QCString &name,const QCString &lab, +// const QCString &title) //{ // writeSectionRef(name,lab,title); //} @@ -1736,11 +1783,11 @@ void RTFGenerator::endSection(const char *lab,SectionType) // return s; //} -void RTFGenerator::docify(const char *str) +void RTFGenerator::docify(const QCString &str) { - if (str) + if (!str.isEmpty()) { - const unsigned char *p=(const unsigned char *)str; + const unsigned char *p=(const unsigned char *)str.data(); unsigned char c; //unsigned char pc='\0'; while (*p) @@ -1751,28 +1798,28 @@ void RTFGenerator::docify(const char *str) #if 0 if ( MultiByte ) { - t << getMultiByte( c ); + m_t << getMultiByte( c ); MultiByte = FALSE; continue; } if ( c >= 0x80 ) { MultiByte = TRUE; - t << getMultiByte( c ); + m_t << getMultiByte( c ); continue; } #endif switch (c) { - case '{': t << "\\{"; break; - case '}': t << "\\}"; break; - case '\\': t << "\\\\"; break; + case '{': m_t << "\\{"; break; + case '}': m_t << "\\}"; break; + case '\\': m_t << "\\\\"; break; default: { // see if we can insert an hyphenation hint - //if (isupper(c) && islower(pc) && !insideTabbing) t << "\\-"; - t << (char)c; + //if (isupper(c) && islower(pc) && !insideTabbing) m_t << "\\-"; + m_t << (char)c; } } //pc = c; @@ -1781,14 +1828,14 @@ void RTFGenerator::docify(const char *str) } } -void RTFGenerator::codify(const char *str) +void RTFGenerator::codify(const QCString &str) { // note that RTF does not have a "verbatim", so "\n" means // nothing... add a "newParagraph()"; //static char spaces[]=" "; - if (str) + if (!str.isEmpty()) { - const unsigned char *p=(const unsigned char *)str; + const unsigned char *p=(const unsigned char *)str.data(); unsigned char c; int spacesToNextTabStop; @@ -1801,16 +1848,16 @@ void RTFGenerator::codify(const char *str) switch(c) { case '\t': spacesToNextTabStop = Config_getInt(TAB_SIZE) - (m_col%Config_getInt(TAB_SIZE)); - t << Doxygen::spaces.left(spacesToNextTabStop); + m_t << Doxygen::spaces.left(spacesToNextTabStop); m_col+=spacesToNextTabStop; break; case '\n': newParagraph(); - t << '\n'; m_col=0; + m_t << '\n'; m_col=0; break; - case '{': t << "\\{"; m_col++; break; - case '}': t << "\\}"; m_col++; break; - case '\\': t << "\\\\"; m_col++; break; - default: p=(const unsigned char *)writeUTF8Char(t,(const char *)p-1); m_col++; break; + case '{': m_t << "\\{"; m_col++; break; + case '}': m_t << "\\}"; m_col++; break; + case '\\': m_t << "\\\\"; m_col++; break; + default: p=(const unsigned char *)writeUTF8Char(m_t,(const char *)p-1); m_col++; break; } } } @@ -1826,123 +1873,123 @@ void RTFGenerator::writeChar(char c) void RTFGenerator::startClassDiagram() { - DBG_RTF(t <<"{\\comment startClassDiagram }\n") + DBG_RTF(m_t << "{\\comment startClassDiagram }\n") } void RTFGenerator::endClassDiagram(const ClassDiagram &d, - const char *fileName,const char *) + const QCString &fileName,const QCString &) { newParagraph(); // create a png file - d.writeImage(t,dir(),m_relPath,fileName,FALSE); + d.writeImage(m_t,dir(),m_relPath,fileName,FALSE); // display the file - t << "{\n"; - t << rtf_Style_Reset << "\n"; - t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \""; - t << fileName << ".png\""; - t << " \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; - t << "}\n"; + m_t << "{\n"; + m_t << rtf_Style_Reset << "\n"; + m_t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \""; + m_t << fileName << ".png\""; + m_t << " \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; + m_t << "}\n"; } -//void RTFGenerator::writeFormula(const char *,const char *text) +//void RTFGenerator::writeFormula(const QCString &,const QCString &text) //{ -// t << text; +// m_t << text; //} -void RTFGenerator::startMemberItem(const char *,int,const char *) +void RTFGenerator::startMemberItem(const QCString &,int,const QCString &) { - DBG_RTF(t <<"{\\comment startMemberItem }\n") - t << rtf_Style_Reset << rtf_BList_DepthStyle() << "\n"; // set style to appropriate depth + DBG_RTF(m_t << "{\\comment startMemberItem }\n") + m_t << rtf_Style_Reset << rtf_BList_DepthStyle() << "\n"; // set style to appropriate depth } void RTFGenerator::endMemberItem() { - DBG_RTF(t <<"{\\comment endMemberItem }\n") + DBG_RTF(m_t << "{\\comment endMemberItem }\n") newParagraph(); } -void RTFGenerator::writeAnchor(const char *fileName,const char *name) +void RTFGenerator::writeAnchor(const QCString &fileName,const QCString &name) { QCString anchor; - if (fileName) + if (!fileName.isEmpty()) { anchor+=fileName; } - if (fileName && name) + if (!fileName.isEmpty() && !name.isEmpty()) { anchor+='_'; } - if (name) + if (!name.isEmpty()) { anchor+=name; } - DBG_RTF(t <<"{\\comment writeAnchor (" << anchor << ")}\n") - t << "{\\bkmkstart " << rtfFormatBmkStr(anchor) << "}\n"; - t << "{\\bkmkend " << rtfFormatBmkStr(anchor) << "}\n"; + DBG_RTF(m_t << "{\\comment writeAnchor (" << anchor << ")}\n") + m_t << "{\\bkmkstart " << rtfFormatBmkStr(anchor) << "}\n"; + m_t << "{\\bkmkend " << rtfFormatBmkStr(anchor) << "}\n"; } -void RTFGenerator::writeRTFReference(const char *label) +void RTFGenerator::writeRTFReference(const QCString &label) { - t << "{\\field\\fldedit {\\*\\fldinst PAGEREF "; - t << rtfFormatBmkStr(label); - t << " \\\\*MERGEFORMAT}{\\fldrslt pagenum}}"; + m_t << "{\\field\\fldedit {\\*\\fldinst PAGEREF "; + m_t << rtfFormatBmkStr(label); + m_t << " \\\\*MERGEFORMAT}{\\fldrslt pagenum}}"; } -void RTFGenerator::startCodeFragment(const char *) +void RTFGenerator::startCodeFragment(const QCString &) { - DBG_RTF(t << "{\\comment (startCodeFragment) }\n") - t << "{\n"; - t << rtf_Style_Reset << rtf_Code_DepthStyle(); + DBG_RTF(m_t << "{\\comment (startCodeFragment) }\n") + m_t << "{\n"; + m_t << rtf_Style_Reset << rtf_Code_DepthStyle(); } -void RTFGenerator::endCodeFragment(const char *) +void RTFGenerator::endCodeFragment(const QCString &) { endCodeLine(); - DBG_RTF(t << "{\\comment (endCodeFragment) }\n") - t << "}\n"; + DBG_RTF(m_t << "{\\comment (endCodeFragment) }\n") + m_t << "}\n"; m_omitParagraph = TRUE; } void RTFGenerator::writeNonBreakableSpace(int) { - t << "\\~ "; + m_t << "\\~ "; } void RTFGenerator::startMemberList() { - t << "\n"; - DBG_RTF(t << "{\\comment (startMemberList) }\n") - t << "{\n"; + m_t << "\n"; + DBG_RTF(m_t << "{\\comment (startMemberList) }\n") + m_t << "{\n"; #ifdef DELETEDCODE if (!insideTabbing) - t << "\\begin{CompactItemize}\n"; + m_t << "\\begin{CompactItemize}\n"; #endif } void RTFGenerator::endMemberList() { - DBG_RTF(t << "{\\comment (endMemberList) }\n") - t << "}\n"; + DBG_RTF(m_t << "{\\comment (endMemberList) }\n") + m_t << "}\n"; #ifdef DELETEDCODE if (!insideTabbing) - t << "\\end{CompactItemize}\n"; + m_t << "\\end{CompactItemize}\n"; #endif } -//void RTFGenerator::startImage(const char *name,const char *,bool) +//void RTFGenerator::startImage(const QCString &name,const QCString &,bool) //{ // newParagraph(); -// t << "{\n"; -// t << rtf_Style_Reset << "\n"; -// t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; -// t << name; -// t << " \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; -// t << "}\n"; +// m_t << "{\n"; +// m_t << rtf_Style_Reset << "\n"; +// m_t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; +// m_t << name; +// m_t << " \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; +// m_t << "}\n"; //} // //void RTFGenerator::endImage(bool) @@ -1950,7 +1997,7 @@ void RTFGenerator::endMemberList() // // not yet implemented //} // -//void RTFGenerator::startDotFile(const char *name,bool) +//void RTFGenerator::startDotFile(const QCString &name,bool) //{ // QCString baseName=name; // int i; @@ -1961,12 +2008,12 @@ void RTFGenerator::endMemberList() // QCString outDir = Config_getString(RTF_OUTPUT); // writeDotGraphFromFile(name,outDir,baseName,BITMAP); // newParagraph(); -// t << "{\n"; -// t << rtf_Style_Reset << "\n"; -// t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; -// t << outDir << "\\" << baseName; -// t << " \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; -// t << "}\n"; +// m_t << "{\n"; +// m_t << rtf_Style_Reset << "\n"; +// m_t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE "; +// m_t << outDir << "\\" << baseName; +// m_t << " \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; +// m_t << "}\n"; //} // //void RTFGenerator::endDotFile(bool) @@ -1974,15 +2021,15 @@ void RTFGenerator::endMemberList() // // not yet implemented //} // -void RTFGenerator::startDescTable(const char *title) +void RTFGenerator::startDescTable(const QCString &title) { - DBG_RTF(t << "{\\comment (startDescTable) }\n") - t << "{\\par\n"; - t << "{" << rtf_Style["Heading5"].reference() << "\n"; + DBG_RTF(m_t << "{\\comment (startDescTable) }\n") + m_t << "{\\par\n"; + m_t << "{" << rtf_Style["Heading5"].reference() << "\n"; docify(title); - t << ":\\par}\n"; - t << rtf_Style_Reset << rtf_DList_DepthStyle(); - t << "\\trowd \\trgaph108\\trleft426\\tblind426" + m_t << ":\\par}\n"; + m_t << rtf_Style_Reset << rtf_DList_DepthStyle(); + m_t << "\\trowd \\trgaph108\\trleft426\\tblind426" "\\trbrdrt\\brdrs\\brdrw10\\brdrcf15 " "\\trbrdrl\\brdrs\\brdrw10\\brdrcf15 " "\\trbrdrb\\brdrs\\brdrw10\\brdrcf15 " @@ -1992,20 +2039,20 @@ void RTFGenerator::startDescTable(const char *title) int i,columnPos[2] = { 25, 100 }; for (i=0;i<2;i++) { - t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10\\brdrcf15 " + m_t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10\\brdrcf15 " "\\clbrdrl\\brdrs\\brdrw10\\brdrcf15 " "\\clbrdrb\\brdrs\\brdrw10\\brdrcf15 " "\\clbrdrr \\brdrs\\brdrw10\\brdrcf15 " "\\cltxlrtb " "\\cellx" << (rtf_pageWidth*columnPos[i]/100) << "\n"; } - t << "\\pard \\widctlpar\\intbl\\adjustright\n"; + m_t << "\\pard \\widctlpar\\intbl\\adjustright\n"; } void RTFGenerator::endDescTable() { - DBG_RTF(t << "{\\comment (endDescTable)}\n") - t << "}\n"; + DBG_RTF(m_t << "{\\comment (endDescTable)}\n") + m_t << "}\n"; } void RTFGenerator::startDescTableRow() @@ -2018,26 +2065,26 @@ void RTFGenerator::endDescTableRow() void RTFGenerator::startDescTableTitle() { - DBG_RTF(t << "{\\comment (startDescTableTitle) }\n") - t << "{\\qr "; + DBG_RTF(m_t << "{\\comment (startDescTableTitle) }\n") + m_t << "{\\qr "; } void RTFGenerator::endDescTableTitle() { - DBG_RTF(t << "{\\comment (endDescTableTitle) }\n") - t << "\\cell }"; + DBG_RTF(m_t << "{\\comment (endDescTableTitle) }\n") + m_t << "\\cell }"; } void RTFGenerator::startDescTableData() { - DBG_RTF(t << "{\\comment (startDescTableData) }\n") - t << "{"; + DBG_RTF(m_t << "{\\comment (startDescTableData) }\n") + m_t << "{"; } void RTFGenerator::endDescTableData() { - DBG_RTF(t << "{\\comment (endDescTableData) }\n") - t << "\\cell }{\\row }\n"; + DBG_RTF(m_t << "{\\comment (endDescTableData) }\n") + m_t << "\\cell }{\\row }\n"; } // a style for list formatted as a "bulleted list" @@ -2063,40 +2110,40 @@ void RTFGenerator::decrementIndentLevel() } // a style for list formatted with "list continue" style -const char * RTFGenerator::rtf_CList_DepthStyle() +QCString RTFGenerator::rtf_CList_DepthStyle() { QCString n=makeIndexName("ListContinue",m_listLevel); return rtf_Style[n.str()].reference(); } // a style for list formatted as a "latext style" table of contents -const char * RTFGenerator::rtf_LCList_DepthStyle() +QCString RTFGenerator::rtf_LCList_DepthStyle() { QCString n=makeIndexName("LatexTOC",m_listLevel); return rtf_Style[n.str()].reference(); } // a style for list formatted as a "bullet" style -const char * RTFGenerator::rtf_BList_DepthStyle() +QCString RTFGenerator::rtf_BList_DepthStyle() { QCString n=makeIndexName("ListBullet",m_listLevel); return rtf_Style[n.str()].reference(); } // a style for list formatted as a "enumeration" style -const char * RTFGenerator::rtf_EList_DepthStyle() +QCString RTFGenerator::rtf_EList_DepthStyle() { QCString n=makeIndexName("ListEnum",m_listLevel); return rtf_Style[n.str()].reference(); } -const char * RTFGenerator::rtf_DList_DepthStyle() +QCString RTFGenerator::rtf_DList_DepthStyle() { QCString n=makeIndexName("DescContinue",m_listLevel); return rtf_Style[n.str()].reference(); } -const char * RTFGenerator::rtf_Code_DepthStyle() +QCString RTFGenerator::rtf_Code_DepthStyle() { QCString n=makeIndexName("CodeExample",m_listLevel); return rtf_Style[n.str()].reference(); @@ -2104,24 +2151,24 @@ const char * RTFGenerator::rtf_Code_DepthStyle() void RTFGenerator::startTextBlock(bool dense) { - DBG_RTF(t << "{\\comment startTextBlock}\n") - t << "{\n"; - t << rtf_Style_Reset; + DBG_RTF(m_t << "{\\comment startTextBlock}\n") + m_t << "{\n"; + m_t << rtf_Style_Reset; if (dense) // no spacing between "paragraphs" { - t << rtf_Style["DenseText"].reference(); + m_t << rtf_Style["DenseText"].reference(); } else // some spacing { - t << rtf_Style["BodyText"].reference(); + m_t << rtf_Style["BodyText"].reference(); } } void RTFGenerator::endTextBlock(bool /*paraBreak*/) { newParagraph(); - DBG_RTF(t << "{\\comment endTextBlock}\n") - t << "}\n"; + DBG_RTF(m_t << "{\\comment endTextBlock}\n") + m_t << "}\n"; //m_omitParagraph = TRUE; } @@ -2129,58 +2176,58 @@ void RTFGenerator::newParagraph() { if (!m_omitParagraph) { - DBG_RTF(t << "{\\comment (newParagraph)}\n") - t << "\\par\n"; + DBG_RTF(m_t << "{\\comment (newParagraph)}\n") + m_t << "\\par\n"; } m_omitParagraph = FALSE; } -void RTFGenerator::startParagraph(const char *txt) +void RTFGenerator::startParagraph(const QCString &txt) { - DBG_RTF(t << "{\\comment startParagraph}\n") + DBG_RTF(m_t << "{\\comment startParagraph}\n") newParagraph(); - t << "{\n"; - if (QCString(txt) == "reference") t << "\\ql\n"; + m_t << "{\n"; + if (QCString(txt) == "reference") m_t << "\\ql\n"; } void RTFGenerator::endParagraph() { - DBG_RTF(t << "{\\comment endParagraph}\n") - t << "}\\par\n"; + DBG_RTF(m_t << "{\\comment endParagraph}\n") + m_t << "}\\par\n"; m_omitParagraph = TRUE; } void RTFGenerator::startMemberSubtitle() { - DBG_RTF(t << "{\\comment startMemberSubtitle}\n") - t << "{\n"; - t << rtf_Style_Reset << rtf_CList_DepthStyle() << "\n"; + DBG_RTF(m_t << "{\\comment startMemberSubtitle}\n") + m_t << "{\n"; + m_t << rtf_Style_Reset << rtf_CList_DepthStyle() << "\n"; } void RTFGenerator::endMemberSubtitle() { - DBG_RTF(t << "{\\comment endMemberSubtitle}\n") + DBG_RTF(m_t << "{\\comment endMemberSubtitle}\n") newParagraph(); - t << "}\n"; + m_t << "}\n"; } //void RTFGenerator::writeUmlaut(char c) //{ // switch(c) // { -// case 'A' : t << '\304'; break; -// case 'E' : t << '\313'; break; -// case 'I' : t << '\317'; break; -// case 'O' : t << '\326'; break; -// case 'U' : t << '\334'; break; -// case 'Y' : t << 'Y'; break; -// case 'a' : t << '\344'; break; -// case 'e' : t << '\353'; break; -// case 'i' : t << '\357'; break; -// case 'o' : t << '\366'; break; -// case 'u' : t << '\374'; break; -// case 'y' : t << '\377'; break; -// default: t << '?'; break; +// case 'A' : m_t << '\304'; break; +// case 'E' : m_t << '\313'; break; +// case 'I' : m_t << '\317'; break; +// case 'O' : m_t << '\326'; break; +// case 'U' : m_t << '\334'; break; +// case 'Y' : m_t << 'Y'; break; +// case 'a' : m_t << '\344'; break; +// case 'e' : m_t << '\353'; break; +// case 'i' : m_t << '\357'; break; +// case 'o' : m_t << '\366'; break; +// case 'u' : m_t << '\374'; break; +// case 'y' : m_t << '\377'; break; +// default: m_t << '?'; break; // } //} // @@ -2188,19 +2235,19 @@ void RTFGenerator::endMemberSubtitle() //{ // switch(c) // { -// case 'A' : t << '\301'; break; -// case 'E' : t << '\311'; break; -// case 'I' : t << '\315'; break; -// case 'O' : t << '\323'; break; -// case 'U' : t << '\332'; break; -// case 'Y' : t << '\335'; break; -// case 'a' : t << '\341'; break; -// case 'e' : t << '\351'; break; -// case 'i' : t << '\355'; break; -// case 'o' : t << '\363'; break; -// case 'u' : t << '\372'; break; -// case 'y' : t << '\375'; break; -// default: t << '?'; break; +// case 'A' : m_t << '\301'; break; +// case 'E' : m_t << '\311'; break; +// case 'I' : m_t << '\315'; break; +// case 'O' : m_t << '\323'; break; +// case 'U' : m_t << '\332'; break; +// case 'Y' : m_t << '\335'; break; +// case 'a' : m_t << '\341'; break; +// case 'e' : m_t << '\351'; break; +// case 'i' : m_t << '\355'; break; +// case 'o' : m_t << '\363'; break; +// case 'u' : m_t << '\372'; break; +// case 'y' : m_t << '\375'; break; +// default: m_t << '?'; break; // } //} // @@ -2208,17 +2255,17 @@ void RTFGenerator::endMemberSubtitle() //{ // switch(c) // { -// case 'A' : t << '\300'; break; -// case 'E' : t << '\310'; break; -// case 'I' : t << '\314'; break; -// case 'O' : t << '\322'; break; -// case 'U' : t << '\331'; break; -// case 'a' : t << '\340'; break; -// case 'e' : t << '\350'; break; -// case 'i' : t << '\354'; break; -// case 'o' : t << '\362'; break; -// case 'u' : t << '\371'; break; -// default: t << '?'; break; +// case 'A' : m_t << '\300'; break; +// case 'E' : m_t << '\310'; break; +// case 'I' : m_t << '\314'; break; +// case 'O' : m_t << '\322'; break; +// case 'U' : m_t << '\331'; break; +// case 'a' : m_t << '\340'; break; +// case 'e' : m_t << '\350'; break; +// case 'i' : m_t << '\354'; break; +// case 'o' : m_t << '\362'; break; +// case 'u' : m_t << '\371'; break; +// default: m_t << '?'; break; // } //} // @@ -2226,17 +2273,17 @@ void RTFGenerator::endMemberSubtitle() //{ // switch(c) // { -// case 'A' : t << '\302'; break; -// case 'E' : t << '\312'; break; -// case 'I' : t << '\316'; break; -// case 'O' : t << '\324'; break; -// case 'U' : t << '\333'; break; -// case 'a' : t << '\342'; break; -// case 'e' : t << '\352'; break; -// case 'i' : t << '\356'; break; -// case 'o' : t << '\364'; break; -// case 'u' : t << '\373'; break; -// default: t << '?'; break; +// case 'A' : m_t << '\302'; break; +// case 'E' : m_t << '\312'; break; +// case 'I' : m_t << '\316'; break; +// case 'O' : m_t << '\324'; break; +// case 'U' : m_t << '\333'; break; +// case 'a' : m_t << '\342'; break; +// case 'e' : m_t << '\352'; break; +// case 'i' : m_t << '\356'; break; +// case 'o' : m_t << '\364'; break; +// case 'u' : m_t << '\373'; break; +// default: m_t << '?'; break; // } //} // @@ -2244,13 +2291,13 @@ void RTFGenerator::endMemberSubtitle() //{ // switch(c) // { -// case 'A' : t << '\303'; break; -// case 'N' : t << '\321'; break; -// case 'O' : t << '\325'; break; -// case 'a' : t << '\343'; break; -// case 'n' : t << '\361'; break; -// case 'o' : t << '\365'; break; -// default: t << '?'; break; +// case 'A' : m_t << '\303'; break; +// case 'N' : m_t << '\321'; break; +// case 'O' : m_t << '\325'; break; +// case 'a' : m_t << '\343'; break; +// case 'n' : m_t << '\361'; break; +// case 'o' : m_t << '\365'; break; +// default: m_t << '?'; break; // } //} // @@ -2258,9 +2305,9 @@ void RTFGenerator::endMemberSubtitle() //{ // switch(c) // { -// case 'A' : t << '\305'; break; -// case 'a' : t << '\345'; break; -// default: t << '?'; break; +// case 'A' : m_t << '\305'; break; +// case 'a' : m_t << '\345'; break; +// default: m_t << '?'; break; // } //} // @@ -2268,9 +2315,9 @@ void RTFGenerator::endMemberSubtitle() //{ // switch(c) // { -// case 'C' : t << '\307'; break; -// case 'c' : t << '\347'; break; -// default: t << '?'; break; +// case 'C' : m_t << '\307'; break; +// case 'c' : m_t << '\347'; break; +// default: m_t << '?'; break; // } //} // @@ -2307,24 +2354,24 @@ bool isLeadBytes(int c) // note: function is not reentrant! -static void encodeForOutput(std::ostream &t,const char *s) +static void encodeForOutput(TextStream &t,const QCString &s) { if (s==0) return; QCString encoding; bool converted=FALSE; - int l = qstrlen(s); + int l = (int)s.length(); static std::vector<char> enc; if (l*4>(int)enc.size()) enc.resize(l*4); // worst case - encoding.sprintf("CP%s",theTranslator->trRTFansicp().data()); + encoding.sprintf("CP%s",qPrint(theTranslator->trRTFansicp())); if (!encoding.isEmpty()) { // convert from UTF-8 back to the output encoding - void *cd = portable_iconv_open(encoding,"UTF-8"); + void *cd = portable_iconv_open(encoding.data(),"UTF-8"); if (cd!=(void *)(-1)) { size_t iLeft=l; size_t oLeft=enc.size(); - char *inputPtr = (char*)s; + const char *inputPtr = s.data(); char *outputPtr = &enc[0]; if (!portable_iconv(cd, &inputPtr, &iLeft, &outputPtr, &oLeft)) { @@ -2336,7 +2383,7 @@ static void encodeForOutput(std::ostream &t,const char *s) } if (!converted) // if we did not convert anything, copy as is. { - memcpy(enc.data(),s,l); + memcpy(enc.data(),s.data(),l); enc.resize(l); } uint i; @@ -2372,7 +2419,7 @@ static void encodeForOutput(std::ostream &t,const char *s) * VERY brittle routine inline RTF's included by other RTF's. * it is recursive and ugly. */ -static bool preProcessFile(Dir &d,const QCString &infName, std::ostream &t, bool bIncludeHeader=TRUE) +static bool preProcessFile(Dir &d,const QCString &infName, TextStream &t, bool bIncludeHeader=TRUE) { std::ifstream f(infName.str(),std::ifstream::in); if (!f.is_open()) @@ -2407,9 +2454,9 @@ static bool preProcessFile(Dir &d,const QCString &infName, std::ostream &t, bool size_t startNamePos = prevLine.find('"',pos)+1; size_t endNamePos = prevLine.find('"',startNamePos); std::string fileName = prevLine.substr(startNamePos,endNamePos-startNamePos); - DBG_RTF(t << "{\\comment begin include " << fileName << "}\n") + DBG_RTF(m_t << "{\\comment begin include " << fileName << "}\n") if (!preProcessFile(d,fileName.c_str(),t,FALSE)) return FALSE; - DBG_RTF(t << "{\\comment end include " << fileName << "}\n") + DBG_RTF(m_t << "{\\comment end include " << fileName << "}\n") } else if (!first) // no INCLUDETEXT on this line { @@ -2440,7 +2487,7 @@ static bool preProcessFile(Dir &d,const QCString &infName, std::ostream &t, bool void RTFGenerator::startDotGraph() { - DBG_RTF(t << "{\\comment (startDotGraph)}\n") + DBG_RTF(m_t << "{\\comment (startDotGraph)}\n") } void RTFGenerator::endDotGraph(DotClassGraph &g) @@ -2448,40 +2495,40 @@ void RTFGenerator::endDotGraph(DotClassGraph &g) newParagraph(); QCString fn = - g.writeGraph(t,GOF_BITMAP,EOF_Rtf,dir(),fileName(),m_relPath,TRUE,FALSE); + g.writeGraph(m_t,GOF_BITMAP,EOF_Rtf,dir(),fileName(),m_relPath,TRUE,FALSE); // display the file - t << "{\n"; - t << rtf_Style_Reset << "\n"; - t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \""; + m_t << "{\n"; + m_t << rtf_Style_Reset << "\n"; + m_t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \""; QCString imgExt = getDotImageExtension(); - t << fn << "." << imgExt; - t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; - t << "}\n"; + m_t << fn << "." << imgExt; + m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; + m_t << "}\n"; newParagraph(); - DBG_RTF(t << "{\\comment (endDotGraph)}\n") + DBG_RTF(m_t << "{\\comment (endDotGraph)}\n") } void RTFGenerator::startInclDepGraph() { - DBG_RTF(t << "{\\comment (startInclDepGraph)}\n") + DBG_RTF(m_t << "{\\comment (startInclDepGraph)}\n") } void RTFGenerator::endInclDepGraph(DotInclDepGraph &g) { newParagraph(); - QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_Rtf,dir(),fileName(),m_relPath,FALSE); + QCString fn = g.writeGraph(m_t,GOF_BITMAP,EOF_Rtf,dir(),fileName(),m_relPath,FALSE); // display the file - t << "{\n"; - t << rtf_Style_Reset << "\n"; - t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \""; + m_t << "{\n"; + m_t << rtf_Style_Reset << "\n"; + m_t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \""; QCString imgExt = getDotImageExtension(); - t << fn << "." << imgExt; - t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; - t << "}\n"; - DBG_RTF(t << "{\\comment (endInclDepGraph)}\n") + m_t << fn << "." << imgExt; + m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; + m_t << "}\n"; + DBG_RTF(m_t << "{\\comment (endInclDepGraph)}\n") } void RTFGenerator::startGroupCollaboration() @@ -2494,57 +2541,57 @@ void RTFGenerator::endGroupCollaboration(DotGroupCollaboration &) void RTFGenerator::startCallGraph() { - DBG_RTF(t << "{\\comment (startCallGraph)}\n") + DBG_RTF(m_t << "{\\comment (startCallGraph)}\n") } void RTFGenerator::endCallGraph(DotCallGraph &g) { newParagraph(); - QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_Rtf,dir(),fileName(),m_relPath,FALSE); + QCString fn = g.writeGraph(m_t,GOF_BITMAP,EOF_Rtf,dir(),fileName(),m_relPath,FALSE); // display the file - t << "{\n"; - t << rtf_Style_Reset << "\n"; - t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \""; + m_t << "{\n"; + m_t << rtf_Style_Reset << "\n"; + m_t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \""; QCString imgExt = getDotImageExtension(); - t << fn << "." << imgExt; - t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; - t << "}\n"; - DBG_RTF(t << "{\\comment (endCallGraph)}\n") + m_t << fn << "." << imgExt; + m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; + m_t << "}\n"; + DBG_RTF(m_t << "{\\comment (endCallGraph)}\n") } void RTFGenerator::startDirDepGraph() { - DBG_RTF(t << "{\\comment (startDirDepGraph)}\n") + DBG_RTF(m_t << "{\\comment (startDirDepGraph)}\n") } void RTFGenerator::endDirDepGraph(DotDirDeps &g) { newParagraph(); - QCString fn = g.writeGraph(t,GOF_BITMAP,EOF_Rtf,dir(),fileName(),m_relPath,FALSE); + QCString fn = g.writeGraph(m_t,GOF_BITMAP,EOF_Rtf,dir(),fileName(),m_relPath,FALSE); // display the file - t << "{\n"; - t << rtf_Style_Reset << "\n"; - t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \""; + m_t << "{\n"; + m_t << rtf_Style_Reset << "\n"; + m_t << "\\par\\pard \\qc {\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \""; QCString imgExt = getDotImageExtension(); - t << fn << "." << imgExt; - t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; - t << "}\n"; - DBG_RTF(t << "{\\comment (endDirDepGraph)}\n") + m_t << fn << "." << imgExt; + m_t << "\" \\\\d \\\\*MERGEFORMAT}{\\fldrslt IMAGE}}\\par\n"; + m_t << "}\n"; + DBG_RTF(m_t << "{\\comment (endDirDepGraph)}\n") } /** Tests the integrity of the result by counting brackets. * */ -void testRTFOutput(const char *name) +void testRTFOutput(const QCString &name) { int bcount=0; int line=1; int c; - std::ifstream f(name,std::ifstream::in); + std::ifstream f(name.data(),std::ifstream::in); if (f.is_open()) { while ((c=f.get())!=-1) @@ -2577,20 +2624,20 @@ void testRTFOutput(const char *name) err: err("RTF integrity test failed at line %d of %s due to a bracket mismatch.\n" " Please try to create a small code example that produces this error \n" - " and send that to doxygen@gmail.com.\n",line,name); + " and send that to doxygen@gmail.com.\n",line,qPrint(name)); } /** * This is an API to a VERY brittle RTF preprocessor that combines nested * RTF files. This version replaces the infile with the new file */ -bool RTFGenerator::preProcessFileInplace(const char *path,const char *name) +bool RTFGenerator::preProcessFileInplace(const QCString &path,const QCString &name) { - Dir d(path); + Dir d(path.str()); // store the original directory if (!d.exists()) { - err("Output dir %s does not exist!\n",path); + err("Output dir %s does not exist!\n",qPrint(path)); return FALSE; } std::string oldDir = Dir::currentDirPath(); @@ -2599,28 +2646,31 @@ bool RTFGenerator::preProcessFileInplace(const char *path,const char *name) Dir::setCurrent(d.absPath()); Dir thisDir; - QCString combinedName = (QCString)path+"/combined.rtf"; - QCString mainRTFName = (QCString)path+"/"+name; + QCString combinedName = path+"/combined.rtf"; + QCString mainRTFName = path+"/"+name; - std::ofstream outt(combinedName.str(),std::ofstream::out | std::ofstream::binary); - if (!outt.is_open()) + std::ofstream f(combinedName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { err("Failed to open %s for writing!\n",combinedName.data()); Dir::setCurrent(oldDir); return FALSE; } + TextStream outt(&f); if (!preProcessFile(thisDir,mainRTFName,outt)) { // it failed, remove the temp file - outt.close(); + outt.flush(); + f.close(); thisDir.remove(combinedName.str()); Dir::setCurrent(oldDir); return FALSE; } // everything worked, move the files - outt.close(); + outt.flush(); + f.close(); thisDir.remove(mainRTFName.str()); thisDir.rename(combinedName.str(),mainRTFName.str()); @@ -2632,122 +2682,126 @@ bool RTFGenerator::preProcessFileInplace(const char *path,const char *name) void RTFGenerator::startMemberGroupHeader(bool hasHeader) { - DBG_RTF(t << "{\\comment startMemberGroupHeader}\n") - t << "{\n"; + DBG_RTF(m_t << "{\\comment startMemberGroupHeader}\n") + m_t << "{\n"; if (hasHeader) incrementIndentLevel(); - t << rtf_Style_Reset << rtf_Style["GroupHeader"].reference(); + m_t << rtf_Style_Reset << rtf_Style["GroupHeader"].reference(); } void RTFGenerator::endMemberGroupHeader() { - DBG_RTF(t << "{\\comment endMemberGroupHeader}\n") + DBG_RTF(m_t << "{\\comment endMemberGroupHeader}\n") newParagraph(); - t << rtf_Style_Reset << rtf_CList_DepthStyle(); + m_t << rtf_Style_Reset << rtf_CList_DepthStyle(); } void RTFGenerator::startMemberGroupDocs() { - DBG_RTF(t << "{\\comment startMemberGroupDocs}\n") + DBG_RTF(m_t << "{\\comment startMemberGroupDocs}\n") startEmphasis(); } void RTFGenerator::endMemberGroupDocs() { - DBG_RTF(t << "{\\comment endMemberGroupDocs}\n") + DBG_RTF(m_t << "{\\comment endMemberGroupDocs}\n") endEmphasis(); newParagraph(); } void RTFGenerator::startMemberGroup() { - DBG_RTF(t << "{\\comment startMemberGroup}\n") - t << rtf_Style_Reset << rtf_BList_DepthStyle() << "\n"; + DBG_RTF(m_t << "{\\comment startMemberGroup}\n") + m_t << rtf_Style_Reset << rtf_BList_DepthStyle() << "\n"; } void RTFGenerator::endMemberGroup(bool hasHeader) { - DBG_RTF(t << "{\\comment endMemberGroup}\n") + DBG_RTF(m_t << "{\\comment endMemberGroup}\n") if (hasHeader) decrementIndentLevel(); - t << "}"; + m_t << "}"; } void RTFGenerator::startExamples() { - DBG_RTF(t << "{\\comment (startExamples)}\n") - t << "{"; // ends at endDescList - t << "{"; // ends at endDescTitle + DBG_RTF(m_t << "{\\comment (startExamples)}\n") + m_t << "{"; // ends at endDescList + m_t << "{"; // ends at endDescTitle startBold(); newParagraph(); docify(theTranslator->trExamples()); endBold(); - t << "}"; + m_t << "}"; newParagraph(); incrementIndentLevel(); - t << rtf_Style_Reset << rtf_DList_DepthStyle(); + m_t << rtf_Style_Reset << rtf_DList_DepthStyle(); } void RTFGenerator::endExamples() { - DBG_RTF(t << "{\\comment (endExamples)}\n") + DBG_RTF(m_t << "{\\comment (endExamples)}\n") m_omitParagraph = FALSE; newParagraph(); decrementIndentLevel(); m_omitParagraph = TRUE; - t << "}"; + m_t << "}"; } -void RTFGenerator::startParamList(ParamListTypes,const char *title) +void RTFGenerator::startParamList(ParamListTypes,const QCString &title) { - DBG_RTF(t << "{\\comment (startParamList)}\n") - t << "{"; // ends at endParamList - t << "{"; // ends at endDescTitle + DBG_RTF(m_t << "{\\comment (startParamList)}\n") + m_t << "{"; // ends at endParamList + m_t << "{"; // ends at endDescTitle startBold(); newParagraph(); docify(title); endBold(); - t << "}"; + m_t << "}"; newParagraph(); incrementIndentLevel(); - t << rtf_Style_Reset << rtf_DList_DepthStyle(); + m_t << rtf_Style_Reset << rtf_DList_DepthStyle(); } void RTFGenerator::endParamList() { - DBG_RTF(t << "{\\comment (endParamList)}\n") + DBG_RTF(m_t << "{\\comment (endParamList)}\n") newParagraph(); decrementIndentLevel(); m_omitParagraph = TRUE; - t << "}"; + m_t << "}"; } -void RTFGenerator::startParameterType(bool first,const char *key) +void RTFGenerator::startParameterType(bool first,const QCString &key) { - DBG_RTF(t << "{\\comment (startParameterType)}\n") - if (!first && key) + DBG_RTF(m_t << "{\\comment (startParameterType)}\n") + if (!first && !key.isEmpty()) { - t << " " << key << " "; + m_t << " " << key << " "; } } void RTFGenerator::endParameterType() { - DBG_RTF(t << "{\\comment (endParameterType)}\n") - t << " "; + DBG_RTF(m_t << "{\\comment (endParameterType)}\n") + m_t << " "; } -void RTFGenerator::exceptionEntry(const char* prefix,bool closeBracket) +void RTFGenerator::exceptionEntry(const QCString &prefix,bool closeBracket) { - DBG_RTF(t << "{\\comment (exceptionEntry)}\n") - if (prefix) - t << " " << prefix << "("; + DBG_RTF(m_t << "{\\comment (exceptionEntry)}\n") + if (!prefix.isEmpty()) + { + m_t << " " << prefix << "("; + } else if (closeBracket) - t << ")"; - t << " "; + { + m_t << ")"; + } + m_t << " "; } void RTFGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *,int) { - RTFDocVisitor *visitor = new RTFDocVisitor(t,*this,ctx?ctx->getDefFileExtension():QCString("")); + RTFDocVisitor *visitor = new RTFDocVisitor(m_t,*this,ctx?ctx->getDefFileExtension():QCString("")); n->accept(visitor); delete visitor; m_omitParagraph = TRUE; @@ -2755,26 +2809,26 @@ void RTFGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *,i void RTFGenerator::rtfwriteRuler_doubleline() { - DBG_RTF(t << "{\\comment (rtfwriteRuler_doubleline)}\n") - t << "{\\pard\\widctlpar\\brdrb\\brdrdb\\brdrw15\\brsp20 \\adjustright \\par}\n"; + DBG_RTF(m_t << "{\\comment (rtfwriteRuler_doubleline)}\n") + m_t << "{\\pard\\widctlpar\\brdrb\\brdrdb\\brdrw15\\brsp20 \\adjustright \\par}\n"; } void RTFGenerator::rtfwriteRuler_emboss() { - DBG_RTF(t << "{\\comment (rtfwriteRuler_emboss)}\n") - t << "{\\pard\\widctlpar\\brdrb\\brdremboss\\brdrw15\\brsp20 \\adjustright \\par}\n"; + DBG_RTF(m_t << "{\\comment (rtfwriteRuler_emboss)}\n") + m_t << "{\\pard\\widctlpar\\brdrb\\brdremboss\\brdrw15\\brsp20 \\adjustright \\par}\n"; } void RTFGenerator::rtfwriteRuler_thick() { - DBG_RTF(t << "{\\comment (rtfwriteRuler_thick)}\n") - t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw75\\brsp20 \\adjustright \\par}\n"; + DBG_RTF(m_t << "{\\comment (rtfwriteRuler_thick)}\n") + m_t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw75\\brsp20 \\adjustright \\par}\n"; } void RTFGenerator::rtfwriteRuler_thin() { - DBG_RTF(t << "{\\comment (rtfwriteRuler_thin)}\n") - t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw5\\brsp20 \\adjustright \\par}\n"; + DBG_RTF(m_t << "{\\comment (rtfwriteRuler_thin)}\n") + m_t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw5\\brsp20 \\adjustright \\par}\n"; } #if 0 @@ -2808,110 +2862,110 @@ void RTFGenerator::postProcess(QByteArray &a) } #endif -void RTFGenerator::startConstraintList(const char *header) +void RTFGenerator::startConstraintList(const QCString &header) { - DBG_RTF(t << "{\\comment (startConstraintList)}\n") - t << "{"; // ends at endConstraintList - t << "{"; + DBG_RTF(m_t << "{\\comment (startConstraintList)}\n") + m_t << "{"; // ends at endConstraintList + m_t << "{"; startBold(); newParagraph(); docify(header); endBold(); - t << "}"; + m_t << "}"; newParagraph(); incrementIndentLevel(); - t << rtf_Style_Reset << rtf_DList_DepthStyle(); + m_t << rtf_Style_Reset << rtf_DList_DepthStyle(); } void RTFGenerator::startConstraintParam() { - DBG_RTF(t << "{\\comment (startConstraintParam)}\n") + DBG_RTF(m_t << "{\\comment (startConstraintParam)}\n") startEmphasis(); } void RTFGenerator::endConstraintParam() { - DBG_RTF(t << "{\\comment (endConstraintParam)}\n") + DBG_RTF(m_t << "{\\comment (endConstraintParam)}\n") endEmphasis(); - t << " : "; + m_t << " : "; } void RTFGenerator::startConstraintType() { - DBG_RTF(t << "{\\comment (startConstraintType)}\n") + DBG_RTF(m_t << "{\\comment (startConstraintType)}\n") startEmphasis(); } void RTFGenerator::endConstraintType() { - DBG_RTF(t << "{\\comment (endConstraintType)}\n") + DBG_RTF(m_t << "{\\comment (endConstraintType)}\n") endEmphasis(); - t << " "; + m_t << " "; } void RTFGenerator::startConstraintDocs() { - DBG_RTF(t << "{\\comment (startConstraintDocs)}\n") + DBG_RTF(m_t << "{\\comment (startConstraintDocs)}\n") } void RTFGenerator::endConstraintDocs() { - DBG_RTF(t << "{\\comment (endConstraintDocs)}\n") + DBG_RTF(m_t << "{\\comment (endConstraintDocs)}\n") newParagraph(); } void RTFGenerator::endConstraintList() { - DBG_RTF(t << "{\\comment (endConstraintList)}\n") + DBG_RTF(m_t << "{\\comment (endConstraintList)}\n") newParagraph(); decrementIndentLevel(); m_omitParagraph = TRUE; - t << "}"; + m_t << "}"; } void RTFGenerator::startIndexListItem() { - DBG_RTF(t << "{\\comment (startIndexListItem)}\n") + DBG_RTF(m_t << "{\\comment (startIndexListItem)}\n") } void RTFGenerator::endIndexListItem() { - DBG_RTF(t << "{\\comment (endIndexListItem)}\n") - t << "\\par\n"; + DBG_RTF(m_t << "{\\comment (endIndexListItem)}\n") + m_t << "\\par\n"; } void RTFGenerator::startInlineHeader() { - DBG_RTF(t << "{\\comment (startInlineHeader)}\n") - t << "{\n"; - t << rtf_Style_Reset << rtf_Style["Heading5"].reference(); + DBG_RTF(m_t << "{\\comment (startInlineHeader)}\n") + m_t << "{\n"; + m_t << rtf_Style_Reset << rtf_Style["Heading5"].reference(); startBold(); } void RTFGenerator::endInlineHeader() { - DBG_RTF(t << "{\\comment (endInlineHeader)}\n") + DBG_RTF(m_t << "{\\comment (endInlineHeader)}\n") endBold(); - t << "\\par"; - t << "}\n"; + m_t << "\\par"; + m_t << "}\n"; } void RTFGenerator::startMemberDocSimple(bool isEnum) { - DBG_RTF(t << "{\\comment (startMemberDocSimple)}\n") - t << "{\\par\n"; - t << "{" << rtf_Style["Heading5"].reference() << "\n"; + DBG_RTF(m_t << "{\\comment (startMemberDocSimple)}\n") + m_t << "{\\par\n"; + m_t << "{" << rtf_Style["Heading5"].reference() << "\n"; if (isEnum) { - t << theTranslator->trEnumerationValues(); + m_t << theTranslator->trEnumerationValues(); } else { - t << theTranslator->trCompoundMembers(); + m_t << theTranslator->trCompoundMembers(); } - t << ":\\par}\n"; - t << rtf_Style_Reset << rtf_DList_DepthStyle(); - t << "\\trowd \\trgaph108\\trleft426\\tblind426" + m_t << ":\\par}\n"; + m_t << rtf_Style_Reset << rtf_DList_DepthStyle(); + m_t << "\\trowd \\trgaph108\\trleft426\\tblind426" "\\trbrdrt\\brdrs\\brdrw10\\brdrcf15 " "\\trbrdrl\\brdrs\\brdrw10\\brdrcf15 " "\\trbrdrb\\brdrs\\brdrw10\\brdrcf15 " @@ -2927,59 +2981,59 @@ void RTFGenerator::startMemberDocSimple(bool isEnum) } for (i=0;i<n;i++) { - t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10\\brdrcf15 " + m_t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10\\brdrcf15 " "\\clbrdrl\\brdrs\\brdrw10\\brdrcf15 " "\\clbrdrb\\brdrs\\brdrw10\\brdrcf15 " "\\clbrdrr \\brdrs\\brdrw10\\brdrcf15 " "\\cltxlrtb " "\\cellx" << (rtf_pageWidth*columnPos[i]/100) << "\n"; } - t << "\\pard \\widctlpar\\intbl\\adjustright\n"; + m_t << "\\pard \\widctlpar\\intbl\\adjustright\n"; } void RTFGenerator::endMemberDocSimple(bool) { - DBG_RTF(t << "{\\comment (endMemberDocSimple)}\n") - t << "}\n"; + DBG_RTF(m_t << "{\\comment (endMemberDocSimple)}\n") + m_t << "}\n"; } void RTFGenerator::startInlineMemberType() { - DBG_RTF(t << "{\\comment (startInlineMemberType)}\n") - t << "{\\qr "; + DBG_RTF(m_t << "{\\comment (startInlineMemberType)}\n") + m_t << "{\\qr "; } void RTFGenerator::endInlineMemberType() { - DBG_RTF(t << "{\\comment (endInlineMemberType)}\n") - t << "\\cell }"; + DBG_RTF(m_t << "{\\comment (endInlineMemberType)}\n") + m_t << "\\cell }"; } void RTFGenerator::startInlineMemberName() { - DBG_RTF(t << "{\\comment (startInlineMemberName)}\n") - t << "{"; + DBG_RTF(m_t << "{\\comment (startInlineMemberName)}\n") + m_t << "{"; } void RTFGenerator::endInlineMemberName() { - DBG_RTF(t << "{\\comment (endInlineMemberName)}\n") - t << "\\cell }"; + DBG_RTF(m_t << "{\\comment (endInlineMemberName)}\n") + m_t << "\\cell }"; } void RTFGenerator::startInlineMemberDoc() { - DBG_RTF(t << "{\\comment (startInlineMemberDoc)}\n") - t << "{"; + DBG_RTF(m_t << "{\\comment (startInlineMemberDoc)}\n") + m_t << "{"; } void RTFGenerator::endInlineMemberDoc() { - DBG_RTF(t << "{\\comment (endInlineMemberDoc)}\n") - t << "\\cell }{\\row }\n"; + DBG_RTF(m_t << "{\\comment (endInlineMemberDoc)}\n") + m_t << "\\cell }{\\row }\n"; } -void RTFGenerator::writeLineNumber(const char *ref,const char *fileName,const char *anchor,int l) +void RTFGenerator::writeLineNumber(const QCString &ref,const QCString &fileName,const QCString &anchor,int l) { bool rtfHyperlinks = Config_getBool(RTF_HYPERLINKS); @@ -2988,23 +3042,23 @@ void RTFGenerator::writeLineNumber(const char *ref,const char *fileName,const ch lineNumber.sprintf("%05d",l); if (m_prettyCode) { - if (fileName && !m_sourceFileName.isEmpty() && rtfHyperlinks) + if (!fileName.isEmpty() && !m_sourceFileName.isEmpty() && rtfHyperlinks) { QCString lineAnchor; lineAnchor.sprintf("_l%05d",l); lineAnchor.prepend(stripExtensionGeneral(m_sourceFileName, ".rtf")); - t << "{\\bkmkstart "; - t << rtfFormatBmkStr(lineAnchor); - t << "}"; - t << "{\\bkmkend "; - t << rtfFormatBmkStr(lineAnchor); - t << "}\n"; + m_t << "{\\bkmkstart "; + m_t << rtfFormatBmkStr(lineAnchor); + m_t << "}"; + m_t << "{\\bkmkend "; + m_t << rtfFormatBmkStr(lineAnchor); + m_t << "}\n"; } - t << lineNumber << " "; + m_t << lineNumber << " "; } else { - t << l << " "; + m_t << l << " "; } m_col=0; } @@ -3023,17 +3077,17 @@ void RTFGenerator::startLabels() { } -void RTFGenerator::writeLabel(const char *l,bool isLast) +void RTFGenerator::writeLabel(const QCString &l,bool isLast) { - t << "{\\f2 [" << l << "]}"; - if (!isLast) t << ", "; + m_t << "{\\f2 [" << l << "]}"; + if (!isLast) m_t << ", "; } void RTFGenerator::endLabels() { } -void RTFGenerator::startFontClass(const char *name) +void RTFGenerator::startFontClass(const QCString &name) { int cod = 2; QCString qname(name); @@ -3048,10 +3102,10 @@ void RTFGenerator::startFontClass(const char *name) else if (qname == "vhdlchar") cod = 25; else if (qname == "vhdlkeyword") cod = 26; else if (qname == "vhdllogic") cod = 27; - t << "{\\cf" << cod << " "; + m_t << "{\\cf" << cod << " "; } void RTFGenerator::endFontClass() { - t << "}"; + m_t << "}"; } diff --git a/src/rtfgen.h b/src/rtfgen.h index e6695bb..c9a069e 100644 --- a/src/rtfgen.h +++ b/src/rtfgen.h @@ -32,8 +32,8 @@ class RTFGenerator : public OutputGenerator virtual std::unique_ptr<OutputGenerator> clone() const; static void init(); - static void writeStyleSheetFile(std::ostream &t); - static void writeExtensionsFile(std::ostream &t); + static void writeStyleSheetFile(TextStream &t); + static void writeExtensionsFile(TextStream &t); OutputType type() const { return RTF; } void setRelativePath(const QCString &path); @@ -41,28 +41,28 @@ class RTFGenerator : public OutputGenerator void writeDoc(DocNode *,const Definition *,const MemberDef *,int); - void startFile(const char *name,const char *manName,const char *title,int id); + void startFile(const QCString &name,const QCString &manName,const QCString &title,int id); void writeSearchInfo() {} - void writeFooter(const char *) {} + void writeFooter(const QCString &) {} void endFile(); void clearBuffer(); //void postProcess(QByteArray &); void startIndexSection(IndexSections); void endIndexSection(IndexSections); - void writePageLink(const char *,bool); + void writePageLink(const QCString &,bool); void startProjectNumber(); void endProjectNumber(); void writeStyleInfo(int part); - void startTitleHead(const char *); + void startTitleHead(const QCString &); void startTitle(); - void endTitleHead(const char *,const char *name); + void endTitleHead(const QCString &,const QCString &name); void endTitle() {} void newParagraph(); - void startParagraph(const char *classDef); + void startParagraph(const QCString &classDef); void endParagraph(); - void writeString(const char *text); + void writeString(const QCString &text); void startIndexListItem(); void endIndexListItem(); void startIndexList(); @@ -70,27 +70,27 @@ class RTFGenerator : public OutputGenerator void startIndexKey(); void endIndexKey(); void startIndexValue(bool); - void endIndexValue(const char *,bool); + void endIndexValue(const QCString &,bool); void startItemList(); void endItemList(); - void startIndexItem(const char *ref,const char *file); - void endIndexItem(const char *ref,const char *file); - void docify(const char *text); - void codify(const char *text); - void writeObjectLink(const char *ref,const char *file, - const char *anchor,const char *name); - void writeCodeLink(const char *ref, const char *file, - const char *anchor,const char *name, - const char *tooltip); - void writeTooltip(const char *, const DocLinkInfo &, const char *, - const char *, const SourceLinkInfo &, const SourceLinkInfo & + void startIndexItem(const QCString &ref,const QCString &file); + void endIndexItem(const QCString &ref,const QCString &file); + void docify(const QCString &text); + void codify(const QCString &text); + void writeObjectLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name); + void writeCodeLink(const QCString &ref, const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip); + void writeTooltip(const QCString &, const DocLinkInfo &, const QCString &, + const QCString &, const SourceLinkInfo &, const SourceLinkInfo & ) {} - void startTextLink(const char *f,const char *anchor); + void startTextLink(const QCString &f,const QCString &anchor); void endTextLink(); - void startHtmlLink(const char *url); + void startHtmlLink(const QCString &url); void endHtmlLink(); - void startTypewriter() { t << "{\\f2 "; } - void endTypewriter() { t << "}"; } + void startTypewriter() { m_t << "{\\f2 "; } + void endTypewriter() { m_t << "}"; } void startGroupHeader(int); void endGroupHeader(int); //void writeListItem(); @@ -101,7 +101,7 @@ class RTFGenerator : public OutputGenerator void endMemberSections() {} void startHeaderSection() {} void endHeaderSection() {} - void startMemberHeader(const char *,int) { startGroupHeader(FALSE); } + void startMemberHeader(const QCString &,int) { startGroupHeader(FALSE); } void endMemberHeader() { endGroupHeader(FALSE); } void startMemberSubtitle(); void endMemberSubtitle(); @@ -113,84 +113,86 @@ class RTFGenerator : public OutputGenerator void endInlineHeader(); void startAnonTypeScope(int) {} void endAnonTypeScope(int) {} - void startMemberItem(const char *,int,const char *); + void startMemberItem(const QCString &,int,const QCString &); void endMemberItem(); void startMemberTemplateParams() {} - void endMemberTemplateParams(const char *,const char *) {} + void endMemberTemplateParams(const QCString &,const QCString &) {} + void startCompoundTemplateParams() { startSubsubsection(); } + void endCompoundTemplateParams() { endSubsubsection(); } void insertMemberAlign(bool) {} void insertMemberAlignLeft(int,bool){} void writeRuler() { rtfwriteRuler_thin(); } - void writeAnchor(const char *fileName,const char *name); - void startCodeFragment(const char *style); - void endCodeFragment(const char *style); - void writeLineNumber(const char *,const char *,const char *,int l); + void writeAnchor(const QCString &fileName,const QCString &name); + void startCodeFragment(const QCString &style); + void endCodeFragment(const QCString &style); + void writeLineNumber(const QCString &,const QCString &,const QCString &,int l); void startCodeLine(bool); void endCodeLine(); - void startEmphasis() { t << "{\\i "; } - void endEmphasis() { t << "}"; } - void startBold() { t << "{\\b "; } - void endBold() { t << "}"; } + void startEmphasis() { m_t << "{\\i "; } + void endEmphasis() { m_t << "}"; } + void startBold() { m_t << "{\\b "; } + void endBold() { m_t << "}"; } void startDescription(); void endDescription(); void startDescItem(); void endDescItem(); - void lineBreak(const char *style=0); - void startMemberDoc(const char *,const char *,const char *,const char *,int,int,bool); + void lineBreak(const QCString &style=QCString()); + void startMemberDoc(const QCString &,const QCString &,const QCString &,const QCString &,int,int,bool); void endMemberDoc(bool); - void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *); - void endDoxyAnchor(const char *,const char *); + void startDoxyAnchor(const QCString &,const QCString &,const QCString &,const QCString &,const QCString &); + void endDoxyAnchor(const QCString &,const QCString &); void writeChar(char c); - void writeLatexSpacing() {};//{ t << "\\hspace{0.3cm}"; } - void writeStartAnnoItem(const char *type,const char *file, - const char *path,const char *name); - void writeEndAnnoItem(const char *name); + void writeLatexSpacing() {};//{ m_t << "\\hspace{0.3cm}"; } + void writeStartAnnoItem(const QCString &type,const QCString &file, + const QCString &path,const QCString &name); + void writeEndAnnoItem(const QCString &name); void startSubsection(); void endSubsection(); void startSubsubsection(); void endSubsubsection(); - void startCenter() { t << "{\\qc\n"; } - void endCenter() { t << "}"; } - void startSmall() { t << "{\\sub "; } - void endSmall() { t << "}"; } + void startCenter() { m_t << "{\\qc\n"; } + void endCenter() { m_t << "}"; } + void startSmall() { m_t << "{\\sub "; } + void endSmall() { m_t << "}"; } - void startMemberDescription(const char *,const char *,bool); + void startMemberDescription(const QCString &,const QCString &,bool); void endMemberDescription(); void startMemberDeclaration() {} - void endMemberDeclaration(const char *,const char *) {} - void writeInheritedSectionTitle(const char *,const char *,const char *, - const char *,const char *,const char *) {} + void endMemberDeclaration(const QCString &,const QCString &) {} + void writeInheritedSectionTitle(const QCString &,const QCString &,const QCString &, + const QCString &,const QCString &,const QCString &) {} void startDescList(SectionTypes); void startExamples(); void endExamples(); - void startParamList(ParamListTypes,const char *); + void startParamList(ParamListTypes,const QCString &); void endParamList(); //void writeDescItem(); void startDescForItem(); void endDescForItem(); - void startSection(const char *,const char *,SectionType); - void endSection(const char *,SectionType); - void addIndexItem(const char *,const char *); + void startSection(const QCString &,const QCString &,SectionType); + void endSection(const QCString &,SectionType); + void addIndexItem(const QCString &,const QCString &); void startIndent(); void endIndent(); void writeSynopsis() {} void startClassDiagram(); - void endClassDiagram(const ClassDiagram &,const char *filename,const char *name); + void endClassDiagram(const ClassDiagram &,const QCString &filename,const QCString &name); void startPageRef(); - void endPageRef(const char *,const char *); + void endPageRef(const QCString &,const QCString &); void startQuickIndices() {} void endQuickIndices() {} - void writeSplitBar(const char *) {} - void writeNavigationPath(const char *) {} + void writeSplitBar(const QCString &) {} + void writeNavigationPath(const QCString &) {} void writeLogo() {} - void writeQuickLinks(bool,HighlightedItem,const char *) {} - void writeSummaryLink(const char *,const char *,const char *,bool) {} + void writeQuickLinks(bool,HighlightedItem,const QCString &) {} + void writeSummaryLink(const QCString &,const QCString &,const QCString &,bool) {} void startContents() {} void endContents() {} void writeNonBreakableSpace(int); - void startDescTable(const char *title); + void startDescTable(const QCString &title); void endDescTable(); void startDescTableRow(); void endDescTableRow(); @@ -226,15 +228,15 @@ class RTFGenerator : public OutputGenerator void endMemberDocPrefixItem() {} void startMemberDocName(bool) {} void endMemberDocName() {} - void startParameterType(bool,const char *); + void startParameterType(bool,const QCString &); void endParameterType(); void startParameterName(bool) {} void endParameterName(bool,bool,bool) {} void startParameterList(bool) {} void endParameterList() {} - void exceptionEntry(const char*,bool); + void exceptionEntry(const QCString &,bool); - void startConstraintList(const char *); + void startConstraintList(const QCString &); void startConstraintParam(); void endConstraintParam(); void startConstraintType(); @@ -253,25 +255,25 @@ class RTFGenerator : public OutputGenerator void endInlineMemberDoc(); void startLabels(); - void writeLabel(const char *l,bool isLast); + void writeLabel(const QCString &l,bool isLast); void endLabels(); - void startFontClass(const char *); + void startFontClass(const QCString &); void endFontClass(); - void writeCodeAnchor(const char *) {} - void setCurrentDoc(const Definition *,const char *,bool) {} - void addWord(const char *,bool) {} + void writeCodeAnchor(const QCString &) {} + void setCurrentDoc(const Definition *,const QCString &,bool) {} + void addWord(const QCString &,bool) {} - static bool preProcessFileInplace(const char *path,const char *name); + static bool preProcessFileInplace(const QCString &path,const QCString &name); private: - const char *rtf_BList_DepthStyle(); - const char *rtf_CList_DepthStyle(); - const char *rtf_EList_DepthStyle(); - const char *rtf_LCList_DepthStyle(); - const char *rtf_DList_DepthStyle(); - const char *rtf_Code_DepthStyle(); + QCString rtf_BList_DepthStyle(); + QCString rtf_CList_DepthStyle(); + QCString rtf_EList_DepthStyle(); + QCString rtf_LCList_DepthStyle(); + QCString rtf_DList_DepthStyle(); + QCString rtf_Code_DepthStyle(); void incrementIndentLevel(); void decrementIndentLevel(); void beginRTFDocument(); @@ -281,7 +283,7 @@ class RTFGenerator : public OutputGenerator void rtfwriteRuler_emboss(); void rtfwriteRuler_thick(); void rtfwriteRuler_thin(); - void writeRTFReference(const char *label); + void writeRTFReference(const QCString &label); QCString m_sourceFileName; int m_col = 0; diff --git a/src/rtfstyle.cpp b/src/rtfstyle.cpp index d279eab..07bc3dd 100644 --- a/src/rtfstyle.cpp +++ b/src/rtfstyle.cpp @@ -272,15 +272,15 @@ bool StyleData::setStyle(const std::string &command, const std::string &styleNam } -void loadStylesheet(const char *name, StyleDataMap& map) +void loadStylesheet(const QCString &name, StyleDataMap& map) { - std::ifstream file(name); + std::ifstream file(name.str()); if (!file.is_open()) { - err("Can't open RTF style sheet file %s. Using defaults.",name); + err("Can't open RTF style sheet file %s. Using defaults.",qPrint(name)); return; } - msg("Loading RTF style sheet %s...\n",name); + msg("Loading RTF style sheet %s...\n",qPrint(name)); uint lineNr=1; @@ -314,15 +314,15 @@ void loadStylesheet(const char *name, StyleDataMap& map) StyleDataMap rtf_Style; -void loadExtensions(const char *name) +void loadExtensions(const QCString &name) { - std::ifstream file(name); + std::ifstream file(name.str()); if (!file.is_open()) { - err("Can't open RTF extensions file %s. Using defaults.",name); + err("Can't open RTF extensions file %s. Using defaults.",qPrint(name)); return; } - msg("Loading RTF extensions %s...\n",name); + msg("Loading RTF extensions %s...\n",qPrint(name)); uint lineNr=1; diff --git a/src/rtfstyle.h b/src/rtfstyle.h index 903f34f..a946b37 100644 --- a/src/rtfstyle.h +++ b/src/rtfstyle.h @@ -39,6 +39,7 @@ struct RTFListItemInfo { bool isEnum; int number; + char type; }; const int rtf_maxIndentLevels = 13; @@ -80,7 +81,7 @@ using StyleDataMap = std::map<std::string,StyleData>; extern StyleDataMap rtf_Style; -void loadExtensions(const char *name); -void loadStylesheet(const char *name, StyleDataMap& map); +void loadExtensions(const QCString &name); +void loadStylesheet(const QCString &name, StyleDataMap& map); #endif diff --git a/src/scanner.h b/src/scanner.h index cefc934..57b54e6 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -31,12 +31,12 @@ class COutlineParser : public OutlineParserInterface public: COutlineParser(); virtual ~COutlineParser(); - void parseInput(const char *fileName, + void parseInput(const QCString &fileName, const char *fileBuf, const std::shared_ptr<Entry> &root, ClangTUParser *clangParser); bool needsPreprocessing(const QCString &extension) const; - void parsePrototype(const char *text); + void parsePrototype(const QCString &text); private: struct Private; std::unique_ptr<Private> p; diff --git a/src/scanner.l b/src/scanner.l index f6241c3..f03304a 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -61,7 +61,6 @@ static AtomicInt anonNSCount; struct scannerYY_state { - scannerYY_state() : docBlock(std::ios_base::ate) {} OutlineParserInterface *thisParser; CommentScanner commentScanner; const char * inputString = 0; @@ -75,6 +74,7 @@ struct scannerYY_state int lastStringContext = 0; int lastCurlyContext = 0; int lastRoundContext = 0; + int lastSharpContext = 0; int lastSquareContext = 0; int lastInitializerContext = 0; int lastClassTemplSpecContext = 0; @@ -140,6 +140,7 @@ struct scannerYY_state int currentArgumentContext = 0; int lastCopyArgStringContext = 0; int lastCopyArgContext = 0; + int requiresContext = 0; QCString *copyArgString = 0; QCString fullArgString; QCString dummyRawString; @@ -150,14 +151,15 @@ struct scannerYY_state QCString *pCopyQuotedString = 0; QCString *pCopyRoundString = 0; QCString *pCopyCurlyString = 0; + QCString *pCopySharpString = 0; QCString *pCopyRawString = 0; - std::ostringstream *pCopyCurlyGString = 0; - std::ostringstream *pCopyRoundGString = 0; - std::ostringstream *pCopySquareGString = 0; - std::ostringstream *pCopyQuotedGString = 0; - std::ostringstream *pCopyHereDocGString = 0; - std::ostringstream *pCopyRawGString = 0; - std::ostringstream *pSkipVerbString = 0; + TextStream *pCopyCurlyGString = 0; + TextStream *pCopyRoundGString = 0; + TextStream *pCopySquareGString = 0; + TextStream *pCopyQuotedGString = 0; + TextStream *pCopyHereDocGString = 0; + TextStream *pCopyRawGString = 0; + TextStream *pSkipVerbString = 0; bool insideFormula = false; bool insideTryBlock = false; @@ -171,7 +173,7 @@ struct scannerYY_state QCString briefBackup; int docBlockContext = 0; - std::ostringstream docBlock; + TextStream docBlock; QCString docBlockName; bool docBlockInBody = false; bool docBlockAutoBrief = false; @@ -384,6 +386,7 @@ NONLopt [^\n]* %x CopyGString %x CopyPHPGString %x CopyRound +%x CopySharp %x CopyCurly %x GCopyRound %x GCopySquare @@ -439,6 +442,12 @@ NONLopt [^\n]* %x DocBlock %x DocCopyBlock + /** C++20 concepts */ + +%x RequiresClause +%x RequiresExpression +%x ConceptName + %% <NextSemi>"{" { @@ -687,7 +696,7 @@ NONLopt [^\n]* } <CliPropertyType>"{" { yyextra->curlyCount=0; - //printf("event: '%s' '%s'\n",yyextra->current->type.data(),yyextra->current->name.data()); + //printf("event: '%s' '%s'\n",qPrint(yyextra->current->type),qPrint(yyextra->current->name)); BEGIN( CSAccessorDecl ); } <CliPropertyType>";" { @@ -873,14 +882,14 @@ NONLopt [^\n]* yyextra->current->argList.setNoParameters(TRUE); } yyextra->current->args = argListToString(yyextra->current->argList); - //printf("argList=%s\n",yyextra->current->args.data()); + //printf("argList=%s\n",qPrint(yyextra->current->args)); unput(';'); BEGIN( Function ); } <ObjCMethod,ObjCParams>(";"{BN}+)?"{" { // start of a method body lineCount(yyscanner); //printf("Type=%s Name=%s args=%s\n", - // yyextra->current->type.data(),yyextra->current->name.data(),argListToString(yyextra->current->argList).data() + // qPrint(yyextra->current->type),qPrint(yyextra->current->name),qPrint(argListToString(yyextra->current->argList)) // ); if (!yyextra->current->argList.empty() && yyextra->current->argList.back().type.isEmpty()) { @@ -1615,6 +1624,19 @@ NONLopt [^\n]* if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } +<FindMembers>{B}*"concept"{BN}+ { // C++20 concept + yyextra->isTypedef=FALSE; + yyextra->current->section = Entry::CONCEPT_SEC; + addType(yyscanner); + yyextra->current->type += " concept"; + yyextra->current->fileName = yyextra->yyFileName; + yyextra->current->startLine = yyextra->yyLineNr; + yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; + lineCount(yyscanner) ; + BEGIN( ConceptName ) ; + } <Operator>"("{BN}*")"({BN}*"<"[^>]*">"){BNopt}/"(" { // A::operator()<int>(int arg) lineCount(yyscanner); yyextra->current->name += "()"; @@ -1661,10 +1683,10 @@ NONLopt [^\n]* BEGIN( NSAliasArg ); } <NSAliasArg>({ID}"::")*{ID} { - //printf("Inserting namespace alias %s::%s->%s\n",yyextra->current_root->name.data(),yyextra->aliasName.data(),yytext); + //printf("Inserting namespace alias %s::%s->%s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->aliasName),yytext); // TODO: namespace aliases are now treated as global entities // while they should be aware of the scope they are in - Doxygen::namespaceAliasMap.insert({yyextra->aliasName.data(),std::string(yytext)}); + Doxygen::namespaceAliasMap.insert({yyextra->aliasName.str(),std::string(yytext)}); } <NSAliasArg>";" { BEGIN( FindMembers ); @@ -1677,7 +1699,7 @@ NONLopt [^\n]* <PHPUse>({ID}{BN}*"\\"{BN}*)*{ID} { lineCount(yyscanner); yyextra->current->name=removeRedundantWhiteSpace(substitute(yytext,"\\","::")); - //printf("PHP: adding use relation: %s\n",yyextra->current->name.data()); + //printf("PHP: adding use relation: %s\n",qPrint(yyextra->current->name)); yyextra->current->fileName = yyextra->yyFileName; // add a using declaration yyextra->current->section=Entry::USINGDECL_SEC; @@ -1694,12 +1716,12 @@ NONLopt [^\n]* <PHPUseAs>{PHPUSEKW} { } <PHPUseAs>{ID} { - //printf("PHP: adding use as relation: %s->%s\n",yytext,yyextra->aliasName.data()); + //printf("PHP: adding use as relation: %s->%s\n",yytext,qPrint(yyextra->aliasName)); if (!yyextra->aliasName.isEmpty()) { Doxygen::namespaceAliasMap.insert({yytext, std::string(removeRedundantWhiteSpace( - substitute(yyextra->aliasName,"\\","::")).data())}); + substitute(yyextra->aliasName,"\\","::")).str())}); } yyextra->aliasName.resize(0); } @@ -1734,7 +1756,7 @@ NONLopt [^\n]* } else { - //printf("import name = %s -> %s\n",yytext,yyextra->current->name.data()); + //printf("import name = %s -> %s\n",yytext,qPrint(yyextra->current->name)); yyextra->current->section=Entry::USINGDECL_SEC; } yyextra->previous = yyextra->current; @@ -1907,7 +1929,7 @@ NONLopt [^\n]* // *yyextra->currentTemplateSpec+='>'; if (yyextra->roundCount==0 && --yyextra->sharpCount<=0) { - //printf("Found %s\n",yyextra->current->name.data()); + //printf("Found %s\n",qPrint(yyextra->current->name)); BEGIN(FindMembers); } } @@ -1915,17 +1937,23 @@ NONLopt [^\n]* lineCount(yyscanner); yyextra->current->name+='>'; // *yyextra->currentTemplateSpec+='>'; - if (yyextra->roundCount==0 && --yyextra->sharpCount<=0) + --yyextra->sharpCount; + if (yyextra->roundCount==0 && yyextra->sharpCount<=0) { yyextra->current->bodyLine = yyextra->yyLineNr; yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->current->args = "("; yyextra->currentArgumentContext = FuncQual; - yyextra->fullArgString = yyextra->current->args.copy(); + yyextra->fullArgString = yyextra->current->args; yyextra->copyArgString = &yyextra->current->args; - //printf("Found %s\n",yyextra->current->name.data()); + //printf("Found %s\n",qPrint(yyextra->current->name)); BEGIN( ReadFuncArgType ) ; } + else if (yyextra->sharpCount<=0) + { + yyextra->current->name+="("; + yyextra->roundCount++; + } } <EndTemplate>">"{BNopt}/"("({BN}*{ID}{BN}*"::")*({BN}*"*"{BN}*)+ { // function pointer returning a template instance lineCount(yyscanner); @@ -2062,10 +2090,81 @@ NONLopt [^\n]* } <FindMembers>"friend"{BN}+("class"|"union"|"struct"){BN}+ { yyextra->current->name=yytext; + lineCount(yyscanner) ; BEGIN(FindMembers); } +<FindMembers>"requires" { // C++20 requires clause + yyextra->current->req.resize(0); + yyextra->requiresContext = YY_START; + BEGIN(RequiresClause); + } +<RequiresClause>"requires"{BN}*"(" { // requires requires(T x) { ... } + lineCount(yyscanner) ; + yyextra->current->req+=yytext; + yyextra->lastRoundContext=RequiresExpression; + yyextra->pCopyRoundString=&yyextra->current->req; + yyextra->roundCount=0; + BEGIN( CopyRound ) ; + } +<RequiresExpression>"{" { + yyextra->current->req+=yytext; + yyextra->lastCurlyContext=RequiresClause; + yyextra->pCopyCurlyString=&yyextra->current->req; + yyextra->curlyCount=0; + BEGIN( CopyCurly ) ; + } +<RequiresExpression>\n { + yyextra->current->req+=' '; + lineCount(yyextra); + } +<RequiresExpression>. { + yyextra->current->req+=yytext; + } +<RequiresClause>"(" { // requires "(A && B)" + yyextra->current->req+=yytext; + yyextra->lastRoundContext=RequiresClause; + yyextra->pCopyRoundString=&yyextra->current->req; + yyextra->roundCount=0; + BEGIN( CopyRound ) ; + } +<RequiresClause>{ID} { // something like "requires true" + if (yyextra->current->req.stripWhiteSpace().isEmpty()) + { + yyextra->current->req=yytext; + BEGIN(yyextra->requiresContext); + } + else + { + REJECT; + } + } +<RequiresClause>{SCOPENAME}{BNopt}"(" { // "requires func(x)" + yyextra->current->req+=yytext; + yyextra->lastRoundContext=RequiresClause; + yyextra->pCopyRoundString=&yyextra->current->req; + yyextra->roundCount=0; + BEGIN( CopyRound ); + } +<RequiresClause>{SCOPENAME}{BNopt}"<" { // "requires C<S,T>" + yyextra->current->req+=yytext; + yyextra->lastSharpContext=RequiresClause; + yyextra->pCopySharpString=&yyextra->current->req; + yyextra->sharpCount=0; + BEGIN( CopySharp ); + } +<RequiresClause>"||"|"&&" { // "requires A || B" or "requires A && B" + yyextra->current->req+=yytext; + } +<RequiresClause>{BN}+ { + yyextra->current->req+=' '; + lineCount(yyscanner) ; + } +<RequiresClause>. { + unput(*yytext); + yyextra->current->req=yyextra->current->req.simplifyWhiteSpace(); + BEGIN(yyextra->requiresContext); + } <FindMembers,FindMemberName>{SCOPENAME} { - if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC)) { yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,yytext); @@ -2353,7 +2452,7 @@ NONLopt [^\n]* yyextra->current->bodyLine = yyextra->yyLineNr; yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->currentArgumentContext = DefineEnd; - yyextra->fullArgString=yyextra->current->args.copy(); + yyextra->fullArgString=yyextra->current->args; yyextra->copyArgString=&yyextra->current->args; BEGIN( ReadFuncArgType ) ; } @@ -2379,7 +2478,7 @@ NONLopt [^\n]* BEGIN(DefineEnd); } <DefineEnd>\n { - //printf("End define: doc=%s docFile=%s docLine=%d\n",yyextra->current->doc.data(),yyextra->current->docFile.data(),yyextra->current->docLine); + //printf("End define: doc=%s docFile=%s docLine=%d\n",qPrint(yyextra->current->doc),qPrint(yyextra->current->docFile),yyextra->current->docLine); yyextra->current->fileName = yyextra->yyFileName; yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; @@ -2654,7 +2753,7 @@ NONLopt [^\n]* BEGIN(GCopyCurly); } <ReadInitializer,ReadInitializerPtr>[;,] { - //printf(">> initializer '%s' <<\n",yyextra->current->initializer.data()); + //printf(">> initializer '%s' <<\n",qPrint(yyextra->current->initializer)); if (*yytext==';' && (yyextra->current_root->spec&Entry::Enum)) { yyextra->current->fileName = yyextra->yyFileName; @@ -2699,7 +2798,7 @@ NONLopt [^\n]* yyextra->lastRawStringContext = YY_START; yyextra->pCopyRawGString = &yyextra->current->initializer; BEGIN(RawGString); - //printf("RawGString delimiter='%s'\n",delimiter.data()); + //printf("RawGString delimiter='%s'\n",qPrint(delimiter)); } } <RawGString>{RAWEND} { @@ -2943,6 +3042,59 @@ NONLopt [^\n]* *yyextra->pCopyRoundString+=*yytext; } + /* generic sharp bracket list copy rules */ +<CopySharp>\" { + *yyextra->pCopySharpString += *yytext; + yyextra->pCopyQuotedString=yyextra->pCopySharpString; + yyextra->lastStringContext=YY_START; + BEGIN(CopyString); + } +<CopySharp>"<" { + *yyextra->pCopySharpString += *yytext; + yyextra->sharpCount++; + } +<CopySharp>">" { + *yyextra->pCopySharpString += *yytext; + if (--yyextra->sharpCount<0) + { + BEGIN(yyextra->lastSharpContext); + } + } +<CopySharp>\n { + lineCount(yyscanner); + *yyextra->pCopySharpString += *yytext; + } +<CopySharp>\' { + if (yyextra->insidePHP) + { + yyextra->current->initializer << yytext; + yyextra->pCopyQuotedString = yyextra->pCopySharpString; + yyextra->lastStringContext=YY_START; + BEGIN(CopyPHPString); + } + else + { + *yyextra->pCopySharpString += yytext; + } + } +<CopySharp>{CHARLIT} { + if (yyextra->insidePHP) + { + REJECT; + } + else + { + *yyextra->pCopySharpString+=yytext; + } + } +<CopySharp>[^"'<>\n,]+ { + *yyextra->pCopySharpString+=yytext; + } +<CopySharp>. { + *yyextra->pCopySharpString+=*yytext; + } + + /* generic round bracket list copy rules for growable strings */ <GCopyRound>\" { *yyextra->pCopyRoundGString << *yytext; @@ -3200,7 +3352,12 @@ NONLopt [^\n]* yyextra->current->type.prepend("typedef "); } bool stat = yyextra->current->stat; - if (!yyextra->current->name.isEmpty() && yyextra->current->section!=Entry::ENUM_SEC) + if (yyextra->current->section==Entry::CONCEPT_SEC) // C++20 concept + { + yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ; + initEntry(yyscanner); + } + else if (!yyextra->current->name.isEmpty() && yyextra->current->section!=Entry::ENUM_SEC) { yyextra->current->type=yyextra->current->type.simplifyWhiteSpace(); yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args); @@ -3426,7 +3583,7 @@ NONLopt [^\n]* yyextra->idlProp = yytext; } <IDLProp>{BN}*{ID}{BN}*"," { // Rare: Another parameter ([propput] HRESULT Item(int index, [in] Type theRealProperty);) - if (!yyextra->current->args) + if (yyextra->current->args.isEmpty()) yyextra->current->args = "("; else yyextra->current->args += ", "; @@ -3447,7 +3604,7 @@ NONLopt [^\n]* yyextra->current->fileName = yyextra->yyFileName; yyextra->current->type = yyextra->idlProp; yyextra->current->args = yyextra->current->args.simplifyWhiteSpace(); - if (yyextra->current->args) + if (!yyextra->current->args.isEmpty()) yyextra->current->args += ")"; yyextra->current->name = yyextra->current->name.stripWhiteSpace(); yyextra->current->section = Entry::VARIABLE_SEC; @@ -3551,8 +3708,8 @@ NONLopt [^\n]* <SkipRemainder>[^\n]* <FindFields>"," { //printf("adding '%s' '%s' '%s' to enum '%s' (mGrpId=%d)\n", - // yyextra->current->type.data(), yyextra->current->name.data(), - // yyextra->current->args.data(), yyextra->current_root->name.data(),yyextra->current->mGrpId); + // qPrint(yyextra->current->type), qPrint(yyextra->current->name), + // qPrint(yyextra->current->args), qPrint(yyextra->current_root->name),yyextra->current->mGrpId); if (!yyextra->current->name.isEmpty()) { yyextra->current->fileName = yyextra->yyFileName; @@ -3573,7 +3730,7 @@ NONLopt [^\n]* { // add to the scope surrounding the enum (copy!) // we cannot during it directly as that would invalidate the iterator in parseCompounds. - //printf("*** adding outer scope entry for %s\n",yyextra->current->name.data()); + //printf("*** adding outer scope entry for %s\n",qPrint(yyextra->current->name)); yyextra->outerScopeEntries.emplace_back(yyextra->current_root->parent(), std::make_shared<Entry>(*yyextra->current)); } yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current); @@ -3710,8 +3867,8 @@ NONLopt [^\n]* yyextra->current->briefFile = briefFile; } QCString &cn = yyextra->current->name; - QCString rn = yyextra->current_root->name.copy(); - //printf("cn='%s' rn='%s' yyextra->isTypedef=%d\n",cn.data(),rn.data(),yyextra->isTypedef); + QCString rn = yyextra->current_root->name; + //printf("cn='%s' rn='%s' yyextra->isTypedef=%d\n",qPrint(cn),qPrint(rn),yyextra->isTypedef); if (!cn.isEmpty() && !rn.isEmpty()) { prependScope(yyscanner); @@ -3732,7 +3889,7 @@ NONLopt [^\n]* // was: yyextra->current->args.simplifyWhiteSpace(); yyextra->current->type = yyextra->current->type.simplifyWhiteSpace(); yyextra->current->name = yyextra->current->name.stripWhiteSpace(); - //printf("adding '%s' '%s' '%s' brief=%s yyextra->insideObjC=%d %x\n",yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data(),yyextra->current->brief.data(),yyextra->insideObjC,yyextra->current->section); + //printf("adding '%s' '%s' '%s' brief=%s yyextra->insideObjC=%d %x\n",qPrint(yyextra->current->type),qPrint(yyextra->current->name),qPrint(yyextra->current->args),qPrint(yyextra->current->brief),yyextra->insideObjC,yyextra->current->section); if (yyextra->insideObjC && ((yyextra->current->spec&Entry::Interface) || (yyextra->current->spec==Entry::Category)) ) // method definition follows @@ -3784,7 +3941,7 @@ NONLopt [^\n]* yyextra->isTypedef = TRUE; yyextra->current->endBodyLine = yyextra->yyLineNr; QCString &cn = yyextra->current->name; - QCString rn = yyextra->current_root->name.copy(); + QCString rn = yyextra->current_root->name; if (!cn.isEmpty() && !rn.isEmpty()) { prependScope(yyscanner); @@ -3805,7 +3962,7 @@ NONLopt [^\n]* prependScope(yyscanner); yyextra->current->args = yyextra->current->args.simplifyWhiteSpace(); yyextra->current->type = yyextra->current->type.simplifyWhiteSpace(); - //printf("Adding compound %s %s %s\n",yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data()); + //printf("Adding compound %s %s %s\n",qPrint(yyextra->current->type),qPrint(yyextra->current->name),qPrint(yyextra->current->args)); if (!yyextra->firstTypedefEntry) { yyextra->firstTypedefEntry = yyextra->current; @@ -3884,13 +4041,13 @@ NONLopt [^\n]* // only look for class scopes, not namespace scopes if ((p->section & Entry::COMPOUND_MASK) && !p->name.isEmpty()) { - //printf("Trying scope '%s'\n",p->name.data()); + //printf("Trying scope '%s'\n",qPrint(p->name)); int i=p->name.findRev("::"); int pi = (i==-1) ? 0 : i+2; if (p->name.at(pi)=='@') { // anonymous compound yyextra->inside -> insert dummy variable name - //printf("Adding anonymous variable for scope %s\n",p->name.data()); + //printf("Adding anonymous variable for scope %s\n",qPrint(p->name)); yyextra->msName.sprintf("@%d",anonCount++); break; } @@ -3899,7 +4056,7 @@ NONLopt [^\n]* if (p==yyextra->current.get()) p=yyextra->current_root.get(); else p=p->parent(); } } - //printf("yyextra->msName=%s yyextra->current->name=%s\n",yyextra->msName.data(),yyextra->current->name.data()); + //printf("yyextra->msName=%s yyextra->current->name=%s\n",qPrint(yyextra->msName),qPrint(yyextra->current->name)); if (!yyextra->msName.isEmpty() /*&& yyextra->msName!=yyextra->current->name*/) // skip typedef T {} T;, removed due to bug608493 { @@ -3930,7 +4087,7 @@ NONLopt [^\n]* if (yyextra->isTypedef) { varEntry->type.prepend("typedef "); - // //printf("yyextra->current->name = %s %s\n",yyextra->current->name.data(),yyextra->msName.data()); + // //printf("yyextra->current->name = %s %s\n",qPrint(yyextra->current->name),qPrint(yyextra->msName)); } if (typedefHidesStruct && yyextra->isTypedef && @@ -3947,16 +4104,16 @@ NONLopt [^\n]* varEntry->fileName = yyextra->yyFileName; varEntry->startLine = yyextra->yyLineNr; varEntry->startColumn = yyextra->yyColNr; - varEntry->doc = yyextra->current->doc.copy(); - varEntry->brief = yyextra->current->brief.copy(); + varEntry->doc = yyextra->current->doc; + varEntry->brief = yyextra->current->brief; varEntry->mGrpId = yyextra->current->mGrpId; varEntry->initializer.str(yyextra->current->initializer.str()); varEntry->groups = yyextra->current->groups; varEntry->sli = yyextra->current->sli; //printf("Add: type='%s',name='%s',args='%s' brief=%s doc=%s\n", - // varEntry->type.data(),varEntry->name.data(), - // varEntry->args.data(),varEntry->brief.data(),varEntry->doc.data()); + // qPrint(varEntry->type),qPrint(varEntry->name), + // qPrint(varEntry->args),qPrint(varEntry->brief),qPrint(varEntry->doc)); yyextra->current_root->moveToSubEntryAndKeep(varEntry); } } @@ -4076,7 +4233,7 @@ NONLopt [^\n]* } <EndFuncPtr>")"{BNopt}/";" { // a variable with extra braces lineCount(yyscanner); - yyextra->current->type+=yyextra->funcPtrType.data()+1; + yyextra->current->type+=yyextra->funcPtrType.mid(1); BEGIN(FindMembers); } <EndFuncPtr>")"{BNopt}/"(" { // a function pointer @@ -4086,7 +4243,7 @@ NONLopt [^\n]* } <EndFuncPtr>")"{BNopt}/"[" { // an array of variables lineCount(yyscanner); - yyextra->current->type+=yyextra->funcPtrType.data(); + yyextra->current->type+=yyextra->funcPtrType; yyextra->current->args += ")"; BEGIN(FindMembers); } @@ -4098,7 +4255,7 @@ NONLopt [^\n]* yyextra->current->bodyLine = yyextra->yyLineNr; yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->currentArgumentContext = FuncFuncEnd; - yyextra->fullArgString=yyextra->current->args.copy(); + yyextra->fullArgString=yyextra->current->args; yyextra->copyArgString=&yyextra->current->args; BEGIN( ReadFuncArgType ) ; } @@ -4128,7 +4285,7 @@ NONLopt [^\n]* } <FuncFuncEnd>")"{BNopt}/[;{] { lineCount(yyscanner); - yyextra->current->type+=yyextra->funcPtrType.data()+1; + yyextra->current->type+=yyextra->funcPtrType.mid(1); BEGIN(Function); } <FuncFuncEnd>")"{BNopt}/"[" { // function returning a pointer to an array @@ -4170,7 +4327,7 @@ NONLopt [^\n]* yyextra->current->bodyLine = yyextra->yyLineNr; yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->currentArgumentContext = FuncQual; - yyextra->fullArgString=yyextra->current->args.copy(); + yyextra->fullArgString=yyextra->current->args; yyextra->copyArgString=&yyextra->current->args; BEGIN( ReadFuncArgType ) ; //printf(">>> Read function arguments!\n"); @@ -4191,7 +4348,7 @@ NONLopt [^\n]* yyextra->current->bodyLine = yyextra->yyLineNr; yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->currentArgumentContext = FuncQual; - yyextra->fullArgString=yyextra->current->args.copy(); + yyextra->fullArgString=yyextra->current->args; yyextra->copyArgString=&yyextra->current->args; BEGIN( ReadFuncArgType ) ; //printf(">>> Read function arguments yyextra->current->argList.size()=%d\n",yyextra->current->argList.size()); @@ -4407,7 +4564,7 @@ NONLopt [^\n]* <ReadTempArgs>">" { *yyextra->copyArgString+=*yytext; yyextra->fullArgString+=*yytext; - //printf("end template list '%s'\n",yyextra->copyArgString->data()); + //printf("end template list '%s'\n",qPrint(*yyextra->copyArgString)); *yyextra->currentArgumentList = *stringToArgumentList(yyextra->language, yyextra->fullArgString); BEGIN( yyextra->currentArgumentContext ); } @@ -4622,6 +4779,11 @@ NONLopt [^\n]* unput(*yytext); BEGIN(FuncQual); } +<TrailingReturn>"requires"{BN}+ { + yyextra->requiresContext = FuncQual; + yyextra->current->req+=' '; + BEGIN(RequiresClause); + } <TrailingReturn>"(" { yyextra->roundCount++; yyextra->current->argList.setTrailingReturnType(yyextra->current->argList.trailingReturnType()+yytext); @@ -4636,7 +4798,7 @@ NONLopt [^\n]* { warn(yyextra->yyFileName,yyextra->yyLineNr, "Found ')' without opening '(' for trailing return type '%s)...'", - yyextra->current->argList.trailingReturnType().data()); + qPrint(yyextra->current->argList.trailingReturnType())); } yyextra->current->argList.setTrailingReturnType(yyextra->current->argList.trailingReturnType()+yytext); yyextra->current->args+=yytext; @@ -4729,8 +4891,15 @@ NONLopt [^\n]* yyextra->current->args += *yytext; lineCount(yyscanner); } -<FuncQual>{ID} { // typically a K&R style C function - if (yyextra->insideCS && qstrcmp(yytext,"where")==0) +<FuncQual>{ID} { + if (yyextra->insideCpp && qstrcmp(yytext,"requires")==0) + { + // c++20 trailing requires clause + yyextra->requiresContext = YY_START; + yyextra->current->req+=' '; + BEGIN(RequiresClause); + } + else if (yyextra->insideCS && qstrcmp(yytext,"where")==0) { // type constraint for a method yyextra->current->typeConstr.clear(); @@ -4738,7 +4907,7 @@ NONLopt [^\n]* yyextra->lastCSConstraint = YY_START; BEGIN( CSConstraintName ); } - else if (checkForKnRstyleC(yyscanner)) + else if (checkForKnRstyleC(yyscanner)) // K&R style C function { yyextra->current->args = yytext; yyextra->oldStyleArgType.resize(0); @@ -4756,12 +4925,12 @@ NONLopt [^\n]* QCString doc,brief; if (yyextra->current->doc!=yyextra->docBackup) { - doc=yyextra->current->doc.copy(); + doc=yyextra->current->doc; yyextra->current->doc=yyextra->docBackup; } if (yyextra->current->brief!=yyextra->briefBackup) { - brief=yyextra->current->brief.copy(); + brief=yyextra->current->brief; yyextra->current->brief=yyextra->briefBackup; } addKnRArgInfo(yyscanner,yyextra->oldStyleArgType+oldStyleArgPtr, @@ -4868,7 +5037,7 @@ NONLopt [^\n]* (!isFunction || yyextra->current->type.left(8)=="typedef ")); //printf("type=%s ts=%d te=%d ti=%d isFunction=%d\n", - // yyextra->current->type.data(),ts,te,ti,isFunction); + // qPrint(yyextra->current->type),ts,te,ti,isFunction); if (*yytext!=';' || (yyextra->current_root->section&Entry::COMPOUND_MASK) ) { @@ -4877,7 +5046,7 @@ NONLopt [^\n]* if (tempArg==-1) tempName=yyextra->current->name; else tempName=yyextra->current->name.left(tempArg); if (isVariable) { - //printf("Scanner.l: found in class variable: '%s' '%s' '%s'\n", yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data()); + //printf("Scanner.l: found in class variable: '%s' '%s' '%s'\n", qPrint(yyextra->current->type),qPrint(yyextra->current->name),qPrint(yyextra->current->args)); if (yyextra->isTypedef && yyextra->current->type.left(8)!="typedef ") { yyextra->current->type.prepend("typedef "); @@ -4886,14 +5055,14 @@ NONLopt [^\n]* } else { - //printf("Scanner.l: found in class function: '%s' '%s' '%s'\n", yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data()); + //printf("Scanner.l: found in class function: '%s' '%s' '%s'\n", qPrint(yyextra->current->type),qPrint(yyextra->current->name),qPrint(yyextra->current->args)); yyextra->current->section = Entry::FUNCTION_SEC ; yyextra->current->proto = *yytext==';'; } } else // a global function prototype or function variable { - //printf("Scanner.l: prototype? type='%s' name='%s' args='%s'\n",yyextra->current->type.data(),yyextra->current->name.data(),yyextra->current->args.data()); + //printf("Scanner.l: prototype? type='%s' name='%s' args='%s'\n",qPrint(yyextra->current->type),qPrint(yyextra->current->name),qPrint(yyextra->current->args)); if (isVariable) { if (yyextra->isTypedef && yyextra->current->type.left(8)!="typedef ") @@ -4910,7 +5079,7 @@ NONLopt [^\n]* yyextra->current->proto = TRUE; } } - //printf("Adding entry '%s'\n",yyextra->current->name.data()); + //printf("Adding entry '%s'\n",qPrint(yyextra->current->name)); if ( yyextra->insidePHP) { if (findAndRemoveWord(yyextra->current->type,"final")) @@ -5111,7 +5280,7 @@ NONLopt [^\n]* } <SkipCurly,SkipCurlyCpp>{B}*{RAWBEGIN} { QCString raw=QCString(yytext).stripWhiteSpace(); - yyextra->delimiter = raw.data()+2; + yyextra->delimiter = raw.mid(2); yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1); yyextra->lastRawStringContext = YY_START; yyextra->dummyRawString.resize(0); @@ -5312,9 +5481,9 @@ NONLopt [^\n]* // a purpose of its own yyextra->current->name = yytext; yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace(); - //printf("template class declaration for %s!\n",yyextra->current->name.data()); - QCString rn = yyextra->current_root->name.copy(); - //printf("cn='%s' rn='%s' yyextra->isTypedef=%d\n",cn.data(),rn.data(),yyextra->isTypedef); + //printf("template class declaration for %s!\n",qPrint(yyextra->current->name)); + QCString rn = yyextra->current_root->name; + //printf("cn='%s' rn='%s' yyextra->isTypedef=%d\n",qPrint(cn),qPrint(rn),yyextra->isTypedef); if (!yyextra->current->name.isEmpty() && !rn.isEmpty()) { prependScope(yyscanner); @@ -5388,6 +5557,17 @@ NONLopt [^\n]* } <AlignAsEnd>\n { lineCount(yyscanner); } <AlignAsEnd>. +<ConceptName>{ID} { + yyextra->current->name = yytext ; + } +<ConceptName>"=" { + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; + yyextra->current->initializer.str(std::string()); + yyextra->lastInitializerContext = FindMembers; + yyextra->initBracketCount=0; + BEGIN(ReadInitializer); + } <CompoundName>{SCOPENAME}/{BN}*"," { // multiple forward declarations on one line // e.g. @protocol A,B; yyextra->current->reset(); @@ -6545,7 +6725,7 @@ NONLopt [^\n]* warn(yyextra->yyFileName,yyextra->yyLineNr, "reached end of file while inside a '%s' block!\n" "The command that should end the block seems to be missing!\n", - yyextra->docBlockName.data()); + qPrint(yyextra->docBlockName)); yyterminate(); } @@ -6558,7 +6738,7 @@ NONLopt [^\n]* <Prototype>"(" { yyextra->current->args+=*yytext; yyextra->currentArgumentContext = PrototypeQual; - yyextra->fullArgString = yyextra->current->args.copy(); + yyextra->fullArgString = yyextra->current->args; yyextra->copyArgString = &yyextra->current->args; BEGIN( ReadFuncArgType ) ; } @@ -6580,7 +6760,7 @@ NONLopt [^\n]* <PrototypePtr>"(" { yyextra->current->args+=*yytext; yyextra->currentArgumentContext = PrototypeQual; - yyextra->fullArgString = yyextra->current->args.copy(); + yyextra->fullArgString = yyextra->current->args; yyextra->copyArgString = &yyextra->current->args; BEGIN( ReadFuncArgType ) ; } @@ -6868,7 +7048,7 @@ static void setContext(yyscan_t yyscanner) yyextra->language==SrcLangExt_Lex); //printf("setContext(%s) yyextra->insideIDL=%d yyextra->insideJava=%d yyextra->insideCS=%d " // "yyextra->insideD=%d yyextra->insidePHP=%d yyextra->insideObjC=%d\n", - // yyextra->yyFileName.data(),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC + // qPrint(yyextra->yyFileName),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC // ); } @@ -6879,7 +7059,7 @@ static void prependScope(yyscan_t yyscanner) struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (yyextra->current_root->section & Entry::SCOPE_MASK) { - //printf("--- prependScope %s to %s\n",yyextra->current_root->name.data(),yyextra->current->name.data()); + //printf("--- prependScope %s to %s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->current->name)); yyextra->current->name.prepend(yyextra->current_root->name+"::"); //printf("prependScope #=%d #yyextra->current=%d\n",yyextra->current_root->tArgLists->count(),yyextra->current->tArgLists->count()); for (const ArgumentList &srcAl : yyextra->current_root->tArgLists) @@ -6970,7 +7150,7 @@ static void splitKnRArg(yyscan_t yyscanner,QCString &oldStyleArgPtr,QCString &ol } else { - oldStyleArgName=yyextra->current->args.copy().stripWhiteSpace(); + oldStyleArgName=yyextra->current->args.stripWhiteSpace(); } } } @@ -6986,7 +7166,7 @@ static void splitKnRArg(yyscan_t yyscanner,QCString &oldStyleArgPtr,QCString &ol } else { - oldStyleArgName=yyextra->current->args.copy().stripWhiteSpace(); + oldStyleArgName=yyextra->current->args.stripWhiteSpace(); } } } @@ -7085,7 +7265,7 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS); if (yyextra->docBlockInBody && hideInBodyDocs) return; - //printf("parseCommentBlock [%s] brief=%d\n",doc.data(),brief); + //printf("parseCommentBlock [%s] brief=%d\n",qPrint(doc),brief); int lineNr = brief ? yyextra->current->briefLine : yyextra->current->docLine; // line of block start // fill in inbodyFile && inbodyLine the first time, see bug 633891 @@ -7117,7 +7297,7 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief ) ) { - //printf("parseCommentBlock position=%d [%s]\n",position,doc.data()+position); + //printf("parseCommentBlock position=%d [%s]\n",position,qPrint(doc)+position); if (needsEntry) { QCString docFile = yyextra->current->docFile; @@ -7144,10 +7324,10 @@ static void handleParametersCommentBlocks(yyscan_t yyscanner,ArgumentList &al) //printf(">>>>>>> handleParametersCommentBlocks()\n"); for (Argument &a : al) { - //printf(" Param %s docs=%s\n",a->name.data(),a->docs.data()); + //printf(" Param %s docs=%s\n",qPrint(a->name),qPrint(a->docs)); if (!a.docs.isEmpty()) { - if (!a.name && a.type == "...") a.name= "..."; + if (a.name.isEmpty() && a.type == "...") a.name= "..."; int position=0; bool needsEntry; @@ -7160,7 +7340,7 @@ static void handleParametersCommentBlocks(yyscan_t yyscanner,ArgumentList &al) yyextra->current->doc.resize(0); yyextra->current->brief.resize(0); - //printf("handleParametersCommentBlock [%s]\n",doc.data()); + //printf("handleParametersCommentBlock [%s]\n",qPrint(doc)); while (yyextra->commentScanner.parseCommentBlock( yyextra->thisParser, yyextra->current.get(), @@ -7177,7 +7357,7 @@ static void handleParametersCommentBlocks(yyscan_t yyscanner,ArgumentList &al) ) ) { - //printf("handleParametersCommentBlock position=%d [%s]\n",position,doc.data()+position); + //printf("handleParametersCommentBlock position=%d [%s]\n",position,qPrint(doc)+position); if (needsEntry) newEntry(yyscanner); } if (needsEntry) @@ -7201,19 +7381,19 @@ static void handleParametersCommentBlocks(yyscan_t yyscanner,ArgumentList &al) static void parseCompounds(yyscan_t yyscanner,const std::shared_ptr<Entry> &rt) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - //printf("parseCompounds(%s)\n",rt->name.data()); + //printf("parseCompounds(%s)\n",qPrint(rt->name)); for (const auto &ce : rt->children()) { - if (ce->program.tellp() != std::streampos(0)) + if (!ce->program.empty()) { //printf("-- %s ---------\n%s\n---------------\n", - // ce->name.data(),ce->program.data()); + // qPrint(ce->name),qPrint(ce->program)); // init scanner state yyextra->padCount=0; //depthIf = 0; yyextra->column=0; yyextra->programStr = ce->program.str(); - yyextra->inputString = yyextra->programStr; + yyextra->inputString = yyextra->programStr.data(); yyextra->inputPosition = 0; if (ce->section==Entry::ENUM_SEC || (ce->spec&Entry::Enum)) BEGIN( FindFields ) ; @@ -7283,7 +7463,7 @@ static void parseCompounds(yyscan_t yyscanner,const std::shared_ptr<Entry> &rt) } yyextra->mtype = Method; yyextra->virt = Normal; - //printf("name=%s yyextra->current->stat=%d yyextra->stat=%d\n",ce->name.data(),yyextra->current->stat,yyextra->stat); + //printf("name=%s yyextra->current->stat=%d yyextra->stat=%d\n",qPrint(ce->name),yyextra->current->stat,yyextra->stat); //memberGroupId = DOX_NOGROUP; //memberGroupRelates.resize(0); @@ -7313,7 +7493,7 @@ static void parseCompounds(yyscan_t yyscanner,const std::shared_ptr<Entry> &rt) //---------------------------------------------------------------------------- static void parseMain(yyscan_t yyscanner, - const char *fileName, + const QCString &fileName, const char *fileBuf, const std::shared_ptr<Entry> &rt, ClangTUParser *clangParser) @@ -7339,7 +7519,7 @@ static void parseMain(yyscan_t yyscanner, yyextra->clangParser = clangParser; setContext(yyscanner); rt->lang = yyextra->language; - msg("Parsing file %s...\n",yyextra->yyFileName.data()); + msg("Parsing file %s...\n",qPrint(yyextra->yyFileName)); yyextra->current_root = rt; initParser(yyscanner); @@ -7385,7 +7565,7 @@ static void parseMain(yyscan_t yyscanner, // add additional entries that were created during processing for (auto &kv: yyextra->outerScopeEntries) { - //printf(">>> adding '%s' to scope '%s'\n",kv.second->name.data(),kv.first->name.data()); + //printf(">>> adding '%s' to scope '%s'\n",qPrint(kv.second->name),qPrint(kv.first->name)); kv.first->moveToSubEntryAndKeep(kv.second); } yyextra->outerScopeEntries.clear(); @@ -7397,7 +7577,7 @@ static void parseMain(yyscan_t yyscanner, static void parsePrototype(yyscan_t yyscanner,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - //printf("**** parsePrototype(%s) begin\n",text.data()); + //printf("**** parsePrototype(%s) begin\n",qPrint(text)); if (text.isEmpty()) { warn(yyextra->yyFileName,yyextra->yyLineNr,"Empty prototype found!"); @@ -7419,7 +7599,7 @@ static void parsePrototype(yyscan_t yyscanner,const QCString &text) orgInputPosition = yyextra->inputPosition; // set new string - yyextra->inputString = text; + yyextra->inputString = text.data(); yyextra->inputPosition = 0; yyextra->column = 0; scannerYYrestart(0, yyscanner); @@ -7475,19 +7655,19 @@ COutlineParser::~COutlineParser() scannerYYlex_destroy(p->yyscanner); } -void COutlineParser::parseInput(const char *fileName, - const char *fileBuf, - const std::shared_ptr<Entry> &root, - ClangTUParser *clangParser) +void COutlineParser::parseInput(const QCString &fileName, + const char *fileBuf, + const std::shared_ptr<Entry> &root, + ClangTUParser *clangParser) { struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; yyextra->thisParser = this; - printlex(yy_flex_debug, TRUE, __FILE__, fileName); + printlex(yy_flex_debug, TRUE, __FILE__, qPrint(fileName)); ::parseMain(p->yyscanner,fileName,fileBuf,root,clangParser); - printlex(yy_flex_debug, FALSE, __FILE__, fileName); + printlex(yy_flex_debug, FALSE, __FILE__, qPrint(fileName)); } @@ -7501,7 +7681,7 @@ bool COutlineParser::needsPreprocessing(const QCString &extension) const ); } -void COutlineParser::parsePrototype(const char *text) +void COutlineParser::parsePrototype(const QCString &text) { ::parsePrototype(p->yyscanner,text); } diff --git a/src/scopedtypevariant.h b/src/scopedtypevariant.h index 16de7f6..a1bece7 100644 --- a/src/scopedtypevariant.h +++ b/src/scopedtypevariant.h @@ -278,7 +278,7 @@ class CallContext void clear() { m_stvList.clear(); - m_stvList.push_back(Ctx("","")); + m_stvList.push_back(Ctx(QCString(),QCString())); } const ScopedTypeVariant getScope() const { diff --git a/src/searchindex.cpp b/src/searchindex.cpp index 6b83940..cf09e67 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -36,6 +36,7 @@ #include "namespacedef.h" #include "classdef.h" #include "utf8.h" +#include "classlist.h" //--------------------------------------------------------------------------------------------- // the following part is for the server based search engine @@ -81,7 +82,7 @@ SearchIndex::SearchIndex() : SearchIndexIntf(Internal) m_index.resize(numIndexEntries); } -void SearchIndex::setCurrentDoc(const Definition *ctx,const char *anchor,bool isSourceFile) +void SearchIndex::setCurrentDoc(const Definition *ctx,const QCString &anchor,bool isSourceFile) { if (ctx==0) return; assert(!isSourceFile || ctx->definitionType()==Definition::TypeFile); @@ -89,7 +90,7 @@ void SearchIndex::setCurrentDoc(const Definition *ctx,const char *anchor,bool is QCString url=isSourceFile ? (toFileDef(ctx))->getSourceFileBase() : ctx->getOutputFileBase(); url+=Config_getString(HTML_FILE_EXTENSION); QCString baseUrl = url; - if (anchor) url+=QCString("#")+anchor; + if (!anchor.isEmpty()) url+=QCString("#")+anchor; if (!isSourceFile) baseUrl=url; QCString name=ctx->qualifiedName(); if (ctx->definitionType()==Definition::TypeMember) @@ -147,7 +148,7 @@ void SearchIndex::setCurrentDoc(const Definition *ctx,const char *anchor,bool is case Definition::TypeGroup: { const GroupDef *gd = toGroupDef(ctx); - if (gd->groupTitle()) + if (!gd->groupTitle().isEmpty()) { name = theTranslator->trGroup(TRUE,TRUE)+" "+gd->groupTitle(); } @@ -175,9 +176,9 @@ void SearchIndex::setCurrentDoc(const Definition *ctx,const char *anchor,bool is } } -static int charsToIndex(const char *word) +static int charsToIndex(const QCString &word) { - if (word==0) return -1; + if (word.length()<2) return -1; // Fast string hashing algorithm //register ushort h=0; @@ -190,18 +191,16 @@ static int charsToIndex(const char *word) //return h; // Simple hashing that allows for substring searching - uint c1=((uchar *)word)[0]; - if (c1==0) return -1; - uint c2=((uchar *)word)[1]; - if (c2==0) return -1; + uint c1=(uchar)word[0]; + uint c2=(uchar)word[1]; return c1*256+c2; } -void SearchIndex::addWord(const char *word,bool hiPriority,bool recurse) +void SearchIndex::addWord(const QCString &word,bool hiPriority,bool recurse) { - if (word==0 || word[0]=='\0') return; + if (word.isEmpty()) return; QCString wStr = QCString(word).lower(); - //printf("SearchIndex::addWord(%s,%d) wStr=%s\n",word,hiPriority,wStr.data()); + //printf("SearchIndex::addWord(%s,%d) wStr=%s\n",word,hiPriority,qPrint(wStr)); int idx=charsToIndex(wStr); if (idx<0 || idx>=static_cast<int>(m_index.size())) return; auto it = m_words.find(wStr.str()); @@ -219,7 +218,7 @@ void SearchIndex::addWord(const char *word,bool hiPriority,bool recurse) i=getPrefixIndex(word); if (i>0) { - addWord(word+i,hiPriority,TRUE); + addWord(word.data()+i,hiPriority,TRUE); found=TRUE; } } @@ -234,12 +233,12 @@ void SearchIndex::addWord(const char *word,bool hiPriority,bool recurse) } if (word[i]!=0 && i>=1) { - addWord(word+i+1,hiPriority,TRUE); + addWord(word.data()+i+1,hiPriority,TRUE); } } } -void SearchIndex::addWord(const char *word,bool hiPriority) +void SearchIndex::addWord(const QCString &word,bool hiPriority) { addWord(word,hiPriority,FALSE); } @@ -252,14 +251,14 @@ static void writeInt(std::ostream &f,size_t index) f.put(static_cast<int>(index&0xff)); } -static void writeString(std::ostream &f,const char *s) +static void writeString(std::ostream &f,const QCString &s) { - const char *p = s; - while (*p) f.put(*p++); + uint l = s.length(); + for (uint i=0;i<l;i++) f.put(s[i]); f.put(0); } -void SearchIndex::write(const char *fileName) +void SearchIndex::write(const QCString &fileName) { size_t i; size_t size=4; // for the header @@ -332,7 +331,7 @@ void SearchIndex::write(const char *fileName) } //printf("Total size %x bytes (word=%x stats=%x urls=%x)\n",size,wordsOffset,statsOffset,urlsOffset); - std::ofstream f(fileName,std::ofstream::out | std::ofstream::binary); + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); if (f.is_open()) { // write header @@ -452,6 +451,8 @@ static QCString definitionToName(const Definition *ctx) return "file"; case Definition::TypeNamespace: return "namespace"; + case Definition::TypeConcept: + return "concept"; case Definition::TypeGroup: return "group"; case Definition::TypePackage: @@ -467,12 +468,12 @@ static QCString definitionToName(const Definition *ctx) return "unknown"; } -void SearchIndexExternal::setCurrentDoc(const Definition *ctx,const char *anchor,bool isSourceFile) +void SearchIndexExternal::setCurrentDoc(const Definition *ctx,const QCString &anchor,bool isSourceFile) { static QCString extId = stripPath(Config_getString(EXTERNAL_SEARCH_ID)); QCString baseName = isSourceFile ? (toFileDef(ctx))->getSourceFileBase() : ctx->getOutputFileBase(); QCString url = baseName + Doxygen::htmlFileExtension; - if (anchor) url+=QCString("#")+anchor; + if (!anchor.isEmpty()) url+=QCString("#")+anchor; QCString key = extId+";"+url; auto it = p->docEntries.find(key.str()); @@ -488,23 +489,23 @@ void SearchIndexExternal::setCurrentDoc(const Definition *ctx,const char *anchor e.extId = extId; e.url = url; it = p->docEntries.insert({key.str(),e}).first; - //printf("searchIndexExt %s : %s\n",e->name.data(),e->url.data()); + //printf("searchIndexExt %s : %s\n",qPrint(e->name),qPrint(e->url)); } p->current = &it->second; } -void SearchIndexExternal::addWord(const char *word,bool hiPriority) +void SearchIndexExternal::addWord(const QCString &word,bool hiPriority) { - if (word==0 || !isId(*word) || p->current==0) return; + if (word.isEmpty() || !isId(word[0]) || p->current==0) return; GrowBuf *pText = hiPriority ? &p->current->importantText : &p->current->normalText; if (pText->getPos()>0) pText->addChar(' '); pText->addStr(word); //printf("addWord %s\n",word); } -void SearchIndexExternal::write(const char *fileName) +void SearchIndexExternal::write(const QCString &fileName) { - std::ofstream t(fileName,std::ofstream::out | std::ofstream::binary); + std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); if (t.is_open()) { t << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; @@ -534,7 +535,7 @@ void SearchIndexExternal::write(const char *fileName) } else { - err("Failed to open file %s for writing!\n",fileName); + err("Failed to open file %s for writing!\n",qPrint(fileName)); } } @@ -552,10 +553,10 @@ QCString searchName(const Definition *d) QCString searchId(const Definition *d) { std::string s = searchName(d).str(); - std::ostringstream t(std::ios_base::ate); + TextStream t; for (size_t i=0;i<s.length();i++) { - if (isId(s[i])) + if (isIdJS(s[i])) { t << s[i]; } @@ -593,6 +594,7 @@ QCString searchId(const Definition *d) #define SEARCH_INDEX_DEFINES 17 #define SEARCH_INDEX_GROUPS 18 #define SEARCH_INDEX_PAGES 19 +#define SEARCH_INDEX_CONCEPTS 20 static std::array<SearchIndexInfo,NUM_SEARCH_INDICES> g_searchIndexInfo = { { @@ -622,7 +624,8 @@ static std::array<SearchIndexInfo,NUM_SEARCH_INDICES> g_searchIndexInfo = { /* SEARCH_INDEX_RELATED */ "related" , []() { return theTranslator->trFriends(); }, {} }, { /* SEARCH_INDEX_DEFINES */ "defines" , []() { return theTranslator->trDefines(); }, {} }, { /* SEARCH_INDEX_GROUPS */ "groups" , []() { return theTranslator->trGroup(TRUE,FALSE); }, {} }, - { /* SEARCH_INDEX_PAGES */ "pages" , []() { return theTranslator->trPage(TRUE,FALSE); }, {} } + { /* SEARCH_INDEX_PAGES */ "pages" , []() { return theTranslator->trPage(TRUE,FALSE); }, {} }, + { /* SEARCH_INDEX_CONCEPTS */ "concepts" , []() { return theTranslator->trConcept(true,false); }, {} } } }; static void addMemberToSearchIndex(const MemberDef *md) @@ -791,6 +794,17 @@ void createJavaScriptSearchIndex() } } + // index concepts + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + std::string letter = convertUTF8ToLower(getUTF8CharAt(cd->name().str(),0)); + if (cd->isLinkable()) + { + g_searchIndexInfo[SEARCH_INDEX_ALL].add(letter,cd.get()); + g_searchIndexInfo[SEARCH_INDEX_CONCEPTS].add(letter,cd.get()); + } + } + // index files for (const auto &fn : *Doxygen::inputNameLinkedMap) { @@ -836,7 +850,7 @@ void createJavaScriptSearchIndex() { if (gd->isLinkable()) { - std::string title = gd->groupTitle(); + std::string title = gd->groupTitle().str(); if (!title.empty()) // TODO: able searching for all word in the title { std::string letter = convertUTF8ToLower(getUTF8CharAt(title,0)); @@ -1114,7 +1128,7 @@ void writeJavaScriptSearchIndex() } else { - err("Failed to open file '%s' for writing...\n",fileName.data()); + err("Failed to open file '%s' for writing...\n",qPrint(fileName)); } p++; } @@ -1205,7 +1219,7 @@ void writeJavaScriptSearchIndex() void SearchIndexInfo::add(const std::string &letter,const Definition *def) { - //printf("%p: %s->%s (full=%s)\n",this,letter.data(),searchName(def).data(),def->name().data()); + //printf("%p: %s->%s (full=%s)\n",this,qPrint(letter),qPrint(searchName(def)),qPrint(def->name())); auto it = symbolMap.find(letter); if (it!=symbolMap.end()) { diff --git a/src/searchindex.h b/src/searchindex.h index ee56b08..893440e 100644 --- a/src/searchindex.h +++ b/src/searchindex.h @@ -70,9 +70,9 @@ class SearchIndexIntf enum Kind { Internal, External }; SearchIndexIntf(Kind k) : m_kind(k) {} virtual ~SearchIndexIntf() {} - virtual void setCurrentDoc(const Definition *ctx,const char *anchor,bool isSourceFile) = 0; - virtual void addWord(const char *word,bool hiPriority) = 0; - virtual void write(const char *file) = 0; + virtual void setCurrentDoc(const Definition *ctx,const QCString &anchor,bool isSourceFile) = 0; + virtual void addWord(const QCString &word,bool hiPriority) = 0; + virtual void write(const QCString &file) = 0; Kind kind() const { return m_kind; } private: Kind m_kind; @@ -82,11 +82,11 @@ class SearchIndex : public SearchIndexIntf { public: SearchIndex(); - void setCurrentDoc(const Definition *ctx,const char *anchor,bool isSourceFile) override; - void addWord(const char *word,bool hiPriority) override; - void write(const char *file) override; + void setCurrentDoc(const Definition *ctx,const QCString &anchor,bool isSourceFile) override; + void addWord(const QCString &word,bool hiPriority) override; + void write(const QCString &file) override; private: - void addWord(const char *word,bool hiPrio,bool recurse); + void addWord(const QCString &word,bool hiPrio,bool recurse); std::unordered_map<std::string,int> m_words; std::vector< std::vector< IndexWord> > m_index; std::unordered_map<std::string,int> m_url2IdMap; @@ -100,16 +100,16 @@ class SearchIndexExternal : public SearchIndexIntf struct Private; public: SearchIndexExternal(); - void setCurrentDoc(const Definition *ctx,const char *anchor,bool isSourceFile); - void addWord(const char *word,bool hiPriority); - void write(const char *file); + void setCurrentDoc(const Definition *ctx,const QCString &anchor,bool isSourceFile); + void addWord(const QCString &word,bool hiPriority); + void write(const QCString &file); private: std::unique_ptr<Private> p; }; //------- client side search index ---------------------- -#define NUM_SEARCH_INDICES 20 +#define NUM_SEARCH_INDICES 21 QCString searchId(const Definition *d); QCString searchName(const Definition *d); diff --git a/src/section.h b/src/section.h index 562f54a..e5bbfc5 100644 --- a/src/section.h +++ b/src/section.h @@ -49,8 +49,8 @@ inline constexpr bool isSection(SectionType type) class SectionInfo { public: - SectionInfo(const char *label, const char *fileName, int lineNr, - const char *title, SectionType type, int level,const char *ref) : + SectionInfo(const QCString &label, const QCString &fileName, int lineNr, + const QCString &title, SectionType type, int level,const QCString &ref) : m_label(label), m_title(title), m_type(type), m_ref(ref), m_lineNr(lineNr), m_fileName(fileName), m_level(level) { @@ -73,10 +73,10 @@ class SectionInfo Definition *definition() const { return m_definition; } // setters - void setFileName(const char *fn) { m_fileName = fn; } - void setType(SectionType t) { m_type = t; } - void setGenerated(bool b) { m_generated = b; } - void setDefinition(Definition *d) { m_definition = d; } + void setFileName(const QCString &fn) { m_fileName = fn; } + void setType(SectionType t) { m_type = t; } + void setGenerated(bool b) { m_generated = b; } + void setDefinition(Definition *d) { m_definition = d; } private: QCString m_label; @@ -99,9 +99,9 @@ class SectionRefs //! Returns a constant pointer to the section info given a section label or nullptr //! if no section with the given label can be found. - const SectionInfo *find(const char *label) const + const SectionInfo *find(const QCString &label) const { - auto it = m_lookup.find(label); + auto it = m_lookup.find(label.str()); return it!=m_lookup.end() ? it->second : nullptr; } @@ -130,15 +130,16 @@ class SectionManager : public LinkedMap<SectionInfo> //! Returns a non-owning pointer to the newly added section. SectionInfo *add(const SectionInfo &si) { - return LinkedMap<SectionInfo>::add(si.label(),si.fileName(),si.lineNr(),si.title(),si.type(),si.level(),si.ref()); + return LinkedMap<SectionInfo>::add(si.label(),si.fileName(), + si.lineNr(),si.title(),si.type(),si.level(),si.ref()); } //! Add a new section //! Return a non-owning pointer to the newly added section - SectionInfo *add(const char *label, const char *fileName, int lineNr, - const char *title, SectionType type, int level,const char *ref=0) + SectionInfo *add(const QCString &label, const QCString &fileName, int lineNr, + const QCString &title, SectionType type, int level,const QCString &ref=QCString()) { - return LinkedMap<SectionInfo>::add(label,fileName,lineNr,title,type,level,ref); + return LinkedMap<SectionInfo>::add(label.data(),fileName,lineNr,title,type,level,ref); } //! returns a reference to the singleton diff --git a/src/sqlcode.h b/src/sqlcode.h index aa465d7..64d7d06 100644 --- a/src/sqlcode.h +++ b/src/sqlcode.h @@ -33,11 +33,11 @@ class SQLCodeParser : public CodeParserInterface SQLCodeParser(); virtual ~SQLCodeParser(); void parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt, bool isExampleBlock, - const char *exampleName=0, + const QCString &exampleName=QCString(), FileDef *fileDef=0, int startLine=-1, int endLine=-1, diff --git a/src/sqlcode.l b/src/sqlcode.l index b3a71d9..ffa8eaa 100644 --- a/src/sqlcode.l +++ b/src/sqlcode.l @@ -231,7 +231,7 @@ static void startCodeLine(yyscan_t yyscanner) { yyextra->currentDefinition = d; yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr); - yyextra->classScope = d->name().copy(); + yyextra->classScope = d->name(); QCString lineAnchor; lineAnchor.sprintf("l%05d",yyextra->yyLineNr); if (yyextra->currentMemberDef) @@ -245,13 +245,13 @@ static void startCodeLine(yyscan_t yyscanner) { yyextra->code->writeLineNumber(d->getReference(), d->getOutputFileBase(), - 0,yyextra->yyLineNr); + QCString(),yyextra->yyLineNr); setCurrentDoc(yyscanner,lineAnchor); } } else { - yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr); + yyextra->code->writeLineNumber(QCString(),QCString(),QCString(),yyextra->yyLineNr); } } @@ -396,11 +396,11 @@ void SQLCodeParser::resetCodeParserState() } void SQLCodeParser::parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt, bool isExampleBlock, - const char *exampleName, + const QCString &exampleName, FileDef *fileDef, int startLine, int endLine, @@ -416,10 +416,10 @@ void SQLCodeParser::parseCode(CodeOutputInterface &codeOutIntf, if (input.isEmpty()) return; - printlex(yy_flex_debug, true, __FILE__, fileDef ? fileDef->fileName().data(): NULL); + printlex(yy_flex_debug, true, __FILE__, fileDef ? qPrint(fileDef->fileName()): NULL); yyextra->code = &codeOutIntf; - yyextra->inputString = input; + yyextra->inputString = input.data(); yyextra->inputPosition = 0; yyextra->currentFontClass = 0; yyextra->needsTermination = false; @@ -444,7 +444,7 @@ void SQLCodeParser::parseCode(CodeOutputInterface &codeOutIntf, if (isExampleBlock && fileDef==0) { // create a dummy filedef for the example - yyextra->sourceFileDef = createFileDef("",(exampleName?exampleName:"generated")); + yyextra->sourceFileDef = createFileDef(QCString(),!exampleName.isEmpty() ? exampleName : QCString("generated")); cleanupSourceDef = true; } @@ -472,7 +472,7 @@ void SQLCodeParser::parseCode(CodeOutputInterface &codeOutIntf, yyextra->sourceFileDef=0; } - printlex(yy_flex_debug, false, __FILE__, fileDef ? fileDef->fileName().data(): NULL); + printlex(yy_flex_debug, false, __FILE__, fileDef ? qPrint(fileDef->fileName()): NULL); } //--------------------------------------------------------------------------------- diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index e936992..7824fca 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -829,22 +829,22 @@ class TextGeneratorSqlite3Impl : public TextGeneratorIntf { public: TextGeneratorSqlite3Impl(StringVector &l) : m_list(l) { } - void writeString(const char * /*s*/,bool /*keepSpaces*/) const + void writeString(const QCString & /*s*/,bool /*keepSpaces*/) const { } void writeBreak(int) const { DBG_CTX(("writeBreak\n")); } - void writeLink(const char * /*extRef*/,const char *file, - const char *anchor,const char * /*text*/ + void writeLink(const QCString & /*extRef*/,const QCString &file, + const QCString &anchor,const QCString & /*text*/ ) const { - std::string rs = file; - if (anchor) + std::string rs = file.str(); + if (!anchor.isEmpty()) { rs+="_1"; - rs+=anchor; + rs+=anchor.str(); } m_list.push_back(rs); } @@ -854,14 +854,14 @@ class TextGeneratorSqlite3Impl : public TextGeneratorIntf }; -static bool bindTextParameter(SqlStmt &s,const char *name,const char *value, bool _static=FALSE) +static bool bindTextParameter(SqlStmt &s,const char *name,const QCString &value, bool _static=FALSE) { int idx = sqlite3_bind_parameter_index(s.stmt, name); if (idx==0) { err("sqlite3_bind_parameter_index(%s)[%s] failed: %s\n", name, s.query, sqlite3_errmsg(s.db)); return false; } - int rv = sqlite3_bind_text(s.stmt, idx, value, -1, _static==TRUE?SQLITE_STATIC:SQLITE_TRANSIENT); + int rv = sqlite3_bind_text(s.stmt, idx, value.data(), -1, _static==TRUE?SQLITE_STATIC:SQLITE_TRANSIENT); if (rv!=SQLITE_OK) { err("sqlite3_bind_text(%s)[%s] failed: %s\n", name, s.query, sqlite3_errmsg(s.db)); return false; @@ -936,17 +936,17 @@ static void recordMetadata() struct Refid { int rowid; - const char *refid; + QCString refid; bool created; }; -struct Refid insertRefid(const char *refid) +struct Refid insertRefid(const QCString &refid) { - struct Refid ret; + Refid ret; ret.rowid=-1; ret.refid=refid; ret.created = FALSE; - if (refid==0) return ret; + if (refid.isEmpty()) return ret; bindTextParameter(refid_select,":refid",refid); ret.rowid=step(refid_select,TRUE,TRUE); @@ -1372,9 +1372,15 @@ static void writeMemberTemplateLists(const MemberDef *md) { writeTemplateArgumentList(md->templateArguments(),md->getClassDef(),md->getFileDef()); } + static void writeTemplateList(const ClassDef *cd) { - writeTemplateArgumentList(cd->templateArguments(),cd,0); + writeTemplateArgumentList(cd->templateArguments(),cd,cd->getFileDef()); +} + +static void writeTemplateList(const ConceptDef *cd) +{ + writeTemplateArgumentList(cd->getTemplateParameterList(),cd,cd->getFileDef()); } QCString getSQLDocBlock(const Definition *scope, @@ -1385,7 +1391,7 @@ QCString getSQLDocBlock(const Definition *scope, { if (doc.isEmpty()) return ""; - std::ostringstream t(std::ios_base::ate); + TextStream t; DocNode *root = validatingParseDoc( fileName, lineNr, @@ -1401,14 +1407,15 @@ QCString getSQLDocBlock(const Definition *scope, ); XMLCodeGenerator codeGen(t); // create a parse tree visitor for XML - XmlDocVisitor *visitor = new XmlDocVisitor(t,codeGen,scope?scope->getDefFileExtension():QCString("")); + XmlDocVisitor *visitor = new XmlDocVisitor(t,codeGen, + scope ? scope->getDefFileExtension() : QCString("")); root->accept(visitor); delete visitor; delete root; return convertCharEntitiesToUTF8(t.str().c_str()); } -static void getSQLDesc(SqlStmt &s,const char *col,const char *value,const Definition *def) +static void getSQLDesc(SqlStmt &s,const char *col,const QCString &value,const Definition *def) { bindTextParameter( s, @@ -1651,7 +1658,7 @@ static void generateSqlite3ForMember(const MemberDef *md, struct Refid scope_ref bindIntParameter(memberdef_insert,":maybevoid",md->isMaybeVoid()); bindIntParameter(memberdef_insert,":maybedefault",md->isMaybeDefault()); bindIntParameter(memberdef_insert,":maybeambiguous",md->isMaybeAmbiguous()); - if (md->bitfieldString()) + if (!md->bitfieldString().isEmpty()) { QCString bitfield = md->bitfieldString(); if (bitfield.at(0)==':') bitfield=bitfield.mid(1); @@ -1716,17 +1723,17 @@ static void generateSqlite3ForMember(const MemberDef *md, struct Refid scope_ref stripQualifiers(typeStr); StringVector list; linkifyText(TextGeneratorSqlite3Impl(list), def, md->getBodyDef(),md,typeStr); - if (typeStr) + if (!typeStr.isEmpty()) { bindTextParameter(memberdef_insert,":type",typeStr); } - if (md->definition()) + if (!md->definition().isEmpty()) { bindTextParameter(memberdef_insert,":definition",md->definition()); } - if (md->argsString()) + if (!md->argsString().isEmpty()) { bindTextParameter(memberdef_insert,":argsstring",md->argsString()); } @@ -1746,9 +1753,9 @@ static void generateSqlite3ForMember(const MemberDef *md, struct Refid scope_ref if (md->getBodyDef()) { DBG_CTX(("initializer:%s %s %s %d\n", - md->anchor().data(), + qPrint(md->anchor()), s.c_str(), - md->getBodyDef()->getDefFileName().data(), + qPrint(md->getBodyDef()->getDefFileName()), md->getStartBodyLine())); QCString qsrc_refid = md->getOutputFileBase() + "_1" + md->anchor(); struct Refid src_refid = insertRefid(qsrc_refid); @@ -1758,7 +1765,7 @@ static void generateSqlite3ForMember(const MemberDef *md, struct Refid scope_ref } } - if ( md->getScopeString() ) + if ( !md->getScopeString().isEmpty() ) { bindTextParameter(memberdef_insert,":scope",md->getScopeString()); } @@ -1803,7 +1810,7 @@ static void generateSqlite3ForMember(const MemberDef *md, struct Refid scope_ref insertMemberFunctionParams(memberdef_id,md,def); } else if (md->memberType()==MemberType_Define && - md->argsString()) + !md->argsString().isEmpty()) { insertMemberDefineParams(memberdef_id,md,def); } @@ -1826,8 +1833,8 @@ static void generateSqlite3Section( const Definition *d, const MemberList *ml, struct Refid scope_refid, const char * /*kind*/, - const char * /*header*/=0, - const char * /*documentation*/=0) + const QCString & /*header*/=QCString(), + const QCString & /*documentation*/=QCString()) { if (ml==0) return; for (const auto &md : *ml) @@ -1934,10 +1941,10 @@ static void generateSqlite3ForClass(const ClassDef *cd) { insertPath(ii->fileDef->absFilePath(),!ii->fileDef->isReference()); } - DBG_CTX(("-----> ClassDef includeInfo for %s\n", nm.data())); + DBG_CTX(("-----> ClassDef includeInfo for %s\n", qPrint(nm))); DBG_CTX((" local : %d\n", ii->local)); DBG_CTX((" imported : %d\n", ii->imported)); - DBG_CTX(("header: %s\n", ii->fileDef->absFilePath().data())); + DBG_CTX(("header: %s\n", qPrint(ii->fileDef->absFilePath()))); DBG_CTX((" file_id : %d\n", file_id)); DBG_CTX((" header_id: %d\n", header_id)); @@ -2003,6 +2010,30 @@ static void generateSqlite3ForClass(const ClassDef *cd) associateAllClassMembers(cd, refid); } +static void generateSqlite3ForConcept(const ConceptDef *cd) +{ + if (cd->isReference() || cd->isHidden()) return; // skip external references + + struct Refid refid = insertRefid(cd->getOutputFileBase()); + if(!refid.created && compounddefExists(refid)){return;} + bindIntParameter(compounddef_insert,":rowid", refid.rowid); + bindTextParameter(compounddef_insert,":name",cd->name()); + bindTextParameter(compounddef_insert,":kind","concept"); + + int file_id = insertPath(cd->getDefFileName()); + bindIntParameter(compounddef_insert,":file_id",file_id); + bindIntParameter(compounddef_insert,":line",cd->getDefLine()); + bindIntParameter(compounddef_insert,":column",cd->getDefColumn()); + + getSQLDesc(compounddef_insert,":briefdescription",cd->briefDescription(),cd); + getSQLDesc(compounddef_insert,":detaileddescription",cd->documentation(),cd); + + step(compounddef_insert); + + // + template argument list(s) + writeTemplateList(cd); +} + // kinds: constants library module namespace package static void generateSqlite3ForNamespace(const NamespaceDef *nd) { @@ -2107,7 +2138,7 @@ static void generateSqlite3ForFile(const FileDef *fd) { // strip tagfile from path QCString tagfile = ii.fileDef->getReference(); - dst_path = ii.fileDef->absFilePath().copy(); + dst_path = ii.fileDef->absFilePath(); dst_path.stripPrefix(tagfile+":"); } else @@ -2121,12 +2152,12 @@ static void generateSqlite3ForFile(const FileDef *fd) dst_id = insertPath(ii.includeName,ii.local,FALSE); } - DBG_CTX(("-----> FileDef includeInfo for %s\n", ii.includeName.data())); + DBG_CTX(("-----> FileDef includeInfo for %s\n", qPrint(ii.includeName))); DBG_CTX((" local: %d\n", ii.local)); DBG_CTX((" imported: %d\n", ii.imported)); if(ii.fileDef) { - DBG_CTX(("include: %s\n", ii.fileDef->absFilePath().data())); + DBG_CTX(("include: %s\n", qPrint(ii.fileDef->absFilePath()))); } DBG_CTX((" src_id : %d\n", src_id)); DBG_CTX((" dst_id: %d\n", dst_id)); @@ -2155,7 +2186,7 @@ static void generateSqlite3ForFile(const FileDef *fd) { // strip tagfile from path QCString tagfile = ii.fileDef->getReference(); - src_path = ii.fileDef->absFilePath().copy(); + src_path = ii.fileDef->absFilePath(); src_path.stripPrefix(tagfile+":"); } else @@ -2349,7 +2380,7 @@ static void generateSqlite3ForPage(const PageDef *pd,bool isExample) { if (mainPageHasTitle()) { - title = filterTitle(convertCharEntitiesToUTF8(Doxygen::mainPage->title()).str()); + title = filterTitle(convertCharEntitiesToUTF8(Doxygen::mainPage->title())); } else { @@ -2363,8 +2394,10 @@ static void generateSqlite3ForPage(const PageDef *pd,bool isExample) { title = si->title(); } - - if(!title){title = pd->title();} + if (title.isEmpty()) + { + title = pd->title(); + } } // + title @@ -2473,14 +2506,21 @@ void generateSqlite3() // + classes for (const auto &cd : *Doxygen::classLinkedMap) { - msg("Generating Sqlite3 output for class %s\n",cd->name().data()); + msg("Generating Sqlite3 output for class %s\n",qPrint(cd->name())); generateSqlite3ForClass(cd.get()); } + // + concepts + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + msg("Generating Sqlite3 output for concept %s\n",qPrint(cd->name())); + generateSqlite3ForConcept(cd.get()); + } + // + namespaces for (const auto &nd : *Doxygen::namespaceLinkedMap) { - msg("Generating Sqlite3 output for namespace %s\n",nd->name().data()); + msg("Generating Sqlite3 output for namespace %s\n",qPrint(nd->name())); generateSqlite3ForNamespace(nd.get()); } @@ -2489,7 +2529,7 @@ void generateSqlite3() { for (const auto &fd : *fn) { - msg("Generating Sqlite3 output for file %s\n",fd->name().data()); + msg("Generating Sqlite3 output for file %s\n",qPrint(fd->name())); generateSqlite3ForFile(fd.get()); } } @@ -2497,28 +2537,28 @@ void generateSqlite3() // + groups for (const auto &gd : *Doxygen::groupLinkedMap) { - msg("Generating Sqlite3 output for group %s\n",gd->name().data()); + msg("Generating Sqlite3 output for group %s\n",qPrint(gd->name())); generateSqlite3ForGroup(gd.get()); } // + page for (const auto &pd : *Doxygen::pageLinkedMap) { - msg("Generating Sqlite3 output for page %s\n",pd->name().data()); + msg("Generating Sqlite3 output for page %s\n",qPrint(pd->name())); generateSqlite3ForPage(pd.get(),FALSE); } // + dirs for (const auto &dd : *Doxygen::dirLinkedMap) { - msg("Generating Sqlite3 output for dir %s\n",dd->name().data()); + msg("Generating Sqlite3 output for dir %s\n",qPrint(dd->name())); generateSqlite3ForDir(dd.get()); } // + examples for (const auto &pd : *Doxygen::exampleLinkedMap) { - msg("Generating Sqlite3 output for example %s\n",pd->name().data()); + msg("Generating Sqlite3 output for example %s\n",qPrint(pd->name())); generateSqlite3ForPage(pd.get(),TRUE); } diff --git a/src/stlsupport.cpp b/src/stlsupport.cpp index 096291a..569314a 100644 --- a/src/stlsupport.cpp +++ b/src/stlsupport.cpp @@ -149,7 +149,7 @@ static void addSTLMember(const std::shared_ptr<Entry> &root,const char *type,con root->moveToSubEntryAndKeep(memEntry); } -static void addSTLIterator(const std::shared_ptr<Entry> &classEntry,const char *name) +static void addSTLIterator(const std::shared_ptr<Entry> &classEntry,const QCString &name) { std::shared_ptr<Entry> iteratorClassEntry = std::make_shared<Entry>(); iteratorClassEntry->fileName = "[STL]"; diff --git a/src/symbolmap.h b/src/symbolmap.h index 0f837d4..a277846 100644 --- a/src/symbolmap.h +++ b/src/symbolmap.h @@ -36,15 +36,15 @@ class SymbolMap using const_iterator = typename Map::const_iterator; //! Add a symbol \a def into the map under key \a name - void add(const char *name,Ptr def) + void add(const QCString &name,Ptr def) { - m_map.insert({std::string(name),def}); + m_map.insert({name.str(),def}); } //! Remove a symbol \a def from the map that was stored under key \a name - void remove(const char *name,Ptr def) + void remove(const QCString &name,Ptr def) { - auto range = find(name); + auto range = find(name.str()); for (auto it=range.first; it!=range.second; ) { if (it->second==def) it = m_map.erase(it); else ++it; @@ -53,16 +53,16 @@ class SymbolMap //! Find the list of symbols stored under key \a name //! Returns a pair of iterators pointing to the start and end of the range of matching symbols - std::pair<const_iterator,const_iterator> find(const char *name) const + std::pair<const_iterator,const_iterator> find(const QCString &name) const { - return m_map.equal_range(name ? name : ""); + return m_map.equal_range(name.str()); } //! Find the list of symbols stored under key \a name //! Returns a pair of iterators pointing to the start and end of the range of matching symbols - std::pair<iterator,iterator> find(const char *name) + std::pair<iterator,iterator> find(const QCString &name) { - return m_map.equal_range(name ? name : ""); + return m_map.equal_range(name.str()); } iterator begin() { return m_map.begin(); } diff --git a/src/symbolresolver.cpp b/src/symbolresolver.cpp index dd9e0f7..f509c7d 100644 --- a/src/symbolresolver.cpp +++ b/src/symbolresolver.cpp @@ -104,7 +104,7 @@ struct SymbolResolver::Private const ClassDef *getResolvedClassRec( const Definition *scope, // in - const char *n, // in + const QCString &n, // in const MemberDef **pTypeDef, // out QCString *pTemplSpec, // out QCString *pResolvedType); // out @@ -164,14 +164,14 @@ struct SymbolResolver::Private const ClassDef *SymbolResolver::Private::getResolvedClassRec( const Definition *scope, - const char *n, + const QCString &n, const MemberDef **pTypeDef, QCString *pTemplSpec, QCString *pResolvedType) { - if (n==0 || *n=='\0') return 0; + if (n.isEmpty()) return 0; //static int level=0; - //fprintf(stderr,"%d [getResolvedClassRec(%s,%s)\n",level++,scope?scope->name().data():"<global>",n); + //fprintf(stderr,"%d [getResolvedClassRec(%s,%s)\n",level++,scope?qPrint(scope->name()):"<global>",n); QCString name; QCString explicitScopePart; QCString strippedTemplateParams; @@ -185,7 +185,7 @@ const ClassDef *SymbolResolver::Private::getResolvedClassRec( } int qualifierIndex = computeQualifiedIndex(name); - //printf("name=%s qualifierIndex=%d\n",name.data(),qualifierIndex); + //printf("name=%s qualifierIndex=%d\n",qPrint(name),qualifierIndex); if (qualifierIndex!=-1) // qualified name { // split off the explicit scope part @@ -201,7 +201,7 @@ const ClassDef *SymbolResolver::Private::getResolvedClassRec( return 0; // empty name } - //printf("Looking for symbol %s\n",name.data()); + //printf("Looking for symbol %s\n",qPrint(name)); auto range = Doxygen::symbolMap.find(name); // the -g (for C# generics) and -p (for ObjC protocols) are now already // stripped from the key used in the symbolMap, so that is not needed here. @@ -236,11 +236,11 @@ const ClassDef *SymbolResolver::Private::getResolvedClassRec( // QCString key=scope->name()+"+"+name+"+"+explicitScopePart; QCString key(scopeNameLen+nameLen+explicitPartLen+fileScopeLen+1); char *pk=key.rawData(); - qstrcpy(pk,scope->name()); *(pk+scopeNameLen-1)='+'; + qstrcpy(pk,scope->name().data()); *(pk+scopeNameLen-1)='+'; pk+=scopeNameLen; - qstrcpy(pk,name); *(pk+nameLen-1)='+'; + qstrcpy(pk,name.data()); *(pk+nameLen-1)='+'; pk+=nameLen; - qstrcpy(pk,explicitScopePart); + qstrcpy(pk,explicitScopePart.data()); pk+=explicitPartLen; // if a file scope is given and it contains using statements we should @@ -252,7 +252,7 @@ const ClassDef *SymbolResolver::Private::getResolvedClassRec( // below is a more efficient coding of // key+="+"+m_fileScope->name(); *pk++='+'; - qstrcpy(pk,m_fileScope->absFilePath()); + qstrcpy(pk,m_fileScope->absFilePath().data()); pk+=fileScopeLen-1; } *pk='\0'; @@ -261,17 +261,17 @@ const ClassDef *SymbolResolver::Private::getResolvedClassRec( { std::lock_guard<std::mutex> lock(g_cacheMutex); pval=Doxygen::lookupCache->find(key.str()); - //printf("Searching for %s result=%p\n",key.data(),pval); + //printf("Searching for %s result=%p\n",qPrint(key),pval); if (pval) { //printf("LookupInfo %p %p '%s' %p\n", - // pval->classDef, pval->typeDef, pval->templSpec.data(), - // pval->resolvedType.data()); + // pval->classDef, pval->typeDef, qPrint(pval->templSpec), + // qPrint(pval->resolvedType)); if (pTemplSpec) *pTemplSpec=pval->templSpec; if (pTypeDef) *pTypeDef=pval->typeDef; if (pResolvedType) *pResolvedType=pval->resolvedType; //fprintf(stderr,"%d ] cachedMatch=%s\n",--level, - // pval->classDef?pval->classDef->name().data():"<none>"); + // pval->classDef?qPrint(pval->classDef->name()):"<none>"); //if (pTemplSpec) // printf("templSpec=%s\n",pTemplSpec->data()); return pval->classDef; @@ -310,7 +310,7 @@ const ClassDef *SymbolResolver::Private::getResolvedClassRec( } //printf("getResolvedClassRec: bestMatch=%p pval->resolvedType=%s\n", - // bestMatch,bestResolvedType.data()); + // bestMatch,qPrint(bestResolvedType)); if (pval) { @@ -321,7 +321,7 @@ const ClassDef *SymbolResolver::Private::getResolvedClassRec( pval->resolvedType = bestResolvedType; } //fprintf(stderr,"%d ] bestMatch=%s distance=%d\n",--level, - // bestMatch?bestMatch->name().data():"<none>",minDistance); + // bestMatch?qPrint(bestMatch->name()):"<none>",minDistance); //if (pTemplSpec) // printf("templSpec=%s\n",pTemplSpec->data()); return bestMatch; @@ -339,7 +339,7 @@ void SymbolResolver::Private::getResolvedSymbol( QCString &bestResolvedType // out ) { - //fprintf(stderr,"getResolvedSymbol(%s,%s)\n",scope->name().data(),d->qualifiedName().data()); + //fprintf(stderr,"getResolvedSymbol(%s,%s)\n",qPrint(scope->name()),qPrint(d->qualifiedName())); // only look at classes and members that are enums or typedefs if (d->definitionType()==Definition::TypeClass || (d->definitionType()==Definition::TypeMember && @@ -352,14 +352,14 @@ void SymbolResolver::Private::getResolvedSymbol( AccessStack accessStack; // test accessibility of definition within scope. int distance = isAccessibleFromWithExpScope(visitedNamespaces,accessStack,scope,d,explicitScopePart); - //fprintf(stderr," %s; distance %s (%p) is %d\n",scope->name().data(),d->name().data(),d,distance); + //fprintf(stderr," %s; distance %s (%p) is %d\n",qPrint(scope->name()),qPrint(d->name()),d,distance); if (distance!=-1) // definition is accessible { // see if we are dealing with a class or a typedef if (d->definitionType()==Definition::TypeClass) // d is a class { const ClassDef *cd = toClassDef(d); - //printf("cd=%s\n",cd->name().data()); + //printf("cd=%s\n",qPrint(cd->name())); if (!cd->isTemplateArgument()) // skip classes that // are only there to // represent a template @@ -425,7 +425,7 @@ void SymbolResolver::Private::getResolvedSymbol( const ClassDef *cd = newResolveTypedef(scope,md,&enumType,&spec,&type,actTemplParams); if (cd) // type resolves to a class { - //printf(" bestTypeDef=%p spec=%s type=%s\n",md,spec.data(),type.data()); + //printf(" bestTypeDef=%p spec=%s type=%s\n",md,qPrint(spec),qPrint(type)); bestMatch = cd; bestTypedef = md; bestTemplSpec = spec; @@ -483,7 +483,7 @@ void SymbolResolver::Private::getResolvedSymbol( //printf(" Not accessible!\n"); } } // if definition is a class or member - //printf(" bestMatch=%p bestResolvedType=%s\n",bestMatch,bestResolvedType.data()); + //printf(" bestMatch=%p bestResolvedType=%s\n",bestMatch,qPrint(bestResolvedType)); } const ClassDef *SymbolResolver::Private::newResolveTypedef( @@ -499,9 +499,9 @@ const ClassDef *SymbolResolver::Private::newResolveTypedef( if (isCached) { //printf("Already cached %s->%s [%s]\n", - // md->name().data(), - // md->getCachedTypedefVal()?md->getCachedTypedefVal()->name().data():"<none>", - // md->getCachedResolvedTypedef()?md->getCachedResolvedTypedef().data():"<none>"); + // qPrint(md->name()), + // md->getCachedTypedefVal()?qPrint(md->getCachedTypedefVal()->name()):"<none>", + // md->getCachedResolvedTypedef()?qPrint(md->getCachedResolvedTypedef()):"<none>"); if (pTemplSpec) *pTemplSpec = md->getCachedTypedefTemplSpec(); if (pResolvedType) *pResolvedType = md->getCachedResolvedTypedef(); @@ -521,7 +521,7 @@ const ClassDef *SymbolResolver::Private::newResolveTypedef( if (typeClass && typeClass->isTemplate() && actTemplParams && !actTemplParams->empty()) { - type = substituteTemplateArgumentsInString(type.str(), + type = substituteTemplateArgumentsInString(type, typeClass->templateArguments(),actTemplParams); } QCString typedefValue = type; @@ -552,7 +552,7 @@ const ClassDef *SymbolResolver::Private::newResolveTypedef( *pMemType = memTypeDef; } - //printf("type=%s result=%p\n",type.data(),result); + //printf("type=%s result=%p\n",qPrint(type),result); if (result==0) { // try unspecialized version if type is template @@ -605,7 +605,7 @@ done: // introduced while parsing code fragments are being cached here. { //printf("setting cached typedef %p in result %p\n",md,result); - //printf("==> %s (%s,%d)\n",result->name().data(),result->getDefFileName().data(),result->getDefLine()); + //printf("==> %s (%s,%d)\n",qPrint(result->name()),qPrint(result->getDefFileName()),result->getDefLine()); //printf("*pResolvedType=%s\n",pResolvedType?pResolvedType->data():"<none>"); MemberDefMutable *mdm = toMemberDefMutable(md); if (mdm) @@ -642,19 +642,19 @@ int SymbolResolver::Private::isAccessibleFromWithExpScope( accessStack.push(scope,m_fileScope,item,explicitScopePart); - //printf(" <isAccessibleFromWithExpScope(%s,%s,%s)\n",scope?scope->name().data():"<global>", - // item?item->name().data():"<none>", - // explicitScopePart.data()); + //printf(" <isAccessibleFromWithExpScope(%s,%s,%s)\n",scope?qPrint(scope->name()):"<global>", + // item?qPrint(item->name()):"<none>", + // qPrint(explicitScopePart)); int result=0; // assume we found it const Definition *newScope = followPath(scope,explicitScopePart); if (newScope) // explicitScope is inside scope => newScope is the result { Definition *itemScope = item->getOuterScope(); - //printf(" scope traversal successful %s<->%s!\n",itemScope->name().data(),newScope->name().data()); + //printf(" scope traversal successful %s<->%s!\n",qPrint(itemScope->name()),qPrint(newScope->name())); //if (newScope && newScope->definitionType()==Definition::TypeClass) //{ // ClassDef *cd = (ClassDef *)newScope; - // printf("---> Class %s: bases=%p\n",cd->name().data(),cd->baseClasses()); + // printf("---> Class %s: bases=%p\n",qPrint(cd->name()),cd->baseClasses()); //} if (itemScope==newScope) // exact match of scopes => distance==0 { @@ -676,7 +676,7 @@ int SymbolResolver::Private::isAccessibleFromWithExpScope( result=1; //printf("scope(%s) is base class of newScope(%s)\n", - // scope->name().data(),newScope->name().data()); + // qPrint(scope->name()),qPrint(newScope->name())); } else { @@ -687,11 +687,11 @@ int SymbolResolver::Private::isAccessibleFromWithExpScope( // this part deals with the case where item is a class // A::B::C but is explicit referenced as A::C, where B is imported // in A via a using directive. - //printf("newScope is a namespace: %s!\n",newScope->name().data()); + //printf("newScope is a namespace: %s!\n",qPrint(newScope->name())); const NamespaceDef *nscope = toNamespaceDef(newScope); for (const auto &cd : nscope->getUsedClasses()) { - //printf("Trying for class %s\n",cd->name().data()); + //printf("Trying for class %s\n",qPrint(cd->name())); if (cd==item) { goto done; @@ -701,7 +701,7 @@ int SymbolResolver::Private::isAccessibleFromWithExpScope( { if (visitedNamespaces.find(nd->name().str())==visitedNamespaces.end()) { - //printf("Trying for namespace %s\n",nd->name().data()); + //printf("Trying for namespace %s\n",qPrint(nd->name())); i = isAccessibleFromWithExpScope(visitedNamespaces,accessStack,scope,item,nd->name()); if (i!=-1) { @@ -722,7 +722,7 @@ int SymbolResolver::Private::isAccessibleFromWithExpScope( } else // failed to resolve explicitScope { - //printf(" failed to resolve: scope=%s\n",scope->name().data()); + //printf(" failed to resolve: scope=%s\n",qPrint(scope->name())); if (scope->definitionType()==Definition::TypeNamespace) { const NamespaceDef *nscope = toNamespaceDef(scope); @@ -767,28 +767,28 @@ const Definition *SymbolResolver::Private::followPath(const Definition *start,co int l; const Definition *current=start; ps=0; - //printf("followPath: start='%s' path='%s'\n",start?start->name().data():"<none>",path.data()); + //printf("followPath: start='%s' path='%s'\n",start?qPrint(start->name()):"<none>",qPrint(path)); // for each part of the explicit scope while ((is=getScopeFragment(path,ps,&l))!=-1) { // try to resolve the part if it is a typedef const MemberDef *memTypeDef=0; QCString qualScopePart = substTypedef(current,path.mid(is,l),&memTypeDef); - //printf(" qualScopePart=%s\n",qualScopePart.data()); + //printf(" qualScopePart=%s\n",qPrint(qualScopePart)); if (memTypeDef) { const ClassDef *type = newResolveTypedef(m_fileScope,memTypeDef,0,0,0); if (type) { - //printf("Found type %s\n",type->name().data()); + //printf("Found type %s\n",qPrint(type->name())); return type; } } const Definition *next = current->findInnerCompound(qualScopePart); //printf("++ Looking for %s inside %s result %s\n", - // qualScopePart.data(), - // current->name().data(), - // next?next->name().data():"<null>"); + // qPrint(qualScopePart), + // qPrint(current->name()), + // next?qPrint(next->name()):"<null>"); if (next==0) // failed to follow the path { //printf("==> next==0!\n"); @@ -813,7 +813,7 @@ const Definition *SymbolResolver::Private::followPath(const Definition *start,co ps=is+l; } //printf("followPath(start=%s,path=%s) result=%s\n", - // start->name().data(),path.data(),current?current->name().data():"<null>"); + // qPrint(start->name()),qPrint(path),current?qPrint(current->name()):"<null>"); return current; // path could be followed } @@ -836,7 +836,7 @@ bool SymbolResolver::Private::accessibleViaUsingNamespace(StringUnorderedSet &vi { for (const auto &und : nl) // check used namespaces for the class { - //printf("[Trying via used namespace %s: count=%d/%d\n",und->name().data(), + //printf("[Trying via used namespace %s: count=%d/%d\n",qPrint(und->name()), // count,nl->count()); const Definition *sc = explicitScopePart.isEmpty() ? und : followPath(und,explicitScopePart); if (sc && item->getOuterScope()==sc) @@ -872,7 +872,7 @@ bool SymbolResolver::Private::accessibleViaUsingClass(const LinkedRefMap<const C { for (const auto &ucd : cl) { - //printf("Trying via used class %s\n",ucd->name().data()); + //printf("Trying via used class %s\n",qPrint(ucd->name())); const Definition *sc = explicitScopePart.isEmpty() ? ucd : followPath(ucd,explicitScopePart); if (sc && sc==item) return true; //printf("Try via used class done\n"); @@ -885,7 +885,7 @@ int SymbolResolver::Private::isAccessibleFrom(AccessStack &accessStack, const Definition *item) { //printf("<isAccessibleFrom(scope=%s,item=%s itemScope=%s)\n", - // scope->name().data(),item->name().data(),item->getOuterScope()->name().data()); + // qPrint(scope->name()),qPrint(item->name()),qPrint(item->getOuterScope()->name())); if (accessStack.find(scope,m_fileScope,item)) { @@ -942,7 +942,7 @@ int SymbolResolver::Private::isAccessibleFrom(AccessStack &accessStack, if (scope->definitionType()==Definition::TypeNamespace) { const NamespaceDef *nscope = toNamespaceDef(scope); - //printf(" %s is namespace with %d used classes\n",nscope->name().data(),nscope->getUsedClasses()); + //printf(" %s is namespace with %d used classes\n",qPrint(nscope->name()),nscope->getUsedClasses()); if (accessibleViaUsingClass(nscope->getUsedClasses(),item)) { //printf("> found via used class\n"); @@ -1009,8 +1009,8 @@ QCString SymbolResolver::Private::substTypedef( if (pTypeDef) *pTypeDef=bestMatch; } - //printf("substTypedef(%s,%s)=%s\n",scope?scope->name().data():"<global>", - // name.data(),result.data()); + //printf("substTypedef(%s,%s)=%s\n",scope?qPrint(scope->name()):"<global>", + // qPrint(name),qPrint(result)); return result; } @@ -1028,7 +1028,7 @@ SymbolResolver::~SymbolResolver() const ClassDef *SymbolResolver::resolveClass(const Definition *scope, - const char *name, + const QCString &name, bool mayBeUnlinkable, bool mayBeHidden) { @@ -1044,7 +1044,7 @@ const ClassDef *SymbolResolver::resolveClass(const Definition *scope, scope=Doxygen::globalScope; } //fprintf(stderr,"------------ resolveClass(scope=%s,name=%s,mayUnlinkable=%d)\n", - // scope?scope->name().data():"<global>", + // scope?qPrint(scope->name()):"<global>", // name, // mayBeUnlinkable // ); @@ -1067,12 +1067,12 @@ const ClassDef *SymbolResolver::resolveClass(const Definition *scope, { if (!mayBeHidden || !result->isHidden()) { - //printf("result was %s\n",result?result->name().data():"<none>"); + //printf("result was %s\n",result?qPrint(result->name()):"<none>"); result=0; // don't link to artificial/hidden classes unless explicitly allowed } } - //fprintf(stderr,"ResolvedClass(%s,%s)=%s\n",scope?scope->name().data():"<global>", - // name,result?result->name().data():"<none>"); + //fprintf(stderr,"ResolvedClass(%s,%s)=%s\n",scope?qPrint(scope->name()):"<global>", + // name,result?qPrint(result->name()):"<none>"); return result; } diff --git a/src/symbolresolver.h b/src/symbolresolver.h index 6122e82..89c3e6d 100644 --- a/src/symbolresolver.h +++ b/src/symbolresolver.h @@ -45,7 +45,7 @@ class SymbolResolver * getTemplateSpec(), and getResolvedType() are set as well. */ const ClassDef *resolveClass(const Definition *scope, - const char *name, + const QCString &name, bool maybeUnlinkable=false, bool mayBeHidden=false); @@ -53,7 +53,7 @@ class SymbolResolver * the class object or a nullptr if the symbol is immutable. */ ClassDefMutable *resolveClassMutable(const Definition *scope, - const char *name, + const QCString &name, bool mayBeUnlinkable=false, bool mayBeHidden=false) { diff --git a/src/tagreader.cpp b/src/tagreader.cpp index 0a7c8f1..6dca1cd 100644 --- a/src/tagreader.cpp +++ b/src/tagreader.cpp @@ -44,32 +44,32 @@ class TagAnchorInfo { public: - TagAnchorInfo(const std::string &f, - const std::string &l, - const std::string &t=std::string()) + TagAnchorInfo(const QCString &f, + const QCString &l, + const QCString &t=QCString()) : label(l), fileName(f), title(t) {} - std::string label; - std::string fileName; - std::string title; + QCString label; + QCString fileName; + QCString title; }; /** Container for enum values that are scoped within an enum */ class TagEnumValueInfo { public: - std::string name; - std::string file; - std::string anchor; - std::string clangid; + QCString name; + QCString file; + QCString anchor; + QCString clangid; }; /** Container for include info that can be read from a tagfile */ class TagIncludeInfo { public: - std::string id; - std::string name; - std::string text; + QCString id; + QCString name; + QCString text; bool isLocal; bool isImported; }; @@ -78,32 +78,34 @@ class TagIncludeInfo class TagMemberInfo { public: - std::string type; - std::string name; - std::string anchorFile; - std::string anchor; - std::string arglist; - std::string kind; - std::string clangId; + QCString type; + QCString name; + QCString anchorFile; + QCString anchor; + QCString arglist; + QCString kind; + QCString clangId; std::vector<TagAnchorInfo> docAnchors; Protection prot = Public; Specifier virt = Normal; bool isStatic = false; std::vector<TagEnumValueInfo> enumValues; + int lineNr; }; /** Base class for all compound types */ class TagCompoundInfo { public: - enum class CompoundType { Class, Namespace, Package, File, Group, Page, Dir }; + enum class CompoundType { Class, Concept, Namespace, Package, File, Group, Page, Dir }; explicit TagCompoundInfo(CompoundType type) : m_type(type) {} virtual ~TagCompoundInfo() {} CompoundType compoundType() const { return m_type; } std::vector<TagMemberInfo> members; - std::string name; - std::string filename; + QCString name; + QCString filename; std::vector<TagAnchorInfo> docAnchors; + int lineNr; private: CompoundType m_type; }; @@ -114,8 +116,8 @@ class TagClassInfo : public TagCompoundInfo public: enum class Kind { None=-1, Class, Struct, Union, Interface, Exception, Protocol, Category, Enum, Service, Singleton }; TagClassInfo(Kind k) : TagCompoundInfo(CompoundType::Class), kind(k) {} - std::string clangId; - std::string anchor; + QCString clangId; + QCString anchor; std::vector<BaseInfo> bases; StringVector templateArguments; StringVector classList; @@ -131,13 +133,30 @@ class TagClassInfo : public TagCompoundInfo } }; +/** Container for concept specific info that can be read from a tagfile */ +class TagConceptInfo : public TagCompoundInfo +{ + public: + TagConceptInfo() :TagCompoundInfo(CompoundType::Concept) {} + QCString clangId; + static TagConceptInfo *get(std::unique_ptr<TagCompoundInfo> &t) + { + return dynamic_cast<TagConceptInfo*>(t.get()); + } + static const TagConceptInfo *get(const std::unique_ptr<TagCompoundInfo> &t) + { + return dynamic_cast<const TagConceptInfo*>(t.get()); + } +}; + /** Container for namespace specific info that can be read from a tagfile */ class TagNamespaceInfo : public TagCompoundInfo { public: TagNamespaceInfo() :TagCompoundInfo(CompoundType::Namespace) {} - std::string clangId; + QCString clangId; StringVector classList; + StringVector conceptList; StringVector namespaceList; static TagNamespaceInfo *get(std::unique_ptr<TagCompoundInfo> &t) { @@ -170,8 +189,9 @@ class TagFileInfo : public TagCompoundInfo { public: TagFileInfo() : TagCompoundInfo(CompoundType::File) { } - std::string path; + QCString path; StringVector classList; + StringVector conceptList; StringVector namespaceList; std::vector<TagIncludeInfo> includes; static TagFileInfo *get(std::unique_ptr<TagCompoundInfo> &t) @@ -189,9 +209,10 @@ class TagGroupInfo : public TagCompoundInfo { public: TagGroupInfo() : TagCompoundInfo(CompoundType::Group) { } - std::string title; + QCString title; StringVector subgroupList; StringVector classList; + StringVector conceptList; StringVector namespaceList; StringVector fileList; StringVector pageList; @@ -211,7 +232,7 @@ class TagPageInfo : public TagCompoundInfo { public: TagPageInfo() : TagCompoundInfo(CompoundType::Page) {} - std::string title; + QCString title; static TagPageInfo *get(std::unique_ptr<TagCompoundInfo> &t) { return dynamic_cast<TagPageInfo*>(t.get()); @@ -227,7 +248,7 @@ class TagDirInfo : public TagCompoundInfo { public: TagDirInfo() : TagCompoundInfo(CompoundType::Dir) {} - std::string path; + QCString path; StringVector subdirList; StringVector fileList; static TagDirInfo *get(std::unique_ptr<TagCompoundInfo> &t) @@ -261,12 +282,12 @@ class TagFileParser m_state = Invalid; } - void startElement( const std::string &name, const XMLHandlers::Attributes& attrib ); - void endElement( const std::string &name ); - void characters ( const std::string & ch ) { m_curString+=ch; } - void error( const std::string &fileName,int lineNr,const std::string &msg) + void startElement( const QCString &name, const XMLHandlers::Attributes& attrib ); + void endElement( const QCString &name ); + void characters ( const QCString & ch ) { m_curString+=ch; } + void error( const QCString &fileName,int lineNr,const QCString &msg) { - ::warn(fileName.c_str(),lineNr,"%s",msg.c_str()); + ::warn(fileName,lineNr,"%s",qPrint(msg)); } void dump(); @@ -279,6 +300,7 @@ class TagFileParser switch (m_state) { case InClass: + case InConcept: case InFile: case InNamespace: case InGroup: @@ -296,10 +318,11 @@ class TagFileParser void startMember( const XMLHandlers::Attributes& attrib) { m_curMember = TagMemberInfo(); - m_curMember.kind = XMLHandlers::value(attrib,"kind"); - std::string protStr = XMLHandlers::value(attrib,"protection"); - std::string virtStr = XMLHandlers::value(attrib,"virtualness"); - std::string staticStr = XMLHandlers::value(attrib,"static"); + m_curMember.kind = XMLHandlers::value(attrib,"kind"); + QCString protStr = XMLHandlers::value(attrib,"protection"); + QCString virtStr = XMLHandlers::value(attrib,"virtualness"); + QCString staticStr = XMLHandlers::value(attrib,"static"); + m_curMember.lineNr = m_locator->lineNr(); if (protStr=="protected") { m_curMember.prot = Protected; @@ -363,7 +386,7 @@ class TagFileParser void endEnumValue() { - m_curEnumValue.name = QCString(m_curString).stripWhiteSpace(); + m_curEnumValue.name = QCString(m_curString).stripWhiteSpace().str(); m_state = m_stateStack.top(); m_stateStack.pop(); if (m_state==InMember) @@ -379,6 +402,7 @@ class TagFileParser switch(m_state) { case InClass: + case InConcept: case InFile: case InNamespace: case InGroup: @@ -386,7 +410,7 @@ class TagFileParser case InMember: case InPackage: case InDir: - if (m_curString.rfind("autotoc_md",0)==0) return; + if (m_curString.right(10)=="autotoc_md") return; break; default: warn("Unexpected tag 'docanchor' found"); @@ -395,6 +419,7 @@ class TagFileParser switch(m_state) { case InClass: + case InConcept: case InFile: case InNamespace: case InGroup: @@ -415,19 +440,19 @@ class TagFileParser switch(m_state) { case InClass: - TagClassInfo::get(m_curCompound)->classList.push_back(m_curString); + TagClassInfo::get(m_curCompound)->classList.push_back(m_curString.str()); break; case InFile: - TagFileInfo::get(m_curCompound)->classList.push_back(m_curString); + TagFileInfo::get(m_curCompound)->classList.push_back(m_curString.str()); break; case InNamespace: - TagNamespaceInfo::get(m_curCompound)->classList.push_back(m_curString); + TagNamespaceInfo::get(m_curCompound)->classList.push_back(m_curString.str()); break; case InGroup: - TagGroupInfo::get(m_curCompound)->classList.push_back(m_curString); + TagGroupInfo::get(m_curCompound)->classList.push_back(m_curString.str()); break; case InPackage: - TagPackageInfo::get(m_curCompound)->classList.push_back(m_curString); + TagPackageInfo::get(m_curCompound)->classList.push_back(m_curString.str()); break; default: warn("Unexpected tag 'class' found"); @@ -435,18 +460,37 @@ class TagFileParser } } + void endConcept() + { + switch(m_state) + { + case InNamespace: + TagNamespaceInfo::get(m_curCompound)->conceptList.push_back(m_curString.str()); + break; + case InFile: + TagFileInfo::get(m_curCompound)->conceptList.push_back(m_curString.str()); + break; + case InGroup: + TagGroupInfo::get(m_curCompound)->conceptList.push_back(m_curString.str()); + break; + default: + warn("Unexpected tag 'concept' found"); + break; + } + } + void endNamespace() { switch(m_state) { case InNamespace: - TagNamespaceInfo::get(m_curCompound)->namespaceList.push_back(m_curString); + TagNamespaceInfo::get(m_curCompound)->namespaceList.push_back(m_curString.str()); break; case InFile: - TagFileInfo::get(m_curCompound)->namespaceList.push_back(m_curString); + TagFileInfo::get(m_curCompound)->namespaceList.push_back(m_curString.str()); break; case InGroup: - TagGroupInfo::get(m_curCompound)->namespaceList.push_back(m_curString); + TagGroupInfo::get(m_curCompound)->namespaceList.push_back(m_curString.str()); break; default: warn("Unexpected tag 'namespace' found"); @@ -459,10 +503,10 @@ class TagFileParser switch(m_state) { case InGroup: - TagGroupInfo::get(m_curCompound)->fileList.push_back(m_curString); + TagGroupInfo::get(m_curCompound)->fileList.push_back(m_curString.str()); break; case InDir: - TagDirInfo::get(m_curCompound)->fileList.push_back(m_curString); + TagDirInfo::get(m_curCompound)->fileList.push_back(m_curString.str()); break; default: warn("Unexpected tag 'file' found"); @@ -475,7 +519,7 @@ class TagFileParser switch(m_state) { case InGroup: - TagGroupInfo::get(m_curCompound)->fileList.push_back(m_curString); + TagGroupInfo::get(m_curCompound)->fileList.push_back(m_curString.str()); break; default: warn("Unexpected tag 'page' found"); @@ -488,7 +532,7 @@ class TagFileParser switch(m_state) { case InDir: - TagDirInfo::get(m_curCompound)->subdirList.push_back(m_curString); + TagDirInfo::get(m_curCompound)->subdirList.push_back(m_curString.str()); break; default: warn("Unexpected tag 'dir' found"); @@ -525,6 +569,7 @@ class TagFileParser switch (m_state) { case InClass: + case InConcept: case InFile: case InNamespace: case InGroup: @@ -547,8 +592,8 @@ class TagFileParser m_curString=""; if (m_state==InClass && m_curCompound) { - std::string protStr = XMLHandlers::value(attrib,"protection"); - std::string virtStr = XMLHandlers::value(attrib,"virtualness"); + QCString protStr = XMLHandlers::value(attrib,"protection"); + QCString virtStr = XMLHandlers::value(attrib,"virtualness"); Protection prot = Public; Specifier virt = Normal; if (protStr=="protected") @@ -563,7 +608,7 @@ class TagFileParser { virt = Virtual; } - TagClassInfo::get(m_curCompound)->bases.push_back(BaseInfo(m_curString.c_str(),prot,virt)); + TagClassInfo::get(m_curCompound)->bases.push_back(BaseInfo(m_curString,prot,virt)); } else { @@ -610,7 +655,7 @@ class TagFileParser { if (m_state==InClass && m_curCompound) { - TagClassInfo::get(m_curCompound)->templateArguments.push_back(m_curString); + TagClassInfo::get(m_curCompound)->templateArguments.push_back(m_curString.str()); } else { @@ -623,6 +668,7 @@ class TagFileParser switch (m_state) { case InClass: + case InConcept: case InNamespace: case InFile: case InGroup: @@ -735,7 +781,7 @@ class TagFileParser { if (m_state==InGroup) { - TagGroupInfo::get(m_curCompound)->subgroupList.push_back(m_curString); + TagGroupInfo::get(m_curCompound)->subgroupList.push_back(m_curString.str()); } else { @@ -757,6 +803,7 @@ class TagFileParser enum State { Invalid, InClass, + InConcept, InFile, InNamespace, InGroup, @@ -771,14 +818,14 @@ class TagFileParser void warn(const char *fmt) { - std::string fileName = m_locator->fileName(); - ::warn(fileName.c_str(),m_locator->lineNr(),"%s", fmt); + QCString fileName = m_locator->fileName(); + ::warn(fileName,m_locator->lineNr(),"%s", fmt); } void warn(const char *fmt,const char *s) { - std::string fileName = m_locator->fileName(); - ::warn(fileName.c_str(),m_locator->lineNr(),fmt,s); + QCString fileName = m_locator->fileName(); + ::warn(fileName,m_locator->lineNr(),fmt,s); } @@ -791,10 +838,10 @@ class TagFileParser TagEnumValueInfo m_curEnumValue; TagIncludeInfo m_curIncludes; - std::string m_curString; - std::string m_tagName; - std::string m_fileName; - std::string m_title; + QCString m_curString; + QCString m_tagName; + QCString m_fileName; + QCString m_title; State m_state = Invalid; std::stack<State> m_stateStack; const XMLLocator *m_locator = nullptr; @@ -839,6 +886,7 @@ static const std::map< std::string, ElementCallbacks > g_elementHandlers = { "title", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endTitle ) } }, { "subgroup", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endSubgroup ) } }, { "class", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endClass ) } }, + { "concept", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endConcept ) } }, { "namespace", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endNamespace ) } }, { "file", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endFile ) } }, { "dir", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endDir ) } }, @@ -874,6 +922,7 @@ static const std::map< std::string, CompoundFactory > g_compoundFactory = { "singleton", { TagFileParser::InClass, []() { return std::make_unique<TagClassInfo>(TagClassInfo::Kind::Singleton); } } }, { "file", { TagFileParser::InFile, []() { return std::make_unique<TagFileInfo>(); } } }, { "namespace", { TagFileParser::InNamespace, []() { return std::make_unique<TagNamespaceInfo>(); } } }, + { "concept", { TagFileParser::InConcept, []() { return std::make_unique<TagConceptInfo>(); } } }, { "group", { TagFileParser::InGroup, []() { return std::make_unique<TagGroupInfo>(); } } }, { "page", { TagFileParser::InPage, []() { return std::make_unique<TagPageInfo>(); } } }, { "package", { TagFileParser::InPackage, []() { return std::make_unique<TagPackageInfo>(); } } }, @@ -882,31 +931,31 @@ static const std::map< std::string, CompoundFactory > g_compoundFactory = //--------------------------------------------------------------------------------------------------------------- -void TagFileParser::startElement( const std::string &name, const XMLHandlers::Attributes& attrib ) +void TagFileParser::startElement( const QCString &name, const XMLHandlers::Attributes& attrib ) { - //printf("startElement '%s'\n",name.data()); - auto it = g_elementHandlers.find(name); + //printf("startElement '%s'\n",qPrint(name)); + auto it = g_elementHandlers.find(name.str()); if (it!=std::end(g_elementHandlers)) { it->second.startCb(*this,attrib); } else { - warn("Unknown start tag '%s' found!",name.data()); + warn("Unknown start tag '%s' found!",qPrint(name)); } } -void TagFileParser::endElement( const std::string &name ) +void TagFileParser::endElement( const QCString &name ) { - //printf("endElement '%s'\n",name.data()); - auto it = g_elementHandlers.find(name); + //printf("endElement '%s'\n",qPrint(name)); + auto it = g_elementHandlers.find(name.str()); if (it!=std::end(g_elementHandlers)) { it->second.endCb(*this); } else { - warn("Unknown end tag '%s' found!",name.data()); + warn("Unknown end tag '%s' found!",qPrint(name)); } } @@ -921,6 +970,7 @@ void TagFileParser::startCompound( const XMLHandlers::Attributes& attrib ) { m_curCompound = it->second.make_instance(); m_state = it->second.state; + m_curCompound->lineNr = m_locator->lineNr(); } else { @@ -945,23 +995,34 @@ void TagFileParser::dump() if (comp->compoundType()==TagCompoundInfo::CompoundType::Class) { const TagClassInfo *cd = TagClassInfo::get(comp); - msg("class '%s'\n",cd->name.data()); - msg(" filename '%s'\n",cd->filename.data()); + msg("class '%s'\n",qPrint(cd->name)); + msg(" filename '%s'\n",qPrint(cd->filename)); for (const BaseInfo &bi : cd->bases) { - msg( " base: %s \n", bi.name.data() ); + msg( " base: %s \n", bi.name.isEmpty() ? "" : qPrint(bi.name) ); } for (const auto &md : cd->members) { msg(" member:\n"); - msg(" kind: '%s'\n",md.kind.data()); - msg(" name: '%s'\n",md.name.data()); - msg(" anchor: '%s'\n",md.anchor.data()); - msg(" arglist: '%s'\n",md.arglist.data()); + msg(" kind: '%s'\n",qPrint(md.kind)); + msg(" name: '%s'\n",qPrint(md.name)); + msg(" anchor: '%s'\n",qPrint(md.anchor)); + msg(" arglist: '%s'\n",qPrint(md.arglist)); } } } + //============== CONCEPTS + for (const auto &comp : m_tagFileCompounds) + { + if (comp->compoundType()==TagCompoundInfo::CompoundType::Concept) + { + const TagConceptInfo *cd = TagConceptInfo::get(comp); + + msg("concept '%s'\n",qPrint(cd->name)); + msg(" filename '%s'\n",qPrint(cd->filename)); + } + } //============== NAMESPACES for (const auto &comp : m_tagFileCompounds) { @@ -969,8 +1030,8 @@ void TagFileParser::dump() { const TagNamespaceInfo *nd = TagNamespaceInfo::get(comp); - msg("namespace '%s'\n",nd->name.data()); - msg(" filename '%s'\n",nd->filename.data()); + msg("namespace '%s'\n",qPrint(nd->name)); + msg(" filename '%s'\n",qPrint(nd->filename)); for (const auto &cls : nd->classList) { msg( " class: %s \n", cls.c_str() ); @@ -979,10 +1040,10 @@ void TagFileParser::dump() for (const auto &md : nd->members) { msg(" member:\n"); - msg(" kind: '%s'\n",md.kind.data()); - msg(" name: '%s'\n",md.name.data()); - msg(" anchor: '%s'\n",md.anchor.data()); - msg(" arglist: '%s'\n",md.arglist.data()); + msg(" kind: '%s'\n",qPrint(md.kind)); + msg(" name: '%s'\n",qPrint(md.name)); + msg(" anchor: '%s'\n",qPrint(md.anchor)); + msg(" arglist: '%s'\n",qPrint(md.arglist)); } } } @@ -994,8 +1055,8 @@ void TagFileParser::dump() { const TagFileInfo *fd = TagFileInfo::get(comp); - msg("file '%s'\n",fd->name.data()); - msg(" filename '%s'\n",fd->filename.data()); + msg("file '%s'\n",qPrint(fd->name)); + msg(" filename '%s'\n",qPrint(fd->filename)); for (const auto &ns : fd->namespaceList) { msg( " namespace: %s \n", ns.c_str() ); @@ -1008,15 +1069,15 @@ void TagFileParser::dump() for (const auto &md : fd->members) { msg(" member:\n"); - msg(" kind: '%s'\n",md.kind.data()); - msg(" name: '%s'\n",md.name.data()); - msg(" anchor: '%s'\n",md.anchor.data()); - msg(" arglist: '%s'\n",md.arglist.data()); + msg(" kind: '%s'\n",qPrint(md.kind)); + msg(" name: '%s'\n",qPrint(md.name)); + msg(" anchor: '%s'\n",qPrint(md.anchor)); + msg(" arglist: '%s'\n",qPrint(md.arglist)); } for (const auto &ii : fd->includes) { - msg(" includes id: %s name: %s\n",ii.id.data(),ii.name.data()); + msg(" includes id: %s name: %s\n",qPrint(ii.id),qPrint(ii.name)); } } } @@ -1027,8 +1088,8 @@ void TagFileParser::dump() if (comp->compoundType()==TagCompoundInfo::CompoundType::Group) { const TagGroupInfo *gd = TagGroupInfo::get(comp); - msg("group '%s'\n",gd->name.data()); - msg(" filename '%s'\n",gd->filename.data()); + msg("group '%s'\n",qPrint(gd->name)); + msg(" filename '%s'\n",qPrint(gd->filename)); for (const auto &ns : gd->namespaceList) { @@ -1054,10 +1115,10 @@ void TagFileParser::dump() for (const auto &md : gd->members) { msg(" member:\n"); - msg(" kind: '%s'\n",md.kind.data()); - msg(" name: '%s'\n",md.name.data()); - msg(" anchor: '%s'\n",md.anchor.data()); - msg(" arglist: '%s'\n",md.arglist.data()); + msg(" kind: '%s'\n",qPrint(md.kind)); + msg(" name: '%s'\n",qPrint(md.name)); + msg(" anchor: '%s'\n",qPrint(md.anchor)); + msg(" arglist: '%s'\n",qPrint(md.arglist)); } } } @@ -1068,9 +1129,9 @@ void TagFileParser::dump() if (comp->compoundType()==TagCompoundInfo::CompoundType::Page) { const TagPageInfo *pd = TagPageInfo::get(comp); - msg("page '%s'\n",pd->name.data()); - msg(" title '%s'\n",pd->title.data()); - msg(" filename '%s'\n",pd->filename.data()); + msg("page '%s'\n",qPrint(pd->name)); + msg(" title '%s'\n",qPrint(pd->title)); + msg(" filename '%s'\n",qPrint(pd->filename)); } } @@ -1081,8 +1142,8 @@ void TagFileParser::dump() { const TagDirInfo *dd = TagDirInfo::get(comp); { - msg("dir '%s'\n",dd->name.data()); - msg(" path '%s'\n",dd->path.data()); + msg("dir '%s'\n",qPrint(dd->name)); + msg(" path '%s'\n",qPrint(dd->path)); for (const auto &fi : dd->fileList) { msg( " file: %s \n", fi.c_str() ); @@ -1100,18 +1161,18 @@ void TagFileParser::addDocAnchors(const std::shared_ptr<Entry> &e,const std::vec { for (const auto &ta : l) { - if (SectionManager::instance().find(ta.label.c_str())==0) + if (SectionManager::instance().find(QCString(ta.label))==0) { //printf("New sectionInfo file=%s anchor=%s\n", - // ta->fileName.data(),ta->label.data()); + // qPrint(ta->fileName),qPrint(ta->label)); SectionInfo *si=SectionManager::instance().add( - ta.label.c_str(),ta.fileName.c_str(),-1,ta.title.c_str(), - SectionType::Anchor,0,m_tagName.c_str()); + ta.label,ta.fileName,-1,ta.title, + SectionType::Anchor,0,m_tagName); e->anchors.push_back(si); } else { - warn("Duplicate anchor %s found",ta.label.data()); + warn("Duplicate anchor %s found",qPrint(ta.label)); } } } @@ -1150,6 +1211,7 @@ void TagFileParser::buildMemberList(const std::shared_ptr<Entry> &ce,const std:: me->stat = tmi.isStatic; me->fileName = ce->fileName; me->id = tmi.clangId; + me->startLine = tmi.lineNr; if (ce->section == Entry::GROUPDOC_SEC) { me->groups.push_back(Grouping(ce->name,Grouping::GROUPING_INGROUP)); @@ -1230,19 +1292,6 @@ void TagFileParser::buildMemberList(const std::shared_ptr<Entry> &ce,const std:: } } -static QCString stripPath(const QCString &s) -{ - int i=s.findRev('/'); - if (i!=-1) - { - return s.right(s.length()-i-1); - } - else - { - return s; - } -} - /*! Injects the info gathered by the XML parser into the Entry tree. * This tree contains the information extracted from the input in a * "unrelated" form. @@ -1282,9 +1331,10 @@ void TagFileParser::buildLists(const std::shared_ptr<Entry> &root) ce->tagInfoData.tagName = m_tagName; ce->tagInfoData.anchor = tci->anchor; ce->tagInfoData.fileName = tci->filename; - ce->hasTagInfo = TRUE; - ce->id = tci->clangId; - ce->lang = tci->isObjC ? SrcLangExt_ObjC : SrcLangExt_Unknown; + ce->startLine = tci->lineNr; + ce->hasTagInfo = TRUE; + ce->id = tci->clangId; + ce->lang = tci->isObjC ? SrcLangExt_ObjC : SrcLangExt_Unknown; // transfer base class list ce->extends = tci->bases; if (!tci->templateArguments.empty()) @@ -1313,28 +1363,29 @@ void TagFileParser::buildLists(const std::shared_ptr<Entry> &root) const TagFileInfo *tfi = TagFileInfo::get(comp); std::shared_ptr<Entry> fe = std::make_shared<Entry>(); - fe->section = guessSection(tfi->name.c_str()); - fe->name = tfi->name.c_str(); + fe->section = guessSection(tfi->name); + fe->name = tfi->name; addDocAnchors(fe,tfi->docAnchors); fe->tagInfoData.tagName = m_tagName; fe->tagInfoData.fileName = tfi->filename; fe->hasTagInfo = TRUE; - std::string fullName = m_tagName+":"+tfi->path+stripPath(tfi->name).str(); - fe->fileName = fullName; - //printf("createFileDef() filename=%s\n",tfi->filename.data()); - std::string tagid = m_tagName+":"+tfi->path; - std::unique_ptr<FileDef> fd { createFileDef(tagid.c_str(), - tfi->name.c_str(),m_tagName.c_str(), - tfi->filename.c_str()) }; + QCString fullName = m_tagName+":"+tfi->path+stripPath(tfi->name); + fe->fileName = fullName; + fe->startLine = tfi->lineNr; + //printf("createFileDef() filename=%s\n",qPrint(tfi->filename)); + QCString tagid = m_tagName+":"+tfi->path; + std::unique_ptr<FileDef> fd { createFileDef(tagid, + tfi->name,m_tagName, + tfi->filename) }; FileName *mn; - if ((mn=Doxygen::inputNameLinkedMap->find(tfi->name.c_str()))) + if ((mn=Doxygen::inputNameLinkedMap->find(tfi->name))) { mn->push_back(std::move(fd)); } else { - mn = Doxygen::inputNameLinkedMap->add(tfi->name.c_str(),fullName.c_str()); + mn = Doxygen::inputNameLinkedMap->add(tfi->name,fullName); mn->push_back(std::move(fd)); } buildMemberList(fe,tfi->members); @@ -1342,6 +1393,27 @@ void TagFileParser::buildLists(const std::shared_ptr<Entry> &root) } } + // build concept list + for (const auto &comp : m_tagFileCompounds) + { + if (comp->compoundType()==TagCompoundInfo::CompoundType::Concept) + { + const TagConceptInfo *tci = TagConceptInfo::get(comp); + + std::shared_ptr<Entry> ce = std::make_shared<Entry>(); + ce->section = Entry::CONCEPT_SEC; + ce->name = tci->name; + addDocAnchors(ce,tci->docAnchors); + ce->tagInfoData.tagName = m_tagName; + ce->tagInfoData.fileName = tci->filename; + ce->startLine = tci->lineNr; + ce->hasTagInfo = TRUE; + ce->id = tci->clangId; + + root->moveToSubEntryAndKeep(ce); + } + } + // build namespace list for (const auto &comp : m_tagFileCompounds) { @@ -1355,6 +1427,7 @@ void TagFileParser::buildLists(const std::shared_ptr<Entry> &root) addDocAnchors(ne,tni->docAnchors); ne->tagInfoData.tagName = m_tagName; ne->tagInfoData.fileName = tni->filename; + ne->startLine = tni->lineNr; ne->hasTagInfo = TRUE; ne->id = tni->clangId; @@ -1376,6 +1449,7 @@ void TagFileParser::buildLists(const std::shared_ptr<Entry> &root) addDocAnchors(pe,tpgi->docAnchors); pe->tagInfoData.tagName = m_tagName; pe->tagInfoData.fileName = tpgi->filename; + pe->startLine = tpgi->lineNr; pe->hasTagInfo = TRUE; buildMemberList(pe,tpgi->members); @@ -1397,6 +1471,7 @@ void TagFileParser::buildLists(const std::shared_ptr<Entry> &root) addDocAnchors(ge,tgi->docAnchors); ge->tagInfoData.tagName = m_tagName; ge->tagInfoData.fileName = tgi->filename; + ge->startLine = tgi->lineNr; ge->hasTagInfo = TRUE; buildMemberList(ge,tgi->members); @@ -1418,7 +1493,7 @@ void TagFileParser::buildLists(const std::shared_ptr<Entry> &root) [&](const std::shared_ptr<Entry> &e) { return e->name == sg.c_str(); }); if (i!=children.end()) { - (*i)->groups.push_back(Grouping(tgi->name.c_str(),Grouping::GROUPING_INGROUP)); + (*i)->groups.push_back(Grouping(tgi->name,Grouping::GROUPING_INGROUP)); } } } @@ -1432,13 +1507,14 @@ void TagFileParser::buildLists(const std::shared_ptr<Entry> &root) const TagPageInfo *tpi = TagPageInfo::get(comp); std::shared_ptr<Entry> pe = std::make_shared<Entry>(); - bool isIndex = (stripExtensionGeneral(tpi->filename.c_str(),getFileNameExtension(tpi->filename.c_str()))=="index"); + bool isIndex = (stripExtensionGeneral(tpi->filename,getFileNameExtension(tpi->filename))=="index"); pe->section = isIndex ? Entry::MAINPAGEDOC_SEC : Entry::PAGEDOC_SEC; pe->name = tpi->name; pe->args = tpi->title; addDocAnchors(pe,tpi->docAnchors); pe->tagInfoData.tagName = m_tagName; pe->tagInfoData.fileName = tpi->filename; + pe->startLine = tpi->lineNr; pe->hasTagInfo = TRUE; root->moveToSubEntryAndKeep(pe); } @@ -1452,30 +1528,30 @@ void TagFileParser::addIncludes() if (comp->compoundType()==TagCompoundInfo::CompoundType::File) { const TagFileInfo *tfi = TagFileInfo::get(comp); - //printf("tag file tagName=%s path=%s name=%s\n",m_tagName.data(),tfi->path.data(),tfi->name.data()); - FileName *fn = Doxygen::inputNameLinkedMap->find(tfi->name.c_str()); + //printf("tag file tagName=%s path=%s name=%s\n",qPrint(m_tagName),qPrint(tfi->path),qPrint(tfi->name)); + FileName *fn = Doxygen::inputNameLinkedMap->find(tfi->name); if (fn) { for (const auto &fd : *fn) { - //printf("input file path=%s name=%s\n",fd->getPath().data(),fd->name().data()); + //printf("input file path=%s name=%s\n",qPrint(fd->getPath()),qPrint(fd->name())); if (fd->getPath()==QCString(m_tagName+":"+tfi->path)) { //printf("found\n"); for (const auto &ii : tfi->includes) { - //printf("ii->name='%s'\n",ii->name.data()); - FileName *ifn = Doxygen::inputNameLinkedMap->find(ii.name.c_str()); + //printf("ii->name='%s'\n",qPrint(ii->name)); + FileName *ifn = Doxygen::inputNameLinkedMap->find(ii.name); ASSERT(ifn!=0); if (ifn) { for (const auto &ifd : *ifn) { //printf("ifd->getOutputFileBase()=%s ii->id=%s\n", - // ifd->getOutputFileBase().data(),ii->id.data()); + // qPrint(ifd->getOutputFileBase()),qPrint(ii->id)); if (ifd->getOutputFileBase()==QCString(ii.id)) { - fd->addIncludeDependency(ifd.get(),ii.text.c_str(),ii.isLocal,ii.isImported); + fd->addIncludeDependency(ifd.get(),ii.text,ii.isLocal,ii.isImported); } } } @@ -1494,13 +1570,13 @@ void parseTagFile(const std::shared_ptr<Entry> &root,const char *fullName) XMLHandlers handlers; // connect the generic events handlers of the XML parser to the specific handlers of the tagFileParser object handlers.startDocument = [&tagFileParser]() { tagFileParser.startDocument(); }; - handlers.startElement = [&tagFileParser](const std::string &name,const XMLHandlers::Attributes &attrs) { tagFileParser.startElement(name,attrs); }; - handlers.endElement = [&tagFileParser](const std::string &name) { tagFileParser.endElement(name); }; - handlers.characters = [&tagFileParser](const std::string &chars) { tagFileParser.characters(chars); }; - handlers.error = [&tagFileParser](const std::string &fileName,int lineNr,const std::string &msg) { tagFileParser.error(fileName,lineNr,msg); }; + handlers.startElement = [&tagFileParser](const std::string &name,const XMLHandlers::Attributes &attrs) { tagFileParser.startElement(QCString(name),attrs); }; + handlers.endElement = [&tagFileParser](const std::string &name) { tagFileParser.endElement(QCString(name)); }; + handlers.characters = [&tagFileParser](const std::string &chars) { tagFileParser.characters(QCString(chars)); }; + handlers.error = [&tagFileParser](const std::string &fileName,int lineNr,const std::string &msg) { tagFileParser.error(QCString(fileName),lineNr,QCString(msg)); }; XMLParser parser(handlers); tagFileParser.setDocumentLocator(&parser); - parser.parse(fullName,inputStr,Debug::isFlagSet(Debug::Lex)); + parser.parse(fullName,inputStr.data(),Debug::isFlagSet(Debug::Lex)); tagFileParser.buildLists(root); tagFileParser.addIncludes(); //tagFileParser.dump(); diff --git a/src/template.cpp b/src/template.cpp index e96b16a..82b35f7 100644..100755 --- a/src/template.cpp +++ b/src/template.cpp @@ -98,10 +98,11 @@ static std::vector<QCString> split(const QCString &str,const QCString &sep, /** Strips spaces surrounding `=` from string \a in, so * `foo = 10 bar=5 baz= 'hello'` will become `foo=10 bar=5 baz='hello'` */ -static QCString removeSpacesAroundEquals(const char *s) +static QCString removeSpacesAroundEquals(const QCString &s) { + if (s.isEmpty()) return s; QCString result(s); - const char *p=result.data(); + const char *p=s.data(); char *q = result.rawData(); char c; while ((c=*p++)) @@ -119,14 +120,14 @@ static QCString removeSpacesAroundEquals(const char *s) } *q++=c; } - if (q<p) result.resize(q-result.data()+1); + if (q<p) result.resize(static_cast<uint>(q-result.data())+1); return result; } //---------------------------------------------------------------------------- #if ENABLE_TRACING -static QCString replace(const char *s,char csrc,char cdst) +static QCString replace(const QCString &s,char csrc,char cdst) { QCString result = s; for (char *p=result.data();*p;p++) @@ -268,22 +269,22 @@ int TemplateStruct::release() return count; } -void TemplateStruct::set(const char *name,const TemplateVariant &v) +void TemplateStruct::set(const QCString &name,const TemplateVariant &v) { - auto it = p->fields.find(name); + auto it = p->fields.find(name.str()); if (it!=p->fields.end()) // change existing field { it->second = v; } else // insert new field { - p->fields.insert(std::make_pair(name,v)); + p->fields.insert(std::make_pair(name.str(),v)); } } -TemplateVariant TemplateStruct::get(const char *name) const +TemplateVariant TemplateStruct::get(const QCString &name) const { - auto it = p->fields.find(name); + auto it = p->fields.find(name.str()); return it!=p->fields.end() ? it->second : TemplateVariant(); } @@ -512,7 +513,7 @@ class TemplateContextImpl : public TemplateContext // TemplateContext methods void push(); void pop(); - void set(const char *name,const TemplateVariant &v); + void set(const QCString &name,const TemplateVariant &v); TemplateVariant get(const QCString &name) const; const TemplateVariant *getRef(const QCString &name) const; void setOutputDirectory(const QCString &dir) @@ -552,7 +553,7 @@ class TemplateContextImpl : public TemplateContext QCString encoding() const { return m_encoding; } void setEncoding(const QCString &file,int line,const QCString &enc); QCString recode(const QCString &s); - void warn(const char *fileName,int line,const char *fmt,...) const; + void warn(const QCString &fileName,int line,const char *fmt,...) const; // index related functions void openSubIndex(const QCString &indexName); @@ -628,12 +629,12 @@ class FilterGet if (v.isValid() && v.type()==TemplateVariant::Struct && arg.type()==TemplateVariant::String) { TemplateVariant result = v.toStruct()->get(arg.toString()); - //printf("\nok[%s]=%d\n",arg.toString().data(),result.type()); + //printf("\nok[%s]=%d\n",qPrint(arg.toString()),result.type()); return result; } else { - //printf("\nnok[%s]\n",arg.toString().data()); + //printf("\nnok[%s]\n",qPrint(arg.toString())); return FALSE; } } @@ -874,7 +875,7 @@ class FilterListSort { if (v.type()==TemplateVariant::List && args.type()==TemplateVariant::String) { - //printf("FilterListSort::apply: v=%s args=%s\n",v.toString().data(),args.toString().data()); + //printf("FilterListSort::apply: v=%s args=%s\n",qPrint(v.toString()),qPrint(args.toString())); TemplateListIntf::ConstIterator *it = v.toList()->createIterator(); TemplateVariant item; @@ -891,7 +892,7 @@ class FilterListSort { QCString sortKey = determineSortKey(s,args.toString()); sortList.emplace_back(sortKey,item); - //printf("sortKey=%s\n",sortKey.data()); + //printf("sortKey=%s\n",qPrint(sortKey)); } } delete it; @@ -899,7 +900,7 @@ class FilterListSort // sort the list std::sort(sortList.begin(), sortList.end(), - [](const auto &lhs,const auto &rhs) { return qstrcmp(lhs.key,rhs.key)<0; }); + [](const auto &lhs,const auto &rhs) { return lhs.key < rhs.key; }); // add sorted items to the result list for (const auto &elem : sortList) @@ -924,7 +925,7 @@ class FilterListSort { QCString var = arg.mid(i+2,j-i-2); TemplateVariant val=s->get(var); - //printf("found argument %s value=%s\n",var.data(),val.toString().data()); + //printf("found argument %s value=%s\n",qPrint(var),qPrint(val.toString())); result+=val.toString(); p=j+2; } @@ -954,7 +955,7 @@ class FilterGroupBy { if (v.type()==TemplateVariant::List && args.type()==TemplateVariant::String) { - //printf("FilterListSort::apply: v=%s args=%s\n",v.toString().data(),args.toString().data()); + //printf("FilterListSort::apply: v=%s args=%s\n",qPrint(v.toString()),qPrint(args.toString())); TemplateListIntf::ConstIterator *it = v.toList()->createIterator(); TemplateVariant item; @@ -971,7 +972,7 @@ class FilterGroupBy { QCString sortKey = determineSortKey(s,args.toString()); sortList.emplace_back(sortKey,item); - //printf("sortKey=%s\n",sortKey.data()); + //printf("sortKey=%s\n",qPrint(sortKey)); } } delete it; @@ -979,7 +980,7 @@ class FilterGroupBy // sort the list std::sort(sortList.begin(), sortList.end(), - [](const auto &lhs,const auto &rhs) { return qstrcmp(lhs.key,rhs.key)<0; }); + [](const auto &lhs,const auto &rhs) { return lhs.key < rhs.key; }); // add sorted items to the result list TemplateList *groupList=0; @@ -1081,10 +1082,10 @@ class FilterAlphaIndex QCString key; TemplateVariant value; }; - static QCString keyToLabel(const char *startLetter) + static QCString keyToLabel(const QCString &startLetter) { - const char *p = startLetter; - if (startLetter==0 || *startLetter==0) return ""; + if (startLetter.isEmpty()) return startLetter; + const char *p = startLetter.data(); char c = *p; QCString result; if (c<127 && c>31) // printable ASCII character @@ -1118,7 +1119,7 @@ class FilterAlphaIndex { if (v.type()==TemplateVariant::List && args.type()==TemplateVariant::String) { - //printf("FilterListSort::apply: v=%s args=%s\n",v.toString().data(),args.toString().data()); + //printf("FilterListSort::apply: v=%s args=%s\n",qPrint(v.toString()),qPrint(args.toString())); TemplateListIntf::ConstIterator *it = v.toList()->createIterator(); TemplateVariant item; @@ -1135,7 +1136,7 @@ class FilterAlphaIndex { uint sortKey = determineSortKey(s,args.toString()); sortList.emplace_back(sortKey,item); - //printf("sortKey=%s\n",sortKey.data()); + //printf("sortKey=%s\n",qPrint(sortKey)); } } delete it; @@ -1143,7 +1144,7 @@ class FilterAlphaIndex // sort the list std::sort(sortList.begin(), sortList.end(), - [](const auto &lhs,const auto &rhs) { return qstrcmp(lhs.key,rhs.key)<0; }); + [](const auto &lhs,const auto &rhs) { return lhs.key < rhs.key; }); // create an index from the sorted list QCString letter; @@ -1407,7 +1408,7 @@ class ExprAstNumber : public ExprAst class ExprAstVariable : public ExprAst { public: - ExprAstVariable(const char *name) : m_name(name) + ExprAstVariable(const QCString &name) : m_name(name) { TRACE(("ExprAstVariable(%s)\n",name)); } const QCString &name() const { return m_name; } virtual TemplateVariant resolve(TemplateContext *c) @@ -1416,7 +1417,7 @@ class ExprAstVariable : public ExprAst TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (!v.isValid()) { - if (ci) ci->warn(ci->templateName(),ci->line(),"undefined variable '%s' in expression",m_name.data()); + if (ci) ci->warn(ci->templateName(),ci->line(),"undefined variable '%s' in expression",qPrint(m_name)); } return v; } @@ -1459,7 +1460,7 @@ class ExprAstFunctionVariable : public ExprAst class ExprAstFilter : public ExprAst { public: - ExprAstFilter(const char *name,ExprAst *arg) : m_name(name), m_arg(arg) + ExprAstFilter(const QCString &name,ExprAst *arg) : m_name(name), m_arg(arg) { TRACE(("ExprAstFilter(%s)\n",name)); } ~ExprAstFilter() { delete m_arg; } const QCString &name() const { return m_name; } @@ -1467,14 +1468,14 @@ class ExprAstFilter : public ExprAst { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return v; // should not happen - TRACE(("Applying filter '%s' to '%s' (type=%d)\n",m_name.data(),v.toString().data(),v.type())); + TRACE(("Applying filter '%s' to '%s' (type=%d)\n",qPrint(m_name),qPrint(v.toString()),v.type())); TemplateVariant arg; if (m_arg) arg = m_arg->resolve(c); bool ok; TemplateVariant result = TemplateFilterFactory::instance()->apply(m_name,v,arg,ok); if (!ok) { - ci->warn(ci->templateName(),ci->line(),"unknown filter '%s'",m_name.data()); + ci->warn(ci->templateName(),ci->line(),"unknown filter '%s'",qPrint(m_name)); } return result; } @@ -1504,7 +1505,7 @@ class ExprAstFilterAppl : public ExprAst class ExprAstLiteral : public ExprAst { public: - ExprAstLiteral(const char *lit) : m_literal(lit) + ExprAstLiteral(const QCString &lit) : m_literal(lit) { TRACE(("ExprAstLiteral(%s)\n",lit)); } const QCString &literal() const { return m_literal; } virtual TemplateVariant resolve(TemplateContext *) { return TemplateVariant(m_literal); } @@ -1664,7 +1665,7 @@ class TemplateNode TemplateNode(TemplateNode *parent) : m_parent(parent) {} virtual ~TemplateNode() {} - virtual void render(std::ostream &ts, TemplateContext *c) = 0; + virtual void render(TextStream &ts, TemplateContext *c) = 0; TemplateNode *parent() { return m_parent; } @@ -1679,7 +1680,7 @@ class TemplateToken { public: enum Type { Text, Variable, Block }; - TemplateToken(Type t,const char *d,int l) : type(t), data(d), line(l) {} + TemplateToken(Type t,const QCString &d,int l) : type(t), data(d), line(l) {} Type type = Text; QCString data; int line = 0; @@ -1694,7 +1695,7 @@ using TemplateTokenStream = std::deque< TemplateTokenPtr >; class TemplateNodeList : public std::vector< std::unique_ptr<TemplateNode> > { public: - void render(std::ostream &ts,TemplateContext *c) + void render(TextStream &ts,TemplateContext *c) { TRACE(("{TemplateNodeList::render\n")); for (const auto &tn : *this) @@ -1722,7 +1723,7 @@ class TemplateParser void prependToken(TemplateTokenPtr &&token); const TemplateToken *currentToken() const; QCString templateName() const { return m_templateName; } - void warn(const char *fileName,int line,const char *fmt,...) const; + void warn(const QCString &fileName,int line,const char *fmt,...) const; private: const TemplateEngine *m_engine = 0; QCString m_templateName; @@ -1744,10 +1745,10 @@ class ExpressionParser { } - ExprAst *parse(const char *expr) + ExprAst *parse(const QCString &expr) { - if (expr==0) return 0; - m_tokenStream = expr; + if (expr.isEmpty()) return 0; + m_tokenStream = expr.data(); getNextToken(); return parseExpression(); } @@ -1988,7 +1989,7 @@ class ExpressionParser ExprAst *parseIdentifier() { - TRACE(("{parseIdentifier(%s)\n",m_curToken.id.data())); + TRACE(("{parseIdentifier(%s)\n",qPrint(m_curToken.id))); ExprAst *id = new ExprAstVariable(m_curToken.id); getNextToken(); TRACE(("}parseIdentifier()\n")); @@ -1997,7 +1998,7 @@ class ExpressionParser ExprAst *parseLiteral() { - TRACE(("{parseLiteral(%s)\n",m_curToken.id.data())); + TRACE(("{parseLiteral(%s)\n",qPrint(m_curToken.id))); ExprAst *expr = new ExprAstLiteral(m_curToken.id); getNextToken(); TRACE(("}parseLiteral()\n")); @@ -2006,7 +2007,7 @@ class ExpressionParser ExprAst *parseIdentifierOptionalArgs() { - TRACE(("{parseIdentifierOptionalArgs(%s)\n",m_curToken.id.data())); + TRACE(("{parseIdentifierOptionalArgs(%s)\n",qPrint(m_curToken.id))); ExprAst *expr = parseIdentifier(); if (expr) { @@ -2050,7 +2051,7 @@ class ExpressionParser ExprAstFilter *parseFilter() { - TRACE(("{parseFilter(%s)\n",m_curToken.id.data())); + TRACE(("{parseFilter(%s)\n",qPrint(m_curToken.id))); QCString filterName = m_curToken.id; getNextToken(); ExprAst *argExpr=0; @@ -2261,7 +2262,7 @@ class ExpressionParser p++; } //TRACE(("token type=%d op=%d num=%d id=%s\n", - // m_curToken.type,m_curToken.op,m_curToken.num,m_curToken.id.data())); + // m_curToken.type,m_curToken.op,m_curToken.num,qPrint(m_curToken.id))); m_tokenStream = p; return TRUE; @@ -2282,7 +2283,7 @@ class TemplateImpl : public TemplateNode, public Template TemplateImpl(TemplateEngine *e,const QCString &name,const QCString &data, const QCString &extension); ~TemplateImpl(); - void render(std::ostream &ts, TemplateContext *c); + void render(TextStream &ts, TemplateContext *c); TemplateEngine *engine() const { return m_engine; } TemplateBlockContext *blockContext() { return &m_blockContext; } @@ -2303,7 +2304,7 @@ class TemplateStructWeakRef : public TemplateStructIntf { public: TemplateStructWeakRef(TemplateStructIntf *ref) : m_ref(ref), m_refCount(0) {} - virtual TemplateVariant get(const char *name) const { return m_ref->get(name); } + virtual TemplateVariant get(const QCString &name) const { return m_ref->get(name); } virtual int addRef() { return ++m_refCount; } virtual int release() { int count=--m_refCount; if (count<=0) { delete this; } return count; } private: @@ -2338,24 +2339,24 @@ void TemplateContextImpl::setEncoding(const QCString &templateName,int line,cons m_encoding=enc; if (!enc.isEmpty()) { - m_fromUtf8 = portable_iconv_open(enc,"UTF-8"); + m_fromUtf8 = portable_iconv_open(enc.data(),"UTF-8"); if (m_fromUtf8==(void*)(-1)) { - warn(templateName,line,"unsupported character conversion: '%s'->'UTF-8'\n", enc.data()); + warn(templateName,line,"unsupported character conversion: '%s'->'UTF-8'\n", qPrint(enc)); } } - //printf("TemplateContextImpl::setEncoding(%s)\n",enc.data()); + //printf("TemplateContextImpl::setEncoding(%s)\n",qPrint(enc)); } QCString TemplateContextImpl::recode(const QCString &s) { - //printf("TemplateContextImpl::recode(%s)\n",s.data()); + //printf("TemplateContextImpl::recode(%s)\n",qPrint(s)); int iSize = s.length(); int oSize = iSize*4+1; QCString output(oSize); size_t iLeft = iSize; size_t oLeft = oSize; - char *iPtr = s.rawData(); + const char *iPtr = s.data(); char *oPtr = output.rawData(); if (!portable_iconv(m_fromUtf8,&iPtr,&iLeft,&oPtr,&oLeft)) { @@ -2370,15 +2371,15 @@ QCString TemplateContextImpl::recode(const QCString &s) } } -void TemplateContextImpl::set(const char *name,const TemplateVariant &v) +void TemplateContextImpl::set(const QCString &name,const TemplateVariant &v) { auto &ctx = m_contextStack.front(); - auto it = ctx.find(name); + auto it = ctx.find(name.str()); if (it!=ctx.end()) { ctx.erase(it); } - ctx.insert(std::make_pair(name,v)); + ctx.insert(std::make_pair(name.str(),v)); } TemplateVariant TemplateContextImpl::get(const QCString &name) const @@ -2395,7 +2396,7 @@ TemplateVariant TemplateContextImpl::get(const QCString &name) const QCString propName = name.mid(i+1); while (!propName.isEmpty()) { - //printf("getPrimary(%s) type=%d:%s\n",objName.data(),v.type(),v.toString().data()); + //printf("getPrimary(%s) type=%d:%s\n",qPrint(objName),v.type(),qPrint(v.toString())); if (v.type()==TemplateVariant::Struct) { i = propName.find("."); @@ -2403,7 +2404,7 @@ TemplateVariant TemplateContextImpl::get(const QCString &name) const v = v.toStruct()->get(propName.left(l)); if (!v.isValid()) { - warn(m_templateName,m_line,"requesting non-existing property '%s' for object '%s'",propName.left(l).data(),objName.data()); + warn(m_templateName,m_line,"requesting non-existing property '%s' for object '%s'",qPrint(propName.left(l)),qPrint(objName)); } if (i!=-1) { @@ -2427,7 +2428,7 @@ TemplateVariant TemplateContextImpl::get(const QCString &name) const } else { - warn(m_templateName,m_line,"list index '%s' is not valid",propName.data()); + warn(m_templateName,m_line,"list index '%s' is not valid",qPrint(propName)); break; } if (i!=-1) @@ -2441,7 +2442,7 @@ TemplateVariant TemplateContextImpl::get(const QCString &name) const } else { - warn(m_templateName,m_line,"using . on an object '%s' is not an struct or list",objName.data()); + warn(m_templateName,m_line,"using . on an object '%s' is not an struct or list",qPrint(objName)); return TemplateVariant(); } } @@ -2490,7 +2491,7 @@ TemplateBlockContext *TemplateContextImpl::blockContext() return &m_blockContext; } -void TemplateContextImpl::warn(const char *fileName,int line,const char *fmt,...) const +void TemplateContextImpl::warn(const QCString &fileName,int line,const char *fmt,...) const { va_list args; va_start(args,fmt); @@ -2501,11 +2502,11 @@ void TemplateContextImpl::warn(const char *fileName,int line,const char *fmt,... void TemplateContextImpl::openSubIndex(const QCString &indexName) { - //printf("TemplateContextImpl::openSubIndex(%s)\n",indexName.data()); + //printf("TemplateContextImpl::openSubIndex(%s)\n",qPrint(indexName)); auto kv = m_indexStacks.find(indexName.str()); if (kv==m_indexStacks.end() || kv->second.empty() || kv->second.top().type()==TemplateVariant::List) // error: no stack yet or no entry { - warn(m_templateName,m_line,"opensubindex for index %s without preceding indexentry",indexName.data()); + warn(m_templateName,m_line,"opensubindex for index %s without preceding indexentry",qPrint(indexName)); return; } // get the parent entry to add the list to @@ -2523,11 +2524,11 @@ void TemplateContextImpl::openSubIndex(const QCString &indexName) void TemplateContextImpl::closeSubIndex(const QCString &indexName) { - //printf("TemplateContextImpl::closeSubIndex(%s)\n",indexName.data()); + //printf("TemplateContextImpl::closeSubIndex(%s)\n",qPrint(indexName)); auto kv = m_indexStacks.find(indexName.str()); if (kv==m_indexStacks.end() || kv->second.size()<3) { - warn(m_templateName,m_line,"closesubindex for index %s without matching open",indexName.data()); + warn(m_templateName,m_line,"closesubindex for index %s without matching open",qPrint(indexName)); } else { @@ -2547,7 +2548,7 @@ void TemplateContextImpl::closeSubIndex(const QCString &indexName) } } } - //fprintf(stderr,"TemplateContextImpl::closeSubIndex(%s) end g_count=%d\n\n",indexName.data(),g_count); + //fprintf(stderr,"TemplateContextImpl::closeSubIndex(%s) end g_count=%d\n\n",qPrint(indexName),g_count); } static void getPathListFunc(TemplateStructIntf *entry,TemplateList *list) @@ -2571,7 +2572,7 @@ static TemplateVariant getPathFunc(const void *ctx, const std::vector<TemplateVa void TemplateContextImpl::addIndexEntry(const QCString &indexName,const std::vector<TemplateKeyValue> &arguments) { auto it = arguments.begin(); - //printf("TemplateContextImpl::addIndexEntry(%s)\n",indexName.data()); + //printf("TemplateContextImpl::addIndexEntry(%s)\n",qPrint(indexName)); //while (it!=arguments.end()) //{ // printf(" key=%s value=%s\n",(*it).key.data(),(*it).value.toString().data()); @@ -2651,11 +2652,11 @@ class TemplateNodeText : public TemplateNode TRACE(("TemplateNodeText('%s')\n",replace(data,'\n',' ').data())); } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen - //printf("TemplateNodeText::render(%s) needsRecoding=%d ci=%p\n",m_data.data(),ci->needsRecoding(),ci); + //printf("TemplateNodeText::render(%s) needsRecoding=%d ci=%p\n",qPrint(m_data),ci->needsRecoding(),ci); if (ci->spacelessEnabled()) { if (ci->needsRecoding()) @@ -2692,12 +2693,12 @@ class TemplateNodeVariable : public TemplateNode TemplateNodeVariable(TemplateParser *parser,TemplateNode *parent,int line,const QCString &var) : TemplateNode(parent), m_templateName(parser->templateName()), m_line(line) { - TRACE(("TemplateNodeVariable(%s)\n",var.data())); + TRACE(("TemplateNodeVariable(%s)\n",qPrint(var))); ExpressionParser expParser(parser,line); m_var = expParser.parse(var); if (m_var==0) { - parser->warn(m_templateName,line,"invalid expression '%s' for variable",var.data()); + parser->warn(m_templateName,line,"invalid expression '%s' for variable",qPrint(var)); } } ~TemplateNodeVariable() @@ -2705,7 +2706,7 @@ class TemplateNodeVariable : public TemplateNode delete m_var; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -2822,7 +2823,7 @@ class TemplateNodeIf : public TemplateNodeCreator<TemplateNodeIf> TemplateNodeIf(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeIf>(parser,parent,line) { - TRACE(("{TemplateNodeIf(%s)\n",data.data())); + TRACE(("{TemplateNodeIf(%s)\n",qPrint(data))); if (data.isEmpty()) { parser->warn(m_templateName,line,"missing argument for if tag"); @@ -2861,13 +2862,13 @@ class TemplateNodeIf : public TemplateNodeCreator<TemplateNodeIf> parser->parse(this,line,stopAt,m_falseNodes); parser->removeNextToken(); // skip over endif } - TRACE(("}TemplateNodeIf(%s)\n",data.data())); + TRACE(("}TemplateNodeIf(%s)\n",qPrint(data))); } ~TemplateNodeIf() { } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -2918,19 +2919,19 @@ class TemplateNodeRepeat : public TemplateNodeCreator<TemplateNodeRepeat> TemplateNodeRepeat(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeRepeat>(parser,parent,line) { - TRACE(("{TemplateNodeRepeat(%s)\n",data.data())); + TRACE(("{TemplateNodeRepeat(%s)\n",qPrint(data))); ExpressionParser expParser(parser,line); m_expr = expParser.parse(data); StringVector stopAt = { "endrepeat" }; parser->parse(this,line,stopAt,m_repeatNodes); parser->removeNextToken(); // skip over endrepeat - TRACE(("}TemplateNodeRepeat(%s)\n",data.data())); + TRACE(("}TemplateNodeRepeat(%s)\n",qPrint(data))); } ~TemplateNodeRepeat() { delete m_expr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -2972,7 +2973,7 @@ class TemplateNodeRange : public TemplateNodeCreator<TemplateNodeRange> TemplateNodeRange(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeRange>(parser,parent,line), m_down(FALSE) { - TRACE(("{TemplateNodeRange(%s)\n",data.data())); + TRACE(("{TemplateNodeRange(%s)\n",qPrint(data))); QCString start,end; int i1 = data.find(" from "); int i2 = data.find(" to "); @@ -3033,7 +3034,7 @@ class TemplateNodeRange : public TemplateNodeCreator<TemplateNodeRange> StringVector stopAt = { "endrange" }; parser->parse(this,line,stopAt,m_loopNodes); parser->removeNextToken(); // skip over endrange - TRACE(("}TemplateNodeRange(%s)\n",data.data())); + TRACE(("}TemplateNodeRange(%s)\n",qPrint(data))); } ~TemplateNodeRange() @@ -3042,7 +3043,7 @@ class TemplateNodeRange : public TemplateNodeCreator<TemplateNodeRange> delete m_endExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3141,7 +3142,7 @@ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> TemplateNodeFor(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeFor>(parser,parent,line), m_reversed(FALSE) { - TRACE(("{TemplateNodeFor(%s)\n",data.data())); + TRACE(("{TemplateNodeFor(%s)\n",qPrint(data))); QCString exprStr; int i = data.find(" in "); if (i==-1) @@ -3192,7 +3193,7 @@ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> parser->parse(this,line,stopAt,m_emptyNodes); parser->removeNextToken(); // skip over endfor } - TRACE(("}TemplateNodeFor(%s)\n",data.data())); + TRACE(("}TemplateNodeFor(%s)\n",qPrint(data))); } ~TemplateNodeFor() @@ -3200,7 +3201,7 @@ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> delete m_expr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3274,7 +3275,7 @@ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> } else // simple type... { - ci->warn(m_templateName,m_line,"for requires a variable of list type, got type '%s'!",v.typeAsString().data()); + ci->warn(m_templateName,m_line,"for requires a variable of list type, got type '%s'!",qPrint(v.typeAsString())); } } } @@ -3302,7 +3303,7 @@ class TemplateNodeMsg : public TemplateNodeCreator<TemplateNodeMsg> parser->removeNextToken(); // skip over endmsg TRACE(("}TemplateNodeMsg()\n")); } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3311,7 +3312,9 @@ class TemplateNodeMsg : public TemplateNodeCreator<TemplateNodeMsg> ci->setActiveEscapeIntf(0); // avoid escaping things we send to standard out bool enable = ci->spacelessEnabled(); ci->enableSpaceless(FALSE); - m_nodes.render(std::cout,c); + TextStream t(&std::cout); + m_nodes.render(t,c); + t.flush(); std::cout << "\n"; ci->setActiveEscapeIntf(escIntf); ci->enableSpaceless(enable); @@ -3330,7 +3333,7 @@ class TemplateNodeBlock : public TemplateNodeCreator<TemplateNodeBlock> TemplateNodeBlock(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeBlock>(parser,parent,line) { - TRACE(("{TemplateNodeBlock(%s)\n",data.data())); + TRACE(("{TemplateNodeBlock(%s)\n",qPrint(data))); m_blockName = data; if (m_blockName.isEmpty()) { @@ -3339,10 +3342,10 @@ class TemplateNodeBlock : public TemplateNodeCreator<TemplateNodeBlock> StringVector stopAt = { "endblock" }; parser->parse(this,line,stopAt,m_nodes); parser->removeNextToken(); // skip over endblock - TRACE(("}TemplateNodeBlock(%s)\n",data.data())); + TRACE(("}TemplateNodeBlock(%s)\n",qPrint(data))); } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3355,7 +3358,7 @@ class TemplateNodeBlock : public TemplateNodeCreator<TemplateNodeBlock> if (nb) // block is overruled { ci->push(); - std::ostringstream ss(std::ios_base::ate); + TextStream ss; // get super block of block nb TemplateNodeBlock *sb = ci->blockContext()->get(m_blockName); if (sb && sb!=nb && sb!=this) // nb and sb both overrule this block @@ -3407,7 +3410,7 @@ class TemplateNodeExtend : public TemplateNodeCreator<TemplateNodeExtend> TemplateNodeExtend(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeExtend>(parser,parent,line) { - TRACE(("{TemplateNodeExtend(%s)\n",data.data())); + TRACE(("{TemplateNodeExtend(%s)\n",qPrint(data))); ExpressionParser ep(parser,line); if (data.isEmpty()) { @@ -3416,14 +3419,14 @@ class TemplateNodeExtend : public TemplateNodeCreator<TemplateNodeExtend> m_extendExpr = ep.parse(data); StringVector stopAt; parser->parse(this,line,stopAt,m_nodes); - TRACE(("}TemplateNodeExtend(%s)\n",data.data())); + TRACE(("}TemplateNodeExtend(%s)\n",qPrint(data))); } ~TemplateNodeExtend() { delete m_extendExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3471,7 +3474,7 @@ class TemplateNodeExtend : public TemplateNodeCreator<TemplateNodeExtend> } else { - ci->warn(m_templateName,m_line,"failed to load template %s for extend",extendFile.data()); + ci->warn(m_templateName,m_line,"failed to load template %s for extend",qPrint(extendFile)); } } } @@ -3488,7 +3491,7 @@ class TemplateNodeInclude : public TemplateNodeCreator<TemplateNodeInclude> TemplateNodeInclude(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeInclude>(parser,parent,line) { - TRACE(("TemplateNodeInclude(%s)\n",data.data())); + TRACE(("TemplateNodeInclude(%s)\n",qPrint(data))); ExpressionParser ep(parser,line); if (data.isEmpty()) { @@ -3500,7 +3503,7 @@ class TemplateNodeInclude : public TemplateNodeCreator<TemplateNodeInclude> { delete m_includeExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3526,7 +3529,7 @@ class TemplateNodeInclude : public TemplateNodeCreator<TemplateNodeInclude> } else { - ci->warn(m_templateName,m_line,"failed to load template '%s' for include",includeFile.data()?includeFile.data():""); + ci->warn(m_templateName,m_line,"failed to load template '%s' for include",qPrint(includeFile)); } } } @@ -3554,6 +3557,7 @@ static void stripLeadingWhiteSpace(QCString &s) else { *dst++=c; skipSpaces=FALSE; } } *dst='\0'; + s.resize( (int)(dst - src) + 1 ); } } @@ -3564,7 +3568,7 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> TemplateNodeCreate(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeCreate>(parser,parent,line), m_templateExpr(0), m_fileExpr(0) { - TRACE(("TemplateNodeCreate(%s)\n",data.data())); + TRACE(("TemplateNodeCreate(%s)\n",qPrint(data))); if (data.isEmpty()) { parser->warn(m_templateName,line,"create tag is missing arguments"); @@ -3597,7 +3601,7 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> delete m_templateExpr; delete m_fileExpr; } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3635,13 +3639,14 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> { outputFile.prepend(ci->outputDirectory()+"/"); } - //printf("NoteCreate(%s)\n",outputFile.data()); - std::ofstream ts(outputFile.str(),std::ofstream::out | std::ofstream::binary); - if (ts.is_open()) + //printf("NoteCreate(%s)\n",qPrint(outputFile)); + std::ofstream f(outputFile.str(),std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream ts(&f); TemplateEscapeIntf *escIntf = ci->escapeIntf(); ci->selectEscapeIntf(extension); - std::ostringstream os(std::ios_base::ate); + TextStream os; createTemplate->render(os,c); QCString out = os.str(); stripLeadingWhiteSpace(out); @@ -3651,12 +3656,12 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> } else { - ci->warn(m_templateName,m_line,"failed to open output file '%s' for create command",outputFile.data()); + ci->warn(m_templateName,m_line,"failed to open output file '%s' for create command",qPrint(outputFile)); } } else { - ci->warn(m_templateName,m_line,"failed to load template '%s' for include",templateFile.data()); + ci->warn(m_templateName,m_line,"failed to load template '%s' for include",qPrint(templateFile)); } t->engine()->setOutputExtension(""); } @@ -3686,7 +3691,7 @@ class TemplateNodeTree : public TemplateNodeCreator<TemplateNodeTree> TemplateNodeTree(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeTree>(parser,parent,line) { - TRACE(("{TemplateNodeTree(%s)\n",data.data())); + TRACE(("{TemplateNodeTree(%s)\n",qPrint(data))); ExpressionParser ep(parser,line); if (data.isEmpty()) { @@ -3696,7 +3701,7 @@ class TemplateNodeTree : public TemplateNodeCreator<TemplateNodeTree> StringVector stopAt = { "endrecursetree" }; parser->parse(this,line,stopAt,m_treeNodes); parser->removeNextToken(); // skip over endrecursetree - TRACE(("}TemplateNodeTree(%s)\n",data.data())); + TRACE(("}TemplateNodeTree(%s)\n",qPrint(data))); } ~TemplateNodeTree() { @@ -3714,7 +3719,7 @@ class TemplateNodeTree : public TemplateNodeCreator<TemplateNodeTree> TemplateContext *c = ctx->templateCtx; TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return QCString(); // should not happen - std::ostringstream ss(std::ios_base::ate); + TextStream ss; c->push(); TemplateVariant node; TemplateListIntf::ConstIterator *it = ctx->list->createIterator(); @@ -3740,7 +3745,7 @@ class TemplateNodeTree : public TemplateNodeCreator<TemplateNodeTree> } else if (list==0) { - ci->warn(m_templateName,m_line,"recursetree: children attribute has type '%s' instead of list\n",v.typeAsString().data()); + ci->warn(m_templateName,m_line,"recursetree: children attribute has type '%s' instead of list\n",qPrint(v.typeAsString())); } } //else @@ -3758,7 +3763,7 @@ class TemplateNodeTree : public TemplateNodeCreator<TemplateNodeTree> delete it; return ss.str(); } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { //printf("TemplateNodeTree::render()\n"); TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); @@ -3797,7 +3802,7 @@ class TemplateNodeIndexEntry : public TemplateNodeCreator<TemplateNodeIndexEntry TemplateNodeIndexEntry(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeIndexEntry>(parser,parent,line) { - TRACE(("{TemplateNodeIndexEntry(%s)\n",data.data())); + TRACE(("{TemplateNodeIndexEntry(%s)\n",qPrint(data))); ExpressionParser expParser(parser,line); std::vector<QCString> args = split(data," "); auto it = args.begin(); @@ -3823,14 +3828,14 @@ class TemplateNodeIndexEntry : public TemplateNodeCreator<TemplateNodeIndexEntry } else { - parser->warn(parser->templateName(),line,"invalid argument '%s' for indexentry tag",arg.data()); + parser->warn(parser->templateName(),line,"invalid argument '%s' for indexentry tag",qPrint(arg)); } ++it; } } - TRACE(("}TemplateNodeIndexEntry(%s)\n",data.data())); + TRACE(("}TemplateNodeIndexEntry(%s)\n",qPrint(data))); } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3859,7 +3864,7 @@ class TemplateNodeOpenSubIndex : public TemplateNodeCreator<TemplateNodeOpenSubI TemplateNodeOpenSubIndex(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeOpenSubIndex>(parser,parent,line) { - TRACE(("{TemplateNodeOpenSubIndex(%s)\n",data.data())); + TRACE(("{TemplateNodeOpenSubIndex(%s)\n",qPrint(data))); m_name = data.stripWhiteSpace(); if (m_name.isEmpty()) { @@ -3867,12 +3872,12 @@ class TemplateNodeOpenSubIndex : public TemplateNodeCreator<TemplateNodeOpenSubI } else if (m_name.find(' ')!=-1) { - parser->warn(parser->templateName(),line,"Expected single argument for opensubindex tag got '%s'",data.data()); + parser->warn(parser->templateName(),line,"Expected single argument for opensubindex tag got '%s'",qPrint(data)); m_name=""; } - TRACE(("}TemplateNodeOpenSubIndex(%s)\n",data.data())); + TRACE(("}TemplateNodeOpenSubIndex(%s)\n",qPrint(data))); } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3895,7 +3900,7 @@ class TemplateNodeCloseSubIndex : public TemplateNodeCreator<TemplateNodeCloseSu TemplateNodeCloseSubIndex(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeCloseSubIndex>(parser,parent,line) { - TRACE(("{TemplateNodeCloseSubIndex(%s)\n",data.data())); + TRACE(("{TemplateNodeCloseSubIndex(%s)\n",qPrint(data))); m_name = data.stripWhiteSpace(); if (m_name.isEmpty()) { @@ -3903,12 +3908,12 @@ class TemplateNodeCloseSubIndex : public TemplateNodeCreator<TemplateNodeCloseSu } else if (m_name.find(' ')!=-1 || m_name.isEmpty()) { - parser->warn(parser->templateName(),line,"Expected single argument for closesubindex tag got '%s'",data.data()); + parser->warn(parser->templateName(),line,"Expected single argument for closesubindex tag got '%s'",qPrint(data)); m_name=""; } - TRACE(("}TemplateNodeCloseSubIndex(%s)\n",data.data())); + TRACE(("}TemplateNodeCloseSubIndex(%s)\n",qPrint(data))); } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3938,7 +3943,7 @@ class TemplateNodeWith : public TemplateNodeCreator<TemplateNodeWith> TemplateNodeWith(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeWith>(parser,parent,line) { - TRACE(("{TemplateNodeWith(%s)\n",data.data())); + TRACE(("{TemplateNodeWith(%s)\n",qPrint(data))); ExpressionParser expParser(parser,line); QCString filteredData = removeSpacesAroundEquals(data); std::vector<QCString> args = split(filteredData," "); @@ -3957,19 +3962,19 @@ class TemplateNodeWith : public TemplateNodeCreator<TemplateNodeWith> } else { - parser->warn(parser->templateName(),line,"invalid argument '%s' for 'with' tag",arg.data()); + parser->warn(parser->templateName(),line,"invalid argument '%s' for 'with' tag",qPrint(arg)); } ++it; } StringVector stopAt = { "endwith" }; parser->parse(this,line,stopAt,m_nodes); parser->removeNextToken(); // skip over endwith - TRACE(("}TemplateNodeWith(%s)\n",data.data())); + TRACE(("}TemplateNodeWith(%s)\n",qPrint(data))); } ~TemplateNodeWith() { } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3997,7 +4002,7 @@ class TemplateNodeCycle : public TemplateNodeCreator<TemplateNodeCycle> TemplateNodeCycle(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeCycle>(parser,parent,line) { - TRACE(("{TemplateNodeCycle(%s)\n",data.data())); + TRACE(("{TemplateNodeCycle(%s)\n",qPrint(data))); m_index=0; ExpressionParser expParser(parser,line); std::vector<QCString> args = split(data," "); @@ -4015,11 +4020,12 @@ class TemplateNodeCycle : public TemplateNodeCreator<TemplateNodeCycle> { parser->warn(parser->templateName(),line,"expected at least two arguments for cycle command, got %zu",m_args.size()); } - TRACE(("}TemplateNodeCycle(%s)\n",data.data())); + TRACE(("}TemplateNodeCycle(%s)\n",qPrint(data))); } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); + if (ci==0) return; // should not happen ci->setLocation(m_templateName,m_line); if (m_index<m_args.size()) { @@ -4077,7 +4083,7 @@ class TemplateNodeSet : public TemplateNodeCreator<TemplateNodeSet> TemplateNodeSet(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeSet>(parser,parent,line) { - TRACE(("{TemplateNodeSet(%s)\n",data.data())); + TRACE(("{TemplateNodeSet(%s)\n",qPrint(data))); ExpressionParser expParser(parser,line); // data format: name=expression int j=data.find('='); @@ -4086,12 +4092,12 @@ class TemplateNodeSet : public TemplateNodeCreator<TemplateNodeSet> { m_mapping = std::make_unique<Mapping>(data.left(j),expr); } - TRACE(("}TemplateNodeSet(%s)\n",data.data())); + TRACE(("}TemplateNodeSet(%s)\n",qPrint(data))); } ~TemplateNodeSet() { } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -4121,7 +4127,7 @@ class TemplateNodeSpaceless : public TemplateNodeCreator<TemplateNodeSpaceless> parser->removeNextToken(); // skip over endwith TRACE(("}TemplateNodeSpaceless()\n")); } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -4144,7 +4150,7 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers> TemplateNodeMarkers(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeMarkers>(parser,parent,line), m_listExpr(0), m_patternExpr(0) { - TRACE(("{TemplateNodeMarkers(%s)\n",data.data())); + TRACE(("{TemplateNodeMarkers(%s)\n",qPrint(data))); int i = data.find(" in "); int w = data.find(" with "); if (i==-1 || w==-1 || w<i) @@ -4161,14 +4167,14 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers> StringVector stopAt = { "endmarkers" }; parser->parse(this,line,stopAt,m_nodes); parser->removeNextToken(); // skip over endmarkers - TRACE(("}TemplateNodeMarkers(%s)\n",data.data())); + TRACE(("}TemplateNodeMarkers(%s)\n",qPrint(data))); } ~TemplateNodeMarkers() { delete m_listExpr; delete m_patternExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -4198,7 +4204,7 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers> std::string part = str.substr(index,newIndex-index); if (ci->needsRecoding()) { - ts << ci->recode(part); // write text before marker + ts << ci->recode(QCString(part)); // write text before marker } else { @@ -4270,7 +4276,7 @@ class TemplateNodeTabbing : public TemplateNodeCreator<TemplateNodeTabbing> parser->removeNextToken(); // skip over endtabbing TRACE(("}TemplateNodeTabbing()\n")); } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -4293,7 +4299,7 @@ class TemplateNodeResource : public TemplateNodeCreator<TemplateNodeResource> TemplateNodeResource(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeResource>(parser,parent,line) { - TRACE(("{TemplateNodeResource(%s)\n",data.data())); + TRACE(("{TemplateNodeResource(%s)\n",qPrint(data))); ExpressionParser ep(parser,line); int i; if (data.isEmpty()) @@ -4312,14 +4318,14 @@ class TemplateNodeResource : public TemplateNodeCreator<TemplateNodeResource> m_resExpr = ep.parse(data); m_asExpr = 0; } - TRACE(("}TemplateNodeResource(%s)\n",data.data())); + TRACE(("}TemplateNodeResource(%s)\n",qPrint(data))); } ~TemplateNodeResource() { delete m_resExpr; delete m_asExpr; } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -4367,7 +4373,7 @@ class TemplateNodeEncoding : public TemplateNodeCreator<TemplateNodeEncoding> TemplateNodeEncoding(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data) : TemplateNodeCreator<TemplateNodeEncoding>(parser,parent,line) { - TRACE(("{TemplateNodeEncoding(%s)\n",data.data())); + TRACE(("{TemplateNodeEncoding(%s)\n",qPrint(data))); ExpressionParser ep(parser,line); if (data.isEmpty()) { @@ -4381,13 +4387,13 @@ class TemplateNodeEncoding : public TemplateNodeCreator<TemplateNodeEncoding> StringVector stopAt = { "endencoding" }; parser->parse(this,line,stopAt,m_nodes); parser->removeNextToken(); // skip over endencoding - TRACE(("}TemplateNodeEncoding(%s)\n",data.data())); + TRACE(("}TemplateNodeEncoding(%s)\n",qPrint(data))); } ~TemplateNodeEncoding() { delete m_encExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -4564,7 +4570,7 @@ class TemplateLexer { m_openChar=openChar; m_closeChar=closeChar; } private: void addToken(TemplateTokenStream &tokens, - const char *data,int line,int startPos,int endPos, + const QCString &data,int line,int startPos,int endPos, TemplateToken::Type type); void reset(); const TemplateEngine *m_engine = 0; @@ -4596,8 +4602,8 @@ void TemplateLexer::tokenize(TemplateTokenStream &tokens) StateEndVariable }; + if (m_data.isEmpty()) return; const char *p=m_data.data(); - if (p==0) return; int state=StateText; int pos=0; int lastTokenPos=0; @@ -4664,10 +4670,10 @@ void TemplateLexer::tokenize(TemplateTokenStream &tokens) { // found tag! state=StateText; - addToken(tokens,m_data.data(),line,lastTokenPos, + addToken(tokens,m_data,line,lastTokenPos, emptyOutputLine ? startLinePos : markStartPos, TemplateToken::Text); - addToken(tokens,m_data.data(),line,markStartPos+2, + addToken(tokens,m_data,line,markStartPos+2, pos-1,TemplateToken::Block); lastTokenPos = pos+1; } @@ -4697,7 +4703,7 @@ void TemplateLexer::tokenize(TemplateTokenStream &tokens) { // found comment tag! state=StateText; - addToken(tokens,m_data.data(),line,lastTokenPos, + addToken(tokens,m_data,line,lastTokenPos, emptyOutputLine ? startLinePos : markStartPos, TemplateToken::Text); lastTokenPos = pos+1; @@ -4745,10 +4751,10 @@ void TemplateLexer::tokenize(TemplateTokenStream &tokens) { // found variable tag! state=StateText; - addToken(tokens,m_data.data(),line,lastTokenPos, + addToken(tokens,m_data,line,lastTokenPos, emptyOutputLine ? startLinePos : markStartPos, TemplateToken::Text); - addToken(tokens,m_data.data(),line,markStartPos+2, + addToken(tokens,m_data,line,markStartPos+2, pos-1,TemplateToken::Variable); lastTokenPos = pos+1; } @@ -4778,22 +4784,21 @@ void TemplateLexer::tokenize(TemplateTokenStream &tokens) } if (lastTokenPos<pos) { - addToken(tokens,m_data.data(),line, + addToken(tokens,m_data,line, lastTokenPos,pos, TemplateToken::Text); } } void TemplateLexer::addToken(TemplateTokenStream &tokens, - const char *data,int line, + const QCString &data,int line, int startPos,int endPos, TemplateToken::Type type) { if (startPos<endPos) { int len = endPos-startPos+1; - QCString text(len); - qstrncpy(text.rawData(),data+startPos,len); + QCString text = data.mid(startPos,len); if (type!=TemplateToken::Text) text = text.stripWhiteSpace(); tokens.push_back(std::make_unique<TemplateToken>(type,text,line)); } @@ -4818,7 +4823,7 @@ void TemplateParser::parse( { auto tok = takeNextToken(); //printf("%p:Token type=%d data='%s' line=%d\n", - // parent,tok->type,tok->data.data(),tok->line); + // parent,tok->type,qPrint(tok->data),tok->line); switch(tok->type) { case TemplateToken::Text: @@ -4836,7 +4841,7 @@ void TemplateParser::parse( command=command.left(sep); } TemplateToken *tok_ptr = tok.get(); - if (std::find(stopAt.begin(),stopAt.end(),command)!=stopAt.end()) + if (std::find(stopAt.begin(),stopAt.end(),command.str())!=stopAt.end()) { prependToken(std::move(tok)); TRACE(("}TemplateParser::parse: stop\n")); @@ -4862,11 +4867,11 @@ void TemplateParser::parse( command=="endrange" || command=="endtabbing" || command=="endencoding") { - warn(m_templateName,tok_ptr->line,"Found tag '%s' without matching start tag",command.data()); + warn(m_templateName,tok_ptr->line,"Found tag '%s' without matching start tag",qPrint(command)); } else { - warn(m_templateName,tok_ptr->line,"Unknown tag '%s'",command.data()); + warn(m_templateName,tok_ptr->line,"Unknown tag '%s'",qPrint(command)); } } break; @@ -4881,7 +4886,7 @@ void TemplateParser::parse( options+=s.c_str(); } warn(m_templateName,line,"Unclosed tag in template, expected one of: %s", - options.data()); + qPrint(options)); } TRACE(("}TemplateParser::parse: last token\n")); } @@ -4914,7 +4919,7 @@ void TemplateParser::prependToken(TemplateTokenPtr &&token) m_tokens.push_front(std::move(token)); } -void TemplateParser::warn(const char *fileName,int line,const char *fmt,...) const +void TemplateParser::warn(const QCString &fileName,int line,const char *fmt,...) const { va_list args; va_start(args,fmt); @@ -4947,10 +4952,10 @@ TemplateImpl::TemplateImpl(TemplateEngine *engine,const QCString &name,const QCS TemplateImpl::~TemplateImpl() { - //printf("deleting template %s\n",m_name.data()); + //printf("deleting template %s\n",qPrint(m_name)); } -void TemplateImpl::render(std::ostream &ts, TemplateContext *c) +void TemplateImpl::render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -5003,7 +5008,7 @@ class TemplateEngine::Private { //for (int i=0;i<m_indent;i++) printf(" "); //m_indent++; - //printf("loadByName(%s,%d) {\n",fileName.data(),line); + //printf("loadByName(%s,%d) {\n",qPrint(fileName),line); m_includeStack.emplace_back(IncludeEntry::Template,fileName,QCString(),line); auto kv = m_templateCache.find(fileName.str()); if (kv==m_templateCache.end()) // first time template is referenced @@ -5034,7 +5039,7 @@ class TemplateEngine::Private } else { - err("Could not open template file %s\n",fileName.data()); + err("Could not open template file %s\n",qPrint(fileName)); } } } @@ -5054,7 +5059,7 @@ class TemplateEngine::Private { //for (int i=0;i<m_indent;i++) printf(" "); //m_indent++; - //printf("enterBlock(%s,%s,%d) {\n",fileName.data(),blockName.data(),line); + //printf("enterBlock(%s,%s,%d) {\n",qPrint(fileName),qPrint(blockName),line); m_includeStack.emplace_back(IncludeEntry::Block,fileName,blockName,line); } @@ -5066,7 +5071,7 @@ class TemplateEngine::Private m_includeStack.pop_back(); } - void printIncludeContext(const char *fileName,int line) const + void printIncludeContext(const QCString &fileName,int line) const { auto it = m_includeStack.rbegin(); while (it!=m_includeStack.rend()) @@ -5078,18 +5083,18 @@ class TemplateEngine::Private { if (next) { - warn(fileName,line," inside template '%s' included from template '%s' at line %d",ie.fileName().data(),next->fileName().data(),ie.line()); + warn(fileName,line," inside template '%s' included from template '%s' at line %d",qPrint(ie.fileName()),qPrint(next->fileName()),ie.line()); } } else // ie.type()==IncludeEntry::Block { - warn(fileName,line," included by block '%s' inside template '%s' at line %d",ie.blockName().data(), - ie.fileName().data(),ie.line()); + warn(fileName,line," included by block '%s' inside template '%s' at line %d",qPrint(ie.blockName()), + qPrint(ie.fileName()),ie.line()); } } } - void setOutputExtension(const char *extension) + void setOutputExtension(const QCString &extension) { m_extension = extension; } @@ -5099,7 +5104,7 @@ class TemplateEngine::Private return m_extension; } - void setTemplateDir(const char *dirName) + void setTemplateDir(const QCString &dirName) { m_templateDirName = dirName; } @@ -5153,12 +5158,12 @@ void TemplateEngine::leaveBlock() p->leaveBlock(); } -void TemplateEngine::printIncludeContext(const char *fileName,int line) const +void TemplateEngine::printIncludeContext(const QCString &fileName,int line) const { p->printIncludeContext(fileName,line); } -void TemplateEngine::setOutputExtension(const char *extension) +void TemplateEngine::setOutputExtension(const QCString &extension) { p->setOutputExtension(extension); } @@ -5168,7 +5173,7 @@ QCString TemplateEngine::outputExtension() const return p->outputExtension(); } -void TemplateEngine::setTemplateDir(const char *dirName) +void TemplateEngine::setTemplateDir(const QCString &dirName) { p->setTemplateDir(dirName); } diff --git a/src/template.h b/src/template.h index 875a039..dee063d 100644 --- a/src/template.h +++ b/src/template.h @@ -17,13 +17,13 @@ #define TEMPLATE_H #include <vector> -#include <iostream> #include "qcstring.h" class TemplateListIntf; class TemplateStructIntf; class TemplateEngine; +class TextStream; /** @defgroup template_api Template API * @@ -412,7 +412,7 @@ class TemplateStructIntf /** Gets the value for a field name. * @param[in] name The name of the field. */ - virtual TemplateVariant get(const char *name) const = 0; + virtual TemplateVariant get(const QCString &name) const = 0; /** Increase object's reference count */ virtual int addRef() = 0; @@ -427,7 +427,7 @@ class TemplateStruct : public TemplateStructIntf { public: // TemplateStructIntf methods - virtual TemplateVariant get(const char *name) const; + virtual TemplateVariant get(const QCString &name) const; virtual int addRef(); virtual int release(); @@ -438,7 +438,7 @@ class TemplateStruct : public TemplateStructIntf * @param[in] name The name of the field. * @param[in] v The value to set. */ - virtual void set(const char *name,const TemplateVariant &v); + virtual void set(const QCString &name,const TemplateVariant &v); private: @@ -505,7 +505,7 @@ class TemplateContext * @note When a given key is already present, * its value will be replaced by \a v */ - virtual void set(const char *name,const TemplateVariant &v) = 0; + virtual void set(const QCString &name,const TemplateVariant &v) = 0; /** Gets the value for a given key * @param[in] name The name of key. @@ -552,7 +552,7 @@ class Template * @param[in] c The context containing data that can be used * when instantiating the template. */ - virtual void render(std::ostream &ts,TemplateContext *c) = 0; + virtual void render(TextStream &ts,TemplateContext *c) = 0; }; //------------------------------------------------------------------------ @@ -590,10 +590,10 @@ class TemplateEngine void unload(Template *t); /** Prints the current template file include stack */ - void printIncludeContext(const char *fileName,int line) const; + void printIncludeContext(const QCString &fileName,int line) const; /** Sets the search directory where to look for template files */ - void setTemplateDir(const char *dirName); + void setTemplateDir(const QCString &dirName); private: friend class TemplateNodeBlock; @@ -605,7 +605,7 @@ class TemplateEngine /** Sets the extension of the output file. This is used to control the * format of 'special' tags in the template */ - void setOutputExtension(const char *extension); + void setOutputExtension(const QCString &extension); /** Returns the output extension, set via setOutputExtension() */ QCString outputExtension() const; diff --git a/src/textdocvisitor.cpp b/src/textdocvisitor.cpp index c40cbd9..47cd56e 100644 --- a/src/textdocvisitor.cpp +++ b/src/textdocvisitor.cpp @@ -50,11 +50,11 @@ void TextDocVisitor::visit(DocEmoji *s) } } -void TextDocVisitor::filter(const char *str) +void TextDocVisitor::filter(const QCString &str) { - if (str==0) return; + if (str.isEmpty()) return; //printf("TextDocVisitor::filter(%s)\n",str); - const char *p=str; + const char *p=str.data(); char c; while (*p) { diff --git a/src/textdocvisitor.h b/src/textdocvisitor.h index 6a4e08c..7439b6b 100644 --- a/src/textdocvisitor.h +++ b/src/textdocvisitor.h @@ -22,12 +22,13 @@ #include "qcstring.h" #include "docvisitor.h" #include "docparser.h" +#include "textstream.h" /*! @brief Concrete visitor implementation for TEXT output. */ class TextDocVisitor : public DocVisitor { public: - TextDocVisitor(std::ostream &t) : DocVisitor(DocVisitor_Text), m_t(t) {} + TextDocVisitor(TextStream &t) : DocVisitor(DocVisitor_Text), m_t(t) {} //-------------------------------------- // visitor functions for leaf nodes @@ -133,9 +134,9 @@ class TextDocVisitor : public DocVisitor private: - void filter(const char *str); + void filter(const QCString &str); - std::ostream &m_t; + TextStream &m_t; }; #endif diff --git a/src/textstream.h b/src/textstream.h new file mode 100644 index 0000000..a9c4a31 --- /dev/null +++ b/src/textstream.h @@ -0,0 +1,251 @@ +/****************************************************************************** + * + * Copyright (C) 1997-2021 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#ifndef TEXTSTREAM_H +#define TEXTSTREAM_H + +#include <string> +#include <iostream> +#include <sstream> +#include <cstdint> +#include <cstdio> +#include <fstream> + +#include "qcstring.h" + +/** @brief Text streaming class that buffers data. + * + * Simpler version of std::ostringstream that has much better + * performance. + */ +class TextStream final +{ + static const int INITIAL_CAPACITY = 4096; + public: + /** Creates an empty stream object. + */ + TextStream() + { + m_buffer.reserve(INITIAL_CAPACITY); + } + /** Create a text stream object for writing to a std::ostream. + * @note data is buffered until flush() is called or the object is destroyed. + */ + TextStream(std::ostream *s) : m_s(s) + { + m_buffer.reserve(INITIAL_CAPACITY); + } + /** Create a text stream, initializing the buffer with string \a s + */ + TextStream(const std::string &s) : m_buffer(s) + { + m_buffer.reserve(s.length()+INITIAL_CAPACITY); + } + + /** Writes any data that is buffered to the attached std::ostream */ + ~TextStream() { flush(); } + + TextStream(const TextStream &) = delete; + TextStream &operator=(const TextStream &) = delete; + + /** Sets or changes the std::ostream to write to. + * @note Any data already buffered will be flushed. + */ + void setStream(std::ostream *s) + { + flush(); + m_s = s; + } + + void setFile(FILE *f) + { + flush(); + m_f = f; + } + + /** Returns the attached std::ostream object. + * @see setStream() + */ + std::ostream *stream() const + { + return m_s; + } + + FILE *file() const + { + return m_f; + } + + /** Adds a character to the stream */ + TextStream &operator<<( char c) + { + m_buffer+=c; + return static_cast<TextStream&>(*this); + } + + /** Adds a C-style string to the stream */ + TextStream &operator<<( const char *s) + { + if (s) m_buffer+=s; + return static_cast<TextStream&>(*this); + } + + /** Adds a QCString to the stream */ + TextStream &operator<<( const QCString &s ) + { + m_buffer+=s.str(); + return static_cast<TextStream&>(*this); + } + + /** Adds a std::string to the stream */ + TextStream &operator<<( const std::string &s ) + { + m_buffer+=s; + return static_cast<TextStream&>(*this); + } + + /** Adds a signed short integer to the stream */ + TextStream &operator<<( signed short i) + { + output_int32(i,i<0); + return static_cast<TextStream&>(*this); + } + + /** Adds a unsigned short integer to the stream */ + TextStream &operator<<( unsigned short i) + { + output_int32(i,false); + return static_cast<TextStream&>(*this); + } + + /** Adds a signed integer to the stream */ + TextStream &operator<<( signed int i) + { + output_int32(i,i<0); + return static_cast<TextStream&>(*this); + } + + /** Adds a unsigned integer to the stream */ + TextStream &operator<<( unsigned int i) + { + output_int32(i,false); + return static_cast<TextStream&>(*this); + } + + /** Adds a float to the stream */ + TextStream &operator<<( float f) + { + output_double((double)f); + return static_cast<TextStream&>(*this); + } + + /** Adds a double to the stream */ + TextStream &operator<<( double d) + { + output_double(d); + return static_cast<TextStream&>(*this); + } + + /** Adds a array of character to the stream + * @param buf the character buffer + * @param len the number of characters in the buffer to write + */ + void write(const char *buf,size_t len) + { + m_buffer.append(buf,len); + } + + /** Flushes the buffer. If a std::ostream is attached, the buffer's + * contents will be written to the stream. + */ + void flush() + { + if (m_s) + { + m_s->write(m_buffer.c_str(),m_buffer.length()); + } + else if (m_f) + { + fwrite(m_buffer.c_str(),1,m_buffer.length(),m_f); + } + m_buffer.clear(); + } + + /** Clears any buffered data */ + void clear() + { + m_buffer.clear(); + } + + /** Return the contents of the buffer as a std::string object */ + std::string str() const + { + return m_buffer; + } + + /** Sets the buffer's contents to string \a s. + * Any data already in the buffer will be flushed. + */ + void str(const std::string &s) + { + flush(); + m_buffer=s; + } + + /** Sets the buffer's contents to string \a s + * Any data already in the buffer will be flushed. + */ + void str(const char *s) + { + flush(); + if (s) m_buffer=s; + } + + /** Returns true iff the buffer is empty */ + bool empty() const + { + return m_buffer.empty(); + } + + private: + /** Writes a string representation of an integer to the buffer + * @param n the absolute value of the integer + * @param neg indicates if the integer is negative + */ + void output_int32( uint32_t n, bool neg ) + { + char buf[20]; + char *p = &buf[19]; + *p = '\0'; + if ( neg ) + { + n = (uint32_t)(-(int32_t)n); + } + do { *--p = ((int32_t)(n%10)) + '0'; n /= 10; } while ( n ); + if ( neg ) *--p = '-'; + m_buffer+=p; + } + void output_double( double d) + { + char buf[64]; + snprintf(buf,64,"%f",d); + m_buffer+=buf; + } + std::string m_buffer; + std::ostream *m_s = nullptr; + FILE *m_f = nullptr; +}; + +#endif diff --git a/src/tooltip.cpp b/src/tooltip.cpp index f8222d7..5768b0a 100644 --- a/src/tooltip.cpp +++ b/src/tooltip.cpp @@ -56,15 +56,10 @@ TooltipManager::~TooltipManager() { } -static QCString escapeId(const char *s) +static QCString escapeId(const QCString &s) { QCString res=s; - char *p=res.rawData(); - while (*p) - { - if (!isId(*p)) *p='_'; - p++; - } + for (uint i=0;i<res.length();i++) if (!isId(res[i])) res[i]='_'; return res; } diff --git a/src/translator.h b/src/translator.h index bcc70ff..02f2ccf 100644 --- a/src/translator.h +++ b/src/translator.h @@ -31,7 +31,7 @@ class Translator * if the user chooses a language whose translation is not up to date. * It is implemented by the adapter classes. */ - virtual QCString updateNeededMessage() { return ""; } + virtual QCString updateNeededMessage() { return QCString(); } virtual ~Translator() {} // Please, have a look at comments inside the translator_en.h file @@ -49,22 +49,22 @@ class Translator * this routine. In case no font encoding is required the empty string * can be returned. */ - virtual QCString latexFontenc() { return "T1"; } + virtual QCString latexFontenc() { return QCString("T1"); } virtual QCString latexFont() { - return "\\usepackage[scaled=.90]{helvet}\n" + return QCString("\\usepackage[scaled=.90]{helvet}\n" "\\usepackage{courier}\n" - "\\renewcommand{\\familydefault}{\\sfdefault}\n"; + "\\renewcommand{\\familydefault}{\\sfdefault}\n"); } /*! * Sets the commands to be inserted directly after the `\\begin{document}` * in the LaTeX document. */ - virtual QCString latexDocumentPre() { return ""; } + virtual QCString latexDocumentPre() { return QCString(""); } /*! * Sets the commands to be inserted directly before the `\\end{document}` * in the LaTeX document. */ - virtual QCString latexDocumentPost() { return ""; } + virtual QCString latexDocumentPost() { return QCString(""); } /*! * Set the name to be used as latex command. */ @@ -94,7 +94,7 @@ class Translator virtual QCString trMemberList() = 0; virtual QCString trThisIsTheListOfAllMembers() = 0; virtual QCString trIncludingInheritedMembers() = 0; - virtual QCString trGeneratedAutomatically(const char *s) = 0; + virtual QCString trGeneratedAutomatically(const QCString &s) = 0; virtual QCString trEnumName() = 0; virtual QCString trEnumValue() = 0; virtual QCString trDefinedIn() = 0; @@ -149,9 +149,9 @@ class Translator virtual QCString trFunctionDocumentation() = 0; virtual QCString trVariableDocumentation() = 0; virtual QCString trCompounds() = 0; - virtual QCString trGeneratedAt(const char *date,const char *projName) = 0; + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) = 0; //virtual QCString trWrittenBy() = 0; - virtual QCString trClassDiagram(const char *clName) = 0; + virtual QCString trClassDiagram(const QCString &clName) = 0; virtual QCString trForInternalUseOnly() = 0; //virtual QCString trReimplementedForInternalReasons() = 0; virtual QCString trWarning() = 0; @@ -182,12 +182,12 @@ class Translator // new since 0.49-990425 ////////////////////////////////////////////////////////////////////////// - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) = 0; - virtual QCString trFileReference(const char *fileName) = 0; - virtual QCString trNamespaceReference(const char *namespaceName) = 0; + virtual QCString trFileReference(const QCString &fileName) = 0; + virtual QCString trNamespaceReference(const QCString &namespaceName) = 0; virtual QCString trPublicMembers() = 0; virtual QCString trPublicSlots() = 0; @@ -249,8 +249,8 @@ class Translator // new since 1.0.0 ////////////////////////////////////////////////////////////////////////// - virtual QCString trCollaborationDiagram(const char *clName) = 0; - virtual QCString trInclDepGraph(const char *fName) = 0; + virtual QCString trCollaborationDiagram(const QCString &clName) = 0; + virtual QCString trInclDepGraph(const QCString &fName) = 0; virtual QCString trConstructorDocumentation() = 0; virtual QCString trGotoSourceCode() = 0; virtual QCString trGotoDocumentation() = 0; @@ -331,7 +331,7 @@ class Translator //virtual QCString trInterfaces() = 0; virtual QCString trClasses() = 0; - virtual QCString trPackage(const char *name) = 0; + virtual QCString trPackage(const QCString &name) = 0; virtual QCString trPackageList() = 0; virtual QCString trPackageListDescription() = 0; virtual QCString trPackages() = 0; @@ -497,7 +497,7 @@ class Translator virtual QCString trDirDocumentation() = 0; virtual QCString trDirectories() = 0; virtual QCString trDirDescription() = 0; - virtual QCString trDirReference(const char *dirName) = 0; + virtual QCString trDirReference(const QCString &dirName) = 0; virtual QCString trDir(bool first_capital, bool singular) = 0; ////////////////////////////////////////////////////////////////////////// @@ -529,10 +529,10 @@ class Translator virtual QCString trDataTypes() = 0; virtual QCString trModulesList() = 0; virtual QCString trModulesListDescription(bool extractAll) = 0; - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) = 0; - virtual QCString trModuleReference(const char *namespaceName) = 0; + virtual QCString trModuleReference(const QCString &namespaceName) = 0; virtual QCString trModulesMembers() = 0; virtual QCString trModulesMemberDescription(bool extractAll) = 0; virtual QCString trModulesIndex() = 0; @@ -547,7 +547,7 @@ class Translator // new since 1.6.0 ////////////////////////////////////////////////////////////////////////// - virtual QCString trDirRelation(const char *name) = 0; + virtual QCString trDirRelation(const QCString &name) = 0; virtual QCString trLoading() = 0; virtual QCString trGlobalNamespace() = 0; virtual QCString trSearching() = 0; @@ -557,9 +557,9 @@ class Translator // new since 1.6.3 ////////////////////////////////////////////////////////////////////////// - //virtual QCString trDirDependency(const char *name) = 0; - virtual QCString trFileIn(const char *name) = 0; - virtual QCString trIncludesFileIn(const char *name) = 0; + //virtual QCString trDirDependency(const QCString &name) = 0; + virtual QCString trFileIn(const QCString &name) = 0; + virtual QCString trIncludesFileIn(const QCString &name) = 0; virtual QCString trDateTime(int year,int month,int day,int dayOfWeek, int hour,int minutes,int seconds, bool includeTime) = 0; @@ -570,7 +570,7 @@ class Translator virtual QCString trCiteReferences() = 0; virtual QCString trCopyright() = 0; - virtual QCString trDirDepGraph(const char *name) = 0; + virtual QCString trDirDepGraph(const QCString &name) = 0; ////////////////////////////////////////////////////////////////////////// // new since 1.8.0 @@ -580,8 +580,8 @@ class Translator virtual QCString trTemplateParameters() = 0; virtual QCString trAndMore(const QCString &number) = 0; virtual QCString trEnumGeneratedFromFiles(bool single) = 0; - virtual QCString trEnumReference(const char *name) = 0; - virtual QCString trInheritedFrom(const char *members,const char *what) = 0; + virtual QCString trEnumReference(const QCString &name) = 0; + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) = 0; virtual QCString trAdditionalInheritedMembers() = 0; ////////////////////////////////////////////////////////////////////////// @@ -602,9 +602,9 @@ class Translator virtual QCString trInterfaces() = 0; virtual QCString trServices() = 0; virtual QCString trConstantGroups() = 0; - virtual QCString trConstantGroupReference(const char *namespaceName) = 0; - virtual QCString trServiceReference(const char *sName) = 0; - virtual QCString trSingletonReference(const char *sName) = 0; + virtual QCString trConstantGroupReference(const QCString &namespaceName) = 0; + virtual QCString trServiceReference(const QCString &sName) = 0; + virtual QCString trSingletonReference(const QCString &sName) = 0; virtual QCString trServiceGeneratedFromFiles(bool single) = 0; virtual QCString trSingletonGeneratedFromFiles(bool single) = 0; @@ -620,7 +620,7 @@ class Translator virtual QCString trDesignUnits() = 0; virtual QCString trFunctionAndProc() = 0; virtual QCString trVhdlType(uint64 type,bool single) = 0; - virtual QCString trCustomReference(const char *name) = 0; + virtual QCString trCustomReference(const QCString &name) = 0; virtual QCString trConstants() = 0; virtual QCString trConstantDocumentation() = 0; @@ -646,7 +646,7 @@ class Translator virtual QCString trExceptionHierarchy() = 0; virtual QCString trExceptionHierarchyDescription() = 0; virtual QCString trExceptionDocumentation() = 0; - virtual QCString trCompoundReferenceSlice(const char *clName, ClassDef::CompoundType compType, bool isLocal) = 0; + virtual QCString trCompoundReferenceSlice(const QCString &clName, ClassDef::CompoundType compType, bool isLocal) = 0; virtual QCString trOperations() = 0; virtual QCString trOperationDocumentation() = 0; virtual QCString trDataMembers() = 0; @@ -657,6 +657,18 @@ class Translator ////////////////////////////////////////////////////////////////////////// virtual QCString trDesignUnitDocumentation() = 0; + +////////////////////////////////////////////////////////////////////////// +// new since 1.9.2 +////////////////////////////////////////////////////////////////////////// + + virtual QCString trConcept(bool first_capital, bool singular) = 0; + virtual QCString trConceptReference(const QCString &conceptName) = 0; + virtual QCString trConceptList() = 0; + virtual QCString trConceptIndex() = 0; + virtual QCString trConceptDocumentation() = 0; + virtual QCString trConceptListDescription(bool extractAll) = 0; + virtual QCString trConceptDefinition() = 0; }; #endif diff --git a/src/translator_adapter.h b/src/translator_adapter.h index 388304c..54a0a35 100644 --- a/src/translator_adapter.h +++ b/src/translator_adapter.h @@ -41,7 +41,35 @@ class TranslatorAdapterBase : public Translator }; -class TranslatorAdapter_1_8_19 : public TranslatorAdapterBase +class TranslatorAdapter_1_9_2 : public TranslatorAdapterBase +{ + public: + virtual QCString updateNeededMessage() + { return createUpdateNeededMessage(idLanguage(),"release 1.9.2"); } + + virtual QCString trConcept(bool first_capital,bool singular) + { return english.trConcept(first_capital,singular); } + + virtual QCString trConceptReference(const QCString &conceptName) + { return english.trConceptReference(conceptName); } + + virtual QCString trConceptList() + { return english.trConceptList(); } + + virtual QCString trConceptIndex() + { return english.trConceptIndex(); } + + virtual QCString trConceptDocumentation() + { return english.trConceptDocumentation(); } + + virtual QCString trConceptListDescription(bool extractAll) + { return english.trConceptListDescription(extractAll); } + + virtual QCString trConceptDefinition() + { return english.trConceptDefinition(); } +}; + +class TranslatorAdapter_1_8_19 : public TranslatorAdapter_1_9_2 { public: virtual QCString updateNeededMessage() @@ -81,7 +109,7 @@ class TranslatorAdapter_1_8_15 : public TranslatorAdapter_1_8_19 virtual QCString trVhdlType(uint64 type,bool single) { return english.trVhdlType(type,single); } - virtual QCString trCustomReference(const char *name) + virtual QCString trCustomReference(const QCString &name) { return english.trCustomReference(name); } virtual QCString trConstants() @@ -156,7 +184,7 @@ class TranslatorAdapter_1_8_15 : public TranslatorAdapter_1_8_19 virtual QCString trExceptionDocumentation() { return english.trExceptionDocumentation(); } - virtual QCString trCompoundReferenceSlice(const char *clName, ClassDef::CompoundType compType, bool isLocal) + virtual QCString trCompoundReferenceSlice(const QCString &clName, ClassDef::CompoundType compType, bool isLocal) { return english.trCompoundReferenceSlice(clName,compType,isLocal); } virtual QCString trOperations() @@ -187,13 +215,13 @@ class TranslatorAdapter_1_8_4 : public TranslatorAdapter_1_8_15 virtual QCString trConstantGroups() { return english.trConstantGroups(); } - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { return english.trConstantGroupReference(namespaceName); } - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { return english.trServiceReference(sName); } - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { return english.trSingletonReference(sName); } virtual QCString trServiceGeneratedFromFiles(bool single) @@ -250,10 +278,10 @@ class TranslatorAdapter_1_8_0 : public TranslatorAdapter_1_8_2 virtual QCString trEnumGeneratedFromFiles(bool single) { return english.trEnumGeneratedFromFiles(single); } - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return english.trEnumReference(name); } - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return english.trInheritedFrom(members,what); } virtual QCString trAdditionalInheritedMembers() @@ -276,12 +304,12 @@ class TranslatorAdapter_1_7_5 : public TranslatorAdapter_1_8_0 virtual QCString trCopyright() { return english.trCopyright(); } - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return english.trDirDepGraph(name); } - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return english.trFileIn(name); } - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return english.trIncludesFileIn(name); } virtual QCString trDateTime(int year,int month,int day,int dayOfWeek, int hour,int minutes,int seconds, @@ -298,7 +326,7 @@ class TranslatorAdapter_1_6_0 : public TranslatorAdapter_1_7_5 virtual QCString updateNeededMessage() { return createUpdateNeededMessage(idLanguage(),"release 1.6.0"); } - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return english.trDirRelation(name); } virtual QCString trLoading() @@ -349,12 +377,12 @@ class TranslatorAdapter_1_6_0 : public TranslatorAdapter_1_7_5 virtual QCString trModulesListDescription(bool extractAll) { return english.trModulesListDescription(extractAll); } - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { return english.trCompoundReferenceFortran(clName,compType,isTemplate); } - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { return english.trModuleReference(namespaceName); } virtual QCString trModulesMembers() diff --git a/src/translator_am.h b/src/translator_am.h index 812d8fb..6e7a9a8 100644 --- a/src/translator_am.h +++ b/src/translator_am.h @@ -108,9 +108,9 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 /*! this is put at the author sections at the bottom of man pages.
* parameter s is name of the project name.
*/
- virtual QCString trGeneratedAutomatically(const char *s)
+ virtual QCString trGeneratedAutomatically(const QCString &s)
{ QCString result="Ավտոմատ ստեղծված է ելքային կոդից, Doxygen-ի միջոցով, ";
- if (s) result+=s+(QCString)" համար:";
+ if (!s.isEmpty()) result+=s+(QCString)" համար:";
return result;
}
@@ -457,16 +457,16 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 /*! This is used in the standard footer of each page and indicates when
* the page was generated
*/
- virtual QCString trGeneratedAt(const char *date,const char *projName)
+ virtual QCString trGeneratedAt(const QCString &date,const QCString &projName)
{
QCString result=(QCString)"Ստեղծվել է "+date;
- if (projName) result+=projName+QCString(" -ի համար,");
+ if (!projName.isEmpty()) result+=projName+QCString(" -ի համար,");
result+=(QCString)" հետևյալ համակարգով.";
return result;
}
/*! this text is put before a class diagram */
- virtual QCString trClassDiagram(const char *clName)
+ virtual QCString trClassDiagram(const QCString &clName)
{
return clName+QCString(" -ի ժառանգման գծագիրը.");
}
@@ -545,7 +545,7 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 //////////////////////////////////////////////////////////////////////////
/*! used as the title of the HTML page of a class/struct/union */
- virtual QCString trCompoundReference(const char *clName,
+ virtual QCString trCompoundReference(const QCString &clName,
ClassDef::CompoundType compType,
bool isTemplate)
{
@@ -583,13 +583,13 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 }
/*! used as the title of the HTML page of a file */
- virtual QCString trFileReference(const char *fileName)
+ virtual QCString trFileReference(const QCString &fileName)
{
return fileName+QCString(" ֆայլեր");
}
/*! used as the title of the HTML page of a namespace */
- virtual QCString trNamespaceReference(const char *namespaceName)
+ virtual QCString trNamespaceReference(const QCString &namespaceName)
{
QCString result=namespaceName;
result+=" անունների տարածություններ";
@@ -787,12 +787,12 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 //////////////////////////////////////////////////////////////////////////
/*! this text is put before a collaboration diagram */
- virtual QCString trCollaborationDiagram(const char *clName)
+ virtual QCString trCollaborationDiagram(const QCString &clName)
{
return (QCString)clName+"-ի համագործակցությունների գծագիր.";
}
/*! this text is put before an include dependency graph */
- virtual QCString trInclDepGraph(const char *fName)
+ virtual QCString trInclDepGraph(const QCString &fName)
{
return (QCString)fName+"-ի ներառումների կախվածությունների գծագիր.";
}
@@ -1074,7 +1074,7 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 }
}
/*! Used as the title of a Java package */
- virtual QCString trPackage(const char *name)
+ virtual QCString trPackage(const QCString &name)
{
return (QCString)"Փաթեթ "+name;
}
@@ -1446,7 +1446,7 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 /*! This returns the title of a directory page. The name of the
* directory is passed via \a dirName.
*/
- virtual QCString trDirReference(const char *dirName)
+ virtual QCString trDirReference(const QCString &dirName)
{ QCString result=dirName; result+=" Ֆայլադարան"; return result; }
/*! This returns the word directory with or without starting capital
@@ -1572,7 +1572,7 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 }
/*! used as the title of the HTML page of a module/type (Fortran) */
- virtual QCString trCompoundReferenceFortran(const char *clName,
+ virtual QCString trCompoundReferenceFortran(const QCString &clName,
ClassDef::CompoundType compType,
bool isTemplate)
{
@@ -1609,7 +1609,7 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 return result;
}
/*! used as the title of the HTML page of a module (Fortran) */
- virtual QCString trModuleReference(const char *namespaceName)
+ virtual QCString trModuleReference(const QCString &namespaceName)
{
return QCString("Մոդուլ ") + namespaceName;
}
@@ -1705,7 +1705,7 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 //////////////////////////////////////////////////////////////////////////
/*! directory relation for \a name */
- virtual QCString trDirRelation(const char *name)
+ virtual QCString trDirRelation(const QCString &name)
{
return QCString(name)+" Կապ";
}
@@ -1742,7 +1742,7 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 * table is shown. The heading for the first column mentions the
* source file that has a relation to another file.
*/
- virtual QCString trFileIn(const char *name)
+ virtual QCString trFileIn(const QCString &name)
{
return (QCString)"Ֆայլը " + name + " ում";
}
@@ -1751,7 +1751,7 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 * table is shown. The heading for the second column mentions the
* destination file that is included.
*/
- virtual QCString trIncludesFileIn(const char *name)
+ virtual QCString trIncludesFileIn(const QCString &name)
{
return (QCString)"Ներառում է ֆայլը " + name + " ում";
}
@@ -1798,7 +1798,7 @@ class TranslatorArmenian : public TranslatorAdapter_1_8_0 { return "Հեղինակային իրավունք"; }
/*! Header for the graph showing the directory dependencies */
- virtual QCString trDirDepGraph(const char *name)
+ virtual QCString trDirDepGraph(const QCString &name)
{ return name + QCString("-ի ֆայլադարանների կախվածությունների գծագիր:"); }
};
diff --git a/src/translator_ar.h b/src/translator_ar.h index 0989249..f847f5b 100644 --- a/src/translator_ar.h +++ b/src/translator_ar.h @@ -133,9 +133,9 @@ class TranslatorArabic : public TranslatorAdapter_1_4_6 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="تم تكوينها آليا بواسطة Doxygen"; - if (s) result+=(QCString)" لـ "+s; + if (!s.isEmpty()) result+=(QCString)" لـ "+s; result+=" من ملفات المصدر."; return result; } @@ -513,16 +513,16 @@ class TranslatorArabic : public TranslatorAdapter_1_4_6 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Generated on "+date; - if (projName) result+=(QCString)" for "+projName; + if (!projName.isEmpty()) result+=(QCString)" for "+projName; result+=(QCString)" by"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Inheritance diagram for "+clName+":"; } @@ -609,7 +609,7 @@ class TranslatorArabic : public TranslatorAdapter_1_4_6 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -631,7 +631,7 @@ class TranslatorArabic : public TranslatorAdapter_1_4_6 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" File Reference"; @@ -639,7 +639,7 @@ class TranslatorArabic : public TranslatorAdapter_1_4_6 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Namespace Reference"; @@ -840,12 +840,12 @@ class TranslatorArabic : public TranslatorAdapter_1_4_6 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"رسم التعاون لـ "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"رسم اعتمادية التضمين لـ "+fName+":"; } @@ -1131,7 +1131,7 @@ class TranslatorArabic : public TranslatorAdapter_1_4_6 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"حزمة "+name; } @@ -1541,7 +1541,7 @@ class TranslatorArabic : public TranslatorAdapter_1_4_6 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=" مرجع الدليل"; result+=dirName; return result; } /*! This returns the word directory with or without starting capital diff --git a/src/translator_br.h b/src/translator_br.h index e180f62..baa4710 100644 --- a/src/translator_br.h +++ b/src/translator_br.h @@ -52,7 +52,7 @@ #ifndef TRANSLATOR_BR_H #define TRANSLATOR_BR_H -class TranslatorBrazilian : public Translator +class TranslatorBrazilian : public TranslatorAdapter_1_9_2 { public: @@ -164,9 +164,9 @@ class TranslatorBrazilian : public Translator /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Gerado automaticamente por Doxygen"; - if (s) result+=(QCString)" para "+s; + if (!s.isEmpty()) result+=(QCString)" para "+s; result+=" a partir do código-fonte."; return result; } @@ -530,16 +530,16 @@ class TranslatorBrazilian : public Translator /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Gerado em "+date; - if (projName) result+=(QCString)" para "+projName; + if (!projName.isEmpty()) result+=(QCString)" para "+projName; result+=(QCString)" por"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Diagrama de hierarquia para "+clName+":"; } @@ -618,7 +618,7 @@ class TranslatorBrazilian : public Translator ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -648,7 +648,7 @@ class TranslatorBrazilian : public Translator } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result = "Referência do Arquivo "; result += fileName; @@ -656,7 +656,7 @@ class TranslatorBrazilian : public Translator } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result ="Refência do Namespace "; result += namespaceName; @@ -882,12 +882,12 @@ class TranslatorBrazilian : public Translator ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Diagrama de colaboração para "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Gráfico de dependência de inclusões para "+fName+":"; } @@ -1170,7 +1170,7 @@ class TranslatorBrazilian : public Translator } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Pacote "+name; } @@ -1566,7 +1566,7 @@ class TranslatorBrazilian : public Translator /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result = "Referência do diretório "; result += dirName; @@ -1695,7 +1695,7 @@ class TranslatorBrazilian : public Translator } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1719,7 +1719,7 @@ class TranslatorBrazilian : public Translator return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result = "Referência do Módulo "; result += namespaceName; @@ -1826,7 +1826,7 @@ class TranslatorBrazilian : public Translator ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return "Relação " + QCString(name); } @@ -1863,7 +1863,7 @@ class TranslatorBrazilian : public Translator * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Arquivo em "+name; } @@ -1872,7 +1872,7 @@ class TranslatorBrazilian : public Translator * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Inclui arquivo em "+name; } @@ -1921,7 +1921,7 @@ class TranslatorBrazilian : public Translator } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Grafo de dependências do diretório ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1952,14 +1952,14 @@ class TranslatorBrazilian : public Translator } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { QCString result = "Referência da enumeração "; return result + name; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" herdados de "+what; } /*! Header of the sections with inherited members specific for the @@ -2040,21 +2040,21 @@ class TranslatorBrazilian : public Translator { return "Grupos de Constantes"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result = "Referência do grupo de constantes "; result += namespaceName; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result = "Referência do serviço "; result += sName; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { // TODO: Emerson Ferreira proposes to add emphasis around the word // Singleton but I'm not sure if this will work for non HTML generators. @@ -2203,7 +2203,7 @@ class TranslatorBrazilian : public Translator return "Classe"; } } - virtual QCString trCustomReference(const char *name) + virtual QCString trCustomReference(const QCString &name) { return "Referência de " + QCString(name); } /* Slice */ @@ -2303,7 +2303,7 @@ class TranslatorBrazilian : public Translator { return "Exceções"; } - virtual QCString trCompoundReferenceSlice(const char *clName, ClassDef::CompoundType compType, bool isLocal) + virtual QCString trCompoundReferenceSlice(const QCString &clName, ClassDef::CompoundType compType, bool isLocal) { QCString result=(QCString)"Referência "; switch(compType) @@ -2341,13 +2341,13 @@ class TranslatorBrazilian : public Translator ////////////////////////////////////////////////////////////////////////// // new since 1.8.19 ////////////////////////////////////////////////////////////////////////// - + /** VHDL design unit documentation */ virtual QCString trDesignUnitDocumentation() - { - return "Documentação da Unidade de Projeto"; + { + return "Documentação da Unidade de Projeto"; } - + }; #endif diff --git a/src/translator_ca.h b/src/translator_ca.h index 7a7e79a..98f2ece 100644 --- a/src/translator_ca.h +++ b/src/translator_ca.h @@ -142,9 +142,9 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Generat automàticament per Doxygen"; - if (s) result+=(QCString)" per a "+s; + if (!s.isEmpty()) result+=(QCString)" per a "+s; result+=" a partir del codi font."; return result; } @@ -504,16 +504,16 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Generat a "+date; - if (projName) result+=(QCString)" per a "+projName; + if (!projName.isEmpty()) result+=(QCString)" per a "+projName; result+=(QCString)" per"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Diagrama d'Herència per a "+clName+":"; } @@ -592,7 +592,7 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -614,7 +614,7 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result="Referència del Fitxer "; result+=fileName; @@ -622,7 +622,7 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result="Referència de l'Espai de Noms "; result+=namespaceName; @@ -823,12 +823,12 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Diagrama de col·laboració per a "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Inclou el graf de dependències per a "+fName+":"; } @@ -1102,7 +1102,7 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Paquet "+name; } @@ -1496,7 +1496,7 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result="Referència del Directori "; result+=dirName; return result; } /*! This returns the word directory with or without starting capital @@ -1623,7 +1623,7 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1645,7 +1645,7 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result="Referència del Mòdul "; result+=namespaceName; @@ -1753,7 +1753,7 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" Relació"; } @@ -1790,7 +1790,7 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Fitxer a "+name; } @@ -1799,7 +1799,7 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Inclou fitxer a "+name; } @@ -1844,7 +1844,7 @@ class TranslatorCatalan : public TranslatorAdapter_1_8_0 { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Graf de dependència de directoris per a ")+name+":"; } diff --git a/src/translator_cn.h b/src/translator_cn.h index a3b5803..8d3aa5e 100644 --- a/src/translator_cn.h +++ b/src/translator_cn.h @@ -135,10 +135,10 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result; result = "由" CN_SPC "Doyxgen" CN_SPC "通过分析" CN_SPC; - if (s) result += ((QCString)s+CN_SPC "的" CN_SPC); + if (!s.isEmpty()) result += ((QCString)s+CN_SPC "的" CN_SPC); result+= "源代码自动生成."; return result; } @@ -391,14 +391,14 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 } } - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"生成于" CN_SPC+date; - if (projName) result+=(QCString)CN_SPC ", 为" CN_SPC+projName; + if (!projName.isEmpty()) result+=(QCString)CN_SPC ", 为" CN_SPC+projName; result+=(QCString)"使用" CN_SPC; return result; } - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"类" CN_SPC+clName+CN_SPC "继承关系图:"; } @@ -459,7 +459,7 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 // new since 0.49-990425 ////////////////////////////////////////////////////////////////////////// - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) // used as the title of the HTML page of a class/struct/union @@ -482,7 +482,7 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=CN_SPC "文件参考"; @@ -490,7 +490,7 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=CN_SPC "命名空间参考"; return result; @@ -697,13 +697,13 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)clName+CN_SPC "的协作图:"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)fName+CN_SPC "的引用(Include)关系图:"; } @@ -1005,7 +1005,7 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"包" CN_SPC+name; } @@ -1441,7 +1441,7 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=CN_SPC "目录参考"; @@ -1574,7 +1574,7 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1596,7 +1596,7 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result += CN_SPC "模块参考手册"; @@ -1696,7 +1696,7 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// // new since 1.6.0 ////////////////////////////////////////////////////////////////////////// - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { // return QCString(name)+" Relation"; // unsure @@ -1727,12 +1727,12 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 // new since 1.6.3 ////////////////////////////////////////////////////////////////////////// - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"文件在"+CN_SPC+name; } - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"在" CN_SPC+name+CN_SPC "中引用"; } @@ -1770,7 +1770,7 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 { return "版权所有"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString(name)+CN_SPC "的目录依赖关系图"; } @@ -1796,11 +1796,11 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 { return "枚举说明文档从下列文件生成:"; } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+CN_SPC "枚举类型参考"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+CN_SPC "继承自" CN_SPC+what; } /*! Header of the sections with inherited members specific for the @@ -1883,21 +1883,21 @@ class TranslatorChinese : public TranslatorAdapter_1_8_15 { return "常量组"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result=namespaceName; result+= CN_SPC "常量组参考"; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)sName; result+= CN_SPC "服务参考"; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)sName; result+= CN_SPC "单例参考"; diff --git a/src/translator_cz.h b/src/translator_cz.h index 4fb3bc2..1ce249e 100644 --- a/src/translator_cz.h +++ b/src/translator_cz.h @@ -172,10 +172,10 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result("Generováno automaticky programem Doxygen " "ze zdrojových textů"); - if (s) result += QCString(" projektu ") + s; + if (!s.isEmpty()) result += QCString(" projektu ") + s; result += "."; return result; } @@ -542,18 +542,17 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result("Generováno "); result += date; - if (projName) - result += QCString(" pro projekt ") + projName; + if (!projName.isEmpty()) result += QCString(" pro projekt ") + projName; result += " programem"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return QCString("Diagram dědičnosti pro třídu ") + clName; } @@ -630,7 +629,7 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -652,7 +651,7 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result("Dokumentace souboru "); result+=fileName; @@ -660,7 +659,7 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result("Dokumentace prostoru jmen "); result+=namespaceName; @@ -872,12 +871,12 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Diagram tříd pro "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Graf závislostí na vkládaných souborech " "pro "+fName+":"; @@ -1162,7 +1161,7 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 return "Třídy"; } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return QCString("Balík ") + name; } @@ -1535,7 +1534,7 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result = "Reference k adresáři "; result += dirName; @@ -1671,7 +1670,7 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1693,7 +1692,7 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result="Dokumentace modulu "; result += namespaceName; @@ -1793,7 +1792,7 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return "Relace " + QCString(name); } @@ -1830,7 +1829,7 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Soubor v "+name; } @@ -1839,7 +1838,7 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Vkládá (include) soubor z "+name; } @@ -1884,7 +1883,7 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Graf závislosti na adresářích pro ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1914,11 +1913,11 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return "Reference k výčtu "+QCString(name); } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" dědí se z "+what; } /*! Header of the sections with inherited members specific for the @@ -1999,21 +1998,21 @@ class TranslatorCzech : public TranslatorAdapter_1_8_15 { return "Konstantní skupiny"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result="Konstantní skupiny z "; result += namespaceName; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result="Popis služby "; result += sName; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result="Popis singletonu "; result += sName; diff --git a/src/translator_de.h b/src/translator_de.h index be51653..ff7b704 100644 --- a/src/translator_de.h +++ b/src/translator_de.h @@ -233,9 +233,9 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Automatisch erzeugt von Doxygen"; - if (s) result+=(QCString)" für "+s; + if (!s.isEmpty()) result+=(QCString)" für "+s; result+=" aus dem Quellcode."; return result; } @@ -603,16 +603,16 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Erzeugt am "+date; - if (projName) result+=(QCString)" für "+projName; + if (!projName.isEmpty()) result+=(QCString)" für "+projName; result+=(QCString)" von"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Klassendiagramm für "+clName+":"; } @@ -691,7 +691,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -713,7 +713,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+="-Dateireferenz"; @@ -721,7 +721,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+="-Namensbereichsreferenz"; @@ -928,13 +928,13 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Zusammengehörigkeiten von "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Include-Abhängigkeitsdiagramm für "+fName+":"; } @@ -1253,7 +1253,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Paket "+name; } @@ -1637,7 +1637,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+="-Verzeichnisreferenz"; return result; } /*! This returns the word directory with or without starting capital @@ -1765,7 +1765,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1787,7 +1787,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+="-Modul-Referenz"; @@ -1891,7 +1891,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return "Bezug " + QCString(name); } @@ -1928,7 +1928,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Datei in "+name; } @@ -1937,7 +1937,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Include-Dateien in "+name; } @@ -1982,7 +1982,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Diagramm der Verzeichnisabhängigkeiten für ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -2013,11 +2013,11 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+" Enum-Referenz"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" geerbt von "+what; } /*! Header of the sections with inherited members specific for the @@ -2098,7 +2098,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 { return "Konstante Gruppen"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Konstantengruppen-Referenz"; @@ -2106,7 +2106,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Dienstreferenz"; @@ -2114,7 +2114,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Singleton-Referenz"; @@ -2252,7 +2252,7 @@ class TranslatorGerman : public TranslatorAdapter_1_8_15 return "Klasse"; } } - virtual QCString trCustomReference(const char *name) + virtual QCString trCustomReference(const QCString &name) { return QCString(name)+"-Referenz"; } ////////////////////////////////////////////////////////////////////////// diff --git a/src/translator_dk.h b/src/translator_dk.h index fa1db9a..1d01f32 100644 --- a/src/translator_dk.h +++ b/src/translator_dk.h @@ -185,9 +185,9 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Automatisk genereret af Doxygen"; - if (s) result+=(QCString)" for "+s; + if (!s.isEmpty()) result+=(QCString)" for "+s; result+=" ud fra kildekoden."; return result; } @@ -514,16 +514,16 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Genereret "+date; - if (projName) result+=(QCString)" for "+projName; + if (!projName.isEmpty()) result+=(QCString)" for "+projName; result+=(QCString)" af"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Stamtræ for "+clName+":"; } @@ -602,7 +602,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -624,7 +624,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" filreference"; @@ -632,7 +632,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" namespace-reference"; @@ -829,12 +829,12 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Samarbejdsdiagram for "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Inklusions-afhængighedsgraf for "+fName+":"; } @@ -1080,7 +1080,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Pakke "+name; } @@ -1418,7 +1418,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result="Indhold af kataloget "; result+=dirName; return result;} /*! This returns the word directory with or without starting capital @@ -1551,7 +1551,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1573,7 +1573,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Modulreference"; // " Module Reference" @@ -1675,7 +1675,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" Relation"; // " Relation" } @@ -1712,7 +1712,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"File i "+name; // "File in " } @@ -1721,7 +1721,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Inkluderer file i "+name; // "Includes file in " } @@ -1767,7 +1767,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 return "Copyright"; } - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Afhængighedsgraf for katalog ")+name+":"; } diff --git a/src/translator_en.h b/src/translator_en.h index ba26bc7..3e456cc 100644 --- a/src/translator_en.h +++ b/src/translator_en.h @@ -141,9 +141,9 @@ class TranslatorEnglish : public Translator /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Generated automatically by Doxygen"; - if (s) result+=(QCString)" for "+s; + if (!s.isEmpty()) result+=(QCString)" for "+s; result+=" from the source code."; return result; } @@ -515,16 +515,16 @@ class TranslatorEnglish : public Translator /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Generated on "+date; - if (projName) result+=(QCString)" for "+projName; + if (!projName.isEmpty()) result+=(QCString)" for "+projName; result+=(QCString)" by"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Inheritance diagram for "+clName+":"; } @@ -603,7 +603,7 @@ class TranslatorEnglish : public Translator ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -625,7 +625,7 @@ class TranslatorEnglish : public Translator } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" File Reference"; @@ -633,7 +633,7 @@ class TranslatorEnglish : public Translator } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Namespace Reference"; @@ -829,12 +829,12 @@ class TranslatorEnglish : public Translator ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Collaboration diagram for "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Include dependency graph for "+fName+":"; } @@ -1117,7 +1117,7 @@ class TranslatorEnglish : public Translator } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Package "+name; } @@ -1511,7 +1511,7 @@ class TranslatorEnglish : public Translator /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" Directory Reference"; return result; } /*! This returns the word directory with or without starting capital @@ -1639,7 +1639,7 @@ class TranslatorEnglish : public Translator } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1660,7 +1660,7 @@ class TranslatorEnglish : public Translator return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Module Reference"; @@ -1762,7 +1762,7 @@ class TranslatorEnglish : public Translator ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" Relation"; } @@ -1799,7 +1799,7 @@ class TranslatorEnglish : public Translator * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"File in "+name; } @@ -1808,7 +1808,7 @@ class TranslatorEnglish : public Translator * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Includes file in "+name; } @@ -1853,7 +1853,7 @@ class TranslatorEnglish : public Translator { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Directory dependency graph for ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1881,11 +1881,11 @@ class TranslatorEnglish : public Translator } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+" Enum Reference"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" inherited from "+what; } /*! Header of the sections with inherited members specific for the @@ -1966,21 +1966,21 @@ class TranslatorEnglish : public Translator { return "Constant Groups"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Constant Group Reference"; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Service Reference"; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Singleton Reference"; @@ -2119,7 +2119,7 @@ class TranslatorEnglish : public Translator return "Class"; } } - virtual QCString trCustomReference(const char *name) + virtual QCString trCustomReference(const QCString &name) { return QCString(name)+" Reference"; } /* Slice */ @@ -2219,7 +2219,7 @@ class TranslatorEnglish : public Translator { return "Exception Documentation"; } - virtual QCString trCompoundReferenceSlice(const char *clName, ClassDef::CompoundType compType, bool isLocal) + virtual QCString trCompoundReferenceSlice(const QCString &clName, ClassDef::CompoundType compType, bool isLocal) { QCString result=(QCString)clName; if (isLocal) result+=" Local"; @@ -2262,6 +2262,51 @@ class TranslatorEnglish : public Translator virtual QCString trDesignUnitDocumentation() { return "Design Unit Documentation"; } +////////////////////////////////////////////////////////////////////////// +// new since 1.9.2 +////////////////////////////////////////////////////////////////////////// + + /** C++20 concept */ + virtual QCString trConcept(bool first_capital, bool singular) + { + QCString result((first_capital ? "Concept" : "concept")); + if (!singular) result+="s"; + return result; + } + /*! used as the title of the HTML page of a C++20 concept page */ + virtual QCString trConceptReference(const QCString &conceptName) + { + QCString result=conceptName; + result+=" Concept Reference"; + return result; + } + + /*! used as the title of page containing all the index of all concepts. */ + virtual QCString trConceptList() + { return "Concept List"; } + + /*! used as the title of chapter containing the index listing all concepts. */ + virtual QCString trConceptIndex() + { return "Concept Index"; } + + /*! used as the title of chapter containing all information about concepts. */ + virtual QCString trConceptDocumentation() + { return "Concept Documentation"; } + + /*! used as an introduction to the concept list */ + virtual QCString trConceptListDescription(bool extractAll) + { + QCString result="Here is a list of all "; + if (!extractAll) result+="documented "; + result+="concepts with brief descriptions:"; + return result; + } + + /*! used to introduce the definition of the C++20 concept */ + virtual QCString trConceptDefinition() + { + return "Concept definition"; + } }; #endif diff --git a/src/translator_eo.h b/src/translator_eo.h index 4ae6ee9..8482b39 100644 --- a/src/translator_eo.h +++ b/src/translator_eo.h @@ -143,9 +143,9 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Generita aŭtomate de Doxygen"; - if (s) result+=(QCString)" por "+s; + if (!s.isEmpty()) result+=(QCString)" por "+s; result+=" el la fontkodo."; return result; } @@ -505,16 +505,16 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Generita la "+date; - if (projName) result+=(QCString)" por "+projName; + if (!projName.isEmpty()) result+=(QCString)" por "+projName; result+=(QCString)" de"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Heredada diagramo por "+clName+":"; } @@ -593,7 +593,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -615,7 +615,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" Dosiera referenco"; @@ -623,7 +623,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Nomspaca referenco"; @@ -820,12 +820,12 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Kunlaborada diagramo por "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Inkluzivaĵa dependeca diagramo por "+fName+":"; } @@ -1105,7 +1105,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Pakaĵo "+name; } @@ -1499,7 +1499,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" Dosieruja Referenco"; return result; } /*! This returns the word directory with or without starting capital @@ -1627,7 +1627,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1648,7 +1648,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Modula Referenco"; @@ -1747,7 +1747,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" Rilato"; } @@ -1784,7 +1784,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Dosiero en "+name; } @@ -1793,7 +1793,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Inkluzivas dosieron en "+name; } @@ -1846,7 +1846,7 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 { return "Kopirajto"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Dosieruja dependa diagramo por ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1874,11 +1874,11 @@ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+" Enum Referenco"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" heredita el "+what; } /*! Header of the sections with inherited members specific for the diff --git a/src/translator_es.h b/src/translator_es.h index 554c487..41dbd8f 100644 --- a/src/translator_es.h +++ b/src/translator_es.h @@ -135,9 +135,9 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Generado automáticamente por Doxygen"; - if (s) result+=(QCString)" para "+s; + if (!s.isEmpty()) result+=(QCString)" para "+s; result+=" del código fuente."; return result; } @@ -495,16 +495,16 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Generado el "+date; - if (projName) result+=(QCString)" para "+projName; + if (!projName.isEmpty()) result+=(QCString)" para "+projName; result+=(QCString)" por"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Diagrama de herencias de "+clName; } @@ -583,7 +583,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -605,7 +605,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result="Referencia del Archivo "; result+=fileName; @@ -613,7 +613,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result="Referencia del Namespace "; result+=namespaceName; @@ -820,13 +820,13 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Diagrama de colaboración para "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Dependencia gráfica adjunta para "+fName+":"; } @@ -1139,7 +1139,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Paquetes "+name; } @@ -1546,7 +1546,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result="Referencia del directorio "; result+=dirName; @@ -1684,7 +1684,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1706,7 +1706,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result="Referencia módulo "; result+=namespaceName; @@ -1809,7 +1809,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" relación"; } @@ -1846,7 +1846,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Fichero en "+name; } @@ -1855,7 +1855,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Incluye ficheros en "+name; } @@ -1903,7 +1903,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Gráfico de dependencias de directorios para ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1933,11 +1933,11 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString("Referencia del enum ") + QCString(name); } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" heredados desde "+what; } /*! Header of the sections with inherited members specific for the @@ -2018,21 +2018,21 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 { return "Grupos constantes"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" referencia de grupos constantes"; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Referencia servicio"; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)sName; result+=" referencia Singleton"; @@ -2171,7 +2171,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 return "Clase"; } } - virtual QCString trCustomReference(const char *name) + virtual QCString trCustomReference(const QCString &name) { return "Referencia"+QCString(name); } virtual QCString trConstants() @@ -2270,7 +2270,7 @@ class TranslatorSpanish : public TranslatorAdapter_1_8_15 { return "Documentación de excepción"; } - virtual QCString trCompoundReferenceSlice(const char *clName, ClassDef::CompoundType compType, bool isLocal) + virtual QCString trCompoundReferenceSlice(const QCString &clName, ClassDef::CompoundType compType, bool isLocal) { QCString result="Referencia de"; switch(compType) diff --git a/src/translator_fa.h b/src/translator_fa.h index 56ba3da..cec2da1 100644 --- a/src/translator_fa.h +++ b/src/translator_fa.h @@ -158,9 +158,9 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="تولید شده توسط نرم افزار دی اکسیژن "; - if (s) result+=(QCString)" برای "+s; + if (!s.isEmpty()) result+=(QCString)" برای "+s; result+=" از کد برنامه "; return result; } @@ -502,16 +502,16 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result = HtmlDivEnd + HtmlRightToLeft + QCString("توليد شده در ") +date ; - if (projName) result+=(QCString)" برای "+projName; + if (!projName.isEmpty()) result+=(QCString)" برای "+projName; result+=(QCString)" توسط"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)""+clName+" نمودار وراثت برای :"; } @@ -590,7 +590,7 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -612,7 +612,7 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" مرجع پرونده"; @@ -620,7 +620,7 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" مرجع فضای نام"; @@ -814,12 +814,12 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Collaboration diagram for "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"نمودار شامل شدن ها برای "+fName+":"; } @@ -1099,7 +1099,7 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Package "+name; } @@ -1492,7 +1492,7 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" مرجع شاخه ی"; return result; } /*! This returns the word directory with or without starting capital @@ -1596,7 +1596,7 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1617,7 +1617,7 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Module Reference"; @@ -1706,7 +1706,7 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name) + " Relation"; } @@ -1743,7 +1743,7 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"پرونده ای در "+name; } @@ -1752,7 +1752,7 @@ class TranslatorPersian : public TranslatorAdapter_1_7_5 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Includes file in "+name; } diff --git a/src/translator_fi.h b/src/translator_fi.h index dd2d38c..1db2372 100644 --- a/src/translator_fi.h +++ b/src/translator_fi.h @@ -197,7 +197,7 @@ class TranslatorFinnish : public TranslatorAdapter_1_6_0 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result=(QCString)"Automaattisesti luotu Doxygenilla " "lähdekoodista projektille "+s; // "Generated automatically by Doxygen" ... "for" ... "from the sourcecode" //if (s) result+=(QCString)" voor "+s; @@ -565,20 +565,20 @@ class TranslatorFinnish : public TranslatorAdapter_1_6_0 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { // funktio on hiukan vaikea kääntää prepositioihin sidotun rakenteen vuoksi. // Muutetaan siis lauserakennetta suomalaisemmaksi // Generated on $date for $project by: // -> Generated for $project on $date by: QCString result=(QCString)"Generoinut "; - if (projName) result+=(QCString)"projektille "+projName+" "; + if (!projName.isEmpty()) result+=(QCString)"projektille "+projName+" "; result+=(QCString)date+" "; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return "Luokan "+(QCString)clName+" luokkakaavio"; // "Inheritance diagram for " } @@ -657,7 +657,7 @@ class TranslatorFinnish : public TranslatorAdapter_1_6_0 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -679,7 +679,7 @@ class TranslatorFinnish : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" tiedostoreferenssi"; // " File Reference" @@ -687,7 +687,7 @@ class TranslatorFinnish : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" nimiavaruusreferenssi"; // " Namespace Reference" @@ -884,12 +884,12 @@ class TranslatorFinnish : public TranslatorAdapter_1_6_0 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Yhteistyökaavio luokalle "+clName+":"; // "Collaboration diagram for "+clName+":" } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Sisällytysriippuvuuskaavio tiedostolle "+fName+":"; // "Include dependency graph for "+fName+":" } @@ -1221,7 +1221,7 @@ class TranslatorFinnish : public TranslatorAdapter_1_6_0 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Paketti "+name; // "Package " } @@ -1616,7 +1616,7 @@ class TranslatorFinnish : public TranslatorAdapter_1_6_0 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" hakemistoreferenssi"; return result; } // " Directory Reference" @@ -1748,7 +1748,7 @@ class TranslatorFinnish : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1769,7 +1769,7 @@ class TranslatorFinnish : public TranslatorAdapter_1_6_0 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" moduulin referenssi"; // " Module Reference" diff --git a/src/translator_fr.h b/src/translator_fr.h index a4eafc2..9bbcf2c 100644 --- a/src/translator_fr.h +++ b/src/translator_fr.h @@ -202,9 +202,9 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Généré automatiquement par Doxygen"; - if (s) result+=(QCString)" pour "+s; + if (!s.isEmpty()) result+=(QCString)" pour "+s; result+=" à partir du code source."; return result; } @@ -569,16 +569,16 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Généré le "+date; - if (projName) result+=(QCString)" pour "+projName; + if (!projName.isEmpty()) result+=(QCString)" pour "+projName; result+=(QCString)" par"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Graphe d'héritage de "+clName+":"; } @@ -657,7 +657,7 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -680,7 +680,7 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result= "Référence du fichier "; result+=fileName; @@ -688,7 +688,7 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result= "Référence de l'espace de nommage "; result+=namespaceName; @@ -888,12 +888,12 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Graphe de collaboration de "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Graphe des dépendances par inclusion de "+fName+":"; } @@ -1173,7 +1173,7 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Paquetage "+name; } @@ -1568,7 +1568,7 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result="Répertoire de référence de "; result+=dirName; return result; } /*! This returns the word directory with or without starting capital @@ -1695,7 +1695,7 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1716,7 +1716,7 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result="Référence du module "; result+= namespaceName; @@ -1818,7 +1818,7 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return "Relation " + QCString(name); } @@ -1855,7 +1855,7 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Fichier dans "+name; } @@ -1864,7 +1864,7 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Inclut le fichier dans "+name; } @@ -1909,7 +1909,7 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Graphe des dépendances de répertoires pour ")+name+":"; } @@ -1938,11 +1938,11 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+" Référence de l'énumération"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" hérités de "+what; } /*! Header of the sections with inherited members specific for the @@ -2023,21 +2023,21 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 { return "Groupes constants"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result="Référence du groupe constant "; result+=namespaceName; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result="Référence du service "; result+=(QCString)sName; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result="Référence du singleton "; result+=(QCString)sName; @@ -2176,7 +2176,7 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 return "Classe"; } } - virtual QCString trCustomReference(const char *name) + virtual QCString trCustomReference(const QCString &name) { return QCString("Référence ") + QCString(name); } virtual QCString trConstants() @@ -2275,7 +2275,7 @@ class TranslatorFrench : public TranslatorAdapter_1_8_15 { return "Documentation des exceptions"; } - virtual QCString trCompoundReferenceSlice(const char *clName, ClassDef::CompoundType compType, bool isLocal) + virtual QCString trCompoundReferenceSlice(const QCString &clName, ClassDef::CompoundType compType, bool isLocal) { QCString result = "Référence "; bool feminine = true; diff --git a/src/translator_gr.h b/src/translator_gr.h index a0511b7..b40b2ec 100644 --- a/src/translator_gr.h +++ b/src/translator_gr.h @@ -140,9 +140,9 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Δημιουργήθηκε αυτόματα από το Doxygen"; - if (s) result+=(QCString)" για "+s; + if (!s.isEmpty()) result+=(QCString)" για "+s; result+=" από τον πηγαίο κώδικα."; return result; } @@ -501,16 +501,16 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Δημιουργήθηκε στις "+date; - if (projName) result+=(QCString)" για "+projName; + if (!projName.isEmpty()) result+=(QCString)" για "+projName; result+=(QCString)" από"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Διάγραμμα κληρονομικότητας για την "+clName+":"; } @@ -589,7 +589,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -611,7 +611,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result="Τεκμηρίωση Αρχείου "; result+=fileName; @@ -619,7 +619,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result="Τεκμηρίωση Χώρου Ονομάτων "; result+=namespaceName; @@ -816,12 +816,12 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Διάγραμμα Συνεργασίας για την κλάση "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Διάγραμμα εξάρτησης αρχείου συμπερίληψης για το "+fName+":"; } @@ -1104,7 +1104,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Πακέτο "+name; } @@ -1508,7 +1508,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=QCString("Αναφορά του Καταλόγου ") + dirName; return result; } /*! This returns the word directory with or without starting capital @@ -1636,7 +1636,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1657,7 +1657,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Δηλώσεις Υπομονάδων"; @@ -1757,7 +1757,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return "Σχέση του "+QCString(name); } @@ -1794,7 +1794,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Αρχείο σε "+name; } @@ -1803,7 +1803,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Εσωκλείει το αρχείο στο "+name; } @@ -1848,7 +1848,7 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Διάγραμμα εξάρτησης φακέλων για ")+name+":"; } @@ -1877,11 +1877,11 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString("Αναφορά Απαρίθμησης ") + QCString(name); } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" κληρονόμησαν από "+what; } /*! Header of the sections with inherited members specific for the @@ -1962,21 +1962,21 @@ class TranslatorGreek : public TranslatorAdapter_1_8_15 { return "Ομάδες Σταθερών"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Τεκμηρίωση Ομάδας Σταθερών"; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Τεκμηρίωση Υπηρεσίας"; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Τεκμηρίωση Μονοσύνολου"; diff --git a/src/translator_hr.h b/src/translator_hr.h index 3f9f492..9f9f841 100644 --- a/src/translator_hr.h +++ b/src/translator_hr.h @@ -118,9 +118,9 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 { return "Ovo je popis svih članova"; } QCString trIncludingInheritedMembers() { return ", uključujući naslijeđene članove."; } - QCString trGeneratedAutomatically(const char *s) + QCString trGeneratedAutomatically(const QCString &s) { QCString result="napravljeno automatski Doxygen-om"; - if (s) result+=(QCString)" za "+s; + if (!s.isEmpty()) result+=(QCString)" za "+s; result+=" iz programskog koda."; return result; } @@ -285,14 +285,14 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 { return "Dokumentacija varijable"; } QCString trCompounds() { return "Strukture"; } - QCString trGeneratedAt(const char *date,const char *projName) + QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Napravljeno "+date; - if (projName) result+=(QCString)" projekt: "+projName; + if (!projName.isEmpty()) result+=(QCString)" projekt: "+projName; result+=" generator: "; return result; } - QCString trClassDiagram(const char *clName) + QCString trClassDiagram(const QCString &clName) { return QCString("Dijagram klasa za ")+clName; } @@ -342,7 +342,7 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 // new since 0.49-990425 ////////////////////////////////////////////////////////////////////////// - QCString trCompoundReference(const char *clName, + QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool /*isTemplate*/) // used as the title of the HTML page of a class/struct/union @@ -362,14 +362,14 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 result += clName; return result; } - QCString trFileReference(const char *fileName) + QCString trFileReference(const QCString &fileName) // used as the title of the HTML page of a file { QCString result="Opis datoteke "; result+=fileName; return result; } - QCString trNamespaceReference(const char *namespaceName) + QCString trNamespaceReference(const QCString &namespaceName) // used as the title of the HTML page of a namespace { QCString result ="Opis imenika "; @@ -559,12 +559,12 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - QCString trCollaborationDiagram(const char *clName) + QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Kolaboracijski dijagram za "+clName+ ":"; } /*! this text is put before an include dependency graph */ - QCString trInclDepGraph(const char *fName) + QCString trInclDepGraph(const QCString &fName) { return (QCString)"Graf include međuovisnosti za "+fName+":"; } @@ -824,7 +824,7 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 return "Klase"; } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Paket "+name; } @@ -1194,7 +1194,7 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result= "Opis direktorija "; result += dirName; return result; } /*! This returns the word directory with or without starting capital @@ -1320,7 +1320,7 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1341,7 +1341,7 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" - Sadržaj modula"; @@ -1438,7 +1438,7 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString("Relacije ") + QCString(name); } @@ -1475,7 +1475,7 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Datoteka u "+name; } @@ -1484,7 +1484,7 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Uključuje datotake u "+name; } @@ -1528,7 +1528,7 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Direktoriji o kojima ovisi ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1556,11 +1556,11 @@ class TranslatorCroatian : public TranslatorAdapter_1_8_2 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return "Opis enumeracije " + QCString(name); } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" naslijeđeni od "+what; } /*! Header of the sections with inherited members specific for the diff --git a/src/translator_hu.h b/src/translator_hu.h index ae2e169..67f3570 100644 --- a/src/translator_hu.h +++ b/src/translator_hu.h @@ -167,9 +167,9 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Ezt a dokumentációt a Doxygen készítette "; - if (s) result+=(QCString)" a" + zed(s[0])+s+(QCString)" projekthez"; + if (!s.isEmpty()) result+=(QCString)" a" + zed(s[0])+s+(QCString)" projekthez"; result+=" a forráskódból."; return result; } @@ -530,16 +530,16 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)""; - if (projName) result+=(QCString)"Projekt: "+projName; + if (!projName.isEmpty()) result+=(QCString)"Projekt: "+projName; result+=(QCString)" Készült: "+date+" Készítette: "; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"A"+zed(clName[0])+clName+" osztály származási diagramja:"; } @@ -618,7 +618,7 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -640,7 +640,7 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" fájlreferencia"; @@ -648,7 +648,7 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" névtér-referencia"; @@ -845,12 +845,12 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"A"+zed(clName[0])+clName+" osztály együttműködési diagramja:"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"A"+zed(fName[0])+fName+" definíciós fájl függési gráfja:"; } @@ -1131,7 +1131,7 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return name+(QCString)" csomag"; } @@ -1526,7 +1526,7 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" könyvtárreferencia"; return result; } /*! This returns the word directory with or without starting capital @@ -1653,7 +1653,7 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1674,7 +1674,7 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" modul hivatkozás"; @@ -1777,7 +1777,7 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" kapcsolat"; } @@ -1814,7 +1814,7 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Fájl a(z) "+name+" könyvtárban"; } @@ -1823,7 +1823,7 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Tartalmazott fájl a(z) "+name+" könyvtárban"; } @@ -1868,7 +1868,7 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 { return "Szerzői jog"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Könyvtár függőségi gráf a(z) ")+name+"-könyvtárhoz:"; } ////////////////////////////////////////////////////////////////////////// @@ -1896,11 +1896,11 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+" felsoroló referencia"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" a(z) "+what+" osztályból származnak"; } /*! Header of the sections with inherited members specific for the @@ -1981,21 +1981,21 @@ class TranslatorHungarian : public TranslatorAdapter_1_8_15 { return "Konstans csoportok"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" konstans csoport referencia"; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)sName; result+=" szolgáltatás referencia"; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)sName; result+=" egyke példány referencia"; diff --git a/src/translator_id.h b/src/translator_id.h index 4b5626a..cb7ae2e 100644 --- a/src/translator_id.h +++ b/src/translator_id.h @@ -125,9 +125,9 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Dibangkitkan secara otomatis oleh Doxygen"; - if (s) result+=(QCString)" untuk "+s; + if (!s.isEmpty()) result+=(QCString)" untuk "+s; result+=" dari kode sumber."; return result; } @@ -486,16 +486,16 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Dibangkitkan pada tanggal "+date; - if (projName) result+=(QCString)" untuk "+projName; + if (!projName.isEmpty()) result+=(QCString)" untuk "+projName; result+=(QCString)" oleh"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Diagram hierarki kelas untuk "+clName+":"; } @@ -574,7 +574,7 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -596,7 +596,7 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result="Referensi File "; result+=fileName; @@ -604,7 +604,7 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result="Referensi Namespace "; result+=namespaceName; @@ -802,12 +802,12 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Diagram kolaborasi untuk "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Bagan kebergantungan pemuatan untuk "+fName+":"; } @@ -1086,7 +1086,7 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Paket "+name; } @@ -1479,7 +1479,7 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result="Referensi Direktori "; result+=dirName; return result; } /*! This returns the word directory with or without starting capital @@ -1606,7 +1606,7 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1627,7 +1627,7 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result="Referensi Modul "; result+=namespaceName; @@ -1727,7 +1727,7 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return "Relasi "+QCString(name); } @@ -1764,7 +1764,7 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"File dimuat dalam "+name; } @@ -1773,7 +1773,7 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Memuat file dalam "+name; } @@ -1818,7 +1818,7 @@ class TranslatorIndonesian : public TranslatorAdapter_1_8_0 { return "Hak Cipta"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Bagan dependensi directori untuk ")+name+":"; } }; diff --git a/src/translator_it.h b/src/translator_it.h index 4b12dae..87361d3 100644 --- a/src/translator_it.h +++ b/src/translator_it.h @@ -179,10 +179,10 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - QCString trGeneratedAutomatically(const char *s) + QCString trGeneratedAutomatically(const QCString &s) { QCString result="Generato automaticamente da Doxygen"; - if (s) result+=(QCString)" per "+s; + if (!s.isEmpty()) result+=(QCString)" per "+s; result+=" a partire dal codice sorgente."; return result; } @@ -518,16 +518,16 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - QCString trGeneratedAt(const char *date,const char *projName) + QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Generato "+date; - if (projName) result+=(QCString)" per "+projName; + if (!projName.isEmpty()) result+=(QCString)" per "+projName; result+=(QCString)" da"; return result; } /*! this text is put before a class diagram */ - QCString trClassDiagram(const char *clName) + QCString trClassDiagram(const QCString &clName) { return (QCString)"Diagramma delle classi per "+clName; } @@ -607,7 +607,7 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - QCString trCompoundReference(const char *clName, + QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -630,7 +630,7 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - QCString trFileReference(const char *fileName) + QCString trFileReference(const QCString &fileName) { QCString result="Riferimenti per il file "; result+=(QCString)fileName; @@ -638,7 +638,7 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a namespace */ - QCString trNamespaceReference(const char *namespaceName) + QCString trNamespaceReference(const QCString &namespaceName) { QCString result="Riferimenti per il namespace "; result+=(QCString)namespaceName; @@ -838,12 +838,12 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - QCString trCollaborationDiagram(const char *clName) + QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Diagramma di collaborazione per "+clName+":"; } /*! this text is put before an include dependency graph */ - QCString trInclDepGraph(const char *fName) + QCString trInclDepGraph(const QCString &fName) { return (QCString)"Grafo delle dipendenze di inclusione per "+fName+":"; } @@ -1117,7 +1117,7 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Package "+name; } @@ -1483,7 +1483,7 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result="Riferimenti per la directory "; result+=dirName; return result; } /*! This returns the word directory with or without starting capital @@ -1609,7 +1609,7 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1631,7 +1631,7 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result="Riferimenti per il modulo "; result+=namespaceName; @@ -1733,7 +1733,7 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return "Relazione per "+QCString(name); } @@ -1770,7 +1770,7 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"File in "+name; } @@ -1779,7 +1779,7 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Include il file in "+name; } @@ -1824,7 +1824,7 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Grafo di dipendenza delle directory per ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1853,11 +1853,11 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString("Riferimenti per il tipo enumerato ") + QCString(name); } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" ereditati da "+what; } /*! Header of the sections with inherited members specific for the @@ -1938,21 +1938,21 @@ class TranslatorItalian : public TranslatorAdapter_1_8_15 { return "Gruppi di costanti"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result="Riferimenti per il gruppo di costanti "; result+=namespaceName; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)"Riferimenti per il servizio "; result+=sName; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)"Riferimenti per il singleton "; result+=sName; diff --git a/src/translator_jp.h b/src/translator_jp.h index 7985823..0f9cdf7 100644 --- a/src/translator_jp.h +++ b/src/translator_jp.h @@ -167,9 +167,9 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result = "Doxygen により"; - if (s) result=(QCString)" "+s+"の"; + if (!s.isEmpty()) result=(QCString)" "+s+"の"; result+="ソースコードから抽出しました。"; return result; } @@ -534,16 +534,16 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result = (QCString)date+"作成"; - if (projName) result+=(QCString)" - " + projName; + if (!projName.isEmpty()) result+=(QCString)" - " + projName; result+=" / 構成: "; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)clName+" の継承関係図"; } @@ -623,7 +623,7 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -644,14 +644,14 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=(QCString)fileName+" ファイル"; return result; } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=(QCString)namespaceName+" 名前空間"; return result; @@ -850,12 +850,12 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 } /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)clName+" 連携図"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)fName+" の依存先関係図:"; } @@ -1128,7 +1128,7 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)name+" パッケージ"; } @@ -1507,7 +1507,7 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" ディレクトリリファレンス"; return result; } /*! This returns the word directory with or without starting capital @@ -1634,7 +1634,7 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1655,7 +1655,7 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+="モジュール"; @@ -1744,7 +1744,7 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" 関係"; } @@ -1781,7 +1781,7 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)name+"にあるファイル"; } @@ -1790,7 +1790,7 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)name+"にあるファイルを include している"; } @@ -1834,7 +1834,7 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 { return "著作権所有"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString(name)+" のディレクトリ依存関係図"; } ////////////////////////////////////////////////////////////////////////// @@ -1860,11 +1860,11 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString("列挙 ")+name+" 詳解"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString("基底クラス ")+what+" に属する継承"+members; } /*! Header of the sections with inherited members specific for the @@ -1946,21 +1946,21 @@ class TranslatorJapanese : public TranslatorAdapter_1_8_15 { return "定数グループ"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" 定数グループ詳解"; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)sName; result+=" サービス詳解"; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Singleton 詳解"; diff --git a/src/translator_kr.h b/src/translator_kr.h index dda8f6e..c0ae658 100644 --- a/src/translator_kr.h +++ b/src/translator_kr.h @@ -165,9 +165,9 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="소스 코드로부터 "; - if (s) result+=s+(QCString)"를 위해 "; + if (!s.isEmpty()) result+=s+(QCString)"를 위해 "; result+="Doxygen에 의해 자동으로 생성됨."; return result; } @@ -529,16 +529,16 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"생성시간 : "+date; - if (projName) result+=(QCString)", 프로젝트명 : "+projName; + if (!projName.isEmpty()) result+=(QCString)", 프로젝트명 : "+projName; result+=(QCString)", 생성자 : "; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)clName+"에 대한 상속 다이어그램 : "; } @@ -617,7 +617,7 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -639,7 +639,7 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" 파일 참조"; @@ -647,7 +647,7 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" 네임스페이스 참조"; @@ -845,12 +845,12 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)clName+"에 대한 협력 다이어그램:"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)fName+"에 대한 include 의존 그래프"; } @@ -1124,7 +1124,7 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return name+(QCString)" 패키지"; } @@ -1517,7 +1517,7 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" 디렉토리 참조"; return result; } /*! This returns the word directory with or without starting capital @@ -1645,7 +1645,7 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1666,7 +1666,7 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" 모듈 참조"; @@ -1767,7 +1767,7 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" 관계"; } @@ -1804,7 +1804,7 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return QCString(name) + "의 파일"; } @@ -1813,7 +1813,7 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return QCString(name) + "의 파일 포함"; } @@ -1858,7 +1858,7 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString(name) + QCString("에 대한 디렉토리 의존성 그래프:"); } ////////////////////////////////////////////////////////////////////////// @@ -1884,11 +1884,11 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+" Enum Reference"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(what) + QCString("(으)로부터 상속된 ") + QCString(members); } /*! Header of the sections with inherited members specific for the @@ -1969,21 +1969,21 @@ class TranslatorKorean : public TranslatorAdapter_1_8_15 { return "상수 그룹들"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" 상수 그룹 레퍼런스"; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)sName; result+=" 서비스 레퍼런스"; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)sName; result+=" 싱글톤 레퍼런스"; diff --git a/src/translator_lt.h b/src/translator_lt.h index 1be20d2..ad88331 100644 --- a/src/translator_lt.h +++ b/src/translator_lt.h @@ -132,9 +132,9 @@ class TranslatorLithuanian : public TranslatorAdapter_1_4_6 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Automatiškai sugeneruota Doxygen įrankiu"; - if (s) result+=(QCString)" "+s; + if (!s.isEmpty()) result+=(QCString)" "+s; result+=" iš programos kodo."; return result; } @@ -494,16 +494,16 @@ class TranslatorLithuanian : public TranslatorAdapter_1_4_6 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Sugeneruota "+date;/*FIXME*/ - if (projName) result+=(QCString)" "+projName;/*FIXME*/ + if (!projName.isEmpty()) result+=(QCString)" "+projName;/*FIXME*/ result+=(QCString)" ";/*FIXME*/ return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Paveldimumo diagrama "+clName+":"; /*FIXME*/ } @@ -582,7 +582,7 @@ class TranslatorLithuanian : public TranslatorAdapter_1_4_6 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -603,7 +603,7 @@ class TranslatorLithuanian : public TranslatorAdapter_1_4_6 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" Failo Nuoroda"; @@ -611,7 +611,7 @@ class TranslatorLithuanian : public TranslatorAdapter_1_4_6 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Vardų Srities Nuoroda"; @@ -808,12 +808,12 @@ class TranslatorLithuanian : public TranslatorAdapter_1_4_6 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Bendradarbiavimo diagrama "+clName+":";/*FIXME*/ } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Įtraukimo priklausomybių diagrama "+fName+":";/*FIXME*/ } @@ -1094,7 +1094,7 @@ class TranslatorLithuanian : public TranslatorAdapter_1_4_6 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Paketas "+name; } @@ -1492,7 +1492,7 @@ class TranslatorLithuanian : public TranslatorAdapter_1_4_6 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" Directorijos aprašas"; return result; } /*! This returns the word directory with or without starting capital diff --git a/src/translator_lv.h b/src/translator_lv.h index 8dcc45b..7367502 100644 --- a/src/translator_lv.h +++ b/src/translator_lv.h @@ -147,9 +147,9 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Automātiski ģenerēts izmantojot Doxygen"; - if (s) result+=(QCString)" priekš "+s; + if (!s.isEmpty()) result+=(QCString)" priekš "+s; result+=" no pirmkoda."; return result; } @@ -509,16 +509,16 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Ģenerēts "+date; - if (projName) result+=(QCString)" projektam "+projName; + if (!projName.isEmpty()) result+=(QCString)" projektam "+projName; result+=(QCString)" ar"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Mantojamības diagramma klasei "+clName+":"; } @@ -597,7 +597,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -619,7 +619,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" faila apraksts"; @@ -627,7 +627,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" nosaukumvietas apraksts"; @@ -823,12 +823,12 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Sadarbības diagramma klasei "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Include dependency graph for "+fName+":"; } @@ -1111,7 +1111,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Pakotne "+name; } @@ -1505,7 +1505,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result="Direktorijas "; result+=dirName; result+=" atsauce"; return result; } /*! This returns the word directory with or without starting capital @@ -1633,7 +1633,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1654,7 +1654,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" moduļu atsauce"; @@ -1756,7 +1756,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" relācija"; } @@ -1793,7 +1793,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"File in "+name; } @@ -1802,7 +1802,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Includes file in "+name; } @@ -1847,7 +1847,7 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 { return "Autortiesības"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Atkarību grafs direktorijai ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1877,11 +1877,11 @@ class TranslatorLatvian : public TranslatorAdapter_1_8_4 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+" uzskaitījumliterāļa atsauce"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" manto no "+what; } /*! Header of the sections with inherited members specific for the diff --git a/src/translator_mk.h b/src/translator_mk.h index 97a55dc..6db452e 100644 --- a/src/translator_mk.h +++ b/src/translator_mk.h @@ -128,9 +128,9 @@ class TranslatorMacedonian : public TranslatorAdapter_1_6_0 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Автоматски создадено од Doxygen"; - if (s) result+=(QCString)" за "+s; + if (!s.isEmpty()) result+=(QCString)" за "+s; result+=" изворниот код."; return result; } @@ -489,16 +489,16 @@ class TranslatorMacedonian : public TranslatorAdapter_1_6_0 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Создадено на "+date; - if (projName) result+=(QCString)" за "+projName; + if (!projName.isEmpty()) result+=(QCString)" за "+projName; result+=(QCString)" од"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Диаграм на наследување за "+clName+":"; } @@ -577,7 +577,7 @@ class TranslatorMacedonian : public TranslatorAdapter_1_6_0 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -599,7 +599,7 @@ class TranslatorMacedonian : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result = "Опис на Датотекaта "; result += fileName; @@ -607,7 +607,7 @@ class TranslatorMacedonian : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result = "Опис на Имeто на Простор "; result += namespaceName; @@ -804,12 +804,12 @@ class TranslatorMacedonian : public TranslatorAdapter_1_6_0 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Диаграм на соработка за "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Вклучен дијаграм на зависност за "+fName+":"; } @@ -1089,7 +1089,7 @@ class TranslatorMacedonian : public TranslatorAdapter_1_6_0 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Пакет "+name; } @@ -1481,7 +1481,7 @@ class TranslatorMacedonian : public TranslatorAdapter_1_6_0 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result= "Опис на Именикот "; result += dirName; return result; } /*! This returns the word directory with or without starting capital @@ -1608,7 +1608,7 @@ class TranslatorMacedonian : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1628,7 +1628,7 @@ class TranslatorMacedonian : public TranslatorAdapter_1_6_0 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" - Содржина на Модул"; diff --git a/src/translator_nl.h b/src/translator_nl.h index 413d353..7bf8db3 100644 --- a/src/translator_nl.h +++ b/src/translator_nl.h @@ -62,9 +62,9 @@ class TranslatorDutch : public Translator { return "Dit is de complete lijst van alle members voor"; } QCString trIncludingInheritedMembers() { return ", inclusief alle overgeërfde members."; } - QCString trGeneratedAutomatically(const char *s) + QCString trGeneratedAutomatically(const QCString &s) { QCString result="Automatisch gegenereerd door Doxygen"; - if (s) result+=(QCString)" voor "+s; + if (!s.isEmpty()) result+=(QCString)" voor "+s; result+=" uit de programmatekst."; return result; } @@ -202,14 +202,14 @@ class TranslatorDutch : public Translator { return "Documentatie van variabelen"; } QCString trCompounds() { return "Klassen"; } - QCString trGeneratedAt(const char *date,const char *projName) + QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Gegenereerd op "+date; - if (projName) result+=(QCString)" voor "+projName; + if (!projName.isEmpty()) result+=(QCString)" voor "+projName; result+=(QCString)" door"; return result; } - QCString trClassDiagram(const char *clName) + QCString trClassDiagram(const QCString &clName) { return (QCString)"Klasse diagram voor "+clName; } @@ -259,7 +259,7 @@ class TranslatorDutch : public Translator // new since 0.49-990425 ////////////////////////////////////////////////////////////////////////// - QCString trCompoundReference(const char *clName, + QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) // used as the title of the HTML page of a class/struct/union @@ -280,14 +280,14 @@ class TranslatorDutch : public Translator result+=" Referentie"; return result; } - QCString trFileReference(const char *fileName) + QCString trFileReference(const QCString &fileName) // used as the title of the HTML page of a file { QCString result=fileName; result+=" Bestand Referentie"; return result; } - QCString trNamespaceReference(const char *namespaceName) + QCString trNamespaceReference(const QCString &namespaceName) // used as the title of the HTML page of a namespace { QCString result=namespaceName; @@ -479,12 +479,12 @@ class TranslatorDutch : public Translator ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - QCString trCollaborationDiagram(const char *clName) + QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Collaboratie diagram voor "+clName+":"; } /*! this text is put before an include dependency graph */ - QCString trInclDepGraph(const char *fName) + QCString trInclDepGraph(const QCString &fName) { return (QCString)"Include afhankelijkheidsgraaf voor "+fName+":"; } @@ -749,7 +749,7 @@ class TranslatorDutch : public Translator return "Klassen"; } /*! Used as the title of a Java package */ - QCString trPackage(const char *name) + QCString trPackage(const QCString &name) { return (QCString)"Package "+name; } @@ -1137,7 +1137,7 @@ class TranslatorDutch : public Translator /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" Folder Referentie"; return result; } /*! This returns the word directory with or without starting capital @@ -1249,7 +1249,7 @@ class TranslatorDutch : public Translator } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1270,7 +1270,7 @@ class TranslatorDutch : public Translator return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Module Referentie"; @@ -1367,7 +1367,7 @@ class TranslatorDutch : public Translator ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" Relatie"; } @@ -1404,7 +1404,7 @@ class TranslatorDutch : public Translator * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Bestand in "+name; } @@ -1413,7 +1413,7 @@ class TranslatorDutch : public Translator * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Includeert bestand in "+name; } @@ -1447,7 +1447,7 @@ class TranslatorDutch : public Translator { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Folder afhankelijkheidsgraaf voor ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1476,11 +1476,11 @@ class TranslatorDutch : public Translator } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+" Enum Referentie"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" overgeërfd van "+what; } /*! Header of the sections with inherited members specific for the @@ -1561,21 +1561,21 @@ class TranslatorDutch : public Translator { return "Konstanten Groepen"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Konstanten Groepen Referentie"; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Service Referentie"; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Singleton Referentie"; @@ -1712,7 +1712,7 @@ class TranslatorDutch : public Translator return "Klasse"; } } - virtual QCString trCustomReference(const char *name) + virtual QCString trCustomReference(const QCString &name) { return QCString(name)+" Referentie"; } /* Slice */ @@ -1764,7 +1764,7 @@ class TranslatorDutch : public Translator { return "Deze inheritance lijst is min of meer alfabetisch gesorteerd:"; } virtual QCString trExceptionDocumentation() { return "Documentatie van exceptions"; } - virtual QCString trCompoundReferenceSlice(const char *clName, ClassDef::CompoundType compType, bool isLocal) + virtual QCString trCompoundReferenceSlice(const QCString &clName, ClassDef::CompoundType compType, bool isLocal) { QCString result=(QCString)clName; if (isLocal) result+=" Lokale"; @@ -1796,6 +1796,46 @@ class TranslatorDutch : public Translator ////////////////////////////////////////////////////////////////////////// virtual QCString trDesignUnitDocumentation() { return "Ontwerp Eenheid Documentatie"; } + +////////////////////////////////////////////////////////////////////////// +// new since 1.9.2 +////////////////////////////////////////////////////////////////////////// + virtual QCString trConcept(bool first_capital, bool singular) + { + QCString result((first_capital ? "Concept" : "concept")); + if (!singular) result+="en"; + return result; + } + + virtual QCString trConceptReference(const QCString &conceptName) + { + QCString result=conceptName; + result+=" Concept Referentie"; + return result; + } + + virtual QCString trConceptList() + { return "Concept Lijst"; } + + virtual QCString trConceptIndex() + { return "Concept Index"; } + + virtual QCString trConceptDocumentation() + { return "Concept Documentatie"; } + + virtual QCString trConceptListDescription(bool extractAll) + { + QCString result="Hieronder volgt de lijst met alle "; + if (!extractAll) result+="gedocumenteerde "; + result+="concepten, elk met een korte beschrijving:"; + return result; + } + + virtual QCString trConceptDefinition() + { + return "Concept definitie"; + } + }; #endif diff --git a/src/translator_no.h b/src/translator_no.h index dee96d0..0444047 100755 --- a/src/translator_no.h +++ b/src/translator_no.h @@ -142,9 +142,9 @@ class TranslatorNorwegian : public TranslatorAdapter_1_4_6 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Generert automatisk av Doxygen"; - if (s) result+=(QCString)" for "+s; + if (!s.isEmpty()) result+=(QCString)" for "+s; result+=" fra kildekoden."; return result; } @@ -524,16 +524,16 @@ class TranslatorNorwegian : public TranslatorAdapter_1_4_6 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Generert "+date; - if (projName) result+=(QCString)" for "+projName; + if (!projName.isEmpty()) result+=(QCString)" for "+projName; result+=(QCString)" av"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Arvediagram for "+clName+":"; } @@ -620,7 +620,7 @@ class TranslatorNorwegian : public TranslatorAdapter_1_4_6 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -642,7 +642,7 @@ class TranslatorNorwegian : public TranslatorAdapter_1_4_6 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" filreferanse"; @@ -650,7 +650,7 @@ class TranslatorNorwegian : public TranslatorAdapter_1_4_6 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" navneromsreferanse"; @@ -851,12 +851,12 @@ class TranslatorNorwegian : public TranslatorAdapter_1_4_6 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Samarbeidsdiagram for "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Avhengighetsgraf for "+fName+":"; } @@ -1136,7 +1136,7 @@ class TranslatorNorwegian : public TranslatorAdapter_1_4_6 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Package "+name; } @@ -1546,7 +1546,7 @@ class TranslatorNorwegian : public TranslatorAdapter_1_4_6 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" Katalog referanse"; return result; } /*! This returns the word directory with or without starting capital diff --git a/src/translator_pl.h b/src/translator_pl.h index 86bc72b..1a094d6 100644 --- a/src/translator_pl.h +++ b/src/translator_pl.h @@ -121,9 +121,9 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - QCString trGeneratedAutomatically(const char *s) + QCString trGeneratedAutomatically(const QCString &s) { QCString result="Wygenerowano automatycznie z kodu źródłowego programem Doxygen"; - if (s) result+=(QCString)" dla "+s; + if (!s.isEmpty()) result+=(QCString)" dla "+s; result+="."; return result; } @@ -497,16 +497,16 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - QCString trGeneratedAt(const char *date,const char *projName) + QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Wygenerowano "+date; - if (projName) result+=(QCString)" dla "+projName; + if (!projName.isEmpty()) result+=(QCString)" dla "+projName; result+=(QCString)" programem"; return result; } /*! this text is put before a class diagram */ - QCString trClassDiagram(const char *clName) + QCString trClassDiagram(const QCString &clName) { return (QCString)"Diagram dziedziczenia dla "+clName; } @@ -591,7 +591,7 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - QCString trCompoundReference(const char *clName, + QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -613,7 +613,7 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 } /*! used as the title of the HTML page of a file */ - QCString trFileReference(const char *fileName) + QCString trFileReference(const QCString &fileName) { QCString result="Dokumentacja pliku "; result+=fileName; @@ -621,7 +621,7 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 } /*! used as the title of the HTML page of a namespace */ - QCString trNamespaceReference(const char *namespaceName) + QCString trNamespaceReference(const QCString &namespaceName) { QCString result="Dokumentacja przestrzeni nazw "; result+=namespaceName; @@ -823,12 +823,12 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - QCString trCollaborationDiagram(const char *clName) + QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Diagram współpracy dla "+clName+":"; } /*! this text is put before an include dependency graph */ - QCString trInclDepGraph(const char *fName) + QCString trInclDepGraph(const QCString &fName) { return (QCString)"Wykres zależności załączania dla "+fName+":"; } @@ -1110,7 +1110,7 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Pakiet "+name; } @@ -1497,7 +1497,7 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result="Dokumentacja katalogu "; result+=dirName; return result; } /*! This returns the word directory with or without starting capital @@ -1624,7 +1624,7 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1645,7 +1645,7 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result="Dokumentacja modułu "; result+=namespaceName; @@ -1744,7 +1744,7 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return "Relacja "+ QCString(name); } @@ -1781,7 +1781,7 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Plik w "+name; } @@ -1790,7 +1790,7 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Zawiera plik w "+name; } @@ -1835,7 +1835,7 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Wykres zależności katalogu dla ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1862,11 +1862,11 @@ class TranslatorPolish : public TranslatorAdapter_1_8_2 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { QCString result="Dokumentacja wyliczenia "; result+=name; return result; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" dziedziczone z "+what; } /*! Header of the sections with inherited members specific for the diff --git a/src/translator_pt.h b/src/translator_pt.h index 2273c97..223ca53 100644 --- a/src/translator_pt.h +++ b/src/translator_pt.h @@ -27,7 +27,7 @@ * --------------- * History: * 20200112: - * - Updated to 1.9.1; + * - Updated to 1.9.1; * 20190203: * - Slice methods added; * 20180612: @@ -63,7 +63,7 @@ #define TRANSLATOR_PT_H -class TranslatorPortuguese : public Translator +class TranslatorPortuguese : public TranslatorAdapter_1_9_2 { public: @@ -165,9 +165,9 @@ class TranslatorPortuguese : public Translator /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - QCString trGeneratedAutomatically(const char *s) + QCString trGeneratedAutomatically(const QCString &s) { QCString result="Gerado automaticamente por Doxygen"; - if (s) result+=(QCString)" para "+s; + if (!s.isEmpty()) result+=(QCString)" para "+s; result+=" a partir do código fonte."; return result; } @@ -515,16 +515,16 @@ class TranslatorPortuguese : public Translator /*! This is used in the standard footer of each page and indicates when * the page was generated */ - QCString trGeneratedAt(const char *date,const char *projName) + QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Gerado em "+date; - if (projName) result+=(QCString)" para "+projName; + if (!projName.isEmpty()) result+=(QCString)" para "+projName; result+=(QCString)" por"; return result; } /*! this text is put before a class diagram */ - QCString trClassDiagram(const char *clName) + QCString trClassDiagram(const QCString &clName) { return (QCString)"Diagrama de heranças da classe "+clName; } @@ -603,7 +603,7 @@ class TranslatorPortuguese : public Translator ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -625,7 +625,7 @@ class TranslatorPortuguese : public Translator } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result= "Referência ao ficheiro "; result += fileName; @@ -633,7 +633,7 @@ class TranslatorPortuguese : public Translator } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result= "Referência ao namespace "; result += namespaceName; @@ -834,12 +834,12 @@ class TranslatorPortuguese : public Translator ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Diagrama de colaboração para "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Diagrama de dependências de inclusão para "+fName+":"; } @@ -1112,7 +1112,7 @@ class TranslatorPortuguese : public Translator } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Pacote "+name; } @@ -1504,7 +1504,7 @@ class TranslatorPortuguese : public Translator /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result = "Referência do diretório "; result += dirName; @@ -1632,7 +1632,7 @@ class TranslatorPortuguese : public Translator } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1656,7 +1656,7 @@ class TranslatorPortuguese : public Translator return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result = "Referência do Módulo "; result += namespaceName; @@ -1761,7 +1761,7 @@ class TranslatorPortuguese : public Translator /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return "Relação " + QCString(name); } @@ -1798,7 +1798,7 @@ class TranslatorPortuguese : public Translator * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Ficheiro em "+name; } @@ -1807,7 +1807,7 @@ class TranslatorPortuguese : public Translator * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Inclui ficheiro em "+name; } @@ -1856,7 +1856,7 @@ class TranslatorPortuguese : public Translator } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Grafo de dependências do directório ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1887,14 +1887,14 @@ class TranslatorPortuguese : public Translator } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { QCString result = "Referência da enumeração "; return result + name; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" herdados de "+what; } /*! Header of the sections with inherited members specific for the @@ -1975,7 +1975,7 @@ class TranslatorPortuguese : public Translator { return "Grupos de Constantes"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result = "Referência do grupo de constantes "; result += namespaceName; @@ -1983,7 +1983,7 @@ class TranslatorPortuguese : public Translator } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result = "Referência do serviço "; result += sName; @@ -1991,7 +1991,7 @@ class TranslatorPortuguese : public Translator } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result = "Referência do Singleton "; result += sName; @@ -2141,7 +2141,7 @@ class TranslatorPortuguese : public Translator return "Classe"; } } - virtual QCString trCustomReference(const char *name) + virtual QCString trCustomReference(const QCString &name) { return "Referência de " + QCString(name); } /* Slice */ @@ -2241,7 +2241,7 @@ class TranslatorPortuguese : public Translator { return "Exceções"; } - virtual QCString trCompoundReferenceSlice(const char *clName, ClassDef::CompoundType compType, bool isLocal) + virtual QCString trCompoundReferenceSlice(const QCString &clName, ClassDef::CompoundType compType, bool isLocal) { QCString result=(QCString)"Referência "; switch(compType) @@ -2279,11 +2279,11 @@ class TranslatorPortuguese : public Translator ////////////////////////////////////////////////////////////////////////// // new since 1.8.19 ////////////////////////////////////////////////////////////////////////// - + /** VHDL design unit documentation */ virtual QCString trDesignUnitDocumentation() - { - return "Documentação da Unidade de Projeto"; + { + return "Documentação da Unidade de Projeto"; } }; diff --git a/src/translator_ro.h b/src/translator_ro.h index 01765a6..6536009 100644 --- a/src/translator_ro.h +++ b/src/translator_ro.h @@ -142,9 +142,9 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Generat automat de Doxygen"; - if (s) result+=(QCString)" pentru "+s; + if (!s.isEmpty()) result+=(QCString)" pentru "+s; result+=" din codul sursă."; return result; } @@ -516,16 +516,16 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Generat "+date; - if (projName) result+=(QCString)" pentru "+projName; + if (!projName.isEmpty()) result+=(QCString)" pentru "+projName; result+=(QCString)" de către"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Diagrama de relaţii pentru "+clName; } @@ -603,7 +603,7 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -626,7 +626,7 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result="Referinţă la fişierul "; result+=fileName; @@ -634,7 +634,7 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result="Referinţă la Namespace-ul "; result+=namespaceName; @@ -833,12 +833,12 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Diagrama de relaţii pentru "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Graful dependenţelor prin incluziune pentru "+fName+":"; } @@ -1115,7 +1115,7 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Pachet "+name; } @@ -1509,7 +1509,7 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result="Director-referinţă "; result+=dirName; return result; @@ -1639,7 +1639,7 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1660,7 +1660,7 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result="Referinţă la Modulul "; result += namespaceName; @@ -1762,7 +1762,7 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" Relație"; } @@ -1799,7 +1799,7 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Fișierul din "+name; } @@ -1808,7 +1808,7 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Include fișierul din "+name; } @@ -1853,7 +1853,7 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Grafic de dependență a directoarelor pentru ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1883,11 +1883,11 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+" Referință Enum"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" moștenit(e) din "+what; } /*! Header of the sections with inherited members specific for the @@ -1968,21 +1968,21 @@ class TranslatorRomanian : public TranslatorAdapter_1_8_15 { return "Grupuri Constante"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Referință Grup Constant"; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Referință Serviciu"; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Referință Singleton"; diff --git a/src/translator_ru.h b/src/translator_ru.h index 3e3f7dc..6a699d4 100644 --- a/src/translator_ru.h +++ b/src/translator_ru.h @@ -110,9 +110,9 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Автоматически создано Doxygen"; - if (s) result+=QCString(" для ")+s; + if (!s.isEmpty()) result+=QCString(" для ")+s; result+=" из исходного текста."; return result; } @@ -455,17 +455,17 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result="Документация "; - if (projName) result+=QCString("по ")+projName; + if (!projName.isEmpty()) result+=QCString("по ")+projName; result+=QCString(". Последние изменения: ")+date; result+=". Создано системой"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return QCString("Граф наследования:")+clName+":"; } @@ -545,7 +545,7 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -584,13 +584,13 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { return QCString("Файл ")+fileName; } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { return QCString("Пространство имен ")+namespaceName; } @@ -802,12 +802,12 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Граф связей класса "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Граф включаемых заголовочных файлов для "+fName+":"; } @@ -1089,7 +1089,7 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return QCString("Пакет ")+name; } @@ -1459,7 +1459,7 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=QCString("Содержание директории ")+ dirName; return result; } /*! This returns the word directory with or without starting capital @@ -1589,7 +1589,7 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1626,7 +1626,7 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { return QCString("Модуль ") + namespaceName; } @@ -1722,7 +1722,7 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" Связь"; } @@ -1759,7 +1759,7 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Файл в "+name; } @@ -1768,7 +1768,7 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Включает файл в "+name; } @@ -1813,7 +1813,7 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 { return "Авторство"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Директория графа зависимостей ")+name+":"; } /////////////////////////////////////////////////////////////////////// @@ -1841,11 +1841,11 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+" Ссылки на перечисление"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" унаследованные от "+what; } /*! Header of the sections with inherited members specific for the @@ -1926,21 +1926,21 @@ class TranslatorRussian : public TranslatorAdapter_1_8_15 { return "Постоянные группы"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Ссылка на постоянную группу"; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Ссылка на сервис"; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Ссылка на одиночку"; diff --git a/src/translator_sc.h b/src/translator_sc.h index b8b5b42..c5924b8 100644 --- a/src/translator_sc.h +++ b/src/translator_sc.h @@ -145,9 +145,9 @@ class TranslatorSerbianCyrillic : public TranslatorAdapter_1_6_0 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Аутоматски направљено помоћу Doxygen-а"; - if (s) result+=(QCString)" за "+s; + if (!s.isEmpty()) result+=(QCString)" за "+s; result+=" из изворног кода."; return result; } @@ -507,16 +507,16 @@ class TranslatorSerbianCyrillic : public TranslatorAdapter_1_6_0 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Направљено "+date; - if (projName) result+=(QCString)" за "+projName; + if (!projName.isEmpty()) result+=(QCString)" за "+projName; result+=(QCString)" помоћу"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Дијаграм наслеђивања за "+clName+":"; } @@ -595,7 +595,7 @@ class TranslatorSerbianCyrillic : public TranslatorAdapter_1_6_0 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -634,7 +634,7 @@ class TranslatorSerbianCyrillic : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" Референца датотеке"; @@ -642,7 +642,7 @@ class TranslatorSerbianCyrillic : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Референца простора имена"; @@ -839,12 +839,12 @@ class TranslatorSerbianCyrillic : public TranslatorAdapter_1_6_0 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Дијаграм сарадње за "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Дијаграм зависности укључивања за "+fName+":"; } @@ -1125,7 +1125,7 @@ class TranslatorSerbianCyrillic : public TranslatorAdapter_1_6_0 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Пакет "+name; } @@ -1531,7 +1531,7 @@ class TranslatorSerbianCyrillic : public TranslatorAdapter_1_6_0 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" Референца директоријума"; return result; } /*! This returns the word directory with or without starting capital @@ -1658,7 +1658,7 @@ class TranslatorSerbianCyrillic : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1679,7 +1679,7 @@ class TranslatorSerbianCyrillic : public TranslatorAdapter_1_6_0 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Референца модула"; diff --git a/src/translator_si.h b/src/translator_si.h index 5a03a71..c199ef6 100644 --- a/src/translator_si.h +++ b/src/translator_si.h @@ -64,9 +64,9 @@ class TranslatorSlovene : public TranslatorAdapter_1_4_6 { return "Seznam metod razreda "; } QCString trIncludingInheritedMembers() { return ", vključujoč dedovane metode in atribute."; } - QCString trGeneratedAutomatically(const char *s) + QCString trGeneratedAutomatically(const QCString &s) { QCString result="zgenerirano z Doxygen-om"; - if (s) result+=(QCString)" za "+s; + if (!s.isEmpty()) result+=(QCString)" za "+s; result+=" iz izvorne kode."; return result; } @@ -186,14 +186,14 @@ class TranslatorSlovene : public TranslatorAdapter_1_4_6 { return "Opis spremenljivke"; } QCString trCompounds() { return "Strukture"; } - QCString trGeneratedAt(const char *date,const char *projName) + QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Generirano "+date; - if (projName) result+=(QCString)" projekt: "+projName; + if (!projName.isEmpty()) result+=(QCString)" projekt: "+projName; result+=(QCString)" generator: "; return result; } - QCString trClassDiagram(const char *clName) + QCString trClassDiagram(const QCString &clName) { return (QCString)"Diagram razredov za "+clName; } @@ -249,7 +249,7 @@ class TranslatorSlovene : public TranslatorAdapter_1_4_6 // new since 0.49-990425 ////////////////////////////////////////////////////////////////////////// - QCString trCompoundReference(const char *clName, + QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool /*isTemplate*/) // used as the title of the HTML page of a class/struct/union @@ -270,14 +270,14 @@ class TranslatorSlovene : public TranslatorAdapter_1_4_6 return result; } - QCString trFileReference(const char *fileName) + QCString trFileReference(const QCString &fileName) // used as the title of the HTML page of a file { QCString result="Datoteka "; result+=fileName; return result; } - QCString trNamespaceReference(const char *namespaceName) + QCString trNamespaceReference(const QCString &namespaceName) // used as the title of the HTML page of a namespace { QCString result ="Imenski prostor "; @@ -472,12 +472,12 @@ class TranslatorSlovene : public TranslatorAdapter_1_4_6 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - QCString trCollaborationDiagram(const char *clName) + QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Kolaboracijski diagram razreda "+clName+":"; } /*! this text is put before an include dependency graph */ - QCString trInclDepGraph(const char *fName) + QCString trInclDepGraph(const QCString &fName) { return (QCString)"Graf prikazuje seznam datotek, " "ki jih datoteka \""+fName+"\" " @@ -765,7 +765,7 @@ class TranslatorSlovene : public TranslatorAdapter_1_4_6 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"JAVA paket "+name; } @@ -1178,7 +1178,7 @@ class TranslatorSlovene : public TranslatorAdapter_1_4_6 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" imeniške reference"; /* not sure for context */ return result; diff --git a/src/translator_sk.h b/src/translator_sk.h index 1e5d258..1691ff5 100644 --- a/src/translator_sk.h +++ b/src/translator_sk.h @@ -115,10 +115,10 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result("Generované automaticky programom Doxygen " "zo zdrojových textov"); - if (s) + if (!s.isEmpty()) result+=(QCString)" projektu "+s; result+="."; return result; @@ -478,16 +478,16 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Generované "+date; - if (projName) result+=(QCString)" pre projekt "+projName; + if (!projName.isEmpty()) result+=(QCString)" pre projekt "+projName; result+=(QCString)" programom"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Diagram dedičnosti pre triedu "+clName; } @@ -564,7 +564,7 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -586,7 +586,7 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result("Dokumentácia súboru "); result+=fileName; @@ -594,7 +594,7 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result("Dokumentácia priestoru mien "); result+=namespaceName; @@ -806,12 +806,12 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Diagram tried pre "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Graf závislostí na vkladaných súboroch " "pre "+fName+":"; @@ -1090,7 +1090,7 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 return "Triedy"; } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Balík "+name; } @@ -1462,7 +1462,7 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result = "Referencia k adresáru "; result += dirName; @@ -1595,7 +1595,7 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1617,7 +1617,7 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result="Dokumentácia modulu "; result += namespaceName; @@ -1717,7 +1717,7 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return "Relácia " + QCString(name); } @@ -1754,7 +1754,7 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Súbor v "+name; } @@ -1763,7 +1763,7 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Vkladá (include) súbor z "+name; } @@ -1808,7 +1808,7 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Graf závislosti na priečinkoch pre ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1827,7 +1827,7 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 virtual QCString trAndMore(const QCString &number) { QCString result("a " + number + " ďaľší"); - if (atoi(number) >= 5) + if (number.toInt() >= 5) result += "ch"; return result + "..."; } @@ -1843,11 +1843,11 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return "Referencia k enumerácii "+QCString(name); } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" dedí sa z "+what; } /*! Header of the sections with inherited members specific for the @@ -1928,21 +1928,21 @@ class TranslatorSlovak : public TranslatorAdapter_1_8_15 { return "Konštantné skupiny"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result="Konštantné skupiny z "; result += namespaceName; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result="Popis služby "; result += sName; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result="Popis singletonu "; result += sName; diff --git a/src/translator_sr.h b/src/translator_sr.h index cb080ea..e5a6cf7 100644 --- a/src/translator_sr.h +++ b/src/translator_sr.h @@ -128,9 +128,9 @@ class TranslatorSerbian : public TranslatorAdapter_1_6_0 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Napravljeno automatski korišćenjem alata Doxygen"; - if( s ) result+=(QCString)" za projekat " + s; + if (!s.isEmpty()) result+=(QCString)" za projekat " + s; result+=" od izvornog koda."; return result; } @@ -487,16 +487,16 @@ class TranslatorSerbian : public TranslatorAdapter_1_6_0 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"[" + date + "] Napravljeno automatski "; - if ( projName ) result+=(QCString)" za projekat " + projName; + if (!projName.isEmpty()) result+=(QCString)" za projekat " + projName; result+=(QCString)" upotrebom "; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return QCString("Dijagram nasleđivanja za klasu ") + clName + ":"; } @@ -575,7 +575,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_6_0 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -597,7 +597,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result = "Opis datoteke "; result += fileName; @@ -605,7 +605,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result="Opis prostora imena "; result += namespaceName; @@ -802,12 +802,12 @@ class TranslatorSerbian : public TranslatorAdapter_1_6_0 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Klasni dijagram za "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Graf zavisnosti datoteka za "+fName+":"; } @@ -1087,7 +1087,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_6_0 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Paket "+name; } @@ -1480,7 +1480,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_6_0 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+="Opis direktorijuma"; return result; } /*! This returns the word directory with or without starting capital @@ -1608,7 +1608,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1629,7 +1629,7 @@ class TranslatorSerbian : public TranslatorAdapter_1_6_0 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" - sažet pregled modula"; diff --git a/src/translator_sv.h b/src/translator_sv.h index 853e265..4916694 100644 --- a/src/translator_sv.h +++ b/src/translator_sv.h @@ -151,7 +151,7 @@ English: #ifndef TRANSLATOR_SE_H #define TRANSLATOR_SE_H -class TranslatorSwedish : public Translator +class TranslatorSwedish : public TranslatorAdapter_1_9_2 { public: @@ -244,9 +244,9 @@ class TranslatorSwedish : public Translator /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Automatiskt skapad av Doxygen"; - if (s) result+=(QCString)" för "+s; + if (!s.isEmpty()) result+=(QCString)" för "+s; result+=" från källkoden."; return result; } @@ -607,16 +607,16 @@ class TranslatorSwedish : public Translator /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Skapad "+date; - if (projName) result+=(QCString)" för "+projName; + if (!projName.isEmpty()) result+=(QCString)" för "+projName; result+=(QCString)" av"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Klassdiagram för "+clName; } @@ -692,7 +692,7 @@ class TranslatorSwedish : public Translator ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -714,7 +714,7 @@ class TranslatorSwedish : public Translator } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" filreferens"; @@ -722,7 +722,7 @@ class TranslatorSwedish : public Translator } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" namnrymdreferens"; @@ -929,12 +929,12 @@ class TranslatorSwedish : public Translator ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Samarbetsdiagram för "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Include-beroendediagram för "+fName+":"; } @@ -1217,7 +1217,7 @@ class TranslatorSwedish : public Translator } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Paket "+name; } @@ -1599,7 +1599,7 @@ class TranslatorSwedish : public Translator /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" Katalogreferens"; return result; } /*! This returns the word directory with or without starting capital @@ -1728,7 +1728,7 @@ class TranslatorSwedish : public Translator } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1749,7 +1749,7 @@ class TranslatorSwedish : public Translator return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Modulreferens"; @@ -1850,7 +1850,7 @@ class TranslatorSwedish : public Translator ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" Relation"; } @@ -1887,7 +1887,7 @@ class TranslatorSwedish : public Translator * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Fil i "+name; } @@ -1896,7 +1896,7 @@ class TranslatorSwedish : public Translator * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Inkluderar fil i "+name; } @@ -1941,7 +1941,7 @@ class TranslatorSwedish : public Translator { return "Copyright"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Katalogberoendegraf för ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1969,11 +1969,11 @@ class TranslatorSwedish : public Translator } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+" Enum-referens"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" ärvd ifrån "+what; } /*! Header of the sections with inherited members specific for the @@ -2054,21 +2054,21 @@ class TranslatorSwedish : public Translator { return "Konstantgrupper"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Referens till konstantgrupp"; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Tjänstereferens"; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)sName; result+=" Singleton-referens"; @@ -2206,7 +2206,7 @@ class TranslatorSwedish : public Translator return "Klass"; } } - virtual QCString trCustomReference(const char *name) + virtual QCString trCustomReference(const QCString &name) { return QCString(name)+"referens"; } /* Slice */ @@ -2311,7 +2311,7 @@ class TranslatorSwedish : public Translator { return "Undantagsdokumentation"; } - virtual QCString trCompoundReferenceSlice(const char *clName, ClassDef::CompoundType compType, bool isLocal) + virtual QCString trCompoundReferenceSlice(const QCString &clName, ClassDef::CompoundType compType, bool isLocal) { QCString result=(QCString)clName; if (isLocal) result+=" Lokal"; diff --git a/src/translator_tr.h b/src/translator_tr.h index 4a68184..ef8c5a3 100644 --- a/src/translator_tr.h +++ b/src/translator_tr.h @@ -140,9 +140,9 @@ class TranslatorTurkish : public TranslatorAdapter_1_7_5 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Doxygen tarafından"; - if (s) result+=s+(QCString)" için "; + if (!s.isEmpty()) result+=s+(QCString)" için "; result+=" kaynak koddan otomatik üretilmiştir."; return result; } @@ -498,16 +498,16 @@ class TranslatorTurkish : public TranslatorAdapter_1_7_5 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=projName+(QCString)" için "+date; - if (projName) result+=(QCString)" tarihinde "; + if (!projName.isEmpty()) result+=(QCString)" tarihinde "; result+=(QCString)" üreten: "; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return clName+(QCString)" için kalıtım şeması:"; } @@ -586,7 +586,7 @@ class TranslatorTurkish : public TranslatorAdapter_1_7_5 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -608,7 +608,7 @@ class TranslatorTurkish : public TranslatorAdapter_1_7_5 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" Dosya Referansı"; @@ -616,7 +616,7 @@ class TranslatorTurkish : public TranslatorAdapter_1_7_5 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Namespace Referansı"; @@ -814,12 +814,12 @@ class TranslatorTurkish : public TranslatorAdapter_1_7_5 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return clName+(QCString)" için işbirliği (collaboration) şeması:"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return fName+(QCString)" için içerme bağımlılık grafiği:"; } @@ -1099,7 +1099,7 @@ class TranslatorTurkish : public TranslatorAdapter_1_7_5 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Paket "+name; } @@ -1493,7 +1493,7 @@ class TranslatorTurkish : public TranslatorAdapter_1_7_5 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" Dizin Referansı"; return result; } /*! This returns the word directory with or without starting capital @@ -1620,7 +1620,7 @@ class TranslatorTurkish : public TranslatorAdapter_1_7_5 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1641,7 +1641,7 @@ class TranslatorTurkish : public TranslatorAdapter_1_7_5 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Modül Referansı"; @@ -1742,7 +1742,7 @@ class TranslatorTurkish : public TranslatorAdapter_1_7_5 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" İlişkisi"; } @@ -1779,7 +1779,7 @@ class TranslatorTurkish : public TranslatorAdapter_1_7_5 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)(name) + (QCString)" dizinindeki dosya"; } @@ -1788,7 +1788,7 @@ class TranslatorTurkish : public TranslatorAdapter_1_7_5 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)(name) + (QCString)" dizinindeki dosyayı kapsıyor"; } diff --git a/src/translator_tw.h b/src/translator_tw.h index 8d9658b..24ad7ed 100644 --- a/src/translator_tw.h +++ b/src/translator_tw.h @@ -153,9 +153,9 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="本文件由Doxygen"; - if (s) result+=(QCString)" 自 "+s; + if (!s.isEmpty()) result+=(QCString)" 自 "+s; result+=" 的原始碼中自動產生."; return result; } @@ -517,16 +517,16 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"產生日期:"+date; - if (projName) result+=(QCString)", 專案:"+projName; + if (!projName.isEmpty()) result+=(QCString)", 專案:"+projName; result+=(QCString)", 產生器:"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"類別"+clName+"的繼承圖:"; } @@ -605,7 +605,7 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -627,7 +627,7 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" 檔案參考文件"; @@ -635,7 +635,7 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" 命名空間(Namespace)參考文件"; @@ -831,12 +831,12 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)""+clName+"的合作圖:"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)""+fName+"的包含相依圖:"; } @@ -1117,7 +1117,7 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Package "+name; } @@ -1495,7 +1495,7 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" 目錄參考文件"; return result; } /*! This returns the word directory with or without starting capital @@ -1614,7 +1614,7 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1635,7 +1635,7 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+="模組參考文件"; @@ -1730,7 +1730,7 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return QCString(name)+" 關連"; } @@ -1767,7 +1767,7 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"檔案在"+name; } @@ -1776,7 +1776,7 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"含入檔案在"+name; } @@ -1821,7 +1821,7 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 { return "版權聲明"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString(name)+"的目錄關連圖"+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1849,11 +1849,11 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+" 列舉型態參考"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" 繼承自 "+what; } /*! Header of the sections with inherited members specific for the @@ -1934,21 +1934,21 @@ class TranslatorChinesetraditional : public TranslatorAdapter_1_8_15 { return "常數群組"; } /** UNO IDL constant groups */ - virtual QCString trConstantGroupReference(const char *namespaceName) + virtual QCString trConstantGroupReference(const QCString &namespaceName) { QCString result=namespaceName; result+="常數群組參考"; return result; } /** UNO IDL service page title */ - virtual QCString trServiceReference(const char *sName) + virtual QCString trServiceReference(const QCString &sName) { QCString result=(QCString)sName; result+="服務參考"; return result; } /** UNO IDL singleton page title */ - virtual QCString trSingletonReference(const char *sName) + virtual QCString trSingletonReference(const QCString &sName) { QCString result=(QCString)sName; result+="Singleton參考"; diff --git a/src/translator_ua.h b/src/translator_ua.h index e24136c..02f9eab 100644 --- a/src/translator_ua.h +++ b/src/translator_ua.h @@ -106,9 +106,9 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Автоматично створено за допомогою Doxygen"; - if (s) result+=QCString(" для ")+s; + if (!s.isEmpty()) result+=QCString(" для ")+s; result+=" з тексту програми."; return result; } @@ -450,17 +450,17 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result="Документація "; - if (projName) result+=QCString("до ")+projName; + if (!projName.isEmpty()) result+=QCString("до ")+projName; result+=QCString(" створена ")+date; result+=" системою"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return QCString("Схема успадкувань для ")+clName; } @@ -539,7 +539,7 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -578,13 +578,13 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { return QCString("Файл ")+fileName; } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { return QCString("Простір імен ")+namespaceName; } @@ -795,12 +795,12 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Діаграма зв'язків класу "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return QCString("Діаграма включених заголовочних файлів для ")+fName+":"; } @@ -1078,7 +1078,7 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return QCString("Пакет ")+name; } @@ -1455,7 +1455,7 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result="Довідник каталогу "; result+=dirName; return result; } /*! This returns the word directory with or without starting capital @@ -1583,7 +1583,7 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1620,7 +1620,7 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Модуль"; @@ -1722,7 +1722,7 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ - virtual QCString trDirRelation(const char *name) + virtual QCString trDirRelation(const QCString &name) { return "Зв'язок з "+QCString(name); } @@ -1759,7 +1759,7 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ - virtual QCString trFileIn(const char *name) + virtual QCString trFileIn(const QCString &name) { return (QCString)"Файл у "+name; } @@ -1768,7 +1768,7 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 * table is shown. The heading for the second column mentions the * destination file that is included. */ - virtual QCString trIncludesFileIn(const char *name) + virtual QCString trIncludesFileIn(const QCString &name) { return (QCString)"Включає файли в "+name; } @@ -1813,7 +1813,7 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 { return "Копірайт"; } /*! Header for the graph showing the directory dependencies */ - virtual QCString trDirDepGraph(const char *name) + virtual QCString trDirDepGraph(const QCString &name) { return QCString("Граф залежностей каталогу для ")+name+":"; } ////////////////////////////////////////////////////////////////////////// @@ -1841,11 +1841,11 @@ class TranslatorUkrainian : public TranslatorAdapter_1_8_4 } /*! Header of a Java enum page (Java enums are represented as classes). */ - virtual QCString trEnumReference(const char *name) + virtual QCString trEnumReference(const QCString &name) { return QCString(name)+" Перелік"; } /*! Used for a section containing inherited members */ - virtual QCString trInheritedFrom(const char *members,const char *what) + virtual QCString trInheritedFrom(const QCString &members,const QCString &what) { return QCString(members)+" успадковано з "+what; } /*! Header of the sections with inherited members specific for the diff --git a/src/translator_vi.h b/src/translator_vi.h index 272dedd..a36dee4 100644 --- a/src/translator_vi.h +++ b/src/translator_vi.h @@ -161,9 +161,9 @@ class TranslatorVietnamese : public TranslatorAdapter_1_6_0 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Được tạo ra bởi Doxygen"; - if (s) result+=(QCString)" cho "+s; + if (!s.isEmpty()) result+=(QCString)" cho "+s; result+=" từ mã nguồn."; return result; } @@ -523,16 +523,16 @@ class TranslatorVietnamese : public TranslatorAdapter_1_6_0 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Được biên soạn vào "+date; - if (projName) result+=(QCString)" cho mã nguồn dự án "+projName; + if (!projName.isEmpty()) result+=(QCString)" cho mã nguồn dự án "+projName; result+=(QCString)" bởi"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Sơ đồ kế thừa cho "+clName+":"; } @@ -611,7 +611,7 @@ class TranslatorVietnamese : public TranslatorAdapter_1_6_0 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -633,7 +633,7 @@ class TranslatorVietnamese : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" File Tham chiếu"; @@ -641,7 +641,7 @@ class TranslatorVietnamese : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Namespace Tham chiếu"; @@ -837,12 +837,12 @@ class TranslatorVietnamese : public TranslatorAdapter_1_6_0 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Sơ đồ liên kết cho "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Kèm theo graph phụ thuộc cho "+fName+":"; } @@ -1122,7 +1122,7 @@ class TranslatorVietnamese : public TranslatorAdapter_1_6_0 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Gói "+name; } @@ -1516,7 +1516,7 @@ class TranslatorVietnamese : public TranslatorAdapter_1_6_0 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" Tham chiếu thư mục"; return result; } /*! This returns the word directory with or without starting capital @@ -1643,7 +1643,7 @@ class TranslatorVietnamese : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1664,7 +1664,7 @@ class TranslatorVietnamese : public TranslatorAdapter_1_6_0 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Tham chiếu Module"; diff --git a/src/translator_za.h b/src/translator_za.h index 8fc847e..362adfb 100644 --- a/src/translator_za.h +++ b/src/translator_za.h @@ -126,9 +126,9 @@ class TranslatorAfrikaans : public TranslatorAdapter_1_6_0 /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ - virtual QCString trGeneratedAutomatically(const char *s) + virtual QCString trGeneratedAutomatically(const QCString &s) { QCString result="Automaties gegenereer deur Doxygen"; - if (s) result+=(QCString)" vir "+s; + if (!s.isEmpty()) result+=(QCString)" vir "+s; result+=" van die bron kode af."; return result; } @@ -486,16 +486,16 @@ class TranslatorAfrikaans : public TranslatorAdapter_1_6_0 /*! This is used in the standard footer of each page and indicates when * the page was generated */ - virtual QCString trGeneratedAt(const char *date,const char *projName) + virtual QCString trGeneratedAt(const QCString &date,const QCString &projName) { QCString result=(QCString)"Gegenereer op "+date; - if (projName) result+=(QCString)" vir "+projName; + if (!projName.isEmpty()) result+=(QCString)" vir "+projName; result+=(QCString)" deur"; return result; } /*! this text is put before a class diagram */ - virtual QCString trClassDiagram(const char *clName) + virtual QCString trClassDiagram(const QCString &clName) { return (QCString)"Afleidings diagram vir "+clName+":"; } @@ -574,7 +574,7 @@ class TranslatorAfrikaans : public TranslatorAdapter_1_6_0 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ - virtual QCString trCompoundReference(const char *clName, + virtual QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -596,7 +596,7 @@ class TranslatorAfrikaans : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a file */ - virtual QCString trFileReference(const char *fileName) + virtual QCString trFileReference(const QCString &fileName) { QCString result=fileName; result+=" Leër Verwysing"; @@ -604,7 +604,7 @@ class TranslatorAfrikaans : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a namespace */ - virtual QCString trNamespaceReference(const char *namespaceName) + virtual QCString trNamespaceReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Namespace Verwysing"; @@ -801,12 +801,12 @@ class TranslatorAfrikaans : public TranslatorAdapter_1_6_0 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ - virtual QCString trCollaborationDiagram(const char *clName) + virtual QCString trCollaborationDiagram(const QCString &clName) { return (QCString)"Samewerkings diagram vir "+clName+":"; } /*! this text is put before an include dependency graph */ - virtual QCString trInclDepGraph(const char *fName) + virtual QCString trInclDepGraph(const QCString &fName) { return (QCString)"Insluitings afhanklikheid diagram vir "+fName+":"; } @@ -1087,7 +1087,7 @@ class TranslatorAfrikaans : public TranslatorAdapter_1_6_0 } } /*! Used as the title of a Java package */ - virtual QCString trPackage(const char *name) + virtual QCString trPackage(const QCString &name) { return (QCString)"Pakket "+name; } @@ -1481,7 +1481,7 @@ class TranslatorAfrikaans : public TranslatorAdapter_1_6_0 /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ - virtual QCString trDirReference(const char *dirName) + virtual QCString trDirReference(const QCString &dirName) { QCString result=dirName; result+=" Directory Verwysing"; return result; } /*! This returns the word directory with or without starting capital @@ -1609,7 +1609,7 @@ class TranslatorAfrikaans : public TranslatorAdapter_1_6_0 } /*! used as the title of the HTML page of a module/type (Fortran) */ - virtual QCString trCompoundReferenceFortran(const char *clName, + virtual QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) { @@ -1630,7 +1630,7 @@ class TranslatorAfrikaans : public TranslatorAdapter_1_6_0 return result; } /*! used as the title of the HTML page of a module (Fortran) */ - virtual QCString trModuleReference(const char *namespaceName) + virtual QCString trModuleReference(const QCString &namespaceName) { QCString result=namespaceName; result+=" Module Bron"; diff --git a/src/types.h b/src/types.h index b629501..a3b7de1 100644 --- a/src/types.h +++ b/src/types.h @@ -91,7 +91,7 @@ struct Grouping return "???"; } - Grouping( const char *gn, GroupPri_t p ) : groupname(gn), pri(p) {} + Grouping( const QCString &gn, GroupPri_t p ) : groupname(gn), pri(p) {} QCString groupname; //!< name of the group GroupPri_t pri; //!< priority of this definition diff --git a/src/utf8.cpp b/src/utf8.cpp index ea7ee34..e7108f4 100644 --- a/src/utf8.cpp +++ b/src/utf8.cpp @@ -13,14 +13,16 @@ * */ +#include <cstdint> #include <sstream> #include "utf8.h" #include "caseconvert.h" +#include "textstream.h" -int getUTF8CharNumBytes(char c) +uint8_t getUTF8CharNumBytes(char c) { - int num=1; + uint8_t num=1; unsigned char uc = static_cast<unsigned char>(c); if (uc>=0x80u) // multibyte character { @@ -64,7 +66,7 @@ static inline uint32_t decode_utf8( const char* data , int numBytes ) noexcept return cp; } -static inline uint32_t convertUTF8CharToUnicode(const char *s,size_t bytesLeft,size_t &len) +static inline uint32_t convertUTF8CharToUnicode(const char *s,size_t bytesLeft,int &len) { if (s==0 || bytesLeft==0) { @@ -72,6 +74,11 @@ static inline uint32_t convertUTF8CharToUnicode(const char *s,size_t bytesLeft,s return 0; } unsigned char uc = static_cast<unsigned char>(*s); + if (uc<128) // ASCII case + { + len=1; + return uc; + } switch (bytesLeft) { default: @@ -115,8 +122,6 @@ static inline uint32_t convertUTF8CharToUnicode(const char *s,size_t bytesLeft,s return uc; } } - len=0; - return 0; } std::string getUTF8CharAt(const std::string &input,size_t pos) @@ -130,50 +135,70 @@ std::string getUTF8CharAt(const std::string &input,size_t pos) uint32_t getUnicodeForUTF8CharAt(const std::string &input,size_t pos) { std::string charS = getUTF8CharAt(input,pos); - size_t len; + int len; return convertUTF8CharToUnicode(charS.c_str(),charS.length(),len); } +static inline char asciiToLower(uint32_t code) +{ + return code>='A' && code<='Z' ? (char)(code+'a'-'A') : (char)code; +} + +static inline char asciiToUpper(uint32_t code) +{ + return code>='a' && code<='z' ? (char)(code+'A'-'a') : (char)code; +} + static inline std::string caseConvert(const std::string &input, + char (*asciiConversionFunc)(uint32_t code), const char *(*conversionFunc)(uint32_t code)) { uint32_t code; - std::ostringstream result(std::ios_base::ate); - size_t len; + std::string result; + result.reserve(input.length()); // assume all ASCII characters + int len; size_t bytesLeft = input.length(); const char *p = input.c_str(); while ((code=convertUTF8CharToUnicode(p,bytesLeft,len))) { - const char *conv = conversionFunc(code); - if (conv==nullptr) // no difference between lower and upper case + if (code<128) // ASCII case { - result << std::string(p,len); + char c = asciiConversionFunc(code); + result+=c; } - else // replace the input character with the conversion result + else // generic case { - result << conv; + const char *conv = conversionFunc(code); + if (conv==nullptr) // no difference between lower and upper case + { + result.append(p,len); + } + else // replace the input character with the conversion result + { + result.append(conv); + } } p+=len; bytesLeft-=len; } - return result.str(); + return result; } std::string convertUTF8ToLower(const std::string &input) { - return caseConvert(input,convertUnicodeToLower); + return caseConvert(input,asciiToLower,convertUnicodeToLower); } std::string convertUTF8ToUpper(const std::string &input) { - return caseConvert(input,convertUnicodeToUpper); + return caseConvert(input,asciiToUpper,convertUnicodeToUpper); } -const char *writeUTF8Char(std::ostream &t,const char *s) +const char *writeUTF8Char(TextStream &t,const char *s) { if (s==0) return 0; - int len = getUTF8CharNumBytes(*s); - for (int i=0;i<len;i++) + uint8_t len = getUTF8CharNumBytes(*s); + for (uint8_t i=0;i<len;i++) { if (s[i]==0) // detect premature end of string (due to invalid UTF8 char) { @@ -193,7 +218,7 @@ bool lastUTF8CharIsMultibyte(const std::string &input) bool isUTF8CharUpperCase(const std::string &input,size_t pos) { if (input.length()<=pos) return false; - size_t len; + int len; // turn the UTF8 character at position pos into a unicode value uint32_t code = convertUTF8CharToUnicode(input.c_str()+pos,input.length()-pos,len); // check if the character can be converted to lower case, if so it was an upper case character @@ -18,7 +18,8 @@ #include <cstdint> #include <string> -#include <iostream> + +class TextStream; /** @file * @brief Various UTF8 related helper functions. @@ -50,12 +51,12 @@ uint32_t getUnicodeForUTF8CharAt(const std::string &input,size_t pos); /** Returns the number of bytes making up a single UTF8 character given the first byte * in the sequence. */ -int getUTF8CharNumBytes(char firstByte); +uint8_t getUTF8CharNumBytes(char firstByte); /** Writes the UTF8 character pointed to by s to stream t and returns a pointer * to the next character. */ -const char *writeUTF8Char(std::ostream &t,const char *s); +const char *writeUTF8Char(TextStream &t,const char *s); /** Returns true iff the last character in input is a multibyte character. */ bool lastUTF8CharIsMultibyte(const std::string &input); diff --git a/src/util.cpp b/src/util.cpp index 0e73bd3..75e82f0 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -19,11 +19,11 @@ #include <math.h> #include <limits.h> #include <string.h> +#include <assert.h> #include <mutex> #include <unordered_set> #include <codecvt> -#include <iostream> #include <algorithm> #include <ctime> #include <cctype> @@ -72,6 +72,7 @@ #include "fileinfo.h" #include "dir.h" #include "utf8.h" +#include "textstream.h" #define ENABLE_TRACINGSUPPORT 0 @@ -99,13 +100,13 @@ TextGeneratorOLImpl::TextGeneratorOLImpl(OutputDocInterface &od) : m_od(od) { } -void TextGeneratorOLImpl::writeString(const char *s,bool keepSpaces) const +void TextGeneratorOLImpl::writeString(const QCString &s,bool keepSpaces) const { - if (s==0) return; + if (s.isEmpty()) return; //printf("TextGeneratorOlImpl::writeString('%s',%d)\n",s,keepSpaces); if (keepSpaces) { - const char *p=s; + const char *p=s.data(); if (p) { char cs[2]; @@ -134,8 +135,8 @@ void TextGeneratorOLImpl::writeBreak(int indent) const } } -void TextGeneratorOLImpl::writeLink(const char *extRef,const char *file, - const char *anchor,const char *text +void TextGeneratorOLImpl::writeLink(const QCString &extRef,const QCString &file, + const QCString &anchor,const QCString &text ) const { //printf("TextGeneratorOlImpl::writeLink('%s')\n",text); @@ -162,10 +163,10 @@ const int maxInheritanceDepth = 100000; "bla @1" => "bla" \endverbatim */ -QCString removeAnonymousScopes(const char *str) +QCString removeAnonymousScopes(const QCString &str) { std::string result; - if (str==0) return result; + if (str.isEmpty()) return result; // helper to check if the found delimiter starts with a colon auto startsWithColon = [](const std::string &del) @@ -190,7 +191,7 @@ QCString removeAnonymousScopes(const char *str) }; static const reg::Ex re(R"([\s:]*@\d+[\s:]*)"); - std::string s = str; + std::string s = str.str(); reg::Iterator iter(s,re); reg::Iterator end; size_t p=0; @@ -219,12 +220,13 @@ QCString removeAnonymousScopes(const char *str) } // replace anonymous scopes with __anonymous__ or replacement if provided -QCString replaceAnonymousScopes(const char *s,const char *replacement) +QCString replaceAnonymousScopes(const QCString &s,const QCString &replacement) { - if (s==0) return QCString(); + if (s.isEmpty()) return s; static const reg::Ex marker(R"(@\d+)"); - std::string result = reg::replace(s,marker,replacement?replacement:"__anonymous__"); - //printf("replaceAnonymousScopes('%s')='%s'\n",s.data(),result.data()); + std::string result = reg::replace(s.str(),marker, + replacement.isEmpty() ? replacement.data() : "__anonymous__"); + //printf("replaceAnonymousScopes('%s')='%s'\n",qPrint(s),qPrint(result)); return result; } @@ -237,7 +239,7 @@ QCString stripAnonymousNamespaceScope(const QCString &s) int sl = s.length(); while ((i=getScopeFragment(s,p,&l))!=-1) { - //printf("Scope fragment %s\n",s.mid(i,l).data()); + //printf("Scope fragment %s\n",qPrint(s.mid(i,l))); if (Doxygen::namespaceLinkedMap->find(s.left(i+l))!=0) { if (s.at(i)!='@') @@ -255,11 +257,11 @@ QCString stripAnonymousNamespaceScope(const QCString &s) p=i+l; } done: - //printf("stripAnonymousNamespaceScope('%s')='%s'\n",s.data(),newScope.data()); + //printf("stripAnonymousNamespaceScope('%s')='%s'\n",qPrint(s),qPrint(newScope)); return newScope; } -void writePageRef(OutputDocInterface &od,const char *cn,const char *mn) +void writePageRef(OutputDocInterface &od,const QCString &cn,const QCString &mn) { od.pushGeneratorState(); @@ -326,9 +328,9 @@ QCString stripFromIncludePath(const QCString &path) * at the extension. A number of variations is allowed in both upper and * lower case) If anyone knows or uses another extension please let me know :-) */ -int guessSection(const char *name) +int guessSection(const QCString &name) { - QCString n=((QCString)name).lower(); + QCString n=name.lower(); if (n.right(2)==".c" || // source n.right(3)==".cc" || n.right(4)==".cxx" || @@ -363,7 +365,7 @@ QCString resolveTypeDef(const Definition *context,const QCString &qualifiedName, const Definition **typedefContext) { //printf("<<resolveTypeDef(%s,%s)\n", - // context ? context->name().data() : "<none>",qualifiedName.data()); + // context ? qPrint(context->name()) : "<none>",qPrint(qualifiedName)); QCString result; if (qualifiedName.isEmpty()) { @@ -396,7 +398,7 @@ QCString resolveTypeDef(const Definition *context,const QCString &qualifiedName, { // split-off scope part QCString resScopeName = qualifiedName.left(scopeIndex); - //printf("resScopeName='%s'\n",resScopeName.data()); + //printf("resScopeName='%s'\n",qPrint(resScopeName)); // look-up scope in context int is,ps=0; @@ -407,18 +409,18 @@ QCString resolveTypeDef(const Definition *context,const QCString &qualifiedName, QCString tmp = resolveTypeDef(mContext,qualScopePart); if (!tmp.isEmpty()) qualScopePart=tmp; resScope = resScope->findInnerCompound(qualScopePart); - //printf("qualScopePart='%s' resScope=%p\n",qualScopePart.data(),resScope); + //printf("qualScopePart='%s' resScope=%p\n",qPrint(qualScopePart),resScope); if (resScope==0) break; ps=is+l; } } - //printf("resScope=%s\n",resScope?resScope->name().data():"<none>"); + //printf("resScope=%s\n",resScope? qPrint(resScope->name()) : "<none>"); // step 2: get the member if (resScope) // no scope or scope found in the current context { //printf("scope found: %s, look for typedef %s\n", - // resScope->qualifiedName().data(),resName.data()); + // qPrint(resScope->qualifiedName()),qPrint(resName)); MemberNameLinkedMap *mnd=0; if (resScope->definitionType()==Definition::TypeClass) { @@ -436,8 +438,8 @@ QCString resolveTypeDef(const Definition *context,const QCString &qualifiedName, { const MemberDef *tmd = tmd_p.get(); //printf("Found member %s resScope=%s outerScope=%s mContext=%p\n", - // tmd->name().data(), resScope->name().data(), - // tmd->getOuterScope()->name().data(), mContext); + // qPrint(tmd->name()),qPrint( resScope->name()), + // qPrint(tmd->getOuterScope()->name()), mContext); if (tmd->isTypedef() /*&& tmd->getOuterScope()==resScope*/) { SymbolResolver resolver; @@ -458,7 +460,7 @@ QCString resolveTypeDef(const Definition *context,const QCString &qualifiedName, if (md) { //printf(">>resolveTypeDef: Found typedef name '%s' in scope '%s' value='%s' args='%s'\n", - // qualifiedName.data(),context->name().data(),md->typeString(),md->argsString() + // qPrint(qualifiedName),qPrint(context->name()),md->typeString(),md->argsString() // ); result=md->typeString(); QCString args = md->argsString(); @@ -475,7 +477,7 @@ QCString resolveTypeDef(const Definition *context,const QCString &qualifiedName, else { //printf(">>resolveTypeDef: Typedef '%s' not found in scope '%s'!\n", - // qualifiedName.data(),context ? context->name().data() : "<global>"); + // qPrint(qualifiedName),context ? qPrint(context->name()) : "<global>"); } return result; @@ -485,16 +487,36 @@ QCString resolveTypeDef(const Definition *context,const QCString &qualifiedName, /*! Get a class definition given its name. * Returns 0 if the class is not found. */ -ClassDef *getClass(const char *n) +ClassDef *getClass(const QCString &n) { - if (n==0 || n[0]=='\0') return 0; + if (n.isEmpty()) return 0; return Doxygen::classLinkedMap->find(n); } -NamespaceDef *getResolvedNamespace(const char *name) + +ConceptDef *getConcept(const QCString &n) { - if (name==0 || name[0]=='\0') return 0; - auto it = Doxygen::namespaceAliasMap.find(name); + if (n.isEmpty()) return 0; + return Doxygen::conceptLinkedMap->find(n); +} + +ConceptDef *getResolvedConcept(const Definition *d,const QCString &name) +{ + ConceptDef *cd=0; + while (d && d!=Doxygen::globalScope) + { + cd = getConcept(d->name()+"::"+name); + if (cd) return cd; + d = d->getOuterScope(); + } + cd = getConcept(name); + return cd; +} + +NamespaceDef *getResolvedNamespace(const QCString &name) +{ + if (name.isEmpty()) return 0; + auto it = Doxygen::namespaceAliasMap.find(name.str()); if (it!=Doxygen::namespaceAliasMap.end()) { int count=0; // recursion detection guard @@ -507,9 +529,9 @@ NamespaceDef *getResolvedNamespace(const char *name) } if (count==10) { - warn_uncond("possible recursive namespace alias detected for %s!\n",name); + warn_uncond("possible recursive namespace alias detected for %s!\n",qPrint(name)); } - return Doxygen::namespaceLinkedMap->find(it->second.data()); + return Doxygen::namespaceLinkedMap->find(it->second); } else { @@ -593,7 +615,7 @@ QCString removeRedundantWhiteSpace(const QCString &s) } if (growBuf==0) return s; // should not happen, only we run out of memory - char *src=s.rawData(); + const char *src=s.data(); char *dst=growBuf; uint i=0; @@ -810,7 +832,7 @@ QCString removeRedundantWhiteSpace(const QCString &s) pc=c; } *dst++='\0'; - //printf("removeRedundantWhitespace(%s)->%s\n",s.data(),growBuf); + //printf("removeRedundantWhitespace(%s)->%s\n",qPrint(s),growBuf); return growBuf; } @@ -888,12 +910,12 @@ bool leftScopeMatch(const QCString &scope, const QCString &name) void linkifyText(const TextGeneratorIntf &out, const Definition *scope, const FileDef *fileScope,const Definition *self, - const char *text, bool autoBreak,bool external, + const QCString &text, bool autoBreak,bool external, bool keepSpaces,int indentLevel) { - if (text==0) return; + if (text.isEmpty()) return; //printf("linkify='%s'\n",text); - std::string txtStr=text; + std::string txtStr=text.str(); size_t strLen = txtStr.length(); if (strLen==0) return; @@ -902,9 +924,9 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, reg::Iterator end; //printf("linkifyText scope=%s fileScope=%s strtxt=%s strlen=%d external=%d\n", - // scope?scope->name().data():"<none>", - // fileScope?fileScope->name().data():"<none>", - // txtStr.data(),strLen,external); + // scope ? qPrint(scope->name()):"<none>", + // fileScope ? qPrint(fileScope->name()) : "<none>", + // qPrint(txtStr),strLen,external); size_t index=0; size_t skipIndex=0; size_t floatingIndex=0; @@ -939,7 +961,7 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, if (i==std::string::npos) { i=splitText.find('<'); if (i!=std::string::npos) offset=0; } if (i==std::string::npos) i=splitText.find('>'); if (i==std::string::npos) i=splitText.find(' '); - //printf("splitText=[%s] len=%d i=%d offset=%d\n",splitText.data(),splitLength,i,offset); + //printf("splitText=[%s] len=%d i=%d offset=%d\n",qPrint(splitText),splitLength,i,offset); if (i!=std::string::npos) // add a link-break at i in case of Html output { std::string part1 = splitText.substr(0,i+offset); @@ -962,9 +984,9 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, } // get word from string std::string word=txtStr.substr(newIndex,matchLen); - QCString matchWord = substitute(substitute(word,"\\","::"),".","::"); + QCString matchWord = substitute(substitute(QCString(word),"\\","::"),".","::"); //printf("linkifyText word=%s matchWord=%s scope=%s\n", - // word.data(),matchWord.data(),scope?scope->name().data():"<none>"); + // qPrint(word),qPrint(matchWord),scope ? qPrint(scope->name()) : "<none>"); bool found=FALSE; if (!insideString) { @@ -973,14 +995,15 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, const FileDef *fd=0; const NamespaceDef *nd=0; const GroupDef *gd=0; - //printf("** Match word '%s'\n",matchWord.data()); + const ConceptDef *cnd=0; + //printf("** Match word '%s'\n",qPrint(matchWord)); SymbolResolver resolver(fileScope); cd=resolver.resolveClass(scope,matchWord); const MemberDef *typeDef = resolver.getTypedef(); if (typeDef) // First look at typedef then class, see bug 584184. { - //printf("Found typedef %s\n",typeDef->name().data()); + //printf("Found typedef %s\n",qPrint(typeDef->name())); if (external ? typeDef->isLinkable() : typeDef->isLinkableInProject()) { if (typeDef->getOuterScope()!=self) @@ -995,7 +1018,7 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, } if (!found && (cd || (cd=getClass(matchWord)))) { - //printf("Found class %s\n",cd->name().data()); + //printf("Found class %s\n",qPrint(cd->name())); // add link to the result if (external ? cd->isLinkable() : cd->isLinkableInProject()) { @@ -1018,18 +1041,18 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, } } } -// else if ((cd=getClass(matchWord+"-g"))) // C# generic as well -// { -// // add link to the result -// if (external ? cd->isLinkable() : cd->isLinkableInProject()) -// { -// if (cd!=self) -// { -// out.writeLink(cd->getReference(),cd->getOutputFileBase(),cd->anchor(),word); -// found=TRUE; -// } -// } -// } + else if ((cnd=getConcept(matchWord))) + { + // add link to the result + if (external ? cnd->isLinkable() : cnd->isLinkableInProject()) + { + if (cnd!=self) + { + out.writeLink(cnd->getReference(),cnd->getOutputFileBase(),cnd->anchor(),word.c_str()); + found=TRUE; + } + } + } else { //printf(" -> nothing\n"); @@ -1051,17 +1074,17 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, matchWord = matchWord.mid(m+2); } - //printf("ScopeName=%s\n",scopeName.data()); - //if (!found) printf("Trying to link %s in %s\n",word.data(),scopeName.data()); + //printf("ScopeName=%s\n",qPrint(scopeName)); + //if (!found) printf("Trying to link %s in %s\n",qPrint(word),qPrint(scopeName)); if (!found && - getDefs(scopeName,matchWord,0,md,cd,fd,nd,gd) && + getDefs(scopeName,matchWord,QCString(),md,cd,fd,nd,gd) && //(md->isTypedef() || md->isEnumerate() || // md->isReference() || md->isVariable() //) && (external ? md->isLinkable() : md->isLinkableInProject()) ) { - //printf("Found ref scope=%s\n",d?d->name().data():"<global>"); + //printf("Found ref scope=%s\n",d ? qPrint(d->name()) : "<global>"); //ol.writeObjectLink(d->getReference(),d->getOutputFileBase(), // md->anchor(),word); if (md!=self && (self==0 || md->name()!=self->name())) @@ -1074,7 +1097,7 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, { out.writeLink(md->getReference(),md->getOutputFileBase(), md->anchor(),word.c_str()); - //printf("found symbol %s\n",matchWord.data()); + //printf("found symbol %s\n",qPrint(matchWord)); found=TRUE; } } @@ -1129,8 +1152,8 @@ void writeExamples(OutputList &ol,const ExampleList &list) ol.disable(OutputGenerator::RTF); ol.disable(OutputGenerator::Docbook); // link for Html / man - //printf("writeObjectLink(file=%s)\n",e->file.data()); - ol.writeObjectLink(0,e.file,e.anchor,e.name); + //printf("writeObjectLink(file=%s)\n",qPrint(e->file)); + ol.writeObjectLink(QCString(),e.file,e.anchor,e.name); ol.popGeneratorState(); ol.pushGeneratorState(); @@ -1138,7 +1161,7 @@ void writeExamples(OutputList &ol,const ExampleList &list) ol.disable(OutputGenerator::Html); // link for Latex / pdf with anchor because the sources // are not hyperlinked (not possible with a verbatim environment). - ol.writeObjectLink(0,e.file,0,e.name); + ol.writeObjectLink(QCString(),e.file,QCString(),e.name); ol.popGeneratorState(); }; @@ -1281,7 +1304,7 @@ int filterCRLF(char *buf,int len) return dest; // length of the valid part of the buf } -static QCString getFilterFromList(const char *name,const StringVector &filterList,bool &found) +static QCString getFilterFromList(const QCString &name,const StringVector &filterList,bool &found) { found=FALSE; // compare the file name to the filter pattern list @@ -1322,10 +1345,10 @@ static QCString getFilterFromList(const char *name,const StringVector &filterLis * In case \a inSourceCode is TRUE then first the source filter list is * considered. */ -QCString getFileFilter(const char* name,bool isSourceCode) +QCString getFileFilter(const QCString &name,bool isSourceCode) { // sanity check - if (name==0) return ""; + if (name.isEmpty()) return ""; const StringVector& filterSrcList = Config_getList(FILTER_SOURCE_PATTERNS); const StringVector& filterList = Config_getList(FILTER_PATTERNS); @@ -1366,30 +1389,30 @@ QCString transcodeCharacterStringToUTF8(const QCString &input) int inputSize=input.length(); int outputSize=inputSize*4+1; QCString output(outputSize); - void *cd = portable_iconv_open(outputEncoding,inputEncoding); + void *cd = portable_iconv_open(outputEncoding,inputEncoding.data()); if (cd==(void *)(-1)) { err("unsupported character conversion: '%s'->'%s'\n", - inputEncoding.data(),outputEncoding); + qPrint(inputEncoding),outputEncoding); error=TRUE; } if (!error) { size_t iLeft=inputSize; size_t oLeft=outputSize; - char *inputPtr = input.rawData(); + const char *inputPtr = input.data(); char *outputPtr = output.rawData(); if (!portable_iconv(cd, &inputPtr, &iLeft, &outputPtr, &oLeft)) { outputSize-=(int)oLeft; output.resize(outputSize+1); output.at(outputSize)='\0'; - //printf("iconv: input size=%d output size=%d\n[%s]\n",size,newSize,srcBuf.data()); + //printf("iconv: input size=%d output size=%d\n[%s]\n",size,newSize,qPrint(srcBuf)); } else { err("failed to translate characters from %s to %s: check INPUT_ENCODING\ninput=[%s]\n", - inputEncoding.data(),outputEncoding,input.data()); + qPrint(inputEncoding),outputEncoding,qPrint(input)); error=TRUE; } } @@ -1401,9 +1424,9 @@ QCString transcodeCharacterStringToUTF8(const QCString &input) * is TRUE the file will be filtered by any user specified input filter. * If \a name is "-" the string will be read from standard input. */ -QCString fileToString(const char *name,bool filter,bool isSourceCode) +QCString fileToString(const QCString &name,bool filter,bool isSourceCode) { - if (name==0 || name[0]==0) return 0; + if (name.isEmpty()) return QCString(); bool fileOpened=false; if (name[0]=='-' && name[1]==0) // read from stdin { @@ -1418,10 +1441,10 @@ QCString fileToString(const char *name,bool filter,bool isSourceCode) } else // read from file { - FileInfo fi(name); + FileInfo fi(name.str()); if (!fi.exists() || !fi.isFile()) { - err("file '%s' not found\n",name); + err("file '%s' not found\n",qPrint(name)); return ""; } BufStr buf((uint)fi.size()); @@ -1439,7 +1462,7 @@ QCString fileToString(const char *name,bool filter,bool isSourceCode) } if (!fileOpened) { - err("cannot open file '%s' for reading\n",name); + err("cannot open file '%s' for reading\n",qPrint(name)); } return ""; } @@ -1457,7 +1480,7 @@ static std::tm getCurrentDateTime() if (!warnedOnce) { warn_uncond("Environment variable SOURCE_DATE_EPOCH does not contain a valid number; value is '%s'\n", - sourceDateEpoch.data()); + qPrint(sourceDateEpoch)); warnedOnce=TRUE; } } @@ -1511,7 +1534,7 @@ int minClassDistance(const ClassDef *cd,const ClassDef *bcd,int level) if (level==256) { warn_uncond("class %s seem to have a recursive " - "inheritance relation!\n",cd->name().data()); + "inheritance relation!\n",qPrint(cd->name())); return -1; } int m=maxInheritanceDepth; @@ -1538,7 +1561,7 @@ Protection classInheritedProtectionLevel(const ClassDef *cd,const ClassDef *bcd, if (level==256) { err("Internal inconsistency: found class %s seem to have a recursive " - "inheritance relation! Please send a bug report to doxygen@gmail.com\n",cd->name().data()); + "inheritance relation! Please send a bug report to doxygen@gmail.com\n",qPrint(cd->name())); } else if (prot!=Private) { @@ -1550,17 +1573,17 @@ Protection classInheritedProtectionLevel(const ClassDef *cd,const ClassDef *bcd, } } exit: - //printf("classInheritedProtectionLevel(%s,%s)=%d\n",cd->name().data(),bcd->name().data(),prot); + //printf("classInheritedProtectionLevel(%s,%s)=%d\n",qPrint(cd->name()),qPrint(bcd->name()),prot); return prot; } void trimBaseClassScope(const BaseClassList &bcl,QCString &s,int level=0) { - //printf("trimBaseClassScope level=%d '%s'\n",level,s.data()); + //printf("trimBaseClassScope level=%d '%s'\n",level,qPrint(s)); for (const auto &bcd : bcl) { ClassDef *cd=bcd.classDef; - //printf("Trying class %s\n",cd->name().data()); + //printf("Trying class %s\n",qPrint(cd->name())); int spos=s.find(cd->name()+"::"); if (spos!=-1) { @@ -1568,7 +1591,7 @@ void trimBaseClassScope(const BaseClassList &bcl,QCString &s,int level=0) s.length()-spos-cd->name().length()-2 ); } - //printf("base class '%s'\n",cd->name().data()); + //printf("base class '%s'\n",qPrint(cd->name())); if (!cd->baseClasses().empty()) { trimBaseClassScope(cd->baseClasses(),s,level+1); @@ -1629,11 +1652,11 @@ static void stripIrrelevantString(QCString &target,const QCString &str) */ void stripIrrelevantConstVolatile(QCString &s) { - //printf("stripIrrelevantConstVolatile(%s)=",s.data()); + //printf("stripIrrelevantConstVolatile(%s)=",qPrint(s)); stripIrrelevantString(s,"const"); stripIrrelevantString(s,"volatile"); stripIrrelevantString(s,"final"); - //printf("%s\n",s.data()); + //printf("%s\n",qPrint(s)); } @@ -1674,7 +1697,7 @@ QCString getCanonicalTemplateSpec(const Definition *d,const FileDef *fs,const QC { templSpec = resolvedType; } - //printf("getCanonicalTemplateSpec(%s)=%s\n",spec.data(),templSpec.data()); + //printf("getCanonicalTemplateSpec(%s)=%s\n",qPrint(spec),qPrint(templSpec)); return templSpec; } @@ -1698,9 +1721,9 @@ static QCString getCanonicalTypeForIdentifier( symName=word; } //printf("getCanonicalTypeForIdentifier(%s d=%s fs=%s ,[%s->%s]) start\n", - // word.data(), - // d ? d->name().data() : "<null>",fs ? fs->name().data() : "<null>", - // tSpec?tSpec->data():"<none>",templSpec.data()); + // qPrint(word), + // d ? qPrint(d->name()) : "<null>", fs ? qPrint(fs->name()) : "<null>", + // tSpec ? qPrint(tSpec) : "<none>", qPrint(templSpec)); // lookup class / class template instance SymbolResolver resolver(fs); @@ -1722,23 +1745,23 @@ static QCString getCanonicalTypeForIdentifier( //printf("cd=%p mtype=%p\n",cd,mType); //printf(" getCanonicalTypeForIdentifier: symbol=%s word=%s cd=%s d=%s fs=%s cd->isTemplate=%d\n", - // symName.data(), - // word.data(), - // cd?cd->name().data():"<none>", - // d?d->name().data():"<none>", - // fs?fs->name().data():"<none>", - // cd?cd->isTemplate():-1 + // qPrint(symName), + // qPrint(word), + // cd ? qPrint(cd->name()) : "<none>", + // d ? qPrint( d->name()) : "<none>", + // fs ? qPrint(fs->name()) : "<none>", + // cd ? cd->isTemplate():-1 // ); //printf(" >>>> word '%s' => '%s' templSpec=%s ts=%s tSpec=%s isTemplate=%d resolvedType=%s\n", - // (word+templSpec).data(), - // cd?cd->qualifiedName().data():"<none>", - // templSpec.data(),ts.data(), - // tSpec?tSpec->data():"<null>", - // cd?cd->isTemplate():FALSE, - // resolvedType.data()); + // qPrint((word+templSpec)), + // cd ? qPrint(cd->qualifiedName()) : "<none>", + // qPrint(templSpec), qPrint(ts), + // tSpec ? qPrint(tSpec) : "<null>", + // cd ? cd->isTemplate():FALSE, + // qPrint(resolvedType)); - //printf(" mtype=%s\n",mType?mType->name().data():"<none>"); + //printf(" mtype=%s\n",mType ? qPrint(mType->name()) : "<none>"); if (cd) // resolves to a known class type { @@ -1793,7 +1816,7 @@ static QCString getCanonicalTypeForIdentifier( { //result = mType->qualifiedName(); // changed after 1.7.2 //result = mType->typeString(); - //printf("word=%s typeString=%s\n",word.data(),mType->typeString()); + //printf("word=%s typeString=%s\n",qPrint(word),mType->typeString()); if (word!=mType->typeString()) { QCString type = mType->typeString(); @@ -1812,7 +1835,7 @@ static QCString getCanonicalTypeForIdentifier( else // fallback { resolvedType = resolveTypeDef(d,word); - //printf("typedef [%s]->[%s]\n",word.data(),resolvedType.data()); + //printf("typedef [%s]->[%s]\n",qPrint(word),qPrint(resolvedType)); if (resolvedType.isEmpty()) // not known as a typedef either { result = word; @@ -1822,7 +1845,7 @@ static QCString getCanonicalTypeForIdentifier( result = resolvedType; } } - //printf("getCanonicalTypeForIdentifier [%s]->[%s]\n",word.data(),result.data()); + //printf("getCanonicalTypeForIdentifier [%s]->[%s]\n",qPrint(word),qPrint(result)); return result; } @@ -1841,8 +1864,8 @@ static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCStr type.stripPrefix("typename "); type = removeRedundantWhiteSpace(type); - //printf("extractCanonicalType(type=%s) start: def=%s file=%s\n",type.data(), - // d ? d->name().data() : "<null>",fs ? fs->name().data() : "<null>"); + //printf("extractCanonicalType(type=%s) start: def=%s file=%s\n",qPrint(type), + // d ? qPrint(d->name()) : "<null>", fs ? qPrint(fs->name()) : "<null>"); QCString canType; QCString templSpec,word; @@ -1867,7 +1890,7 @@ static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCStr canType += ct; } //printf(" word=%s templSpec=%s canType=%s ct=%s\n", - // word.data(),templSpec.data(),canType.data(),ct.data()); + // qPrint(word), qPrint(templSpec), qPrint(canType), qPrint(ct)); if (!templSpec.isEmpty()) // if we didn't use up the templSpec already // (i.e. type is not a template specialization) // then resolve any identifiers inside. @@ -1879,7 +1902,7 @@ static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCStr size_t tp=0; // for each identifier template specifier - //printf("adding resolved %s to %s\n",templSpec.data(),canType.data()); + //printf("adding resolved %s to %s\n",qPrint(templSpec),qPrint(canType)); for (; it!=end ; ++it) { const auto &match = *it; @@ -1896,7 +1919,7 @@ static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCStr pp=p; } canType += type.right(type.length()-pp); - //printf("extractCanonicalType = '%s'->'%s'\n",type.data(),canType.data()); + //printf("extractCanonicalType = '%s'->'%s'\n",qPrint(type),qPrint(canType)); return removeRedundantWhiteSpace(canType); } @@ -1905,7 +1928,7 @@ static QCString extractCanonicalArgType(const Definition *d,const FileDef *fs,co { QCString type = arg.type.stripWhiteSpace(); QCString name = arg.name; - //printf("----- extractCanonicalArgType(type=%s,name=%s)\n",type.data(),name.data()); + //printf("----- extractCanonicalArgType(type=%s,name=%s)\n",qPrint(type),qPrint(name)); if ((type=="const" || type=="volatile") && !name.isEmpty()) { // name is part of type => correct type+=" "; @@ -1930,10 +1953,10 @@ static bool matchArgument2( ) { //printf(">> match argument: %s::'%s|%s' (%s) <-> %s::'%s|%s' (%s)\n", - // srcScope ? srcScope->name().data() : "", - // srcA.type.data(),srcA.name.data(),srcA.canType.data(), - // dstScope ? dstScope->name().data() : "", - // dstA.type.data(),dstA.name.data(),dstA.canType.data()); + // srcScope ? qPrint(srcScope->name()) : "", + // qPrint(srcA.type), qPrint(srcA.name), qPrint(srcA.canType), + // dstScope ? qPrint(dstScope->name()) : "", + // qPrint(dstA.type), qPrint(dstA.name), qPrint(dstA.canType)); //if (srcA->array!=dstA->array) // nomatch for char[] against char //{ @@ -1946,8 +1969,8 @@ static bool matchArgument2( QCString dstType = dstA.type; stripIrrelevantConstVolatile(srcType); stripIrrelevantConstVolatile(dstType); - //printf("'%s'<->'%s'\n",sSrcName.data(),dstType.right(sSrcName.length()).data()); - //printf("'%s'<->'%s'\n",sDstName.data(),srcType.right(sDstName.length()).data()); + //printf("'%s'<->'%s'\n",qPrint(sSrcName),qPrint(dstType.right(sSrcName.length()))); + //printf("'%s'<->'%s'\n",qPrint(sDstName),qPrint(srcType.right(sDstName.length()))); if (sSrcName==dstType.right(sSrcName.length())) { // case "unsigned int" <-> "unsigned int i" srcA.type+=sSrcName; @@ -1976,7 +1999,7 @@ static bool matchArgument2( else { //printf(" Canonical types do not match [%s]<->[%s]\n", - // srcA->canType.data(),dstA->canType.data()); + // qPrint(srcA->canType),qPrint(dstA->canType)); NOMATCH return FALSE; } @@ -2076,7 +2099,7 @@ bool matchArguments2(const Definition *srcScope,const FileDef *srcFileScope,cons void mergeArguments(ArgumentList &srcAl,ArgumentList &dstAl,bool forceNameOverwrite) { //printf("mergeArguments '%s', '%s'\n", - // argListToString(srcAl).data(),argListToString(dstAl).data()); + // qPrint(argListToString(srcAl)),qPrint(argListToString(dstAl))); if (srcAl.size()!=dstAl.size()) { @@ -2092,12 +2115,12 @@ void mergeArguments(ArgumentList &srcAl,ArgumentList &dstAl,bool forceNameOverwr if (srcA.defval.isEmpty() && !dstA.defval.isEmpty()) { - //printf("Defval changing '%s'->'%s'\n",srcA.defval.data(),dstA.defval.data()); + //printf("Defval changing '%s'->'%s'\n",qPrint(srcA.defval),qPrint(dstA.defval)); srcA.defval=dstA.defval; } else if (!srcA.defval.isEmpty() && dstA.defval.isEmpty()) { - //printf("Defval changing '%s'->'%s'\n",dstA.defval.data(),srcA.defval.data()); + //printf("Defval changing '%s'->'%s'\n",qPrint(dstA.defval),qPrint(srcA.defval)); dstA.defval=srcA.defval; } @@ -2116,24 +2139,24 @@ void mergeArguments(ArgumentList &srcAl,ArgumentList &dstAl,bool forceNameOverwr if (srcA.type==dstA.type) { - //printf("1. merging %s:%s <-> %s:%s\n",srcA.type.data(),srcA.name.data(),dstA.type.data(),dstA.name.data()); + //printf("1. merging %s:%s <-> %s:%s\n",qPrint(srcA.type),qPrint(srcA.name),qPrint(dstA.type),qPrint(dstA.name)); if (srcA.name.isEmpty() && !dstA.name.isEmpty()) { - //printf("type: '%s':='%s'\n",srcA.type.data(),dstA.type.data()); - //printf("name: '%s':='%s'\n",srcA.name.data(),dstA.name.data()); + //printf("type: '%s':='%s'\n",qPrint(srcA.type),qPrint(dstA.type)); + //printf("name: '%s':='%s'\n",qPrint(srcA.name),qPrint(dstA.name)); srcA.type = dstA.type; srcA.name = dstA.name; } else if (!srcA.name.isEmpty() && dstA.name.isEmpty()) { - //printf("type: '%s':='%s'\n",dstA.type.data(),srcA.type.data()); - //printf("name: '%s':='%s'\n",dstA.name.data(),srcA.name.data()); + //printf("type: '%s':='%s'\n",qPrint(dstA.type),qPrint(srcA.type)); + //printf("name: '%s':='%s'\n",qPrint(dstA.name),qPrint(srcA.name)); dstA.type = srcA.type; dstA.name = dstA.name; } else if (!srcA.name.isEmpty() && !dstA.name.isEmpty()) { - //printf("srcA.name=%s dstA.name=%s\n",srcA.name.data(),dstA.name.data()); + //printf("srcA.name=%s dstA.name=%s\n",qPrint(srcA.name),qPrint(dstA.name)); if (forceNameOverwrite) { srcA.name = dstA.name; @@ -2153,7 +2176,7 @@ void mergeArguments(ArgumentList &srcAl,ArgumentList &dstAl,bool forceNameOverwr } else { - //printf("2. merging '%s':'%s' <-> '%s':'%s'\n",srcA.type.data(),srcA.name.data(),dstA.type.data(),dstA.name.data()); + //printf("2. merging '%s':'%s' <-> '%s':'%s'\n",qPrint(srcA.type),qPrint(srcA.name),qPrint(dstA.type),qPrint(dstA.name)); srcA.type=srcA.type.stripWhiteSpace(); dstA.type=dstA.type.stripWhiteSpace(); if (srcA.type+" "+srcA.name==dstA.type) // "unsigned long:int" <-> "unsigned long int:bla" @@ -2181,15 +2204,15 @@ void mergeArguments(ArgumentList &srcAl,ArgumentList &dstAl,bool forceNameOverwr j2=dstA.type.length()-i2-2; if (i1!=-1 && i2==-1 && srcA.type.right(j1)==dstA.type) { - //printf("type: '%s':='%s'\n",dstA.type.data(),srcA.type.data()); - //printf("name: '%s':='%s'\n",dstA.name.data(),srcA.name.data()); + //printf("type: '%s':='%s'\n",qPrint(dstA.type),qPrint(srcA.type)); + //printf("name: '%s':='%s'\n",qPrint(dstA.name),qPrint(srcA.name)); dstA.type = srcA.type.left(i1+2)+dstA.type; dstA.name = dstA.name; } else if (i1==-1 && i2!=-1 && dstA.type.right(j2)==srcA.type) { - //printf("type: '%s':='%s'\n",srcA.type.data(),dstA.type.data()); - //printf("name: '%s':='%s'\n",dstA.name.data(),srcA.name.data()); + //printf("type: '%s':='%s'\n",qPrint(srcA.type),qPrint(dstA.type)); + //printf("name: '%s':='%s'\n",qPrint(dstA.name),qPrint(srcA.name)); srcA.type = dstA.type.left(i2+2)+srcA.type; srcA.name = dstA.name; } @@ -2202,15 +2225,15 @@ void mergeArguments(ArgumentList &srcAl,ArgumentList &dstAl,bool forceNameOverwr dstA.docs = srcA.docs; } //printf("Merge argument '%s|%s' '%s|%s'\n", - // srcA.type.data(),srcA.name.data(), - // dstA.type.data(),dstA.name.data()); + // qPrint(srcA.type), qPrint(srcA.name), + // qPrint(dstA.type), qPrint(dstA.name)); ++srcIt; ++dstIt; } } static void findMembersWithSpecificName(const MemberName *mn, - const char *args, + const QCString &args, bool checkStatics, const FileDef *currentFile, bool checkCV, @@ -2224,7 +2247,7 @@ static void findMembersWithSpecificName(const MemberName *mn, const FileDef *fd=md->getFileDef(); const GroupDef *gd=md->getGroupDef(); //printf(" md->name()='%s' md->args='%s' fd=%p gd=%p current=%p ref=%s\n", - // md->name().data(),args,fd,gd,currentFile,md->getReference().data()); + // qPrint(md->name()),args,fd,gd,currentFile,qPrint(md->getReference())); if ( ((gd && gd->isLinkable()) || (fd && fd->isLinkable()) || md->isReference()) && md->getNamespaceDef()==0 && md->isLinkable() && @@ -2233,7 +2256,7 @@ static void findMembersWithSpecificName(const MemberName *mn, ) { bool match=TRUE; - if (args && !md->isDefine() && qstrcmp(args,"()")!=0) + if (!args.isEmpty() && !md->isDefine() && args!="()") { const ArgumentList &mdAl = md->argumentList(); auto argList_p = stringToArgumentList(md->getLanguage(),args); @@ -2275,7 +2298,7 @@ static void findMembersWithSpecificName(const MemberName *mn, */ bool getDefs(const QCString &scName, const QCString &mbName, - const char *args, + const QCString &args, const MemberDef *&md, const ClassDef *&cd, const FileDef *&fd, @@ -2294,7 +2317,7 @@ bool getDefs(const QCString &scName, scopeName = substitute(scopeName,"\\","::"); // for PHP memberName = substitute(memberName,"\\","::"); // for PHP //printf("Search for name=%s args=%s in scope=%s forceEmpty=%d\n", - // memberName.data(),args,scopeName.data(),forceEmptyScope); + // qPrint(memberName),qPrint(args),qPrint(scopeName),forceEmptyScope); int is,im=0,pm=0; // strip common part of the scope from the scopeName @@ -2307,7 +2330,7 @@ bool getDefs(const QCString &scName, pm=im+2; } //printf("result after scope corrections scope=%s name=%s\n", - // scopeName.data(),memberName.data()); + // qPrint(scopeName), qPrint(memberName)); QCString mName=memberName; QCString mScope; @@ -2324,15 +2347,15 @@ bool getDefs(const QCString &scName, // handle special the case where both scope name and member scope are equal if (mScope==scopeName) scopeName.resize(0); - //printf("mScope='%s' mName='%s'\n",mScope.data(),mName.data()); + //printf("mScope='%s' mName='%s'\n",qPrint(mScope),qPrint(mName)); MemberName *mn = Doxygen::memberNameLinkedMap->find(mName); - //printf("mName=%s mn=%p\n",mName.data(),mn); + //printf("mName=%s mn=%p\n",qPrint(mName),mn); if ((!forceEmptyScope || scopeName.isEmpty()) && // this was changed for bug638856, forceEmptyScope => empty scopeName mn && !(scopeName.isEmpty() && mScope.isEmpty())) { - //printf(" >member name '%s' found\n",mName.data()); + //printf(" >member name '%s' found\n",qPrint(mName)); int scopeOffset=scopeName.length(); do { @@ -2356,7 +2379,7 @@ bool getDefs(const QCString &scName, fcd=resolver.resolveClass(Doxygen::globalScope,nameWithoutTemplates); tmd=resolver.getTypedef(); } - //printf("Trying class scope %s: fcd=%p tmd=%p\n",className.data(),fcd,tmd); + //printf("Trying class scope %s: fcd=%p tmd=%p\n",qPrint(className),fcd,tmd); // todo: fill in correct fileScope! if (fcd && // is it a documented class fcd->isLinkable() @@ -2365,7 +2388,7 @@ bool getDefs(const QCString &scName, //printf(" Found fcd=%p\n",fcd); int mdist=maxInheritanceDepth; std::unique_ptr<ArgumentList> argList; - if (args) + if (!args.isEmpty()) { argList = stringToArgumentList(fcd->getLanguage(),args); } @@ -2375,7 +2398,7 @@ bool getDefs(const QCString &scName, if (!mmd->isStrongEnumValue()) { const ArgumentList &mmdAl = mmd->argumentList(); - bool match=args==0 || + bool match = args.isEmpty() || matchArguments2(mmd->getOuterScope(),mmd->getFileDef(),&mmdAl, fcd, fcd->getFileDef(),argList.get(), checkCV); @@ -2396,7 +2419,7 @@ bool getDefs(const QCString &scName, } } } - if (mdist==maxInheritanceDepth && args && qstrcmp(args,"()")==0) + if (mdist==maxInheritanceDepth && args=="()") // no exact match found, but if args="()" an arbitrary member will do { //printf(" >Searching for arbitrary member\n"); @@ -2406,7 +2429,7 @@ bool getDefs(const QCString &scName, //if (mmd->isLinkable()) //{ const ClassDef *mcd=mmd->getClassDef(); - //printf(" >Class %s found\n",mcd->name().data()); + //printf(" >Class %s found\n",qPrint(mcd->name())); if (mcd) { int m=minClassDistance(fcd,mcd); @@ -2477,9 +2500,9 @@ bool getDefs(const QCString &scName, //printf("Global symbol\n"); const MemberDef *fuzzy_mmd = 0; std::unique_ptr<ArgumentList> argList; - bool hasEmptyArgs = args && qstrcmp(args, "()") == 0; + bool hasEmptyArgs = args=="()"; - if (args) + if (!args.isEmpty()) { argList = stringToArgumentList(SrcLangExt_Cpp, args); } @@ -2493,7 +2516,7 @@ bool getDefs(const QCString &scName, continue; } - if (!args) + if (args.isEmpty()) { fuzzy_mmd = mmd; break; @@ -2527,7 +2550,7 @@ bool getDefs(const QCString &scName, // maybe an namespace, file or group member ? //printf("Testing for global symbol scopeName='%s' mScope='%s' :: mName='%s'\n", - // scopeName.data(),mScope.data(),mName.data()); + // qPrint(scopeName), qPrint(mScope), qPrint(mName)); if ((mn=Doxygen::functionNameLinkedMap->find(mName))) // name is known { //printf(" >symbol name found\n"); @@ -2542,16 +2565,16 @@ bool getDefs(const QCString &scName, } else if (!mScope.isEmpty()) { - namespaceName=mScope.copy(); + namespaceName=mScope; } - //printf("Trying namespace %s\n",namespaceName.data()); + //printf("Trying namespace %s\n",qPrint(namespaceName)); if (!namespaceName.isEmpty() && (fnd=Doxygen::namespaceLinkedMap->find(namespaceName)) && fnd->isLinkable() ) { //printf("Symbol inside existing namespace '%s' count=%d\n", - // namespaceName.data(),mn->count()); + // qPrint(namespaceName),mn->count()); bool found=FALSE; for (const auto &mmd_p : *mn) { @@ -2561,7 +2584,7 @@ bool getDefs(const QCString &scName, const MemberDef *emd = mmd->getEnumScope(); if (emd && emd->isStrong()) { - //printf("yes match %s<->%s!\n",mScope.data(),emd->localName().data()); + //printf("yes match %s<->%s!\n",qPrint(mScope),qPrint(emd->localName())); if (emd->getNamespaceDef()==fnd && rightScopeMatch(mScope,emd->localName())) { @@ -2581,7 +2604,7 @@ bool getDefs(const QCString &scName, else if (mmd->getOuterScope()==fnd /* && mmd->isLinkable() */ ) { // namespace is found bool match=TRUE; - if (args && qstrcmp(args,"()")!=0) + if (!args.isEmpty() && args!="()") { const ArgumentList &mmdAl = mmd->argumentList(); auto argList_p = stringToArgumentList(mmd->getLanguage(),args); @@ -2599,7 +2622,7 @@ bool getDefs(const QCString &scName, } } } - if (!found && args && !qstrcmp(args,"()")) + if (!found && args=="()") // no exact match found, but if args="()" an arbitrary // member will do { @@ -2638,9 +2661,9 @@ bool getDefs(const QCString &scName, { const MemberDef *mmd = mmd_p.get(); const MemberDef *tmd = mmd->getEnumScope(); - //printf("try member %s tmd=%s\n",mmd->name().data(),tmd?tmd->name().data():"<none>"); + //printf("try member %s tmd=%s\n",qPrint(mmd->name()),tmd ? qPrint(tmd->name()) : "<none>"); int ni=namespaceName.findRev("::"); - //printf("namespaceName=%s ni=%d\n",namespaceName.data(),ni); + //printf("namespaceName=%s ni=%d\n",qPrint(namespaceName),ni); bool notInNS = tmd && ni==-1 && tmd->getNamespaceDef()==0 && (mScope.isEmpty() || mScope==tmd->name()); bool sameNS = tmd && tmd->getNamespaceDef() && namespaceName.left(ni)==tmd->getNamespaceDef()->name() && namespaceName.mid(ni+2)==tmd->name(); //printf("notInNS=%d sameNS=%d\n",notInNS,sameNS); @@ -2654,7 +2677,7 @@ bool getDefs(const QCString &scName, gd=mmd->getGroupDef(); if (gd && gd->isLinkable()) fd=0; else gd=0; //printf("Found scoped enum %s fd=%p gd=%p\n", - // mmd->name().data(),fd,gd); + // qPrint(mmd->name()),fd,gd); return TRUE; } } @@ -2680,7 +2703,7 @@ bool getDefs(const QCString &scName, findMembersWithSpecificName(mn,args,FALSE,currentFile,checkCV,members); } //printf("found %d members\n",members.count()); - if (members.size()!=1 && args && !qstrcmp(args,"()")) + if (members.size()!=1 && args=="()") { // no exact match found, but if args="()" an arbitrary // member will do @@ -2690,8 +2713,8 @@ bool getDefs(const QCString &scName, { const auto &mmd_p = *it; const MemberDef *mmd = mmd_p.get(); - //printf("Found member '%s'\n",mmd->name().data()); - //printf("member is linkable mmd->name()='%s'\n",mmd->name().data()); + //printf("Found member '%s'\n",qPrint(mmd->name())); + //printf("member is linkable mmd->name()='%s'\n",qPrint(mmd->name())); fd=mmd->getFileDef(); gd=mmd->getGroupDef(); const MemberDef *tmd = mmd->getEnumScope(); @@ -2709,7 +2732,7 @@ bool getDefs(const QCString &scName, { if (currentFile) { - //printf("multiple results; pick one from file:%s\n", currentFile->name().data()); + //printf("multiple results; pick one from file:%s\n",qPrint( currentFile->name())); for (const auto &rmd : members) { if (rmd->getFileDef() && rmd->getFileDef()->name() == currentFile->name()) @@ -2758,7 +2781,7 @@ bool getDefs(const QCString &scName, * - if `cd` is non zero, the scope was a class pointed to by cd. * - if `nd` is non zero, the scope was a namespace pointed to by nd. */ -static bool getScopeDefs(const char *docScope,const char *scope, +static bool getScopeDefs(const QCString &docScope,const QCString &scope, ClassDef *&cd, NamespaceDef *&nd) { cd=0;nd=0; @@ -2783,7 +2806,7 @@ static bool getScopeDefs(const char *docScope,const char *scope, do // for each possible docScope (from largest to and including empty) { - QCString fullName=scopeName.copy(); + QCString fullName=scopeName; if (scopeOffset>0) fullName.prepend(docScopeName.left(scopeOffset)+"::"); if (((cd=getClass(fullName)) || // normal class @@ -2812,18 +2835,18 @@ static bool getScopeDefs(const char *docScope,const char *scope, static bool isLowerCase(QCString &s) { + if (s.isEmpty()) return true; uchar *p=(uchar*)s.data(); - if (p==0) return TRUE; int c; - while ((c=*p++)) if (!islower(c)) return FALSE; - return TRUE; + while ((c=*p++)) if (!islower(c)) return false; + return true; } /*! Returns an object to reference to given its name and context * @post return value TRUE implies *resContext!=0 or *resMember!=0 */ -bool resolveRef(/* in */ const char *scName, - /* in */ const char *name, +bool resolveRef(/* in */ const QCString &scName, + /* in */ const QCString &name, /* in */ bool inSeeBlock, /* out */ const Definition **resContext, /* out */ const MemberDef **resMember, @@ -2832,7 +2855,7 @@ bool resolveRef(/* in */ const char *scName, bool checkScope ) { - //printf("resolveRef(scope=%s,name=%s,inSeeBlock=%d)\n",scName,name,inSeeBlock); + //printf("resolveRef(scope=%s,name=%s,inSeeBlock=%d)\n",qPrint(scName),qPrint(name),inSeeBlock); QCString tsName = name; //bool memberScopeFirst = tsName.find('#')!=-1; QCString fullName = substitute(tsName,"#","::"); @@ -2870,7 +2893,7 @@ bool resolveRef(/* in */ const char *scName, return FALSE; } - //printf("scName=%s fullName=%s\n",scName,fullName.data()); + //printf("scName=%s fullName=%s\n",scName,qPrint(fullName)); // check if this is a class or namespace reference if (scName!=fullName && getScopeDefs(scName,fullName,cd,nd)) @@ -2891,7 +2914,7 @@ bool resolveRef(/* in */ const char *scName, { //printf("found scName=%s fullName=%s scName==fullName=%d " // "inSeeBlock=%d scopePos=%d!\n", - // scName,fullName.data(),scName==fullName,inSeeBlock,scopePos); + // scName,qPrint(fullName),scName==fullName,inSeeBlock,scopePos); return FALSE; } // continue search... @@ -2932,10 +2955,11 @@ bool resolveRef(/* in */ const char *scName, const FileDef *fd = 0; const NamespaceDef *nd = 0; const GroupDef *gd = 0; + const ConceptDef *cnd = 0; // check if nameStr is a member or global. //printf("getDefs(scope=%s,name=%s,args=%s checkScope=%d)\n", - // scopeStr.data(),nameStr.data(),argsStr.data(),checkScope); + // qPrint(scopeStr), qPrint(nameStr), qPrint(argsStr),checkScope); if (getDefs(scopeStr,nameStr,argsStr, md,cd,fd,nd,gd, //scopePos==0 && !memberScopeFirst, // forceEmptyScope @@ -2945,7 +2969,7 @@ bool resolveRef(/* in */ const char *scName, ) ) { - //printf("after getDefs checkScope=%d nameStr=%s cd=%p nd=%p\n",checkScope,nameStr.data(),cd,nd); + //printf("after getDefs checkScope=%d nameStr=%s cd=%p nd=%p\n",checkScope,qPrint(nameStr),cd,nd); if (checkScope && md && md->getOuterScope()==Doxygen::globalScope && !md->isStrongEnumValue() && (!scopeStr.isEmpty() || nameStr.find("::")>0)) @@ -2966,7 +2990,7 @@ bool resolveRef(/* in */ const char *scName, else if (gd) *resContext=gd; else { *resContext=0; *resMember=0; return FALSE; } //printf("member=%s (md=%p) anchor=%s linkable()=%d context=%s\n", - // md->name().data(),md,md->anchor().data(),md->isLinkable(),(*resContext)->name().data()); + // qPrint(md->name()), md, qPrint(md->anchor()), md->isLinkable(), qPrint((*resContext)->name())); return TRUE; } else if (inSeeBlock && !nameStr.isEmpty() && (gd=Doxygen::groupLinkedMap->find(nameStr))) @@ -2974,6 +2998,11 @@ bool resolveRef(/* in */ const char *scName, *resContext=gd; return TRUE; } + else if ((cnd=Doxygen::conceptLinkedMap->find(nameStr))) + { + *resContext=cnd; + return TRUE; + } else if (tsName.find('.')!=-1) // maybe a link to a file { bool ambig; @@ -3002,7 +3031,7 @@ bool resolveRef(/* in */ const char *scName, return FALSE; } -QCString linkToText(SrcLangExt lang,const char *link,bool isFileName) +QCString linkToText(SrcLangExt lang,const QCString &link,bool isFileName) { //static bool optimizeOutputJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA); QCString result=link; @@ -3096,8 +3125,8 @@ bool generateRef(OutputDocInterface &od,const char *scName, } #endif -bool resolveLink(/* in */ const char *scName, - /* in */ const char *lr, +bool resolveLink(/* in */ const QCString &scName, + /* in */ const QCString &lr, /* in */ bool /*inSeeBlock*/, /* out */ const Definition **resContext, /* out */ QCString &resAnchor @@ -3107,12 +3136,13 @@ bool resolveLink(/* in */ const char *scName, QCString linkRef=lr; QCString linkRefWithoutTemplates = stripTemplateSpecifiersFromScope(linkRef,FALSE); - //printf("ResolveLink linkRef=%s\n",lr); + //printf("ResolveLink linkRef=%s\n",qPrint(lr)); const FileDef *fd; const GroupDef *gd; const PageDef *pd; const ClassDef *cd; const DirDef *dir; + const ConceptDef *cnd; const NamespaceDef *nd; const SectionInfo *si=0; bool ambig; @@ -3175,12 +3205,12 @@ bool resolveLink(/* in */ const char *scName, resAnchor=cd->anchor(); return TRUE; } -// else if ((cd=getClass(linkRef+"-g"))) // C# generic link -// { -// *resContext=cd; -// resAnchor=cd->anchor(); -// return TRUE; -// } + else if ((cnd=getConcept(linkRef))) // C++20 concept definition + { + *resContext=cnd; + resAnchor=cnd->anchor(); + return TRUE; + } else if ((nd=Doxygen::namespaceLinkedMap->find(linkRef))) { *resContext=nd; @@ -3209,19 +3239,19 @@ bool resolveLink(/* in */ const char *scName, // basis for the link's text. // returns TRUE if a link could be generated. -bool generateLink(OutputDocInterface &od,const char *clName, - const char *lr,bool inSeeBlock,const char *lt) +bool generateLink(OutputDocInterface &od,const QCString &clName, + const QCString &lr,bool inSeeBlock,const QCString <) { //printf("generateLink(clName=%s,lr=%s,lr=%s)\n",clName,lr,lt); const Definition *compound = 0; //PageDef *pageDef=0; QCString anchor,linkText=linkToText(SrcLangExt_Unknown,lt,FALSE); - //printf("generateLink linkText=%s\n",linkText.data()); + //printf("generateLink linkText=%s\n",qPrint(linkText)); if (resolveLink(clName,lr,inSeeBlock,&compound,anchor)) { if (compound) // link to compound { - if (lt==0 && anchor.isEmpty() && /* compound link */ + if (lt.isEmpty() && anchor.isEmpty() && /* compound link */ compound->definitionType()==Definition::TypeGroup /* is group */ ) { @@ -3251,17 +3281,17 @@ bool generateLink(OutputDocInterface &od,const char *clName, } } -void generateFileRef(OutputDocInterface &od,const char *name,const char *text) +void generateFileRef(OutputDocInterface &od,const QCString &name,const QCString &text) { //printf("generateFileRef(%s,%s)\n",name,text); - QCString linkText = text ? text : name; + QCString linkText = text.isEmpty() ? text : name; //FileInfo *fi; FileDef *fd; bool ambig; if ((fd=findFileDef(Doxygen::inputNameLinkedMap,name,ambig)) && fd->isLinkable()) // link to documented input file - od.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,linkText); + od.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),QCString(),linkText); else od.docify(linkText); } @@ -3280,10 +3310,10 @@ static Cache<std::string,FindFileCacheElem> g_findFileDefCache(5000); static std::mutex g_findFileDefMutex; -FileDef *findFileDef(const FileNameLinkedMap *fnMap,const char *n,bool &ambig) +FileDef *findFileDef(const FileNameLinkedMap *fnMap,const QCString &n,bool &ambig) { ambig=FALSE; - if (n==0) return 0; + if (n.isEmpty()) return 0; std::lock_guard<std::mutex> lock(g_findFileDefMutex); @@ -3294,7 +3324,7 @@ FileDef *findFileDef(const FileNameLinkedMap *fnMap,const char *n,bool &ambig) key+=n; FindFileCacheElem *cachedResult = g_findFileDefCache.find(key.str()); - //printf("key=%s cachedResult=%p\n",key.data(),cachedResult); + //printf("key=%s cachedResult=%p\n",qPrint(key),cachedResult); if (cachedResult) { ambig = cachedResult->isAmbig; @@ -3306,7 +3336,7 @@ FileDef *findFileDef(const FileNameLinkedMap *fnMap,const char *n,bool &ambig) cachedResult = g_findFileDefCache.insert(key.str(),FindFileCacheElem(0,FALSE)); } - QCString name=Dir::cleanDirPath(n); + QCString name=Dir::cleanDirPath(n.str()); QCString path; int slashPos; const FileName *fn; @@ -3366,7 +3396,7 @@ exit: //---------------------------------------------------------------------- -QCString showFileDefMatches(const FileNameLinkedMap *fnMap,const char *n) +QCString showFileDefMatches(const FileNameLinkedMap *fnMap,const QCString &n) { QCString result; QCString name=n; @@ -3393,11 +3423,11 @@ QCString showFileDefMatches(const FileNameLinkedMap *fnMap,const char *n) //---------------------------------------------------------------------- -QCString substituteKeywords(const QCString &s,const char *title, - const char *projName,const char *projNum,const char *projBrief) +QCString substituteKeywords(const QCString &s,const QCString &title, + const QCString &projName,const QCString &projNum,const QCString &projBrief) { QCString result = s; - if (title) result = substitute(result,"$title",title); + if (!title.isEmpty()) result = substitute(result,"$title",title); result = substitute(result,"$datetime",dateToString(TRUE)); result = substitute(result,"$date",dateToString(FALSE)); result = substitute(result,"$year",yearToString()); @@ -3538,14 +3568,14 @@ int getUtf8Char(const char *input,char ids[MAX_UTF8_CHAR_SIZE],CaseModifier modi #endif // note that this function is not reentrant due to the use of static growBuf! -QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscore) +QCString escapeCharsInString(const QCString &name,bool allowDots,bool allowUnderscore) { + if (name.isEmpty()) return name; bool caseSenseNames = Config_getBool(CASE_SENSE_NAMES); bool allowUnicodeNames = Config_getBool(ALLOW_UNICODE_NAMES); - if (name==0) return ""; GrowBuf growBuf; signed char c; - const char *p=name; + const char *p=name.data(); while ((c=*p++)!=0) { switch(c) @@ -3620,11 +3650,12 @@ QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscor return growBuf.get(); } -QCString unescapeCharsInString(const char *s) +QCString unescapeCharsInString(const QCString &s) { - static bool caseSenseNames = Config_getBool(CASE_SENSE_NAMES); + if (s.isEmpty()) return s; + bool caseSenseNames = Config_getBool(CASE_SENSE_NAMES); QCString result; - const char *p = s; + const char *p = s.data(); if (p) { char c; @@ -3699,16 +3730,16 @@ static int g_usedNamesCount=1; * given its name, which could be a class name with template * arguments, so special characters need to be escaped. */ -QCString convertNameToFile(const char *name,bool allowDots,bool allowUnderscore) +QCString convertNameToFile(const QCString &name,bool allowDots,bool allowUnderscore) { - if (name==0 || name[0]=='\0') return ""; + if (name.isEmpty()) return name; static bool shortNames = Config_getBool(SHORT_NAMES); static bool createSubdirs = Config_getBool(CREATE_SUBDIRS); QCString result; if (shortNames) // use short names only { std::lock_guard<std::mutex> lock(g_usedNamesMutex); - auto kv = g_usedNames.find(name); + auto kv = g_usedNames.find(name.str()); uint num=0; if (kv!=g_usedNames.end()) { @@ -3717,7 +3748,7 @@ QCString convertNameToFile(const char *name,bool allowDots,bool allowUnderscore) else { num = g_usedNamesCount; - g_usedNames.insert(std::make_pair(name,g_usedNamesCount++)); + g_usedNames.insert(std::make_pair(name.str(),g_usedNamesCount++)); } result.sprintf("a%05d",num); } @@ -3729,9 +3760,9 @@ QCString convertNameToFile(const char *name,bool allowDots,bool allowUnderscore) { // third algorithm based on MD5 hash uchar md5_sig[16]; - QCString sigStr(33); + char sigStr[33]; MD5Buffer((const unsigned char *)result.data(),resultLen,md5_sig); - MD5SigToString(md5_sig,sigStr.rawData(),33); + MD5SigToString(md5_sig,sigStr); result=result.left(128-32)+sigStr; } } @@ -3747,23 +3778,22 @@ QCString convertNameToFile(const char *name,bool allowDots,bool allowUnderscore) result.prepend(QCString().sprintf("d%x/d%02x/",l1Dir,l2Dir)); } - //printf("*** convertNameToFile(%s)->%s\n",name,result.data()); + //printf("*** convertNameToFile(%s)->%s\n",name,qPrint(result)); return result; } -QCString relativePathToRoot(const char *name) +QCString relativePathToRoot(const QCString &name) { QCString result; if (Config_getBool(CREATE_SUBDIRS)) { - if (name==0) + if (name.isEmpty()) { return REL_PATH_TO_ROOT; } else { - QCString n = name; - int i = n.findRev('/'); + int i = name.findRev('/'); if (i!=-1) { result=REL_PATH_TO_ROOT; @@ -3785,7 +3815,7 @@ void createSubDirs(const Dir &d) subdir.sprintf("d%x",l1); if (!d.exists(subdir.str()) && !d.mkdir(subdir.str())) { - term("Failed to create output directory '%s'\n",subdir.data()); + term("Failed to create output directory '%s'\n",qPrint(subdir)); } for (l2=0;l2<256;l2++) { @@ -3793,7 +3823,7 @@ void createSubDirs(const Dir &d) subsubdir.sprintf("d%x/d%02x",l1,l2); if (!d.exists(subsubdir.str()) && !d.mkdir(subsubdir.str())) { - term("Failed to create output directory '%s'\n",subsubdir.data()); + term("Failed to create output directory '%s'\n",qPrint(subsubdir)); } } } @@ -3812,7 +3842,7 @@ void extractNamespaceName(const QCString &scopeName, NamespaceDef *nd = 0; if (!clName.isEmpty() && (nd=getResolvedNamespace(clName)) && getClass(clName)==0) { // the whole name is a namespace (and not a class) - namespaceName=nd->name().copy(); + namespaceName=nd->name(); className.resize(0); goto done; } @@ -3820,11 +3850,11 @@ void extractNamespaceName(const QCString &scopeName, while (p>=0 && (i=clName.findRev("::",p))!=-1) // see if the first part is a namespace (and not a class) { - //printf("Trying %s\n",clName.left(i).data()); + //printf("Trying %s\n",qPrint(clName.left(i))); if (i>0 && (nd=getResolvedNamespace(clName.left(i))) && getClass(clName.left(i))==0) { //printf("found!\n"); - namespaceName=nd->name().copy(); + namespaceName=nd->name(); className=clName.right(clName.length()-i-2); goto done; } @@ -3833,18 +3863,18 @@ void extractNamespaceName(const QCString &scopeName, //printf("not found!\n"); // not found, so we just have to guess. - className=scopeName.copy(); + className=scopeName; namespaceName.resize(0); done: if (className.isEmpty() && !namespaceName.isEmpty() && !allowEmptyClass) { // class and namespace with the same name, correct to return the class. - className=namespaceName.copy(); + className=namespaceName; namespaceName.resize(0); } - //printf("extractNamespace '%s' => '%s|%s'\n",scopeName.data(), - // className.data(),namespaceName.data()); + //printf("extractNamespace '%s' => '%s|%s'\n",qPrint(scopeName), + // qPrint(className),qPrint(namespaceName)); if (/*className.right(2)=="-g" ||*/ className.right(2)=="-p") { className = className.left(className.length()-2); @@ -3854,7 +3884,7 @@ done: QCString insertTemplateSpecifierInScope(const QCString &scope,const QCString &templ) { - QCString result=scope.copy(); + QCString result=scope; if (!templ.isEmpty() && scope.find('<')==-1) { int si,pi=0; @@ -3864,7 +3894,7 @@ QCString insertTemplateSpecifierInScope(const QCString &scope,const QCString &te ((cd=getClass(scope.left(si)))==0 || cd->templateArguments().empty()) ) { - //printf("Tried '%s'\n",(scope.left(si)+templ).data()); + //printf("Tried '%s'\n",qPrint((scope.left(si)+templ))); pi=si+2; } if (si==-1) // not nested => append template specifier @@ -3877,7 +3907,7 @@ QCString insertTemplateSpecifierInScope(const QCString &scope,const QCString &te } } //printf("insertTemplateSpecifierInScope('%s','%s')=%s\n", - // scope.data(),templ.data(),result.data()); + // qPrint(scope),qPrint(templ),qPrint(result)); return result; } @@ -3885,7 +3915,7 @@ QCString insertTemplateSpecifierInScope(const QCString &scope,const QCString &te /*! Strips the scope from a name. Examples: A::B will return A * and A<T>::B<N::C<D> > will return A<T>. */ -QCString stripScope(const char *name) +QCString stripScope(const QCString &name) { QCString result = name; int l=result.length(); @@ -3905,7 +3935,7 @@ QCString stripScope(const char *name) { case ':': // only exit in the case of :: - //printf("stripScope(%s)=%s\n",name,result.right(l-p-1).data()); + //printf("stripScope(%s)=%s\n",name,qPrint(result.right(l-p-1))); if (p>0 && result.at(p-1)==':' && (count==0 || skipBracket)) { return result.right(l-p-1); @@ -3978,11 +4008,11 @@ QCString stripScope(const char *name) } /*! Converts a string to a HTML id string */ -QCString convertToId(const char *s) +QCString convertToId(const QCString &s) { - if (s==0) return ""; + if (s.isEmpty()) return s; GrowBuf growBuf; - const char *p=s; + const char *p=s.data(); char c; bool first=TRUE; while ((c=*p++)) @@ -4011,18 +4041,18 @@ QCString convertToId(const char *s) * that an id cannot have a digit at the first position. To overcome problems * with double labels we always place an "a" in front */ -QCString correctId(QCString s) +QCString correctId(const QCString &s) { if (s.isEmpty()) return s; return "a" + s; } /*! Converts a string to an XML-encoded string */ -QCString convertToXML(const char *s, bool keepEntities) +QCString convertToXML(const QCString &s, bool keepEntities) { - if (s==0) return ""; + if (s.isEmpty()) return s; GrowBuf growBuf; - const char *p=s; + const char *p=s.data(); char c; while ((c=*p++)) { @@ -4069,13 +4099,13 @@ QCString convertToXML(const char *s, bool keepEntities) } /*! Converts a string to an DocBook-encoded string */ -QCString convertToDocBook(const char *s) +QCString convertToDocBook(const QCString &s) { - if (s==0) return ""; + if (s.isEmpty()) return s; GrowBuf growBuf; const unsigned char *q; int cnt; - const unsigned char *p=(const unsigned char *)s; + const unsigned char *p=(const unsigned char *)s.data(); char c; while ((c=*p++)) { @@ -4133,11 +4163,11 @@ QCString convertToDocBook(const char *s) } /*! Converts a string to a HTML-encoded string */ -QCString convertToHtml(const char *s,bool keepEntities) +QCString convertToHtml(const QCString &s,bool keepEntities) { - if (s==0) return ""; + if (s.isEmpty()) return s; GrowBuf growBuf; - const char *p=s; + const char *p=s.data(); char c; while ((c=*p++)) { @@ -4193,11 +4223,11 @@ QCString convertToHtml(const char *s,bool keepEntities) return growBuf.get(); } -QCString convertToJSString(const char *s) +QCString convertToJSString(const QCString &s) { - if (s==0) return ""; + if (s.isEmpty()) return s; GrowBuf growBuf; - const char *p=s; + const char *p=s.data(); char c; while ((c=*p++)) { @@ -4212,11 +4242,11 @@ QCString convertToJSString(const char *s) return convertCharEntitiesToUTF8(growBuf.get()); } -QCString convertToPSString(const char *s) +QCString convertToPSString(const QCString &s) { - if (s==0) return ""; + if (s.isEmpty()) return s; GrowBuf growBuf; - const char *p=s; + const char *p=s.data(); char c; while ((c=*p++)) { @@ -4233,19 +4263,18 @@ QCString convertToPSString(const char *s) QCString convertToLaTeX(const QCString &s,bool insideTabbing,bool keepSpaces) { - std::ostringstream t(std::ios_base::ate); + TextStream t; filterLatexString(t,s,insideTabbing,false,false,false,keepSpaces); - QCString result = t.str(); - return result.data(); + return t.str(); } -QCString convertCharEntitiesToUTF8(const char *str) +QCString convertCharEntitiesToUTF8(const QCString &str) { - if (str==0) return QCString(); + if (str.isEmpty()) return QCString(); - std::string s = str; + std::string s = str.data(); static const reg::Ex re(R"(&\a\w*;)"); reg::Iterator it(s,re); reg::Iterator end; @@ -4261,7 +4290,7 @@ QCString convertCharEntitiesToUTF8(const char *str) { growBuf.addStr(s.substr(i,p-i)); } - std::string entity = match.str(); + QCString entity(match.str()); DocSymbol::SymType symType = HtmlEntityMapper::instance()->name2sym(entity); const char *code=0; if (symType!=DocSymbol::Sym_Unknown && (code=HtmlEntityMapper::instance()->utf8(symType))) @@ -4276,7 +4305,7 @@ QCString convertCharEntitiesToUTF8(const char *str) } growBuf.addStr(s.substr(i)); growBuf.addChar(0); - //printf("convertCharEntitiesToUTF8(%s)->%s\n",s.data(),growBuf.get()); + //printf("convertCharEntitiesToUTF8(%s)->%s\n",qPrint(s),growBuf.get()); return growBuf.get(); } @@ -4296,7 +4325,7 @@ void addMembersToMemberGroup(MemberList *ml, const Definition *context) { ASSERT(context!=0); - //printf("addMemberToMemberGroup() context=%s\n",context->name().data()); + //printf("addMemberToMemberGroup() context=%s\n",qPrint(context->name())); if (ml==0) return; struct MoveMemberInfo @@ -4407,7 +4436,7 @@ void addMembersToMemberGroup(MemberList *ml, * class \a name and a template argument list \a templSpec. If -1 is returned * there are no more matches. */ -int extractClassNameFromType(const char *type,int &pos,QCString &name,QCString &templSpec,SrcLangExt lang) +int extractClassNameFromType(const QCString &type,int &pos,QCString &name,QCString &templSpec,SrcLangExt lang) { static reg::Ex re_norm(R"(\a[\w:]*)"); static reg::Ex re_fortran(R"(\a[\w:()=]*)"); @@ -4415,8 +4444,8 @@ int extractClassNameFromType(const char *type,int &pos,QCString &name,QCString & name.resize(0); templSpec.resize(0); - if (type==0) return -1; - int typeLen=qstrlen(type); + if (type.isEmpty()) return -1; + int typeLen=(int)type.length(); if (typeLen>0) { if (lang == SrcLangExt_Fortran) @@ -4427,7 +4456,7 @@ int extractClassNameFromType(const char *type,int &pos,QCString &name,QCString & re = &re_fortran; } } - std::string s = type; + std::string s = type.str(); reg::Iterator it(s,*re,(int)pos); reg::Iterator end; @@ -4471,13 +4500,13 @@ int extractClassNameFromType(const char *type,int &pos,QCString &name,QCString & pos=i+l; } //printf("extractClassNameFromType([in] type=%s,[out] pos=%d,[out] name=%s,[out] templ=%s)=TRUE i=%d\n", - // type,pos,name.data(),templSpec.data(),i); + // type,pos,qPrint(name),qPrint(templSpec),i); return i; } } pos = typeLen; //printf("extractClassNameFromType([in] type=%s,[out] pos=%d,[out] name=%s,[out] templ=%s)=FALSE\n", - // type,pos,name.data(),templSpec.data()); + // type,pos,qPrint(name),qPrint(templSpec)); return -1; } @@ -4504,7 +4533,7 @@ QCString normalizeNonTemplateArgumentsInString( size_t i = match.position(); size_t l = match.length(); result += s.substr(pi,i-pi); - std::string n = match.str(); + QCString n(match.str()); bool found=FALSE; for (const Argument &formArg : formalArgs) { @@ -4518,7 +4547,7 @@ QCString normalizeNonTemplateArgumentsInString( { // try to resolve the type SymbolResolver resolver; - const ClassDef *cd = resolver.resolveClass(context,n.c_str()); + const ClassDef *cd = resolver.resolveClass(context,n); if (cd) { result+=cd->name(); @@ -4535,7 +4564,7 @@ QCString normalizeNonTemplateArgumentsInString( pi=i+l; } result+=s.substr(pi); - //printf("normalizeNonTemplateArgumentInString(%s)=%s\n",name.data(),result.data()); + //printf("normalizeNonTemplateArgumentInString(%s)=%s\n",qPrint(name),qPrint(result)); return removeRedundantWhiteSpace(result); } @@ -4547,16 +4576,17 @@ QCString normalizeNonTemplateArgumentsInString( * prevent recursive substitution. */ QCString substituteTemplateArgumentsInString( - const std::string &name, + const QCString &nm, const ArgumentList &formalArgs, const std::unique_ptr<ArgumentList> &actualArgs) { //printf("substituteTemplateArgumentsInString(name=%s formal=%s actualArg=%s)\n", - // name.data(),argListToString(formalArgs).data(),argListToString(actualArgs).data()); - if (formalArgs.empty()) return name; - std::string result; + // qPrint(name),qPrint(argListToString(formalArgs)),qPrint(argListToString(actualArgs))); + if (formalArgs.empty()) return nm; + QCString result; static const reg::Ex re(R"(\a[\w:]*)"); + std::string name = nm.str(); reg::Iterator it(name,re); reg::Iterator end; size_t p=0; @@ -4567,7 +4597,7 @@ QCString substituteTemplateArgumentsInString( size_t i = match.position(); size_t l = match.length(); if (i>p) result += name.substr(p,i-p); - std::string n = match.str(); + QCString n(match.str()); ArgumentList::iterator actIt; if (actualArgs) { @@ -4601,9 +4631,9 @@ QCString substituteTemplateArgumentsInString( if (formArg.type=="class" || formArg.type=="typename" || formArg.type.left(8)=="template") { //printf("n=%s formArg->type='%s' formArg->name='%s' formArg->defval='%s'\n", - // n.data(),formArg->type.data(),formArg->name.data(),formArg->defval.data()); + // qPrint(n),qPrint(formArg->type),qPrint(formArg->name),qPrint(formArg->defval)); //printf(">> n='%s' formArg->name='%s' actArg->type='%s' actArg->name='%s'\n", - // n.data(),formArg.name.data(),actIt!=actualArgs.end() ? actIt->type.data() : "",actIt!=actualArgs.end() ? actIt->name.data() : "" + // qPrint(n),qPrint(formArg.name),actIt!=actualArgs.end() ? qPrint(actIt->type) : "",actIt!=actualArgs.end() ? qPrint(actIt->name) : "" // ); if (formArg.name==n && actualArgs && actIt!=actualArgs->end() && !actArg.type.isEmpty()) // base class is a template argument { @@ -4632,20 +4662,20 @@ QCString substituteTemplateArgumentsInString( else if (formArg.name==n && (actualArgs==nullptr || actIt==actualArgs->end()) && !formArg.defval.isEmpty() && - formArg.defval!=name /* to prevent recursion */ + formArg.defval!=nm /* to prevent recursion */ ) { - result += substituteTemplateArgumentsInString(formArg.defval.str(),formalArgs,actualArgs)+" "; + result += substituteTemplateArgumentsInString(formArg.defval,formalArgs,actualArgs)+" "; found=TRUE; } } else if (formArg.name==n && (actualArgs==nullptr || actIt==actualArgs->end()) && !formArg.defval.isEmpty() && - formArg.defval!=name /* to prevent recursion */ + formArg.defval!=nm /* to prevent recursion */ ) { - result += substituteTemplateArgumentsInString(formArg.defval.str(),formalArgs,actualArgs)+" "; + result += substituteTemplateArgumentsInString(formArg.defval,formalArgs,actualArgs)+" "; found=TRUE; } if (actualArgs && actIt!=actualArgs->end()) @@ -4661,8 +4691,8 @@ QCString substituteTemplateArgumentsInString( } result+=name.substr(p); //printf(" Inheritance relation %s -> %s\n", - // name.data(),result.data()); - return QCString(result).stripWhiteSpace(); + // qPrint(name),qPrint(result)); + return result.stripWhiteSpace(); } @@ -4684,7 +4714,7 @@ QCString stripTemplateSpecifiersFromScope(const QCString &fullName, int l=fullName.length(); while (i!=-1) { - //printf("1:result+=%s\n",fullName.mid(p,i-p).data()); + //printf("1:result+=%s\n",qPrint(fullName.mid(p,i-p))); int e=i+1; int count=1; int round=0; @@ -4707,22 +4737,22 @@ QCString stripTemplateSpecifiersFromScope(const QCString &fullName, // we only do the parent scope, so we stop here if needed result+=fullName.mid(p,i-p); - //printf(" trying %s\n",(result+fullName.mid(i,e-i)).data()); + //printf(" trying %s\n",qPrint(result+fullName.mid(i,e-i))); if (getClass(result+fullName.mid(i,e-i))!=0) { result+=fullName.mid(i,e-i); - //printf(" 2:result+=%s\n",fullName.mid(i,e-i-1).data()); + //printf(" 2:result+=%s\n",qPrint(fullName.mid(i,e-i-1))); } else if (pLastScopeStripped) { - //printf(" last stripped scope '%s'\n",fullName.mid(i,e-i).data()); + //printf(" last stripped scope '%s'\n",qPrint(fullName.mid(i,e-i))); *pLastScopeStripped=fullName.mid(i,e-i); } p=e; i=fullName.find('<',p); } result+=fullName.right(l-p); - //printf("3:result+=%s\n",fullName.right(l-p).data()); + //printf("3:result+=%s\n",qPrint(fullName.right(l-p))); return result; } @@ -4757,7 +4787,7 @@ QCString mergeScopes(const QCString &leftScope,const QCString &rightScope) if (found) return result; // case leftScope=="A" rightScope=="B" => result = "A::B" - result=leftScope.copy(); + result=leftScope; if (!result.isEmpty() && !rightScope.isEmpty()) result+="::"; result+=rightScope; return result; @@ -4811,15 +4841,15 @@ int getScopeFragment(const QCString &s,int p,int *l) } found: *l=sp-p; - //printf("getScopeFragment(%s,%d)=%s\n",s.data(),p,s.mid(p,*l).data()); + //printf("getScopeFragment(%s,%d)=%s\n",qPrint(s),p,qPrint(s.mid(p,*l))); return p; } //---------------------------------------------------------------------------- -PageDef *addRelatedPage(const char *name,const QCString &ptitle, +PageDef *addRelatedPage(const QCString &name,const QCString &ptitle, const QCString &doc, - const char *fileName, + const QCString &fileName, int docLine, int startLine, const RefItemVector &sli, @@ -4837,11 +4867,11 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, if (!xref && !title.isEmpty() && pd->title()!=title) { warn(fileName,startLine,"multiple use of page label '%s', (other occurrence: %s, line: %d)", - name,pd->docFile().data(),pd->getStartBodyLine()); + qPrint(name),qPrint(pd->docFile()),pd->getStartBodyLine()); } // append documentation block to the page. pd->setDocumentation(doc,fileName,docLine); - //printf("Adding page docs '%s' pi=%p name=%s\n",doc.data(),pd,name); + //printf("Adding page docs '%s' pi=%p name=%s\n",qPrint(doc),pd,name); // append (x)refitems to the page. pd->setRefItems(sli); } @@ -4853,7 +4883,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, else if (baseName.right(Doxygen::htmlFileExtension.length())==Doxygen::htmlFileExtension) baseName=baseName.left(baseName.length()-Doxygen::htmlFileExtension.length()); - //printf("Appending page '%s'\n",baseName.data()); + //printf("Appending page '%s'\n",qPrint(baseName)); pd = Doxygen::pageLinkedMap->add(baseName, std::unique_ptr<PageDef>( createPageDef(fileName,docLine,baseName,doc,title))); @@ -4895,11 +4925,11 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, { if (si->lineNr() != -1) { - warn(orgFile,line,"multiple use of section label '%s', (first occurrence: %s, line %d)",pd->name().data(),si->fileName().data(),si->lineNr()); + warn(orgFile,line,"multiple use of section label '%s', (first occurrence: %s, line %d)",qPrint(pd->name()),qPrint(si->fileName()),si->lineNr()); } else { - warn(orgFile,line,"multiple use of section label '%s', (first occurrence: %s)",pd->name().data(),si->fileName().data()); + warn(orgFile,line,"multiple use of section label '%s', (first occurrence: %s)",qPrint(pd->name()),qPrint(si->fileName())); } } else @@ -4907,10 +4937,10 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, SectionManager::instance().add(pd->name(), file,-1,pd->title(),SectionType::Page,0,pd->getReference()); //printf("si->label='%s' si->definition=%s si->fileName='%s'\n", - // si->label.data(),si->definition?si->definition->name().data():"<none>", - // si->fileName.data()); - //printf(" SectionInfo: sec=%p sec->fileName=%s\n",si,si->fileName.data()); - //printf("Adding section key=%s si->fileName=%s\n",pageName.data(),si->fileName.data()); + // qPrint(si->label),si->definition?si->definition->name().data():"<none>", + // qPrint(si->fileName)); + //printf(" SectionInfo: sec=%p sec->fileName=%s\n",si,qPrint(si->fileName)); + //printf("Adding section key=%s si->fileName=%s\n",qPrint(pageName),qPrint(si->fileName)); } } } @@ -4920,11 +4950,11 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, //---------------------------------------------------------------------------- void addRefItem(const RefItemVector &sli, - const char *key, - const char *prefix, const char *name,const char *title,const char *args,const Definition *scope) + const QCString &key, const QCString &prefix, const QCString &name, + const QCString &title, const QCString &args, const Definition *scope) { //printf("addRefItem(sli=%d,key=%s,prefix=%s,name=%s,title=%s,args=%s)\n",(int)sli.size(),key,prefix,name,title,args); - if (key && key[0]!='@') // check for @ to skip anonymous stuff (see bug427012) + if (!key.isEmpty() && key[0]!='@') // check for @ to skip anonymous stuff (see bug427012) { for (RefItem *item : sli) { @@ -4956,7 +4986,7 @@ bool recursivelyAddGroupListToTitle(OutputList &ol,const Definition *d,bool root { ol.writeString(" » "); } - ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),0,gd->groupTitle()); + ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),QCString(),gd->groupTitle()); } if (root) { @@ -4973,12 +5003,12 @@ void addGroupListToTitle(OutputList &ol,const Definition *d) recursivelyAddGroupListToTitle(ol,d,TRUE); } -void filterLatexString(std::ostream &t,const char *str, +void filterLatexString(TextStream &t,const QCString &str, bool insideTabbing,bool insidePre,bool insideItem,bool insideTable,bool keepSpaces) { - if (str==0) return; + if (str.isEmpty()) return; //if (strlen(str)<2) stackTrace(); - const unsigned char *p=(const unsigned char *)str; + const unsigned char *p=(const unsigned char *)str.data(); const unsigned char *q; int cnt; unsigned char c; @@ -5125,12 +5155,12 @@ void filterLatexString(std::ostream &t,const char *str, } } -QCString latexEscapeLabelName(const char *s) +QCString latexEscapeLabelName(const QCString &s) { - if (s==0) return ""; - QCString tmp(qstrlen(s)+1); - std::ostringstream t(std::ios_base::ate); - const char *p=s; + if (s.isEmpty()) return s; + QCString tmp(s.length()+1); + TextStream t; + const char *p=s.data(); char c; int i; while ((c=*p++)) @@ -5168,12 +5198,12 @@ QCString latexEscapeLabelName(const char *s) return t.str(); } -QCString latexEscapeIndexChars(const char *s) +QCString latexEscapeIndexChars(const QCString &s) { - if (s==0) return ""; - QCString tmp(qstrlen(s)+1); - std::ostringstream t(std::ios_base::ate); - const char *p=s; + if (s.isEmpty()) return s; + QCString tmp(s.length()+1); + TextStream t; + const char *p=s.data(); char c; int i; while ((c=*p++)) @@ -5199,7 +5229,7 @@ QCString latexEscapeIndexChars(const char *s) p++; } tmp[i]=0; - filterLatexString(t,tmp.data(), + filterLatexString(t,tmp, true, // insideTabbing false, // insidePre false, // insideItem @@ -5212,11 +5242,11 @@ QCString latexEscapeIndexChars(const char *s) return t.str(); } -QCString latexEscapePDFString(const char *s) +QCString latexEscapePDFString(const QCString &s) { - if (s==0) return ""; - std::ostringstream t(std::ios_base::ate); - const char *p=s; + if (s.isEmpty()) return s; + TextStream t; + const char *p=s.data(); char c; while ((c=*p++)) { @@ -5236,11 +5266,11 @@ QCString latexEscapePDFString(const char *s) return t.str(); } -QCString latexFilterURL(const char *s) +QCString latexFilterURL(const QCString &s) { - if (s==0) return ""; - std::ostringstream t(std::ios_base::ate); - const signed char *p=(const signed char*)s; + if (s.isEmpty()) return s; + TextStream t; + const signed char *p=(const signed char*)s.data(); char c; while ((c=*p++)) { @@ -5269,7 +5299,7 @@ static std::mutex g_rtfFormatMutex; static std::unordered_map<std::string,std::string> g_tagMap; static QCString g_nextTag( "AAAAAAAAAA" ); -QCString rtfFormatBmkStr(const char *name) +QCString rtfFormatBmkStr(const QCString &name) { std::lock_guard<std::mutex> lock(g_rtfFormatMutex); @@ -5278,7 +5308,7 @@ QCString rtfFormatBmkStr(const char *name) // supplied, and keep track of the correspondence // between names and strings. QCString tag = g_nextTag; - auto result = g_tagMap.insert( std::make_pair(name, g_nextTag) ); + auto result = g_tagMap.insert( std::make_pair(name.str(), g_nextTag.str()) ); if (result.second) // new item was added { @@ -5299,7 +5329,7 @@ QCString rtfFormatBmkStr(const char *name) } } - //printf("Name = %s RTF_tag = %s\n",name,(*tag).data()); + //printf("Name = %s RTF_tag = %s\n",name,qPrint(*tag))); return tag; } @@ -5308,28 +5338,27 @@ bool checkExtension(const char *fName, const char *ext) return (QCString(fName).right(QCString(ext).length())==ext); } -QCString addHtmlExtensionIfMissing(const char *fName) +QCString addHtmlExtensionIfMissing(const QCString &fName) { - if (fName==0) return fName; - const char *p = strchr(fName,'.'); - if (p==nullptr) // no extension + if (fName.isEmpty()) return fName; + if (fName.find('.')==-1) // no extension { return QCString(fName)+Doxygen::htmlFileExtension; } return fName; } -QCString stripExtensionGeneral(const char *fName, const char *ext) +QCString stripExtensionGeneral(const QCString &fName, const QCString &ext) { QCString result=fName; - if (result.right(QCString(ext).length())==QCString(ext)) + if (result.right(ext.length())==ext) { - result=result.left(result.length()-QCString(ext).length()); + result=result.left(result.length()-ext.length()); } return result; } -QCString stripExtension(const char *fName) +QCString stripExtension(const QCString &fName) { return stripExtensionGeneral(fName, Doxygen::htmlFileExtension); } @@ -5341,10 +5370,10 @@ void replaceNamespaceAliases(QCString &scope,int i) QCString ns = scope.left(i); if (!ns.isEmpty()) { - auto it = Doxygen::namespaceAliasMap.find(ns.data()); + auto it = Doxygen::namespaceAliasMap.find(ns.str()); if (it!=Doxygen::namespaceAliasMap.end()) { - scope=it->second.data()+scope.right(scope.length()-i); + scope=QCString(it->second)+scope.right(scope.length()-i); i=static_cast<int>(it->second.length()); } } @@ -5352,7 +5381,7 @@ void replaceNamespaceAliases(QCString &scope,int i) } } -QCString stripPath(const char *s) +QCString stripPath(const QCString &s) { QCString result=s; int i=result.findRev('/'); @@ -5369,11 +5398,11 @@ QCString stripPath(const char *s) } /** returns \c TRUE iff string \a s contains word \a w */ -bool containsWord(const char *str,const char *word) +bool containsWord(const QCString &str,const char *word) { - if (str==0 || word==0) return false; + if (str.isEmpty() || word==0) return false; static const reg::Ex re(R"(\a+)"); - std::string s = str; + std::string s = str.str(); for (reg::Iterator it(s,re) ; it!=reg::Iterator() ; ++it) { if (it->str()==word) return true; @@ -5430,8 +5459,8 @@ bool findAndRemoveWord(QCString &sentence,const char *word) */ QCString stripLeadingAndTrailingEmptyLines(const QCString &s,int &docLine) { + if (s.isEmpty()) return QCString(); const char *p = s.data(); - if (p==0) return 0; // search for leading empty lines int i=0,li=-1,l=s.length(); @@ -5462,8 +5491,8 @@ QCString stripLeadingAndTrailingEmptyLines(const QCString &s,int &docLine) // return substring if (bi==-1) bi=l; if (li==-1) li=0; - if (bi<=li) return 0; // only empty lines - //printf("docLine='%s' len=%d li=%d bi=%d\n",s.data(),s.length(),li,bi); + if (bi<=li) return QCString(); // only empty lines + //printf("docLine='%s' len=%d li=%d bi=%d\n",qPrint(s),s.length(),li,bi); return s.mid(li,bi-li); } @@ -5523,17 +5552,17 @@ bool updateLanguageMapping(const QCString &extension,const QCString &language) { g_extLookup.erase(it); // language was already register for this ext } - //printf("registering extension %s\n",extName.data()); - g_extLookup.insert(std::make_pair(extName,parserId)); + //printf("registering extension %s\n",qPrint(extName)); + g_extLookup.insert(std::make_pair(extName.str(),parserId)); if (!Doxygen::parserManager->registerExtension(extName,p->parserName)) { err("Failed to assign extension %s to parser %s for language %s\n", - extName.data(),p->parserName,language.data()); + extName.data(),p->parserName,qPrint(language)); } else { //msg("Registered extension %s to language parser %s...\n", - // extName.data(),language.data()); + // extName.data(),qPrint(language)); } return TRUE; } @@ -5617,10 +5646,10 @@ SrcLangExt getLanguageFromFileName(const QCString& fileName) auto it = g_extLookup.find(extName.str()); if (it!=g_extLookup.end()) // listed extension { - //printf("getLanguageFromFileName(%s)=%x\n",fi.extension().data(),*pVal); + //printf("getLanguageFromFileName(%s)=%x\n",qPrint(fi.extension()),*pVal); return (SrcLangExt)it->second; } - //printf("getLanguageFromFileName(%s) not found!\n",fileName.data()); + //printf("getLanguageFromFileName(%s) not found!\n",qPrint(fileName)); return SrcLangExt_Cpp; // not listed => assume C-ish language. } @@ -5635,7 +5664,7 @@ QCString getFileNameExtension(QCString fn) //-------------------------------------------------------------------------- static MemberDef *getMemberFromSymbol(const Definition *scope,const FileDef *fileScope, - const char *n) + const QCString &n) { if (scope==0 || (scope->definitionType()!=Definition::TypeClass && @@ -5663,7 +5692,7 @@ static MemberDef *getMemberFromSymbol(const Definition *scope,const FileDef *fil replaceNamespaceAliases(explicitScopePart,explicitScopePart.length()); name = name.mid(qualifierIndex+2); } - //printf("explicitScopePart=%s\n",explicitScopePart.data()); + //printf("explicitScopePart=%s\n",qPrint(explicitScopePart)); int minDistance = 10000; MemberDef *bestMatch = 0; @@ -5679,7 +5708,7 @@ static MemberDef *getMemberFromSymbol(const Definition *scope,const FileDef *fil { minDistance = distance; bestMatch = toMemberDef(d); - //printf("new best match %s distance=%d\n",bestMatch->qualifiedName().data(),distance); + //printf("new best match %s distance=%d\n",qPrint(bestMatch->qualifiedName()),distance); } } } @@ -5687,7 +5716,7 @@ static MemberDef *getMemberFromSymbol(const Definition *scope,const FileDef *fil } /*! Returns true iff the given name string appears to be a typedef in scope. */ -bool checkIfTypedef(const Definition *scope,const FileDef *fileScope,const char *n) +bool checkIfTypedef(const Definition *scope,const FileDef *fileScope,const QCString &n) { MemberDef *bestMatch = getMemberFromSymbol(scope,fileScope,n); @@ -5745,11 +5774,11 @@ QCString parseCommentAsText(const Definition *scope,const MemberDef *md, const QCString &doc,const QCString &fileName,int lineNr) { if (doc.isEmpty()) return ""; - //printf("parseCommentAsText(%s)\n",doc.data()); - std::ostringstream t(std::ios_base::ate); + //printf("parseCommentAsText(%s)\n",qPrint(doc)); + TextStream t; DocNode *root = validatingParseDoc(fileName,lineNr, (Definition*)scope,(MemberDef*)md,doc,FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); TextDocVisitor *visitor = new TextDocVisitor(t); root->accept(visitor); delete visitor; @@ -5785,7 +5814,7 @@ QCString parseCommentAsText(const Definition *scope,const MemberDef *md, //-------------------------------------------------------------------------------------- static QCString expandAliasRec(StringUnorderedSet &aliasesProcessed, - const std::string &s,bool allowRecursion=FALSE); + const QCString &s,bool allowRecursion=FALSE); struct Marker { @@ -5830,7 +5859,7 @@ static int findEndOfCommand(const char *s) static QCString replaceAliasArguments(StringUnorderedSet &aliasesProcessed, const QCString &aliasValue,const QCString &argList) { - //printf("----- replaceAliasArguments(val=[%s],args=[%s])\n",aliasValue.data(),argList.data()); + //printf("----- replaceAliasArguments(val=[%s],args=[%s])\n",qPrint(aliasValue),qPrint(argList)); // first make a list of arguments from the comma separated argument list std::vector<QCString> args; @@ -5868,7 +5897,7 @@ static QCString replaceAliasArguments(StringUnorderedSet &aliasesProcessed, insideMarkerId = false; int markerLen = i-markerStart; markerList.push_back(Marker(markerStart-1, - atoi(aliasValue.mid(markerStart,markerLen)), + aliasValue.mid(markerStart,markerLen).toInt(), markerLen+1)); } if (c=='\\' && (pc=='@' || pc=='\\')) // found escaped backslash @@ -5894,29 +5923,30 @@ static QCString replaceAliasArguments(StringUnorderedSet &aliasesProcessed, { const Marker &m = markerList.at(i); result+=aliasValue.mid(p,m.pos-p); - //printf("part before marker %d: '%s'\n",i,aliasValue.mid(p,m->pos-p).data()); + //printf("part before marker %d: '%s'\n",i,qPrint(aliasValue.mid(p,m->pos-p))); if (m.number>0 && m.number<=(int)args.size()) // valid number { - result+=expandAliasRec(aliasesProcessed,args.at(m.number-1).str(),TRUE); + result+=expandAliasRec(aliasesProcessed,args.at(m.number-1),TRUE); //printf("marker index=%d pos=%d number=%d size=%d replacement %s\n",i,m->pos,m->number,m->size, - // args.at(m->number-1)->data()); + // qPrint(args.at(m->number-1))); } p=m.pos+m.size; // continue after the marker } result+=aliasValue.right(l-p); // append remainder - //printf("string after replacement of markers: '%s'\n",result.data()); + //printf("string after replacement of markers: '%s'\n",qPrint(result)); // expand the result again result = substitute(result,"\\{","{"); result = substitute(result,"\\}","}"); - result = expandAliasRec(aliasesProcessed,substitute(result,"\\,",",").str()); + result = expandAliasRec(aliasesProcessed,substitute(result,"\\,",",")); return result; } static QCString escapeCommas(const QCString &s) { - std::ostringstream result(std::ios_base::ate); + if (s.isEmpty()) return s; + TextStream result; const char *p = s.data(); char c,pc=0; while ((c=*p++)) @@ -5931,24 +5961,23 @@ static QCString escapeCommas(const QCString &s) } pc=c; } - //printf("escapeCommas: '%s'->'%s'\n",s.data(),result.data()); + //printf("escapeCommas: '%s'->'%s'\n",qPrint(s),qPrint(result)); return result.str(); } -static QCString expandAliasRec(StringUnorderedSet &aliasesProcessed,const std::string &s,bool allowRecursion) +static QCString expandAliasRec(StringUnorderedSet &aliasesProcessed,const QCString &s,bool allowRecursion) { - std::string result; + QCString result; static const reg::Ex re(R"([\\@](\a\w*))"); - reg::Iterator re_it(s,re); - reg::Iterator end; - - int p = 0; - for ( ; re_it!=end ; ++re_it) + std::string str = s.str(); + reg::Match match; + size_t p = 0; + while (search(str,match,re,p)) { - const auto &match = *re_it; - int i = (int)match.position(); - int l = (int)match.length(); - if (i>p) result+=s.substr(p,i-p); + size_t i = match.position(); + size_t l = match.length(); + if (i>p) result+=s.mid(p,i-p); + QCString args = extractAliasArgs(s,i+l); bool hasArgs = !args.isEmpty(); // found directly after command int argsLen = args.length(); @@ -5961,7 +5990,6 @@ static QCString expandAliasRec(StringUnorderedSet &aliasesProcessed,const std::s cmd += QCString().sprintf("{%d}",numArgs); // alias name + {n} } auto it = Doxygen::aliasMap.find(cmd.str()); - if (numArgs>1 && it==Doxygen::aliasMap.end()) { // in case there is no command with numArgs parameters, but there is a command with 1 parameter, // we also accept all text as the argument of that command (so you don't have to escape commas) @@ -5973,20 +6001,20 @@ static QCString expandAliasRec(StringUnorderedSet &aliasesProcessed,const std::s } } //printf("Found command s='%s' cmd='%s' numArgs=%d args='%s' aliasText=%s\n", - // s.data(),cmd.data(),numArgs,args.data(),it!=Doxygen::aliasMap.end()?it->second.c_str():"<none>"); + // s.data(),cmd.data(),numArgs,args.data(),aliasText?aliasText->data():"<none>"); if ((allowRecursion || aliasesProcessed.find(cmd.str())==aliasesProcessed.end()) && it!=Doxygen::aliasMap.end()) // expand the alias { //printf("is an alias!\n"); if (!allowRecursion) aliasesProcessed.insert(cmd.str()); - QCString val = it->second; + QCString val(it->second); if (hasArgs) { val = replaceAliasArguments(aliasesProcessed,val,args); //printf("replace '%s'->'%s' args='%s'\n", // aliasText->data(),val.data(),args.data()); } - result+=expandAliasRec(aliasesProcessed,val.str()).str(); + result+=expandAliasRec(aliasesProcessed,val); if (!allowRecursion) aliasesProcessed.erase(cmd.str()); p=i+l; if (hasArgs) p+=argsLen+2; @@ -5998,14 +6026,14 @@ static QCString expandAliasRec(StringUnorderedSet &aliasesProcessed,const std::s p=i+l; } } - result+=s.substr(p); + result+=s.right(s.length()-p); //printf("expandAliases '%s'->'%s'\n",s.data(),result.data()); return result; } -int countAliasArguments(const QCString argList) +int countAliasArguments(const QCString &argList) { int count=1; int l = argList.length(); @@ -6046,7 +6074,7 @@ QCString extractAliasArgs(const QCString &args,int pos) if (bc==0) { - //printf("extractAliasArgs('%s')->'%s'\n",args.data(),args.mid(pos+1,i-pos-1).data()); + //printf("extractAliasArgs('%s')->'%s'\n",qPrint(args),qPrint(args.mid(pos+1,i-pos-1))); return args.mid(pos+1,i-pos-1); } } @@ -6054,13 +6082,13 @@ QCString extractAliasArgs(const QCString &args,int pos) return ""; } -QCString resolveAliasCmd(const QCString aliasCmd) +QCString resolveAliasCmd(const QCString &aliasCmd) { QCString result; StringUnorderedSet aliasesProcessed; - //printf("Expanding: '%s'\n",aliasCmd.data()); - result = expandAliasRec(aliasesProcessed,aliasCmd.str()); - //printf("Expanding result: '%s'->'%s'\n",aliasCmd.data(),result.data()); + //printf("Expanding: '%s'\n",qPrint(aliasCmd)); + result = expandAliasRec(aliasesProcessed,aliasCmd); + //printf("Expanding result: '%s'->'%s'\n",qPrint(aliasCmd),qPrint(result)); return result; } @@ -6071,9 +6099,9 @@ std::string expandAlias(const std::string &aliasName,const std::string &aliasVal // avoid expanding this command recursively aliasesProcessed.insert(aliasName); // expand embedded commands - //printf("Expanding: '%s'->'%s'\n",aliasName.data(),aliasValue.data()); + //printf("Expanding: '%s'->'%s'\n",qPrint(aliasName),qPrint(aliasValue)); result = expandAliasRec(aliasesProcessed,aliasValue.c_str()); - //printf("Expanding result: '%s'->'%s'\n",aliasName.data(),result.data()); + //printf("Expanding result: '%s'->'%s'\n",qPrint(aliasName),qPrint(result)); return result.str(); } @@ -6091,7 +6119,7 @@ void writeTypeConstraints(OutputList &ol,const Definition *d,const ArgumentList ol.endConstraintType(); ol.startConstraintDocs(); ol.generateDoc(d->docFile(),d->docLine(),d,0,a.docs,TRUE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endConstraintDocs(); } ol.endConstraintList(); @@ -6126,23 +6154,23 @@ void stackTrace() #endif } -static int transcodeCharacterBuffer(const char *fileName,BufStr &srcBuf,int size, - const char *inputEncoding,const char *outputEncoding) +static int transcodeCharacterBuffer(const QCString &fileName,BufStr &srcBuf,int size, + const QCString &inputEncoding,const QCString &outputEncoding) { - if (inputEncoding==0 || outputEncoding==0) return size; + if (inputEncoding.isEmpty() || outputEncoding.isEmpty()) return size; if (qstricmp(inputEncoding,outputEncoding)==0) return size; - void *cd = portable_iconv_open(outputEncoding,inputEncoding); + void *cd = portable_iconv_open(outputEncoding.data(),inputEncoding.data()); if (cd==(void *)(-1)) { term("unsupported character conversion: '%s'->'%s': %s\n" "Check the INPUT_ENCODING setting in the config file!\n", - inputEncoding,outputEncoding,strerror(errno)); + qPrint(inputEncoding),qPrint(outputEncoding),strerror(errno)); } int tmpBufSize=size*4+1; BufStr tmpBuf(tmpBufSize); size_t iLeft=size; size_t oLeft=tmpBufSize; - char *srcPtr = srcBuf.data(); + const char *srcPtr = srcBuf.data(); char *dstPtr = tmpBuf.data(); uint newSize=0; if (!portable_iconv(cd, &srcPtr, &iLeft, &dstPtr, &oLeft)) @@ -6150,32 +6178,32 @@ static int transcodeCharacterBuffer(const char *fileName,BufStr &srcBuf,int size newSize = tmpBufSize-(int)oLeft; srcBuf.shrink(newSize); strncpy(srcBuf.data(),tmpBuf.data(),newSize); - //printf("iconv: input size=%d output size=%d\n[%s]\n",size,newSize,srcBuf.data()); + //printf("iconv: input size=%d output size=%d\n[%s]\n",size,newSize,qPrint(srcBuf)); } else { term("%s: failed to translate characters from %s to %s: check INPUT_ENCODING\n", - fileName,inputEncoding,outputEncoding); + qPrint(fileName),qPrint(inputEncoding),qPrint(outputEncoding)); } portable_iconv_close(cd); return newSize; } //! read a file name \a fileName and optionally filter and transcode it -bool readInputFile(const char *fileName,BufStr &inBuf,bool filter,bool isSourceCode) +bool readInputFile(const QCString &fileName,BufStr &inBuf,bool filter,bool isSourceCode) { // try to open file int size=0; - FileInfo fi(fileName); + FileInfo fi(fileName.str()); if (!fi.exists()) return FALSE; QCString filterName = getFileFilter(fileName,isSourceCode); if (filterName.isEmpty() || !filter) { - std::ifstream f(fileName,std::ifstream::in | std::ifstream::binary); + std::ifstream f(fileName.str(),std::ifstream::in | std::ifstream::binary); if (!f.is_open()) { - err("could not open file %s\n",fileName); + err("could not open file %s\n",qPrint(fileName)); return FALSE; } size=(int)fi.size(); @@ -6184,7 +6212,7 @@ bool readInputFile(const char *fileName,BufStr &inBuf,bool filter,bool isSourceC f.read(inBuf.data(),size); if (f.fail()) { - err("problems while reading file %s\n",fileName); + err("problems while reading file %s\n",qPrint(fileName)); return FALSE; } } @@ -6195,7 +6223,7 @@ bool readInputFile(const char *fileName,BufStr &inBuf,bool filter,bool isSourceC FILE *f=Portable::popen(cmd,"r"); if (!f) { - err("could not execute filter %s\n",filterName.data()); + err("could not execute filter %s\n",qPrint(filterName)); return FALSE; } const int bufSize=1024; @@ -6247,22 +6275,23 @@ bool readInputFile(const char *fileName,BufStr &inBuf,bool filter,bool isSourceC // and translate CR's size=inBuf.curPos()-start; int newSize=filterCRLF(inBuf.data()+start,size); - //printf("filter char at %p size=%d newSize=%d\n",dest.data()+oldPos,size,newSize); + //printf("filter char at %p size=%d newSize=%d\n",qPrint(dest)+oldPos,size,newSize); if (newSize!=size) // we removed chars { inBuf.shrink(newSize); // resize the array - //printf(".......resizing from %d to %d result=[%s]\n",oldPos+size,oldPos+newSize,dest.data()); + //printf(".......resizing from %d to %d result=[%s]\n",oldPos+size,oldPos+newSize,qPrint(dest)); } inBuf.addChar(0); return TRUE; } // Replace %word by word in title -QCString filterTitle(const std::string &title) +QCString filterTitle(const QCString &title) { std::string tf; + std::string t = title.str(); static const reg::Ex re(R"(%[a-z_A-Z]+)"); - reg::Iterator it(title,re); + reg::Iterator it(t,re); reg::Iterator end; size_t p = 0; for (; it!=end ; ++it) @@ -6270,11 +6299,11 @@ QCString filterTitle(const std::string &title) const auto &match = *it; size_t i = match.position(); size_t l = match.length(); - if (i>p) tf+=title.substr(p,i-p); + if (i>p) tf+=t.substr(p,i-p); tf+=match.str().substr(1); // skip % p=i+l; } - tf+=title.substr(p); + tf+=t.substr(p); return tf; } @@ -6319,7 +6348,7 @@ bool patternMatch(const FileInfo &fi,const StringVector &patList) (fn!=afp && fp!=afp && reg::match(afp,re))); if (found) break; //printf("Matching '%s' against pattern '%s' found=%d\n", - // fi->fileName().data(),pattern.data(),found); + // qPrint(fi->fileName()),qPrint(pattern),found); } } } @@ -6366,15 +6395,14 @@ QCString externalRef(const QCString &relPath,const QCString &ref,bool href) /** Writes the intensity only bitmap represented by \a data as an image to * directory \a dir using the colors defined by HTML_COLORSTYLE_*. */ -void writeColoredImgData(const char *dir,ColoredImgDataItem data[]) +void writeColoredImgData(const QCString &dir,ColoredImgDataItem data[]) { static int hue = Config_getInt(HTML_COLORSTYLE_HUE); static int sat = Config_getInt(HTML_COLORSTYLE_SAT); static int gamma = Config_getInt(HTML_COLORSTYLE_GAMMA); while (data->name) { - QCString fileName; - fileName=(QCString)dir+"/"+data->name; + QCString fileName = dir+"/"+data->name; ColoredImage img(data->width,data->height,data->content,data->alpha, sat,hue,gamma); if (!img.save(fileName)) @@ -6391,11 +6419,11 @@ void writeColoredImgData(const char *dir,ColoredImgDataItem data[]) * valid color, based on the intensity represented by hex number AA * and the current HTML_COLORSTYLE_* settings. */ -QCString replaceColorMarkers(const char *str) +QCString replaceColorMarkers(const QCString &str) { - if (str==0) return QCString(); + if (str.isEmpty()) return QCString(); std::string result; - std::string s=str; + std::string s=str.str(); static const reg::Ex re(R"(##[0-9A-Fa-f][0-9A-Fa-f])"); reg::Iterator it(s,re); reg::Iterator end; @@ -6432,7 +6460,7 @@ QCString replaceColorMarkers(const char *str) colStr[5]=hex[blue>>4]; colStr[6]=hex[blue&0xf]; colStr[7]=0; - //printf("replacing %s->%s (level=%d)\n",lumStr.data(),colStr,level); + //printf("replacing %s->%s (level=%d)\n",qPrint(lumStr),colStr,level); result+=colStr; p=i+l; } @@ -6447,7 +6475,7 @@ bool copyFile(const QCString &src,const QCString &dest) { if (!Dir().copy(src.str(),dest.str())) { - err("could not copy file %s to %s\n",src.data(),dest.data()); + err("could not copy file %s to %s\n",qPrint(src),qPrint(dest)); return false; } return true; @@ -6457,7 +6485,7 @@ bool copyFile(const QCString &src,const QCString &dest) * Full lines are returned, excluding the lines on which the markers appear. * \sa routine lineBlock */ -QCString extractBlock(const QCString text,const QCString marker) +QCString extractBlock(const QCString &text,const QCString &marker) { QCString result; int p=0,i; @@ -6495,14 +6523,14 @@ QCString extractBlock(const QCString text,const QCString marker) { l2=lp; } - //printf("text=[%s]\n",text.mid(l1,l2-l1).data()); + //printf("text=[%s]\n",qPrint(text.mid(l1,l2-l1))); return l2>l1 ? text.mid(l1,l2-l1) : QCString(); } /** Returns the line number of the line following the line with the marker. * \sa routine extractBlock */ -int lineBlock(const QCString text,const QCString marker) +int lineBlock(const QCString &text,const QCString &marker) { int result = 1; int p=0,i; @@ -6605,7 +6633,7 @@ QCString stripIndentation(const QCString &s) { if (s.isEmpty()) return s; // empty string -> we're done - //printf("stripIndentation:\n%s\n------\n",s.data()); + //printf("stripIndentation:\n%s\n------\n",qPrint(s)); // compute minimum indentation over all lines const char *p=s.data(); char c; @@ -6629,7 +6657,7 @@ QCString stripIndentation(const QCString &s) if (minIndent==0) return s; // remove minimum indentation for each line - std::ostringstream result(std::ios_base::ate); + TextStream result; p=s.data(); indent=0; while ((c=*p++)) @@ -6712,7 +6740,7 @@ void stripIndentation(QCString &doc,const int indentationLevel) break; } } - doc.resize(dst-doc.data()+1); + doc.resize(static_cast<uint>(dst-doc.data())+1); } @@ -6813,14 +6841,34 @@ bool namespaceHasNestedNamespace(const NamespaceDef *nd) return false; } +bool namespaceHasNestedConcept(const NamespaceDef *nd) +{ + for (const auto &cnd : nd->getNamespaces()) + { + if (namespaceHasNestedConcept(cnd)) + { + //printf("<namespaceHasVisibleChild(%s,includeClasses=%d): case2\n",qPrint(nd->name()),includeClasses); + return true; + } + } + for (const auto &cnd : nd->getConcepts()) + { + if (cnd->isLinkableInProject()) + { + return true; + } + } + return false; +} + bool namespaceHasNestedClass(const NamespaceDef *nd,bool filterClasses,ClassDef::CompoundType ct) { - //printf(">namespaceHasVisibleChild(%s,includeClasses=%d)\n",nd->name().data(),includeClasses); + //printf(">namespaceHasVisibleChild(%s,includeClasses=%d)\n",qPrint(nd->name()),includeClasses); for (const auto &cnd : nd->getNamespaces()) { if (namespaceHasNestedClass(cnd,filterClasses,ct)) { - //printf("<namespaceHasVisibleChild(%s,includeClasses=%d): case2\n",nd->name().data(),includeClasses); + //printf("<namespaceHasVisibleChild(%s,includeClasses=%d): case2\n",qPrint(nd->name()),includeClasses); return TRUE; } } @@ -6846,7 +6894,7 @@ bool namespaceHasNestedClass(const NamespaceDef *nd,bool filterClasses,ClassDef: { if (cd->isLinkableInProject() && cd->templateMaster()==0) { - //printf("<namespaceHasVisibleChild(%s,includeClasses=%d): case3\n",nd->name().data(),includeClasses); + //printf("<namespaceHasVisibleChild(%s,includeClasses=%d): case3\n",qPrint(nd->name()),includeClasses); return TRUE; } } @@ -7105,10 +7153,11 @@ QCString getDotImageExtension() return i==-1 ? imgExt : imgExt.left(i); } -bool openOutputFile(const char *outFile,std::ofstream &f) +bool openOutputFile(const QCString &outFile,std::ofstream &f) { + assert(!f.is_open()); bool fileOpened=FALSE; - bool writeToStdout=(outFile[0]=='-' && outFile[1]=='\0'); + bool writeToStdout=outFile=="-"; if (writeToStdout) // write to stdout { f.basic_ios<char>::rdbuf(std::cout.rdbuf()); @@ -7116,7 +7165,7 @@ bool openOutputFile(const char *outFile,std::ofstream &f) } else // write to file { - FileInfo fi(outFile); + FileInfo fi(outFile.str()); if (fi.exists()) // create a backup { Dir dir; @@ -7125,13 +7174,13 @@ bool openOutputFile(const char *outFile,std::ofstream &f) dir.remove(backup.fileName()); dir.rename(fi.fileName(),fi.fileName()+".bak"); } - f.open(outFile,std::ofstream::out | std::ofstream::binary); + f.open(outFile.str(),std::ofstream::out | std::ofstream::binary); fileOpened = f.is_open(); } return fileOpened; } -void writeExtraLatexPackages(std::ostream &t) +void writeExtraLatexPackages(TextStream &t) { // User-specified packages const StringVector &extraPackages = Config_getList(EXTRA_PACKAGES); @@ -7149,7 +7198,7 @@ void writeExtraLatexPackages(std::ostream &t) } } -void writeLatexSpecialFormulaChars(std::ostream &t) +void writeLatexSpecialFormulaChars(TextStream &t) { unsigned char minus[4]; // Superscript minus char *pminus = (char *)minus; @@ -7177,7 +7226,7 @@ void writeLatexSpecialFormulaChars(std::ostream &t) //------------------------------------------------------ // simplified way to know if this is fixed form -bool recognizeFixedForm(const char* contents, FortranFormat format) +bool recognizeFixedForm(const QCString &contents, FortranFormat format) { int column=0; bool skipLine=FALSE; @@ -7185,10 +7234,12 @@ bool recognizeFixedForm(const char* contents, FortranFormat format) if (format == FortranFormat_Fixed) return TRUE; if (format == FortranFormat_Free) return FALSE; - for(int i=0;;i++) { + for (int i=0;;i++) + { column++; - switch(contents[i]) { + switch(contents[i]) + { case '\n': column=0; skipLine=FALSE; @@ -7222,7 +7273,7 @@ bool recognizeFixedForm(const char* contents, FortranFormat format) FortranFormat convertFileNameFortranParserCode(QCString fn) { QCString ext = getFileNameExtension(fn); - QCString parserName = Doxygen::parserManager->getParserName(ext.data()); + QCString parserName = Doxygen::parserManager->getParserName(ext); if (parserName == "fortranfixed") return FortranFormat_Fixed; else if (parserName == "fortranfree") return FortranFormat_Free; @@ -7232,18 +7283,18 @@ FortranFormat convertFileNameFortranParserCode(QCString fn) //------------------------------------------------------------------------ /// Clear a text block \a s from \a begin to \a end markers -QCString clearBlock(const char *s,const char *begin,const char *end) +QCString clearBlock(const QCString &s,const QCString &begin,const QCString &end) { - if (s==0 || begin==0 || end==0) return s; + if (s.isEmpty() || begin.isEmpty() || end.isEmpty()) return s; const char *p, *q; - int beginLen = qstrlen(begin); - int endLen = qstrlen(end); + int beginLen = (int)begin.length(); + int endLen = (int)end.length(); int resLen = 0; - for (p=s; (q=strstr(p,begin))!=0; p=q+endLen) + for (p=s.data(); (q=strstr(p,begin.data()))!=0; p=q+endLen) { resLen+=(int)(q-p); p=q+beginLen; - if ((q=strstr(p,end))==0) + if ((q=strstr(p,end.data()))==0) { resLen+=beginLen; break; @@ -7254,15 +7305,15 @@ QCString clearBlock(const char *s,const char *begin,const char *end) QCString result(resLen+1); char *r; - for (r=result.rawData(), p=s; (q=strstr(p,begin))!=0; p=q+endLen) + for (r=result.rawData(), p=s.data(); (q=strstr(p,begin.data()))!=0; p=q+endLen) { int l = (int)(q-p); memcpy(r,p,l); r+=l; p=q+beginLen; - if ((q=strstr(p,end))==0) + if ((q=strstr(p,end.data()))==0) { - memcpy(r,begin,beginLen); + memcpy(r,begin.data(),beginLen); r+=beginLen; break; } @@ -7340,7 +7391,7 @@ QCString removeEmptyLines(const QCString &s) } } out.addChar('\0'); - //printf("removeEmptyLines(%s)=%s\n",s.data(),out.data()); + //printf("removeEmptyLines(%s)=%s\n",qPrint(s),qPrint(out)); return out.data(); } @@ -7410,3 +7461,40 @@ std::string join(const StringVector &sv,const std::string &delimiter) return result; } +QCString integerToAlpha(int n, bool upper) +{ + QCString result; + int residual = n; + + char modVal[2]; + modVal[1] = 0; + while (residual > 0) + { + modVal[0] = (upper ? 'A': 'a') + (residual-1)%26; + result = modVal + result; + residual = (residual-1) / 26; + } + return result; +} + +QCString integerToRoman(int n, bool upper) +{ + static const char *str_romans_upper[] = { "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" }; + static const char *str_romans_lower[] = { "m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix", "v", "iv", "i" }; + static const int values[] = { 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 }; + static const char **str_romans = upper ? str_romans_upper : str_romans_lower; + + QCString result; + int residual = n; + + for (int i = 0; i < 13; ++i) + { + while (residual - values[i] >= 0) + { + result += str_romans[i]; + residual -= values[i]; + } + } + + return result; +} @@ -36,6 +36,7 @@ #include "outputgen.h" #include "regex.h" #include "dir.h" +#include "conceptdef.h" //-------------------------------------------------------------------- @@ -63,10 +64,10 @@ class TextGeneratorIntf { public: virtual ~TextGeneratorIntf() {} - virtual void writeString(const char *,bool) const = 0; + virtual void writeString(const QCString &,bool) const = 0; virtual void writeBreak(int indent) const = 0; - virtual void writeLink(const char *extRef,const char *file, - const char *anchor,const char *text + virtual void writeLink(const QCString &extRef,const QCString &file, + const QCString &anchor,const QCString &text ) const = 0; }; @@ -76,10 +77,10 @@ class TextGeneratorOLImpl : public TextGeneratorIntf public: virtual ~TextGeneratorOLImpl() {} TextGeneratorOLImpl(OutputDocInterface &od); - void writeString(const char *s,bool keepSpaces) const; + void writeString(const QCString &s,bool keepSpaces) const; void writeBreak(int indent) const; - void writeLink(const char *extRef,const char *file, - const char *anchor,const char *text + void writeLink(const QCString &extRef,const QCString &file, + const QCString &anchor,const QCString &text ) const; private: OutputDocInterface &m_od; @@ -96,20 +97,20 @@ void linkifyText(const TextGeneratorIntf &ol, const Definition *scope, const FileDef *fileScope, const Definition *self, - const char *text, + const QCString &text, bool autoBreak=FALSE, bool external=TRUE, bool keepSpaces=FALSE, int indentLevel=0 ); -QCString fileToString(const char *name,bool filter=FALSE,bool isSourceCode=FALSE); +QCString fileToString(const QCString &name,bool filter=FALSE,bool isSourceCode=FALSE); QCString dateToString(bool); bool getDefs(const QCString &scopeName, const QCString &memberName, - const char *, + const QCString &args, const MemberDef *&md, const ClassDef *&cd, const FileDef *&fd, @@ -120,10 +121,10 @@ bool getDefs(const QCString &scopeName, bool checkCV=FALSE ); -QCString getFileFilter(const char* name,bool isSourceCode); +QCString getFileFilter(const QCString &name,bool isSourceCode); -bool resolveRef(/* in */ const char *scName, - /* in */ const char *name, +bool resolveRef(/* in */ const QCString &scName, + /* in */ const QCString &name, /* in */ bool inSeeBlock, /* out */ const Definition **resContext, /* out */ const MemberDef **resMember, @@ -132,8 +133,8 @@ bool resolveRef(/* in */ const char *scName, /* in */ bool checkScope = FALSE ); -bool resolveLink(/* in */ const char *scName, - /* in */ const char *lr, +bool resolveLink(/* in */ const QCString &scName, + /* in */ const QCString &lr, /* in */ bool inSeeBlock, /* out */ const Definition **resContext, /* out */ QCString &resAnchor @@ -142,13 +143,13 @@ bool resolveLink(/* in */ const char *scName, //bool generateRef(OutputDocInterface &od,const char *, // const char *,bool inSeeBlock,const char * =0); -bool generateLink(OutputDocInterface &od,const char *, - const char *,bool inSeeBlock,const char *); +bool generateLink(OutputDocInterface &od,const QCString &, + const QCString &,bool inSeeBlock,const QCString &); -void generateFileRef(OutputDocInterface &od,const char *, - const char *linkTxt=0); +void generateFileRef(OutputDocInterface &od,const QCString &, + const QCString &linkTxt=QCString()); -void writePageRef(OutputDocInterface &od,const char *cn,const char *mn); +void writePageRef(OutputDocInterface &od,const QCString &cn,const QCString &mn); QCString getCanonicalTemplateSpec(const Definition *d,const FileDef *fs,const QCString& spec); @@ -166,31 +167,39 @@ QCString clearBlock(const char *s,const char *begin,const char *end); QCString selectBlock(const QCString& s,const QCString &name,bool enable, OutputGenerator::OutputType o); QCString removeEmptyLines(const QCString &s); -QCString resolveDefines(const char *n); - -ClassDef *getClass(const char *key); -inline ClassDefMutable *getClassMutable(const char *key) +ClassDef *getClass(const QCString &key); +inline ClassDefMutable *getClassMutable(const QCString &key) { return toClassDefMutable(getClass(key)); } +ConceptDef *getConcept(const QCString &key); +inline ConceptDefMutable *getConceptMutable(const QCString &key) +{ + return toConceptDefMutable(getConcept(key)); +} +ConceptDef *getResolvedConcept(const Definition *scope,const QCString &name); -NamespaceDef *getResolvedNamespace(const char *key); -inline NamespaceDefMutable *getResolvedNamespaceMutable(const char *key) +NamespaceDef *getResolvedNamespace(const QCString &key); +inline NamespaceDefMutable *getResolvedNamespaceMutable(const QCString &key) { return toNamespaceDefMutable(getResolvedNamespace(key)); } -FileDef *findFileDef(const FileNameLinkedMap *fnMap,const char *n, +FileDef *findFileDef(const FileNameLinkedMap *fnMap,const QCString &n, bool &ambig); -QCString showFileDefMatches(const FileNameLinkedMap *fnMap,const char *n); +QCString showFileDefMatches(const FileNameLinkedMap *fnMap,const QCString &n); -int guessSection(const char *name); +int guessSection(const QCString &name); inline bool isId(int c) { return c=='_' || c>=128 || c<0 || isalnum(c); } +inline bool isIdJS(int c) +{ + return c>=128 || c<0 || isalnum(c); +} QCString removeRedundantWhiteSpace(const QCString &s); @@ -212,25 +221,26 @@ bool rightScopeMatch(const QCString &scope, const QCString &name); bool leftScopeMatch(const QCString &scope, const QCString &name); -QCString substituteKeywords(const QCString &s,const char *title, - const char *projName,const char *projNum,const char *projBrief); +QCString substituteKeywords(const QCString &s,const QCString &title, + const QCString &projName,const QCString &projNum,const QCString &projBrief); int getPrefixIndex(const QCString &name); -QCString removeAnonymousScopes(const char *s); +QCString removeAnonymousScopes(const QCString &s); -QCString replaceAnonymousScopes(const char *s,const char *replacement=0); +QCString replaceAnonymousScopes(const QCString &s,const QCString &replacement=QCString()); bool hasVisibleRoot(const BaseClassList &bcl); bool classHasVisibleChildren(const ClassDef *cd); bool namespaceHasNestedNamespace(const NamespaceDef *nd); +bool namespaceHasNestedConcept(const NamespaceDef *nd); bool namespaceHasNestedClass(const NamespaceDef *nd,bool filterClasses,ClassDef::CompoundType ct); bool classVisibleInIndex(const ClassDef *cd); int minClassDistance(const ClassDef *cd,const ClassDef *bcd,int level=0); Protection classInheritedProtectionLevel(const ClassDef *cd,const ClassDef *bcd,Protection prot=Public,int level=0); -QCString convertNameToFile(const char *name,bool allowDots=FALSE,bool allowUnderscore=FALSE); +QCString convertNameToFile(const QCString &name,bool allowDots=FALSE,bool allowUnderscore=FALSE); void extractNamespaceName(const QCString &scopeName, QCString &className,QCString &namespaceName, @@ -238,22 +248,22 @@ void extractNamespaceName(const QCString &scopeName, QCString insertTemplateSpecifierInScope(const QCString &scope,const QCString &templ); -QCString stripScope(const char *name); +QCString stripScope(const QCString &name); -QCString convertToId(const char *s); -QCString correctId(QCString s); +QCString convertToId(const QCString &s); +QCString correctId(const QCString &s); -QCString convertToHtml(const char *s,bool keepEntities=TRUE); +QCString convertToHtml(const QCString &s,bool keepEntities=TRUE); QCString convertToLaTeX(const QCString &s,bool insideTabbing=FALSE,bool keepSpaces=FALSE); -QCString convertToXML(const char *s, bool keepEntities=FALSE); +QCString convertToXML(const QCString &s, bool keepEntities=FALSE); -QCString convertToDocBook(const char *s); +QCString convertToDocBook(const QCString &s); -QCString convertToJSString(const char *s); +QCString convertToJSString(const QCString &s); -QCString convertToPSString(const char *s); +QCString convertToPSString(const QCString &s); QCString getOverloadDocs(); @@ -261,7 +271,7 @@ void addMembersToMemberGroup(/* in,out */ MemberList *ml, /* in,out */ MemberGroupList *pMemberGroups, /* in */ const Definition *context); -int extractClassNameFromType(const char *type,int &pos, +int extractClassNameFromType(const QCString &type,int &pos, QCString &name,QCString &templSpec,SrcLangExt=SrcLangExt_Unknown); QCString normalizeNonTemplateArgumentsInString( @@ -270,7 +280,7 @@ QCString normalizeNonTemplateArgumentsInString( const ArgumentList &formalArgs); QCString substituteTemplateArgumentsInString( - const std::string &name, + const QCString &name, const ArgumentList &formalArgs, const std::unique_ptr<ArgumentList> &actualArgs); @@ -288,17 +298,17 @@ int getScopeFragment(const QCString &s,int p,int *l); int filterCRLF(char *buf,int len); void addRefItem(const RefItemVector &sli, - const char *key, - const char *prefix, - const char *name, - const char *title, - const char *args, + const QCString &key, + const QCString &prefix, + const QCString &name, + const QCString &title, + const QCString &args, const Definition *scope); -PageDef *addRelatedPage(const char *name, +PageDef *addRelatedPage(const QCString &name, const QCString &ptitle, const QCString &doc, - const char *fileName, + const QCString &fileName, int docLine, int startLine, const RefItemVector &sli = RefItemVector(), @@ -308,34 +318,34 @@ PageDef *addRelatedPage(const char *name, SrcLangExt lang=SrcLangExt_Unknown ); -QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscore=FALSE); -QCString unescapeCharsInString(const char *s); +QCString escapeCharsInString(const QCString &name,bool allowDots,bool allowUnderscore=FALSE); +QCString unescapeCharsInString(const QCString &s); void addGroupListToTitle(OutputList &ol,const Definition *d); -void filterLatexString(std::ostream &t,const char *str, +void filterLatexString(TextStream &t,const QCString &str, bool insideTabbing, bool insidePre, bool insideItem, bool insideTable, bool keepSpaces); -QCString latexEscapeLabelName(const char *s); -QCString latexEscapeIndexChars(const char *s); -QCString latexEscapePDFString(const char *s); -QCString latexFilterURL(const char *s); +QCString latexEscapeLabelName(const QCString &s); +QCString latexEscapeIndexChars(const QCString &s); +QCString latexEscapePDFString(const QCString &s); +QCString latexFilterURL(const QCString &s); -QCString rtfFormatBmkStr(const char *name); +QCString rtfFormatBmkStr(const QCString &name); -QCString linkToText(SrcLangExt lang,const char *link,bool isFileName); +QCString linkToText(SrcLangExt lang,const QCString &link,bool isFileName); bool checkExtension(const char *fName, const char *ext); -QCString addHtmlExtensionIfMissing(const char *fName); +QCString addHtmlExtensionIfMissing(const QCString &fName); -QCString stripExtensionGeneral(const char *fName, const char *ext); +QCString stripExtensionGeneral(const QCString &fName, const QCString &ext); -QCString stripExtension(const char *fName); +QCString stripExtension(const QCString &fName); void replaceNamespaceAliases(QCString &scope,int i); @@ -343,13 +353,13 @@ int computeQualifiedIndex(const QCString &name); void addDirPrefix(QCString &fileName); -QCString relativePathToRoot(const char *name); +QCString relativePathToRoot(const QCString &name); void createSubDirs(const Dir &d); -QCString stripPath(const char *s); +QCString stripPath(const QCString &s); -bool containsWord(const char *s,const char *word); +bool containsWord(const QCString &s,const char *word); bool findAndRemoveWord(QCString &s,const char *word); @@ -361,7 +371,7 @@ QCString getFileNameExtension(QCString fn); void initDefaultExtensionMapping(); void addCodeOnlyMappings(); -bool checkIfTypedef(const Definition *scope,const FileDef *fileScope,const char *n); +bool checkIfTypedef(const Definition *scope,const FileDef *fileScope,const QCString &n); QCString parseCommentAsText(const Definition *scope,const MemberDef *member,const QCString &doc,const QCString &fileName,int lineNr); @@ -371,27 +381,26 @@ QCString recodeString(const QCString &str,const char *fromEncoding,const char *t QCString extractAliasArgs(const QCString &args,int pos); -int countAliasArguments(const QCString argList); +int countAliasArguments(const QCString &argList); -QCString resolveAliasCmd(const QCString aliasCmd); +QCString resolveAliasCmd(const QCString &aliasCmd); std::string expandAlias(const std::string &aliasName,const std::string &aliasValue); void writeTypeConstraints(OutputList &ol,const Definition *d,const ArgumentList &al); -QCString convertCharEntitiesToUTF8(const char *s); +QCString convertCharEntitiesToUTF8(const QCString &s); void stackTrace(); -bool readInputFile(const char *fileName,BufStr &inBuf, +bool readInputFile(const QCString &fileName,BufStr &inBuf, bool filter=TRUE,bool isSourceCode=FALSE); -QCString filterTitle(const std::string &title); +QCString filterTitle(const QCString &title); bool patternMatch(const FileInfo &fi,const StringVector &patList); QCString externalLinkTarget(const bool parent = false); QCString externalRef(const QCString &relPath,const QCString &ref,bool href); int nextUtf8CharPosition(const QCString &utf8Str,uint len,uint startPos); -const char *writeUtf8Char(std::ostream &t,const char *s); void writeMarkerList(OutputList &ol,const std::string &markerText,size_t numMarkers, std::function<void(size_t)> replaceFunc); @@ -406,12 +415,12 @@ struct ColoredImgDataItem unsigned char *alpha; }; -void writeColoredImgData(const char *dir,ColoredImgDataItem data[]); -QCString replaceColorMarkers(const char *str); +void writeColoredImgData(const QCString &dir,ColoredImgDataItem data[]); +QCString replaceColorMarkers(const QCString &str); bool copyFile(const QCString &src,const QCString &dest); -QCString extractBlock(const QCString text,const QCString marker); -int lineBlock(const QCString text,const QCString marker); +QCString extractBlock(const QCString &text,const QCString &marker); +int lineBlock(const QCString &text,const QCString &marker); bool isURL(const QCString &url); @@ -438,9 +447,9 @@ void convertProtectionLevel( ); bool mainPageHasTitle(); -bool openOutputFile(const char *outFile,std::ofstream &f); -void writeExtraLatexPackages(std::ostream &t); -void writeLatexSpecialFormulaChars(std::ostream &t); +bool openOutputFile(const QCString &outFile,std::ofstream &f); +void writeExtraLatexPackages(TextStream &t); +void writeLatexSpecialFormulaChars(TextStream &t); StringVector split(const std::string &s,const std::string &delimiter); StringVector split(const std::string &s,const reg::Ex &delimiter); @@ -448,7 +457,10 @@ int findIndex(const StringVector &sv,const std::string &s); int findIndex(const std::string &s,const reg::Ex &re); std::string join(const StringVector &s,const std::string &delimiter); -bool recognizeFixedForm(const char* contents, FortranFormat format); +bool recognizeFixedForm(const QCString &contents, FortranFormat format); FortranFormat convertFileNameFortranParserCode(QCString fn); +QCString integerToAlpha(int n, bool upper=true); +QCString integerToRoman(int n, bool upper=true); + #endif diff --git a/src/vhdlcode.h b/src/vhdlcode.h index 48c15bb..c563a8f 100644 --- a/src/vhdlcode.h +++ b/src/vhdlcode.h @@ -29,11 +29,11 @@ class VHDLCodeParser : public CodeParserInterface VHDLCodeParser(); virtual ~VHDLCodeParser(); void parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt lang, bool isExampleBlock, - const char *exampleName=0, + const QCString &exampleName=QCString(), FileDef *fileDef=0, int startLine=-1, int endLine=-1, diff --git a/src/vhdlcode.l b/src/vhdlcode.l index 36b7e6d..8908976 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -110,27 +110,27 @@ struct vhdlcodeYY_state }; -static void writeFont(yyscan_t yyscanner,const char *s,const char* text); +static void writeFont(yyscan_t yyscanner,const char *s,const QCString &text); static void generateMemLink(yyscan_t yyscanner,CodeOutputInterface &ol,QCString &clName,QCString& memberName); static bool writeColoredWord(yyscan_t yyscanner,QCString& word ); -static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *clName, bool typeOnly=false, const char *curr_class=0); +static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol,const QCString &clName, bool typeOnly=false, const QCString &curr_class=QCString()); static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor); static bool checkVhdlString(yyscan_t yyscanner,QCString &name); -static void addToSearchIndex(yyscan_t yyscanner,const char *text); +static void addToSearchIndex(yyscan_t yyscanner,const QCString &text); static void startCodeLine(yyscan_t yyscanner); static void endCodeLine(yyscan_t yyscanner); static void nextCodeLine(yyscan_t yyscanner); -static void writeWord(yyscan_t yyscanner,const char *word,const char* curr_class=0,bool classLink=false); -static void codifyLines(yyscan_t yyscanner,const char *text,const char *cl=0,bool classlink=false,bool comment=false); +static void writeWord(yyscan_t yyscanner,const QCString &word,const QCString &curr_class=QCString(),bool classLink=false); +static void codifyLines(yyscan_t yyscanner,const QCString &text,const QCString &cl=QCString(),bool classlink=false,bool comment=false); static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, const Definition *d, - const char *text); + const QCString &text); static void generateFuncLink(yyscan_t yyscanner,CodeOutputInterface &ol,const MemberDef* mdef); static int countLines(yyscan_t yyscanner); static void endFontClass(yyscan_t yyscanner); static void startFontClass(yyscan_t yyscanner,const char *s); static void appStringLower(QCString& qcs,const char* text); -static void codifyMapLines(yyscan_t yyscanner,const char *text); +static void codifyMapLines(yyscan_t yyscanner,const QCString &text); static void writeFuncProto(yyscan_t yyscanner); static void writeProcessProto(yyscan_t yyscanner); static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); @@ -228,7 +228,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI if (ql.size()>=2) { unsigned int index=0; - QCString t1=ql[0]; + QCString t1(ql[0]); char cc=t1.at(index); while (cc==' ' || cc=='\t') { @@ -259,7 +259,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI } codifyLines(yyscanner,"=>"); index=0; - QCString s2=ql[1]; + QCString s2(ql[1]); t1=s2; cc=t1.at(index); while (cc==' ' || cc=='\t') @@ -287,7 +287,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI } else { - codifyLines(yyscanner,yytext,yyextra->currClass.data()); + codifyLines(yyscanner,yytext,yyextra->currClass); } BEGIN(Map); } @@ -353,7 +353,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI <ParseType>{ENDEFUNC} { QCString tt(yytext); - codifyLines(yyscanner,yytext,yyextra->currClass.data()); + codifyLines(yyscanner,yytext,yyextra->currClass); tt=tt.lower(); VhdlDocGen::deleteAllChars(tt,';'); tt.stripWhiteSpace(); @@ -374,12 +374,12 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI } <ParseType>{END1} { - codifyLines(yyscanner,yytext,yyextra->currClass.data()); + codifyLines(yyscanner,yytext,yyextra->currClass); yyextra->vhdlKeyDict.clear(); } <ParseType>^{B}*("begin "|"begin") { - codifyLines(yyscanner,yytext,yyextra->currClass.data()); + codifyLines(yyscanner,yytext,yyextra->currClass); yyextra->isFuncProto=false; } @@ -387,7 +387,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI yyextra->funcProto.append(yytext); if (yyextra->isProto) { - codifyLines(yyscanner,yytext,yyextra->currClass.data()); + codifyLines(yyscanner,yytext,yyextra->currClass); } } @@ -412,7 +412,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI if (VhdlDocGen::isNumber(val.str())) { startFontClass(yyscanner,"vhdllogic"); - codifyLines(yyscanner,yytext,yyextra->currClass.data()); + codifyLines(yyscanner,yytext,yyextra->currClass); endFontClass(yyscanner); } else @@ -422,7 +422,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI } else { - codifyLines(yyscanner,yytext,yyextra->currClass.data()); + codifyLines(yyscanner,yytext,yyextra->currClass); } } } @@ -580,7 +580,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI std::string s3=strl[2]; s1.append("."); s3.insert(0,"."); - codifyLines(yyscanner,s1.c_str(),yyextra->currClass.data()); + codifyLines(yyscanner,s1.c_str(),yyextra->currClass); ClassDef *cd=VhdlDocGen::getPackageName(s2.c_str()); if (cd) { @@ -606,27 +606,27 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI if (j>0) { QCString left=tt.left(j+1); - codifyLines(yyscanner,left.data()); + codifyLines(yyscanner,left); tt=tt.right(tt.length()-j-1); - left=VhdlDocGen::getIndexWord(tt.data(),0); + left=VhdlDocGen::getIndexWord(tt,0); if (!left.isEmpty()) { if (left.contains('(')) { j=left.find('(',false); QCString name=left.left(j); - generateClassOrGlobalLink(yyscanner,*yyextra->code,name.data()); + generateClassOrGlobalLink(yyscanner,*yyextra->code,name); yyextra->PortMapComp=name; name=tt.right(tt.length()-name.length()); - codifyLines(yyscanner,name.data()); + codifyLines(yyscanner,name); } else { - generateClassOrGlobalLink(yyscanner,*yyextra->code,left.data()); - tt.stripPrefix(left.data()); //=tt.right(tt.length()-left.length()-1); + generateClassOrGlobalLink(yyscanner,*yyextra->code,left); + tt.stripPrefix(left); //=tt.right(tt.length()-left.length()-1); yyextra->PortMapComp=left; - codifyLines(yyscanner,tt.data()); + codifyLines(yyscanner,tt); } } } @@ -634,11 +634,11 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI { if (tt.contains(':',false)) { - codifyMapLines(yyscanner,tt.data()); + codifyMapLines(yyscanner,tt); } else { - codifyLines(yyscanner,tt.data()); + codifyLines(yyscanner,tt); } } yyextra->braceCount=1; @@ -651,7 +651,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI temp=temp.stripWhiteSpace(); VhdlDocGen::deleteAllChars(temp,'\n'); yyextra->tempComp=temp; - codifyLines(yyscanner,yytext,temp.data(),true); + codifyLines(yyscanner,yytext,temp,true); yyextra->braceCount=0; yyextra->isComponent=true; BEGIN(ParseComponent); @@ -667,7 +667,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI temp+=VhdlDocGen::getIndexWord(yytext,1); yyextra->currClass=temp; VhdlDocGen::deleteAllChars(temp,'\n'); - codifyLines(yyscanner,yytext,temp.data(),true); + codifyLines(yyscanner,yytext,temp,true); yyextra->isPackageBody=false; } @@ -677,10 +677,10 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI QCString temp=VhdlDocGen::getIndexWord(yytext,2); StringVector ql=split(yytext,temp.str()); std::string ll=ql[0]; - codifyLines(yyscanner,ll.c_str(),yyextra->currClass.data()); + codifyLines(yyscanner,ll.c_str(),yyextra->currClass); temp=temp.stripWhiteSpace(); temp.prepend("_"); - generateClassOrGlobalLink(yyscanner,*yyextra->code,temp.data()); + generateClassOrGlobalLink(yyscanner,*yyextra->code,temp); yyextra->currClass.resize(0); yyextra->currClass=temp; yyextra->isProto=false; @@ -743,13 +743,13 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI } <Bases>"end"{BN}+"architecture"{BN}+{FUNCNAME} { - codifyLines(yyscanner,yytext,yyextra->currClass.data(),true); + codifyLines(yyscanner,yytext,yyextra->currClass,true); yyextra->currArch = false; } <Bases>"end"{BN}+{FUNCNAME} { if (yyextra->currArch) { - codifyLines(yyscanner,yytext,yyextra->currClass.data(),true); + codifyLines(yyscanner,yytext,yyextra->currClass,true); yyextra->currArch = false; } else @@ -772,7 +772,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI if (!writeColoredWord(yyscanner,temp)) { - generateClassOrGlobalLink(yyscanner,*yyextra->code,temp.data()); + generateClassOrGlobalLink(yyscanner,*yyextra->code,temp); } } <End>";" { @@ -810,7 +810,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI } <Bases>^{B}*("use"){BN}+("entity"|"component")[^\n]* { - codifyLines(yyscanner,yytext,yyextra->currClass.data(),true); + codifyLines(yyscanner,yytext,yyextra->currClass,true); } @@ -859,7 +859,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI <Bases>^{B}*{XILINX}/[^a-zA-Z0-9_] { writeWord(yyscanner,yytext); - //codifyLines(yyscanner,yytext,yyextra->currClass.data(),true); + //codifyLines(yyscanner,yytext,yyextra->currClass,true); } <Bases>^{B}*"set_"[^\n]* { @@ -969,7 +969,7 @@ static bool checkVhdlString(yyscan_t yyscanner,QCString &name) else { startFontClass(yyscanner,"keyword"); - yyextra->code->codify(name.data()); + yyextra->code->codify(name); endFontClass(yyscanner); } return true; @@ -978,14 +978,14 @@ static bool checkVhdlString(yyscan_t yyscanner,QCString &name) if (VhdlDocGen::isNumber(name.str())) { startFontClass(yyscanner,"vhdllogic"); - yyextra->code->codify(name.data()); + yyextra->code->codify(name); endFontClass(yyscanner); return true; } return false; } -static void addToSearchIndex(yyscan_t yyscanner,const char *text) +static void addToSearchIndex(yyscan_t yyscanner,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; if (Doxygen::searchIndex) @@ -1011,14 +1011,14 @@ static void startCodeLine(yyscan_t yyscanner) // if ((yyextra->yyLineNr % 500) == 0) // fprintf(stderr,"\n starting Line %d:",yyextra->yyLineNr); const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr); - //printf("startCodeLine %d d=%s\n", yyextra->yyLineNr,d ? d->name().data() : "<null>"); + //printf("startCodeLine %d d=%s\n", yyextra->yyLineNr,qPrint(d ? d->name()) : "<null>"); if (!yyextra->includeCodeFragment && d) { yyextra->currentDefinition = d; yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr); if (!yyextra->tempComp.isEmpty() && yyextra->currentMemberDef ) { - //ClassDef *cf=VhdlDocGen::getClass(yyextra->tempComp.data()); + //ClassDef *cf=VhdlDocGen::getClass(yyextra->tempComp); QCString nn=yyextra->currentMemberDef->name(); const MemberDef* mdeff=VhdlDocGen::findMember(yyextra->tempComp,nn); if (mdeff) @@ -1040,13 +1040,13 @@ static void startCodeLine(yyscan_t yyscanner) { yyextra->code->writeLineNumber(d->getReference(), d->getOutputFileBase(), - 0,yyextra->yyLineNr); + QCString(),yyextra->yyLineNr); setCurrentDoc(yyscanner,lineAnchor); } } else { - yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr); + yyextra->code->writeLineNumber(QCString(),QCString(),QCString(),yyextra->yyLineNr); } } yyextra->code->startCodeLine(yyextra->sourceFileDef); @@ -1084,7 +1084,7 @@ static void nextCodeLine(yyscan_t yyscanner) * and will be linked. */ -static void writeWord(yyscan_t yyscanner,const char *word,const char* curr_class,bool classLink) +static void writeWord(yyscan_t yyscanner,const QCString &word,const QCString &curr_class,bool classLink) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool found=false; @@ -1102,8 +1102,8 @@ static void writeWord(yyscan_t yyscanner,const char *word,const char* curr_class if (!writeColoredWord(yyscanner,temp)) // is it a keyword ? { //if (VhdlDocGen::findKeyWord(temp)) - // writeFont(yyscanner,"vhdlkeyword",temp.data()); - //printf("writeWord: %s\n",temp.data()); + // writeFont(yyscanner,"vhdlkeyword",temp); + //printf("writeWord: %s\n",qPrint(temp)); if (!tclass.isEmpty()) { if (!classLink) @@ -1119,7 +1119,7 @@ static void writeWord(yyscan_t yyscanner,const char *word,const char* curr_class { if (!checkVhdlString(yyscanner,temp)) { - yyextra->code->codify(temp.data()); + yyextra->code->codify(temp); } } } @@ -1156,16 +1156,16 @@ static void writeWord(yyscan_t yyscanner,const char *word,const char* curr_class } else { - QCString qc(temp.data()); + QCString qc(temp); if (VhdlDocGen::isNumber(qc.str())) { startFontClass(yyscanner,"vhdllogic"); - yyextra->code->codify(temp.data()); + yyextra->code->codify(temp); endFontClass(yyscanner); } else { - yyextra->code->codify(temp.data()); + yyextra->code->codify(temp); } } } @@ -1176,12 +1176,12 @@ static void writeWord(yyscan_t yyscanner,const char *word,const char* curr_class /*! write a code fragment 'text' that may span multiple lines, inserting * line numbers for each line. */ -static void codifyLines(yyscan_t yyscanner,const char *text,const char *cl,bool classlink,bool comment) +static void codifyLines(yyscan_t yyscanner,const QCString &text,const QCString &cl,bool classlink,bool comment) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - if (text==0) return; + if (text.isEmpty()) return; //printf("codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,text); - const char *p=text,*sp=p; + const char *p=text.data(),*sp=p; char c; bool done=false; while (!done) @@ -1195,7 +1195,7 @@ static void codifyLines(yyscan_t yyscanner,const char *text,const char *cl,bool line = line.left((int)(p-sp)-1); if (comment) { - writeFont(yyscanner,"comment",line.data()); + writeFont(yyscanner,"comment",line); } else { @@ -1224,9 +1224,10 @@ static void codifyLines(yyscan_t yyscanner,const char *text,const char *cl,bool */ static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, const Definition *d, - const char *text) + const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (text.isEmpty()) return; static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS); TooltipManager::instance().addTooltip(ol,d); QCString ref = d->getReference(); @@ -1238,18 +1239,17 @@ static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, tooltip = d->briefDescriptionAsTooltip(); } bool done=false; - char *p=(char *)text; + const char *p=text.data(); while (!done) { - char *sp=p; + const char *sp=p; char c; while ((c=*p++) && c!='\n') {} if (c=='\n') { yyextra->yyLineNr++; - *(p-1)='\0'; // printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp); - ol.writeCodeLink(ref,file,anchor,sp,tooltip); + ol.writeCodeLink(ref,file,anchor,QCString(sp,p-sp-1),tooltip); nextCodeLine(yyscanner); } else @@ -1264,7 +1264,7 @@ static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, */ static void generateFuncLink(yyscan_t yyscanner,CodeOutputInterface &ol,const MemberDef* mdef) { - //printf("generateFuncLink(FuncName=%s)\n",mdef->name().data()); + //printf("generateFuncLink(FuncName=%s)\n",qPrint(mdef->name())); QCString memberName=mdef->name(); if (mdef->isLinkable()) // is it a linkable class @@ -1273,7 +1273,7 @@ static void generateFuncLink(yyscan_t yyscanner,CodeOutputInterface &ol,const Me addToSearchIndex(yyscanner,memberName); return; } - codifyLines(yyscanner,memberName.data()); + codifyLines(yyscanner,memberName); addToSearchIndex(yyscanner,memberName); } // generateFuncLink @@ -1283,7 +1283,7 @@ static void generateMemLink(yyscan_t yyscanner,CodeOutputInterface &ol,QCString if (memberName.isEmpty()) return; if (clName.isEmpty()) { - codifyLines(yyscanner,memberName.data()); + codifyLines(yyscanner,memberName); return; } @@ -1294,7 +1294,7 @@ static void generateMemLink(yyscan_t yyscanner,CodeOutputInterface &ol,QCString //bool isLocal=false; const MemberDef *md=VhdlDocGen::findMember(className,memberName); - ClassDef *po=VhdlDocGen::getClass(className.data()); + ClassDef *po=VhdlDocGen::getClass(className); if (md==0 && po && (VhdlDocGen::VhdlClasses)po->protection()==VhdlDocGen::PACKBODYCLASS) { @@ -1310,12 +1310,13 @@ static void generateMemLink(yyscan_t yyscanner,CodeOutputInterface &ol,QCString return; } // nothing found, just write out the word - codifyLines(yyscanner,memberName.data()); + codifyLines(yyscanner,memberName); addToSearchIndex(yyscanner,memberName); }// generateMemLink -static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *clName, bool /*typeOnly*/, const char *curr_class) +static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol, + const QCString &clName, bool /*typeOnly*/, const QCString &curr_class) { QCString className=clName; @@ -1325,8 +1326,8 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol //MemberDef *md=0; //bool isLocal=false; className.stripPrefix("_"); - cd = getClass(className.data()); - if (!cd && curr_class) + cd = getClass(className); + if (!cd && !curr_class.isEmpty()) { QCString cls = curr_class; QCString suffix = "::"; @@ -1409,10 +1410,10 @@ static void startFontClass(yyscan_t yyscanner,const char *s) yyextra->currentFontClass=s; } -static void writeFont(yyscan_t yyscanner,const char *s,const char* text) +static void writeFont(yyscan_t yyscanner,const char *s,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - if (s==0 || text==0) return; + if (s==0 || text.isEmpty()) return; //printf("writeFont(yyscanner,%d,\"%s\")\n",yyextra->yyLineNr,text); yyextra->code->startFontClass(s); yyextra->code->codify(text); @@ -1429,16 +1430,16 @@ static void appStringLower(QCString& qcs,const char* text) } /* writes and links a port map statement */ -static void codifyMapLines(yyscan_t yyscanner,const char *text) +static void codifyMapLines(yyscan_t yyscanner,const QCString &text) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - if (text==0) return; + if (text.isEmpty()) return; QCString temp; //bool dot=false; int wordCounter=0; QCString ctemp; - //printf("codifyMapLines(%d,\"%s\")\n",yyextra->yyLineNr,text); - const char *p=text; //,*sp=p; + //printf("codifyMapLines(%d,\"%s\")\n",yyextra->yyLineNr,qPrint(text)); + const char *p=text.data(); char c; bool done=false; while (!done) @@ -1477,7 +1478,7 @@ static void codifyMapLines(yyscan_t yyscanner,const char *text) } } ctemp.fill(c,1); - codifyLines(yyscanner,ctemp.data()); + codifyLines(yyscanner,ctemp); ctemp.resize(0); temp.resize(0); }//while @@ -1495,13 +1496,13 @@ static void writeFuncProto(yyscan_t yyscanner) if (name.isEmpty()) { - codifyLines(yyscanner,yyextra->funcProto.data(),yyextra->currClass.data()); + codifyLines(yyscanner,yyextra->funcProto,yyextra->currClass); return; } StringVector qlist=split(yyextra->funcProto.str(),name.str()); - QCString temp=qlist[0]; - codifyLines(yyscanner,temp.data(),yyextra->currClass.data()); - yyextra->funcProto.stripPrefix(temp.data()); + QCString temp(qlist[0]); + codifyLines(yyscanner,temp,yyextra->currClass); + yyextra->funcProto.stripPrefix(temp); temp.resize(0); temp=yyextra->currClass; if (yyextra->isPackageBody) @@ -1513,12 +1514,12 @@ static void writeFuncProto(yyscan_t yyscanner) if (mdef) { generateFuncLink(yyscanner,*yyextra->code,mdef); - yyextra->funcProto.stripPrefix(name.data()); - codifyLines(yyscanner,yyextra->funcProto.data(),yyextra->currClass.data()); + yyextra->funcProto.stripPrefix(name); + codifyLines(yyscanner,yyextra->funcProto,yyextra->currClass); } else { - codifyLines(yyscanner,yyextra->funcProto.data(),yyextra->currClass.data()); + codifyLines(yyscanner,yyextra->funcProto,yyextra->currClass); } }// writeFuncProto @@ -1527,7 +1528,7 @@ static void writeFuncProto(yyscan_t yyscanner) static void writeProcessProto(yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - codifyLines(yyscanner,yyextra->funcProto.data(),yyextra->currClass.data()); + codifyLines(yyscanner,yyextra->funcProto,yyextra->currClass); yyextra->vhdlKeyDict.clear(); }// writeProcessProto @@ -1539,7 +1540,7 @@ static bool writeColoredWord(yyscan_t yyscanner,QCString& word ) const char *ss=VhdlDocGen::findKeyWord(qcs); if (ss) { - writeFont(yyscanner,ss,word.data()); + writeFont(yyscanner,ss,word); return true; } return false; @@ -1573,11 +1574,11 @@ void VHDLCodeParser::resetCodeParserState() } void VHDLCodeParser::parseCode(CodeOutputInterface &od, - const char *className, + const QCString &className, const QCString &s, SrcLangExt, bool exBlock, - const char *exName, + const QCString &exName, FileDef *fd, int startLine, int endLine, @@ -1591,7 +1592,7 @@ void VHDLCodeParser::parseCode(CodeOutputInterface &od, struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("***parseCode() exBlock=%d exName=%s fd=%p\n",exBlock,exName,fd); if (s.isEmpty()) return; - printlex(yy_flex_debug, true, __FILE__, fd ? fd->fileName().data(): NULL); + printlex(yy_flex_debug, true, __FILE__, fd ? qPrint(fd->fileName()): NULL); if (memberDef) { const ClassDef *dd=memberDef->getClassDef(); @@ -1599,7 +1600,7 @@ void VHDLCodeParser::parseCode(CodeOutputInterface &od, } resetCodeParserState(); yyextra->code = &od; - yyextra->inputString = s; + yyextra->inputString = s.data(); yyextra->inputPosition = 0; yyextra->currentFontClass = 0; yyextra->needsTermination = false; @@ -1664,7 +1665,7 @@ void VHDLCodeParser::parseCode(CodeOutputInterface &od, // write the tooltips TooltipManager::instance().writeTooltips(od); - printlex(yy_flex_debug, false, __FILE__, fd ? fd->fileName().data(): NULL); + printlex(yy_flex_debug, false, __FILE__, fd ? qPrint(fd->fileName()): NULL); } #if USE_STATE2STRING diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 47b406d..f0763db 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -61,25 +61,26 @@ #include "VhdlParser.h" #include "regex.h" #include "plantuml.h" +#include "textstream.h" //#define DEBUGFLOW #define theTranslator_vhdlType theTranslator->trVhdlType -static void initUCF(Entry* root,const char* type,QCString & qcs,int line,QCString & fileName,QCString & brief); +static void initUCF(Entry* root,const QCString &type,QCString &qcs,int line,const QCString & fileName,QCString & brief); static void writeUCFLink(const MemberDef* mdef,OutputList &ol); static void addInstance(ClassDefMutable* entity, ClassDefMutable* arch, ClassDefMutable *inst, const std::shared_ptr<Entry> &cur); //---------- create svg ------------------------------------------------------------- static void createSVG(); -static void startDot(std::ostream &t); -static void startTable(std::ostream &t,const QCString &className); +static void startDot(TextStream &t); +static void startTable(TextStream &t,const QCString &className); static std::vector<const MemberDef *> getPorts(const ClassDef *cd); -static void writeVhdlEntityToolTip(std::ostream& t,ClassDef *cd); -static void endDot(std::ostream &t); -static void writeTable(const std::vector<const MemberDef*> &portList,std::ostream & t); -static void endTable(std::ostream &t); -static void writeClassToDot(std::ostream &t,ClassDef* cd); -static void writeVhdlDotLink(std::ostream &t,const QCString &a,const QCString &b,const QCString &style); +static void writeVhdlEntityToolTip(TextStream& t,ClassDef *cd); +static void endDot(TextStream &t); +static void writeTable(const std::vector<const MemberDef*> &portList,TextStream & t); +static void endTable(TextStream &t); +static void writeClassToDot(TextStream &t,ClassDef* cd); +static void writeVhdlDotLink(TextStream &t,const QCString &a,const QCString &b,const QCString &style); static const MemberDef *flowMember=0; void VhdlDocGen::setFlowMember( const MemberDef* mem) @@ -95,11 +96,11 @@ void VhdlDocGen::setFlowMember( const MemberDef* mem) //-------------------------------------------------------------------------------------------------- -static void codify(std::ostream &t,const char *str) +static void codify(TextStream &t,const QCString &str) { - if (str) + if (!str.isEmpty()) { - const char *p=str; + const char *p=str.data(); char c; while (*p) { @@ -134,7 +135,7 @@ static void writeLink(const MemberDef* mdef,OutputList &ol) static void startFonts(const QCString& q, const char *keyword,OutputList& ol) { ol.startFontClass(keyword); - ol.docify(q.data()); + ol.docify(q); ol.endFontClass(); } @@ -187,12 +188,13 @@ void VhdlDocGen::writeOverview() QCString ov =Config_getString(HTML_OUTPUT); QCString fileName=ov+"/vhdl_design.dot"; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { - err("Warning: Cannot open file %s for writing\n",fileName.data()); + err("Warning: Cannot open file %s for writing\n",qPrint(fileName)); return; } + TextStream t(&f); startDot(t); @@ -223,20 +225,21 @@ void VhdlDocGen::writeOverview() dotn+=cd->name(); QCString csc=bClass->name()+":"; csc+=bClass->name(); - // fprintf(stderr,"\n <%s| %s>",dotn.data(),csc.data()); - writeVhdlDotLink(t,dotn,csc,0); + // fprintf(stderr,"\n <%s| %s>",qPrint(dotn),qPrint(csc)); + writeVhdlDotLink(t,dotn,csc,QCString()); } }// for endDot(t); // writePortLinks(t); - t.close(); + t.flush(); + f.close(); createSVG(); } //------------------------------------------------------------------------------------------------------------------------------------------------------ -static void startDot(std::ostream &t) +static void startDot(TextStream &t) { t << " digraph G { \n"; t << "rankdir=LR \n"; @@ -244,18 +247,18 @@ static void startDot(std::ostream &t) t << "stylesheet=\"doxygen.css\"\n"; } -static void endDot(std::ostream &t) +static void endDot(TextStream &t) { t <<" } \n"; } -static void startTable(std::ostream &t,const QCString &className) +static void startTable(TextStream &t,const QCString &className) { t << className <<" [ shape=none , fontname=\"arial\", fontcolor=\"blue\" , \n"; t << "label=<<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\">\n"; } -static void writeVhdlDotLink(std::ostream &t, +static void writeVhdlDotLink(TextStream &t, const QCString &a,const QCString &b,const QCString &style) { t << a << "->" << b; @@ -285,7 +288,7 @@ static QCString formatBriefNote(const QCString &brief,ClassDef * cd) return vForm; } -static void writeVhdlEntityToolTip(std::ostream& t,ClassDef *cd) +static void writeVhdlEntityToolTip(TextStream& t,ClassDef *cd) { QCString brief=cd->briefDescription(); @@ -306,7 +309,7 @@ static void writeVhdlEntityToolTip(std::ostream& t,ClassDef *cd) writeVhdlDotLink(t,dotn,node,"dotted"); } -static void writeColumn(std::ostream &t,const MemberDef *md,bool start) +static void writeColumn(TextStream &t,const MemberDef *md,bool start) { QCString toolTip; @@ -339,7 +342,7 @@ static void writeColumn(std::ostream &t,const MemberDef *md,bool start) t<<" TOOLTIP=\""; if (!toolTip.isEmpty()) { - codify(t,toolTip.data()); + codify(t,toolTip); } else { @@ -347,7 +350,7 @@ static void writeColumn(std::ostream &t,const MemberDef *md,bool start) if (!largs.isEmpty()) { largs=substitute(largs,"%"," "); - codify(t,largs.data()); + codify(t,largs); } } t << "\" "; @@ -389,13 +392,13 @@ static void writeColumn(std::ostream &t,const MemberDef *md,bool start) } } -static void endTable(std::ostream &t) +static void endTable(TextStream &t) { t << "</TABLE>>\n"; t << "] \n"; } -static void writeClassToDot(std::ostream &t,ClassDef* cd) +static void writeClassToDot(TextStream &t,ClassDef* cd) { t << "<TR><TD COLSPAN=\"2\" BGCOLOR=\"yellow\" "; t << "PORT=\""; @@ -429,9 +432,9 @@ static std::vector<const MemberDef*> getPorts(const ClassDef *cd) return portList; } -//writeColumn(std::ostream &t,QCString name,bool start) +//writeColumn(TextStream &t,QCString name,bool start) -static void writeTable(const std::vector<const MemberDef*> &portList,std::ostream & t) +static void writeTable(const std::vector<const MemberDef*> &portList,TextStream & t) { std::vector<const MemberDef *> inPorts; std::vector<const MemberDef *> outPorts; @@ -576,9 +579,9 @@ const char* VhdlDocGen::findKeyWord(const QCString& kw) return 0; } -ClassDef *VhdlDocGen::getClass(const char *name) +ClassDef *VhdlDocGen::getClass(const QCString &name) { - if (name==0 || name[0]=='\0') return 0; + if (name.isEmpty()) return 0; return Doxygen::classLinkedMap->find(QCString(name).stripWhiteSpace()); } @@ -597,7 +600,7 @@ const MemberDef* VhdlDocGen::findMember(const QCString& className, const QCStrin const MemberDef *mdef=0; cd=getClass(className); - //printf("VhdlDocGen::findMember(%s,%s)=%p\n",className.data(),memName.data(),cd); + //printf("VhdlDocGen::findMember(%s,%s)=%p\n",qPrint(className),qPrint(memName),cd); if (cd==0) return 0; mdef=VhdlDocGen::findMemberDef(cd,memName,MemberListType_variableMembers); @@ -694,7 +697,7 @@ const MemberDef* VhdlDocGen::findMember(const QCString& className, const QCStrin const MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberListType type) { QCString keyType=cd->symbolName()+"@"+key; - //printf("\n %s | %s | %s",cd->symbolName().data(),key.data(,),keyType.data()); + //printf("\n %s | %s | %s",qPrint(cd->symbolName()),key.data(,),qPrint(keyType)); auto it = g_varMap.find(keyType.str()); if (it!=g_varMap.end()) @@ -712,7 +715,7 @@ const MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,Memb return 0; } //int l=ml->count(); - // fprintf(stderr,"\n loading entity %s %s: %d",cd->symbolName().data(),keyType.data(),l); + // fprintf(stderr,"\n loading entity %s %s: %d",qPrint(cd->symbolName()),qPrint(keyType),l); for (const auto &md : *ml) { @@ -765,7 +768,7 @@ void VhdlDocGen::findAllPackages( ClassDef *cdef) const MemberDef* VhdlDocGen::findFunction(const QCString& funcname, const QCString& package) { - ClassDef *cdef=getClass(package.data()); + ClassDef *cdef=getClass(package); if (cdef==0) return 0; MemberList *mem=cdef->getMemberList(MemberListType_pubMethods); @@ -848,12 +851,12 @@ void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol) if (ii==VhdlDocGen::PACKAGE_BODY) { nn.stripPrefix("_"); - cd=getClass(nn.data()); + cd=getClass(nn); } else if (ii==VhdlDocGen::PACKAGE) { nn.prepend("_"); - cd=getClass(nn.data()); + cd=getClass(nn); } else if (ii==VhdlDocGen::ARCHITECTURE) { @@ -861,7 +864,7 @@ void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol) if (qlist.size()>1) { nn=qlist[1]; - cd=VhdlDocGen::getClass(nn.data()); + cd=VhdlDocGen::getClass(nn); } } @@ -874,8 +877,8 @@ void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol) StringVector qlist=split(s.str(),"-"); if (qlist.size()>2) { - QCString s1=qlist[0]; - QCString s2=qlist[1]; + QCString s1(qlist[0]); + QCString s2(qlist[1]); s1.stripPrefix("_"); if (ql.size()==1) s1.resize(0); ClassDef *cc = getClass(s); @@ -925,7 +928,7 @@ const ClassDef* VhdlDocGen::findArchitecture(const ClassDef *cd) StringVector ql=split(jj.str(),":"); if (ql.size()>1) { - if (ql[0]==nn) + if (QCString(ql[0])==nn) { return citer.get(); } @@ -941,16 +944,16 @@ void VhdlDocGen::writeVhdlLink(const ClassDef* ccd ,OutputList& ol,QCString& typ { if (ccd==0) return; ol.startBold(); - ol.docify(type.data()); + ol.docify(type); ol.endBold(); nn.stripPrefix("_"); - ol.writeObjectLink(ccd->getReference(),ccd->getOutputFileBase(),0,nn.data()); + ol.writeObjectLink(ccd->getReference(),ccd->getOutputFileBase(),QCString(),nn); if (!behav.isEmpty()) { behav.prepend(" "); ol.startBold(); - ol.docify(behav.data()); + ol.docify(behav); ol.endBold(); } @@ -983,7 +986,7 @@ void VhdlDocGen::prepareComment(QCString& qcs) * @param ret Stores the return type * @param doc ??? */ -void VhdlDocGen::parseFuncProto(const char* text,QCString& name,QCString& ret,bool doc) +void VhdlDocGen::parseFuncProto(const QCString &text,QCString& name,QCString& ret,bool doc) { int index,end; QCString s1(text); @@ -1014,7 +1017,7 @@ void VhdlDocGen::parseFuncProto(const char* text,QCString& name,QCString& ret,bo int s=s1.find(' '); if (s==-1) s=s1.find('\t'); if (i==-1 || i<s) - s1=VhdlDocGen::getIndexWord(s1.data(),1); + s1=VhdlDocGen::getIndexWord(s1,1); else // s<i, s=start of name, i=end of name s1=s1.mid(s,(i-s)); @@ -1033,14 +1036,14 @@ void VhdlDocGen::parseFuncProto(const char* text,QCString& name,QCString& ret,bo * returns the n'th word of a string */ -QCString VhdlDocGen::getIndexWord(const char* c,int index) +QCString VhdlDocGen::getIndexWord(const QCString &c,int index) { static const reg::Ex reg(R"([\s|])"); - auto ql=split(c,reg); + auto ql=split(c.str(),reg); if ((size_t)index < ql.size()) { - return ql[index]; + return QCString(ql[index]); } return ""; @@ -1253,7 +1256,7 @@ void VhdlDocGen::formatString(const QCString &s, OutputList& ol,const MemberDef* index=temp.length(); }// for temp=temp.stripWhiteSpace(); - // printf("\n [%s]",qcs.data()); + // printf("\n [%s]",qPrint(qcs)); VhdlDocGen::writeFormatString(temp,ol,mdef); } @@ -1365,7 +1368,7 @@ void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList &al,const else startFonts(w,"vhdlchar",ol); - if (arg.attrib) + if (!arg.attrib.isEmpty()) startFonts(arg.attrib,"vhdlchar",ol); sem=TRUE; @@ -1377,8 +1380,8 @@ void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList &al,const } ol.startBold(); ol.docify(" )"); - const char *exp=mdef->excpString(); - if (exp) + QCString exp=mdef->excpString(); + if (!exp.isEmpty()) { ol.insertMemberAlign(); ol.startBold(); @@ -1534,57 +1537,57 @@ QCString VhdlDocGen::convertArgumentListToString(const ArgumentList &al,bool fun void VhdlDocGen::writeVhdlDeclarations(const MemberList* ml, OutputList& ol,const GroupDef* gd,const ClassDef* cd,const FileDef *fd,const NamespaceDef* nd) { - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::LIBRARY,FALSE),0,FALSE,VhdlDocGen::LIBRARY); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::USE,FALSE),0,FALSE,VhdlDocGen::USE); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::FUNCTION,FALSE),0,FALSE,VhdlDocGen::FUNCTION); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::COMPONENT,FALSE),0,FALSE,VhdlDocGen::COMPONENT); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::CONSTANT,FALSE),0,FALSE,VhdlDocGen::CONSTANT); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::TYPE,FALSE),0,FALSE,VhdlDocGen::TYPE); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::SUBTYPE,FALSE),0,FALSE,VhdlDocGen::SUBTYPE); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::GENERIC,FALSE),0,FALSE,VhdlDocGen::GENERIC); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::PORT,FALSE),0,FALSE,VhdlDocGen::PORT); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::PROCESS,FALSE),0,FALSE,VhdlDocGen::PROCESS); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::SIGNAL,FALSE),0,FALSE,VhdlDocGen::SIGNAL); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::ATTRIBUTE,FALSE),0,FALSE,VhdlDocGen::ATTRIBUTE); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::PROCEDURE,FALSE),0,FALSE,VhdlDocGen::PROCEDURE); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::RECORD,FALSE),0,FALSE,VhdlDocGen::RECORD); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::UNITS,FALSE),0,FALSE,VhdlDocGen::UNITS); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::SHAREDVARIABLE,FALSE),0,FALSE,VhdlDocGen::SHAREDVARIABLE); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::VFILE,FALSE),0,FALSE,VhdlDocGen::VFILE); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::GROUP,FALSE),0,FALSE,VhdlDocGen::GROUP); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::INSTANTIATION,FALSE),0,FALSE,VhdlDocGen::INSTANTIATION); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::ALIAS,FALSE),0,FALSE,VhdlDocGen::ALIAS); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::MISCELLANEOUS,TRUE),0,FALSE,VhdlDocGen::MISCELLANEOUS); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::LIBRARY,FALSE),QCString(),FALSE,VhdlDocGen::LIBRARY); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::USE,FALSE),QCString(),FALSE,VhdlDocGen::USE); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::FUNCTION,FALSE),QCString(),FALSE,VhdlDocGen::FUNCTION); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::COMPONENT,FALSE),QCString(),FALSE,VhdlDocGen::COMPONENT); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::CONSTANT,FALSE),QCString(),FALSE,VhdlDocGen::CONSTANT); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::TYPE,FALSE),QCString(),FALSE,VhdlDocGen::TYPE); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::SUBTYPE,FALSE),QCString(),FALSE,VhdlDocGen::SUBTYPE); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::GENERIC,FALSE),QCString(),FALSE,VhdlDocGen::GENERIC); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::PORT,FALSE),QCString(),FALSE,VhdlDocGen::PORT); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::PROCESS,FALSE),QCString(),FALSE,VhdlDocGen::PROCESS); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::SIGNAL,FALSE),QCString(),FALSE,VhdlDocGen::SIGNAL); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::ATTRIBUTE,FALSE),QCString(),FALSE,VhdlDocGen::ATTRIBUTE); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::PROCEDURE,FALSE),QCString(),FALSE,VhdlDocGen::PROCEDURE); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::RECORD,FALSE),QCString(),FALSE,VhdlDocGen::RECORD); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::UNITS,FALSE),QCString(),FALSE,VhdlDocGen::UNITS); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::SHAREDVARIABLE,FALSE),QCString(),FALSE,VhdlDocGen::SHAREDVARIABLE); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::VFILE,FALSE),QCString(),FALSE,VhdlDocGen::VFILE); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::GROUP,FALSE),QCString(),FALSE,VhdlDocGen::GROUP); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::INSTANTIATION,FALSE),QCString(),FALSE,VhdlDocGen::INSTANTIATION); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::ALIAS,FALSE),QCString(),FALSE,VhdlDocGen::ALIAS); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::MISCELLANEOUS,TRUE),QCString(),FALSE,VhdlDocGen::MISCELLANEOUS); // configurations must be added to global file definitions. - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::CONFIG,FALSE),0,FALSE,VhdlDocGen::CONFIG); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::UCF_CONST,FALSE),0,FALSE,VhdlDocGen::UCF_CONST); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::CONFIG,FALSE),QCString(),FALSE,VhdlDocGen::CONFIG); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::UCF_CONST,FALSE),QCString(),FALSE,VhdlDocGen::UCF_CONST); } void VhdlDocGen::correctMemberProperties(MemberDefMutable *md) { - if (qstrcmp(md->argsString(),"package")==0) + if (md->argsString()=="package") { md->setMemberSpecifiers(VhdlDocGen::INSTANTIATION); } - else if (qstrcmp(md->argsString(),"configuration")==0) + else if (md->argsString()=="configuration") { md->setMemberSpecifiers(VhdlDocGen::CONFIG); } - else if (qstrcmp(md->typeString(),"library")==0) + else if (md->typeString()=="library") { md->setMemberSpecifiers(VhdlDocGen::LIBRARY); } - else if (qstrcmp(md->typeString(),"use")==0) + else if (md->typeString()=="use") { md->setMemberSpecifiers(VhdlDocGen::USE); } - else if (qstricmp(md->typeString(),"misc")==0) + else if (md->typeString().lower()=="misc") { md->setMemberSpecifiers(VhdlDocGen::MISCELLANEOUS); } - else if (qstricmp(md->typeString(),"ucf_const")==0) + else if (md->typeString().lower()=="ucf_const") { md->setMemberSpecifiers(VhdlDocGen::UCF_CONST); } @@ -1694,7 +1697,7 @@ bool VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definit return hasParams; } -void VhdlDocGen::writeTagFile(MemberDefMutable *mdef,std::ostream &tagFile) +void VhdlDocGen::writeTagFile(MemberDefMutable *mdef,TextStream &tagFile) { tagFile << " <member kind=\""; if (VhdlDocGen::isGeneric(mdef)) tagFile << "generic"; @@ -1774,7 +1777,7 @@ void VhdlDocGen::writeVHDLDeclaration(const MemberDefMutable* mdef,OutputList &o // start a new member declaration uint isAnonymous = (bool)(annoClassDef); // || m_impl->annMemb || m_impl->annEnumType; - ///printf("startMemberItem for %s\n",name().data()); + ///printf("startMemberItem for %s\n",qPrint(name())); uint64_t mm=mdef->getMemberSpecifiers(); if (mm==VhdlDocGen::MISCELLANEOUS) isAnonymous=3; @@ -1785,7 +1788,7 @@ void VhdlDocGen::writeVHDLDeclaration(const MemberDefMutable* mdef,OutputList &o bool detailsVisible = mdef->isDetailedSectionLinkable(); if (!detailsVisible) // && !m_impl->annMemb) { - QCString doxyName=mdef->name().copy(); + QCString doxyName=mdef->name(); if (!cname.isEmpty()) doxyName.prepend(cname+"::"); QCString doxyArgs=mdef->argsString(); ol.startDoxyAnchor(cfname,cname,mdef->anchor(),doxyName,doxyArgs); @@ -1844,12 +1847,12 @@ void VhdlDocGen::writeVHDLDeclaration(const MemberDefMutable* mdef,OutputList &o ol.docify(" "); QCString name=theTranslator_vhdlType(VhdlDocGen::PACKAGE,TRUE); ol.startBold(); - ol.docify(name.data()); + ol.docify(name); name.resize(0); ol.endBold(); name+=" <"+mdef->name()+">"; ol.startEmphasis(); - ol.writeObjectLink(kl->getReference(),kl->getOutputFileBase(),0,name.data()); + ol.writeObjectLink(kl->getReference(),kl->getOutputFileBase(),QCString(),name); ol.popGeneratorState(); } break; @@ -1912,7 +1915,7 @@ void VhdlDocGen::writeVHDLDeclaration(const MemberDefMutable* mdef,OutputList &o } largs.prepend("::"); - largs.prepend(mdef->name().data()); + largs.prepend(mdef->name()); ol.writeObjectLink(mdef->getReference(), cfname, mdef->anchor(), @@ -1939,7 +1942,7 @@ void VhdlDocGen::writeVHDLDeclaration(const MemberDefMutable* mdef,OutputList &o { nn=mdef->name(); } - kl=getClass(nn.data()); + kl=getClass(nn); if (kl) { nn=kl->getOutputFileBase(); @@ -1955,7 +1958,7 @@ void VhdlDocGen::writeVHDLDeclaration(const MemberDefMutable* mdef,OutputList &o { name+=mdef->name()+"> "; } - ol.writeObjectLink(kl->getReference(),kl->getOutputFileBase(),0,name.data()); + ol.writeObjectLink(kl->getReference(),kl->getOutputFileBase(),QCString(),name); ol.endEmphasis(); ol.popGeneratorState(); } @@ -2002,17 +2005,15 @@ void VhdlDocGen::writeVHDLDeclaration(const MemberDefMutable* mdef,OutputList &o ol.endDoxyAnchor(cfname,mdef->anchor()); } - // name().data(),annoClassDef,annEnumType); - // if(mm!=VhdlDocGen::MISCELLANEOUS) ol.endMemberItem(); if (!mdef->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC) /* && !annMemb */) { QCString s=mdef->briefDescription(); - ol.startMemberDescription(mdef->anchor(), NULL, mm == VhdlDocGen::PORT); + ol.startMemberDescription(mdef->anchor(), QCString(), mm == VhdlDocGen::PORT); ol.generateDoc(mdef->briefFile(),mdef->briefLine(), mdef->getOuterScope()?mdef->getOuterScope():d, - mdef,s.data(),TRUE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + mdef,s,TRUE,FALSE, + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); if (detailsVisible) { ol.pushGeneratorState(); @@ -2025,7 +2026,7 @@ void VhdlDocGen::writeVHDLDeclaration(const MemberDefMutable* mdef,OutputList &o } else // local link { - ol.startTextLink(0,mdef->anchor()); + ol.startTextLink(QCString(),mdef->anchor()); } ol.endTextLink(); //ol.startEmphasis(); @@ -2094,22 +2095,22 @@ static bool membersHaveSpecificType(const MemberList *ml,uint64 type) void VhdlDocGen::writeVHDLDeclarations(const MemberList* ml,OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, - const char *title,const char *subtitle,bool /*showEnumValues*/,int type) + const QCString &title,const QCString &subtitle,bool /*showEnumValues*/,int type) { if (!membersHaveSpecificType(ml,type)) return; - if (title) + if (!title.isEmpty()) { ol.startMemberHeader(convertToId(title),type == VhdlDocGen::PORT ? 3 : 2); ol.parseText(title); ol.endMemberHeader(); ol.docify(" "); } - if (subtitle && subtitle[0]!=0) + if (!subtitle.isEmpty()) { ol.startMemberSubtitle(); ol.generateDoc("[generated]",-1,0,0,subtitle,FALSE,FALSE, - 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberSubtitle(); } //printf("memberGroupList=%p\n",memberGroupList); @@ -2119,7 +2120,7 @@ void VhdlDocGen::writeVHDLDeclarations(const MemberList* ml,OutputList &ol, { if (membersHaveSpecificType(&mg->members(),type)) { - //printf("mg->header=%s\n",mg->header().data()); + //printf("mg->header=%s\n",qPrint(mg->header())); bool hasHeader=mg->header()!="[NOHEADER]"; ol.startMemberGroupHeader(hasHeader); if (hasHeader) @@ -2132,7 +2133,7 @@ void VhdlDocGen::writeVHDLDeclarations(const MemberList* ml,OutputList &ol, //printf("Member group has docs!\n"); ol.startMemberGroupDocs(); ol.generateDoc("[generated]",-1,0,0,mg->documentation()+"\n",FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberGroupDocs(); } ol.startMemberGroup(); @@ -2151,7 +2152,7 @@ bool VhdlDocGen::writeClassType( const ClassDef * cd, QCString qcs = theTranslator->trVhdlType(id+2,TRUE); cname=VhdlDocGen::getClassName(cd); ol.startBold(); - ol.writeString(qcs.data()); + ol.writeString(qcs); ol.writeString(" "); ol.endBold(); //ol.insertMemberAlign(); @@ -2214,11 +2215,11 @@ void VhdlDocGen::writeSource(const MemberDefMutable *mdef,OutputList& ol,const Q ol.pushGeneratorState(); ol.startCodeFragment("DoxyCode"); intf->parseCode( ol, // codeOutIntf - 0, // scope + QCString(), // scope codeFragment, // input SrcLangExt_VHDL, // lang FALSE, // isExample - 0, // exampleName + QCString(), // exampleName const_cast<FileDef*>(mdef->getFileDef()), // fileDef mdef->getStartBodyLine(), // startLine mdef->getEndBodyLine(), // endLine @@ -2260,7 +2261,7 @@ QCString VhdlDocGen::convertFileNameToClassName(QCString name) return n; } -void VhdlDocGen::parseUCF(const char* input, Entry* entity,QCString fileName,bool altera) +void VhdlDocGen::parseUCF(const char* input, Entry* entity,const QCString &fileName,bool altera) { QCString ucFile(input); int lineNo=0; @@ -2295,18 +2296,18 @@ void VhdlDocGen::parseUCF(const char* input, Entry* entity,QCString fileName,b temp.stripPrefix("set_location_assignment"); - initUCF(entity,0,temp,lineNo,fileName,brief); + initUCF(entity,QCString(),temp,lineNo,fileName,brief); } else { static const reg::Ex ee(R"([\s=])"); int in=findIndex(temp.str(),ee); QCString ff=temp.left(in); - temp.stripPrefix(ff.data()); + temp.stripPrefix(ff); ff.append("#"); if (!temp.isEmpty()) { - initUCF(entity,ff.data(),temp,lineNo,fileName,brief); + initUCF(entity,ff,temp,lineNo,fileName,brief); } } } @@ -2316,11 +2317,11 @@ void VhdlDocGen::parseUCF(const char* input, Entry* entity,QCString fileName,b }// while } -static void initUCF(Entry* root,const char* type,QCString & qcs,int line,QCString & fileName,QCString & brief) +static void initUCF(Entry* root,const QCString &type,QCString &qcs, + int line,const QCString &fileName,QCString & brief) { if (qcs.isEmpty())return; QCString n; - // bool bo=(qstricmp(type,qcs.data())==0); VhdlDocGen::deleteAllChars(qcs,';'); qcs=qcs.stripWhiteSpace(); @@ -2332,7 +2333,6 @@ static void initUCF(Entry* root,const char* type,QCString & qcs,int line,QCStr { n=type; VhdlDocGen::deleteAllChars(n,'#'); - type=""; } else { @@ -2360,7 +2360,7 @@ static void initUCF(Entry* root,const char* type,QCString & qcs,int line,QCStr } current->name= n+"_"; - current->name.append(VhdlDocGen::getRecordNumber().data()); + current->name.append(VhdlDocGen::getRecordNumber()); if (!brief.isEmpty()) { @@ -2384,7 +2384,7 @@ static void writeUCFLink(const MemberDef* mdef,OutputList &ol) if (!equ) { - ol.writeString(n.data()); + ol.writeString(n); ol.docify(" "); ol.insertMemberAlign(); } @@ -2469,11 +2469,11 @@ QCString VhdlDocGen::parseForBinding(QCString & entity,QCString & arch) // find class with upper/lower letters -ClassDef* VhdlDocGen::findVhdlClass(const char *className ) +ClassDef* VhdlDocGen::findVhdlClass(const QCString &className ) { for (const auto &cd : *Doxygen::classLinkedMap) { - if (qstricmp(className,cd->name().data())==0) + if (qstricmp(className.data(),qPrint(cd->name()))==0) { return cd.get(); } @@ -2517,8 +2517,8 @@ void VhdlDocGen::computeVhdlComponentRelations() entity=cur->type; } - ClassDefMutable *classEntity= toClassDefMutable(VhdlDocGen::findVhdlClass(entity.data())); - inst=VhdlDocGen::getIndexWord(cur->args.data(),0); + ClassDefMutable *classEntity= toClassDefMutable(VhdlDocGen::findVhdlClass(entity)); + inst=VhdlDocGen::getIndexWord(cur->args,0); ClassDefMutable *cd=toClassDefMutable(Doxygen::classLinkedMap->find(inst)); ClassDefMutable *ar=toClassDefMutable(Doxygen::classLinkedMap->find(cur->args)); @@ -2528,7 +2528,7 @@ void VhdlDocGen::computeVhdlComponentRelations() } // if (classEntity==0) - // err("%s:%d:Entity:%s%s",cur->fileName.data(),cur->startLine,entity.data()," could not be found"); + // err("%s:%d:Entity:%s%s",qPrint(cur->fileName),cur->startLine,qPrint(entity)," could not be found"); addInstance(classEntity,ar,cd,cur); } @@ -2552,12 +2552,12 @@ static void addInstance(ClassDefMutable* classEntity, ClassDefMutable* ar, if (classEntity==cd) return; bName=classEntity->name(); - // fprintf(stderr,"\naddInstance %s to %s %s %s\n", classEntity->name().data(),cd->name().data(),ar->name().data(),cur->name); - n1=classEntity->name().data(); + // fprintf(stderr,"\naddInstance %s to %s %s %s\n",qPrint( classEntity->name()),qPrint(cd->name()),qPrint(ar->name()),cur->name); + n1=classEntity->name(); if (!cd->isBaseClass(classEntity, true, 0)) { - cd->insertBaseClass(classEntity,n1,Public,Normal,0); + cd->insertBaseClass(classEntity,n1,Public,Normal,QCString()); } else { @@ -2566,7 +2566,7 @@ static void addInstance(ClassDefMutable* classEntity, ClassDefMutable* ar, if (!VhdlDocGen::isSubClass(classEntity,cd,true,0)) { - classEntity->insertSubClass(cd,Public,Normal,0); + classEntity->insertSubClass(cd,Public,Normal,QCString()); classEntity->setLanguage(SrcLangExt_VHDL); } @@ -2574,14 +2574,14 @@ ferr: QCString uu=cur->name; std::unique_ptr<MemberDefMutable> md { createMemberDef( ar->getDefFileName(), cur->startLine,cur->startColumn, - n1,uu,uu, 0, + n1,uu,uu, QCString(), Public, Normal, cur->stat,Member, MemberType_Variable, ArgumentList(), ArgumentList(), "") }; - if (ar->getOutputFileBase()) + if (!ar->getOutputFileBase().isEmpty()) { TagInfo tg; tg.anchor = 0; @@ -2590,13 +2590,13 @@ ferr: md->setTagInfo(&tg); } - //fprintf(stderr,"\n%s%s%s\n",md->name().data(),cur->brief.data(),cur->doc.data()); + //fprintf(stderr,"\n%s%s%s\n",qPrint(md->name()),qPrint(cur->brief),qPrint(cur->doc)); md->setLanguage(SrcLangExt_VHDL); md->setMemberSpecifiers(VhdlDocGen::INSTANTIATION); md->setBriefDescription(cur->brief,cur->briefFile,cur->briefLine); md->setBodySegment(cur->startLine,cur->startLine,-1) ; - md->setDocumentation(cur->doc.data(),cur->docFile.data(),cur->docLine); + md->setDocumentation(cur->doc,cur->docFile,cur->docLine); FileDef *fd=ar->getFileDef(); md->setBodyDef(fd); ar->insertMember(md.get()); @@ -2612,7 +2612,7 @@ void VhdlDocGen::writeRecordUnit(QCString & largs,QCString & ltype,OutputList& if (i>0) { //sets the real record member name - const_cast<MemberDefMutable*>(mdef)->setName(mdef->name().left(i).data()); + const_cast<MemberDefMutable*>(mdef)->setName(mdef->name().left(i)); } writeLink(mdef,ol); @@ -2638,7 +2638,7 @@ void VhdlDocGen::writeRecUnitDocu( for(size_t i=0;i<len;i++) { - QCString n=ql[i]; + QCString n=QCString(ql[i]); ol.startParameterType(first,""); ol.endParameterType(); ol.startParameterName(TRUE); @@ -2662,7 +2662,7 @@ void VhdlDocGen::writeRecUnitDocu( bool VhdlDocGen::isSubClass(ClassDef* cd,ClassDef *scd, bool followInstances,int level) { bool found=FALSE; - //printf("isBaseClass(cd=%s) looking for %s\n",name().data(),bcd->name().data()); + //printf("isBaseClass(cd=%s) looking for %s\n",qPrint(name()),qPrint(bcd->name())); if (level>255) { err("Possible recursive class relation while inside %s and looking for %s\n",qPrint(cd->name()),qPrint(scd->name())); @@ -2674,7 +2674,7 @@ bool VhdlDocGen::isSubClass(ClassDef* cd,ClassDef *scd, bool followInstances,int { const ClassDef *ccd=bcd.classDef; if (!followInstances && ccd->templateMaster()) ccd=ccd->templateMaster(); - //printf("isSubClass() subclass %s\n",ccd->name().data()); + //printf("isSubClass() subclass %s\n",qPrint(ccd->name())); if (ccd==scd) { found=TRUE; @@ -2753,12 +2753,12 @@ void VhdlDocGen::createFlowChart(const MemberDef *mdef) mdList.push_back(mdef); } - //fprintf(stderr,"\n create flow mem %s %p\n",mdef->name().data(),mdef); + //fprintf(stderr,"\n create flow mem %s %p\n",qPrint(mdef->name()),mdef); int actualStart= mdef->getStartBodyLine(); int actualEnd=mdef->getEndBodyLine(); const FileDef* fd=mdef->getFileDef(); - bool b=readCodeFragment( fd->absFilePath().data(), actualStart,actualEnd,codeFragment); + bool b=readCodeFragment( fd->absFilePath(), actualStart,actualEnd,codeFragment); if (!b) return; auto parser { Doxygen::parserManager->getOutlineParser(".vhd") }; @@ -2897,7 +2897,7 @@ void alignText(QCString & q) q.append(" ..."); - QCString str(q.data()); + QCString str(q); QCString temp; while (str.length()>80) @@ -2941,7 +2941,7 @@ void FlowChart::printNode(const FlowChart& flo) q=" "; } QCString nn=flo.exp.stripWhiteSpace(); - printf("\nYES: %s%s[%d,%d]",q.data(),nn.data(),flo.stamp,flo.id); + printf("\nYES: %s%s[%d,%d]",qPrint(q),qPrint(nn),flo.stamp,flo.id); } else { @@ -3030,7 +3030,7 @@ void FlowChart::colTextNodes() const FlowChart &ftemp = flowList[j+1]; if (ftemp.type & EMPTY) { - FlowChart fc(TEXT_NO,"empty ",0); + FlowChart fc(TEXT_NO,"empty ",QCString()); fc.stamp = flo.stamp; flowList.insert(flowList.begin()+j+1,fc); } @@ -3054,7 +3054,7 @@ void FlowChart::delFlowList() flowList.clear(); } -void FlowChart::alignCommentNode(std::ostream &t,QCString com) +void FlowChart::alignCommentNode(TextStream &t,QCString com) { uint max=0; QCString s; @@ -3085,12 +3085,12 @@ void FlowChart::alignCommentNode(std::ostream &t,QCString com) { s+="\n"; } - FlowChart::codify(t,s.data()); + FlowChart::codify(t,s); } } -void FlowChart::buildCommentNodes(std::ostream & t) +void FlowChart::buildCommentNodes(TextStream & t) { size_t size=flowList.size(); bool begin=false; @@ -3175,11 +3175,11 @@ void FlowChart::buildCommentNodes(std::ostream & t) }// for; } -void FlowChart::codify(std::ostream &t,const char *str) +void FlowChart::codify(TextStream &t,const QCString &str) { - if (str) + if (!str.isEmpty()) { - const char *p=str; + const char *p=str.data(); char c; while (*p) { @@ -3202,7 +3202,7 @@ FlowChart::~FlowChart() { } -FlowChart::FlowChart(int typ,const char * t,const char* ex,const char* lab) +FlowChart::FlowChart(int typ,const QCString &t,const QCString &ex,const QCString &lab) { stamp=ifcounter; @@ -3229,7 +3229,7 @@ FlowChart::FlowChart(int typ,const char * t,const char* ex,const char* lab) id=nodeCounter++; } -void FlowChart::addFlowChart(int type,const char* text,const char* exp, const char *label) +void FlowChart::addFlowChart(int type,const QCString &text,const QCString &exp, const QCString &label) { if (!VhdlDocGen::getFlowMember()) return; @@ -3237,12 +3237,12 @@ void FlowChart::addFlowChart(int type,const char* text,const char* exp, const ch QCString expression(exp); - if (text) + if (!text.isEmpty()) { typeString=substitute(typeString,";","\n"); } - if (exp) + if (!exp.isEmpty()) { expression=substitute(expression,"\"","\\\""); } @@ -3388,7 +3388,7 @@ void FlowChart::createSVG() //const MemberDef *m=VhdlDocGen::getFlowMember(); //if (m) - // fprintf(stderr,"\n creating flowchart : %s %s in file %s \n",theTranslator->trVhdlType(m->getMemberSpecifiers(),TRUE),m->name().data(),m->getFileDef()->name().data()); + // fprintf(stderr,"\n creating flowchart : %s %s in file %s \n",theTranslator->trVhdlType(m->getMemberSpecifiers(),TRUE),qPrint(m->name()),qPrint(m->getFileDef()->name())); QCString dir=" -o \""+ov+qcs+"\""; ov+="/flow_design.dot"; @@ -3401,7 +3401,7 @@ void FlowChart::createSVG() } } -void FlowChart::startDot(std::ostream &t) +void FlowChart::startDot(TextStream &t) { t << " digraph G { \n"; t << "rankdir=TB \n"; @@ -3409,7 +3409,7 @@ void FlowChart::startDot(std::ostream &t) t << "stylesheet=\"doxygen.css\"\n"; } -void FlowChart::endDot(std::ostream &t) +void FlowChart::endDot(TextStream &t) { t << " } \n"; } @@ -3420,12 +3420,13 @@ void FlowChart::writeFlowChart() QCString ov = Config_getString(HTML_OUTPUT); QCString fileName = ov+"/flow_design.dot"; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { - err("Cannot open file %s for writing\n",fileName.data()); + err("Cannot open file %s for writing\n",qPrint(fileName)); return; } + TextStream t(&f); colTextNodes(); // buildCommentNodes(t); @@ -3438,7 +3439,8 @@ void FlowChart::writeFlowChart() { printUmlTree(); delFlowList(); - t.close(); + t.flush(); + f.close(); return; } @@ -3452,11 +3454,12 @@ void FlowChart::writeFlowChart() FlowChart::endDot(t); delFlowList(); - t.close(); + t.flush(); + f.close(); FlowChart::createSVG(); }// writeFlowChart -void FlowChart::writeShape(std::ostream &t,const FlowChart &fl) +void FlowChart::writeShape(TextStream &t,const FlowChart &fl) { if (fl.type & EEND) return; QCString var; @@ -3497,7 +3500,7 @@ void FlowChart::writeShape(std::ostream &t,const FlowChart &fl) QCString kl; if (exit) kl=fl.text+" "; - if (fl.label) + if (!fl.label.isEmpty()) { kl+=fl.label+":"+exp+var; } @@ -3558,14 +3561,14 @@ void FlowChart::writeShape(std::ostream &t,const FlowChart &fl) } -void FlowChart::writeEdge(std::ostream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i) +void FlowChart::writeEdge(TextStream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i) { bool b=fl_from.type & STARTL; bool c=fl_to.type & STARTL; #ifdef DEBUGFLOW - QCString s1(getNodeName(fl_from.id).data()); - QCString s2(getNodeName(fl_to.id).data()); + QCString s1(getNodeName(fl_from.id)); + QCString s2(getNodeName(fl_to.id)); auto it = g_keyMap.find(s1.str()); auto it1 = g_keyMap.find(s2.str()); // checks if the link is connected to a valid node @@ -3576,7 +3579,7 @@ void FlowChart::writeEdge(std::ostream &t,const FlowChart &fl_from,const FlowCha writeEdge(t,fl_from.id,fl_to.id,i,b,c); } -void FlowChart::writeEdge(std::ostream &t,int fl_from,int fl_to,int i,bool bFrom,bool bTo) +void FlowChart::writeEdge(TextStream &t,int fl_from,int fl_to,int i,bool bFrom,bool bTo) { QCString label,col; @@ -3597,10 +3600,10 @@ void FlowChart::writeEdge(std::ostream &t,int fl_from,int fl_to,int i,bool bFrom } t << "edge [color=\""+col+"\",label=\""+label+"\"]\n"; - t << getNodeName(fl_from).data(); + t << getNodeName(fl_from); if (bFrom) t << ":s"; t << "->"; - t << getNodeName(fl_to).data(); + t << getNodeName(fl_to); if (bTo) t << ":n"; t << "\n"; } @@ -3631,7 +3634,7 @@ void FlowChart::alignFuncProc( QCString & q,const ArgumentList &al,bool isFunc) attl+=arg.type; if (--index) attl+=",\n"; else attl+="\n"; - attl.prepend(prev.data()); + attl.prepend(prev); temp+=attl; } @@ -3688,7 +3691,7 @@ size_t FlowChart::findLabel(size_t index,const QCString &label) return j; } } - err("could not find label: %s",label.data()); + err("could not find label: %s",qPrint(label)); return 0; } @@ -3768,7 +3771,7 @@ size_t FlowChart::getNextIfLink(const FlowChart &fl,size_t index) return getNextNode(endifNode,stamp); } -void FlowChart::writeFlowLinks(std::ostream &t) +void FlowChart::writeFlowLinks(TextStream &t) { size_t size=flowList.size(); if (size<2) return; @@ -3864,7 +3867,7 @@ void FlowChart::writeFlowLinks(std::ostream &t) { size_t z; bool b = kind==NEXT_NO; - if (fll.exp) + if (!fll.exp.isEmpty()) { writeEdge(t,fll,flowList[j+1],1); } diff --git a/src/vhdldocgen.h b/src/vhdldocgen.h index aa3313e..207e449 100644 --- a/src/vhdldocgen.h +++ b/src/vhdldocgen.h @@ -36,11 +36,12 @@ class Definition; class GroupDef; class FileDef; class NamespaceDef; +class TextStream; struct Argument; struct VhdlConfNode { - VhdlConfNode(const char* a,const char* b,const char* config,const char* cs,bool leaf) + VhdlConfNode(const QCString &a,const QCString &b,const QCString &config,const QCString &cs,bool leaf) { arch=a; // architecture e.g. for iobuffer arch=arch.lower(); @@ -115,10 +116,10 @@ class VhdlDocGen static bool isSubClass(ClassDef* cd,ClassDef *scd, bool followInstances,int level); - static QCString getIndexWord(const char* ,int index); + static QCString getIndexWord(const QCString &,int index); static bool deleteCharRev(QCString &s,char c); static void deleteAllChars(QCString &s,char c); - static void parseFuncProto(const char* text, + static void parseFuncProto(const QCString &text, QCString& name, QCString& ret, bool doc=false); @@ -135,13 +136,13 @@ class VhdlDocGen static const MemberDef* findMemberDef(ClassDef* cd, const QCString& key, MemberListType type); - static ClassDef *getClass(const char *name); + static ClassDef *getClass(const QCString &name); static const MemberDef* findFunction(const QCString& name, const QCString& package); static QCString getClassTitle(const ClassDef*); static void writeInlineClassLink(const ClassDef*, OutputList &ol); - static void writeTagFile(MemberDefMutable *mdef,std::ostream &tagFile); + static void writeTagFile(MemberDefMutable *mdef,TextStream &tagFile); static bool isConstraint(const MemberDef *mdef); static bool isConfig(const MemberDef *mdef); @@ -197,7 +198,7 @@ class VhdlDocGen static void writeVHDLDeclarations(const MemberList* ml,OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, - const char *title,const char *subtitle,bool showEnumValues,int type); + const QCString &title,const QCString &subtitle,bool showEnumValues,int type); static bool writeClassType(const ClassDef *,OutputList &ol ,QCString & cname); @@ -209,10 +210,9 @@ class VhdlDocGen static bool isNumber(const std::string& s); static QCString getProtectionName(int prot); - static void parseUCF(const char* input,Entry* entity,QCString f,bool vendor); + static void parseUCF(const char* input,Entry* entity,const QCString &f,bool vendor); static const ClassDef* findArchitecture(const ClassDef *cd); - //static const ClassDef* findArchitecture(QCString identifier, QCString entity_name); static void correctMemberProperties(MemberDefMutable *md); @@ -221,14 +221,14 @@ class VhdlDocGen static QCString parseForConfig(QCString & entity,QCString & arch); static QCString parseForBinding(QCString & entity,QCString & arch); static void addBaseClass(ClassDef* cd,ClassDef *ent); - static ClassDef* findVhdlClass(const char *className ); + static ClassDef* findVhdlClass(const QCString &className ); static void writeOverview(OutputList &ol); static void writeOverview(); // flowcharts static void createFlowChart(const MemberDef*); - //static void addFlowImage(const std::ostream &,const QCString &); + //static void addFlowImage(const TextStream &,const QCString &); static void setFlowMember( const MemberDef *flowMember); static const MemberDef *getFlowMember(); @@ -288,13 +288,13 @@ class FlowChart //---------- create svg ------------------------------------------------------------- static void createSVG(); - static void startDot(std::ostream &t); - static void endDot(std::ostream &t); - static void codify(std::ostream &t,const char *str); - static void writeShape(std::ostream &t,const FlowChart &fl); - static void writeEdge(std::ostream &t,int fl_from,int fl_to,int i,bool bFrom=FALSE,bool bTo=FALSE); - static void writeEdge(std::ostream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i); - static void writeFlowLinks(std::ostream &t); + static void startDot(TextStream &t); + static void endDot(TextStream &t); + static void codify(TextStream &t,const QCString &str); + static void writeShape(TextStream &t,const FlowChart &fl); + static void writeEdge(TextStream &t,int fl_from,int fl_to,int i,bool bFrom=FALSE,bool bTo=FALSE); + static void writeEdge(TextStream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i); + static void writeFlowLinks(TextStream &t); static QCString getNodeName(int n); static void colTextNodes(); @@ -309,7 +309,7 @@ class FlowChart static void delFlowList(); static const char* getNodeType(int c); - static void addFlowChart(int type,const char* text,const char* exp,const char * label=0); + static void addFlowChart(int type,const QCString &text,const QCString &exp,const QCString &label=QCString()); static void moveToPrevLevel(); static int getTimeStamp(); static void writeFlowChart(); @@ -317,13 +317,13 @@ class FlowChart static QCString convertNameToFileName(); static void printNode(const FlowChart& n); static void printFlowTree(); - static void buildCommentNodes(std::ostream &t); - static void alignCommentNode(std::ostream &t,QCString com); + static void buildCommentNodes(TextStream &t); + static void alignCommentNode(TextStream &t,QCString com); static void printUmlTree(); static QCString printPlantUmlNode(const FlowChart &flo,bool,bool); - FlowChart(int typ,const char* t,const char* ex,const char* label=0); + FlowChart(int typ,const QCString &t,const QCString &ex,const QCString &label=QCString()); ~FlowChart(); private: diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp index f060c30..963f3ec 100644 --- a/src/vhdljjparser.cpp +++ b/src/vhdljjparser.cpp @@ -57,7 +57,7 @@ static EntryList g_instFiles; struct VHDLOutlineParser::Private { - void parseVhdlfile(const char *fileName,const char* inputBuffer,bool inLine); + void parseVhdlfile(const QCString &fileName,const char* inputBuffer,bool inLine); VHDLOutlineParser *thisParser = 0; VhdlParser *vhdlParser = 0; @@ -86,20 +86,20 @@ struct VHDLOutlineParser::Private }; -void VHDLOutlineParser::Private::parseVhdlfile(const char *fileName, +void VHDLOutlineParser::Private::parseVhdlfile(const QCString &fileName, const char* inputBuffer,bool inLine) { JAVACC_STRING_TYPE s =inputBuffer; CharStream *stream = new CharStream(s.c_str(), (int)s.size(), 1, 1); VhdlParserTokenManager *tokenManager = new VhdlParserTokenManager(stream); - VhdlTokenManagerErrorHandler *tokErrHandler=new VhdlTokenManagerErrorHandler(fileName); + VhdlTokenManagerErrorHandler *tokErrHandler=new VhdlTokenManagerErrorHandler(fileName.data()); vhdlParser=new VhdlParser(tokenManager); vhdlParser->setOutlineParser(thisParser); vhdlParser->setSharedState(&shared); tokenManager->setLexParser(vhdlParser); tokenManager->ReInit(stream,0); tokenManager->setErrorHandler(tokErrHandler); - VhdlErrorHandler *parserErrHandler=new VhdlErrorHandler(fileName); + VhdlErrorHandler *parserErrHandler=new VhdlErrorHandler(fileName.data()); vhdlParser->setErrorHandler(parserErrHandler); try { @@ -129,7 +129,7 @@ VHDLOutlineParser::~VHDLOutlineParser() { } -void VHDLOutlineParser::parseInput(const char *fileName,const char *fileBuf, +void VHDLOutlineParser::parseInput(const QCString &fileName,const char *fileBuf, const std::shared_ptr<Entry> &root, ClangTUParser *) { VhdlParser::SharedState *s = &p->shared; @@ -138,7 +138,7 @@ void VHDLOutlineParser::parseInput(const char *fileName,const char *fileBuf, // fprintf(stderr,"\n ============= %s\n ==========\n",fileBuf); - bool inLine = (fileName==0 || strlen(fileName)==0); + bool inLine = fileName.isEmpty(); p->yyFileName=fileName; @@ -266,7 +266,7 @@ void VHDLOutlineParser::handleFlowComment(const char* doc) QCString qcs(doc); qcs=qcs.stripWhiteSpace(); qcs.stripPrefix("--#"); - FlowChart::addFlowChart(FlowChart::COMMENT_NO,0,0,qcs.data()); + FlowChart::addFlowChart(FlowChart::COMMENT_NO,QCString(),QCString(),qcs); } } @@ -324,7 +324,7 @@ int VHDLOutlineParser::checkInlineCode(QCString &doc) QCString na; for (const auto &qcs_ : ql) { - QCString qcs = qcs_; + QCString qcs(qcs_); qcs = qcs.simplifyWhiteSpace(); if (findRe(qcs,csRe)!=-1) { @@ -380,7 +380,7 @@ int VHDLOutlineParser::checkInlineCode(QCString &doc) return 1; } -void VHDLOutlineParser::handleCommentBlock(const char *doc1, bool brief) +void VHDLOutlineParser::handleCommentBlock(const QCString &doc1, bool brief) { int position = 0; bool needsEntry = FALSE; @@ -462,7 +462,7 @@ void VHDLOutlineParser::handleCommentBlock(const char *doc1, bool brief) p->strComment.resize(0); } -void VHDLOutlineParser::parsePrototype(const char *text) +void VHDLOutlineParser::parsePrototype(const QCString &text) { p->varName=text; p->varr=TRUE; @@ -618,7 +618,7 @@ void VHDLOutlineParser::pushLabel( QCString &label,QCString & val) QCString VHDLOutlineParser::popLabel(QCString & q) { int i=q.findRev("|"); - if (i<0) return ""; + if (i<0) return QCString(); q = q.left(i); return q; } @@ -764,9 +764,9 @@ void VHDLOutlineParser::createFlow() q+=")"; } - q.prepend(VhdlDocGen::getFlowMember()->name().data()); + q.prepend(VhdlDocGen::getFlowMember()->name()); - FlowChart::addFlowChart(FlowChart::START_NO,q,0); + FlowChart::addFlowChart(FlowChart::START_NO,q,QCString()); if (s->currP==VhdlDocGen::FUNCTION) { @@ -781,7 +781,7 @@ void VHDLOutlineParser::createFlow() ret="end process "; } - FlowChart::addFlowChart(FlowChart::END_NO,ret,0); + FlowChart::addFlowChart(FlowChart::END_NO,ret,QCString()); // FlowChart::printFlowList(); FlowChart::writeFlowChart(); s->currP=0; @@ -849,7 +849,7 @@ void VHDLOutlineParser::error_skipto(int kind) p->vhdlParser->getNextToken(); // step to next token op=p->vhdlParser->getToken(1); // get first token if (op==0) break; - //fprintf(stderr,"\n %s",t->image.data()); + //fprintf(stderr,"\n %s",qPrint(t->image)); } while (op->kind != kind); p->vhdlParser->clearError(); // The above loop consumes tokens all the way up to a token of diff --git a/src/vhdljjparser.h b/src/vhdljjparser.h index 01316a7..542f48d 100755 --- a/src/vhdljjparser.h +++ b/src/vhdljjparser.h @@ -29,13 +29,13 @@ class VHDLOutlineParser : public OutlineParserInterface public: VHDLOutlineParser(); virtual ~VHDLOutlineParser(); - void parseInput(const char * fileName, + void parseInput(const QCString &fileName, const char *fileBuf, const std::shared_ptr<Entry> &root, ClangTUParser *clangParser); bool needsPreprocessing(const QCString &) const { return TRUE; } - void parsePrototype(const char *text); + void parsePrototype(const QCString &text); // interface for generated parser code @@ -50,7 +50,7 @@ class VHDLOutlineParser : public OutlineParserInterface void createFunction(const char *impure,uint64 spec,const char *fname); void addVhdlType(const char *n,int startLine,int section, uint64 spec,const char* args,const char* type,Protection prot); void addCompInst(const char *n, const char* instName, const char* comp,int iLine); - void handleCommentBlock(const char* doc,bool brief); + void handleCommentBlock(const QCString &doc,bool brief); void handleFlowComment(const char*); void initEntry(Entry *e); void newEntry(); diff --git a/src/xmlcode.h b/src/xmlcode.h index 5a35506..93b05b7 100644 --- a/src/xmlcode.h +++ b/src/xmlcode.h @@ -33,11 +33,11 @@ class XMLCodeParser : public CodeParserInterface XMLCodeParser(); virtual ~XMLCodeParser(); void parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt, bool isExampleBlock, - const char *exampleName=0, + const QCString &exampleName=QCString(), FileDef *fileDef=0, int startLine=-1, int endLine=-1, diff --git a/src/xmlcode.l b/src/xmlcode.l index 65406d4..ff3d247 100644 --- a/src/xmlcode.l +++ b/src/xmlcode.l @@ -246,7 +246,7 @@ static void startCodeLine(yyscan_t yyscanner) yyextra->currentDefinition = d; yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr); //yyextra->insideBody = false; - yyextra->classScope = d->name().copy(); + yyextra->classScope = d->name(); QCString lineAnchor; lineAnchor.sprintf("l%05d",yyextra->yyLineNr); if (yyextra->currentMemberDef) @@ -260,13 +260,13 @@ static void startCodeLine(yyscan_t yyscanner) { yyextra->code->writeLineNumber(d->getReference(), d->getOutputFileBase(), - 0,yyextra->yyLineNr); + QCString(),yyextra->yyLineNr); setCurrentDoc(yyscanner,lineAnchor); } } else { - yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr); + yyextra->code->writeLineNumber(QCString(),QCString(),QCString(),yyextra->yyLineNr); } } @@ -395,11 +395,11 @@ void XMLCodeParser::resetCodeParserState() } void XMLCodeParser::parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, + const QCString &scopeName, const QCString &input, SrcLangExt, bool isExampleBlock, - const char *exampleName, + const QCString &exampleName, FileDef *fileDef, int startLine, int endLine, @@ -415,10 +415,10 @@ void XMLCodeParser::parseCode(CodeOutputInterface &codeOutIntf, if (input.isEmpty()) return; - printlex(yy_flex_debug, true, __FILE__, fileDef ? fileDef->fileName().data(): NULL); + printlex(yy_flex_debug, true, __FILE__, fileDef ? qPrint(fileDef->fileName()): NULL); yyextra->code = &codeOutIntf; - yyextra->inputString = input; + yyextra->inputString = input.data(); yyextra->inputPosition = 0; yyextra->currentFontClass = 0; yyextra->needsTermination = false; @@ -443,7 +443,7 @@ void XMLCodeParser::parseCode(CodeOutputInterface &codeOutIntf, if (isExampleBlock && fileDef==0) { // create a dummy filedef for the example - yyextra->sourceFileDef = createFileDef("",(exampleName?exampleName:"generated")); + yyextra->sourceFileDef = createFileDef("",(!exampleName.isEmpty()?exampleName:QCString("generated"))); cleanupSourceDef = true; } @@ -471,7 +471,7 @@ void XMLCodeParser::parseCode(CodeOutputInterface &codeOutIntf, yyextra->sourceFileDef=0; } - printlex(yy_flex_debug, false, __FILE__, fileDef ? fileDef->fileName().data(): NULL); + printlex(yy_flex_debug, false, __FILE__, fileDef ? qPrint(fileDef->fileName()): NULL); } diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index a356682..757ae76 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -35,7 +35,7 @@ static void visitCaption(XmlDocVisitor *parent, const DocNodeList &children) for (const auto &n : children) n->accept(parent); } -static void visitPreStart(std::ostream &t, const char *cmd, bool doCaption, +static void visitPreStart(TextStream &t, const char *cmd, bool doCaption, XmlDocVisitor *parent, const DocNodeList &children, const QCString &name, bool writeType, DocImage::Type type, const QCString &width, const QCString &height, const QCString &alt = QCString(""), bool inlineImage = FALSE) @@ -82,12 +82,12 @@ static void visitPreStart(std::ostream &t, const char *cmd, bool doCaption, t << ">"; } -static void visitPostEnd(std::ostream &t, const char *cmd) +static void visitPostEnd(TextStream &t, const char *cmd) { t << "</" << cmd << ">\n"; } -XmlDocVisitor::XmlDocVisitor(std::ostream &t,CodeOutputInterface &ci,const char *langExt) +XmlDocVisitor::XmlDocVisitor(TextStream &t,CodeOutputInterface &ci,const QCString &langExt) : DocVisitor(DocVisitor_XML), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_langExt(langExt) { @@ -452,7 +452,7 @@ void XmlDocVisitor::visit(DocInclude *inc) void XmlDocVisitor::visit(DocIncOperator *op) { //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n", - // op->type(),op->isFirst(),op->isLast(),op->text().data()); + // op->type(),op->isFirst(),op->isLast(),qPrint(op->text())); if (op->isFirst()) { if (!m_hide) @@ -710,7 +710,14 @@ void XmlDocVisitor::visitPre(DocHtmlList *s) { if (m_hide) return; if (s->type()==DocHtmlList::Ordered) - m_t << "<orderedlist>\n"; + { + m_t << "<orderedlist"; + for (const auto &opt : s->attribs()) + { + m_t << " " << opt.name << "=\"" << opt.value << "\""; + } + m_t << ">\n"; + } else m_t << "<itemizedlist>\n"; } @@ -937,7 +944,7 @@ void XmlDocVisitor::visitPre(DocImage *img) bool ambig; if (url.isEmpty() && (fd=findFileDef(Doxygen::imageNameLinkedMap,img->name(),ambig))) { - copyFile(fd->absFilePath(),Config_getString(XML_OUTPUT)+"/"+baseName.data()); + copyFile(fd->absFilePath(),Config_getString(XML_OUTPUT)+"/"+baseName); } } @@ -1166,7 +1173,7 @@ void XmlDocVisitor::visitPost(DocXRefItem *x) void XmlDocVisitor::visitPre(DocInternalRef *ref) { if (m_hide) return; - startLink(0,ref->file(),ref->anchor()); + startLink(QCString(),ref->file(),ref->anchor()); } void XmlDocVisitor::visitPost(DocInternalRef *) @@ -1217,14 +1224,14 @@ void XmlDocVisitor::visitPost(DocParBlock *) } -void XmlDocVisitor::filter(const char *str) +void XmlDocVisitor::filter(const QCString &str) { m_t << convertToXML(str); } void XmlDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor) { - //printf("XmlDocVisitor: file=%s anchor=%s\n",file.data(),anchor.data()); + //printf("XmlDocVisitor: file=%s anchor=%s\n",qPrint(file),qPrint(anchor)); m_t << "<ref refid=\"" << file; if (!anchor.isEmpty()) m_t << "_1" << anchor; m_t << "\" kindref=\""; diff --git a/src/xmldocvisitor.h b/src/xmldocvisitor.h index 0309a5e..f4b2a71 100644 --- a/src/xmldocvisitor.h +++ b/src/xmldocvisitor.h @@ -23,6 +23,7 @@ #include "qcstring.h" #include "docvisitor.h" +#include "textstream.h" class CodeOutputInterface; class QCString; @@ -31,7 +32,7 @@ class QCString; class XmlDocVisitor : public DocVisitor { public: - XmlDocVisitor(std::ostream &t,CodeOutputInterface &ci,const char *langExt); + XmlDocVisitor(TextStream &t,CodeOutputInterface &ci,const QCString &langExt); //-------------------------------------- // visitor functions for leaf nodes @@ -145,7 +146,7 @@ class XmlDocVisitor : public DocVisitor // helper functions //-------------------------------------- - void filter(const char *str); + void filter(const QCString &str); void startLink(const QCString &ref,const QCString &file, const QCString &anchor); void endLink(); @@ -154,7 +155,7 @@ class XmlDocVisitor : public DocVisitor // state variables //-------------------------------------- - std::ostream &m_t; + TextStream &m_t; CodeOutputInterface &m_ci; bool m_insidePre; bool m_hide; diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 39346da..86f3081 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -15,6 +15,7 @@ #include <stdlib.h> +#include "textstream.h" #include "xmlgen.h" #include "doxygen.h" #include "message.h" @@ -106,13 +107,15 @@ static const char *xmlSectionMapper(MemberListType ml) } -inline void writeXMLString(std::ostream &t,const char *s) +inline void writeXMLString(TextStream &t,const QCString &s) { t << convertToXML(s); } -inline void writeXMLCodeString(std::ostream &t,const char *s, int &col) +inline void writeXMLCodeString(TextStream &t,const QCString &str, int &col) { + if (str.isEmpty()) return; + const char *s = str.data(); char c; while ((c=*s++)) { @@ -145,7 +148,7 @@ inline void writeXMLCodeString(std::ostream &t,const char *s, int &col) } -static void writeXMLHeader(std::ostream &t) +static void writeXMLHeader(TextStream &t) { t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";; t << "<doxygen xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; @@ -162,7 +165,7 @@ static void writeCombineScript() std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); if (!t.is_open()) { - err("Cannot open file %s for writing!\n",fileName.data()); + err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } @@ -185,16 +188,16 @@ static void writeCombineScript() } -void writeXMLLink(std::ostream &t,const char *extRef,const char *compoundId, - const char *anchorId,const char *text,const char *tooltip) +void writeXMLLink(TextStream &t,const QCString &extRef,const QCString &compoundId, + const QCString &anchorId,const QCString &text,const QCString &tooltip) { t << "<ref refid=\"" << compoundId; - if (anchorId) t << "_1" << anchorId; + if (!anchorId.isEmpty()) t << "_1" << anchorId; t << "\" kindref=\""; - if (anchorId) t << "member"; else t << "compound"; + if (!anchorId.isEmpty()) t << "member"; else t << "compound"; t << "\""; - if (extRef) t << " external=\"" << extRef << "\""; - if (tooltip) t << " tooltip=\"" << convertToXML(tooltip) << "\""; + if (!extRef.isEmpty()) t << " external=\"" << extRef << "\""; + if (!tooltip.isEmpty()) t << " tooltip=\"" << convertToXML(tooltip) << "\""; t << ">"; writeXMLString(t,text); t << "</ref>"; @@ -204,26 +207,26 @@ void writeXMLLink(std::ostream &t,const char *extRef,const char *compoundId, class TextGeneratorXMLImpl : public TextGeneratorIntf { public: - TextGeneratorXMLImpl(std::ostream &t): m_t(t) {} - void writeString(const char *s,bool /*keepSpaces*/) const + TextGeneratorXMLImpl(TextStream &t): m_t(t) {} + void writeString(const QCString &s,bool /*keepSpaces*/) const { writeXMLString(m_t,s); } void writeBreak(int) const {} - void writeLink(const char *extRef,const char *file, - const char *anchor,const char *text + void writeLink(const QCString &extRef,const QCString &file, + const QCString &anchor,const QCString &text ) const { - writeXMLLink(m_t,extRef,file,anchor,text,0); + writeXMLLink(m_t,extRef,file,anchor,text,QCString()); } private: - std::ostream &m_t; + TextStream &m_t; }; //------------------------------------------------------------------------------------------- /** Generator for producing XML formatted source code. */ -void XMLCodeGenerator::codify(const char *text) +void XMLCodeGenerator::codify(const QCString &text) { XML_DB(("(codify \"%s\")\n",text)); if (m_insideCodeLine && !m_insideSpecialHL && m_normalHLNeedStartTag) @@ -233,9 +236,9 @@ void XMLCodeGenerator::codify(const char *text) } writeXMLCodeString(m_t,text,m_col); } -void XMLCodeGenerator::writeCodeLink(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip) +void XMLCodeGenerator::writeCodeLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip) { XML_DB(("(writeCodeLink)\n")); if (m_insideCodeLine && !m_insideSpecialHL && m_normalHLNeedStartTag) @@ -244,10 +247,10 @@ void XMLCodeGenerator::writeCodeLink(const char *ref,const char *file, m_normalHLNeedStartTag=FALSE; } writeXMLLink(m_t,ref,file,anchor,name,tooltip); - m_col+=qstrlen(name); + m_col+=name.length(); } -void XMLCodeGenerator::writeTooltip(const char *, const DocLinkInfo &, const char *, - const char *, const SourceLinkInfo &, const SourceLinkInfo & +void XMLCodeGenerator::writeTooltip(const QCString &, const DocLinkInfo &, const QCString &, + const QCString &, const SourceLinkInfo &, const SourceLinkInfo & ) { XML_DB(("(writeToolTip)\n")); @@ -294,7 +297,7 @@ void XMLCodeGenerator::endCodeLine() m_external.resize(0); m_insideCodeLine=FALSE; } -void XMLCodeGenerator::startFontClass(const char *colorClass) +void XMLCodeGenerator::startFontClass(const QCString &colorClass) { XML_DB(("(startFontClass)\n")); if (m_insideCodeLine && !m_insideSpecialHL && !m_normalHLNeedStartTag) @@ -311,23 +314,23 @@ void XMLCodeGenerator::endFontClass() m_t << "</highlight>"; // non DocBook m_insideSpecialHL=FALSE; } -void XMLCodeGenerator::writeCodeAnchor(const char *) +void XMLCodeGenerator::writeCodeAnchor(const QCString &) { XML_DB(("(writeCodeAnchor)\n")); } -void XMLCodeGenerator::writeLineNumber(const char *extRef,const char *compId, - const char *anchorId,int l) +void XMLCodeGenerator::writeLineNumber(const QCString &extRef,const QCString &compId, + const QCString &anchorId,int l) { XML_DB(("(writeLineNumber)\n")); // we remember the information provided here to use it // at the <codeline> start tag. m_lineNumber = l; - if (compId) + if (!compId.isEmpty()) { m_refId=compId; - if (anchorId) m_refId+=(QCString)"_1"+anchorId; + if (!anchorId.isEmpty()) m_refId+=(QCString)"_1"+anchorId; m_isMemberRef = anchorId!=0; - if (extRef) m_external=extRef; + if (!extRef.isEmpty()) m_external=extRef; } } void XMLCodeGenerator::finish() @@ -335,19 +338,19 @@ void XMLCodeGenerator::finish() if (m_insideCodeLine) endCodeLine(); } -void XMLCodeGenerator::startCodeFragment(const char *) +void XMLCodeGenerator::startCodeFragment(const QCString &) { m_t << " <programlisting>\n"; } -void XMLCodeGenerator::endCodeFragment(const char *) +void XMLCodeGenerator::endCodeFragment(const QCString &) { m_t << " </programlisting>\n"; } //------------------------------------------------------------------------------------------- -static void writeTemplateArgumentList(std::ostream &t, +static void writeTemplateArgumentList(TextStream &t, const ArgumentList &al, const Definition *scope, const FileDef *fileScope, @@ -390,17 +393,22 @@ static void writeTemplateArgumentList(std::ostream &t, } } -static void writeMemberTemplateLists(const MemberDef *md,std::ostream &t) +static void writeMemberTemplateLists(const MemberDef *md,TextStream &t) { writeTemplateArgumentList(t,md->templateArguments(),md->getClassDef(),md->getFileDef(),8); } -static void writeTemplateList(const ClassDef *cd,std::ostream &t) +static void writeTemplateList(const ClassDef *cd,TextStream &t) { - writeTemplateArgumentList(t,cd->templateArguments(),cd,0,4); + writeTemplateArgumentList(t,cd->templateArguments(),cd,cd->getFileDef(),4); } -static void writeXMLDocBlock(std::ostream &t, +static void writeTemplateList(const ConceptDef *cd,TextStream &t) +{ + writeTemplateArgumentList(t,cd->getTemplateParameterList(),cd,cd->getFileDef(),4); +} + +static void writeXMLDocBlock(TextStream &t, const QCString &fileName, int lineNr, const Definition *scope, @@ -411,7 +419,7 @@ static void writeXMLDocBlock(std::ostream &t, if (stext.isEmpty()) return; // convert the documentation string into an abstract syntax tree DocNode *root = validatingParseDoc(fileName,lineNr,scope,md,text,FALSE,FALSE, - 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); + QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); // create a code generator XMLCodeGenerator *xmlCodeGen = new XMLCodeGenerator(t); // create a parse tree visitor for XML @@ -425,7 +433,7 @@ static void writeXMLDocBlock(std::ostream &t, } -void writeXMLCodeBlock(std::ostream &t,FileDef *fd) +void writeXMLCodeBlock(TextStream &t,FileDef *fd) { auto intf=Doxygen::parserManager->getCodeParser(fd->getDefFileExtension()); SrcLangExt langExt = getLanguageFromFileName(fd->getDefFileExtension()); @@ -433,11 +441,11 @@ void writeXMLCodeBlock(std::ostream &t,FileDef *fd) XMLCodeGenerator *xmlGen = new XMLCodeGenerator(t); xmlGen->startCodeFragment("DoxyCode"); intf->parseCode(*xmlGen, // codeOutIntf - 0, // scopeName + QCString(), // scopeName fileToString(fd->absFilePath(),Config_getBool(FILTER_SOURCE_FILES)), langExt, // lang FALSE, // isExampleBlock - 0, // exampleName + QCString(), // exampleName fd, // fileDef -1, // startLine -1, // endLine @@ -450,7 +458,7 @@ void writeXMLCodeBlock(std::ostream &t,FileDef *fd) delete xmlGen; } -static void writeMemberReference(std::ostream &t,const Definition *def,const MemberDef *rmd,const char *tagName) +static void writeMemberReference(TextStream &t,const Definition *def,const MemberDef *rmd,const QCString &tagName) { QCString scope = rmd->getScopeString(); QCString name = rmd->name(); @@ -507,7 +515,7 @@ static QCString memberOutputFileBase(const MemberDef *md) } -static void generateXMLForMember(const MemberDef *md,std::ostream &ti,std::ostream &t,const Definition *def) +static void generateXMLForMember(const MemberDef *md,TextStream &ti,TextStream &t,const Definition *def) { // + declaration/definition arg lists @@ -818,7 +826,7 @@ static void generateXMLForMember(const MemberDef *md,std::ostream &ti,std::ostre t << " <write>" << convertToXML(md->getWriteAccessor()) << "</write>\n"; } - if (md->memberType()==MemberType_Variable && md->bitfieldString()) + if (md->memberType()==MemberType_Variable && !md->bitfieldString().isEmpty()) { QCString bitfield = md->bitfieldString(); if (bitfield.at(0)==':') bitfield=bitfield.mid(1); @@ -912,7 +920,7 @@ static void generateXMLForMember(const MemberDef *md,std::ostream &ti,std::ostre } } else if (md->memberType()==MemberType_Define && - md->argsString()) // define + !md->argsString().isEmpty()) // define { if (md->argumentList().empty()) // special case for "foo()" to // distinguish it from "foo". @@ -927,6 +935,12 @@ static void generateXMLForMember(const MemberDef *md,std::ostream &ti,std::ostre } } } + if (!md->requiresClause().isEmpty()) + { + t << " <requiresclause>"; + linkifyText(TextGeneratorXMLImpl(t),md,md->getFileDef(),md,md->requiresClause()); + t << " </requiresclause>\n"; + } if (md->hasOneLineInitializer() || md->hasMultiLineInitializer()) { @@ -935,7 +949,7 @@ static void generateXMLForMember(const MemberDef *md,std::ostream &ti,std::ostre t << "</initializer>\n"; } - if (md->excpString()) + if (!md->excpString().isEmpty()) { t << " <exceptions>"; linkifyText(TextGeneratorXMLImpl(t),def,md->getBodyDef(),md,md->excpString()); @@ -1036,9 +1050,9 @@ static bool memberVisible(const Definition *d,const MemberDef *md) md->getNamespaceDef()==0; } -static void generateXMLSection(const Definition *d,std::ostream &ti,std::ostream &t, - const MemberList *ml,const char *kind,const char *header=0, - const char *documentation=0) +static void generateXMLSection(const Definition *d,TextStream &ti,TextStream &t, + const MemberList *ml,const QCString &kind,const QCString &header=QCString(), + const QCString &documentation=QCString()) { if (ml==0) return; int count=0; @@ -1053,11 +1067,11 @@ static void generateXMLSection(const Definition *d,std::ostream &ti,std::ostream if (count==0) return; // empty list t << " <sectiondef kind=\"" << kind << "\">\n"; - if (header) + if (!header.isEmpty()) { t << " <header>" << convertToXML(header) << "</header>\n"; } - if (documentation) + if (!documentation.isEmpty()) { t << " <description>"; writeXMLDocBlock(t,d->docFile(),d->docLine(),d,0,documentation); @@ -1073,7 +1087,7 @@ static void generateXMLSection(const Definition *d,std::ostream &ti,std::ostream t << " </sectiondef>\n"; } -static void writeListOfAllMembers(const ClassDef *cd,std::ostream &t) +static void writeListOfAllMembers(const ClassDef *cd,TextStream &t) { t << " <listofallmembers>\n"; for (auto &mni : cd->memberNameInfoLinkedMap()) @@ -1114,7 +1128,7 @@ static void writeListOfAllMembers(const ClassDef *cd,std::ostream &t) t << " </listofallmembers>\n"; } -static void writeInnerClasses(const ClassLinkedRefMap &cl,std::ostream &t) +static void writeInnerClasses(const ClassLinkedRefMap &cl,TextStream &t) { for (const auto &cd : cl) { @@ -1134,7 +1148,7 @@ static void writeInnerClasses(const ClassLinkedRefMap &cl,std::ostream &t) } } -static void writeInnerNamespaces(const NamespaceLinkedRefMap &nl,std::ostream &t) +static void writeInnerNamespaces(const NamespaceLinkedRefMap &nl,TextStream &t) { for (const auto &nd : nl) { @@ -1147,7 +1161,7 @@ static void writeInnerNamespaces(const NamespaceLinkedRefMap &nl,std::ostream &t } } -static void writeInnerFiles(const FileList &fl,std::ostream &t) +static void writeInnerFiles(const FileList &fl,TextStream &t) { for (const auto &fd : fl) { @@ -1156,7 +1170,7 @@ static void writeInnerFiles(const FileList &fl,std::ostream &t) } } -static void writeInnerPages(const PageLinkedRefMap &pl,std::ostream &t) +static void writeInnerPages(const PageLinkedRefMap &pl,TextStream &t) { for (const auto &pd : pl) { @@ -1169,7 +1183,7 @@ static void writeInnerPages(const PageLinkedRefMap &pl,std::ostream &t) } } -static void writeInnerGroups(const GroupList &gl,std::ostream &t) +static void writeInnerGroups(const GroupList &gl,TextStream &t) { for (const auto &sgd : gl) { @@ -1179,7 +1193,7 @@ static void writeInnerGroups(const GroupList &gl,std::ostream &t) } } -static void writeInnerDirs(const DirList *dl,std::ostream &t) +static void writeInnerDirs(const DirList *dl,TextStream &t) { if (dl) { @@ -1191,7 +1205,27 @@ static void writeInnerDirs(const DirList *dl,std::ostream &t) } } -static void generateXMLForClass(const ClassDef *cd,std::ostream &ti) +static void writeIncludeInfo(const IncludeInfo *ii,TextStream &t) +{ + if (ii) + { + QCString nm = ii->includeName; + if (nm.isEmpty() && ii->fileDef) nm = ii->fileDef->docName(); + if (!nm.isEmpty()) + { + t << " <includes"; + if (ii->fileDef && !ii->fileDef->isReference()) // TODO: support external references + { + t << " refid=\"" << ii->fileDef->getOutputFileBase() << "\""; + } + t << " local=\"" << (ii->local ? "yes" : "no") << "\">"; + t << nm; + t << "</includes>\n"; + } + } +} + +static void generateXMLForClass(const ClassDef *cd,TextStream &ti) { // + brief description // + detailed description @@ -1215,7 +1249,7 @@ static void generateXMLForClass(const ClassDef *cd,std::ostream &ti) if (cd->templateMaster()!=0) return; // skip generated template instances. if (cd->isArtificial()) return; // skip artificially created classes - msg("Generating XML output for class %s\n",cd->name().data()); + msg("Generating XML output for class %s\n",qPrint(cd->name())); ti << " <compound refid=\"" << classOutputFileBase(cd) << "\" kind=\"" << cd->compoundTypeString() @@ -1223,12 +1257,13 @@ static void generateXMLForClass(const ClassDef *cd,std::ostream &ti) QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+ classOutputFileBase(cd)+".xml"; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { - err("Cannot open file %s for writing!\n",fileName.data()); + err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } + TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" @@ -1308,23 +1343,7 @@ static void generateXMLForClass(const ClassDef *cd,std::ostream &ti) << "</derivedcompoundref>\n"; } - const IncludeInfo *ii=cd->includeInfo(); - if (ii) - { - QCString nm = ii->includeName; - if (nm.isEmpty() && ii->fileDef) nm = ii->fileDef->docName(); - if (!nm.isEmpty()) - { - t << " <includes"; - if (ii->fileDef && !ii->fileDef->isReference()) // TODO: support external references - { - t << " refid=\"" << ii->fileDef->getOutputFileBase() << "\""; - } - t << " local=\"" << (ii->local ? "yes" : "no") << "\">"; - t << nm; - t << "</includes>\n"; - } - } + writeIncludeInfo(cd->includeInfo(),t); writeInnerClasses(cd->getClasses(),t); @@ -1343,6 +1362,13 @@ static void generateXMLForClass(const ClassDef *cd,std::ostream &ti) } } + if (!cd->requiresClause().isEmpty()) + { + t << " <requiresclause>"; + linkifyText(TextGeneratorXMLImpl(t),cd,cd->getFileDef(),0,cd->requiresClause()); + t << " </requiresclause>\n"; + } + t << " <briefdescription>\n"; writeXMLDocBlock(t,cd->briefFile(),cd->briefLine(),cd,0,cd->briefDescription()); t << " </briefdescription>\n"; @@ -1385,7 +1411,51 @@ static void generateXMLForClass(const ClassDef *cd,std::ostream &ti) ti << " </compound>\n"; } -static void generateXMLForNamespace(const NamespaceDef *nd,std::ostream &ti) +static void generateXMLForConcept(const ConceptDef *cd,TextStream &ti) +{ + if (cd->isReference() || cd->isHidden()) return; // skip external references. + + ti << " <compound refid=\"" << cd->getOutputFileBase() + << "\" kind=\"concept\"" << "><name>" + << convertToXML(cd->name()) << "</name>\n"; + + QCString outputDirectory = Config_getString(XML_OUTPUT); + QCString fileName=outputDirectory+"/"+cd->getOutputFileBase()+".xml"; + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) + { + err("Cannot open file %s for writing!\n",qPrint(fileName)); + return; + } + TextStream t(&f); + writeXMLHeader(t); + t << " <compounddef id=\"" << cd->getOutputFileBase() + << "\" kind=\"concept\">\n"; + t << " <compoundname>"; + writeXMLString(t,cd->name()); + t << "</compoundname>\n"; + writeIncludeInfo(cd->includeInfo(),t); + writeTemplateList(cd,t); + t << " <initializer>"; + linkifyText(TextGeneratorXMLImpl(t),cd,cd->getFileDef(),0,cd->initializer()); + t << " </initializer>\n"; + t << " <briefdescription>\n"; + writeXMLDocBlock(t,cd->briefFile(),cd->briefLine(),cd,0,cd->briefDescription()); + t << " </briefdescription>\n"; + t << " <detaileddescription>\n"; + writeXMLDocBlock(t,cd->docFile(),cd->docLine(),cd,0,cd->documentation()); + t << " </detaileddescription>\n"; + t << " <location file=\"" + << convertToXML(stripFromPath(cd->getDefFileName())) << "\" line=\"" + << cd->getDefLine() << "\"" << " column=\"" + << cd->getDefColumn() << "\"/>\n" ; + t << " </compounddef>\n"; + t << "</doxygen>\n"; + + ti << " </compound>\n"; +} + +static void generateXMLForNamespace(const NamespaceDef *nd,TextStream &ti) { // + contained class definitions // + contained namespace definitions @@ -1404,12 +1474,13 @@ static void generateXMLForNamespace(const NamespaceDef *nd,std::ostream &ti) QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+nd->getOutputFileBase()+".xml"; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { - err("Cannot open file %s for writing!\n",fileName.data()); + err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } + TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" << nd->getOutputFileBase() @@ -1454,7 +1525,7 @@ static void generateXMLForNamespace(const NamespaceDef *nd,std::ostream &ti) ti << " </compound>\n"; } -static void generateXMLForFile(FileDef *fd,std::ostream &ti) +static void generateXMLForFile(FileDef *fd,TextStream &ti) { // + includes files // + includedby files @@ -1478,12 +1549,13 @@ static void generateXMLForFile(FileDef *fd,std::ostream &ti) QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+fd->getOutputFileBase()+".xml"; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { - err("Cannot open file %s for writing!\n",fileName.data()); + err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } + TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" << fd->getOutputFileBase() @@ -1567,7 +1639,7 @@ static void generateXMLForFile(FileDef *fd,std::ostream &ti) ti << " </compound>\n"; } -static void generateXMLForGroup(const GroupDef *gd,std::ostream &ti) +static void generateXMLForGroup(const GroupDef *gd,TextStream &ti) { // + members // + member groups @@ -1588,12 +1660,13 @@ static void generateXMLForGroup(const GroupDef *gd,std::ostream &ti) QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+gd->getOutputFileBase()+".xml"; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { - err("Cannot open file %s for writing!\n",fileName.data()); + err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } + TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" @@ -1633,7 +1706,7 @@ static void generateXMLForGroup(const GroupDef *gd,std::ostream &ti) ti << " </compound>\n"; } -static void generateXMLForDir(DirDef *dd,std::ostream &ti) +static void generateXMLForDir(DirDef *dd,TextStream &ti) { if (dd->isReference()) return; // skip external references ti << " <compound refid=\"" << dd->getOutputFileBase() @@ -1642,12 +1715,13 @@ static void generateXMLForDir(DirDef *dd,std::ostream &ti) QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+dd->getOutputFileBase()+".xml"; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { - err("Cannot open file %s for writing!\n",fileName.data()); + err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } + TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" @@ -1670,7 +1744,7 @@ static void generateXMLForDir(DirDef *dd,std::ostream &ti) ti << " </compound>\n"; } -static void generateXMLForPage(PageDef *pd,std::ostream &ti,bool isExample) +static void generateXMLForPage(PageDef *pd,TextStream &ti,bool isExample) { // + name // + title @@ -1694,12 +1768,13 @@ static void generateXMLForPage(PageDef *pd,std::ostream &ti,bool isExample) QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+pageName+".xml"; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { - err("Cannot open file %s for writing!\n",fileName.data()); + err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } + TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" << pageName; @@ -1742,7 +1817,7 @@ static void generateXMLForPage(PageDef *pd,std::ostream &ti,bool isExample) { if (isSection(si->type())) { - //printf(" level=%d title=%s\n",level,si->title.data()); + //printf(" level=%d title=%s\n",level,qPrint(si->title)); int nextLevel = (int)si->type(); if (nextLevel>level) { @@ -1810,6 +1885,7 @@ static void generateXMLForPage(PageDef *pd,std::ostream &ti,bool isExample) void generateXML() { // + classes + // + concepts // + namespaces // + files // + groups @@ -1825,115 +1901,125 @@ void generateXML() ResourceMgr::instance().copyResource("doxyfile.xsd",outputDirectory); QCString fileName=outputDirectory+"/compound.xsd"; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { - err("Cannot open file %s for writing!\n",fileName.data()); + err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } - - // write compound.xsd, but replace special marker with the entities - QCString compound_xsd = ResourceMgr::instance().getAsString("compound.xsd"); - const char *startLine = compound_xsd.data(); - while (*startLine) { - // find end of the line - const char *endLine = startLine+1; - while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n - int len=endLine-startLine; - if (len>0) + TextStream t(&f); + + // write compound.xsd, but replace special marker with the entities + QCString compound_xsd = ResourceMgr::instance().getAsString("compound.xsd"); + const char *startLine = compound_xsd.data(); + while (*startLine) { - QCString s(len+1); - qstrncpy(s.rawData(),startLine,len); - s[len]='\0'; - if (s.find("<!-- Automatically insert here the HTML entities -->")!=-1) + // find end of the line + const char *endLine = startLine+1; + while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n + int len=static_cast<int>(endLine-startLine); + if (len>0) { - HtmlEntityMapper::instance()->writeXMLSchema(t); - } - else - { - t.write(startLine,len); + QCString s(startLine,len); + if (s.find("<!-- Automatically insert here the HTML entities -->")!=-1) + { + HtmlEntityMapper::instance()->writeXMLSchema(t); + } + else + { + t.write(startLine,len); + } } + startLine=endLine; } - startLine=endLine; } - t.close(); + f.close(); - std::ofstream f; fileName=outputDirectory+"/Doxyfile.xml"; - bool fileOpened=openOutputFile(fileName,f); - if (fileOpened) + f.open(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { - Config::writeXMLDoxyfile(f); + err("Cannot open file %s for writing\n",fileName.data()); + return; } else { - err("Cannot open file %s for writing\n",fileName.data()); - return; + TextStream t(&f); + Config::writeXMLDoxyfile(t); } + f.close(); fileName=outputDirectory+"/index.xml"; - t.open(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + f.open(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { - err("Cannot open file %s for writing!\n",fileName.data()); + err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } - //t.setEncoding(std::ostream::UnicodeUTF8); + else + { + TextStream t(&f); - // write index header - t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";; - t << "<doxygenindex xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; - t << "xsi:noNamespaceSchemaLocation=\"index.xsd\" "; - t << "version=\"" << getDoxygenVersion() << "\" "; - t << "xml:lang=\"" << theTranslator->trISOLang() << "\""; - t << ">\n"; + // write index header + t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";; + t << "<doxygenindex xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; + t << "xsi:noNamespaceSchemaLocation=\"index.xsd\" "; + t << "version=\"" << getDoxygenVersion() << "\" "; + t << "xml:lang=\"" << theTranslator->trISOLang() << "\""; + t << ">\n"; - for (const auto &cd : *Doxygen::classLinkedMap) - { - generateXMLForClass(cd.get(),t); - } - for (const auto &nd : *Doxygen::namespaceLinkedMap) - { - msg("Generating XML output for namespace %s\n",nd->name().data()); - generateXMLForNamespace(nd.get(),t); - } - for (const auto &fn : *Doxygen::inputNameLinkedMap) - { - for (const auto &fd : *fn) + for (const auto &cd : *Doxygen::classLinkedMap) { - msg("Generating XML output for file %s\n",fd->name().data()); - generateXMLForFile(fd.get(),t); + generateXMLForClass(cd.get(),t); + } + for (const auto &cd : *Doxygen::conceptLinkedMap) + { + msg("Generating XML output for concept %s\n",qPrint(cd->name())); + generateXMLForConcept(cd.get(),t); + } + for (const auto &nd : *Doxygen::namespaceLinkedMap) + { + msg("Generating XML output for namespace %s\n",qPrint(nd->name())); + generateXMLForNamespace(nd.get(),t); + } + for (const auto &fn : *Doxygen::inputNameLinkedMap) + { + for (const auto &fd : *fn) + { + msg("Generating XML output for file %s\n",qPrint(fd->name())); + generateXMLForFile(fd.get(),t); + } + } + for (const auto &gd : *Doxygen::groupLinkedMap) + { + msg("Generating XML output for group %s\n",qPrint(gd->name())); + generateXMLForGroup(gd.get(),t); + } + for (const auto &pd : *Doxygen::pageLinkedMap) + { + msg("Generating XML output for page %s\n",qPrint(pd->name())); + generateXMLForPage(pd.get(),t,FALSE); + } + for (const auto &dd : *Doxygen::dirLinkedMap) + { + msg("Generate XML output for dir %s\n",qPrint(dd->name())); + generateXMLForDir(dd.get(),t); + } + for (const auto &pd : *Doxygen::exampleLinkedMap) + { + msg("Generating XML output for example %s\n",qPrint(pd->name())); + generateXMLForPage(pd.get(),t,TRUE); + } + if (Doxygen::mainPage) + { + msg("Generating XML output for the main page\n"); + generateXMLForPage(Doxygen::mainPage.get(),t,FALSE); } - } - for (const auto &gd : *Doxygen::groupLinkedMap) - { - msg("Generating XML output for group %s\n",gd->name().data()); - generateXMLForGroup(gd.get(),t); - } - for (const auto &pd : *Doxygen::pageLinkedMap) - { - msg("Generating XML output for page %s\n",pd->name().data()); - generateXMLForPage(pd.get(),t,FALSE); - } - for (const auto &dd : *Doxygen::dirLinkedMap) - { - msg("Generate XML output for dir %s\n",dd->name().data()); - generateXMLForDir(dd.get(),t); - } - for (const auto &pd : *Doxygen::exampleLinkedMap) - { - msg("Generating XML output for example %s\n",pd->name().data()); - generateXMLForPage(pd.get(),t,TRUE); - } - if (Doxygen::mainPage) - { - msg("Generating XML output for the main page\n"); - generateXMLForPage(Doxygen::mainPage.get(),t,FALSE); - } - //t << " </compoundlist>\n"; - t << "</doxygenindex>\n"; + //t << " </compoundlist>\n"; + t << "</doxygenindex>\n"; + } writeCombineScript(); } diff --git a/src/xmlgen.h b/src/xmlgen.h index 58f9a64..ec67906 100644 --- a/src/xmlgen.h +++ b/src/xmlgen.h @@ -15,37 +15,39 @@ #include "outputgen.h" +class TextStream; + class XMLCodeGenerator : public CodeOutputInterface { public: - XMLCodeGenerator(std::ostream &t) : m_t(t), m_lineNumber(-1), m_isMemberRef(FALSE), m_col(0), + XMLCodeGenerator(TextStream &t) : m_t(t), m_lineNumber(-1), m_isMemberRef(FALSE), m_col(0), m_insideCodeLine(FALSE), m_normalHLNeedStartTag(TRUE), m_insideSpecialHL(FALSE) {} virtual ~XMLCodeGenerator() { } - void codify(const char *text); - void writeCodeLink(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip); - void writeTooltip(const char *, const DocLinkInfo &, const char *, - const char *, const SourceLinkInfo &, const SourceLinkInfo & - ); - void startCodeLine(bool); - void endCodeLine(); - void startFontClass(const char *colorClass); - void endFontClass(); - void writeCodeAnchor(const char *); - void writeLineNumber(const char *extRef,const char *compId, - const char *anchorId,int l); - void setCurrentDoc(const Definition *,const char *,bool){} - void addWord(const char *,bool){} - void startCodeFragment(const char *); - void endCodeFragment(const char *); + void codify(const QCString &text) override; + void writeCodeLink(const QCString &ref,const QCString &file, + const QCString &anchor,const QCString &name, + const QCString &tooltip) override; + void writeTooltip(const QCString &, const DocLinkInfo &, const QCString &, + const QCString &, const SourceLinkInfo &, const SourceLinkInfo & + ) override; + void startCodeLine(bool) override; + void endCodeLine() override; + void startFontClass(const QCString &colorClass) override; + void endFontClass() override; + void writeCodeAnchor(const QCString &) override; + void writeLineNumber(const QCString &extRef,const QCString &compId, + const QCString &anchorId,int l) override; + void setCurrentDoc(const Definition *,const QCString &,bool) override {} + void addWord(const QCString &,bool) override {} + void startCodeFragment(const QCString &) override; + void endCodeFragment(const QCString &) override; void finish(); private: - std::ostream &m_t; + TextStream &m_t; QCString m_refId; QCString m_external; int m_lineNumber; |