From c48639744a6fa118b9851b307107994ba93ce4c8 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 28 Mar 2021 13:58:30 +0200 Subject: Refactoring: Add TextStream buffer to improve output writing performance - direct use of std::stringstream and std::ostream gave a 30% drop in performance. --- src/classdef.cpp | 4 +- src/classdef.h | 2 +- src/code.l | 3 +- src/config.h | 8 +- src/configimpl.h | 49 +- src/configimpl.l | 49 +- src/context.cpp | 84 ++- src/defgen.cpp | 20 +- src/definition.cpp | 2 +- src/definition.h | 4 +- src/definitionimpl.h | 4 +- src/diagram.cpp | 456 +++++++------- src/diagram.h | 6 +- src/dirdef.cpp | 4 +- src/dirdef.h | 2 +- src/docbookgen.cpp | 360 +++++------ src/docbookgen.h | 8 +- src/docbookvisitor.cpp | 6 +- src/docbookvisitor.h | 9 +- src/docsets.cpp | 25 +- src/docsets.h | 5 +- src/doctokenizer.l | 10 +- src/dot.cpp | 6 +- src/dot.h | 3 +- src/dotcallgraph.cpp | 2 +- src/dotcallgraph.h | 2 +- src/dotclassgraph.cpp | 9 +- src/dotclassgraph.h | 12 +- src/dotdirdeps.cpp | 9 +- src/dotdirdeps.h | 2 +- src/dotfilepatcher.cpp | 28 +- src/dotfilepatcher.h | 9 +- src/dotgfxhierarchytable.cpp | 6 +- src/dotgfxhierarchytable.h | 4 +- src/dotgraph.cpp | 18 +- src/dotgraph.h | 9 +- src/dotgroupcollaboration.cpp | 11 +- src/dotgroupcollaboration.h | 10 +- src/dotincldepgraph.cpp | 7 +- src/dotincldepgraph.h | 8 +- src/dotlegendgraph.cpp | 4 +- src/dotnode.cpp | 19 +- src/dotnode.h | 13 +- src/doxygen.cpp | 51 +- src/emoji.cpp | 3 +- src/emoji.h | 5 +- src/entry.cpp | 8 +- src/entry.h | 5 +- src/filedef.cpp | 8 +- src/filedef.h | 2 +- src/formula.cpp | 14 +- src/ftvhelp.cpp | 28 +- src/ftvhelp.h | 10 +- src/groupdef.cpp | 4 +- src/groupdef.h | 2 +- src/growbuf.h | 37 +- src/htmldocvisitor.cpp | 10 +- src/htmldocvisitor.h | 5 +- src/htmlentity.cpp | 3 +- src/htmlentity.h | 5 +- src/htmlgen.cpp | 840 ++++++++++++------------ src/htmlgen.h | 78 +-- src/index.cpp | 22 +- src/latexdocvisitor.cpp | 10 +- src/latexdocvisitor.h | 5 +- src/latexgen.cpp | 621 +++++++++--------- src/latexgen.h | 66 +- src/mandocvisitor.cpp | 2 +- src/mandocvisitor.h | 5 +- src/mangen.cpp | 188 +++--- src/mangen.h | 26 +- src/markdown.cpp | 2 +- src/memberdef.cpp | 4 +- src/memberdef.h | 2 +- src/membergroup.cpp | 2 +- src/membergroup.h | 3 +- src/memberlist.cpp | 2 +- src/memberlist.h | 2 +- src/msc.cpp | 10 +- src/msc.h | 5 +- src/namespacedef.cpp | 8 +- src/namespacedef.h | 2 +- src/outputgen.cpp | 13 +- src/outputgen.h | 3 +- src/pagedef.cpp | 4 +- src/pagedef.h | 2 +- src/pyscanner.l | 7 +- src/qcstring.cpp | 10 +- src/qhp.cpp | 3 +- src/qhpxmlwriter.cpp | 2 +- src/qhpxmlwriter.h | 5 +- src/rtfdocvisitor.cpp | 2 +- src/rtfdocvisitor.h | 5 +- src/rtfgen.cpp | 1403 +++++++++++++++++++++-------------------- src/rtfgen.h | 26 +- src/scanner.l | 19 +- src/tagreader.cpp | 10 +- src/template.cpp | 71 ++- src/template.h | 4 +- src/textdocvisitor.h | 5 +- src/textstream.h | 232 +++++++ src/utf8.cpp | 11 +- src/utf8.h | 5 +- src/util.cpp | 21 +- src/util.h | 7 +- src/vhdldocgen.cpp | 78 +-- src/vhdldocgen.h | 23 +- src/xmldocvisitor.cpp | 6 +- src/xmldocvisitor.h | 5 +- src/xmlgen.cpp | 241 +++---- src/xmlgen.h | 6 +- 111 files changed, 2998 insertions(+), 2647 deletions(-) create mode 100644 src/textstream.h diff --git a/src/classdef.cpp b/src/classdef.cpp index 17b9acb..4d4b2ae 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -299,7 +299,7 @@ class ClassDefImpl : public DefinitionMixin 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; @@ -2046,7 +2046,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 << " - // 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,12 +54,12 @@ 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); /*! Parses a configuration file with name \a fn. * \returns TRUE if successful, FALSE if the file could not be diff --git a/src/configimpl.h b/src/configimpl.h index 2a124f8..60811d1 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,17 +76,17 @@ 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 writeTemplate(TextStream &t,bool sl,bool upd) = 0; + virtual void compareDoxyfile(TextStream &t) = 0; virtual void convertStrToVal() {} virtual void emptyValueToDefault() {} virtual void substEnvVars() = 0; virtual void init() {} - void writeBoolValue(std::ostream &t,bool v); - void writeIntValue(std::ostream &t,int i); - void writeStringValue(std::ostream &t,const QCString &s); - void writeStringList(std::ostream &t,const StringVector &l); + void writeBoolValue(TextStream &t,bool v); + void writeIntValue(TextStream &t,int i); + void writeStringValue(TextStream &t,const QCString &s); + void writeStringList(TextStream &t,const StringVector &l); QCString m_spaces; QCString m_name; @@ -107,8 +108,8 @@ class ConfigInfo : public ConfigOption m_name = name; m_doc = doc; } - void writeTemplate(std::ostream &t, bool sl,bool); - void compareDoxyfile(std::ostream &){}; + void writeTemplate(TextStream &t, bool sl,bool); + void compareDoxyfile(TextStream &){}; void substEnvVars() {} }; @@ -130,8 +131,8 @@ 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 writeTemplate(TextStream &t,bool sl,bool); + void compareDoxyfile(TextStream &t); void substEnvVars(); void init() { m_value = m_defaultValue; } private: @@ -157,9 +158,9 @@ class ConfigEnum : public ConfigOption const std::vector &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 compareDoxyfile(TextStream &t); void init() { m_value = m_defValue.copy(); } private: @@ -188,8 +189,8 @@ 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 writeTemplate(TextStream &t,bool sl,bool); + void compareDoxyfile(TextStream &t); void substEnvVars(); void init() { m_value = m_defValue.copy(); } void emptyValueToDefault() { if(m_value.isEmpty()) m_value=m_defValue; }; @@ -221,8 +222,8 @@ 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 writeTemplate(TextStream &t,bool sl,bool upd); + void compareDoxyfile(TextStream &t); void init() { m_value = m_defValue; } private: int m_value; @@ -250,8 +251,8 @@ 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 writeTemplate(TextStream &t,bool sl,bool upd); + void compareDoxyfile(TextStream &t); void init() { m_value = m_defValue; } private: bool m_value; @@ -266,8 +267,8 @@ 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 writeTemplate(TextStream &,bool,bool); + void compareDoxyfile(TextStream &) {} void substEnvVars() {} }; @@ -278,8 +279,8 @@ 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 writeTemplate(TextStream &,bool,bool); + void compareDoxyfile(TextStream &) {} void substEnvVars() {} }; @@ -473,12 +474,12 @@ 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); void setHeader(const char *header) { m_header = header; } diff --git a/src/configimpl.l b/src/configimpl.l index 6f22061..bde2290 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -40,6 +40,7 @@ #include "configoptions.h" #include "fileinfo.h" #include "dir.h" +#include "textstream.h" #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 @@ -127,18 +128,18 @@ static QCString convertToComment(const QCString &s, const QCString &u) return result; } -void ConfigOption::writeBoolValue(std::ostream &t,bool v) +void ConfigOption::writeBoolValue(TextStream &t,bool v) { t << " "; if (v) t << "YES"; else t << "NO"; } -void ConfigOption::writeIntValue(std::ostream &t,int i) +void ConfigOption::writeIntValue(TextStream &t,int i) { t << " " << i; } -void ConfigOption::writeStringValue(std::ostream &t,const QCString &s) +void ConfigOption::writeStringValue(TextStream &t,const QCString &s) { char c; bool needsEscaping=FALSE; @@ -169,7 +170,7 @@ void ConfigOption::writeStringValue(std::ostream &t,const QCString &s) } } -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) @@ -321,7 +322,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) { @@ -332,7 +333,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) { @@ -349,12 +350,12 @@ void ConfigList::writeTemplate(std::ostream &t,bool sl,bool) t << "\n"; } -void ConfigList::compareDoxyfile(std::ostream &t) +void ConfigList::compareDoxyfile(TextStream &t) { 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) { writeTemplate(t,TRUE,TRUE); @@ -382,7 +383,7 @@ void ConfigList::compareDoxyfile(std::ostream &t) } } -void ConfigEnum::writeTemplate(std::ostream &t,bool sl,bool) +void ConfigEnum::writeTemplate(TextStream &t,bool sl,bool) { if (!sl) { @@ -399,12 +400,12 @@ void ConfigEnum::writeTemplate(std::ostream &t,bool sl,bool) t << "\n"; } -void ConfigEnum::compareDoxyfile(std::ostream &t) +void ConfigEnum::compareDoxyfile(TextStream &t) { if (m_value != m_defValue) writeTemplate(t,TRUE,TRUE); } -void ConfigString::writeTemplate(std::ostream &t,bool sl,bool) +void ConfigString::writeTemplate(TextStream &t,bool sl,bool) { if (!sl) { @@ -421,12 +422,12 @@ void ConfigString::writeTemplate(std::ostream &t,bool sl,bool) t << "\n"; } -void ConfigString::compareDoxyfile(std::ostream &t) +void ConfigString::compareDoxyfile(TextStream &t) { if (m_value.stripWhiteSpace() != m_defValue.stripWhiteSpace()) writeTemplate(t,TRUE,TRUE); } -void ConfigInt::writeTemplate(std::ostream &t,bool sl,bool upd) +void ConfigInt::writeTemplate(TextStream &t,bool sl,bool upd) { if (!sl) { @@ -450,12 +451,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 (m_value != m_defValue) writeTemplate(t,TRUE,TRUE); } -void ConfigBool::writeTemplate(std::ostream &t,bool sl,bool upd) +void ConfigBool::writeTemplate(TextStream &t,bool sl,bool upd) { if (!sl) { @@ -480,13 +481,13 @@ void ConfigBool::writeTemplate(std::ostream &t,bool sl,bool upd) t << "\n"; } -void ConfigBool::compareDoxyfile(std::ostream &t) +void ConfigBool::compareDoxyfile(TextStream &t) { if (m_value != m_defValue) writeTemplate(t,TRUE,TRUE); } -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) {} /* ----------------------------------------------------------------- * @@ -1082,7 +1083,7 @@ static void readIncludeFile(const char *incName) /*@ ---------------------------------------------------------------------------- */ -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) @@ -1106,7 +1107,7 @@ void ConfigImpl::writeTemplate(std::ostream &t,bool sl,bool upd) } } -void ConfigImpl::compareDoxyfile(std::ostream &t) +void ConfigImpl::compareDoxyfile(TextStream &t) { t << "# Difference with default Doxyfile " << getFullVersion(); t << "\n"; @@ -1307,7 +1308,7 @@ static QCString configFileToString(const char *name) 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(in.gcount())); if (!ret.empty() && ret[ret.length()-1]!='\n') ret+='\n'; // to help the scanner return ret; }; @@ -2062,12 +2063,12 @@ 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); diff --git a/src/context.cpp b/src/context.cpp index dec48c9..32e6720 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -1259,7 +1259,7 @@ 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); + 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,7 +1295,7 @@ 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: @@ -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().data(),TRUE); } static TemplateVariant parseCode(const FileDef *fd,const QCString &relPath) @@ -1327,7 +1325,7 @@ 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: @@ -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); } //------------------------------------------------------------------------ @@ -1949,7 +1946,7 @@ class ClassContext::Private : public DefinitionContext } 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 +1987,13 @@ class ClassContext::Private : public DefinitionContext { 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 << "
\n"; t << " } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } DotClassGraph *getCollaborationGraph() const { @@ -2049,7 +2045,7 @@ class ClassContext::Private : public DefinitionContext 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 +2076,7 @@ class ClassContext::Private : public DefinitionContext } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } TemplateVariant includeInfo() const @@ -3054,7 +3049,7 @@ class FileContext::Private : public DefinitionContext 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 +3080,7 @@ class FileContext::Private : public DefinitionContext } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } DotInclDepGraph *getIncludedByGraph() const { @@ -3106,7 +3100,7 @@ class FileContext::Private : public DefinitionContext 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 +3131,7 @@ class FileContext::Private : public DefinitionContext } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } TemplateVariant hasDetails() const { @@ -3512,7 +3505,7 @@ class DirContext::Private : public DefinitionContext } 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 +3544,7 @@ class DirContext::Private : public DefinitionContext } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } private: @@ -3729,7 +3721,7 @@ 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 { @@ -3803,7 +3795,7 @@ class TextGeneratorHtml : public TextGeneratorIntf } private: - std::ostream &m_ts; + TextStream &m_ts; QCString m_relPath; }; @@ -3812,7 +3804,7 @@ class TextGeneratorHtml : public TextGeneratorIntf class TextGeneratorLatex : public TextGeneratorIntf { public: - TextGeneratorLatex(std::ostream &ts) : m_ts(ts) {} + TextGeneratorLatex(TextStream &ts) : m_ts(ts) {} void writeString(const char *s,bool keepSpaces) const { if (s==0) return; @@ -3862,7 +3854,7 @@ class TextGeneratorLatex : public TextGeneratorIntf } private: - std::ostream &m_ts; + TextStream &m_ts; }; //------------------------------------------------------------------------ @@ -3876,7 +3868,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 +3888,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) { @@ -4937,7 +4929,7 @@ class MemberContext::Private : public DefinitionContext if (hasCallGraph().toBool()) { DotCallGraph *cg = getCallGraph(); - std::ostringstream t(std::ios_base::ate); + TextStream t; switch (g_globals.outputFormat) { case ContextOutputFormat_Html: @@ -4964,8 +4956,7 @@ class MemberContext::Private : public DefinitionContext break; } g_globals.dynSectionId++; - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } else { @@ -5009,7 +5000,7 @@ class MemberContext::Private : public DefinitionContext if (hasCallerGraph().toBool()) { DotCallGraph *cg = getCallerGraph(); - std::ostringstream t(std::ios_base::ate); + TextStream t; switch (g_globals.outputFormat) { case ContextOutputFormat_Html: @@ -5036,8 +5027,7 @@ class MemberContext::Private : public DefinitionContext break; } g_globals.dynSectionId++; - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } else { @@ -5273,7 +5263,7 @@ class ModuleContext::Private : public DefinitionContext } 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 +5300,7 @@ class ModuleContext::Private : public DefinitionContext } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } TemplateVariant hasDetails() const { @@ -8291,7 +8280,7 @@ class InheritanceGraphContext::Private } 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 +8292,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; @@ -9892,7 +9880,7 @@ class LatexSpaceless : public TemplateSpacelessIntf void reset() { } QCString remove(const QCString &s) { - std::ostringstream result(std::ios_base::ate); + TextStream result; const char *p = s.data(); char c; while ((c=*p++)) @@ -9925,7 +9913,7 @@ class HtmlSpaceless : public TemplateSpacelessIntf } QCString remove(const QCString &s) { - std::ostringstream result(std::ios_base::ate); + TextStream result; const char *p = s.data(); char c; while ((c=*p++)) @@ -10115,7 +10103,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 +10128,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); } diff --git a/src/defgen.cpp b/src/defgen.cpp index 6e6e5f7..5a3641e 100644 --- a/src/defgen.cpp +++ b/src/defgen.cpp @@ -36,10 +36,11 @@ #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 char *s) { const char* p=s; char c; @@ -55,7 +56,7 @@ static inline void writeDEFString(std::ofstream &t,const char *s) } static void generateDEFForMember(const MemberDef *md, - std::ofstream &t, + TextStream &t, const Definition *def, const char* Prefix) { @@ -295,7 +296,7 @@ static void generateDEFForMember(const MemberDef *md, static void generateDEFClassSection(const ClassDef *cd, - std::ofstream &t, + TextStream &t, const MemberList *ml, const char *kind) { @@ -312,7 +313,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,7 +446,7 @@ 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) { @@ -460,7 +461,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 +489,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 @@ -531,12 +532,13 @@ void generateDEF() } 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()); 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..2820c16 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -403,7 +403,7 @@ void DefinitionImpl::addSectionsToIndex() } } -void DefinitionImpl::writeDocAnchorsToTagFile(std::ostream &tagFile) const +void DefinitionImpl::writeDocAnchorsToTagFile(TextStream &tagFile) const { if (!m_impl->sectionRefs.empty()) { diff --git a/src/definition.h b/src/definition.h index 900bbb2..1b1c364 100644 --- a/src/definition.h +++ b/src/definition.h @@ -19,7 +19,6 @@ #define DEFINITION_H #include -#include #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 @@ -383,7 +383,7 @@ class DefinitionMutable 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; // --------------------------------- diff --git a/src/definitionimpl.h b/src/definitionimpl.h index 0ac394f..2bc6127 100644 --- a/src/definitionimpl.h +++ b/src/definitionimpl.h @@ -111,7 +111,7 @@ class DefinitionImpl void writeQuickMemberLinks(OutputList &,const MemberDef *) const; void writeSummaryLinks(OutputList &) const; QCString pathFragment() const; - void writeDocAnchorsToTagFile(std::ostream &) const; + void writeDocAnchorsToTagFile(TextStream &) const; void setLocalName(const QCString name); void addSectionsToIndex(); void writeToc(OutputList &ol, const LocalToc <) const; @@ -261,7 +261,7 @@ 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) { m_impl.setLocalName(name); } diff --git a/src/diagram.cpp b/src/diagram.cpp index 365dd46..2581b40 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" //----------------------------------------------------------------------------- @@ -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); @@ -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()) @@ -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,7 +1044,7 @@ ClassDiagram::~ClassDiagram() { } -void ClassDiagram::writeFigure(std::ostream &output,const char *path, +void ClassDiagram::writeFigure(TextStream &output,const char *path, const char *fileName) const { uint baseRows=p->base.computeRows(); @@ -1086,236 +1087,241 @@ 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()); } - - //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); @@ -1334,7 +1340,7 @@ void ClassDiagram::writeFigure(std::ostream &output,const char *path, } -void ClassDiagram::writeImage(std::ostream &t,const char *path, +void ClassDiagram::writeImage(TextStream &t,const char *path, const char *relPath,const char *fileName, bool generateMap) const { diff --git a/src/diagram.h b/src/diagram.h index 9f8ba82..2cfb579 100644 --- a/src/diagram.h +++ b/src/diagram.h @@ -20,9 +20,9 @@ #define DIAGRAM_H #include -#include class ClassDef; +class TextStream; /** Class representing a built-in class diagram. */ class ClassDiagram @@ -30,9 +30,9 @@ class ClassDiagram public: ClassDiagram(const ClassDef *root); ~ClassDiagram(); - void writeFigure(std::ostream &t,const char *path, + void writeFigure(TextStream &t,const char *path, const char *file) const; - void writeImage(std::ostream &t,const char *path,const char *relPath, + void writeImage(TextStream &t,const char *path,const char *relPath, const char *file,bool generateMap=true) const; private: struct Private; diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 6e95755..a1363cc 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -61,7 +61,7 @@ class DirDefImpl : public DefinitionMixin 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); @@ -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 << " \n"; tagFile << " " << convertToXML(displayName()) << "\n"; diff --git a/src/dirdef.h b/src/dirdef.h index c7b2f9a..39c0c15 100644 --- a/src/dirdef.h +++ b/src/dirdef.h @@ -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; diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 6214249..6ff520d 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -71,12 +71,12 @@ #endif //------------------ -inline void writeDocbookString(std::ostream &t,const char *s) +inline void writeDocbookString(TextStream &t,const char *s) { t << convertToDocBook(s); } -inline void writeDocbookCodeString(std::ostream &t,const char *s, int &col) +inline void writeDocbookCodeString(TextStream &t,const char *s, int &col) { char c; while ((c=*s++)) @@ -116,7 +116,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 << ""; t << convertToDocBook(prim); @@ -129,7 +129,7 @@ static void addIndexTerm(std::ostream &t, QCString prim, QCString sec = "") } t << "\n"; } -void writeDocbookLink(std::ostream &t,const char * /*extRef*/,const char *compoundId, +void writeDocbookLink(TextStream &t,const char * /*extRef*/,const char *compoundId, const char *anchorId,const char * text,const char * /*tooltip*/) { t << ""; } -DocbookCodeGenerator::DocbookCodeGenerator(std::ostream &t) : m_t(nullptr) +DocbookCodeGenerator::DocbookCodeGenerator(TextStream &t) : m_t(nullptr) { m_prettyCode=Config_getBool(DOCBOOK_PROGRAMLISTING); setTextStream(t); @@ -324,28 +324,28 @@ DB_GEN_C relPath = relativePathToRoot(fileName); if (fileName.right(4)!=".xml") fileName+=".xml"; startPlainFile(fileName); - m_codeGen.setTextStream(t); + m_codeGen.setTextStream(m_t); m_codeGen.setRelativePath(relPath); m_codeGen.setSourceFileName(stripPath(fileName)); - t << "\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 << "\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 << "\n"; + if (m_inDetail) m_t << "\n"; m_inDetail = FALSE; while (m_inLevel != -1) { - t << "\n"; + m_t << "\n"; m_inLevel--; } - if (m_inGroup) t << "\n"; + if (m_inGroup) m_t << "\n"; m_inGroup = FALSE; QCString fileType="section"; @@ -358,7 +358,7 @@ DB_GEN_C { fileType="chapter"; } - t << "\n"; + m_t << "\n"; endPlainFile(); m_codeGen.setSourceFileName(""); } @@ -371,16 +371,16 @@ DB_GEN_C2("IndexSections " << is) case isTitlePageStart: { QCString dbk_projectName = Config_getString(PROJECT_NAME); - t << " \n"; - t << " " << convertToDocBook(dbk_projectName) << "\n"; - t << " \n"; + m_t << " \n"; + m_t << " " << convertToDocBook(dbk_projectName) << "\n"; + m_t << " \n"; } break; case isTitlePageAuthor: break; case isMainPage: - t << "\n"; - t << " "; + m_t << "<chapter>\n"; + m_t << " <title>"; break; case isModuleIndex: //Module Index}\n" @@ -395,7 +395,7 @@ DB_GEN_C2("IndexSections " << is) //Hierarchical Index}\n" break; case isCompoundIndex: - //t << "{"; //Class Index}\n" + //m_t << "{"; //Class Index}\n" break; case isFileIndex: //Annotated File Index}\n" @@ -404,28 +404,28 @@ 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 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 +447,78 @@ DB_GEN_C2("IndexSections " << is) case isTitlePageAuthor: break; case isMainPage: - t << "\n"; - t << " \n"; - t << "\n"; + m_t << "\n"; + m_t << " \n"; + m_t << "\n"; break; case isModuleIndex: - //t << "\n"; + //m_t << "\n"; break; case isDirIndex: - //t << ""; - //t << "\n"; + //m_t << ""; + //m_t << "\n"; break; case isNamespaceIndex: - //t << ""; - //t << "\n"; + //m_t << ""; + //m_t << "\n"; break; case isClassHierarchyIndex: - //t << ""; - //t << "\n"; + //m_t << ""; + //m_t << "\n"; break; case isCompoundIndex: - //t << "\n"; + //m_t << "\n"; break; case isFileIndex: - //t << ""; - //t << "\n"; + //m_t << ""; + //m_t << "\n"; break; case isPageIndex: - //t << ""; - //t << "\n"; + //m_t << ""; + //m_t << "\n"; break; case isModuleDocumentation: { - t << "\n"; + m_t << "\n"; for (const auto &gd : *Doxygen::groupLinkedMap) { if (!gd->isReference()) { - t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } - t << "\n"; + m_t << "\n"; break; case isDirDocumentation: { - t << "\n"; + m_t << "\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 << "\n"; + m_t << "\n"; break; case isNamespaceDocumentation: { - t << "\n"; + m_t << "\n"; for (const auto &nd : *Doxygen::namespaceLinkedMap) { if (nd->isLinkableInProject() && !nd->isAlias()) { - t << "getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << "getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } - t << "\n"; + m_t << "\n"; break; case isClassDocumentation: { - t << "\n"; + m_t << "\n"; for (const auto &cd : *Doxygen::classLinkedMap) { if (cd->isLinkableInProject() && @@ -527,15 +527,15 @@ DB_GEN_C2("IndexSections " << is) !cd->isAlias() ) { - t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } - t << "\n"; + m_t << "\n"; break; case isFileDocumentation: { - t << "\n"; + m_t << "\n"; bool isFirst=TRUE; for (const auto &fn : *Doxygen::inputNameLinkedMap) { @@ -545,43 +545,43 @@ DB_GEN_C2("IndexSections " << is) { if (isFirst) { - t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; if (sourceBrowser && m_prettyCode && fd->generateSourceFile()) { - t << " getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } isFirst=FALSE; } else { - t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; if (sourceBrowser && m_prettyCode && fd->generateSourceFile()) { - t << " getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } } } } - t << "\n"; + m_t << "\n"; break; case isExampleDocumentation: { - t << "\n"; + m_t << "\n"; for (const auto &pd : *Doxygen::exampleLinkedMap) { - t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } - t << "\n"; + m_t << "\n"; break; case isPageDocumentation: break; case isPageDocumentation2: break; case isEndIndex: - t << "\n"; + m_t << "\n"; break; } } @@ -592,17 +592,17 @@ DB_GEN_C { if (!pd->getGroupDef() && !pd->isReference() && pd->name() == stripPath(name)) { - t << "\n"; + m_t << "\n"; if (pd->hasTitle()) { - t << " " << convertToDocBook(pd->title()) << "\n"; + m_t << " " << convertToDocBook(pd->title()) << "\n"; } else { - t << " " << convertToDocBook(pd->name()) << "\n"; + m_t << " " << convertToDocBook(pd->name()) << "\n"; } - t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; - t << "\n"; + m_t << " getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << "\n"; } } } @@ -611,7 +611,7 @@ 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; } @@ -619,118 +619,118 @@ DB_GEN_C void DocbookGenerator::startParagraph(const char *) { DB_GEN_C - t << "\n"; + m_t << "\n"; } void DocbookGenerator::endParagraph() { DB_GEN_C - t << "\n"; + m_t << "\n"; } void DocbookGenerator::writeString(const char *text) { DB_GEN_C - t << text; + m_t << text; } void DocbookGenerator::startMemberHeader(const char *,int) { DB_GEN_C - t << "\n"; + m_t << "\n"; m_inSimpleSect[m_levelListItem] = TRUE; - t << " "; + m_t << " <title>"; } void DocbookGenerator::endMemberHeader() { DB_GEN_C - t << " \n"; + m_t << " \n"; } void DocbookGenerator::docify(const char *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) { DB_GEN_C if (anchor) - if (f) t << ""; - else t << ""; + if (f) m_t << ""; + else m_t << ""; else - t << ""; + m_t << ""; docify(text); - t << ""; + m_t << ""; } void DocbookGenerator::startMemberList() { DB_GEN_C - t << " \n"; + m_t << " \n"; m_levelListItem++; } void DocbookGenerator::endMemberList() { DB_GEN_C - if (m_inListItem[m_levelListItem]) t << "\n"; + if (m_inListItem[m_levelListItem]) m_t << "\n"; m_inListItem[m_levelListItem] = FALSE; - t << " \n"; + m_t << " \n"; m_levelListItem = (m_levelListItem> 0 ? m_levelListItem - 1 : 0); - if (m_inSimpleSect[m_levelListItem]) t << "\n"; + if (m_inSimpleSect[m_levelListItem]) m_t << "\n"; m_inSimpleSect[m_levelListItem] = FALSE; } void DocbookGenerator::startMemberItem(const char *,int,const char *) { DB_GEN_C - if (m_inListItem[m_levelListItem]) t << "\n"; - t << " "; + if (m_inListItem[m_levelListItem]) m_t << "\n"; + m_t << " "; m_inListItem[m_levelListItem] = TRUE; } void DocbookGenerator::endMemberItem() { DB_GEN_C - t << "\n"; + m_t << "\n"; } void DocbookGenerator::startBold() { DB_GEN_C - t << ""; + m_t << ""; } void DocbookGenerator::endBold() { DB_GEN_C - t << ""; + m_t << ""; } 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 << "\n"; + if (m_inSimpleSect[m_levelListItem]) m_t << "\n"; m_inSimpleSect[m_levelListItem] = FALSE; if (m_inLevel != -1) m_inGroup = TRUE; - if (m_inLevel == extraIndentLevel) t << "\n"; + if (m_inLevel == extraIndentLevel) m_t << "\n"; m_inLevel = extraIndentLevel; - t << "
\n"; - t << ""; + 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 << "\n"; + m_t << "\n"; } void DocbookGenerator::startParameterList(bool openBracket) { DB_GEN_C - if (openBracket) t << "("; + if (openBracket) m_t << "("; } void DocbookGenerator::endParameterList() { @@ -739,22 +739,22 @@ DB_GEN_C void DocbookGenerator::writeNonBreakableSpace(int n) { DB_GEN_C - for (int i=0;i"; + if (!m_denseText) m_t << ""; } void DocbookGenerator::endTypewriter() { DB_GEN_C - if (!m_denseText) t << "\n"; + if (!m_denseText) m_t << "\n"; } void DocbookGenerator::startTextBlock(bool dense) { @@ -762,7 +762,7 @@ DB_GEN_C if (dense) { m_denseText = TRUE; - t << ""; + m_t << ""; } } void DocbookGenerator::endTextBlock(bool) @@ -771,41 +771,41 @@ DB_GEN_C if (m_denseText) { m_denseText = FALSE; - t << ""; + m_t << ""; } } void DocbookGenerator::startMemberDoc(const char *clname, const char *memname, const char *, const char *title, int memCount, int memTotal, bool) { DB_GEN_C2("m_inLevel " << m_inLevel) - t << "
\n"; - t << " " << 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 << "\n"; + m_t << "\n"; if (memname && 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 << ""; + m_t << ""; } void DocbookGenerator::startTitleHead(const char *) { DB_GEN_C - t << ""; + m_t << "<title>"; } void DocbookGenerator::endTitleHead(const char *,const char *name) { DB_GEN_C - t << "\n"; - if (name) addIndexTerm(t, name); + m_t << "\n"; + if (name) addIndexTerm(m_t, name); } void DocbookGenerator::startDoxyAnchor(const char *fName,const char *, const char *anchor,const char *, @@ -814,12 +814,12 @@ void DocbookGenerator::startDoxyAnchor(const char *fName,const char *, DB_GEN_C if (!m_inListItem[m_levelListItem] && !m_descTable) { - if (!m_firstMember) t << "
"; + if (!m_firstMember) m_t << "
"; m_firstMember = FALSE; } if (anchor) { - t << ""; + m_t << ""; } } void DocbookGenerator::endDoxyAnchor(const char *,const char *) @@ -829,7 +829,7 @@ DB_GEN_C void DocbookGenerator::startMemberDocName(bool) { DB_GEN_C - t << ""; + m_t << ""; } void DocbookGenerator::endMemberDocName() { @@ -838,12 +838,12 @@ DB_GEN_C void DocbookGenerator::startMemberGroupHeader(bool) { DB_GEN_C - t << ""; + m_t << "<simplesect><title>"; } void DocbookGenerator::endMemberGroupHeader() { DB_GEN_C - t << "\n"; + m_t << "\n"; } void DocbookGenerator::startMemberGroup() { @@ -852,27 +852,27 @@ DB_GEN_C void DocbookGenerator::endMemberGroup(bool) { DB_GEN_C - t << "\n"; + m_t << "\n"; } void DocbookGenerator::startClassDiagram() { DB_GEN_C - t << ""; + m_t << ""; } void DocbookGenerator::endClassDiagram(const ClassDiagram &d, const char *fileName,const char *) { DB_GEN_C - t << " \n"; - t << " \n"; - t << " \n"; - t << " \n"; + m_t << " \n"; + m_t << " \n"; + m_t << " " << "\n"; - t << " \n"; - d.writeImage(t,dir(),relPath,fileName,FALSE); - t << " \n"; - t << " \n"; - t << "\n"; + m_t << " \n"; + d.writeImage(m_t,dir(),relPath,fileName,FALSE); + m_t << " \n"; + m_t << " \n"; + m_t << "\n"; } void DocbookGenerator::startLabels() { @@ -882,8 +882,8 @@ DB_GEN_C void DocbookGenerator::writeLabel(const char *l,bool isLast) { DB_GEN_C - t << "[" << l << "]"; - if (!isLast) t << ", "; + m_t << "[" << l << "]"; + if (!isLast) m_t << ", "; } void DocbookGenerator::endLabels() @@ -893,25 +893,25 @@ DB_GEN_C void DocbookGenerator::startExamples() { DB_GEN_C - t << ""; + m_t << "<simplesect><title>"; docify(theTranslator->trExamples()); - t << ""; + m_t << ""; } void DocbookGenerator::endExamples() { DB_GEN_C - t << "\n"; + m_t << "\n"; } void DocbookGenerator::startSubsubsection() { DB_GEN_C - t << ""; + m_t << "<simplesect><title>"; } void DocbookGenerator::endSubsubsection() { DB_GEN_C - t << "\n"; + m_t << "\n"; } void DocbookGenerator::writeChar(char c) { @@ -924,33 +924,33 @@ DB_GEN_C void DocbookGenerator::startMemberDocPrefixItem() { DB_GEN_C - t << ""; + m_t << ""; } void DocbookGenerator::endMemberDocPrefixItem() { DB_GEN_C - t << ""; + m_t << ""; } void DocbookGenerator::exceptionEntry(const char* prefix,bool closeBracket) { DB_GEN_C if (prefix) - t << " " << prefix << "("; + 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() @@ -961,62 +961,62 @@ DB_GEN_C void DocbookGenerator::endMemberTemplateParams(const char *,const char *) { DB_GEN_C - t << ""; - t << ""; + m_t << ""; + m_t << ""; } void DocbookGenerator::startSection(const char *lab,const char *,SectionType) { DB_GEN_C - t << "
"; - t << ""; + m_t << " <section xml:id=\"_" << stripPath(lab) << "\">"; + m_t << "<title>"; } void DocbookGenerator::endSection(const char *,SectionType) { DB_GEN_C - t << ""; - t << "
"; + m_t << ""; + m_t << " "; } void DocbookGenerator::addIndexItem(const char *prim,const char *sec) { DB_GEN_C - addIndexTerm(t, prim, sec); + addIndexTerm(m_t, prim, sec); } void DocbookGenerator::startDescTable(const char *title) { DB_GEN_C int ncols = 2; - t << "\n"; - if (title)t << "" << convertToDocBook(title) << "\n"; - t << " \n"; + m_t << "\n"; + if (title)m_t << "" << convertToDocBook(title) << "\n"; + m_t << " \n"; for (int i = 0; i < ncols; i++) { - t << " \n"; + m_t << " \n"; } - t << "\n"; + m_t << "\n"; m_descTable = TRUE; } void DocbookGenerator::endDescTable() { DB_GEN_C - t << " \n"; - t << " \n"; - t << "\n"; + m_t << " \n"; + m_t << " \n"; + m_t << "\n"; m_descTable = FALSE; } void DocbookGenerator::startDescTableRow() { DB_GEN_C - t << ""; - t << ""; + m_t << ""; + m_t << ""; } void DocbookGenerator::endDescTableRow() { DB_GEN_C - t << ""; + m_t << ""; } void DocbookGenerator::startDescTableTitle() @@ -1032,13 +1032,13 @@ DB_GEN_C void DocbookGenerator::startDescTableData() { DB_GEN_C - t << ""; + m_t << ""; } void DocbookGenerator::endDescTableData() { DB_GEN_C - t << ""; + m_t << ""; } void DocbookGenerator::startGroupCollaboration() { @@ -1047,7 +1047,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 +1056,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 +1065,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 +1074,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 +1083,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() { @@ -1097,14 +1097,14 @@ DB_GEN_C void DocbookGenerator::startConstraintList(const char *header) { DB_GEN_C - t << ""; + m_t << "<simplesect><title>"; docify(header); - t << "\n"; + m_t << "\n"; } void DocbookGenerator::startConstraintParam() { DB_GEN_C - t << ""; + m_t << ""; } void DocbookGenerator::endConstraintParam() { @@ -1113,12 +1113,12 @@ DB_GEN_C void DocbookGenerator::startConstraintType() { DB_GEN_C - t << ":"; + m_t << ":"; } void DocbookGenerator::endConstraintType() { DB_GEN_C - t << "\n"; + m_t << "\n"; } void DocbookGenerator::startConstraintDocs() { @@ -1131,5 +1131,5 @@ DB_GEN_C void DocbookGenerator::endConstraintList() { DB_GEN_C - t << "\n"; + m_t << "\n"; } diff --git a/src/docbookgen.h b/src/docbookgen.h index 1f8b6ef..3d22d5d 100644 --- a/src/docbookgen.h +++ b/src/docbookgen.h @@ -23,12 +23,12 @@ class DocbookCodeGenerator : public CodeOutputInterface { public: - DocbookCodeGenerator(std::ostream &t); + DocbookCodeGenerator(TextStream &t); DocbookCodeGenerator(); virtual ~DocbookCodeGenerator(); - void setTextStream(std::ostream &t) + void setTextStream(TextStream &t) { - m_t.rdbuf(t.rdbuf()); + m_t = t; } void setRelativePath(const QCString &path) { m_relPath = path; } void setSourceFileName(const QCString &sourceFileName) { m_sourceFileName = sourceFileName; } @@ -58,7 +58,7 @@ class DocbookCodeGenerator : public CodeOutputInterface void endCodeFragment(const char *style); private: - std::ostream m_t; + TextStream m_t; QCString m_refId; QCString m_external; int m_lineNumber = -1; diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index 60c1b08..ce43aec 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -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 char *langExt) : DocVisitor(DocVisitor_Docbook), m_t(t), m_ci(ci),m_langExt(langExt) { DB_VIS_C diff --git a/src/docbookvisitor.h b/src/docbookvisitor.h index f1e6c88..1407df6 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 char *langExt); ~DocbookDocVisitor(); //-------------------------------------- // visitor functions for leaf nodes @@ -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/docsets.cpp b/src/docsets.cpp index 6040277..66ef115 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 indentStack; std::set scopes; }; @@ -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()); } + p->nts.setStream(&p->ntf); //QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index"; QCString indexName="index"; p->nts << "\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()); } + p->tts.setStream(&p->ttf); p->tts << "\n"; p->tts << "\n"; } @@ -185,10 +190,12 @@ void DocSets::finalize() p->nts << " \n"; p->nts << " \n"; p->nts << "\n"; - p->nts.close(); + p->nts.flush(); + p->ntf.close(); p->tts << "\n"; - p->tts.close(); + p->tts.flush(); + p->ttf.close(); } QCString DocSets::Private::indent() @@ -476,7 +483,7 @@ void DocSets::addIndexItem(const Definition *context,const MemberDef *md, } } -void DocSets::writeToken(std::ostream &t, +void DocSets::writeToken(TextStream &t, const Definition *d, const QCString &type, const QCString &lang, diff --git a/src/docsets.h b/src/docsets.h index 2bdf7ac..39a8509 100644 --- a/src/docsets.h +++ b/src/docsets.h @@ -17,10 +17,11 @@ #define DOCSETS_H #include -#include #include "index.h" +class TextStream; + class Definition; /** A class that generates docset files. @@ -54,7 +55,7 @@ class DocSets : public IndexIntf void addStyleSheetFile(const char *) {} 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); diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 5debd5f..e2aac01 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -152,9 +152,9 @@ 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; + size_t i; int indent=0; static int tabSize=Config_getInt(TAB_SIZE); for (i=0;i^{LISTITEM} { /* list item */ lineCount(yytext,yyleng); QCString text=yytext; - int dashPos = text.findRev('-'); + size_t dashPos = static_cast(text.findRev('-')); g_token->isEnumList = text.at(dashPos+1)=='#'; g_token->id = -1; g_token->indent = computeIndent(yytext,dashPos); @@ -543,7 +543,7 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio {BLANK}*(\n|"\\ilinebr"){LISTITEM} { /* list item on next line */ lineCount(yytext,yyleng); QCString text=extractPartAfterNewLine(yytext); - int dashPos = text.findRev('-'); + size_t dashPos = static_cast(text.findRev('-')); g_token->isEnumList = text.at(dashPos+1)=='#'; g_token->id = -1; g_token->indent = computeIndent(text,dashPos); @@ -820,7 +820,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;iindent;i++) diff --git a/src/dot.cpp b/src/dot.cpp index 2ffe9c2..4275a2c 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -320,7 +320,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) @@ -355,11 +355,11 @@ void writeDotImageMapFromFile(std::ostream &t, } else // bitmap graphics { - std::ostringstream tt(std::ios_base::ate); + TextStream tt; t << "\""\n"; DotFilePatcher::convertMapFile(tt, absOutFile, relPath ,TRUE, context); - if (tt.tellp()>0) + if (!tt.empty()) { t << ""; t << tt.str(); diff --git a/src/dot.h b/src/dot.h index 4b908ff..1ba00be 100644 --- a/src/dot.h +++ b/src/dot.h @@ -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 @@ -49,7 +50,7 @@ class DotManager void writeDotGraphFromFile(const char *inFile,const char *outDir, const char *outFile,GraphOutputFormat format); -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=-1); diff --git a/src/dotcallgraph.cpp b/src/dotcallgraph.cpp index efe829f..4426876 100644 --- a/src/dotcallgraph.cpp +++ b/src/dotcallgraph.cpp @@ -179,7 +179,7 @@ QCString DotCallGraph::getMapLabel() const } QCString DotCallGraph::writeGraph( - std::ostream &out, + TextStream &out, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, const char *path, diff --git a/src/dotcallgraph.h b/src/dotcallgraph.h index ad9006f..9fd5c66 100644 --- a/src/dotcallgraph.h +++ b/src/dotcallgraph.h @@ -29,7 +29,7 @@ class DotCallGraph : public DotGraph bool isTrivial() const; bool isTooBig() const; int numNodes() const; - QCString writeGraph(std::ostream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, + QCString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path,const char *fileName, const char *relPath,bool writeImageMap=TRUE, int graphId=-1); diff --git a/src/dotclassgraph.cpp b/src/dotclassgraph.cpp index fe36bc9..95a9b7d 100644 --- a/src/dotclassgraph.cpp +++ b/src/dotclassgraph.cpp @@ -18,6 +18,7 @@ #include "containers.h" #include "dotclassgraph.h" #include "dotnode.h" +#include "textstream.h" #include "config.h" #include "util.h" @@ -443,7 +444,7 @@ QCString DotClassGraph::getImgAltText() const return ""; } -QCString DotClassGraph::writeGraph(std::ostream &out, +QCString DotClassGraph::writeGraph(TextStream &out, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, const char *path, @@ -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..cd39608 100644 --- a/src/dotclassgraph.h +++ b/src/dotclassgraph.h @@ -16,12 +16,12 @@ #ifndef DOTCLASSGRAPH_H #define DOTCLASSGRAPH_H -#include - #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, + QCString writeGraph(TextStream &t,GraphOutputFormat gf,EmbeddedOutputFormat ef, const char *path, const char *fileName, const char *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; diff --git a/src/dotdirdeps.cpp b/src/dotdirdeps.cpp index 680b2f7..8367df9 100644 --- a/src/dotdirdeps.cpp +++ b/src/dotdirdeps.cpp @@ -29,7 +29,7 @@ using DirDefMap = std::map; * @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); @@ -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,7 +214,7 @@ 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, diff --git a/src/dotdirdeps.h b/src/dotdirdeps.h index ff46db2..713afb4 100644 --- a/src/dotdirdeps.h +++ b/src/dotdirdeps.h @@ -26,7 +26,7 @@ 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, diff --git a/src/dotfilepatcher.cpp b/src/dotfilepatcher.cpp index 3d64418..bb2bf15 100644 --- a/src/dotfilepatcher.cpp +++ b/src/dotfilepatcher.cpp @@ -211,7 +211,7 @@ 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, +bool DotFilePatcher::convertMapFile(TextStream &t,const char *mapName, const QCString relPath, bool urlOnly, const QCString &context) { @@ -314,19 +314,20 @@ bool DotFilePatcher::run() const 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()); thisDir.rename(tmpName,patchFile); return FALSE; } + TextStream t(&fo); int width,height; bool insideHeader=FALSE; bool replacedHeader=FALSE; @@ -411,12 +412,12 @@ bool DotFilePatcher::run() const int n = sscanf(line.data()+i,"\n"; t << ResourceMgr::instance().getAsString("header.html"); } -void HtmlGenerator::writeFooterFile(std::ostream &t) +void HtmlGenerator::writeFooterFile(TextStream &t) { t << "\n"; t << ResourceMgr::instance().getAsString("footer.html"); @@ -1062,7 +1065,7 @@ void HtmlGenerator::startFile(const char *name,const char *, startPlainFile(fileName); m_codeGen.setId(id); - m_codeGen.setTextStream(t); + m_codeGen.setTextStream(m_t); m_codeGen.setRelativePath(m_relPath); { std::lock_guard lock(g_indexLock); @@ -1070,26 +1073,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?title:"")),m_relPath); - t << "\n"; + m_t << "\n"; //bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); bool searchEngine = Config_getBool(SEARCHENGINE); if (searchEngine /*&& !generateTreeView*/) { - t << "\n"; + m_t << "\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,7 +1117,7 @@ void HtmlGenerator::writeSearchInfo(std::ostream &t,const QCString &) void HtmlGenerator::writeSearchInfo() { - writeSearchInfo(t,m_relPath); + writeSearchInfo(m_t,m_relPath); } @@ -1144,10 +1147,10 @@ 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); @@ -1155,7 +1158,7 @@ void HtmlGenerator::writePageFooter(std::ostream &t,const QCString &lastTitle, void HtmlGenerator::writeFooter(const char *navPath) { - writePageFooter(t,m_lastTitle,m_relPath,navPath); + writePageFooter(m_t,m_lastTitle,m_relPath,navPath); } void HtmlGenerator::endFile() @@ -1165,12 +1168,12 @@ void HtmlGenerator::endFile() void HtmlGenerator::startProjectNumber() { - t << "

"; + m_t << "

"; } void HtmlGenerator::endProjectNumber() { - t << "

"; + m_t << ""; } void HtmlGenerator::writeStyleInfo(int part) @@ -1187,7 +1190,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"); } @@ -1205,7 +1208,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()); @@ -1236,7 +1239,7 @@ void HtmlGenerator::startDoxyAnchor(const char *,const char *, const char *anchor, const char *, const char *) { - t << ""; + m_t << ""; } void HtmlGenerator::endDoxyAnchor(const char *,const char *) @@ -1251,29 +1254,29 @@ void HtmlGenerator::endDoxyAnchor(const char *,const char *) void HtmlGenerator::startParagraph(const char *classDef) { if (classDef) - t << "\n

"; + m_t << "\n

"; else - t << "\n

"; + m_t << "\n

"; } void HtmlGenerator::endParagraph() { - t << "

\n"; + m_t << "

\n"; } void HtmlGenerator::writeString(const char *text) { - t << text; + m_t << text; } void HtmlGenerator::startIndexListItem() { - t << "
  • "; + m_t << "
  • "; } void HtmlGenerator::endIndexListItem() { - t << "
  • \n"; + m_t << "\n"; } void HtmlGenerator::startIndexItem(const char *ref,const char *f) @@ -1283,21 +1286,21 @@ void HtmlGenerator::startIndexItem(const char *ref,const char *f) { if (ref) { - t << ""; + m_t << "href=\""; + m_t << externalRef(m_relPath,ref,TRUE); + if (f) m_t << addHtmlExtensionIfMissing(f); + m_t << "\">"; } else { - t << ""; + m_t << ""; } } @@ -1306,22 +1309,22 @@ void HtmlGenerator::endIndexItem(const char *ref,const char *f) //printf("HtmlGenerator::endIndexItem(%s,%s,%s)\n",ref,f,name); if (ref || f) { - t << ""; + m_t << ""; } else { - t << ""; + m_t << ""; } } void HtmlGenerator::writeStartAnnoItem(const char *,const char *f, const char *path,const char *name) { - t << "
  • "; + m_t << "
  • "; if (path) docify(path); - t << ""; + m_t << ""; docify(name); - t << " "; + m_t << " "; } void HtmlGenerator::writeObjectLink(const char *ref,const char *f, @@ -1329,63 +1332,63 @@ void HtmlGenerator::writeObjectLink(const char *ref,const char *f, { if (ref) { - t << ""; + m_t << "href=\""; + m_t << externalRef(m_relPath,ref,TRUE); + if (f) m_t << addHtmlExtensionIfMissing(f); + if (anchor) m_t << "#" << anchor; + m_t << "\">"; docify(name); - t << ""; + m_t << ""; } void HtmlGenerator::startTextLink(const char *f,const char *anchor) { - t << ""; + m_t << ""; } void HtmlGenerator::endTextLink() { - t << ""; + m_t << ""; } void HtmlGenerator::startHtmlLink(const char *url) { bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); - t << ""; + m_t << ""; } void HtmlGenerator::endHtmlLink() { - t << ""; + m_t << ""; } void HtmlGenerator::startGroupHeader(int extraIndentLevel) { if (extraIndentLevel==2) { - t << "

    "; + m_t << "

    "; } else if (extraIndentLevel==1) { - t << "

    "; + m_t << "

    "; } else // extraIndentLevel==0 { - t << "

    "; + m_t << "

    "; } } @@ -1393,15 +1396,15 @@ void HtmlGenerator::endGroupHeader(int extraIndentLevel) { if (extraIndentLevel==2) { - t << "

    \n"; + m_t << "\n"; } else if (extraIndentLevel==1) { - t << "\n"; + m_t << "\n"; } else { - t << "\n"; + m_t << "\n"; } } @@ -1409,25 +1412,25 @@ void HtmlGenerator::startSection(const char *lab,const char *,SectionType type) { switch(type) { - case SectionType::Page: t << "\n\n

    "; break; - case SectionType::Section: t << "\n\n

    "; break; - case SectionType::Subsection: t << "\n\n

    "; break; - case SectionType::Subsubsection: t << "\n\n

    "; break; - case SectionType::Paragraph: t << "\n\n

    "; break; + case SectionType::Page: m_t << "\n\n

    "; break; + case SectionType::Section: m_t << "\n\n

    "; break; + case SectionType::Subsection: m_t << "\n\n

    "; break; + case SectionType::Subsubsection: m_t << "\n\n

    "; break; + case SectionType::Paragraph: m_t << "\n\n

    "; break; default: ASSERT(0); break; } - t << ""; + m_t << ""; } void HtmlGenerator::endSection(const char *,SectionType type) { switch(type) { - case SectionType::Page: t << "
    "; break; - case SectionType::Section: t << ""; break; - case SectionType::Subsection: t << ""; break; - case SectionType::Subsubsection: t << ""; break; - case SectionType::Paragraph: t << ""; break; + case SectionType::Page: m_t << ""; break; + case SectionType::Section: m_t << ""; break; + case SectionType::Subsection: m_t << ""; break; + case SectionType::Subsubsection: m_t << ""; break; + case SectionType::Paragraph: m_t << ""; break; default: ASSERT(0); break; } } @@ -1448,24 +1451,24 @@ void HtmlGenerator::docify(const char *str,bool inHtmlComment) 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 +1484,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 << ""; @@ -1501,13 +1504,13 @@ static void startSectionHeader(std::ostream &t, } } -static void endSectionHeader(std::ostream &t) +static void endSectionHeader(TextStream &t) { //t << ""; t << "
  • \n"; } -static void startSectionSummary(std::ostream &t,int sectionCount) +static void startSectionSummary(TextStream &t,int sectionCount) { //t << ""; bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); @@ -1519,7 +1522,7 @@ static void startSectionSummary(std::ostream &t,int sectionCount) } } -static void endSectionSummary(std::ostream &t) +static void endSectionSummary(TextStream &t) { //t << ""; bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); @@ -1529,7 +1532,7 @@ static void endSectionSummary(std::ostream &t) } } -static void startSectionContent(std::ostream &t,int sectionCount) +static void startSectionContent(TextStream &t,int sectionCount) { //t << ""; bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); @@ -1545,7 +1548,7 @@ static void startSectionContent(std::ostream &t,int sectionCount) } } -static void endSectionContent(std::ostream &t) +static void endSectionContent(TextStream &t) { //t << ""; t << "\n"; @@ -1555,51 +1558,51 @@ 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) { - 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 << "
    \n"; - t << " \"\"/\n"; - t << " \n"; - t << tt.str(); - t << " \n"; - t << "
    "; + if (!tt.empty()) + { + m_t << "
    \n"; + m_t << " \"\"/\n"; + m_t << " \n"; + m_t << tt.str(); + m_t << " \n"; + m_t << "
    "; } else { - t << "
    \n"; - t << " \"\"/\n"; - t << "
    "; + m_t << "
    \n"; + m_t << " \"\"/\n"; + m_t << "
    "; } - endSectionContent(t); + endSectionContent(m_t); m_sectionCount++; } void HtmlGenerator::startMemberList() { - DBG_HTML(t << "\n") + DBG_HTML(m_t << "\n") } void HtmlGenerator::endMemberList() { - DBG_HTML(t << "\n") + DBG_HTML(m_t << "\n") } // anonymous type: @@ -1608,24 +1611,24 @@ void HtmlGenerator::endMemberList() // 2 = single column left aligned void HtmlGenerator::startMemberItem(const char *anchor,int annoType,const char *inheritId) { - DBG_HTML(t << "\n") + DBG_HTML(m_t << "\n") if (m_emptySection) { - t << "\n"; + m_t << "
    \n"; m_emptySection=FALSE; } - t << ""; + m_t << "\">"; insertMemberAlignLeft(annoType, true); } void HtmlGenerator::endMemberItem() { - t << "\n"; + m_t << "\n"; } void HtmlGenerator::startMemberTemplateParams() @@ -1634,63 +1637,63 @@ void HtmlGenerator::startMemberTemplateParams() void HtmlGenerator::endMemberTemplateParams(const char *anchor,const char *inheritId) { - t << "\n"; - t << "\n"; + m_t << ""; + if (!initTag) m_t << " "; switch(annoType) { - case 0: t << "
    "; + m_t << "\">"; } void HtmlGenerator::insertMemberAlign(bool templ) { - DBG_HTML(t << "\n") + DBG_HTML(m_t << "\n") QCString className = templ ? "memTemplItemRight" : "memItemRight"; - t << " "; + m_t << " "; } void HtmlGenerator::insertMemberAlignLeft(int annoType, bool initTag) { - if (!initTag) t << " "; break; - case 1: t << ""; break; - case 2: t << ""; break; - default: t << ""; break; + case 0: m_t << ""; break; + case 1: m_t << ""; break; + case 2: m_t << ""; break; + default: m_t << ""; break; } } void HtmlGenerator::startMemberDescription(const char *anchor,const char *inheritId, bool typ) { - DBG_HTML(t << "\n") + DBG_HTML(m_t << "\n") if (m_emptySection) { - t << "\n"; + m_t << "
    \n"; m_emptySection=FALSE; } - t << ""; - t << ""; - if (typ) t << ""; - t << ""; + if (typ) m_t << ""; + m_t << "\n"; + DBG_HTML(m_t << "\n") + m_t << "
    \n"; } void HtmlGenerator::startMemberSections() { - DBG_HTML(t << "\n") + DBG_HTML(m_t << "\n") m_emptySection=TRUE; // we postpone writing
      ";; + m_t << "\">"; + m_t << "  ";; } void HtmlGenerator::endMemberDescription() { - DBG_HTML(t << "\n") - t << "
    until we actually // write a row to prevent empty tables, which // are not valid XHTML! @@ -1698,364 +1701,364 @@ void HtmlGenerator::startMemberSections() void HtmlGenerator::endMemberSections() { - DBG_HTML(t << "\n") + DBG_HTML(m_t << "\n") if (!m_emptySection) { - t << "
    \n"; + m_t << "
    \n"; } } void HtmlGenerator::startMemberHeader(const char *anchor, int typ) { - DBG_HTML(t << "\n") + DBG_HTML(m_t << "\n") if (!m_emptySection) { - t << ""; + m_t << ""; m_emptySection=TRUE; } if (m_emptySection) { - t << "\n"; + m_t << "
    \n"; m_emptySection=FALSE; } - t << "\n"; + DBG_HTML(m_t << "\n") + m_t << "\n"; } void HtmlGenerator::startMemberSubtitle() { - DBG_HTML(t << "\n") - t << "\n"; + DBG_HTML(m_t << "\n") + m_t << "\n"; } void HtmlGenerator::startIndexList() { - t << "

    "; + m_t << "

    "; if (anchor) { - t << "\n"; + m_t << "\n"; } } void HtmlGenerator::endMemberHeader() { - DBG_HTML(t << "\n") - t << "

    "; + DBG_HTML(m_t << "\n") + m_t << "
    "; } void HtmlGenerator::endMemberSubtitle() { - DBG_HTML(t << "\n") - t << "
    \n"; + m_t << "
    \n"; } void HtmlGenerator::endIndexList() { - t << "
    \n"; + m_t << "\n"; } void HtmlGenerator::startIndexKey() { // inserted 'class = ...', 02 jan 2002, jh - t << " "; + m_t << " "; } void HtmlGenerator::endIndexKey() { - t << ""; + m_t << ""; } void HtmlGenerator::startIndexValue(bool) { // inserted 'class = ...', 02 jan 2002, jh - t << ""; + m_t << ""; } void HtmlGenerator::endIndexValue(const char *,bool) { - t << "\n"; + m_t << "\n"; } void HtmlGenerator::startMemberDocList() { - DBG_HTML(t << "\n";) + DBG_HTML(m_t << "\n";) } void HtmlGenerator::endMemberDocList() { - DBG_HTML(t << "\n";) + DBG_HTML(m_t << "\n";) } void HtmlGenerator::startMemberDoc( const char *clName, const char *memName, const char *anchor, const char *title, int memCount, int memTotal, bool showInline) { - DBG_HTML(t << "\n";) - t << "\n

    " - << "◆ "; + DBG_HTML(m_t << "\n";) + m_t << "\n

    " + << "◆ "; docify(title); if (memTotal>1) { - t << " [" << memCount << "/" << memTotal <<"]"; + m_t << " [" << memCount << "/" << memTotal <<"]"; } - t << "

    \n"; - t << "\n
    \n"; - t << "
    \n"; + m_t << "\n"; + m_t << "\n
    \n"; + m_t << "
    \n"; } void HtmlGenerator::startMemberDocPrefixItem() { - DBG_HTML(t << "\n";) - t << "
    \n"; + DBG_HTML(m_t << "\n";) + m_t << "
    \n"; } void HtmlGenerator::endMemberDocPrefixItem() { - DBG_HTML(t << "\n";) - t << "
    \n"; + DBG_HTML(m_t << "\n";) + m_t << "
    \n"; } void HtmlGenerator::startMemberDocName(bool /*align*/) { - DBG_HTML(t << "\n";) + DBG_HTML(m_t << "\n";) - t << " \n"; + m_t << "
    \n"; - t << " \n"; - t << " \n"; + m_t << " \n"; + DBG_HTML(m_t << "\n";) + m_t << "\n"; } void HtmlGenerator::startParameterList(bool openBracket) { - DBG_HTML(t << "\n";) - t << " \n"; + DBG_HTML(m_t << "\n";) + m_t << " \n"; } void HtmlGenerator::startParameterType(bool first,const char *key) { if (first) { - DBG_HTML(t << "\n";) - t << " \n"; - t << " \n"; - t << " \n"; - t << " \n"; + m_t << " \n"; + m_t << " \n"; + m_t << " \n"; + DBG_HTML(m_t << "\n";) + m_t << " \n"; } void HtmlGenerator::startParameterName(bool /*oneArgOnly*/) { - DBG_HTML(t << "\n";) - t << " \n"; - t << " \n"; + m_t << " \n"; - t << " \n"; - t << " \n"; - t << " \n"; - t << " \n"; - t << " \n"; + m_t << " \n"; + m_t << " \n"; + m_t << " \n"; + m_t << " \n"; + m_t << " \n"; - t << " \n"; + m_t << "\n"; + m_t << " \n"; } } void HtmlGenerator::endParameterList() { - DBG_HTML(t << "\n";) - t << "\n"; - t << " \n"; + DBG_HTML(m_t << "\n";) + m_t << "\n"; + m_t << " \n"; } void HtmlGenerator::exceptionEntry(const char* prefix,bool closeBracket) { - DBG_HTML(t << "\n";) - t << "\n"; - t << " \n"; - t << " \n"; - t << " \n"; + m_t << " \n"; + m_t << " \n"; + m_t << " \n"; + m_t << " \n"; } - t << "
    "; + m_t << "
    "; } void HtmlGenerator::endMemberDocName() { - DBG_HTML(t << "\n";) - t << ""; - if (openBracket) t << "("; - t << ""; + if (openBracket) m_t << "("; + m_t << ""; + DBG_HTML(m_t << "\n";) + m_t << " "; } else { - DBG_HTML(t << "\n";) - t << "
    "; - if (key) t << key; - t << ""; + DBG_HTML(m_t << "\n";) + m_t << "
    "; + if (key) m_t << key; + m_t << ""; } } void HtmlGenerator::endParameterType() { - DBG_HTML(t << "\n";) - t << " "; + DBG_HTML(m_t << "\n";) + m_t << " "; } void HtmlGenerator::endParameterName(bool last,bool emptyList,bool closeBracket) { - DBG_HTML(t << "\n";) + DBG_HTML(m_t << "\n";) if (last) { if (emptyList) { - if (closeBracket) t << ")"; - t << ""; + if (closeBracket) m_t << ")"; + m_t << ""; } else { - t << " 
    "; - if (closeBracket) t << ")"; - t << ""; + m_t << " 
    "; + if (closeBracket) m_t << ")"; + m_t << ""; } } else { - t << "
    "; + DBG_HTML(m_t << "\n";) + m_t << "
    "; // colspan 2 so it gets both parameter type and parameter name columns if (prefix) - t << prefix << "("; + m_t << prefix << "("; else if (closeBracket) - t << ")"; + m_t << ")"; else - t << ""; + m_t << ""; } void HtmlGenerator::endMemberDoc(bool hasArgs) { - DBG_HTML(t << "\n";) + DBG_HTML(m_t << "\n";) if (!hasArgs) { - t << "
    \n"; - // t << "
    \n"; + m_t << " \n"; + // m_t << "
    \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 << "
    ["; + m_t << "
    ["; startHtmlLink(m_relPath+"graph_legend"+Doxygen::htmlFileExtension); - t << theTranslator->trLegend(); + m_t << theTranslator->trLegend(); endHtmlLink(); - t << "]
    "; + m_t << "]
    "; } - 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 << "
    "; + m_t << "
    "; } void HtmlGenerator::endMemberGroupHeader() { - t << "
    \n"; + m_t << "
    \n"; } void HtmlGenerator::startMemberGroupDocs() { - t << "
    "; + m_t << "
    "; } void HtmlGenerator::endMemberGroupDocs() { - t << "
    \n"; + m_t << "
    \n"; } void HtmlGenerator::startMemberGroup() @@ -2068,15 +2071,15 @@ void HtmlGenerator::endMemberGroup(bool) void HtmlGenerator::startIndent() { - DBG_HTML(t << "\n";) + DBG_HTML(m_t << "\n";) - t << "
    \n"; + m_t << "
    \n"; } void HtmlGenerator::endIndent() { - DBG_HTML(t << "\n";) - t << "\n
    \n" << "
    \n"; + DBG_HTML(m_t << "\n";) + m_t << "\n
    \n" << "
    \n"; } void HtmlGenerator::addIndexItem(const char *,const char *) @@ -2088,86 +2091,86 @@ void HtmlGenerator::writeNonBreakableSpace(int n) int i; for (i=0;i\n" - << "" << title << ""; + m_t << "\n" + << ""; } void HtmlGenerator::endDescTable() { - t << "
    " << title << "
    \n"; + m_t << "\n"; } void HtmlGenerator::startDescTableRow() { - t << ""; + m_t << ""; } void HtmlGenerator::endDescTableRow() { - t << "\n"; + m_t << "\n"; } void HtmlGenerator::startDescTableTitle() { - t << ""; + m_t << ""; } void HtmlGenerator::endDescTableTitle() { - t << " "; + m_t << " "; } void HtmlGenerator::startDescTableData() { - t << ""; + m_t << ""; } void HtmlGenerator::endDescTableData() { - t << ""; + m_t << ""; } void HtmlGenerator::startExamples() { - t << "
    "; + m_t << "
    "; docify(theTranslator->trExamples()); - t << "
    "; + m_t << "
    "; } void HtmlGenerator::endExamples() { - t << "
    \n"; + m_t << "\n"; } void HtmlGenerator::startParamList(ParamListTypes, const char *title) { - t << "
    "; + m_t << "
    "; docify(title); - t << "
    "; + m_t << "
    "; } void HtmlGenerator::endParamList() { - t << "
    "; + m_t << ""; } 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 +2190,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 +2203,7 @@ static void endQuickIndexList(std::ostream &t,bool compact) } } -static void startQuickIndexItem(std::ostream &t,const char *l, +static void startQuickIndexItem(TextStream &t,const char *l, bool hl,bool /*compact*/, const QCString &relPath) { @@ -2214,7 +2217,7 @@ static void startQuickIndexItem(std::ostream &t,const char *l, t << ""; } -static void endQuickIndexItem(std::ostream &t,const char *l) +static void endQuickIndexItem(TextStream &t,const char *l) { t << ""; if (l) t << ""; @@ -2262,7 +2265,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 +2294,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,7 +2363,7 @@ 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 &relPath) @@ -2484,7 +2487,7 @@ static void writeDefaultQuickLinks(std::ostream &t,bool compact, void HtmlGenerator::endQuickIndices() { - t << "\n"; + m_t << "\n"; } QCString HtmlGenerator::writeSplitBarAsString(const char *name,const char *relpath) @@ -2495,62 +2498,62 @@ QCString HtmlGenerator::writeSplitBarAsString(const char *name,const char *relpa if (generateTreeView) { result = QCString( - "
    \n" - "
    \n" - "
    \n" - "
    \n" - "
    \n" - "
    \n" - "
    \n" - "
    \n" - "
    \n" - "\n" - "
    \n"); + "
    \n" + "
    \n" + "
    \n" + "
    \n" + "
    \n" + "
    \n" + "
    \n" + "
    \n" + "
    \n" + "\n" + "
    \n"); } return result; } void HtmlGenerator::writeSplitBar(const char *name) { - t << writeSplitBarAsString(name,m_relPath); + m_t << writeSplitBarAsString(name,m_relPath); } void HtmlGenerator::writeNavigationPath(const char *s) { - t << substitute(s,"$relpath^",m_relPath); + m_t << substitute(s,"$relpath^",m_relPath); } void HtmlGenerator::startContents() { - t << "
    \n"; + m_t << "
    \n"; } void HtmlGenerator::endContents() { - t << "
    \n"; + m_t << "
    \n"; } void HtmlGenerator::startPageDoc(const char *pageTitle) { - t << "
    "; + m_t << "
    "; } void HtmlGenerator::endPageDoc() { - t << "
    \n"; + m_t << "
    \n"; } void HtmlGenerator::writeQuickLinks(bool compact,HighlightedItem hli,const char *file) { - writeDefaultQuickLinks(t,compact,hli,file,m_relPath); + writeDefaultQuickLinks(m_t,compact,hli,file,m_relPath); } // PHP based search script @@ -2563,9 +2566,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 << " \"" << convertToHtml(projectName) << "\",\n"; @@ -2586,16 +2590,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 << "\n"; + m_t << "
    \n"; } void HtmlGenerator::startInlineHeader() { if (m_emptySection) { - t << "\n"; + m_t << "
    \n"; m_emptySection=FALSE; } - t << "\n"; + m_t << "\n"; } void HtmlGenerator::startMemberDocSimple(bool isEnum) { - DBG_HTML(t << "\n";) - t << "

    "; + m_t << "

    "; } void HtmlGenerator::endInlineHeader() { - t << "

    \n"; - t << "
    "; - t << (isEnum? theTranslator->trEnumerationValues() : + DBG_HTML(m_t << "\n";) + m_t << "\n"; + m_t << "\n"; } void HtmlGenerator::endMemberDocSimple(bool) { - DBG_HTML(t << "\n";) - t << "
    "; + m_t << (isEnum? theTranslator->trEnumerationValues() : theTranslator->trCompoundMembers()) << "
    \n"; + DBG_HTML(m_t << "\n";) + m_t << "
    \n"; } void HtmlGenerator::startInlineMemberType() { - DBG_HTML(t << "\n";) - t << "\n"; + DBG_HTML(m_t << "\n";) + m_t << "\n"; } void HtmlGenerator::endInlineMemberType() { - DBG_HTML(t << "\n";) - t << "\n"; + DBG_HTML(m_t << "\n";) + m_t << "\n"; } void HtmlGenerator::startInlineMemberName() { - DBG_HTML(t << "\n";) - t << "\n"; + DBG_HTML(m_t << "\n";) + m_t << "\n"; } void HtmlGenerator::endInlineMemberName() { - DBG_HTML(t << "\n";) - t << "\n"; + DBG_HTML(m_t << "\n";) + m_t << "\n"; } void HtmlGenerator::startInlineMemberDoc() { - DBG_HTML(t << "\n";) - t << "\n"; + DBG_HTML(m_t << "\n";) + m_t << "\n"; } void HtmlGenerator::endInlineMemberDoc() { - DBG_HTML(t << "\n";) - t << "\n"; + DBG_HTML(m_t << "\n";) + m_t << "\n"; } void HtmlGenerator::startLabels() { - DBG_HTML(t << "\n";) - t << ""; + DBG_HTML(m_t << "\n";) + m_t << ""; } void HtmlGenerator::writeLabel(const char *l,bool /*isLast*/) { - DBG_HTML(t << "\n";) - //t << "[" << l << "]"; - //if (!isLast) t << ", "; - t << "" << l << ""; + DBG_HTML(m_t << "\n";) + //m_t << "[" << l << "]"; + //if (!isLast) m_t << ", "; + m_t << "" << l << ""; } void HtmlGenerator::endLabels() { - DBG_HTML(t << "\n";) - t << ""; + DBG_HTML(m_t << "\n";) + m_t << ""; } void HtmlGenerator::writeInheritedSectionTitle( @@ -2916,7 +2924,7 @@ void HtmlGenerator::writeInheritedSectionTitle( const char *file, const char *anchor, const char *title, const char *name) { - DBG_HTML(t << "\n";) + DBG_HTML(m_t << "\n";) QCString a = anchor; if (!a.isEmpty()) a.prepend("#"); QCString classLink = QCString("")+convertToHtml(name,FALSE)+""; - t << "" + m_t << "" << "" << "\"-\"/ " << theTranslator->trInheritedFrom(convertToHtml(title,FALSE),classLink) @@ -2944,35 +2952,35 @@ void HtmlGenerator::writeSummaryLink(const char *file,const char *anchor,const c { if (first) { - t << "
    \n"; + m_t << "
    \n"; } else { - t << " |\n"; + m_t << " |\n"; } - t << ""; - t << title; - t << ""; + m_t << "\">"; + m_t << title; + m_t << ""; } void HtmlGenerator::endMemberDeclaration(const char *anchor,const char *inheritId) { - t << " \n"; + m_t << "\"> \n"; } void HtmlGenerator::setCurrentDoc(const Definition *context,const char *anchor,bool isSourceFile) diff --git a/src/htmlgen.h b/src/htmlgen.h index df9bc0c..053506d 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -21,11 +21,11 @@ class HtmlCodeGenerator : public CodeOutputInterface { public: - HtmlCodeGenerator(std::ostream &t,const QCString &relPath); + HtmlCodeGenerator(TextStream &t,const QCString &relPath); HtmlCodeGenerator(); int id() const { return m_id; } void setId(int id) { m_id = id; } - void setTextStream(std::ostream &t); + void setTextStream(TextStream &t); void setRelativePath(const QCString &path); void codify(const char *text); void writeCodeLink(const char *ref,const char *file, @@ -56,7 +56,7 @@ class HtmlCodeGenerator : public CodeOutputInterface const char *tooltip); void docify(const char *str); bool m_streamSet = false; - std::ostream m_t; + TextStream m_t; int m_col = 0; QCString m_relPath; bool m_lineOpen = false; @@ -75,11 +75,11 @@ 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 char *cssname); + static void writeFooterFile(TextStream &t); static void writeTabData(); - static void writeSearchInfo(std::ostream &t,const QCString &relPath); + static void writeSearchInfo(TextStream &t,const QCString &relPath); static void writeSearchData(const char *dir); static void writeSearchPage(); static void writeExternalSearchPage(); @@ -133,8 +133,8 @@ class HtmlGenerator : public OutputGenerator void writeStyleInfo(int part); void startTitleHead(const char *); void endTitleHead(const char *,const char *); - void startTitle() { t << "
    "; } - void endTitle() { t << "
    "; } + void startTitle() { m_t << "
    "; } + void endTitle() { m_t << "
    "; } void startParagraph(const char *classDef); void endParagraph(); @@ -147,8 +147,8 @@ class HtmlGenerator : public OutputGenerator void endIndexKey(); void startIndexValue(bool); void endIndexValue(const char *,bool); - void startItemList() { t << "
      \n"; } - void endItemList() { t << "
    \n"; } + void startItemList() { m_t << "
      \n"; } + void endItemList() { m_t << "
    \n"; } void startIndexItem(const char *ref,const char *file); void endIndexItem(const char *ref,const char *file); void docify(const char *text); @@ -160,12 +160,12 @@ class HtmlGenerator : public OutputGenerator void endTextLink(); void startHtmlLink(const char *url); void endHtmlLink(); - void startTypewriter() { t << ""; } - void endTypewriter() { t << ""; } + void startTypewriter() { m_t << ""; } + void endTypewriter() { m_t << ""; } void startGroupHeader(int); void endGroupHeader(int); - void startItemListItem() { t << "
  • "; } - void endItemListItem() { t << "
  • \n"; } + void startItemListItem() { m_t << "
  • "; } + void endItemListItem() { m_t << "
  • \n"; } void startMemberSections(); void endMemberSections(); @@ -205,19 +205,19 @@ class HtmlGenerator : public OutputGenerator const char *file, const char *anchor, const char *title,const char *name); - void writeRuler() { t << "
    "; } + void writeRuler() { m_t << "
    "; } void writeAnchor(const char *,const char *name) - { t << ""; } - void startEmphasis() { t << ""; } - void endEmphasis() { t << ""; } - void startBold() { t << ""; } - void endBold() { t << ""; } - void startDescription() { t << "\n
    \n"; } - void endDescription() { t << "\n
    \n\n"; } - void startDescItem() { t << "
    "; } - void endDescItem() { t << "
    "; } - void startDescForItem() { t << "
    "; } - void endDescForItem() { t << "
    \n"; } + { m_t << ""; } + void startEmphasis() { m_t << ""; } + void endEmphasis() { m_t << ""; } + void startBold() { m_t << ""; } + void endBold() { m_t << ""; } + void startDescription() { m_t << "\n
    \n"; } + void endDescription() { m_t << "\n
    \n\n"; } + void startDescItem() { m_t << "
    "; } + void endDescItem() { m_t << "
    "; } + void startDescForItem() { m_t << "
    "; } + void endDescForItem() { m_t << "
    \n"; } void lineBreak(const char *style); void writeChar(char c); void startMemberDoc(const char *clName, const char *memName, @@ -231,15 +231,15 @@ class HtmlGenerator : public OutputGenerator 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 << "

    "; } - void endSubsection() { t << "

    \n"; } - void startSubsubsection() { t << "

    "; } - void endSubsubsection() { t << "

    \n"; } - void startCenter() { t << "
    \n"; } - void endCenter() { t << "
    \n"; } - void startSmall() { t << "\n"; } - void endSmall() { t << "\n"; } + void writeEndAnnoItem(const char *) { m_t << "\n"; } + void startSubsection() { m_t << "

    "; } + void endSubsection() { m_t << "

    \n"; } + void startSubsubsection() { m_t << "

    "; } + void endSubsubsection() { m_t << "

    \n"; } + void startCenter() { m_t << "
    \n"; } + void endCenter() { m_t << "
    \n"; } + void startSmall() { m_t << "\n"; } + void endSmall() { m_t << "\n"; } void startExamples(); void endExamples(); void startParamList(ParamListTypes,const char *); @@ -289,9 +289,9 @@ class HtmlGenerator : public OutputGenerator void writeGraphicalHierarchy(DotGfxHierarchyTable &g); void startTextBlock(bool) - { t << "
    "; } + { m_t << "
    "; } void endTextBlock(bool) - { t << "
    "; } + { m_t << "
    "; } void lastIndexPage() {} void startMemberDocPrefixItem(); @@ -329,7 +329,7 @@ class HtmlGenerator : public OutputGenerator 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; diff --git a/src/index.cpp b/src/index.cpp index 92c9f37..3d3169b 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -989,7 +989,7 @@ static void writeHierarchicalIndex(OutputList &ol) } 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); @@ -1095,7 +1095,7 @@ static void writeHierarchicalInterfaceIndex(OutputList &ol) } 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); @@ -1201,7 +1201,7 @@ static void writeHierarchicalExceptionIndex(OutputList &ol) } 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); @@ -1457,7 +1457,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; @@ -1864,7 +1864,7 @@ static void writeNamespaceIndex(OutputList &ol) } 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; @@ -2389,7 +2389,7 @@ static void writeAnnotatedIndexGeneric(OutputList &ol,const AnnotatedIndexContex 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) @@ -3601,7 +3601,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; @@ -3996,7 +3996,7 @@ static void writeGroupIndex(OutputList &ol) } 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()); @@ -4439,9 +4439,9 @@ 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 2002-03-05 QCString latex_command = theTranslator->latexCommandName(); QCString mkidx_command = Config_getString(MAKEINDEX_CMD_NAME); @@ -499,24 +500,24 @@ 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); @@ -531,7 +532,7 @@ 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.setTextStream(m_t); m_codeGen.setRelativePath(m_relPath); m_codeGen.setSourceFileName(stripPath(fileName)); } @@ -549,7 +550,7 @@ void LatexGenerator::endFile() void LatexGenerator::startProjectNumber() { - t << "\\\\[1ex]\\large "; + m_t << "\\\\[1ex]\\large "; } static QCString extraLatexStyleSheet() @@ -613,7 +614,7 @@ 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) @@ -639,11 +640,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(); @@ -701,45 +702,45 @@ 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 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 +748,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 +761,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 +774,8 @@ 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; } } @@ -790,8 +791,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 +809,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 +821,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 +851,31 @@ 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 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 +886,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 +903,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 +920,10 @@ 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"; } } } @@ -940,10 +941,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 +960,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 +976,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,7 +1007,7 @@ 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; } } @@ -1015,9 +1016,9 @@ void LatexGenerator::writePageLink(const char *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,45 +1028,45 @@ 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 *) { - t << "\n" << "\n"; + m_t << "\n" << "\n"; } void LatexGenerator::endParagraph() { - t << "\n" << "\n"; + m_t << "\n" << "\n"; } void LatexGenerator::writeString(const char *text) { - t << text; + m_t << text; } void LatexGenerator::startIndexItem(const char *ref,const char *fn) { - t << "\\item "; + m_t << "\\item "; if (!ref && fn) { - t << "\\contentsline{section}{"; + m_t << "\\contentsline{section}{"; } } @@ -1073,15 +1074,15 @@ void LatexGenerator::endIndexItem(const char *ref,const char *fn) { if (!ref && fn) { - t << "}{\\pageref{" << stripPath(fn) << "}}{}\n"; + m_t << "}{\\pageref{" << stripPath(fn) << "}}{}\n"; } } //void LatexGenerator::writeIndexFileItem(const char *,const char *text) //{ -// t << "\\item\\contentsline{section}{"; +// m_t << "\\item\\contentsline{section}{"; // docify(text); -// t << "}{\\pageref{" << stripPath(text) << "}}\n"; +// m_t << "}{\\pageref{" << stripPath(text) << "}}\n"; //} @@ -1089,48 +1090,48 @@ void LatexGenerator::startHtmlLink(const char *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) //{ // 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) { - t << "\\item\\contentsline{section}\\textbf{ "; + m_t << "\\item\\contentsline{section}\\textbf{ "; if (path) docify(path); docify(name); - t << "} "; + m_t << "} "; } void LatexGenerator::writeEndAnnoItem(const char *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,22 +1140,22 @@ 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*/) { - //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) //{ -// t << "\\textbf{ "; +// m_t << "\\textbf{ "; // docify(name); -// t << "}"; +// m_t << "}"; //} void LatexGenerator::startTextLink(const char *f,const char *anchor) @@ -1162,14 +1163,14 @@ void LatexGenerator::startTextLink(const char *f,const char *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) m_t << stripPath(f); + if (anchor) m_t << "_" << anchor; + m_t << "}{"; } else { - t << "\\textbf{ "; + m_t << "\\textbf{ "; } } @@ -1178,9 +1179,9 @@ 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, @@ -1189,33 +1190,33 @@ void LatexGenerator::writeObjectLink(const char *ref, const char *f, bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS); if (!m_disableLinks && !ref && pdfHyperlinks) { - t << "\\mbox{\\hyperlink{"; - if (f) t << stripPath(f); - if (f && anchor) t << "_"; - if (anchor) t << anchor; - t << "}{"; + m_t << "\\mbox{\\hyperlink{"; + if (f) m_t << stripPath(f); + if (f && anchor) m_t << "_"; + if (anchor) 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) { - t << "}{"; - if (clname) t << clname; - if (anchor) t << "_" << anchor; - t << "}"; + m_t << "}{"; + if (clname) m_t << clname; + if (anchor) m_t << "_" << anchor; + m_t << "}"; } @@ -1225,28 +1226,28 @@ void LatexGenerator::startTitleHead(const char *fileName) bool usePDFLatex = Config_getBool(USE_PDFLATEX); if (usePDFLatex && pdfHyperlinks && fileName) { - 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) { - t << "}\n"; + m_t << "}\n"; if (name) { - 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 +1255,11 @@ void LatexGenerator::startTitle() { if (Config_getBool(COMPACT_LATEX)) { - t << "\\doxysubsection{"; + m_t << "\\doxysubsection{"; } else { - t << "\\doxysection{"; + m_t << "\\doxysection{"; } } @@ -1271,19 +1272,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 +1292,18 @@ void LatexGenerator::startGroupHeader(int extraIndentLevel) void LatexGenerator::endGroupHeader(int) { m_disableLinks=FALSE; - t << "}\n"; + m_t << "}\n"; } void LatexGenerator::startMemberHeader(const char *,int) { if (Config_getBool(COMPACT_LATEX)) { - t << "\\doxysubsubsection*{"; + m_t << "\\doxysubsubsection*{"; } else { - t << "\\doxysubsection*{"; + m_t << "\\doxysubsection*{"; } m_disableLinks=TRUE; } @@ -1310,7 +1311,7 @@ void LatexGenerator::startMemberHeader(const char *,int) void LatexGenerator::endMemberHeader() { m_disableLinks=FALSE; - t << "}\n"; + m_t << "}\n"; } void LatexGenerator::startMemberDoc(const char *clname, @@ -1323,33 +1324,33 @@ void LatexGenerator::startMemberDoc(const char *clname, { if (memname && memname[0]!='@') { - t << "\\index{"; + m_t << "\\index{"; if (clname) { - 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 << "}"; + 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) { - 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,32 +1358,32 @@ 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 *, @@ -1391,18 +1392,18 @@ void LatexGenerator::startDoxyAnchor(const char *fName,const char *, { 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) m_t << stripPath(fName); + if (anchor) m_t << "_" << anchor; + m_t << "}"; } - t << "\\label{"; - if (fName) t << stripPath(fName); - if (anchor) t << "_" << anchor; - t << "}} \n"; + m_t << "\\label{"; + if (fName) m_t << stripPath(fName); + if (anchor) m_t << "_" << anchor; + m_t << "}} \n"; } void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor) @@ -1412,18 +1413,18 @@ void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor) void LatexGenerator::writeAnchor(const char *fName,const char *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) { - 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"; } } } @@ -1438,20 +1439,20 @@ void LatexGenerator::addIndexItem(const char *s1,const char *s2) { if (s1) { - t << "\\index{"; - t << latexEscapeLabelName(s1); - t << "@{"; - t << latexEscapeIndexChars(s1); - t << "}"; + m_t << "\\index{"; + m_t << latexEscapeLabelName(s1); + m_t << "@{"; + m_t << latexEscapeIndexChars(s1); + m_t << "}"; if (s2) { - 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 << "}"; } } @@ -1462,46 +1463,46 @@ void LatexGenerator::startSection(const char *lab,const char *,SectionType type) 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) { - t << "}\\label{" << lab << "}\n"; + m_t << "}\\label{" << lab << "}\n"; } void LatexGenerator::docify(const char *str) { - filterLatexString(t,str, + filterLatexString(m_t,str, m_insideTabbing, // insideTabbing false, // insidePre false, // insideItem @@ -1520,14 +1521,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 *) { - d.writeFigure(t,dir(),fileName); + d.writeFigure(m_t,dir(),fileName); } @@ -1535,8 +1536,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 +1547,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,7 +1557,7 @@ void LatexGenerator::startMemberTemplateParams() { if (templateMemberItem) { - t << "{\\footnotesize "; + m_t << "{\\footnotesize "; } } @@ -1564,7 +1565,7 @@ void LatexGenerator::endMemberTemplateParams(const char *,const char *) { if (templateMemberItem) { - t << "}\\\\"; + m_t << "}\\\\"; } } @@ -1573,7 +1574,7 @@ void LatexGenerator::startMemberItem(const char *,int annoType,const char *) //printf("LatexGenerator::startMemberItem(%d)\n",annType); if (!m_insideTabbing) { - t << "\\item \n"; + m_t << "\\item \n"; templateMemberItem = (annoType == 3); } } @@ -1582,22 +1583,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) { if (!m_insideTabbing) { - t << "\\begin{DoxyCompactList}\\small\\item\\em "; + m_t << "\\begin{DoxyCompactList}\\small\\item\\em "; } else { - for (int i=0;i"; - t << "{\\em "; + for (int i=0;i"; + m_t << "{\\em "; } } @@ -1605,12 +1606,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 +1621,11 @@ void LatexGenerator::writeNonBreakableSpace(int) //printf("writeNonBreakableSpace()\n"); if (m_insideTabbing) { - t << "\\>"; + m_t << "\\>"; } else { - t << "~"; + m_t << "~"; } } @@ -1645,20 +1646,20 @@ void LatexGenerator::writeNonBreakableSpace(int) void LatexGenerator::startDescTable(const char *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 +1668,7 @@ void LatexGenerator::endDescTableRow() void LatexGenerator::startDescTableTitle() { - t << "}"; + m_t << "}"; } void LatexGenerator::endDescTableTitle() @@ -1676,12 +1677,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 +1694,7 @@ void LatexGenerator::startMemberList() { if (!m_insideTabbing) { - t << "\\begin{DoxyCompactItemize}\n"; + m_t << "\\begin{DoxyCompactItemize}\n"; } } @@ -1702,41 +1703,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 +1746,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 +1757,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 +1766,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 +1775,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 +1784,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 +1793,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,33 +1828,33 @@ 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) { - 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() @@ -1862,58 +1863,58 @@ void LatexGenerator::endParameterList() void LatexGenerator::startParameterType(bool first,const char *key) { - t << "\\item[{"; + m_t << "\\item[{"; if (!first && key) 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) { if (prefix) - t << " " << prefix << "("; + 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) { - 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 +1923,12 @@ void LatexGenerator::endConstraintParam() void LatexGenerator::startConstraintType() { - t << "} : {\\em "; + m_t << "} : {\\em "; } void LatexGenerator::endConstraintType() { - t << "}]"; + m_t << "}]"; } void LatexGenerator::startConstraintDocs() @@ -1940,36 +1941,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 *) { if (m_insideTabbing) { - t << "\\\\\n"; + m_t << "\\\\\n"; } else { - t << "\\newline\n"; + m_t << "\\newline\n"; } } @@ -1978,15 +1979,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 +1995,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 +2010,7 @@ void LatexGenerator::startInlineMemberType() void LatexGenerator::endInlineMemberType() { - t << "&\n"; + m_t << "&\n"; m_insideTabbing = FALSE; } @@ -2020,7 +2021,7 @@ void LatexGenerator::startInlineMemberName() void LatexGenerator::endInlineMemberName() { - t << "&\n"; + m_t << "&\n"; m_insideTabbing = FALSE; } @@ -2030,18 +2031,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) { - 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..ce99789 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -23,12 +23,14 @@ #define LATEX_STYLE_EXTENSION ".sty" +class TextStream; + class LatexCodeGenerator : public CodeOutputInterface { public: - LatexCodeGenerator(std::ostream &t,const QCString &relPath,const QCString &sourceFile); + LatexCodeGenerator(TextStream &t,const QCString &relPath,const QCString &sourceFile); LatexCodeGenerator(); - void setTextStream(std::ostream &t); + void setTextStream(TextStream &t); void setRelativePath(const QCString &path); void setSourceFileName(const QCString &sourceFileName); void codify(const char *text); @@ -65,7 +67,7 @@ class LatexCodeGenerator : public CodeOutputInterface const char *tooltip); void docify(const char *str); bool m_streamSet = false; - std::ostream m_t; + TextStream m_t; QCString m_relPath; QCString m_sourceFileName; int m_col = 0; @@ -85,9 +87,9 @@ class LatexGenerator : public OutputGenerator virtual std::unique_ptr 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; } @@ -138,7 +140,7 @@ class LatexGenerator : public OutputGenerator void startTitleHead(const char *); void startTitle(); void endTitleHead(const char *,const char *name); - void endTitle() { t << "}"; } + void endTitle() { m_t << "}"; } void newParagraph(); void startParagraph(const char *classDef); @@ -146,14 +148,14 @@ class LatexGenerator : public OutputGenerator void writeString(const char *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 startItemList() { m_t << "\\begin{DoxyCompactItemize}\n"; } + void endItemList() { m_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); @@ -164,11 +166,11 @@ class LatexGenerator : public OutputGenerator void endTextLink(); void startHtmlLink(const char *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() {} @@ -202,12 +204,12 @@ class LatexGenerator : public OutputGenerator void insertMemberAlign(bool) {} void insertMemberAlignLeft(int,bool){} - void writeRuler() { t << "\n\n"; } + void writeRuler() { m_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 startEmphasis() { m_t << "{\\em "; } + void endEmphasis() { m_t << "}"; } + void startBold() { m_t << "{\\bfseries "; } + void endBold() { m_t << "}"; } void startDescription(); void endDescription(); void startDescItem(); @@ -218,31 +220,31 @@ class LatexGenerator : public OutputGenerator void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *); void endDoxyAnchor(const char *,const char *); void writeChar(char c); - void writeLatexSpacing() { t << "\\hspace{0.3cm}"; } + void writeLatexSpacing() { m_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 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 char *,const char *,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 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 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); @@ -291,7 +293,7 @@ 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 *); diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index 3839510..894c910 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -28,7 +28,7 @@ #include "emoji.h" #include "fileinfo.h" -ManDocVisitor::ManDocVisitor(std::ostream &t,CodeOutputInterface &ci, +ManDocVisitor::ManDocVisitor(TextStream &t,CodeOutputInterface &ci, const char *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) diff --git a/src/mandocvisitor.h b/src/mandocvisitor.h index c994f08..d644111 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 char *langExt); //-------------------------------------- // visitor functions for leaf nodes @@ -149,7 +150,7 @@ class ManDocVisitor : public DocVisitor // state variables //-------------------------------------- - std::ostream &m_t; + TextStream &m_t; CodeOutputInterface &m_ci; bool m_insidePre; bool m_hide; diff --git a/src/mangen.cpp b/src/mangen.cpp index 2c26553..dc4cbb2 100644 --- a/src/mangen.cpp +++ b/src/mangen.cpp @@ -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) { - 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,8 +192,8 @@ 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; @@ -203,8 +203,8 @@ void ManGenerator::startParagraph(const char *) { 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; @@ -260,15 +260,15 @@ void ManGenerator::endHtmlLink() 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; @@ -276,13 +276,13 @@ void ManGenerator::endGroupHeader(int) void ManGenerator::startMemberHeader(const char *,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; } @@ -297,12 +297,12 @@ void ManGenerator::docify(const char *str) { 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'); @@ -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; @@ -395,15 +395,15 @@ void ManGenerator::endItemListItem() void ManGenerator::startCodeFragment(const char *) { newParagraph(); - t << ".nf\n"; + m_t << ".nf\n"; m_firstCol=TRUE; m_paragraph=FALSE; } void ManGenerator::endCodeFragment(const char *) { - 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; @@ -411,8 +411,8 @@ void ManGenerator::endCodeFragment(const char *) void ManGenerator::startMemberDoc(const char *,const char *,const char *,const char *,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; } @@ -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; } @@ -541,21 +541,21 @@ void ManGenerator::endAnonTypeScope(int indentLevel) void ManGenerator::startMemberItem(const char *,int,const char *) { - 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,17 +584,17 @@ 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; } @@ -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; } @@ -658,7 +658,7 @@ void ManGenerator::endExamples() void ManGenerator::startDescTable(const char *title) { if (!m_firstCol) - { t << "\n.PP\n"; + { m_t << "\n.PP\n"; m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } @@ -678,7 +678,7 @@ void ManGenerator::endDescTable() void ManGenerator::startParamList(ParamListTypes,const char *title) { if (!m_firstCol) - { t << "\n.PP\n"; + { m_t << "\n.PP\n"; m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } @@ -695,7 +695,7 @@ 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; @@ -705,7 +705,7 @@ void ManGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *,i void ManGenerator::startConstraintList(const char *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; } @@ -832,8 +832,8 @@ void ManGenerator::startLabels() void ManGenerator::writeLabel(const char *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..e621988 100644 --- a/src/mangen.h +++ b/src/mangen.h @@ -82,8 +82,8 @@ class ManGenerator : public OutputGenerator void endTextLink() {} void startHtmlLink(const char *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() {} @@ -123,18 +123,18 @@ class ManGenerator : public OutputGenerator 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 writeLineNumber(const char *,const char *,const char *,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 char *) { m_t << "\n.br\n"; } void writeChar(char c); void startMemberDoc(const char *,const char *,const char *,const char *,int,int,bool); void endMemberDoc(bool); @@ -143,7 +143,7 @@ class ManGenerator : public OutputGenerator 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 writeEndAnnoItem(const char *) { m_t << "\n"; m_firstCol=TRUE; } void startSubsection(); void endSubsection(); void startSubsubsection(); @@ -152,8 +152,8 @@ 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 char *,const char *,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 *, @@ -186,7 +186,7 @@ class ManGenerator : public OutputGenerator void writeSummaryLink(const char *,const char *,const char *,bool) {} void startContents() {} void endContents() {} - void writeNonBreakableSpace(int n) { int i; for (i=0;iresult.data()) { // strip part of the input - result = result.mid(p-result.data()); + result = result.mid(static_cast(p-result.data())); } return result; } diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 26b997c..48291cb 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -315,7 +315,7 @@ class MemberDefImpl : public DefinitionMixin 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; @@ -4258,7 +4258,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 << " writeTagFile(tagFile); } diff --git a/src/membergroup.h b/src/membergroup.h index 178a0f9..64d75b2 100644 --- a/src/membergroup.h +++ b/src/membergroup.h @@ -37,6 +37,7 @@ class OutputList; class Definition; class DefinitionMutable; class RefItem; +class TextStream; /** A class representing a group of members. */ class MemberGroup @@ -60,7 +61,7 @@ class MemberGroup const Definition *container,bool showEnumValues,bool showInline) const; void writeDocumentationPage(OutputList &ol,const char *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..c4ee04c 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -948,7 +948,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..7b73dc5 100644 --- a/src/memberlist.h +++ b/src/memberlist.h @@ -100,7 +100,7 @@ class MemberList void writeSimpleDocumentation(OutputList &ol,const Definition *container) const; void writeDocumentationPage(OutputList &ol, const char *scopeName, const DefinitionMutable *container) const; - void writeTagFile(std::ostream &); + void writeTagFile(TextStream &); bool declVisible() const; void addMemberGroup(MemberGroup *mg); void setInGroup(bool inGroup) { m_inGroup=inGroup; } diff --git a/src/msc.cpp b/src/msc.cpp index 8b45faa..7247689 100644 --- a/src/msc.cpp +++ b/src/msc.cpp @@ -25,10 +25,11 @@ #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 char *mapName,const QCString relPath, const QCString &context) { std::ifstream f(mapName,std::ifstream::in); @@ -153,16 +154,15 @@ static QCString getMscImageMapFromFile(const QCString& inFile, const QCString& o 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, diff --git a/src/msc.h b/src/msc.h index 1122cc7..64b1238 100644 --- a/src/msc.h +++ b/src/msc.h @@ -16,9 +16,8 @@ #ifndef _MSC_H #define _MSC_H -#include - class QCString; +class TextStream; enum MscOutputFormat { MSC_BITMAP , MSC_EPS, MSC_SVG }; @@ -28,7 +27,7 @@ void writeMscGraphFromFile(const char *inFile,const char *outDir, 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..d392f69 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -63,7 +63,7 @@ class NamespaceDefImpl : public DefinitionMixin 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 insertNamespace(const NamespaceDef *nd); virtual void insertMember(MemberDef *md); @@ -125,7 +125,7 @@ class NamespaceDefImpl : public DefinitionMixin 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 writeNamespaceDeclarations(OutputList &ol,const QCString &title, bool isConstantGroup=false); @@ -533,7 +533,7 @@ bool NamespaceDefImpl::hasDetailedDescription() const !documentation().isEmpty()); } -void NamespaceDefImpl::writeTagFile(std::ostream &tagFile) +void NamespaceDefImpl::writeTagFile(TextStream &tagFile) { tagFile << " \n"; tagFile << " " << convertToXML(name()) << "\n"; @@ -851,7 +851,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) { diff --git a/src/namespacedef.h b/src/namespacedef.h index dfe43a7..0dc0005 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -108,7 +108,7 @@ 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 insertNamespace(const NamespaceDef *nd) = 0; virtual void insertMember(MemberDef *md) = 0; // md cannot be const, since setSectionList is called on it diff --git a/src/outputgen.cpp b/src/outputgen.cpp index d922a93..ff03498 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 char *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,7 +50,7 @@ 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"); } @@ -66,12 +66,13 @@ void OutputGenerator::startPlainFile(const char *name) { term("Could not open file %s for writing\n",m_fileName.data()); } - t.rdbuf(m_file.rdbuf()); + m_t.setStream(&m_file); } void OutputGenerator::endPlainFile() { - t.rdbuf(nullptr); + m_t.flush(); + m_t.setStream(nullptr); m_file.close(); m_fileName.resize(0); } diff --git a/src/outputgen.h b/src/outputgen.h index 7a4571d..9eab898 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; @@ -495,7 +496,7 @@ class OutputGenerator : public BaseOutputDocInterface virtual void endLabels() = 0; protected: - std::ostream t; + TextStream m_t; private: QCString m_dir; QCString m_fileName; diff --git a/src/pagedef.cpp b/src/pagedef.cpp index 59055a3..ef5c4eb 100644 --- a/src/pagedef.cpp +++ b/src/pagedef.cpp @@ -57,7 +57,7 @@ class PageDefImpl : public DefinitionMixin 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; @@ -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()) diff --git a/src/pagedef.h b/src/pagedef.h index 0da42dd..ee77612 100644 --- a/src/pagedef.h +++ b/src/pagedef.h @@ -55,7 +55,7 @@ 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; diff --git a/src/pyscanner.l b/src/pyscanner.l index 23bdb0b..1e6c7ab 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; @@ -1749,7 +1748,7 @@ static void parseCompounds(yyscan_t yyscanner,std::shared_ptr rt) for (size_t i=0; ichildren().size(); ++i) { std::shared_ptr 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()); diff --git a/src/qcstring.cpp b/src/qcstring.cpp index 0ed5a99..ed35990 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; diff --git a/src/qhp.cpp b/src/qhp.cpp index dd199ad..47131be 100644 --- a/src/qhp.cpp +++ b/src/qhp.cpp @@ -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() diff --git a/src/qhpxmlwriter.cpp b/src/qhpxmlwriter.cpp index f495aaa..fe3b380 100644 --- a/src/qhpxmlwriter.cpp +++ b/src/qhpxmlwriter.cpp @@ -42,7 +42,7 @@ 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(); } diff --git a/src/qhpxmlwriter.h b/src/qhpxmlwriter.h index f883ba6..bc927d4 100644 --- a/src/qhpxmlwriter.h +++ b/src/qhpxmlwriter.h @@ -17,9 +17,10 @@ #ifndef QHPXMLWRITER_H #define QHPXMLWRITER_H -#include #include +class TextStream; + class QhpXmlWriter { public: @@ -29,7 +30,7 @@ class QhpXmlWriter void setIndentLevel(int level); void setCompressionEnabled(bool enabled); void insert(QhpXmlWriter const & source); - void dumpTo(std::ostream & file); + void dumpTo(TextStream & file); void open(char const * elementName, char const * const * attributes = 0); void openClose(char const * elementName, diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index 5a19fc0..d0d4e06 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -55,7 +55,7 @@ static QCString align(DocHtmlCell *cell) return ""; } -RTFDocVisitor::RTFDocVisitor(std::ostream &t,CodeOutputInterface &ci, +RTFDocVisitor::RTFDocVisitor(TextStream &t,CodeOutputInterface &ci, const char *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) diff --git a/src/rtfdocvisitor.h b/src/rtfdocvisitor.h index 290746a..bbad6c4 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 char *langExt); //-------------------------------------- // visitor functions for leaf nodes @@ -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..91e4996 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"; @@ -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,54 +318,54 @@ 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) @@ -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) m_t << "{\\subject " << rtf_subject << "}\n"; + if (rtf_comments) m_t << "{\\comment " << rtf_comments << "}\n"; + if (rtf_company) m_t << "{\\company " << rtf_company << "}\n"; + if (rtf_author) m_t << "{\\author " << rtf_author << "}\n"; + if (rtf_manager) m_t << "{\\manager " << rtf_manager << "}\n"; + if (rtf_documentType) m_t << "{\\category " << rtf_documentType << "}\n"; + if (rtf_keywords) m_t << "{\\keywords " << rtf_keywords << "}\n"; + m_t << "{\\comment "; break; case isMainPage: //Introduction @@ -449,7 +449,7 @@ void RTFGenerator::startIndexSection(IndexSections is) break; case isClassHierarchyIndex: //Hierarchical Index - DBG_RTF(t << "{\\comment start classhierarchy}\n") + DBG_RTF(m_t << "{\\comment start classhierarchy}\n") beginRTFChapter(); break; case isCompoundIndex: @@ -559,7 +559,7 @@ void RTFGenerator::startIndexSection(IndexSections is) break; case isPageDocumentation2: { - t << "{\\tc \\v "; + m_t << "{\\tc \\v "; } break; case isEndIndex: @@ -579,175 +579,175 @@ void RTFGenerator::endIndexSection(IndexSections is) case isTitlePageStart: if (rtf_title) // 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 "<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 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 +755,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 +780,15 @@ 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"; } } } @@ -798,11 +798,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 +812,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 +829,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 +857,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,17 +895,17 @@ 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; } @@ -913,21 +913,21 @@ void RTFGenerator::endIndexSection(IndexSections is) void RTFGenerator::writePageLink(const char *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"; } @@ -937,35 +937,35 @@ void RTFGenerator::writeStyleInfo(int) void RTFGenerator::lineBreak(const char *) { - 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) { - 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 +973,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 +983,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 +992,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 +1003,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,59 +1012,59 @@ 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 *) { - 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) { - DBG_RTF(t << "{\\comment (endIndexItem)}\n") + DBG_RTF(m_t << "{\\comment (endIndexItem)}\n") if (!ref && fn) { - 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) //{ -// 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) @@ -1072,10 +1072,10 @@ void RTFGenerator::startHtmlLink(const char *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 +1087,7 @@ void RTFGenerator::endHtmlLink() { if (Config_getBool(RTF_HYPERLINKS)) { - t << "}}}\n"; + m_t << "}}}\n"; } else { @@ -1105,75 +1105,75 @@ void RTFGenerator::endHtmlLink() void RTFGenerator::writeStartAnnoItem(const char *,const char *f, const char *path,const char *name) { - DBG_RTF(t << "{\\comment (writeStartAnnoItem)}\n") - t << "{\\b "; + DBG_RTF(m_t << "{\\comment (writeStartAnnoItem)}\n") + m_t << "{\\b "; if (path) docify(path); if (f && 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) { - DBG_RTF(t << "{\\comment (writeEndAnnoItem)}\n") + DBG_RTF(m_t << "{\\comment (writeEndAnnoItem)}\n") if (name) { - 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) { - DBG_RTF(t << "{\\comment (endIndexValue)}\n") - if (hasBrief) t << ")"; - t << "} "; + DBG_RTF(m_t << "{\\comment (endIndexValue)}\n") + if (hasBrief) m_t << ")"; + m_t << "} "; if (name) { - t << "\\tab "; + m_t << "\\tab "; writeRTFReference(name); - t << "\n"; + m_t << "\n"; } else { - t << "\n"; + m_t << "\n"; } m_omitParagraph=FALSE; newParagraph(); @@ -1182,107 +1182,107 @@ 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) //{ -// 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"<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;itrPageAbbreviation()); // writeRTFReference(lab); -// t << ")\n"; +// m_t << ")\n"; // } //} // @@ -1717,9 +1717,9 @@ void RTFGenerator::endSection(const char *lab,SectionType) // const char *title) //{ // docify(title); -// t << "\\tab"; +// m_t << "\\tab"; // writeRTFReference(lab); -// t << "\n"; +// m_t << "\n"; //} // //void RTFGenerator::writeSectionRefAnchor(const char *name,const char *lab, @@ -1751,28 +1751,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; @@ -1801,16 +1801,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,7 +1826,7 @@ 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, @@ -1835,31 +1835,31 @@ void RTFGenerator::endClassDiagram(const ClassDiagram &d, 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) //{ -// t << text; +// m_t << text; //} void RTFGenerator::startMemberItem(const char *,int,const char *) { - 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(); } @@ -1879,70 +1879,70 @@ void RTFGenerator::writeAnchor(const char *fileName,const char *name) 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) { - 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 *) { - 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 *) { 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) //{ // 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) @@ -1961,12 +1961,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) @@ -1976,13 +1976,13 @@ void RTFGenerator::endMemberList() // void RTFGenerator::startDescTable(const char *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 +1992,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 +2018,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" @@ -2104,24 +2104,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 +2129,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) { - 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 +2188,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 +2208,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 +2226,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 +2244,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 +2258,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 +2268,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,7 +2307,7 @@ bool isLeadBytes(int c) // note: function is not reentrant! -static void encodeForOutput(std::ostream &t,const char *s) +static void encodeForOutput(TextStream &t,const char *s) { if (s==0) return; QCString encoding; @@ -2372,7 +2372,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 +2407,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 +2440,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 +2448,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,46 +2494,46 @@ 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. @@ -2602,25 +2602,28 @@ bool RTFGenerator::preProcessFileInplace(const char *path,const char *name) QCString combinedName = (QCString)path+"/combined.rtf"; QCString mainRTFName = (QCString)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 +2635,122 @@ 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) { - 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) { - DBG_RTF(t << "{\\comment (startParameterType)}\n") + DBG_RTF(m_t << "{\\comment (startParameterType)}\n") if (!first && key) { - 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) { - DBG_RTF(t << "{\\comment (exceptionEntry)}\n") + DBG_RTF(m_t << "{\\comment (exceptionEntry)}\n") if (prefix) - t << " " << prefix << "("; + 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 +2758,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 @@ -2810,108 +2813,108 @@ void RTFGenerator::postProcess(QByteArray &a) void RTFGenerator::startConstraintList(const char *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,56 +2930,56 @@ void RTFGenerator::startMemberDocSimple(bool isEnum) } for (i=0;i 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); @@ -89,8 +89,8 @@ class RTFGenerator : public OutputGenerator void endTextLink(); void startHtmlLink(const char *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(); @@ -128,10 +128,10 @@ class RTFGenerator : public OutputGenerator void writeLineNumber(const char *,const char *,const char *,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(); @@ -142,7 +142,7 @@ class RTFGenerator : public OutputGenerator void startDoxyAnchor(const char *,const char *,const char *,const char *,const char *); void endDoxyAnchor(const char *,const char *); void writeChar(char c); - void writeLatexSpacing() {};//{ t << "\\hspace{0.3cm}"; } + void writeLatexSpacing() {};//{ m_t << "\\hspace{0.3cm}"; } void writeStartAnnoItem(const char *type,const char *file, const char *path,const char *name); void writeEndAnnoItem(const char *name); @@ -150,10 +150,10 @@ class RTFGenerator : public OutputGenerator 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 endMemberDescription(); diff --git a/src/scanner.l b/src/scanner.l index f6241c3..38c8169 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; @@ -151,13 +150,13 @@ struct scannerYY_state QCString *pCopyRoundString = 0; QCString *pCopyCurlyString = 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 +170,7 @@ struct scannerYY_state QCString briefBackup; int docBlockContext = 0; - std::ostringstream docBlock; + TextStream docBlock; QCString docBlockName; bool docBlockInBody = false; bool docBlockAutoBrief = false; @@ -7204,7 +7203,7 @@ static void parseCompounds(yyscan_t yyscanner,const std::shared_ptr &rt) //printf("parseCompounds(%s)\n",rt->name.data()); 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()); diff --git a/src/tagreader.cpp b/src/tagreader.cpp index 0a7c8f1..786c851 100644 --- a/src/tagreader.cpp +++ b/src/tagreader.cpp @@ -949,16 +949,16 @@ void TagFileParser::dump() msg(" filename '%s'\n",cd->filename.data()); for (const BaseInfo &bi : cd->bases) { - msg( " base: %s \n", bi.name.data() ); + msg( " base: %s \n", bi.name.isEmpty() ? "" : bi.name.data() ); } 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",md.kind.c_str()); + msg(" name: '%s'\n",md.name.c_str()); + msg(" anchor: '%s'\n",md.anchor.c_str()); + msg(" arglist: '%s'\n",md.arglist.c_str()); } } } diff --git a/src/template.cpp b/src/template.cpp index e96b16a..5ae5881 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -119,7 +119,7 @@ static QCString removeSpacesAroundEquals(const char *s) } *q++=c; } - if (q(q-result.data())+1); return result; } @@ -1664,7 +1664,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; } @@ -1694,7 +1694,7 @@ using TemplateTokenStream = std::deque< TemplateTokenPtr >; class TemplateNodeList : public std::vector< std::unique_ptr > { public: - void render(std::ostream &ts,TemplateContext *c) + void render(TextStream &ts,TemplateContext *c) { TRACE(("{TemplateNodeList::render\n")); for (const auto &tn : *this) @@ -2282,7 +2282,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; } @@ -2651,7 +2651,7 @@ 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(c); if (ci==0) return; // should not happen @@ -2705,7 +2705,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(c); if (ci==0) return; // should not happen @@ -2867,7 +2867,7 @@ class TemplateNodeIf : public TemplateNodeCreator { } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -2930,7 +2930,7 @@ class TemplateNodeRepeat : public TemplateNodeCreator { delete m_expr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3042,7 +3042,7 @@ class TemplateNodeRange : public TemplateNodeCreator delete m_endExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3200,7 +3200,7 @@ class TemplateNodeFor : public TemplateNodeCreator delete m_expr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3302,7 +3302,7 @@ class TemplateNodeMsg : public TemplateNodeCreator parser->removeNextToken(); // skip over endmsg TRACE(("}TemplateNodeMsg()\n")); } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3311,7 +3311,9 @@ class TemplateNodeMsg : public TemplateNodeCreator 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); @@ -3342,7 +3344,7 @@ class TemplateNodeBlock : public TemplateNodeCreator TRACE(("}TemplateNodeBlock(%s)\n",data.data())); } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3355,7 +3357,7 @@ class TemplateNodeBlock : public TemplateNodeCreator 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 @@ -3423,7 +3425,7 @@ class TemplateNodeExtend : public TemplateNodeCreator delete m_extendExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3500,7 +3502,7 @@ class TemplateNodeInclude : public TemplateNodeCreator { delete m_includeExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3597,7 +3599,7 @@ class TemplateNodeCreate : public TemplateNodeCreator delete m_templateExpr; delete m_fileExpr; } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -3636,12 +3638,13 @@ class TemplateNodeCreate : public TemplateNodeCreator 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()) + 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); @@ -3714,7 +3717,7 @@ class TemplateNodeTree : public TemplateNodeCreator TemplateContext *c = ctx->templateCtx; TemplateContextImpl* ci = dynamic_cast(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(); @@ -3758,7 +3761,7 @@ class TemplateNodeTree : public TemplateNodeCreator 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(c); @@ -3830,7 +3833,7 @@ class TemplateNodeIndexEntry : public TemplateNodeCreator(c); if (ci==0) return; // should not happen @@ -3872,7 +3875,7 @@ class TemplateNodeOpenSubIndex : public TemplateNodeCreator(c); if (ci==0) return; // should not happen @@ -3908,7 +3911,7 @@ class TemplateNodeCloseSubIndex : public TemplateNodeCreator(c); if (ci==0) return; // should not happen @@ -3969,7 +3972,7 @@ class TemplateNodeWith : public TemplateNodeCreator ~TemplateNodeWith() { } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -4017,7 +4020,7 @@ class TemplateNodeCycle : public TemplateNodeCreator } TRACE(("}TemplateNodeCycle(%s)\n",data.data())); } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); ci->setLocation(m_templateName,m_line); @@ -4091,7 +4094,7 @@ class TemplateNodeSet : public TemplateNodeCreator ~TemplateNodeSet() { } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -4121,7 +4124,7 @@ class TemplateNodeSpaceless : public TemplateNodeCreator 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(c); if (ci==0) return; // should not happen @@ -4168,7 +4171,7 @@ class TemplateNodeMarkers : public TemplateNodeCreator delete m_listExpr; delete m_patternExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -4270,7 +4273,7 @@ class TemplateNodeTabbing : public TemplateNodeCreator 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(c); if (ci==0) return; // should not happen @@ -4319,7 +4322,7 @@ class TemplateNodeResource : public TemplateNodeCreator delete m_resExpr; delete m_asExpr; } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -4387,7 +4390,7 @@ class TemplateNodeEncoding : public TemplateNodeCreator { delete m_encExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen @@ -4950,7 +4953,7 @@ TemplateImpl::~TemplateImpl() //printf("deleting template %s\n",m_name.data()); } -void TemplateImpl::render(std::ostream &ts, TemplateContext *c) +void TemplateImpl::render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast(c); if (ci==0) return; // should not happen diff --git a/src/template.h b/src/template.h index 875a039..879231e 100644 --- a/src/template.h +++ b/src/template.h @@ -17,13 +17,13 @@ #define TEMPLATE_H #include -#include #include "qcstring.h" class TemplateListIntf; class TemplateStructIntf; class TemplateEngine; +class TextStream; /** @defgroup template_api Template API * @@ -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; }; //------------------------------------------------------------------------ diff --git a/src/textdocvisitor.h b/src/textdocvisitor.h index 6a4e08c..ef08721 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 @@ -135,7 +136,7 @@ class TextDocVisitor : public DocVisitor void filter(const char *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..37525ef --- /dev/null +++ b/src/textstream.h @@ -0,0 +1,232 @@ +/****************************************************************************** + * + * 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 +#include +#include +#include +#include +#include + +#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(); } + + /** 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; + } + + /** Returns the attached std::ostream object. + * @see setStream() + */ + std::ostream *stream() const + { + return m_s; + } + + /** Adds a character to the stream */ + TextStream &operator<<( char c) + { + m_buffer+=c; + return static_cast(*this); + } + + /** Adds a C-style string to the stream */ + TextStream &operator<<( const char *s) + { + if (s) m_buffer+=s; + return static_cast(*this); + } + + /** Adds a QCString to the stream */ + TextStream &operator<<( const QCString &s ) + { + m_buffer+=s.str(); + return static_cast(*this); + } + + /** Adds a std::string to the stream */ + TextStream &operator<<( const std::string &s ) + { + m_buffer+=s; + return static_cast(*this); + } + + /** Adds a signed short integer to the stream */ + TextStream &operator<<( signed short i) + { + output_int32(i,i<0); + return static_cast(*this); + } + + /** Adds a unsigned short integer to the stream */ + TextStream &operator<<( unsigned short i) + { + output_int32(i,false); + return static_cast(*this); + } + + /** Adds a signed integer to the stream */ + TextStream &operator<<( signed int i) + { + output_int32(i,i<0); + return static_cast(*this); + } + + /** Adds a unsigned integer to the stream */ + TextStream &operator<<( unsigned int i) + { + output_int32(i,false); + return static_cast(*this); + } + + /** Adds a float to the stream */ + TextStream &operator<<( float f) + { + output_double((double)f); + return static_cast(*this); + } + + /** Adds a double to the stream */ + TextStream &operator<<( double d) + { + output_double(d); + return static_cast(*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()); + } + 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; +}; + +#endif diff --git a/src/utf8.cpp b/src/utf8.cpp index ea7ee34..651c021 100644 --- a/src/utf8.cpp +++ b/src/utf8.cpp @@ -17,6 +17,7 @@ #include "utf8.h" #include "caseconvert.h" +#include "textstream.h" int getUTF8CharNumBytes(char c) { @@ -64,7 +65,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) { @@ -130,7 +131,7 @@ 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); } @@ -139,7 +140,7 @@ static inline std::string caseConvert(const std::string &input, { uint32_t code; std::ostringstream result(std::ios_base::ate); - size_t len; + int len; size_t bytesLeft = input.length(); const char *p = input.c_str(); while ((code=convertUTF8CharToUnicode(p,bytesLeft,len))) @@ -169,7 +170,7 @@ std::string convertUTF8ToUpper(const std::string &input) return caseConvert(input,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); @@ -193,7 +194,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 diff --git a/src/utf8.h b/src/utf8.h index c4c8aad..538230d 100644 --- a/src/utf8.h +++ b/src/utf8.h @@ -18,7 +18,8 @@ #include #include -#include + +class TextStream; /** @file * @brief Various UTF8 related helper functions. @@ -55,7 +56,7 @@ int 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..930abe4 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -72,6 +71,7 @@ #include "fileinfo.h" #include "dir.h" #include "utf8.h" +#include "textstream.h" #define ENABLE_TRACINGSUPPORT 0 @@ -4233,10 +4233,9 @@ 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(); } @@ -4973,7 +4972,7 @@ void addGroupListToTitle(OutputList &ol,const Definition *d) recursivelyAddGroupListToTitle(ol,d,TRUE); } -void filterLatexString(std::ostream &t,const char *str, +void filterLatexString(TextStream &t,const char *str, bool insideTabbing,bool insidePre,bool insideItem,bool insideTable,bool keepSpaces) { if (str==0) return; @@ -5129,7 +5128,7 @@ QCString latexEscapeLabelName(const char *s) { if (s==0) return ""; QCString tmp(qstrlen(s)+1); - std::ostringstream t(std::ios_base::ate); + TextStream t; const char *p=s; char c; int i; @@ -5172,7 +5171,7 @@ QCString latexEscapeIndexChars(const char *s) { if (s==0) return ""; QCString tmp(qstrlen(s)+1); - std::ostringstream t(std::ios_base::ate); + TextStream t; const char *p=s; char c; int i; @@ -5746,7 +5745,7 @@ QCString parseCommentAsText(const Definition *scope,const MemberDef *md, { if (doc.isEmpty()) return ""; //printf("parseCommentAsText(%s)\n",doc.data()); - std::ostringstream t(std::ios_base::ate); + TextStream t; DocNode *root = validatingParseDoc(fileName,lineNr, (Definition*)scope,(MemberDef*)md,doc,FALSE,FALSE, 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); @@ -6712,7 +6711,7 @@ void stripIndentation(QCString &doc,const int indentationLevel) break; } } - doc.resize(dst-doc.data()+1); + doc.resize(static_cast(dst-doc.data())+1); } @@ -7131,7 +7130,7 @@ bool openOutputFile(const char *outFile,std::ofstream &f) return fileOpened; } -void writeExtraLatexPackages(std::ostream &t) +void writeExtraLatexPackages(TextStream &t) { // User-specified packages const StringVector &extraPackages = Config_getList(EXTRA_PACKAGES); @@ -7149,7 +7148,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; diff --git a/src/util.h b/src/util.h index 1811447..4d27a4c 100644 --- a/src/util.h +++ b/src/util.h @@ -313,7 +313,7 @@ QCString unescapeCharsInString(const char *s); void addGroupListToTitle(OutputList &ol,const Definition *d); -void filterLatexString(std::ostream &t,const char *str, +void filterLatexString(TextStream &t,const char *str, bool insideTabbing, bool insidePre, bool insideItem, @@ -391,7 +391,6 @@ 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 replaceFunc); @@ -439,8 +438,8 @@ void convertProtectionLevel( bool mainPageHasTitle(); bool openOutputFile(const char *outFile,std::ofstream &f); -void writeExtraLatexPackages(std::ostream &t); -void writeLatexSpecialFormulaChars(std::ostream &t); +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); diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 47b406d..78fef92 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -61,6 +61,7 @@ #include "VhdlParser.h" #include "regex.h" #include "plantuml.h" +#include "textstream.h" //#define DEBUGFLOW #define theTranslator_vhdlType theTranslator->trVhdlType @@ -71,15 +72,15 @@ static void addInstance(ClassDefMutable* entity, ClassDefMutable* arch, ClassDef //---------- 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 getPorts(const ClassDef *cd); -static void writeVhdlEntityToolTip(std::ostream& t,ClassDef *cd); -static void endDot(std::ostream &t); -static void writeTable(const std::vector &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 &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,7 +96,7 @@ void VhdlDocGen::setFlowMember( const MemberDef* mem) //-------------------------------------------------------------------------------------------------- -static void codify(std::ostream &t,const char *str) +static void codify(TextStream &t,const char *str) { if (str) { @@ -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()); return; } + TextStream t(&f); startDot(t); @@ -230,13 +232,14 @@ void VhdlDocGen::writeOverview() 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=<\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; @@ -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 << "
    >\n"; t << "] \n"; } -static void writeClassToDot(std::ostream &t,ClassDef* cd) +static void writeClassToDot(TextStream &t,ClassDef* cd) { t << " 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 &portList,std::ostream & t) +static void writeTable(const std::vector &portList,TextStream & t) { std::vector inPorts; std::vector outPorts; @@ -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 << " 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 << "\n"; } -XmlDocVisitor::XmlDocVisitor(std::ostream &t,CodeOutputInterface &ci,const char *langExt) +XmlDocVisitor::XmlDocVisitor(TextStream &t,CodeOutputInterface &ci,const char *langExt) : DocVisitor(DocVisitor_XML), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_langExt(langExt) { diff --git a/src/xmldocvisitor.h b/src/xmldocvisitor.h index 0309a5e..835819d 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 char *langExt); //-------------------------------------- // visitor functions for leaf nodes @@ -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 9f74b69..fa661a9 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -15,6 +15,7 @@ #include +#include "textstream.h" #include "xmlgen.h" #include "doxygen.h" #include "message.h" @@ -106,12 +107,12 @@ static const char *xmlSectionMapper(MemberListType ml) } -inline void writeXMLString(std::ostream &t,const char *s) +inline void writeXMLString(TextStream &t,const char *s) { t << convertToXML(s); } -inline void writeXMLCodeString(std::ostream &t,const char *s, int &col) +inline void writeXMLCodeString(TextStream &t,const char *s, int &col) { char c; while ((c=*s++)) @@ -145,7 +146,7 @@ inline void writeXMLCodeString(std::ostream &t,const char *s, int &col) } -static void writeXMLHeader(std::ostream &t) +static void writeXMLHeader(TextStream &t) { t << "\n";; t << "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); } -static void writeXMLDocBlock(std::ostream &t, +static void writeXMLDocBlock(TextStream &t, const QCString &fileName, int lineNr, const Definition *scope, @@ -425,7 +426,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()); @@ -450,7 +451,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 char *tagName) { QCString scope = rmd->getScopeString(); QCString name = rmd->name(); @@ -507,7 +508,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 @@ -1036,7 +1037,7 @@ static bool memberVisible(const Definition *d,const MemberDef *md) md->getNamespaceDef()==0; } -static void generateXMLSection(const Definition *d,std::ostream &ti,std::ostream &t, +static void generateXMLSection(const Definition *d,TextStream &ti,TextStream &t, const MemberList *ml,const char *kind,const char *header=0, const char *documentation=0) { @@ -1073,7 +1074,7 @@ static void generateXMLSection(const Definition *d,std::ostream &ti,std::ostream t << " \n"; } -static void writeListOfAllMembers(const ClassDef *cd,std::ostream &t) +static void writeListOfAllMembers(const ClassDef *cd,TextStream &t) { t << " \n"; for (auto &mni : cd->memberNameInfoLinkedMap()) @@ -1114,7 +1115,7 @@ static void writeListOfAllMembers(const ClassDef *cd,std::ostream &t) t << " \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 +1135,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 +1148,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 +1157,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 +1170,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 +1180,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 +1192,7 @@ static void writeInnerDirs(const DirList *dl,std::ostream &t) } } -static void generateXMLForClass(const ClassDef *cd,std::ostream &ti) +static void generateXMLForClass(const ClassDef *cd,TextStream &ti) { // + brief description // + detailed description @@ -1223,12 +1224,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()); return; } + TextStream t(&f); writeXMLHeader(t); t << " \n"; } -static void generateXMLForNamespace(const NamespaceDef *nd,std::ostream &ti) +static void generateXMLForNamespace(const NamespaceDef *nd,TextStream &ti) { // + contained class definitions // + contained namespace definitions @@ -1404,12 +1406,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()); return; } + TextStream t(&f); writeXMLHeader(t); t << " getOutputFileBase() @@ -1454,7 +1457,7 @@ static void generateXMLForNamespace(const NamespaceDef *nd,std::ostream &ti) ti << "
    \n"; } -static void generateXMLForFile(FileDef *fd,std::ostream &ti) +static void generateXMLForFile(FileDef *fd,TextStream &ti) { // + includes files // + includedby files @@ -1478,12 +1481,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()); return; } + TextStream t(&f); writeXMLHeader(t); t << " getOutputFileBase() @@ -1567,7 +1571,7 @@ static void generateXMLForFile(FileDef *fd,std::ostream &ti) ti << " \n"; } -static void generateXMLForGroup(const GroupDef *gd,std::ostream &ti) +static void generateXMLForGroup(const GroupDef *gd,TextStream &ti) { // + members // + member groups @@ -1588,12 +1592,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()); return; } + TextStream t(&f); writeXMLHeader(t); t << " \n"; } -static void generateXMLForDir(DirDef *dd,std::ostream &ti) +static void generateXMLForDir(DirDef *dd,TextStream &ti) { if (dd->isReference()) return; // skip external references ti << " getOutputFileBase() @@ -1642,12 +1647,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()); return; } + TextStream t(&f); writeXMLHeader(t); t << " \n"; } -static void generateXMLForPage(PageDef *pd,std::ostream &ti,bool isExample) +static void generateXMLForPage(PageDef *pd,TextStream &ti,bool isExample) { // + name // + title @@ -1694,12 +1700,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()); return; } + TextStream t(&f); writeXMLHeader(t); t << " 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("")!=-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(endLine-startLine); + if (len>0) { - HtmlEntityMapper::instance()->writeXMLSchema(t); - } - else - { - t.write(startLine,len); + QCString s(len+1); + qstrncpy(s.rawData(),startLine,len); + s[len]='\0'; + if (s.find("")!=-1) + { + HtmlEntityMapper::instance()->writeXMLSchema(t); + } + else + { + t.write(startLine,len); + } } + startLine=endLine; } - startLine=endLine; } - t.close(); + 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()); return; } - //t.setEncoding(std::ostream::UnicodeUTF8); + else + { + TextStream t(&f); - // write index header - t << "\n";; - t << "trISOLang() << "\""; - t << ">\n"; + // write index header + t << "\n";; + t << "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 &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) + { + msg("Generating XML output for file %s\n",fd->name().data()); + generateXMLForFile(fd.get(),t); + } + } + 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); } - } - 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 << " \n"; - t << "\n"; + //t << " \n"; + t << "\n"; + } writeCombineScript(); } diff --git a/src/xmlgen.h b/src/xmlgen.h index 58f9a64..01914a6 100644 --- a/src/xmlgen.h +++ b/src/xmlgen.h @@ -15,11 +15,13 @@ #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() { } @@ -45,7 +47,7 @@ class XMLCodeGenerator : public CodeOutputInterface void finish(); private: - std::ostream &m_t; + TextStream &m_t; QCString m_refId; QCString m_external; int m_lineNumber; -- cgit v0.12