diff options
Diffstat (limited to 'src')
111 files changed, 2998 insertions, 2647 deletions
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<ClassDefMutable> virtual void addGroupedInheritedMembers(OutputList &ol,MemberListType lt, const ClassDef *inheritedFrom,const QCString &inheritId) const; - virtual void writeTagFile(std::ostream &); + virtual void writeTagFile(TextStream &); virtual int countMembersIncludingGrouped(MemberListType lt,const ClassDef *inheritedFrom,bool additional) const; virtual int countInheritanceNodes() const; @@ -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 << " <compound kind=\""; diff --git a/src/classdef.h b/src/classdef.h index b1582be..4e29a2e 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -448,7 +448,7 @@ class ClassDefMutable : public DefinitionMutable, public ClassDef virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *md) const = 0; virtual void writeSummaryLinks(OutputList &ol) const = 0; virtual void writeInlineDocumentation(OutputList &ol) const = 0; - virtual void writeTagFile(std::ostream &) = 0; + virtual void writeTagFile(TextStream &) = 0; virtual void writeMemberDeclarations(OutputList &ol,ClassDefSet &visitedClasses, MemberListType lt,const QCString &title, const char *subTitle=0,bool showInline=FALSE,const ClassDef *inheritedFrom=0, @@ -75,11 +75,10 @@ // context for an Objective-C method call struct ObjCCallCtx { - ObjCCallCtx() : comment(std::ios_base::ate) {} int id; QCString methodName; QCString objectTypeOrName; - std::ostringstream comment; + TextStream comment; const ClassDef *objectType; const MemberDef *objectVar; const MemberDef *method; diff --git a/src/config.h b/src/config.h index f3fd278..2886a0a 100644 --- a/src/config.h +++ b/src/config.h @@ -16,8 +16,6 @@ #ifndef CONFIG_H #define CONFIG_H -#include <ostream> - // note: this header file is generated from config.xml #include "configvalues.h" @@ -44,6 +42,8 @@ //#endif //! @} +class TextStream; + /** \brief Public function to deal with the configuration file. */ namespace Config { @@ -54,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<QCString> &values() const { return m_valueRange; } QCString *valueRef() { return &m_value; } void substEnvVars(); - void writeTemplate(std::ostream &t,bool sl,bool); + void writeTemplate(TextStream &t,bool sl,bool); void convertStrToVal(); - void compareDoxyfile(std::ostream &t); + void 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<uint>(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<ClassContext::Private> } TemplateVariant inheritanceDiagram() const { - std::ostringstream t(std::ios_base::ate); + TextStream t; static bool haveDot = Config_getBool(HAVE_DOT); static bool classDiagrams = Config_getBool(CLASS_DIAGRAMS); static bool classGraph = Config_getBool(CLASS_GRAPH); @@ -1990,13 +1987,13 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { case ContextOutputFormat_Html: { - std::ostringstream tt(std::ios_base::ate); + TextStream tt; QCString name = convertToHtml(m_classDef->displayName()); d.writeImage(tt,g_globals.outputDir, relPathAsString(), m_classDef->getOutputFileBase()); - if (tt.tellp()>0) + if (!tt.empty()) { t << "<div class=\"center\">\n"; t << " <img src=\""; @@ -2029,8 +2026,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } DotClassGraph *getCollaborationGraph() const { @@ -2049,7 +2045,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> TemplateVariant collaborationDiagram() const { static bool haveDot = Config_getBool(HAVE_DOT); - std::ostringstream t(std::ios_base::ate); + TextStream t; if (haveDot) { DotClassGraph *cg = getCollaborationGraph(); @@ -2080,8 +2076,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } TemplateVariant includeInfo() const @@ -3054,7 +3049,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> TemplateVariant includeGraph() const { static bool haveDot = Config_getBool(HAVE_DOT); - std::ostringstream t(std::ios_base::ate); + TextStream t; if (haveDot) { DotInclDepGraph *cg = getIncludeGraph(); @@ -3085,8 +3080,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } DotInclDepGraph *getIncludedByGraph() const { @@ -3106,7 +3100,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> TemplateVariant includedByGraph() const { static bool haveDot = Config_getBool(HAVE_DOT); - std::ostringstream t(std::ios_base::ate); + TextStream t; if (haveDot) { DotInclDepGraph *cg = getIncludedByGraph(); @@ -3137,8 +3131,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } TemplateVariant hasDetails() const { @@ -3512,7 +3505,7 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> } TemplateVariant dirGraph() const { - std::ostringstream t(std::ios_base::ate); + TextStream t; static bool haveDot = Config_getBool(HAVE_DOT); static bool dirGraph = Config_getBool(DIRECTORY_GRAPH); if (haveDot && dirGraph) @@ -3551,8 +3544,7 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } private: @@ -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<MemberContext::Private> if (hasCallGraph().toBool()) { DotCallGraph *cg = getCallGraph(); - std::ostringstream t(std::ios_base::ate); + TextStream t; switch (g_globals.outputFormat) { case ContextOutputFormat_Html: @@ -4964,8 +4956,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> break; } g_globals.dynSectionId++; - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } else { @@ -5009,7 +5000,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> if (hasCallerGraph().toBool()) { DotCallGraph *cg = getCallerGraph(); - std::ostringstream t(std::ios_base::ate); + TextStream t; switch (g_globals.outputFormat) { case ContextOutputFormat_Html: @@ -5036,8 +5027,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> break; } g_globals.dynSectionId++; - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } else { @@ -5273,7 +5263,7 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } TemplateVariant groupGraph() const { - std::ostringstream t(std::ios_base::ate); + TextStream t; static bool haveDot = Config_getBool(HAVE_DOT); static bool groupGraphs = Config_getBool(GROUP_GRAPHS); if (haveDot && groupGraphs) @@ -5310,8 +5300,7 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } g_globals.dynSectionId++; } - QCString result = t.str(); - return TemplateVariant(result.data(),TRUE); + return TemplateVariant(t.str().c_str(),TRUE); } TemplateVariant hasDetails() const { @@ -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 <vector> -#include <iostream> #include "types.h" #include "reflist.h" @@ -40,6 +39,7 @@ class SectionInfo; class Definition; class DefinitionMutable; class DefinitionImpl; +class TextStream; /** Data associated with a detailed description. */ struct DocInfo @@ -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 <memory> -#include <iostream> 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<DirDef> virtual QCString shortTitle() const; virtual bool hasDetailedDescription() const; virtual void writeDocumentation(OutputList &ol); - virtual void writeTagFile(std::ostream &t); + virtual void writeTagFile(TextStream &t); virtual void setDiskName(const QCString &name) { m_diskName = name; } virtual void sort(); virtual void setParent(DirDef *parent); @@ -457,7 +457,7 @@ bool DirDefImpl::hasDetailedDescription() const return (!briefDescription().isEmpty() && repeatBrief) || !documentation().isEmpty(); } -void DirDefImpl::writeTagFile(std::ostream &tagFile) +void DirDefImpl::writeTagFile(TextStream &tagFile) { tagFile << " <compound kind=\"dir\">\n"; tagFile << " <name>" << convertToXML(displayName()) << "</name>\n"; 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 << "<indexterm><primary>"; t << convertToDocBook(prim); @@ -129,7 +129,7 @@ static void addIndexTerm(std::ostream &t, QCString prim, QCString sec = "") } t << "</indexterm>\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 << "<link linkend=\"_" << stripPath(compoundId); @@ -140,7 +140,7 @@ void writeDocbookLink(std::ostream &t,const char * /*extRef*/,const char *compou t << "</link>"; } -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 << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";; - t << "<" << fileType << " xmlns=\"http://docbook.org/ns/docbook\" version=\"5.0\" xmlns:xlink=\"http://www.w3.org/1999/xlink\""; - if (!pageName.isEmpty()) t << " xml:id=\"_" << stripPath(pageName) << "\""; - t << " xml:lang=\"" << theTranslator->trISOLang() << "\""; - t << ">\n"; + m_t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";; + m_t << "<" << fileType << " xmlns=\"http://docbook.org/ns/docbook\" version=\"5.0\" xmlns:xlink=\"http://www.w3.org/1999/xlink\""; + if (!pageName.isEmpty()) m_t << " xml:id=\"_" << stripPath(pageName) << "\""; + m_t << " xml:lang=\"" << theTranslator->trISOLang() << "\""; + m_t << ">\n"; } void DocbookGenerator::endFile() { DB_GEN_C - if (m_inDetail) t << "</section>\n"; + if (m_inDetail) m_t << "</section>\n"; m_inDetail = FALSE; while (m_inLevel != -1) { - t << "</section>\n"; + m_t << "</section>\n"; m_inLevel--; } - if (m_inGroup) t << "</section>\n"; + if (m_inGroup) m_t << "</section>\n"; m_inGroup = FALSE; QCString fileType="section"; @@ -358,7 +358,7 @@ DB_GEN_C { fileType="chapter"; } - t << "</" << fileType << ">\n"; + m_t << "</" << fileType << ">\n"; endPlainFile(); m_codeGen.setSourceFileName(""); } @@ -371,16 +371,16 @@ DB_GEN_C2("IndexSections " << is) case isTitlePageStart: { QCString dbk_projectName = Config_getString(PROJECT_NAME); - t << " <info>\n"; - t << " <title>" << convertToDocBook(dbk_projectName) << "</title>\n"; - t << " </info>\n"; + m_t << " <info>\n"; + m_t << " <title>" << convertToDocBook(dbk_projectName) << "</title>\n"; + m_t << " </info>\n"; } break; case isTitlePageAuthor: break; case isMainPage: - t << "<chapter>\n"; - t << " <title>"; + m_t << "<chapter>\n"; + m_t << " <title>"; break; case isModuleIndex: //Module Index}\n" @@ -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 << "</title>\n"; - t << " <xi:include href=\"mainpage.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; - t << "</chapter>\n"; + m_t << "</title>\n"; + m_t << " <xi:include href=\"mainpage.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << "</chapter>\n"; break; case isModuleIndex: - //t << "</chapter>\n"; + //m_t << "</chapter>\n"; break; case isDirIndex: - //t << "<xi:include href=\"dirs.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; - //t << "</chapter>\n"; + //m_t << "<xi:include href=\"dirs.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; + //m_t << "</chapter>\n"; break; case isNamespaceIndex: - //t << "<xi:include href=\"namespaces.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; - //t << "</chapter>\n"; + //m_t << "<xi:include href=\"namespaces.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; + //m_t << "</chapter>\n"; break; case isClassHierarchyIndex: - //t << "<xi:include href=\"hierarchy.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; - //t << "</chapter>\n"; + //m_t << "<xi:include href=\"hierarchy.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; + //m_t << "</chapter>\n"; break; case isCompoundIndex: - //t << "</chapter>\n"; + //m_t << "</chapter>\n"; break; case isFileIndex: - //t << "<xi:include href=\"files.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; - //t << "</chapter>\n"; + //m_t << "<xi:include href=\"files.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; + //m_t << "</chapter>\n"; break; case isPageIndex: - //t << "<xi:include href=\"pages.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; - //t << "</chapter>\n"; + //m_t << "<xi:include href=\"pages.xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>"; + //m_t << "</chapter>\n"; break; case isModuleDocumentation: { - t << "</title>\n"; + m_t << "</title>\n"; for (const auto &gd : *Doxygen::groupLinkedMap) { if (!gd->isReference()) { - t << " <xi:include href=\"" << gd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << gd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } - t << "</chapter>\n"; + m_t << "</chapter>\n"; break; case isDirDocumentation: { - t << "</title>\n"; + m_t << "</title>\n"; for (const auto &dd : *Doxygen::dirLinkedMap) { if (dd->isLinkableInProject()) { - t << "< xi:include href=\"" << dd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << "< xi:include href=\"" << dd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } - t << "</chapter>\n"; + m_t << "</chapter>\n"; break; case isNamespaceDocumentation: { - t << "</title>\n"; + m_t << "</title>\n"; for (const auto &nd : *Doxygen::namespaceLinkedMap) { if (nd->isLinkableInProject() && !nd->isAlias()) { - t << "<xi:include href=\"" << nd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << "<xi:include href=\"" << nd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } - t << "</chapter>\n"; + m_t << "</chapter>\n"; break; case isClassDocumentation: { - t << "</title>\n"; + m_t << "</title>\n"; for (const auto &cd : *Doxygen::classLinkedMap) { if (cd->isLinkableInProject() && @@ -527,15 +527,15 @@ DB_GEN_C2("IndexSections " << is) !cd->isAlias() ) { - t << " <xi:include href=\"" << cd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << cd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } - t << "</chapter>\n"; + m_t << "</chapter>\n"; break; case isFileDocumentation: { - t << "</title>\n"; + m_t << "</title>\n"; bool isFirst=TRUE; for (const auto &fn : *Doxygen::inputNameLinkedMap) { @@ -545,43 +545,43 @@ DB_GEN_C2("IndexSections " << is) { if (isFirst) { - t << " <xi:include href=\"" << fd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << fd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; if (sourceBrowser && m_prettyCode && fd->generateSourceFile()) { - t << " <xi:include href=\"" << fd->getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << fd->getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } isFirst=FALSE; } else { - t << " <xi:include href=\"" << fd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << fd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; if (sourceBrowser && m_prettyCode && fd->generateSourceFile()) { - t << " <xi:include href=\"" << fd->getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << fd->getSourceFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } } } } } - t << "</chapter>\n"; + m_t << "</chapter>\n"; break; case isExampleDocumentation: { - t << "</title>\n"; + m_t << "</title>\n"; for (const auto &pd : *Doxygen::exampleLinkedMap) { - t << " <xi:include href=\"" << pd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << " <xi:include href=\"" << pd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; } } - t << "</chapter>\n"; + m_t << "</chapter>\n"; break; case isPageDocumentation: break; case isPageDocumentation2: break; case isEndIndex: - t << "<index/>\n"; + m_t << "<index/>\n"; break; } } @@ -592,17 +592,17 @@ DB_GEN_C { if (!pd->getGroupDef() && !pd->isReference() && pd->name() == stripPath(name)) { - t << "<chapter>\n"; + m_t << "<chapter>\n"; if (pd->hasTitle()) { - t << " <title>" << convertToDocBook(pd->title()) << "</title>\n"; + m_t << " <title>" << convertToDocBook(pd->title()) << "</title>\n"; } else { - t << " <title>" << convertToDocBook(pd->name()) << "</title>\n"; + m_t << " <title>" << convertToDocBook(pd->name()) << "</title>\n"; } - t << " <xi:include href=\"" << pd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; - t << "</chapter>\n"; + m_t << " <xi:include href=\"" << pd->getOutputFileBase() << ".xml\" xmlns:xi=\"http://www.w3.org/2001/XInclude\"/>\n"; + m_t << "</chapter>\n"; } } } @@ -611,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 << "<para>\n"; + m_t << "<para>\n"; } void DocbookGenerator::endParagraph() { DB_GEN_C - t << "</para>\n"; + m_t << "</para>\n"; } void DocbookGenerator::writeString(const char *text) { DB_GEN_C - t << text; + m_t << text; } void DocbookGenerator::startMemberHeader(const char *,int) { DB_GEN_C - t << "<simplesect>\n"; + m_t << "<simplesect>\n"; m_inSimpleSect[m_levelListItem] = TRUE; - t << " <title>"; + m_t << " <title>"; } void DocbookGenerator::endMemberHeader() { DB_GEN_C - t << " </title>\n"; + m_t << " </title>\n"; } void DocbookGenerator::docify(const char *str) { 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 << "<link linkend=\"_" << stripPath(f) << "_1" << anchor << "\">"; - else t << "<link linkend=\"_" << anchor << "\">"; + if (f) m_t << "<link linkend=\"_" << stripPath(f) << "_1" << anchor << "\">"; + else m_t << "<link linkend=\"_" << anchor << "\">"; else - t << "<link linkend=\"_" << stripPath(f) << "\">"; + m_t << "<link linkend=\"_" << stripPath(f) << "\">"; docify(text); - t << "</link>"; + m_t << "</link>"; } void DocbookGenerator::startMemberList() { DB_GEN_C - t << " <itemizedlist>\n"; + m_t << " <itemizedlist>\n"; m_levelListItem++; } void DocbookGenerator::endMemberList() { DB_GEN_C - if (m_inListItem[m_levelListItem]) t << "</listitem>\n"; + if (m_inListItem[m_levelListItem]) m_t << "</listitem>\n"; m_inListItem[m_levelListItem] = FALSE; - t << " </itemizedlist>\n"; + m_t << " </itemizedlist>\n"; m_levelListItem = (m_levelListItem> 0 ? m_levelListItem - 1 : 0); - if (m_inSimpleSect[m_levelListItem]) t << "</simplesect>\n"; + if (m_inSimpleSect[m_levelListItem]) m_t << "</simplesect>\n"; m_inSimpleSect[m_levelListItem] = FALSE; } void DocbookGenerator::startMemberItem(const char *,int,const char *) { DB_GEN_C - if (m_inListItem[m_levelListItem]) t << "</listitem>\n"; - t << " <listitem><para>"; + if (m_inListItem[m_levelListItem]) m_t << "</listitem>\n"; + m_t << " <listitem><para>"; m_inListItem[m_levelListItem] = TRUE; } void DocbookGenerator::endMemberItem() { DB_GEN_C - t << "</para>\n"; + m_t << "</para>\n"; } void DocbookGenerator::startBold() { DB_GEN_C - t << "<emphasis role=\"strong\">"; + m_t << "<emphasis role=\"strong\">"; } void DocbookGenerator::endBold() { DB_GEN_C - t << "</emphasis>"; + m_t << "</emphasis>"; } void DocbookGenerator::startGroupHeader(int extraIndentLevel) { DB_GEN_C2("m_inLevel " << m_inLevel) DB_GEN_C2("extraIndentLevel " << extraIndentLevel) m_firstMember = TRUE; - if (m_inSimpleSect[m_levelListItem]) t << "</simplesect>\n"; + if (m_inSimpleSect[m_levelListItem]) m_t << "</simplesect>\n"; m_inSimpleSect[m_levelListItem] = FALSE; if (m_inLevel != -1) m_inGroup = TRUE; - if (m_inLevel == extraIndentLevel) t << "</section>\n"; + if (m_inLevel == extraIndentLevel) m_t << "</section>\n"; m_inLevel = extraIndentLevel; - t << "<section>\n"; - t << "<title>"; + m_t << "<section>\n"; + m_t << "<title>"; } void DocbookGenerator::writeRuler() { DB_GEN_C2("m_inLevel " << m_inLevel) DB_GEN_C2("m_inGroup " << m_inGroup) - if (m_inGroup) t << "</section>\n"; + if (m_inGroup) m_t << "</section>\n"; m_inGroup = FALSE; } void DocbookGenerator::endGroupHeader(int) { DB_GEN_C - t << "</title>\n"; + m_t << "</title>\n"; } void DocbookGenerator::startParameterList(bool openBracket) { DB_GEN_C - if (openBracket) t << "("; + if (openBracket) m_t << "("; } void DocbookGenerator::endParameterList() { @@ -739,22 +739,22 @@ DB_GEN_C void DocbookGenerator::writeNonBreakableSpace(int n) { DB_GEN_C - for (int i=0;i<n;i++) t << " "; + for (int i=0;i<n;i++) m_t << " "; } void DocbookGenerator::lineBreak(const char *) { DB_GEN_C - t << "\n"; + m_t << "\n"; } void DocbookGenerator::startTypewriter() { DB_GEN_C - if (!m_denseText) t << "<computeroutput>"; + if (!m_denseText) m_t << "<computeroutput>"; } void DocbookGenerator::endTypewriter() { DB_GEN_C - if (!m_denseText) t << "</computeroutput>\n"; + if (!m_denseText) m_t << "</computeroutput>\n"; } void DocbookGenerator::startTextBlock(bool dense) { @@ -762,7 +762,7 @@ DB_GEN_C if (dense) { m_denseText = TRUE; - t << "<programlisting>"; + m_t << "<programlisting>"; } } void DocbookGenerator::endTextBlock(bool) @@ -771,41 +771,41 @@ DB_GEN_C if (m_denseText) { m_denseText = FALSE; - t << "</programlisting>"; + m_t << "</programlisting>"; } } void DocbookGenerator::startMemberDoc(const char *clname, const char *memname, const char *, const char *title, int memCount, int memTotal, bool) { DB_GEN_C2("m_inLevel " << m_inLevel) - t << " <section>\n"; - t << " <title>" << convertToDocBook(title); + m_t << " <section>\n"; + m_t << " <title>" << convertToDocBook(title); if (memTotal>1) { - t << "<computeroutput>[" << memCount << "/" << memTotal << "]</computeroutput>"; + m_t << "<computeroutput>[" << memCount << "/" << memTotal << "]</computeroutput>"; } - t << "</title>\n"; + m_t << "</title>\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 << "</computeroutput></para>"; + m_t << "</computeroutput></para>"; } void DocbookGenerator::startTitleHead(const char *) { DB_GEN_C - t << "<title>"; + m_t << "<title>"; } void DocbookGenerator::endTitleHead(const char *,const char *name) { DB_GEN_C - t << "</title>\n"; - if (name) addIndexTerm(t, name); + m_t << "</title>\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 << " </section>"; + if (!m_firstMember) m_t << " </section>"; m_firstMember = FALSE; } if (anchor) { - t << "<anchor xml:id=\"_" << stripPath(fName) << "_1" << anchor << "\"/>"; + m_t << "<anchor xml:id=\"_" << stripPath(fName) << "_1" << anchor << "\"/>"; } } void DocbookGenerator::endDoxyAnchor(const char *,const char *) @@ -829,7 +829,7 @@ DB_GEN_C void DocbookGenerator::startMemberDocName(bool) { DB_GEN_C - t << "<para><computeroutput>"; + m_t << "<para><computeroutput>"; } void DocbookGenerator::endMemberDocName() { @@ -838,12 +838,12 @@ DB_GEN_C void DocbookGenerator::startMemberGroupHeader(bool) { DB_GEN_C - t << "<simplesect><title>"; + m_t << "<simplesect><title>"; } void DocbookGenerator::endMemberGroupHeader() { DB_GEN_C - t << "</title>\n"; + m_t << "</title>\n"; } void DocbookGenerator::startMemberGroup() { @@ -852,27 +852,27 @@ DB_GEN_C void DocbookGenerator::endMemberGroup(bool) { DB_GEN_C - t << "</simplesect>\n"; + m_t << "</simplesect>\n"; } void DocbookGenerator::startClassDiagram() { DB_GEN_C - t << "<para>"; + m_t << "<para>"; } void DocbookGenerator::endClassDiagram(const ClassDiagram &d, const char *fileName,const char *) { DB_GEN_C - t << " <informalfigure>\n"; - t << " <mediaobject>\n"; - t << " <imageobject>\n"; - t << " <imagedata width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" + m_t << " <informalfigure>\n"; + m_t << " <mediaobject>\n"; + m_t << " <imageobject>\n"; + m_t << " <imagedata width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << relPath << fileName << ".png\">" << "</imagedata>\n"; - t << " </imageobject>\n"; - d.writeImage(t,dir(),relPath,fileName,FALSE); - t << " </mediaobject>\n"; - t << " </informalfigure>\n"; - t << "</para>\n"; + m_t << " </imageobject>\n"; + d.writeImage(m_t,dir(),relPath,fileName,FALSE); + m_t << " </mediaobject>\n"; + m_t << " </informalfigure>\n"; + m_t << "</para>\n"; } void DocbookGenerator::startLabels() { @@ -882,8 +882,8 @@ DB_GEN_C void DocbookGenerator::writeLabel(const char *l,bool isLast) { DB_GEN_C - t << "<computeroutput>[" << l << "]</computeroutput>"; - if (!isLast) t << ", "; + m_t << "<computeroutput>[" << l << "]</computeroutput>"; + if (!isLast) m_t << ", "; } void DocbookGenerator::endLabels() @@ -893,25 +893,25 @@ DB_GEN_C void DocbookGenerator::startExamples() { DB_GEN_C - t << "<simplesect><title>"; + m_t << "<simplesect><title>"; docify(theTranslator->trExamples()); - t << "</title>"; + m_t << "</title>"; } void DocbookGenerator::endExamples() { DB_GEN_C - t << "</simplesect>\n"; + m_t << "</simplesect>\n"; } void DocbookGenerator::startSubsubsection() { DB_GEN_C - t << "<simplesect><title>"; + m_t << "<simplesect><title>"; } void DocbookGenerator::endSubsubsection() { DB_GEN_C - t << "</title></simplesect>\n"; + m_t << "</title></simplesect>\n"; } void DocbookGenerator::writeChar(char c) { @@ -924,33 +924,33 @@ DB_GEN_C void DocbookGenerator::startMemberDocPrefixItem() { DB_GEN_C - t << "<computeroutput>"; + m_t << "<computeroutput>"; } void DocbookGenerator::endMemberDocPrefixItem() { DB_GEN_C - t << "</computeroutput>"; + m_t << "</computeroutput>"; } void DocbookGenerator::exceptionEntry(const char* prefix,bool closeBracket) { 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 << "</para>"; - t << "<para>"; + m_t << "</para>"; + m_t << "<para>"; } void DocbookGenerator::startSection(const char *lab,const char *,SectionType) { DB_GEN_C - t << " <section xml:id=\"_" << stripPath(lab) << "\">"; - t << "<title>"; + m_t << " <section xml:id=\"_" << stripPath(lab) << "\">"; + m_t << "<title>"; } void DocbookGenerator::endSection(const char *,SectionType) { DB_GEN_C - t << "</title>"; - t << " </section>"; + m_t << "</title>"; + m_t << " </section>"; } 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 << "<informaltable frame=\"all\">\n"; - if (title)t << "<title>" << convertToDocBook(title) << "</title>\n"; - t << " <tgroup cols=\"" << ncols << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">\n"; + m_t << "<informaltable frame=\"all\">\n"; + if (title)m_t << "<title>" << convertToDocBook(title) << "</title>\n"; + m_t << " <tgroup cols=\"" << ncols << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">\n"; for (int i = 0; i < ncols; i++) { - t << " <colspec colname='c" << i+1 << "'/>\n"; + m_t << " <colspec colname='c" << i+1 << "'/>\n"; } - t << "<tbody>\n"; + m_t << "<tbody>\n"; m_descTable = TRUE; } void DocbookGenerator::endDescTable() { DB_GEN_C - t << " </tbody>\n"; - t << " </tgroup>\n"; - t << "</informaltable>\n"; + m_t << " </tbody>\n"; + m_t << " </tgroup>\n"; + m_t << "</informaltable>\n"; m_descTable = FALSE; } void DocbookGenerator::startDescTableRow() { DB_GEN_C - t << "<row>"; - t << "<entry>"; + m_t << "<row>"; + m_t << "<entry>"; } void DocbookGenerator::endDescTableRow() { DB_GEN_C - t << "</row>"; + m_t << "</row>"; } void DocbookGenerator::startDescTableTitle() @@ -1032,13 +1032,13 @@ DB_GEN_C void DocbookGenerator::startDescTableData() { DB_GEN_C - t << "</entry><entry>"; + m_t << "</entry><entry>"; } void DocbookGenerator::endDescTableData() { DB_GEN_C - t << "</entry>"; + m_t << "</entry>"; } void DocbookGenerator::startGroupCollaboration() { @@ -1047,7 +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 << "<simplesect><title>"; + m_t << "<simplesect><title>"; docify(header); - t << "</title>\n"; + m_t << "</title>\n"; } void DocbookGenerator::startConstraintParam() { DB_GEN_C - t << "<para><emphasis role=\"strong\">"; + m_t << "<para><emphasis role=\"strong\">"; } void DocbookGenerator::endConstraintParam() { @@ -1113,12 +1113,12 @@ DB_GEN_C void DocbookGenerator::startConstraintType() { DB_GEN_C - t << ":"; + m_t << ":"; } void DocbookGenerator::endConstraintType() { DB_GEN_C - t << "</emphasis></para>\n"; + m_t << "</emphasis></para>\n"; } void DocbookGenerator::startConstraintDocs() { @@ -1131,5 +1131,5 @@ DB_GEN_C void DocbookGenerator::endConstraintList() { DB_GEN_C - t << "</simplesect>\n"; + m_t << "</simplesect>\n"; } diff --git a/src/docbookgen.h b/src/docbookgen.h index 1f8b6ef..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<bool> indentStack; std::set<std::string> 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 << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; @@ -165,11 +169,12 @@ void DocSets::initialize() p->indentStack.push(true); QCString tokens = Config_getString(HTML_OUTPUT) + "/Tokens.xml"; - p->tts.open(tokens.str(),std::ofstream::out | std::ofstream::binary); - if (!p->tts.is_open()) + p->ttf.open(tokens.str(),std::ofstream::out | std::ofstream::binary); + if (!p->ttf.is_open()) { term("Could not open file %s for writing\n",tokens.data()); } + p->tts.setStream(&p->ttf); p->tts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; p->tts << "<Tokens version=\"1.0\">\n"; } @@ -185,10 +190,12 @@ void DocSets::finalize() p->nts << " </Node>\n"; p->nts << " </TOC>\n"; p->nts << "</DocSetNodes>\n"; - p->nts.close(); + p->nts.flush(); + p->ntf.close(); p->tts << "</Tokens>\n"; - p->tts.close(); + p->tts.flush(); + p->ttf.close(); } QCString DocSets::Private::indent() @@ -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 <memory> -#include <iostream> #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<length;i++) @@ -498,7 +498,7 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio <St_Para>^{LISTITEM} { /* list item */ lineCount(yytext,yyleng); QCString text=yytext; - int dashPos = text.findRev('-'); + size_t dashPos = static_cast<size_t>(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 <St_Para>{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<size_t>(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;i<g_token->indent;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 << "<img src=\"" << relPath << imgName << "\" alt=\"" << imgName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>\n"; DotFilePatcher::convertMapFile(tt, absOutFile, relPath ,TRUE, context); - if (tt.tellp()>0) + if (!tt.empty()) { t << "<map name=\"" << mapName << "\" id=\"" << mapName << "\">"; t << tt.str(); @@ -25,6 +25,7 @@ class DotRunner; class DotRunnerQueue; +class TextStream; /** Singleton that manages parallel dot invocations and patching files for embedding image maps */ class DotManager @@ -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 <iostream> - #include "classdef.h" #include "dotnode.h" #include "dotgraph.h" +class TextStream; + /** Representation of a class inheritance or dependency graph */ class DotClassGraph : public DotGraph { @@ -31,13 +31,13 @@ public: bool isTrivial() const; bool isTooBig() const; int numNodes() const; - QCString writeGraph(std::ostream &t,GraphOutputFormat gf,EmbeddedOutputFormat ef, + 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<std::string,const DirDef *>; * @param[in] fillBackground if the node shall be explicitly filled * @param[in,out] directoriesInGraph lists the directories which have been written to the output stream */ -static void drawDirectory(std::ostream &outStream, const DirDef *const directory, const bool fillBackground, +static void drawDirectory(TextStream &outStream, const DirDef *const directory, const bool fillBackground, DirDefMap &directoriesInGraph) { outStream << " " << directory->getOutputFileBase() << " [shape=box " @@ -46,7 +46,7 @@ static void drawDirectory(std::ostream &outStream, const DirDef *const directory directoriesInGraph.insert(std::make_pair(directory->getOutputFileBase().str(), directory)); } -void writeDotDirDepGraph(std::ostream &t,const DirDef *dd,bool linkRelations) +void writeDotDirDepGraph(TextStream &t,const DirDef *dd,bool linkRelations) { int fontSize = Config_getInt(DOT_FONTSIZE); QCString fontName = Config_getString(DOT_FONTNAME); @@ -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,"<!-- MAP %d",&mapId); if (n==1 && mapId>=0 && mapId<(int)m_maps.size()) { - std::ostringstream tt(std::ios_base::ate); + TextStream tt; const Map &map = m_maps.at(mapId); //printf("patching MAP %d in file %s with contents of %s\n", // mapId,m_patchFile.data(),map.mapFile.data()); convertMapFile(tt,map.mapFile,map.relPath,map.urlOnly,map.context); - if (tt.tellp()>0) + if (!tt.empty()) { t << "<map name=\"" << correctId(map.label) << "\" id=\"" << correctId(map.label) << "\">\n"; t << tt.str(); @@ -462,29 +463,32 @@ bool DotFilePatcher::run() const { QCString orgName=m_patchFile.left(m_patchFile.length()-4)+"_org.svg"; t << substitute(svgZoomFooter,"$orgname",stripPath(orgName)); - t.close(); + t.flush(); + fo.close(); // keep original SVG file so we can refer to it, we do need to replace // dummy link by real ones fi.open(tmpName,std::ifstream::in); - t.open(orgName,std::ofstream::out | std::ofstream::binary); + fo.open(orgName,std::ofstream::out | std::ofstream::binary); if (!fi.is_open()) { err("problem opening file %s for reading!\n",tmpName.c_str()); return FALSE; } - if (!t.is_open()) + if (!fo.is_open()) { err("problem opening file %s for writing!\n",orgName.data()); return FALSE; } + t.setStream(&fo); while (getline(fi,lineStr)) // foreach line { std::string line = lineStr+'\n'; const Map &map = m_maps.front(); // there is only one 'map' for a SVG file t << replaceRef(line.c_str(),map.relPath,map.urlOnly,map.context,"_top"); } + t.flush(); fi.close(); - t.close(); + fo.close(); } // remove temporary file thisDir.remove(tmpName); @@ -521,14 +525,14 @@ static bool readSVGSize(const QCString &fileName,int *width,int *height) return true; } -static void writeSVGNotSupported(std::ostream &out) +static void writeSVGNotSupported(TextStream &out) { out << "<p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p>"; } /// Check if a reference to a SVG figure can be written and do so if possible. /// Returns FALSE if not possible (for instance because the SVG file is not yet generated). -bool DotFilePatcher::writeSVGFigureLink(std::ostream &out,const QCString &relPath, +bool DotFilePatcher::writeSVGFigureLink(TextStream &out,const QCString &relPath, const QCString &baseName,const QCString &absImgName) { int width=600,height=600; @@ -567,7 +571,7 @@ bool DotFilePatcher::writeSVGFigureLink(std::ostream &out,const QCString &relPat return TRUE; } -bool DotFilePatcher::writeVecGfxFigure(std::ostream &out,const QCString &baseName, +bool DotFilePatcher::writeVecGfxFigure(TextStream &out,const QCString &baseName, const QCString &figureName) { int width=400,height=550; diff --git a/src/dotfilepatcher.h b/src/dotfilepatcher.h index 5b51da8..e0ac918 100644 --- a/src/dotfilepatcher.h +++ b/src/dotfilepatcher.h @@ -17,10 +17,11 @@ #define DOTFILEPATCHER_H #include <vector> -#include <iostream> #include "qcstring.h" +class TextStream; + /** Helper class to insert a set of map file into an output file */ class DotFilePatcher { @@ -41,14 +42,14 @@ class DotFilePatcher bool run() const; bool isSVGFile() const; - static bool convertMapFile(std::ostream &t,const char *mapName, + static bool convertMapFile(TextStream &t,const char *mapName, const QCString relPath, bool urlOnly=FALSE, const QCString &context=QCString()); - static bool writeSVGFigureLink(std::ostream &out,const QCString &relPath, + static bool writeSVGFigureLink(TextStream &out,const QCString &relPath, const QCString &baseName,const QCString &absImgName); - static bool writeVecGfxFigure(std::ostream& out, const QCString& baseName, + static bool writeVecGfxFigure(TextStream& out, const QCString& baseName, const QCString& figureName); private: diff --git a/src/dotgfxhierarchytable.cpp b/src/dotgfxhierarchytable.cpp index 4684f96..042e233 100644 --- a/src/dotgfxhierarchytable.cpp +++ b/src/dotgfxhierarchytable.cpp @@ -35,7 +35,7 @@ QCString DotGfxHierarchyTable::getBaseName() const void DotGfxHierarchyTable::computeTheGraph() { - std::ostringstream md5stream(std::ios_base::ate); + TextStream md5stream; writeGraphHeader(md5stream,theTranslator->trGraphicalHierarchy()); md5stream << " rankdir=\"LR\";\n"; for (auto node : m_rootNodes) @@ -61,7 +61,7 @@ QCString DotGfxHierarchyTable::getMapLabel() const return escapeCharsInString(m_rootSubgraphNode->label(),FALSE); } -void DotGfxHierarchyTable::createGraph(DotNode *n,std::ostream &out, +void DotGfxHierarchyTable::createGraph(DotNode *n,TextStream &out, const char *path,const char *fileName,int id) { m_rootSubgraphNode = n; @@ -71,7 +71,7 @@ void DotGfxHierarchyTable::createGraph(DotNode *n,std::ostream &out, DotGraph::writeGraph(out, GOF_BITMAP, EOF_Html, path, fileName, "", TRUE, 0); } -void DotGfxHierarchyTable::writeGraph(std::ostream &out, +void DotGfxHierarchyTable::writeGraph(TextStream &out, const char *path,const char *fileName) { //printf("DotGfxHierarchyTable::writeGraph(%s)\n",name); diff --git a/src/dotgfxhierarchytable.h b/src/dotgfxhierarchytable.h index e85f3e9..9beff77 100644 --- a/src/dotgfxhierarchytable.h +++ b/src/dotgfxhierarchytable.h @@ -32,9 +32,9 @@ class DotGfxHierarchyTable : public DotGraph { public: DotGfxHierarchyTable(const char *prefix="",ClassDef::CompoundType ct=ClassDef::Class); - void createGraph(DotNode *rootNode,std::ostream &t,const char *path, + void createGraph(DotNode *rootNode,TextStream &t,const char *path, const char *fileName,int id); - void writeGraph(std::ostream &t,const char *path, const char *fileName); + void writeGraph(TextStream &t,const char *path, const char *fileName); const std::vector<DotNode*> subGraphs() const { return m_rootSubgraphs; } protected: diff --git a/src/dotgraph.cpp b/src/dotgraph.cpp index d9dd91e..9717502 100644 --- a/src/dotgraph.cpp +++ b/src/dotgraph.cpp @@ -76,15 +76,15 @@ static bool checkDeliverables(const QCString &file1, return file1Ok && file2Ok; } -static bool insertMapFile(std::ostream &out,const QCString &mapFile, +static bool insertMapFile(TextStream &out,const QCString &mapFile, const QCString &relPath,const QCString &mapLabel) { FileInfo fi(mapFile.str()); if (fi.exists() && fi.size()>0) // reuse existing map file { - std::ostringstream t(std::ios_base::ate); + TextStream t; DotFilePatcher::convertMapFile(t,mapFile,relPath,false); - if (t.tellp()>0) + if (!t.empty()) { out << "<map name=\"" << mapLabel << "\" id=\"" << mapLabel << "\">\n"; out << t.str(); @@ -104,7 +104,7 @@ QCString DotGraph::imgName() const } QCString DotGraph::writeGraph( - std::ostream& t, // output stream for the code file (html, ...) + TextStream& t, // output stream for the code file (html, ...) GraphOutputFormat gf, // bitmap(png/svg) or ps(eps/pdf) EmbeddedOutputFormat ef, // html, latex, ... const char* path, // output folder @@ -196,7 +196,7 @@ bool DotGraph::prepareDotFile() return TRUE; } -void DotGraph::generateCode(std::ostream &t) +void DotGraph::generateCode(TextStream &t) { QCString imgExt = getDotImageExtension(); if (m_graphFormat==GOF_BITMAP && m_textFormat==EOF_DocBook) @@ -260,7 +260,7 @@ void DotGraph::generateCode(std::ostream &t) } } -void DotGraph::writeGraphHeader(std::ostream &t,const QCString &title) +void DotGraph::writeGraphHeader(TextStream &t,const QCString &title) { int fontSize = Config_getInt(DOT_FONTSIZE); QCString fontName = Config_getString(DOT_FONTNAME); @@ -292,7 +292,7 @@ void DotGraph::writeGraphHeader(std::ostream &t,const QCString &title) "fontsize=\"" << fontSize << "\",shape=record];\n"; } -void DotGraph::writeGraphFooter(std::ostream &t) +void DotGraph::writeGraphFooter(TextStream &t) { t << "}\n"; } @@ -307,7 +307,7 @@ void DotGraph::computeGraph(DotNode *root, QCString &graphStr) { //printf("computeMd5Signature\n"); - std::ostringstream md5stream(std::ios_base::ate); + TextStream md5stream; writeGraphHeader(md5stream,title); if (!rank.isEmpty()) { @@ -323,7 +323,7 @@ void DotGraph::computeGraph(DotNode *root, { const auto &children = pn->children(); auto child_it = std::find(children.begin(),children.end(),root); - int index = child_it - children.begin(); + size_t index = child_it - children.begin(); root->writeArrow(md5stream, // stream gt, // graph type format, // output format diff --git a/src/dotgraph.h b/src/dotgraph.h index 176d776..5dc03f9 100644 --- a/src/dotgraph.h +++ b/src/dotgraph.h @@ -22,6 +22,7 @@ #include "dir.h" class DotNode; +class TextStream; enum GraphOutputFormat { GOF_BITMAP, GOF_EPS }; enum EmbeddedOutputFormat { EOF_Html, EOF_LaTeX, EOF_Rtf, EOF_DocBook }; @@ -39,7 +40,7 @@ class DotGraph /** returns node numbers. The Counter is reset by the constructor */ int getNextNodeNumber() { return ++m_curNodeNumber; } - QCString writeGraph(std::ostream &t, + QCString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path, @@ -49,8 +50,8 @@ class DotGraph int graphId=-1 ); - static void writeGraphHeader(std::ostream& t, const QCString& title = QCString()); - static void writeGraphFooter(std::ostream& t); + static void writeGraphHeader(TextStream& t, const QCString& title = QCString()); + static void writeGraphFooter(TextStream& t); static void computeGraph(DotNode* root, GraphType gt, GraphOutputFormat format, @@ -97,7 +98,7 @@ class DotGraph DotGraph &operator=(const DotGraph &); bool prepareDotFile(); - void generateCode(std::ostream &t); + void generateCode(TextStream &t); int m_curNodeNumber = 0; }; diff --git a/src/dotgroupcollaboration.cpp b/src/dotgroupcollaboration.cpp index 9ee0bba..5157778 100644 --- a/src/dotgroupcollaboration.cpp +++ b/src/dotgroupcollaboration.cpp @@ -13,8 +13,6 @@ * */ -#include <sstream> - #include "dotgroupcollaboration.h" #include "classlist.h" #include "doxygen.h" @@ -22,6 +20,7 @@ #include "pagedef.h" #include "util.h" #include "config.h" +#include "textstream.h" DotGroupCollaboration::DotGroupCollaboration(const GroupDef* gd) { @@ -209,7 +208,7 @@ QCString DotGroupCollaboration::getBaseName() const void DotGroupCollaboration::computeTheGraph() { - std::ostringstream md5stream(std::ios_base::ate); + TextStream md5stream; writeGraphHeader(md5stream,m_rootNode->label()); // clean write flags @@ -240,7 +239,7 @@ QCString DotGroupCollaboration::getMapLabel() const return escapeCharsInString(m_baseName, FALSE); } -QCString DotGroupCollaboration::writeGraph( std::ostream &t, +QCString DotGroupCollaboration::writeGraph( TextStream &t, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, const char *path, const char *fileName, const char *relPath, bool generateImageMap,int graphId) @@ -250,7 +249,7 @@ QCString DotGroupCollaboration::writeGraph( std::ostream &t, return DotGraph::writeGraph(t, graphFormat, textFormat, path, fileName, relPath, generateImageMap, graphId); } -void DotGroupCollaboration::Edge::write( std::ostream &t ) const +void DotGroupCollaboration::Edge::write( TextStream &t ) const { const char* linkTypeColor[] = { "darkorchid3" @@ -315,7 +314,7 @@ bool DotGroupCollaboration::isTrivial() const return m_usedNodes.size() <= 1; } -void DotGroupCollaboration::writeGraphHeader(std::ostream &t,const QCString &title) const +void DotGroupCollaboration::writeGraphHeader(TextStream &t,const QCString &title) const { int fontSize = Config_getInt(DOT_FONTSIZE); QCString fontName = Config_getString(DOT_FONTNAME); diff --git a/src/dotgroupcollaboration.h b/src/dotgroupcollaboration.h index 3d83673..7353be9 100644 --- a/src/dotgroupcollaboration.h +++ b/src/dotgroupcollaboration.h @@ -16,19 +16,19 @@ #ifndef DOTGROUPCOLLABORATION_H #define DOTGROUPCOLLABORATION_H -#include <iostream> - #include "dotnode.h" #include "dotgraph.h" #include "groupdef.h" +class TextStream; + /** Representation of a group collaboration graph */ class DotGroupCollaboration : public DotGraph { public : DotGroupCollaboration(const GroupDef* gd); ~DotGroupCollaboration(); - QCString writeGraph(std::ostream &t, GraphOutputFormat gf,EmbeddedOutputFormat ef, + QCString writeGraph(TextStream &t, GraphOutputFormat gf,EmbeddedOutputFormat ef, const char *path,const char *fileName,const char *relPath, bool writeImageMap=TRUE,int graphId=-1); bool isTrivial() const; @@ -67,13 +67,13 @@ class DotGroupCollaboration : public DotGraph EdgeType eType; std::vector<Link> links; - void write( std::ostream &t ) const; + void write( TextStream &t ) const; }; void buildGraph(const GroupDef* gd); void addCollaborationMember(const Definition* def, QCString& url, EdgeType eType ); void addMemberList( class MemberList* ml ); - void writeGraphHeader(std::ostream &t,const QCString &title) const; + void writeGraphHeader(TextStream &t,const QCString &title) const; Edge* addEdge( DotNode* _pNStart, DotNode* _pNEnd, EdgeType _eType, const QCString& _label, const QCString& _url ); diff --git a/src/dotincldepgraph.cpp b/src/dotincldepgraph.cpp index 4f6b8c3..87b44ce 100644 --- a/src/dotincldepgraph.cpp +++ b/src/dotincldepgraph.cpp @@ -17,6 +17,7 @@ #include "dotnode.h" #include "util.h" #include "config.h" +#include "textstream.h" void DotInclDepGraph::buildGraph(DotNode *n,const FileDef *fd,int distance) { @@ -180,7 +181,7 @@ QCString DotInclDepGraph::getMapLabel() const } } -QCString DotInclDepGraph::writeGraph(std::ostream &out, +QCString DotInclDepGraph::writeGraph(TextStream &out, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, const char *path, @@ -207,7 +208,7 @@ int DotInclDepGraph::numNodes() const return (int)m_startNode->children().size(); } -void DotInclDepGraph::writeXML(std::ostream &t) +void DotInclDepGraph::writeXML(TextStream &t) { for (const auto &kv : m_usedNodes) { @@ -215,7 +216,7 @@ void DotInclDepGraph::writeXML(std::ostream &t) } } -void DotInclDepGraph::writeDocbook(std::ostream &t) +void DotInclDepGraph::writeDocbook(TextStream &t) { for (const auto &kv : m_usedNodes) { diff --git a/src/dotincldepgraph.h b/src/dotincldepgraph.h index f511608..e253be1 100644 --- a/src/dotincldepgraph.h +++ b/src/dotincldepgraph.h @@ -22,20 +22,22 @@ #include "dotnode.h" #include "dotgraph.h" +class TextStream; + /** Representation of an include dependency graph */ class DotInclDepGraph : public DotGraph { public: DotInclDepGraph(const FileDef *fd,bool inverse); ~DotInclDepGraph(); - QCString writeGraph(std::ostream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, + QCString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path,const char *fileName,const char *relPath, bool writeImageMap=TRUE,int graphId=-1); bool isTrivial() const; bool isTooBig() const; int numNodes() const; - void writeXML(std::ostream &t); - void writeDocbook(std::ostream &t); + void writeXML(TextStream &t); + void writeDocbook(TextStream &t); protected: virtual QCString getBaseName() const; diff --git a/src/dotlegendgraph.cpp b/src/dotlegendgraph.cpp index 0389a1d..53e2a7a 100644 --- a/src/dotlegendgraph.cpp +++ b/src/dotlegendgraph.cpp @@ -25,7 +25,7 @@ void DotLegendGraph::writeGraph(const char *path) { - std::ostringstream ts(std::ios_base::ate); + TextStream ts; DotGraph::writeGraph(ts, GOF_BITMAP, EOF_Html, path, "", "", FALSE, 0); if (getDotImageExtension()=="svg") @@ -45,7 +45,7 @@ void DotLegendGraph::computeTheGraph() { int fontSize = Config_getInt(DOT_FONTSIZE); QCString fontName = Config_getString(DOT_FONTNAME); - std::ostringstream md5stream(std::ios_base::ate); + TextStream md5stream; writeGraphHeader(md5stream,theTranslator->trLegendTitle()); md5stream << " Node9 [shape=\"box\",label=\"Inherited\",fontsize=\"" << fontSize << "\",height=0.2,width=0.4,fontname=\"" << fontName << "\",fillcolor=\"grey75\",style=\"filled\" fontcolor=\"black\"];\n"; md5stream << " Node10 -> Node9 [dir=\"back\",color=\"midnightblue\",fontsize=\"" << fontSize << "\",style=\"solid\",fontname=\"" << fontName << "\"];\n"; diff --git a/src/dotnode.cpp b/src/dotnode.cpp index 234dff0..1d3d920 100644 --- a/src/dotnode.cpp +++ b/src/dotnode.cpp @@ -21,6 +21,7 @@ #include "language.h" #include "doxygen.h" #include "util.h" +#include "textstream.h" /** Helper struct holding the properties of a edge in a dot graph. */ struct EdgeProperties @@ -137,7 +138,7 @@ static QCString escapeTooltip(const QCString &tooltip) return result; } -static void writeBoxMemberList(std::ostream &t, +static void writeBoxMemberList(TextStream &t, char prot,const MemberList *ml,const ClassDef *scope, bool isStatic=FALSE,const StringUnorderedSet *skipNames=nullptr) { @@ -360,7 +361,7 @@ void DotNode::setDistance(int distance) inline int DotNode::findParent( DotNode *n ) { auto it = std::find(m_parents.begin(),m_parents.end(),n); - return it!=m_parents.end() ? it-m_parents.begin() : -1; + return it!=m_parents.end() ? static_cast<int>(it-m_parents.begin()) : -1; } /*! helper function that deletes all nodes in a connected graph, given @@ -376,7 +377,7 @@ void DotNode::deleteNodes(DotNode *node) } } -void DotNode::writeBox(std::ostream &t, +void DotNode::writeBox(TextStream &t, GraphType gt, GraphOutputFormat /*format*/, bool hasNonReachableChildren) const @@ -501,7 +502,7 @@ void DotNode::writeBox(std::ostream &t, t << "];\n"; } -void DotNode::writeArrow(std::ostream &t, +void DotNode::writeArrow(TextStream &t, GraphType gt, GraphOutputFormat format, const DotNode *cn, @@ -550,7 +551,7 @@ void DotNode::writeArrow(std::ostream &t, t << "];\n"; } -void DotNode::write(std::ostream &t, +void DotNode::write(TextStream &t, GraphType gt, GraphOutputFormat format, bool topDown, @@ -584,7 +585,7 @@ void DotNode::write(std::ostream &t, { const auto &children = pn->children(); auto child_it = std::find(children.begin(),children.end(),this); - int index = child_it - children.begin(); + size_t index = child_it - children.begin(); //printf("write arrow %s%s%s\n",label().data(),backArrows?"<-":"->",pn->label().data()); writeArrow(t, gt, @@ -601,7 +602,7 @@ void DotNode::write(std::ostream &t, //printf("end DotNode::write(%d) name=%s\n",distance,m_label.data()); } -void DotNode::writeXML(std::ostream &t,bool isClassGraph) const +void DotNode::writeXML(TextStream &t,bool isClassGraph) const { t << " <node id=\"" << m_number << "\">\n"; t << " <label>" << convertToXML(m_label) << "</label>\n"; @@ -665,7 +666,7 @@ void DotNode::writeXML(std::ostream &t,bool isClassGraph) const t << " </node>\n"; } -void DotNode::writeDocbook(std::ostream &t,bool isClassGraph) const +void DotNode::writeDocbook(TextStream &t,bool isClassGraph) const { t << " <node id=\"" << m_number << "\">\n"; t << " <label>" << convertToXML(m_label) << "</label>\n"; @@ -730,7 +731,7 @@ void DotNode::writeDocbook(std::ostream &t,bool isClassGraph) const } -void DotNode::writeDEF(std::ostream &t) const +void DotNode::writeDEF(TextStream &t) const { const char* nodePrefix = " node-"; diff --git a/src/dotnode.h b/src/dotnode.h index bfe5af4..7d1dd62 100644 --- a/src/dotnode.h +++ b/src/dotnode.h @@ -25,6 +25,7 @@ class ClassDef; class DotNode; +class TextStream; /** Attributes of an edge of a dot graph */ class EdgeInfo @@ -75,14 +76,14 @@ class DotNode void removeParent(DotNode *n); int findParent( DotNode *n ); - void write(std::ostream &t,GraphType gt,GraphOutputFormat f, + void write(TextStream &t,GraphType gt,GraphOutputFormat f, bool topDown,bool toChildren,bool backArrows) const; - void writeXML(std::ostream &t,bool isClassGraph) const; - void writeDocbook(std::ostream &t,bool isClassGraph) const; - void writeDEF(std::ostream &t) const; - void writeBox(std::ostream &t,GraphType gt,GraphOutputFormat f, + void writeXML(TextStream &t,bool isClassGraph) const; + void writeDocbook(TextStream &t,bool isClassGraph) const; + void writeDEF(TextStream &t) const; + void writeBox(TextStream &t,GraphType gt,GraphOutputFormat f, bool hasNonReachableChildren) const; - void writeArrow(std::ostream &t,GraphType gt,GraphOutputFormat f,const DotNode *cn, + void writeArrow(TextStream &t,GraphType gt,GraphOutputFormat f,const DotNode *cn, const EdgeInfo *ei,bool topDown, bool pointBack=TRUE) const; QCString label() const { return m_label; } diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 34cea10..d5e082d 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -8981,11 +8981,12 @@ static QCString fixSlashes(QCString &s) static void generateConfigFile(const char *configFile,bool shortList, bool updateOnly=FALSE) { - std::ofstream t; - bool fileOpened=openOutputFile(configFile,t); + std::ofstream f; + bool fileOpened=openOutputFile(configFile,f); bool writeToStdout=(configFile[0]=='-' && configFile[1]=='\0'); if (fileOpened) { + TextStream t(&f); Config::writeTemplate(t,shortList,updateOnly); if (!writeToStdout) { @@ -9020,7 +9021,8 @@ static void compareDoxyfile() bool fileOpened=openOutputFile(configFile,f); if (fileOpened) { - Config::compareDoxyfile(f); + TextStream t(&f); + Config::compareDoxyfile(t); } else { @@ -9882,7 +9884,7 @@ void readAliases() //---------------------------------------------------------------------------- -static void dumpSymbol(std::ostream &t,Definition *d) +static void dumpSymbol(TextStream &t,Definition *d) { QCString anchor; if (d->definitionType()==Definition::TypeMember) @@ -9906,9 +9908,10 @@ static void dumpSymbol(std::ostream &t,Definition *d) static void dumpSymbolMap() { - std::ofstream t("symbols.sql",std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + std::ofstream f("symbols.sql",std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); for (const auto &kv : Doxygen::symbolMap) { dumpSymbol(t,kv.second); @@ -10141,7 +10144,7 @@ void cleanUpDoxygen() DotManager::deleteInstance(); } -static int computeIdealCacheParam(uint v) +static int computeIdealCacheParam(size_t v) { //printf("computeIdealCacheParam(v=%u)\n",v); @@ -10240,7 +10243,8 @@ void readConfiguration(int argc, char **argv) std::ofstream f; if (openOutputFile(argv[optind+1],f)) { - RTFGenerator::writeExtensionsFile(f); + TextStream t(&f); + RTFGenerator::writeExtensionsFile(t); } cleanUpDoxygen(); exit(0); @@ -10268,7 +10272,8 @@ void readConfiguration(int argc, char **argv) std::ofstream f; if (openOutputFile(argv[optind+1],f)) { - EmojiEntityMapper::instance()->writeEmojiFile(f); + TextStream t(&f); + EmojiEntityMapper::instance()->writeEmojiFile(t); } cleanUpDoxygen(); exit(0); @@ -10296,7 +10301,8 @@ void readConfiguration(int argc, char **argv) std::ofstream f; if (openOutputFile(argv[optind+1],f)) { - RTFGenerator::writeStyleSheetFile(f); + TextStream t(&f); + RTFGenerator::writeStyleSheetFile(t); } cleanUpDoxygen(); exit(1); @@ -10333,17 +10339,20 @@ void readConfiguration(int argc, char **argv) std::ofstream f; if (openOutputFile(argv[optind+1],f)) { - HtmlGenerator::writeHeaderFile(f, argv[optind+3]); + TextStream t(&f); + HtmlGenerator::writeHeaderFile(t, argv[optind+3]); } f.close(); if (openOutputFile(argv[optind+2],f)) { - HtmlGenerator::writeFooterFile(f); + TextStream t(&f); + HtmlGenerator::writeFooterFile(t); } f.close(); if (openOutputFile(argv[optind+3],f)) { - HtmlGenerator::writeStyleSheetFile(f); + TextStream t(&f); + HtmlGenerator::writeStyleSheetFile(t); } cleanUpDoxygen(); exit(0); @@ -10379,17 +10388,20 @@ void readConfiguration(int argc, char **argv) std::ofstream f; if (openOutputFile(argv[optind+1],f)) { - LatexGenerator::writeHeaderFile(f); + TextStream t(&f); + LatexGenerator::writeHeaderFile(t); } f.close(); if (openOutputFile(argv[optind+2],f)) { - LatexGenerator::writeFooterFile(f); + TextStream t(&f); + LatexGenerator::writeFooterFile(t); } f.close(); if (openOutputFile(argv[optind+3],f)) { - LatexGenerator::writeStyleSheetFile(f); + TextStream t(&f); + LatexGenerator::writeStyleSheetFile(t); } cleanUpDoxygen(); exit(0); @@ -10656,14 +10668,15 @@ static void writeTagFile() QCString generateTagFile = Config_getString(GENERATE_TAGFILE); if (generateTagFile.isEmpty()) return; - std::ofstream tagFile(generateTagFile.str(),std::ofstream::out | std::ofstream::binary); - if (!tagFile.is_open()) + std::ofstream f(generateTagFile.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { err("cannot open tag file %s for writing\n", generateTagFile.data() ); return; } + TextStream tagFile(&f); tagFile << "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\n"; tagFile << "<tagfile doxygen_version=\"" << getDoxygenVersion() << "\""; if (strlen(getGitVersion())>0) @@ -11866,7 +11879,7 @@ void generateOutput() Doxygen::lookupCache->capacity(), Doxygen::lookupCache->hits(), Doxygen::lookupCache->misses()); - cacheParam = computeIdealCacheParam(Doxygen::lookupCache->misses()*2/3); // part of the cache is flushed, hence the 2/3 correction factor + cacheParam = computeIdealCacheParam(static_cast<size_t>(Doxygen::lookupCache->misses()*2/3)); // part of the cache is flushed, hence the 2/3 correction factor if (cacheParam>Config_getInt(LOOKUP_CACHE_SIZE)) { msg("Note: based on cache misses the ideal setting for LOOKUP_CACHE_SIZE is %d at the cost of higher memory usage.\n",cacheParam); diff --git a/src/emoji.cpp b/src/emoji.cpp index 9871c22..d723f64 100644 --- a/src/emoji.cpp +++ b/src/emoji.cpp @@ -16,6 +16,7 @@ #include "emoji.h" #include "message.h" #include "util.h" +#include "textstream.h" static struct emojiEntityInfo { @@ -1563,7 +1564,7 @@ int EmojiEntityMapper::symbol2index(const std::string &symName) const /*! * @brief Writes the list of supported emojis to the given file. */ -void EmojiEntityMapper::writeEmojiFile(std::ostream &t) +void EmojiEntityMapper::writeEmojiFile(TextStream &t) { for (int i = 0; i < g_numEmojiEntities; i++) { diff --git a/src/emoji.h b/src/emoji.h index a0184f6..7ec2519 100644 --- a/src/emoji.h +++ b/src/emoji.h @@ -17,7 +17,8 @@ #include <map> #include <string> -#include <iostream> + +class TextStream; /** @brief Singleton helper class to map emoji entities to other formats */ class EmojiEntityMapper @@ -27,7 +28,7 @@ class EmojiEntityMapper static void deleteInstance(); const char *name(int index) const; const char *unicode(int index) const; - void writeEmojiFile(std::ostream &t); + void writeEmojiFile(TextStream &t); int symbol2index(const std::string &symName) const; private: diff --git a/src/entry.cpp b/src/entry.cpp index 6ab9dc1..e44b2d3 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -30,7 +30,7 @@ static AtomicInt g_num; -Entry::Entry() : program(std::ios_base::ate), initializer(std::ios_base::ate) +Entry::Entry() { //printf("Entry::Entry(%p)\n",this); g_num++; @@ -45,7 +45,7 @@ Entry::Entry() : program(std::ios_base::ate), initializer(std::ios_base::ate) reset(); } -Entry::Entry(const Entry &e) : program(std::ios_base::ate), initializer(std::ios_base::ate) +Entry::Entry(const Entry &e) { //printf("Entry::Entry(%p):copy\n",this); g_num++; @@ -72,8 +72,8 @@ Entry::Entry(const Entry &e) : program(std::ios_base::ate), initializer(std::ios bitfields = e.bitfields; argList = e.argList; tArgLists = e.tArgLists; - program.str(e.program.str()); - initializer.str(e.initializer.str()); + program = e.program; + initializer = e.initializer; includeFile = e.includeFile; includeName = e.includeName; doc = e.doc; diff --git a/src/entry.h b/src/entry.h index cf46efb..dd2b157 100644 --- a/src/entry.h +++ b/src/entry.h @@ -25,6 +25,7 @@ #include "types.h" #include "arguments.h" #include "reflist.h" +#include "textstream.h" class SectionInfo; class FileDef; @@ -256,8 +257,8 @@ class Entry QCString bitfields; //!< member's bit fields ArgumentList argList; //!< member arguments as a list ArgumentLists tArgLists; //!< template argument declarations - std::ostringstream program; //!< the program text - std::ostringstream initializer; //!< initial value (for variables) + TextStream program; //!< the program text + TextStream initializer; //!< initial value (for variables) QCString includeFile; //!< include file (2 arg of \\class, must be unique) QCString includeName; //!< include name (3 arg of \\class) QCString doc; //!< documentation block (partly parsed) diff --git a/src/filedef.cpp b/src/filedef.cpp index 18050dd..a9503c5 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -104,7 +104,7 @@ class FileDefImpl : public DefinitionMixin<FileDef> virtual void writeMemberPages(OutputList &ol); virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const; virtual void writeSummaryLinks(OutputList &ol) const; - virtual void writeTagFile(std::ostream &t); + virtual void writeTagFile(TextStream &t); virtual void writeSourceHeader(OutputList &ol); virtual void writeSourceBody(OutputList &ol,ClangTUParser *clangParser); virtual void writeSourceFooter(OutputList &ol); @@ -150,7 +150,7 @@ class FileDefImpl : public DefinitionMixin<FileDef> void endMemberDocumentation(OutputList &ol); void writeDetailedDescription(OutputList &ol,const QCString &title); void writeBriefDescription(OutputList &ol); - void writeClassesToTagFile(std::ostream &t,const ClassLinkedRefMap &list); + void writeClassesToTagFile(TextStream &t,const ClassLinkedRefMap &list); IncludeInfoMap m_includeMap; IncludeInfoList m_includeList; @@ -307,7 +307,7 @@ bool FileDefImpl::hasDetailedDescription() const ); } -void FileDefImpl::writeTagFile(std::ostream &tagFile) +void FileDefImpl::writeTagFile(TextStream &tagFile) { tagFile << " <compound kind=\"file\">\n"; tagFile << " <name>" << convertToXML(name()) << "</name>\n"; @@ -513,7 +513,7 @@ void FileDefImpl::writeBriefDescription(OutputList &ol) ol.writeSynopsis(); } -void FileDefImpl::writeClassesToTagFile(std::ostream &tagFile, const ClassLinkedRefMap &list) +void FileDefImpl::writeClassesToTagFile(TextStream &tagFile, const ClassLinkedRefMap &list) { for (const auto &cd : list) { diff --git a/src/filedef.h b/src/filedef.h index b3c38ba..3075470 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -154,7 +154,7 @@ class FileDef : public DefinitionMutable, public Definition virtual void writeMemberPages(OutputList &ol) = 0; virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const = 0; virtual void writeSummaryLinks(OutputList &ol) const = 0; - virtual void writeTagFile(std::ostream &t) = 0; + virtual void writeTagFile(TextStream &t) = 0; virtual void writeSourceHeader(OutputList &ol) = 0; virtual void writeSourceBody(OutputList &ol,ClangTUParser *clangParser) = 0; diff --git a/src/formula.cpp b/src/formula.cpp index c08e9be..6ca93cb 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -151,9 +151,10 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c // generate a latex file containing one formula per page. QCString texName="_formulas.tex"; IntVector formulasToGenerate; - std::ofstream t(texName.str(),std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + std::ofstream f(texName.str(),std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); if (Config_getBool(LATEX_BATCHMODE)) t << "\\batchmode\n"; t << "\\documentclass{article}\n"; t << "\\usepackage{ifthen}\n"; @@ -183,7 +184,8 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c Doxygen::indexList->addImageFile(resultName); } t << "\\end{document}\n"; - t.close(); + t.flush(); + f.close(); } if (!formulasToGenerate.empty()) // there are new formulas { @@ -427,9 +429,10 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c // generated images represent (we use this next time to avoid regeneration // of the images, and to avoid forcing the user to delete all images in order // to let a browser refresh the images). - t.open("formula.repository",std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + f.open("formula.repository",std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); for (int i=0; i<(int)p->formulas.size(); i++) { DisplaySize size = p->getDisplaySize(i); @@ -440,7 +443,6 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c } t << ":" << p->formulas[i].c_str() << "\n"; } - t.close(); } // reset the directory to the original location. Dir::setCurrent(oldDir); diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index 572556d..d061325 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -279,7 +279,7 @@ QCString FTVHelp::generateIndentLabel(FTVNode *n,int level) return result; } -void FTVHelp::generateIndent(std::ostream &t, FTVNode *n,bool opened) +void FTVHelp::generateIndent(TextStream &t, FTVNode *n,bool opened) { int indent=0; FTVNode *p = n->parent; @@ -299,7 +299,7 @@ void FTVHelp::generateIndent(std::ostream &t, FTVNode *n,bool opened) } } -void FTVHelp::generateLink(std::ostream &t,FTVNode *n) +void FTVHelp::generateLink(TextStream &t,FTVNode *n) { //printf("FTVHelp::generateLink(ref=%s,file=%s,anchor=%s\n", // n->ref.data(),n->file.data(),n->anchor.data()); @@ -344,7 +344,7 @@ void FTVHelp::generateLink(std::ostream &t,FTVNode *n) } } -static void generateBriefDoc(std::ostream &t,const Definition *def) +static void generateBriefDoc(TextStream &t,const Definition *def) { QCString brief = def->briefDescription(TRUE); //printf("*** %p: generateBriefDoc(%s)='%s'\n",def,def->name().data(),brief.data()); @@ -383,7 +383,7 @@ static char compoundIcon(const ClassDef *cd) return icon; } -void FTVHelp::generateTree(std::ostream &t, const std::vector<FTVNode*> &nl,int level,int maxLevel,int &index) +void FTVHelp::generateTree(TextStream &t, const std::vector<FTVNode*> &nl,int level,int maxLevel,int &index) { for (const auto &n : nl) { @@ -534,7 +534,7 @@ static bool dupOfParent(const FTVNode *n) return FALSE; } -static void generateJSLink(std::ostream &t,const FTVNode *n) +static void generateJSLink(TextStream &t,const FTVNode *n) { if (n->file.isEmpty()) // no link { @@ -557,7 +557,7 @@ static QCString convertFileId2Var(const QCString &fileId) return substitute(varId,"-","_"); } -static bool generateJSTree(NavIndexEntryList &navIndex,std::ostream &t, +static bool generateJSTree(NavIndexEntryList &navIndex,TextStream &t, const std::vector<FTVNode*> &nl,int level,bool &first) { static QCString htmlOutput = Config_getString(HTML_OUTPUT); @@ -616,14 +616,15 @@ static bool generateJSTree(NavIndexEntryList &navIndex,std::ostream &t, fileId+="_dup"; } QCString fileName = htmlOutput+"/"+fileId+".js"; - std::ofstream tt(fileName,std::ofstream::out | std::ofstream::binary); - if (tt.is_open()) + std::ofstream f(fileName,std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream tt(&f); tt << "var " << convertFileId2Var(fileId) << " =\n"; generateJSTree(navIndex,tt,n->children,1,firstChild); tt << "\n];"; } - tt.close(); + f.close(); t << "\"" << fileId << "\" ]"; } else // no children @@ -649,11 +650,12 @@ static bool generateJSTree(NavIndexEntryList &navIndex,std::ostream &t, static void generateJSNavTree(const std::vector<FTVNode*> &nodeList) { QCString htmlOutput = Config_getString(HTML_OUTPUT); - std::ofstream t(htmlOutput.str()+"/navtreedata.js",std::ofstream::out | std::ofstream::binary); + std::ofstream f(htmlOutput.str()+"/navtreedata.js",std::ofstream::out | std::ofstream::binary); NavIndexEntryList navIndex; - if (t.is_open()) + if (f.is_open()) { - //std::ostream tidx(&fidx); + TextStream t(&f); + //TextStream tidx(&fidx); //tidx << "var NAVTREEINDEX =\n"; //tidx << "{\n"; t << JAVASCRIPT_LICENSE_TEXT; @@ -779,7 +781,7 @@ void FTVHelp::generateTreeViewScripts() } // write tree inside page -void FTVHelp::generateTreeViewInline(std::ostream &t) +void FTVHelp::generateTreeViewInline(TextStream &t) { int preferredNumEntries = Config_getInt(HTML_INDEX_NUM_ENTRIES); t << "<div class=\"directory\">\n"; diff --git a/src/ftvhelp.h b/src/ftvhelp.h index 11317fd..57fbf12 100644 --- a/src/ftvhelp.h +++ b/src/ftvhelp.h @@ -24,11 +24,11 @@ #ifndef FTVHELP_H #define FTVHELP_H -#include <iostream> #include <vector> #include "index.h" class Definition; +class TextStream; struct FTVNode; /** A class that generates a dynamic tree view side panel. @@ -55,14 +55,14 @@ class FTVHelp : public IndexIntf void addImageFile(const char *) {} void addStyleSheetFile(const char *) {} void generateTreeView(); - void generateTreeViewInline(std::ostream &t); + void generateTreeViewInline(TextStream &t); static void generateTreeViewImages(); void generateTreeViewScripts(); private: - void generateTree(std::ostream &t,const std::vector<FTVNode*> &nl,int level,int maxLevel,int &index); + void generateTree(TextStream &t,const std::vector<FTVNode*> &nl,int level,int maxLevel,int &index); QCString generateIndentLabel(FTVNode *n,int level); - void generateIndent(std::ostream &t,FTVNode *n,bool opened); - void generateLink(std::ostream &t,FTVNode *n); + void generateIndent(TextStream &t,FTVNode *n,bool opened); + void generateLink(TextStream &t,FTVNode *n); std::vector< std::vector<FTVNode*> > m_indentNodes; int m_indent; bool m_topLevelIndex; diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 7e6dca4..27ab775 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -75,7 +75,7 @@ class GroupDefImpl : public DefinitionMixin<GroupDef> virtual void writeDocumentation(OutputList &ol); virtual void writeMemberPages(OutputList &ol); virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const; - virtual void writeTagFile(std::ostream &); + virtual void writeTagFile(TextStream &); virtual size_t numDocMembers() const; virtual bool isLinkableInProject() const; virtual bool isLinkable() const; @@ -597,7 +597,7 @@ void GroupDefImpl::computeAnchors() m_allMemberList.setAnchors(); } -void GroupDefImpl::writeTagFile(std::ostream &tagFile) +void GroupDefImpl::writeTagFile(TextStream &tagFile) { tagFile << " <compound kind=\"group\">\n"; tagFile << " <name>" << convertToXML(name()) << "</name>\n"; diff --git a/src/groupdef.h b/src/groupdef.h index 2d0dafc..26d26ca 100644 --- a/src/groupdef.h +++ b/src/groupdef.h @@ -69,7 +69,7 @@ class GroupDef : public DefinitionMutable, public Definition virtual void writeDocumentation(OutputList &ol) = 0; virtual void writeMemberPages(OutputList &ol) = 0; virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const = 0; - virtual void writeTagFile(std::ostream &) = 0; + virtual void writeTagFile(TextStream &) = 0; virtual size_t numDocMembers() const = 0; virtual bool isLinkableInProject() const = 0; virtual bool isLinkable() const = 0; diff --git a/src/growbuf.h b/src/growbuf.h index bb26404..8c532ca 100644 --- a/src/growbuf.h +++ b/src/growbuf.h @@ -5,7 +5,7 @@ #include <string.h> #include <string> -#define GROW_AMOUNT 1024 +#define GROW_AMOUNT 1024*4 /** Class representing a string buffer optimised for growing. */ class GrowBuf @@ -14,6 +14,37 @@ class GrowBuf GrowBuf() : m_str(0), m_pos(0), m_len(0) {} GrowBuf(uint initialSize) : m_pos(0), m_len(initialSize) { m_str=(char*)malloc(m_len); } ~GrowBuf() { free(m_str); } + GrowBuf(const GrowBuf &other) + { + m_len = other.m_len; + m_pos = other.m_pos; + m_str = (char*)malloc(m_len); + memcpy(m_str,other.m_str,m_len); + } + GrowBuf &operator=(const GrowBuf &other) + { + if (this!=&other) + { + m_len = other.m_len; + m_pos = other.m_pos; + m_str = (char*)malloc(m_len); + memcpy(m_str,other.m_str,m_len); + } + return *this; + } + GrowBuf(GrowBuf &&other) + { + m_len = std::move(other.m_len); + m_pos = std::move(other.m_pos); + m_str = std::move(other.m_str); + } + GrowBuf &operator=(GrowBuf &&other) + { + m_len = std::move(other.m_len); + m_pos = std::move(other.m_pos); + m_str = std::move(other.m_str); + return *this; + } void reserve(uint size) { if (m_len<size) { m_len = size; m_str = (char*)realloc(m_str,m_len); } } void clear() { m_pos=0; } void addChar(char c) { if (m_pos>=m_len) { m_len+=GROW_AMOUNT; m_str = (char*)realloc(m_str,m_len); } @@ -56,10 +87,12 @@ class GrowBuf m_pos+=l; } } - const char *get() { return m_str; } + char *get() { return m_str; } + const char *get() const { return m_str; } uint getPos() const { return m_pos; } void setPos(uint newPos) { m_pos = newPos; } char at(uint i) const { return m_str[i]; } + bool empty() const { return m_pos==0; } private: char *m_str; uint m_pos; diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 73939a0..545b96e 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -264,7 +264,7 @@ static QCString htmlAttribsToString(const HtmlAttribList &attribs, QCString *pAl //------------------------------------------------------------------------- -HtmlDocVisitor::HtmlDocVisitor(std::ostream &t,CodeOutputInterface &ci, +HtmlDocVisitor::HtmlDocVisitor(TextStream &t,CodeOutputInterface &ci, const Definition *ctx) : DocVisitor(DocVisitor_Html), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_ctx(ctx) @@ -471,7 +471,7 @@ void HtmlDocVisitor::visit(DocStyleChange *s) } -static void visitPreCaption(std::ostream &t, DocVerbatim *s) +static void visitPreCaption(TextStream &t, DocVerbatim *s) { if (s->hasCaption()) { @@ -480,7 +480,7 @@ static void visitPreCaption(std::ostream &t, DocVerbatim *s) } -static void visitPostCaption(std::ostream &t, DocVerbatim *s) +static void visitPostCaption(TextStream &t, DocVerbatim *s) { if (s->hasCaption()) { @@ -2378,7 +2378,7 @@ void HtmlDocVisitor::forceEndParagraph(DocNode *n) const DocNodeList &children = para->children(); auto it = std::find_if(children.begin(),children.end(),[n](const auto &np) { return np.get()==n; }); if (it==children.end()) return; - int nodeIndex = it - children.begin(); + int nodeIndex = static_cast<int>(it - children.begin()); nodeIndex--; if (nodeIndex<0) return; // first node in paragraph while (nodeIndex>=0 && isInvisibleNode(children.at(nodeIndex).get())) @@ -2414,7 +2414,7 @@ void HtmlDocVisitor::forceStartParagraph(DocNode *n) const DocNodeList &children = para->children(); auto it = std::find_if(children.begin(),children.end(),[n](const auto &np) { return np.get()==n; }); if (it==children.end()) return; - int nodeIndex = it - children.begin(); + int nodeIndex = static_cast<int>(it - children.begin()); int numNodes = static_cast<int>(para->children().size()); bool styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,nodeIndex); if (styleOutsideParagraph) return; diff --git a/src/htmldocvisitor.h b/src/htmldocvisitor.h index 3e157d2..f03504e 100644 --- a/src/htmldocvisitor.h +++ b/src/htmldocvisitor.h @@ -23,12 +23,13 @@ class Definition; class MemberDef; class DocNode; class CodeOutputInterface; +class TextStream; /*! @brief Concrete visitor implementation for HTML output. */ class HtmlDocVisitor : public DocVisitor { public: - HtmlDocVisitor(std::ostream &t,CodeOutputInterface &ci,const Definition *ctx); + HtmlDocVisitor(TextStream &t,CodeOutputInterface &ci,const Definition *ctx); //-------------------------------------- // visitor functions for leaf nodes @@ -156,7 +157,7 @@ class HtmlDocVisitor : public DocVisitor // state variables //-------------------------------------- - std::ostream &m_t; + TextStream &m_t; CodeOutputInterface &m_ci; bool m_insidePre; bool m_hide; diff --git a/src/htmlentity.cpp b/src/htmlentity.cpp index f5ddd6f..8f2eb78 100644 --- a/src/htmlentity.cpp +++ b/src/htmlentity.cpp @@ -15,6 +15,7 @@ #include "htmlentity.h" #include "message.h" +#include "textstream.h" //! Number of doxygen commands mapped as if it were HTML entities static const int g_numberHtmlMappedCmds = 11; @@ -473,7 +474,7 @@ DocSymbol::SymType HtmlEntityMapper::name2sym(const QCString &symName) const return it!=m_name2sym.end() ? it->second : DocSymbol::Sym_Unknown; } -void HtmlEntityMapper::writeXMLSchema(std::ostream &t) +void HtmlEntityMapper::writeXMLSchema(TextStream &t) { for (int i=0;i<g_numHtmlEntities - g_numberHtmlMappedCmds;i++) { diff --git a/src/htmlentity.h b/src/htmlentity.h index 7d0a822..cbdc0a1 100644 --- a/src/htmlentity.h +++ b/src/htmlentity.h @@ -17,10 +17,11 @@ #include <unordered_map> #include <string> -#include <iostream> #include "docparser.h" +class TextStream; + /** @brief Singleton helper class to map html entities to other formats */ class HtmlEntityMapper { @@ -36,7 +37,7 @@ class HtmlEntityMapper const char *man(DocSymbol::SymType symb) const; const char *rtf(DocSymbol::SymType symb) const; const DocSymbol::PerlSymb *perl(DocSymbol::SymType symb) const; - void writeXMLSchema(std::ostream &t); + void writeXMLSchema(TextStream &t); private: void validate(); HtmlEntityMapper(); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index be7071c..08a8cde 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -52,6 +52,7 @@ #include "fileinfo.h" #include "dir.h" #include "utf8.h" +#include "textstream.h" //#define DBG_HTML(x) x; #define DBG_HTML(x) @@ -64,7 +65,7 @@ static const char *hex="0123456789ABCDEF"; // note: this is only active if DISABLE_INDEX=YES, if DISABLE_INDEX is disabled, this // part will be rendered inside menu.js -static void writeClientSearchBox(std::ostream &t,const char *relPath) +static void writeClientSearchBox(TextStream &t,const char *relPath) { const char *rp = relPath ? relPath : ""; t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n"; @@ -87,7 +88,7 @@ static void writeClientSearchBox(std::ostream &t,const char *relPath) // note: this is only active if DISABLE_INDEX=YES. if DISABLE_INDEX is disabled, this // part will be rendered inside menu.js -static void writeServerSearchBox(std::ostream &t,const char *relPath,bool highlightSearch) +static void writeServerSearchBox(TextStream &t,const char *relPath,bool highlightSearch) { const char *rp = relPath ? relPath : ""; bool externalSearch = Config_getBool(EXTERNAL_SEARCH); @@ -301,7 +302,7 @@ static QCString getConvertLatexMacro() static QCString getSearchBox(bool serverSide, QCString relPath, bool highlightSearch) { - std::ostringstream t(std::ios_base::ate); + TextStream t; if (serverSide) { writeServerSearchBox(t, relPath, highlightSearch); @@ -515,15 +516,15 @@ HtmlCodeGenerator::HtmlCodeGenerator() : m_t(nullptr) { } -HtmlCodeGenerator::HtmlCodeGenerator(std::ostream &t,const QCString &relPath) +HtmlCodeGenerator::HtmlCodeGenerator(TextStream &t,const QCString &relPath) : m_t(nullptr), m_relPath(relPath) { setTextStream(t); } -void HtmlCodeGenerator::setTextStream(std::ostream &t) +void HtmlCodeGenerator::setTextStream(TextStream &t) { - m_t.rdbuf(t.rdbuf()); + m_t = t; m_streamSet=true; } @@ -937,9 +938,10 @@ void HtmlGenerator::init() } { - std::ofstream t(dname+"/dynsections.js",std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + std::ofstream f(dname+"/dynsections.js",std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); t << mgr.getAsString("dynsections.js"); if (Config_getBool(SOURCE_BROWSER) && Config_getBool(SOURCE_TOOLTIPS)) { @@ -1011,9 +1013,10 @@ void HtmlGenerator::writeSearchData(const char *dname) } QCString searchDirName = dname; - std::ofstream t(searchDirName.str()+"/search.css",std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + std::ofstream f(searchDirName.str()+"/search.css",std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); QCString searchCss; if (Config_getBool(DISABLE_INDEX)) { @@ -1033,18 +1036,18 @@ void HtmlGenerator::writeSearchData(const char *dname) } } -void HtmlGenerator::writeStyleSheetFile(std::ostream &t) +void HtmlGenerator::writeStyleSheetFile(TextStream &t) { t << replaceColorMarkers(substitute(ResourceMgr::instance().getAsString("doxygen.css"),"$doxygenversion",getDoxygenVersion())); } -void HtmlGenerator::writeHeaderFile(std::ostream &t, const char * /*cssname*/) +void HtmlGenerator::writeHeaderFile(TextStream &t, const char * /*cssname*/) { t << "<!-- HTML header for doxygen " << getDoxygenVersion() << "-->\n"; t << ResourceMgr::instance().getAsString("header.html"); } -void HtmlGenerator::writeFooterFile(std::ostream &t) +void HtmlGenerator::writeFooterFile(TextStream &t) { t << "<!-- HTML footer for doxygen " << getDoxygenVersion() << "-->\n"; t << ResourceMgr::instance().getAsString("footer.html"); @@ -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<std::mutex> 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 << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " - << getDoxygenVersion() << " -->\n"; + m_t << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " + << getDoxygenVersion() << " -->\n"; //bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); bool searchEngine = Config_getBool(SEARCHENGINE); if (searchEngine /*&& !generateTreeView*/) { - t << "<script type=\"text/javascript\">\n"; - t << "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n"; - t << "var searchBox = new SearchBox(\"searchBox\", \"" - << m_relPath<< "search\",false,'" << theTranslator->trSearch() << "','" << Doxygen::htmlFileExtension << "');\n"; - t << "/* @license-end */\n"; - t << "</script>\n"; + m_t << "<script type=\"text/javascript\">\n"; + m_t << "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n"; + m_t << "var searchBox = new SearchBox(\"searchBox\", \"" + << m_relPath<< "search\",false,'" << theTranslator->trSearch() << "','" << Doxygen::htmlFileExtension << "');\n"; + m_t << "/* @license-end */\n"; + m_t << "</script>\n"; } //generateDynamicSections(t,relPath); m_sectionCount=0; } -void HtmlGenerator::writeSearchInfo(std::ostream &t,const QCString &) +void HtmlGenerator::writeSearchInfo(TextStream &t,const QCString &) { bool searchEngine = Config_getBool(SEARCHENGINE); bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH); @@ -1114,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 << "<h3 class=\"version\">"; + m_t << "<h3 class=\"version\">"; } void HtmlGenerator::endProjectNumber() { - t << "</h3>"; + m_t << "</h3>"; } 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 << "<a id=\"" << anchor << "\"></a>"; + m_t << "<a id=\"" << anchor << "\"></a>"; } 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<p class=\"" << classDef << "\">"; + m_t << "\n<p class=\"" << classDef << "\">"; else - t << "\n<p>"; + m_t << "\n<p>"; } void HtmlGenerator::endParagraph() { - t << "</p>\n"; + m_t << "</p>\n"; } void HtmlGenerator::writeString(const char *text) { - t << text; + m_t << text; } void HtmlGenerator::startIndexListItem() { - t << "<li>"; + m_t << "<li>"; } void HtmlGenerator::endIndexListItem() { - t << "</li>\n"; + m_t << "</li>\n"; } void HtmlGenerator::startIndexItem(const char *ref,const char *f) @@ -1283,21 +1286,21 @@ void HtmlGenerator::startIndexItem(const char *ref,const char *f) { if (ref) { - t << "<a class=\"elRef\" "; - t << externalLinkTarget(); + m_t << "<a class=\"elRef\" "; + m_t << externalLinkTarget(); } else { - t << "<a class=\"el\" "; + m_t << "<a class=\"el\" "; } - t << "href=\""; - t << externalRef(m_relPath,ref,TRUE); - if (f) t << addHtmlExtensionIfMissing(f); - t << "\">"; + m_t << "href=\""; + m_t << externalRef(m_relPath,ref,TRUE); + if (f) m_t << addHtmlExtensionIfMissing(f); + m_t << "\">"; } else { - t << "<b>"; + m_t << "<b>"; } } @@ -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 << "</a>"; + m_t << "</a>"; } else { - t << "</b>"; + m_t << "</b>"; } } void HtmlGenerator::writeStartAnnoItem(const char *,const char *f, const char *path,const char *name) { - t << "<li>"; + m_t << "<li>"; if (path) docify(path); - t << "<a class=\"el\" href=\"" << addHtmlExtensionIfMissing(f) << "\">"; + m_t << "<a class=\"el\" href=\"" << addHtmlExtensionIfMissing(f) << "\">"; docify(name); - t << "</a> "; + m_t << "</a> "; } 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 << "<a class=\"elRef\" "; - t << externalLinkTarget(); + m_t << "<a class=\"elRef\" "; + m_t << externalLinkTarget(); } else { - t << "<a class=\"el\" "; + m_t << "<a class=\"el\" "; } - t << "href=\""; - t << externalRef(m_relPath,ref,TRUE); - if (f) t << addHtmlExtensionIfMissing(f); - if (anchor) t << "#" << anchor; - t << "\">"; + m_t << "href=\""; + m_t << externalRef(m_relPath,ref,TRUE); + if (f) m_t << addHtmlExtensionIfMissing(f); + if (anchor) m_t << "#" << anchor; + m_t << "\">"; docify(name); - t << "</a>"; + m_t << "</a>"; } void HtmlGenerator::startTextLink(const char *f,const char *anchor) { - t << "<a href=\""; - if (f) t << m_relPath << addHtmlExtensionIfMissing(f); - if (anchor) t << "#" << anchor; - t << "\">"; + m_t << "<a href=\""; + if (f) m_t << m_relPath << addHtmlExtensionIfMissing(f); + if (anchor) m_t << "#" << anchor; + m_t << "\">"; } void HtmlGenerator::endTextLink() { - t << "</a>"; + m_t << "</a>"; } void HtmlGenerator::startHtmlLink(const char *url) { bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); - t << "<a "; - if (generateTreeView) t << "target=\"top\" "; - t << "href=\""; - if (url) t << url; - t << "\">"; + m_t << "<a "; + if (generateTreeView) m_t << "target=\"top\" "; + m_t << "href=\""; + if (url) m_t << url; + m_t << "\">"; } void HtmlGenerator::endHtmlLink() { - t << "</a>"; + m_t << "</a>"; } void HtmlGenerator::startGroupHeader(int extraIndentLevel) { if (extraIndentLevel==2) { - t << "<h4 class=\"groupheader\">"; + m_t << "<h4 class=\"groupheader\">"; } else if (extraIndentLevel==1) { - t << "<h3 class=\"groupheader\">"; + m_t << "<h3 class=\"groupheader\">"; } else // extraIndentLevel==0 { - t << "<h2 class=\"groupheader\">"; + m_t << "<h2 class=\"groupheader\">"; } } @@ -1393,15 +1396,15 @@ void HtmlGenerator::endGroupHeader(int extraIndentLevel) { if (extraIndentLevel==2) { - t << "</h4>\n"; + m_t << "</h4>\n"; } else if (extraIndentLevel==1) { - t << "</h3>\n"; + m_t << "</h3>\n"; } else { - t << "</h2>\n"; + m_t << "</h2>\n"; } } @@ -1409,25 +1412,25 @@ void HtmlGenerator::startSection(const char *lab,const char *,SectionType type) { switch(type) { - case SectionType::Page: t << "\n\n<h1>"; break; - case SectionType::Section: t << "\n\n<h2>"; break; - case SectionType::Subsection: t << "\n\n<h3>"; break; - case SectionType::Subsubsection: t << "\n\n<h4>"; break; - case SectionType::Paragraph: t << "\n\n<h5>"; break; + case SectionType::Page: m_t << "\n\n<h1>"; break; + case SectionType::Section: m_t << "\n\n<h2>"; break; + case SectionType::Subsection: m_t << "\n\n<h3>"; break; + case SectionType::Subsubsection: m_t << "\n\n<h4>"; break; + case SectionType::Paragraph: m_t << "\n\n<h5>"; break; default: ASSERT(0); break; } - t << "<a id=\"" << lab << "\"></a>"; + m_t << "<a id=\"" << lab << "\"></a>"; } void HtmlGenerator::endSection(const char *,SectionType type) { switch(type) { - case SectionType::Page: t << "</h1>"; break; - case SectionType::Section: t << "</h2>"; break; - case SectionType::Subsection: t << "</h3>"; break; - case SectionType::Subsubsection: t << "</h4>"; break; - case SectionType::Paragraph: t << "</h5>"; break; + case SectionType::Page: m_t << "</h1>"; break; + case SectionType::Section: m_t << "</h2>"; break; + case SectionType::Subsection: m_t << "</h3>"; break; + case SectionType::Subsubsection: m_t << "</h4>"; break; + case SectionType::Paragraph: m_t << "</h5>"; break; default: ASSERT(0); break; } } @@ -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 << "<!-- startSectionHeader -->"; @@ -1501,13 +1504,13 @@ static void startSectionHeader(std::ostream &t, } } -static void endSectionHeader(std::ostream &t) +static void endSectionHeader(TextStream &t) { //t << "<!-- endSectionHeader -->"; t << "</div>\n"; } -static void startSectionSummary(std::ostream &t,int sectionCount) +static void startSectionSummary(TextStream &t,int sectionCount) { //t << "<!-- startSectionSummary -->"; bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); @@ -1519,7 +1522,7 @@ static void startSectionSummary(std::ostream &t,int sectionCount) } } -static void endSectionSummary(std::ostream &t) +static void endSectionSummary(TextStream &t) { //t << "<!-- endSectionSummary -->"; bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); @@ -1529,7 +1532,7 @@ static void endSectionSummary(std::ostream &t) } } -static void startSectionContent(std::ostream &t,int sectionCount) +static void startSectionContent(TextStream &t,int sectionCount) { //t << "<!-- startSectionContent -->"; bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); @@ -1545,7 +1548,7 @@ static void startSectionContent(std::ostream &t,int sectionCount) } } -static void endSectionContent(std::ostream &t) +static void endSectionContent(TextStream &t) { //t << "<!-- endSectionContent -->"; t << "</div>\n"; @@ -1555,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 << " <div class=\"center\">\n"; - t << " <img src=\""; - t << m_relPath << fileName << ".png\" usemap=\"#" << convertToId(name); - t << "_map\" alt=\"\"/>\n"; - t << " <map id=\"" << convertToId(name); - t << "_map\" name=\"" << convertToId(name); - t << "_map\">\n"; - t << tt.str(); - t << " </map>\n"; - t << "</div>"; + if (!tt.empty()) + { + m_t << " <div class=\"center\">\n"; + m_t << " <img src=\""; + m_t << m_relPath << fileName << ".png\" usemap=\"#" << convertToId(name); + m_t << "_map\" alt=\"\"/>\n"; + m_t << " <map id=\"" << convertToId(name); + m_t << "_map\" name=\"" << convertToId(name); + m_t << "_map\">\n"; + m_t << tt.str(); + m_t << " </map>\n"; + m_t << "</div>"; } else { - t << " <div class=\"center\">\n"; - t << " <img src=\""; - t << m_relPath << fileName << ".png\" alt=\"\"/>\n"; - t << " </div>"; + m_t << " <div class=\"center\">\n"; + m_t << " <img src=\""; + m_t << m_relPath << fileName << ".png\" alt=\"\"/>\n"; + m_t << " </div>"; } - endSectionContent(t); + endSectionContent(m_t); m_sectionCount++; } void HtmlGenerator::startMemberList() { - DBG_HTML(t << "<!-- startMemberList -->\n") + DBG_HTML(m_t << "<!-- startMemberList -->\n") } void HtmlGenerator::endMemberList() { - DBG_HTML(t << "<!-- endMemberList -->\n") + DBG_HTML(m_t << "<!-- endMemberList -->\n") } // anonymous type: @@ -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 << "<!-- startMemberItem() -->\n") + DBG_HTML(m_t << "<!-- startMemberItem() -->\n") if (m_emptySection) { - t << "<table class=\"memberdecls\">\n"; + m_t << "<table class=\"memberdecls\">\n"; m_emptySection=FALSE; } - t << "<tr class=\"memitem:" << (anchor?anchor:""); + m_t << "<tr class=\"memitem:" << (anchor?anchor:""); if (inheritId) { - t << " inherit " << inheritId; + m_t << " inherit " << inheritId; } - t << "\">"; + m_t << "\">"; insertMemberAlignLeft(annoType, true); } void HtmlGenerator::endMemberItem() { - t << "</td></tr>\n"; + m_t << "</td></tr>\n"; } void HtmlGenerator::startMemberTemplateParams() @@ -1634,63 +1637,63 @@ void HtmlGenerator::startMemberTemplateParams() void HtmlGenerator::endMemberTemplateParams(const char *anchor,const char *inheritId) { - t << "</td></tr>\n"; - t << "<tr class=\"memitem:" << (anchor?anchor:""); + m_t << "</td></tr>\n"; + m_t << "<tr class=\"memitem:" << (anchor?anchor:""); if (inheritId) { - t << " inherit " << inheritId; + m_t << " inherit " << inheritId; } - t << "\"><td class=\"memTemplItemLeft\" align=\"right\" valign=\"top\">"; + m_t << "\"><td class=\"memTemplItemLeft\" align=\"right\" valign=\"top\">"; } void HtmlGenerator::insertMemberAlign(bool templ) { - DBG_HTML(t << "<!-- insertMemberAlign -->\n") + DBG_HTML(m_t << "<!-- insertMemberAlign -->\n") QCString className = templ ? "memTemplItemRight" : "memItemRight"; - t << " </td><td class=\"" << className << "\" valign=\"bottom\">"; + m_t << " </td><td class=\"" << className << "\" valign=\"bottom\">"; } void HtmlGenerator::insertMemberAlignLeft(int annoType, bool initTag) { - if (!initTag) t << " </td>"; + if (!initTag) m_t << " </td>"; switch(annoType) { - case 0: t << "<td class=\"memItemLeft\" align=\"right\" valign=\"top\">"; break; - case 1: t << "<td class=\"memItemLeft\" >"; break; - case 2: t << "<td class=\"memItemLeft\" valign=\"top\">"; break; - default: t << "<td class=\"memTemplParams\" colspan=\"2\">"; break; + case 0: m_t << "<td class=\"memItemLeft\" align=\"right\" valign=\"top\">"; break; + case 1: m_t << "<td class=\"memItemLeft\" >"; break; + case 2: m_t << "<td class=\"memItemLeft\" valign=\"top\">"; break; + default: m_t << "<td class=\"memTemplParams\" colspan=\"2\">"; break; } } void HtmlGenerator::startMemberDescription(const char *anchor,const char *inheritId, bool typ) { - DBG_HTML(t << "<!-- startMemberDescription -->\n") + DBG_HTML(m_t << "<!-- startMemberDescription -->\n") if (m_emptySection) { - t << "<table class=\"memberdecls\">\n"; + m_t << "<table class=\"memberdecls\">\n"; m_emptySection=FALSE; } - t << "<tr class=\"memdesc:" << (anchor?anchor:""); + m_t << "<tr class=\"memdesc:" << (anchor?anchor:""); if (inheritId) { - t << " inherit " << inheritId; + m_t << " inherit " << inheritId; } - t << "\">"; - t << "<td class=\"mdescLeft\"> </td>"; - if (typ) t << "<td class=\"mdescLeft\"> </td>"; - t << "<td class=\"mdescRight\">";; + m_t << "\">"; + m_t << "<td class=\"mdescLeft\"> </td>"; + if (typ) m_t << "<td class=\"mdescLeft\"> </td>"; + m_t << "<td class=\"mdescRight\">";; } void HtmlGenerator::endMemberDescription() { - DBG_HTML(t << "<!-- endMemberDescription -->\n") - t << "<br /></td></tr>\n"; + DBG_HTML(m_t << "<!-- endMemberDescription -->\n") + m_t << "<br /></td></tr>\n"; } void HtmlGenerator::startMemberSections() { - DBG_HTML(t << "<!-- startMemberSections -->\n") + DBG_HTML(m_t << "<!-- startMemberSections -->\n") m_emptySection=TRUE; // we postpone writing <table> until we actually // write a row to prevent empty tables, which // are not valid XHTML! @@ -1698,364 +1701,364 @@ void HtmlGenerator::startMemberSections() void HtmlGenerator::endMemberSections() { - DBG_HTML(t << "<!-- endMemberSections -->\n") + DBG_HTML(m_t << "<!-- endMemberSections -->\n") if (!m_emptySection) { - t << "</table>\n"; + m_t << "</table>\n"; } } void HtmlGenerator::startMemberHeader(const char *anchor, int typ) { - DBG_HTML(t << "<!-- startMemberHeader -->\n") + DBG_HTML(m_t << "<!-- startMemberHeader -->\n") if (!m_emptySection) { - t << "</table>"; + m_t << "</table>"; m_emptySection=TRUE; } if (m_emptySection) { - t << "<table class=\"memberdecls\">\n"; + m_t << "<table class=\"memberdecls\">\n"; m_emptySection=FALSE; } - t << "<tr class=\"heading\"><td colspan=\"" << typ << "\"><h2 class=\"groupheader\">"; + m_t << "<tr class=\"heading\"><td colspan=\"" << typ << "\"><h2 class=\"groupheader\">"; if (anchor) { - t << "<a name=\"" << anchor << "\"></a>\n"; + m_t << "<a name=\"" << anchor << "\"></a>\n"; } } void HtmlGenerator::endMemberHeader() { - DBG_HTML(t << "<!-- endMemberHeader -->\n") - t << "</h2></td></tr>\n"; + DBG_HTML(m_t << "<!-- endMemberHeader -->\n") + m_t << "</h2></td></tr>\n"; } void HtmlGenerator::startMemberSubtitle() { - DBG_HTML(t << "<!-- startMemberSubtitle -->\n") - t << "<tr><td class=\"ititle\" colspan=\"2\">"; + DBG_HTML(m_t << "<!-- startMemberSubtitle -->\n") + m_t << "<tr><td class=\"ititle\" colspan=\"2\">"; } void HtmlGenerator::endMemberSubtitle() { - DBG_HTML(t << "<!-- endMemberSubtitle -->\n") - t << "</td></tr>\n"; + DBG_HTML(m_t << "<!-- endMemberSubtitle -->\n") + m_t << "</td></tr>\n"; } void HtmlGenerator::startIndexList() { - t << "<table>\n"; + m_t << "<table>\n"; } void HtmlGenerator::endIndexList() { - t << "</table>\n"; + m_t << "</table>\n"; } void HtmlGenerator::startIndexKey() { // inserted 'class = ...', 02 jan 2002, jh - t << " <tr><td class=\"indexkey\">"; + m_t << " <tr><td class=\"indexkey\">"; } void HtmlGenerator::endIndexKey() { - t << "</td>"; + m_t << "</td>"; } void HtmlGenerator::startIndexValue(bool) { // inserted 'class = ...', 02 jan 2002, jh - t << "<td class=\"indexvalue\">"; + m_t << "<td class=\"indexvalue\">"; } void HtmlGenerator::endIndexValue(const char *,bool) { - t << "</td></tr>\n"; + m_t << "</td></tr>\n"; } void HtmlGenerator::startMemberDocList() { - DBG_HTML(t << "<!-- startMemberDocList -->\n";) + DBG_HTML(m_t << "<!-- startMemberDocList -->\n";) } void HtmlGenerator::endMemberDocList() { - DBG_HTML(t << "<!-- endMemberDocList -->\n";) + DBG_HTML(m_t << "<!-- endMemberDocList -->\n";) } void HtmlGenerator::startMemberDoc( const char *clName, const char *memName, const char *anchor, const char *title, int memCount, int memTotal, bool showInline) { - DBG_HTML(t << "<!-- startMemberDoc -->\n";) - t << "\n<h2 class=\"memtitle\">" - << "<span class=\"permalink\"><a href=\"#" << anchor << "\">◆ </a></span>"; + DBG_HTML(m_t << "<!-- startMemberDoc -->\n";) + m_t << "\n<h2 class=\"memtitle\">" + << "<span class=\"permalink\"><a href=\"#" << anchor << "\">◆ </a></span>"; docify(title); if (memTotal>1) { - t << " <span class=\"overload\">[" << memCount << "/" << memTotal <<"]</span>"; + m_t << " <span class=\"overload\">[" << memCount << "/" << memTotal <<"]</span>"; } - t << "</h2>\n"; - t << "\n<div class=\"memitem\">\n"; - t << "<div class=\"memproto\">\n"; + m_t << "</h2>\n"; + m_t << "\n<div class=\"memitem\">\n"; + m_t << "<div class=\"memproto\">\n"; } void HtmlGenerator::startMemberDocPrefixItem() { - DBG_HTML(t << "<!-- startMemberDocPrefixItem -->\n";) - t << "<div class=\"memtemplate\">\n"; + DBG_HTML(m_t << "<!-- startMemberDocPrefixItem -->\n";) + m_t << "<div class=\"memtemplate\">\n"; } void HtmlGenerator::endMemberDocPrefixItem() { - DBG_HTML(t << "<!-- endMemberDocPrefixItem -->\n";) - t << "</div>\n"; + DBG_HTML(m_t << "<!-- endMemberDocPrefixItem -->\n";) + m_t << "</div>\n"; } void HtmlGenerator::startMemberDocName(bool /*align*/) { - DBG_HTML(t << "<!-- startMemberDocName -->\n";) + DBG_HTML(m_t << "<!-- startMemberDocName -->\n";) - t << " <table class=\"memname\">\n"; + m_t << " <table class=\"memname\">\n"; - t << " <tr>\n"; - t << " <td class=\"memname\">"; + m_t << " <tr>\n"; + m_t << " <td class=\"memname\">"; } void HtmlGenerator::endMemberDocName() { - DBG_HTML(t << "<!-- endMemberDocName -->\n";) - t << "</td>\n"; + DBG_HTML(m_t << "<!-- endMemberDocName -->\n";) + m_t << "</td>\n"; } void HtmlGenerator::startParameterList(bool openBracket) { - DBG_HTML(t << "<!-- startParameterList -->\n";) - t << " <td>"; - if (openBracket) t << "("; - t << "</td>\n"; + DBG_HTML(m_t << "<!-- startParameterList -->\n";) + m_t << " <td>"; + if (openBracket) m_t << "("; + m_t << "</td>\n"; } void HtmlGenerator::startParameterType(bool first,const char *key) { if (first) { - DBG_HTML(t << "<!-- startFirstParameterType -->\n";) - t << " <td class=\"paramtype\">"; + DBG_HTML(m_t << "<!-- startFirstParameterType -->\n";) + m_t << " <td class=\"paramtype\">"; } else { - DBG_HTML(t << "<!-- startParameterType -->\n";) - t << " <tr>\n"; - t << " <td class=\"paramkey\">"; - if (key) t << key; - t << "</td>\n"; - t << " <td></td>\n"; - t << " <td class=\"paramtype\">"; + DBG_HTML(m_t << "<!-- startParameterType -->\n";) + m_t << " <tr>\n"; + m_t << " <td class=\"paramkey\">"; + if (key) m_t << key; + m_t << "</td>\n"; + m_t << " <td></td>\n"; + m_t << " <td class=\"paramtype\">"; } } void HtmlGenerator::endParameterType() { - DBG_HTML(t << "<!-- endParameterType -->\n";) - t << " </td>\n"; + DBG_HTML(m_t << "<!-- endParameterType -->\n";) + m_t << " </td>\n"; } void HtmlGenerator::startParameterName(bool /*oneArgOnly*/) { - DBG_HTML(t << "<!-- startParameterName -->\n";) - t << " <td class=\"paramname\">"; + DBG_HTML(m_t << "<!-- startParameterName -->\n";) + m_t << " <td class=\"paramname\">"; } void HtmlGenerator::endParameterName(bool last,bool emptyList,bool closeBracket) { - DBG_HTML(t << "<!-- endParameterName -->\n";) + DBG_HTML(m_t << "<!-- endParameterName -->\n";) if (last) { if (emptyList) { - if (closeBracket) t << "</td><td>)"; - t << "</td>\n"; - t << " <td>"; + if (closeBracket) m_t << "</td><td>)"; + m_t << "</td>\n"; + m_t << " <td>"; } else { - t << " </td>\n"; - t << " </tr>\n"; - t << " <tr>\n"; - t << " <td></td>\n"; - t << " <td>"; - if (closeBracket) t << ")"; - t << "</td>\n"; - t << " <td></td><td>"; + m_t << " </td>\n"; + m_t << " </tr>\n"; + m_t << " <tr>\n"; + m_t << " <td></td>\n"; + m_t << " <td>"; + if (closeBracket) m_t << ")"; + m_t << "</td>\n"; + m_t << " <td></td><td>"; } } else { - t << "</td>\n"; - t << " </tr>\n"; + m_t << "</td>\n"; + m_t << " </tr>\n"; } } void HtmlGenerator::endParameterList() { - DBG_HTML(t << "<!-- endParameterList -->\n";) - t << "</td>\n"; - t << " </tr>\n"; + DBG_HTML(m_t << "<!-- endParameterList -->\n";) + m_t << "</td>\n"; + m_t << " </tr>\n"; } void HtmlGenerator::exceptionEntry(const char* prefix,bool closeBracket) { - DBG_HTML(t << "<!-- exceptionEntry -->\n";) - t << "</td>\n"; - t << " </tr>\n"; - t << " <tr>\n"; - t << " <td align=\"right\">"; + DBG_HTML(m_t << "<!-- exceptionEntry -->\n";) + m_t << "</td>\n"; + m_t << " </tr>\n"; + m_t << " <tr>\n"; + m_t << " <td align=\"right\">"; // colspan 2 so it gets both parameter type and parameter name columns if (prefix) - t << prefix << "</td><td>(</td><td colspan=\"2\">"; + m_t << prefix << "</td><td>(</td><td colspan=\"2\">"; else if (closeBracket) - t << "</td><td>)</td><td></td><td>"; + m_t << "</td><td>)</td><td></td><td>"; else - t << "</td><td></td><td colspan=\"2\">"; + m_t << "</td><td></td><td colspan=\"2\">"; } void HtmlGenerator::endMemberDoc(bool hasArgs) { - DBG_HTML(t << "<!-- endMemberDoc -->\n";) + DBG_HTML(m_t << "<!-- endMemberDoc -->\n";) if (!hasArgs) { - t << " </tr>\n"; + m_t << " </tr>\n"; } - t << " </table>\n"; - // t << "</div>\n"; + m_t << " </table>\n"; + // m_t << "</div>\n"; } void HtmlGenerator::startDotGraph() { - startSectionHeader(t,m_relPath,m_sectionCount); + startSectionHeader(m_t,m_relPath,m_sectionCount); } void HtmlGenerator::endDotGraph(DotClassGraph &g) { bool generateLegend = Config_getBool(GENERATE_LEGEND); bool umlLook = Config_getBool(UML_LOOK); - endSectionHeader(t); - startSectionSummary(t,m_sectionCount); - endSectionSummary(t); - startSectionContent(t,m_sectionCount); + endSectionHeader(m_t); + startSectionSummary(m_t,m_sectionCount); + endSectionSummary(m_t); + startSectionContent(m_t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,TRUE,m_sectionCount); + g.writeGraph(m_t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,TRUE,m_sectionCount); if (generateLegend && !umlLook) { - t << "<center><span class=\"legend\">["; + m_t << "<center><span class=\"legend\">["; startHtmlLink(m_relPath+"graph_legend"+Doxygen::htmlFileExtension); - t << theTranslator->trLegend(); + m_t << theTranslator->trLegend(); endHtmlLink(); - t << "]</span></center>"; + m_t << "]</span></center>"; } - endSectionContent(t); + endSectionContent(m_t); m_sectionCount++; } void HtmlGenerator::startInclDepGraph() { - startSectionHeader(t,m_relPath,m_sectionCount); + startSectionHeader(m_t,m_relPath,m_sectionCount); } void HtmlGenerator::endInclDepGraph(DotInclDepGraph &g) { - endSectionHeader(t); - startSectionSummary(t,m_sectionCount); - endSectionSummary(t); - startSectionContent(t,m_sectionCount); + endSectionHeader(m_t); + startSectionSummary(m_t,m_sectionCount); + endSectionSummary(m_t); + startSectionContent(m_t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); + g.writeGraph(m_t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); - endSectionContent(t); + endSectionContent(m_t); m_sectionCount++; } void HtmlGenerator::startGroupCollaboration() { - startSectionHeader(t,m_relPath,m_sectionCount); + startSectionHeader(m_t,m_relPath,m_sectionCount); } void HtmlGenerator::endGroupCollaboration(DotGroupCollaboration &g) { - endSectionHeader(t); - startSectionSummary(t,m_sectionCount); - endSectionSummary(t); - startSectionContent(t,m_sectionCount); + endSectionHeader(m_t); + startSectionSummary(m_t,m_sectionCount); + endSectionSummary(m_t); + startSectionContent(m_t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); + g.writeGraph(m_t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); - endSectionContent(t); + endSectionContent(m_t); m_sectionCount++; } void HtmlGenerator::startCallGraph() { - startSectionHeader(t,m_relPath,m_sectionCount); + startSectionHeader(m_t,m_relPath,m_sectionCount); } void HtmlGenerator::endCallGraph(DotCallGraph &g) { - endSectionHeader(t); - startSectionSummary(t,m_sectionCount); - endSectionSummary(t); - startSectionContent(t,m_sectionCount); + endSectionHeader(m_t); + startSectionSummary(m_t,m_sectionCount); + endSectionSummary(m_t); + startSectionContent(m_t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); + g.writeGraph(m_t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); - endSectionContent(t); + endSectionContent(m_t); m_sectionCount++; } void HtmlGenerator::startDirDepGraph() { - startSectionHeader(t,m_relPath,m_sectionCount); + startSectionHeader(m_t,m_relPath,m_sectionCount); } void HtmlGenerator::endDirDepGraph(DotDirDeps &g) { - endSectionHeader(t); - startSectionSummary(t,m_sectionCount); - endSectionSummary(t); - startSectionContent(t,m_sectionCount); + endSectionHeader(m_t); + startSectionSummary(m_t,m_sectionCount); + endSectionSummary(m_t); + startSectionContent(m_t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); + g.writeGraph(m_t,GOF_BITMAP,EOF_Html,dir(),fileName(),m_relPath,TRUE,m_sectionCount); - endSectionContent(t); + endSectionContent(m_t); m_sectionCount++; } void HtmlGenerator::writeGraphicalHierarchy(DotGfxHierarchyTable &g) { - g.writeGraph(t,dir(),fileName()); + g.writeGraph(m_t,dir(),fileName()); } void HtmlGenerator::startMemberGroupHeader(bool) { - t << "<tr><td colspan=\"2\"><div class=\"groupHeader\">"; + m_t << "<tr><td colspan=\"2\"><div class=\"groupHeader\">"; } void HtmlGenerator::endMemberGroupHeader() { - t << "</div></td></tr>\n"; + m_t << "</div></td></tr>\n"; } void HtmlGenerator::startMemberGroupDocs() { - t << "<tr><td colspan=\"2\"><div class=\"groupText\">"; + m_t << "<tr><td colspan=\"2\"><div class=\"groupText\">"; } void HtmlGenerator::endMemberGroupDocs() { - t << "</div></td></tr>\n"; + m_t << "</div></td></tr>\n"; } void HtmlGenerator::startMemberGroup() @@ -2068,15 +2071,15 @@ void HtmlGenerator::endMemberGroup(bool) void HtmlGenerator::startIndent() { - DBG_HTML(t << "<!-- startIndent -->\n";) + DBG_HTML(m_t << "<!-- startIndent -->\n";) - t << "<div class=\"memdoc\">\n"; + m_t << "<div class=\"memdoc\">\n"; } void HtmlGenerator::endIndent() { - DBG_HTML(t << "<!-- endIndent -->\n";) - t << "\n</div>\n" << "</div>\n"; + DBG_HTML(m_t << "<!-- endIndent -->\n";) + m_t << "\n</div>\n" << "</div>\n"; } void HtmlGenerator::addIndexItem(const char *,const char *) @@ -2088,86 +2091,86 @@ void HtmlGenerator::writeNonBreakableSpace(int n) int i; for (i=0;i<n;i++) { - t << " "; + m_t << " "; } } void HtmlGenerator::startDescTable(const char *title) { - t << "<table class=\"fieldtable\">\n" - << "<tr><th colspan=\"2\">" << title << "</th></tr>"; + m_t << "<table class=\"fieldtable\">\n" + << "<tr><th colspan=\"2\">" << title << "</th></tr>"; } void HtmlGenerator::endDescTable() { - t << "</table>\n"; + m_t << "</table>\n"; } void HtmlGenerator::startDescTableRow() { - t << "<tr>"; + m_t << "<tr>"; } void HtmlGenerator::endDescTableRow() { - t << "</tr>\n"; + m_t << "</tr>\n"; } void HtmlGenerator::startDescTableTitle() { - t << "<td class=\"fieldname\">"; + m_t << "<td class=\"fieldname\">"; } void HtmlGenerator::endDescTableTitle() { - t << " </td>"; + m_t << " </td>"; } void HtmlGenerator::startDescTableData() { - t << "<td class=\"fielddoc\">"; + m_t << "<td class=\"fielddoc\">"; } void HtmlGenerator::endDescTableData() { - t << "</td>"; + m_t << "</td>"; } void HtmlGenerator::startExamples() { - t << "<dl class=\"section examples\"><dt>"; + m_t << "<dl class=\"section examples\"><dt>"; docify(theTranslator->trExamples()); - t << "</dt>"; + m_t << "</dt>"; } void HtmlGenerator::endExamples() { - t << "</dl>\n"; + m_t << "</dl>\n"; } void HtmlGenerator::startParamList(ParamListTypes, const char *title) { - t << "<dl><dt><b>"; + m_t << "<dl><dt><b>"; docify(title); - t << "</b></dt>"; + m_t << "</b></dt>"; } void HtmlGenerator::endParamList() { - t << "</dl>"; + m_t << "</dl>"; } void HtmlGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *,int id) { m_codeGen.setId(id); - HtmlDocVisitor *visitor = new HtmlDocVisitor(t,m_codeGen,ctx); + HtmlDocVisitor *visitor = new HtmlDocVisitor(m_t,m_codeGen,ctx); n->accept(visitor); delete visitor; } //---------------- helpers for index generation ----------------------------- -static void startQuickIndexList(std::ostream &t,bool compact,bool topLevel=TRUE) +static void startQuickIndexList(TextStream &t,bool compact,bool topLevel=TRUE) { if (compact) { @@ -2187,7 +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 << "<span>"; } -static void endQuickIndexItem(std::ostream &t,const char *l) +static void endQuickIndexItem(TextStream &t,const char *l) { t << "</span>"; if (l) t << "</a>"; @@ -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 << "</div><!-- top -->\n"; + m_t << "</div><!-- top -->\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( - "<div id=\"side-nav\" class=\"ui-resizable side-nav-resizable\">\n" - " <div id=\"nav-tree\">\n" - " <div id=\"nav-tree-contents\">\n" - " <div id=\"nav-sync\" class=\"sync\"></div>\n" - " </div>\n" - " </div>\n" - " <div id=\"splitbar\" style=\"-moz-user-select:none;\" \n" - " class=\"ui-resizable-handle\">\n" - " </div>\n" - "</div>\n" - "<script type=\"text/javascript\">\n" - "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n" - "$(document).ready(function(){initNavTree('") + - QCString(addHtmlExtensionIfMissing(name)) + - QCString("','") + relpath + - QCString("'); initResizable(); });\n" - "/* @license-end */\n" - "</script>\n" - "<div id=\"doc-content\">\n"); + "<div id=\"side-nav\" class=\"ui-resizable side-nav-resizable\">\n" + " <div id=\"nav-tree\">\n" + " <div id=\"nav-tree-contents\">\n" + " <div id=\"nav-sync\" class=\"sync\"></div>\n" + " </div>\n" + " </div>\n" + " <div id=\"splitbar\" style=\"-moz-user-select:none;\" \n" + " class=\"ui-resizable-handle\">\n" + " </div>\n" + "</div>\n" + "<script type=\"text/javascript\">\n" + "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n" + "$(document).ready(function(){initNavTree('") + + QCString(addHtmlExtensionIfMissing(name)) + + QCString("','") + relpath + + QCString("'); initResizable(); });\n" + "/* @license-end */\n" + "</script>\n" + "<div id=\"doc-content\">\n"); } return result; } void HtmlGenerator::writeSplitBar(const char *name) { - 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 << "<div class=\"contents\">\n"; + m_t << "<div class=\"contents\">\n"; } void HtmlGenerator::endContents() { - t << "</div><!-- contents -->\n"; + m_t << "</div><!-- contents -->\n"; } void HtmlGenerator::startPageDoc(const char *pageTitle) { - t << "<div>"; + m_t << "<div>"; } void HtmlGenerator::endPageDoc() { - t << "</div><!-- PageDoc -->\n"; + m_t << "</div><!-- PageDoc -->\n"; } void HtmlGenerator::writeQuickLinks(bool compact,HighlightedItem hli,const char *file) { - 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 << "<?php\n\n"; t << "$config = array(\n"; t << " 'PROJECT_NAME' => \"" << 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 << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " @@ -2628,12 +2633,13 @@ void HtmlGenerator::writeSearchPage() writePageFooter(t,"Search","",""); } - t.close(); + f.close(); QCString scriptName = htmlOutput+"/search/search.js"; - t.open(scriptName.str(),std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + f.open(scriptName.str(),std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); t << ResourceMgr::instance().getAsString("extsearch.js"); } else @@ -2647,9 +2653,10 @@ void HtmlGenerator::writeExternalSearchPage() bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); QCString dname = Config_getString(HTML_OUTPUT); QCString fileName = dname+"/search"+Doxygen::htmlFileExtension; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); t << substituteHtmlKeywords(g_header,"Search",""); t << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " @@ -2695,12 +2702,13 @@ void HtmlGenerator::writeExternalSearchPage() writePageFooter(t,"Search","",""); } - t.close(); + f.close(); QCString scriptName = dname+"/search/search.js"; - t.open(scriptName.str(),std::ofstream::out | std::ofstream::binary); - if (t.is_open()) + f.open(scriptName.str(),std::ofstream::out | std::ofstream::binary); + if (f.is_open()) { + TextStream t(&f); t << "var searchResultsText=[" << "\"" << theTranslator->trSearchResults(0) << "\"," << "\"" << theTranslator->trSearchResults(1) << "\"," @@ -2748,167 +2756,167 @@ void HtmlGenerator::writeExternalSearchPage() void HtmlGenerator::startConstraintList(const char *header) { - t << "<div class=\"typeconstraint\">\n"; - t << "<dl><dt><b>" << header << "</b></dt><dd>\n"; - t << "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\">\n"; + m_t << "<div class=\"typeconstraint\">\n"; + m_t << "<dl><dt><b>" << header << "</b></dt><dd>\n"; + m_t << "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\">\n"; } void HtmlGenerator::startConstraintParam() { - t << "<tr><td valign=\"top\"><em>"; + m_t << "<tr><td valign=\"top\"><em>"; } void HtmlGenerator::endConstraintParam() { - t << "</em></td>"; + m_t << "</em></td>"; } void HtmlGenerator::startConstraintType() { - t << "<td> :</td><td valign=\"top\"><em>"; + m_t << "<td> :</td><td valign=\"top\"><em>"; } void HtmlGenerator::endConstraintType() { - t << "</em></td>"; + m_t << "</em></td>"; } void HtmlGenerator::startConstraintDocs() { - t << "<td> "; + m_t << "<td> "; } void HtmlGenerator::endConstraintDocs() { - t << "</td></tr>\n"; + m_t << "</td></tr>\n"; } void HtmlGenerator::endConstraintList() { - t << "</table>\n"; - t << "</dd>\n"; - t << "</dl>\n"; - t << "</div>\n"; + m_t << "</table>\n"; + m_t << "</dd>\n"; + m_t << "</dl>\n"; + m_t << "</div>\n"; } void HtmlGenerator::lineBreak(const char *style) { if (style) { - t << "<br class=\"" << style << "\" />\n"; + m_t << "<br class=\"" << style << "\" />\n"; } else { - t << "<br />\n"; + m_t << "<br />\n"; } } void HtmlGenerator::startHeaderSection() { - t << "<div class=\"header\">\n"; + m_t << "<div class=\"header\">\n"; } void HtmlGenerator::startTitleHead(const char *) { - t << " <div class=\"headertitle\">\n"; + m_t << " <div class=\"headertitle\">\n"; startTitle(); } void HtmlGenerator::endTitleHead(const char *,const char *) { endTitle(); - t << " </div>\n"; + m_t << " </div>\n"; } void HtmlGenerator::endHeaderSection() { - t << "</div><!--header-->\n"; + m_t << "</div><!--header-->\n"; } void HtmlGenerator::startInlineHeader() { if (m_emptySection) { - t << "<table class=\"memberdecls\">\n"; + m_t << "<table class=\"memberdecls\">\n"; m_emptySection=FALSE; } - t << "<tr><td colspan=\"2\"><h3>"; + m_t << "<tr><td colspan=\"2\"><h3>"; } void HtmlGenerator::endInlineHeader() { - t << "</h3></td></tr>\n"; + m_t << "</h3></td></tr>\n"; } void HtmlGenerator::startMemberDocSimple(bool isEnum) { - DBG_HTML(t << "<!-- startMemberDocSimple -->\n";) - t << "<table class=\"fieldtable\">\n"; - t << "<tr><th colspan=\"" << (isEnum?"2":"3") << "\">"; - t << (isEnum? theTranslator->trEnumerationValues() : + DBG_HTML(m_t << "<!-- startMemberDocSimple -->\n";) + m_t << "<table class=\"fieldtable\">\n"; + m_t << "<tr><th colspan=\"" << (isEnum?"2":"3") << "\">"; + m_t << (isEnum? theTranslator->trEnumerationValues() : theTranslator->trCompoundMembers()) << "</th></tr>\n"; } void HtmlGenerator::endMemberDocSimple(bool) { - DBG_HTML(t << "<!-- endMemberDocSimple -->\n";) - t << "</table>\n"; + DBG_HTML(m_t << "<!-- endMemberDocSimple -->\n";) + m_t << "</table>\n"; } void HtmlGenerator::startInlineMemberType() { - DBG_HTML(t << "<!-- startInlineMemberType -->\n";) - t << "<tr><td class=\"fieldtype\">\n"; + DBG_HTML(m_t << "<!-- startInlineMemberType -->\n";) + m_t << "<tr><td class=\"fieldtype\">\n"; } void HtmlGenerator::endInlineMemberType() { - DBG_HTML(t << "<!-- endInlineMemberType -->\n";) - t << "</td>\n"; + DBG_HTML(m_t << "<!-- endInlineMemberType -->\n";) + m_t << "</td>\n"; } void HtmlGenerator::startInlineMemberName() { - DBG_HTML(t << "<!-- startInlineMemberName -->\n";) - t << "<td class=\"fieldname\">\n"; + DBG_HTML(m_t << "<!-- startInlineMemberName -->\n";) + m_t << "<td class=\"fieldname\">\n"; } void HtmlGenerator::endInlineMemberName() { - DBG_HTML(t << "<!-- endInlineMemberName -->\n";) - t << "</td>\n"; + DBG_HTML(m_t << "<!-- endInlineMemberName -->\n";) + m_t << "</td>\n"; } void HtmlGenerator::startInlineMemberDoc() { - DBG_HTML(t << "<!-- startInlineMemberDoc -->\n";) - t << "<td class=\"fielddoc\">\n"; + DBG_HTML(m_t << "<!-- startInlineMemberDoc -->\n";) + m_t << "<td class=\"fielddoc\">\n"; } void HtmlGenerator::endInlineMemberDoc() { - DBG_HTML(t << "<!-- endInlineMemberDoc -->\n";) - t << "</td></tr>\n"; + DBG_HTML(m_t << "<!-- endInlineMemberDoc -->\n";) + m_t << "</td></tr>\n"; } void HtmlGenerator::startLabels() { - DBG_HTML(t << "<!-- startLabels -->\n";) - t << "<span class=\"mlabels\">"; + DBG_HTML(m_t << "<!-- startLabels -->\n";) + m_t << "<span class=\"mlabels\">"; } void HtmlGenerator::writeLabel(const char *l,bool /*isLast*/) { - DBG_HTML(t << "<!-- writeLabel(" << l << ") -->\n";) - //t << "<tt>[" << l << "]</tt>"; - //if (!isLast) t << ", "; - t << "<span class=\"mlabel\">" << l << "</span>"; + DBG_HTML(m_t << "<!-- writeLabel(" << l << ") -->\n";) + //m_t << "<tt>[" << l << "]</tt>"; + //if (!isLast) m_t << ", "; + m_t << "<span class=\"mlabel\">" << l << "</span>"; } void HtmlGenerator::endLabels() { - DBG_HTML(t << "<!-- endLabels -->\n";) - t << "</span>"; + DBG_HTML(m_t << "<!-- endLabels -->\n";) + m_t << "</span>"; } void HtmlGenerator::writeInheritedSectionTitle( @@ -2916,7 +2924,7 @@ void HtmlGenerator::writeInheritedSectionTitle( const char *file, const char *anchor, const char *title, const char *name) { - DBG_HTML(t << "<!-- writeInheritedSectionTitle -->\n";) + DBG_HTML(m_t << "<!-- writeInheritedSectionTitle -->\n";) QCString a = anchor; if (!a.isEmpty()) a.prepend("#"); QCString classLink = QCString("<a class=\"el\" "); @@ -2933,7 +2941,7 @@ void HtmlGenerator::writeInheritedSectionTitle( } classLink=classLink+addHtmlExtensionIfMissing(file)+a; classLink+=QCString("\">")+convertToHtml(name,FALSE)+"</a>"; - t << "<tr class=\"inherit_header " << id << "\">" + m_t << "<tr class=\"inherit_header " << id << "\">" << "<td colspan=\"2\" onclick=\"javascript:toggleInherit('" << id << "')\">" << "<img src=\"" << m_relPath << "closed.png\" alt=\"-\"/> " << theTranslator->trInheritedFrom(convertToHtml(title,FALSE),classLink) @@ -2944,35 +2952,35 @@ void HtmlGenerator::writeSummaryLink(const char *file,const char *anchor,const c { if (first) { - t << " <div class=\"summary\">\n"; + m_t << " <div class=\"summary\">\n"; } else { - t << " |\n"; + m_t << " |\n"; } - t << "<a href=\""; + m_t << "<a href=\""; if (file) { - t << m_relPath << addHtmlExtensionIfMissing(file); + m_t << m_relPath << addHtmlExtensionIfMissing(file); } else if (anchor) { - t << "#"; - t << anchor; + m_t << "#"; + m_t << anchor; } - t << "\">"; - t << title; - t << "</a>"; + m_t << "\">"; + m_t << title; + m_t << "</a>"; } void HtmlGenerator::endMemberDeclaration(const char *anchor,const char *inheritId) { - t << "<tr class=\"separator:" << (anchor?anchor:""); + m_t << "<tr class=\"separator:" << (anchor?anchor:""); if (inheritId) { - t << " inherit " << inheritId; + m_t << " inherit " << inheritId; } - t << "\"><td class=\"memSeparator\" colspan=\"2\"> </td></tr>\n"; + m_t << "\"><td class=\"memSeparator\" colspan=\"2\"> </td></tr>\n"; } void HtmlGenerator::setCurrentDoc(const Definition *context,const char *anchor,bool isSourceFile) 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 << "<div class=\"title\">"; } - void endTitle() { t << "</div>"; } + void startTitle() { m_t << "<div class=\"title\">"; } + void endTitle() { m_t << "</div>"; } 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 << "<ul>\n"; } - void endItemList() { t << "</ul>\n"; } + void startItemList() { m_t << "<ul>\n"; } + void endItemList() { m_t << "</ul>\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 << "<code>"; } - void endTypewriter() { t << "</code>"; } + void startTypewriter() { m_t << "<code>"; } + void endTypewriter() { m_t << "</code>"; } void startGroupHeader(int); void endGroupHeader(int); - void startItemListItem() { t << "<li>"; } - void endItemListItem() { t << "</li>\n"; } + void startItemListItem() { m_t << "<li>"; } + void endItemListItem() { m_t << "</li>\n"; } void startMemberSections(); void endMemberSections(); @@ -205,19 +205,19 @@ class HtmlGenerator : public OutputGenerator const char *file, const char *anchor, const char *title,const char *name); - void writeRuler() { t << "<hr/>"; } + void writeRuler() { m_t << "<hr/>"; } void writeAnchor(const char *,const char *name) - { t << "<a name=\"" << name <<"\" id=\"" << name << "\"></a>"; } - void startEmphasis() { t << "<em>"; } - void endEmphasis() { t << "</em>"; } - void startBold() { t << "<b>"; } - void endBold() { t << "</b>"; } - void startDescription() { t << "\n<dl>\n"; } - void endDescription() { t << "\n</dl>\n\n"; } - void startDescItem() { t << "<dt>"; } - void endDescItem() { t << "</dt>"; } - void startDescForItem() { t << "<dd>"; } - void endDescForItem() { t << "</dd>\n"; } + { m_t << "<a name=\"" << name <<"\" id=\"" << name << "\"></a>"; } + void startEmphasis() { m_t << "<em>"; } + void endEmphasis() { m_t << "</em>"; } + void startBold() { m_t << "<b>"; } + void endBold() { m_t << "</b>"; } + void startDescription() { m_t << "\n<dl>\n"; } + void endDescription() { m_t << "\n</dl>\n\n"; } + void startDescItem() { m_t << "<dt>"; } + void endDescItem() { m_t << "</dt>"; } + void startDescForItem() { m_t << "<dd>"; } + void endDescForItem() { m_t << "</dd>\n"; } void lineBreak(const 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 << "<h2>"; } - void endSubsection() { t << "</h2>\n"; } - void startSubsubsection() { t << "<h3>"; } - void endSubsubsection() { t << "</h3>\n"; } - void startCenter() { t << "<center>\n"; } - void endCenter() { t << "</center>\n"; } - void startSmall() { t << "<small>\n"; } - void endSmall() { t << "</small>\n"; } + void writeEndAnnoItem(const char *) { m_t << "\n"; } + void startSubsection() { m_t << "<h2>"; } + void endSubsection() { m_t << "</h2>\n"; } + void startSubsubsection() { m_t << "<h3>"; } + void endSubsubsection() { m_t << "</h3>\n"; } + void startCenter() { m_t << "<center>\n"; } + void endCenter() { m_t << "</center>\n"; } + void startSmall() { m_t << "<small>\n"; } + void endSmall() { m_t << "</small>\n"; } void startExamples(); void endExamples(); void startParamList(ParamListTypes,const char *); @@ -289,9 +289,9 @@ class HtmlGenerator : public OutputGenerator void writeGraphicalHierarchy(DotGfxHierarchyTable &g); void startTextBlock(bool) - { t << "<div class=\"textblock\">"; } + { m_t << "<div class=\"textblock\">"; } void endTextBlock(bool) - { t << "</div>"; } + { m_t << "</div>"; } void lastIndexPage() {} void startMemberDocPrefixItem(); @@ -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<newSize;i++) indexWritten.at(i)=FALSE; } diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index ddaa97b..68c050f 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -52,7 +52,7 @@ static const char *getSectionName(int level) return secLabels[std::min(maxLevels-1,l)]; } -static void visitPreStart(std::ostream &t, bool hasCaption, QCString name, QCString width, QCString height, bool inlineImage = FALSE) +static void visitPreStart(TextStream &t, bool hasCaption, QCString name, QCString width, QCString height, bool inlineImage = FALSE) { if (inlineImage) { @@ -122,7 +122,7 @@ static void visitPreStart(std::ostream &t, bool hasCaption, QCString name, QCSt -static void visitPostEnd(std::ostream &t, bool hasCaption, bool inlineImage = FALSE) +static void visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage = FALSE) { if (inlineImage) { @@ -176,7 +176,7 @@ QCString LatexDocVisitor::escapeMakeIndexChars(const char *s) } -LatexDocVisitor::LatexDocVisitor(std::ostream &t,LatexCodeGenerator &ci, +LatexDocVisitor::LatexDocVisitor(TextStream &t,LatexCodeGenerator &ci, const char *langExt,bool insideTabbing) : DocVisitor(DocVisitor_Latex), m_t(t), m_ci(ci), m_insidePre(FALSE), m_insideItem(FALSE), m_hide(FALSE), m_hideCaption(FALSE), m_insideTabbing(insideTabbing), @@ -1045,7 +1045,7 @@ static bool tableIsNested(const DocNode *n) return isNested; } -static void writeStartTableCommand(std::ostream &t,const DocNode *n,int cols) +static void writeStartTableCommand(TextStream &t,const DocNode *n,int cols) { if (tableIsNested(n)) { @@ -1058,7 +1058,7 @@ static void writeStartTableCommand(std::ostream &t,const DocNode *n,int cols) //return isNested ? "TabularNC" : "TabularC"; } -static void writeEndTableCommand(std::ostream &t,const DocNode *n) +static void writeEndTableCommand(TextStream &t,const DocNode *n) { if (tableIsNested(n)) { diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h index 5e590eb..8c04f39 100644 --- a/src/latexdocvisitor.h +++ b/src/latexdocvisitor.h @@ -22,12 +22,13 @@ #include "docvisitor.h" class LatexCodeGenerator; +class TextStream; /*! @brief Concrete visitor implementation for LaTeX output. */ class LatexDocVisitor : public DocVisitor { public: - LatexDocVisitor(std::ostream &t,LatexCodeGenerator &ci, + LatexDocVisitor(TextStream &t,LatexCodeGenerator &ci, const char *langExt,bool insideTabbing); //-------------------------------------- @@ -176,7 +177,7 @@ class LatexDocVisitor : public DocVisitor // state variables //-------------------------------------- - std::ostream &m_t; + TextStream &m_t; LatexCodeGenerator &m_ci; bool m_insidePre; bool m_insideItem; diff --git a/src/latexgen.cpp b/src/latexgen.cpp index c0c3e47..a7d01f6 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -49,7 +49,7 @@ static QCString g_header; static QCString g_footer; -LatexCodeGenerator::LatexCodeGenerator(std::ostream &t,const QCString &relPath,const QCString &sourceFileName) +LatexCodeGenerator::LatexCodeGenerator(TextStream &t,const QCString &relPath,const QCString &sourceFileName) : m_t(nullptr), m_relPath(relPath), m_sourceFileName(sourceFileName) { m_prettyCode=Config_getBool(LATEX_SOURCE_CODE); @@ -61,9 +61,9 @@ LatexCodeGenerator::LatexCodeGenerator() : m_t(nullptr) m_prettyCode=Config_getBool(LATEX_SOURCE_CODE); } -void LatexCodeGenerator::setTextStream(std::ostream &t) +void LatexCodeGenerator::setTextStream(TextStream &t) { - m_t.rdbuf(t.rdbuf()); + m_t = t; } void LatexCodeGenerator::setRelativePath(const QCString &path) @@ -292,11 +292,12 @@ static void writeLatexMakefile() { bool generateBib = !CitationManager::instance().isEmpty(); QCString fileName=Config_getString(LATEX_OUTPUT)+"/Makefile"; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { term("Could not open file %s for writing\n",fileName.data()); } + TextStream t(&f); // inserted by KONNO Akihisa <konno@researchers.jp> 2002-03-05 QCString latex_command = theTranslator->latexCommandName(); QCString mkidx_command = Config_getString(MAKEINDEX_CMD_NAME); @@ -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<m_indent+2;i++) t << "\\>"; - t << "{\\em "; + for (int i=0;i<m_indent+2;i++) m_t << "\\>"; + 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<OutputGenerator> clone() const; static void init(); - static void writeStyleSheetFile(std::ostream &t); - static void writeHeaderFile(std::ostream &t); - static void writeFooterFile(std::ostream &t); + static void writeStyleSheetFile(TextStream &t); + static void writeHeaderFile(TextStream &t); + static void writeFooterFile(TextStream &t); virtual OutputType type() const { return Latex; } @@ -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;i<n;i++) t << " "; } + void writeNonBreakableSpace(int n) { int i; for (i=0;i<n;i++) m_t << " "; } void startDescTable(const char *t); void endDescTable(); @@ -194,7 +194,7 @@ class ManGenerator : public OutputGenerator void endDescTableRow() {} void startDescTableTitle() { startItemListItem(); startBold(); startEmphasis(); endItemListItem(); } void endDescTableTitle() { endEmphasis(); endBold(); } - void startDescTableData() { t << "\n"; m_firstCol=TRUE; } + void startDescTableData() { m_t << "\n"; m_firstCol=TRUE; } void endDescTableData() {} void startDotGraph() {} diff --git a/src/markdown.cpp b/src/markdown.cpp index d7ec28d..3de454b 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -2729,7 +2729,7 @@ QCString Markdown::process(const QCString &input, int &startNewlines) if (p>result.data()) { // strip part of the input - result = result.mid(p-result.data()); + result = result.mid(static_cast<int>(p-result.data())); } return result; } 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<MemberDefMutable> 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 << " <member kind=\""; diff --git a/src/memberdef.h b/src/memberdef.h index 3f9fb92..d2d6e1d 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -409,7 +409,7 @@ class MemberDefMutable : public DefinitionMutable, public MemberDef bool inGroup,bool showEnumValues=FALSE,bool showInline=FALSE) const = 0; virtual void writeMemberDocSimple(OutputList &ol,const Definition *container) const = 0; - virtual void writeTagFile(std::ostream &) const = 0; + virtual void writeTagFile(TextStream &) const = 0; virtual void writeLink(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd, bool onlyText=FALSE) const = 0; diff --git a/src/membergroup.cpp b/src/membergroup.cpp index 38d5503..3b5ccd6 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -295,7 +295,7 @@ void MemberGroup::setRefItems(const RefItemVector &sli) m_xrefListItems.insert(m_xrefListItems.end(), sli.cbegin(), sli.cend()); } -void MemberGroup::writeTagFile(std::ostream &tagFile) +void MemberGroup::writeTagFile(TextStream &tagFile) { memberList->writeTagFile(tagFile); } diff --git a/src/membergroup.h b/src/membergroup.h index 178a0f9..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, @@ -16,9 +16,8 @@ #ifndef _MSC_H #define _MSC_H -#include <iostream> - 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<NamespaceDefMutable> virtual void writeDocumentation(OutputList &ol); virtual void writeMemberPages(OutputList &ol); virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const; - virtual void writeTagFile(std::ostream &); + virtual void writeTagFile(TextStream &); virtual void insertClass(const ClassDef *cd); virtual void insertNamespace(const NamespaceDef *nd); virtual void insertMember(MemberDef *md); @@ -125,7 +125,7 @@ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> void endMemberDocumentation(OutputList &ol); void writeSummaryLinks(OutputList &ol) const; void addNamespaceAttributes(OutputList &ol); - void writeClassesToTagFile(std::ostream &,const ClassLinkedRefMap &d); + void writeClassesToTagFile(TextStream &,const ClassLinkedRefMap &d); void 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 << " <compound kind=\"namespace\">\n"; tagFile << " <name>" << convertToXML(name()) << "</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<PageDef> virtual QCString displayName(bool=TRUE) const { return hasTitle() ? m_title : DefinitionMixin::name(); } virtual bool showLineNo() const; virtual void writeDocumentation(OutputList &ol); - virtual void writeTagFile(std::ostream &); + virtual void writeTagFile(TextStream &); virtual void setNestingLevel(int l); virtual void writePageDocumentation(OutputList &ol) const; @@ -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<Entry> rt) for (size_t i=0; i<rt->children().size(); ++i) { std::shared_ptr<Entry> ce = rt->children()[i]; - if (ce->program.tellp() != std::streampos(0)) + if (!ce->program.empty()) { //fprintf(stderr,"parseCompounds: -- %s (line %d) ---------\n%s\n---------------\n", // ce->name.data(), ce->bodyLine, ce->program.data()); 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 <iostream> #include <sstream> +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 "<<rtf_Style["Footer"].reference() << "{\\chpgn}}\n"; + m_t << rtf_Style_Reset <<"\n"; + m_t << "\\sectd\\pgnlcrm\n"; + m_t << "{\\footer "<<rtf_Style["Footer"].reference() << "{\\chpgn}}\n"; // the title entry - DBG_RTF(t << "{\\comment begin title page}\n") + DBG_RTF(m_t << "{\\comment begin title page}\n") - t << rtf_Style_Reset << rtf_Style["SubTitle"].reference() << "\n"; // set to title style + m_t << rtf_Style_Reset << rtf_Style["SubTitle"].reference() << "\n"; // set to title style - t << "\\vertalc\\qc\\par\\par\\par\\par\\par\\par\\par\n"; + m_t << "\\vertalc\\qc\\par\\par\\par\\par\\par\\par\\par\n"; if (rtf_logoFilename) { - t << "{\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"" << rtf_logoFilename; - t << "\" \\\\d \\\\*MERGEFORMAT} {\\fldrslt IMAGE }}\\par\\par\n"; + m_t << "{\\field\\flddirty {\\*\\fldinst INCLUDEPICTURE \"" << rtf_logoFilename; + m_t << "\" \\\\d \\\\*MERGEFORMAT} {\\fldrslt IMAGE }}\\par\\par\n"; } if (rtf_company) { - t << rtf_company << "\\par\\par\n"; + m_t << rtf_company << "\\par\\par\n"; } - t << rtf_Style_Reset << rtf_Style["Title"].reference() << "\n"; // set to title style + m_t << rtf_Style_Reset << rtf_Style["Title"].reference() << "\n"; // set to title style if (rtf_title) // User has overridden document title in extensions file - t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt " << rtf_title << "}}\\par\n"; + m_t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt " << rtf_title << "}}\\par\n"; else { DocText *root = validatingParseText(projectName); - t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt "; + m_t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt "; writeDoc(root,0,0,0); - t << "}}\\par\n"; + m_t << "}}\\par\n"; } - t << rtf_Style_Reset << rtf_Style["SubTitle"].reference() << "\n"; // set to title style - t << "\\par\n"; + m_t << rtf_Style_Reset << rtf_Style["SubTitle"].reference() << "\n"; // set to title style + m_t << "\\par\n"; if (rtf_documentType) { - t << rtf_documentType << "\\par\n"; + m_t << rtf_documentType << "\\par\n"; } if (rtf_documentId) { - t << rtf_documentId << "\\par\n"; + m_t << rtf_documentId << "\\par\n"; } - t << "\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\n"; + m_t << "\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\\par\n"; - t << rtf_Style_Reset << rtf_Style["SubTitle"].reference() << "\n"; // set to subtitle style + m_t << rtf_Style_Reset << rtf_Style["SubTitle"].reference() << "\n"; // set to subtitle style if (rtf_author) - t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt "<< rtf_author << " }}\\par\n"; + m_t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt "<< rtf_author << " }}\\par\n"; else - t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt AUTHOR}}\\par\n"; + m_t << "{\\field\\fldedit {\\*\\fldinst AUTHOR \\\\*MERGEFORMAT}{\\fldrslt AUTHOR}}\\par\n"; - t << theTranslator->trVersion() << " " << Config_getString(PROJECT_NUMBER) << "\\par"; - t << "{\\field\\fldedit {\\*\\fldinst CREATEDATE \\\\*MERGEFORMAT}" + m_t << theTranslator->trVersion() << " " << Config_getString(PROJECT_NUMBER) << "\\par"; + m_t << "{\\field\\fldedit {\\*\\fldinst CREATEDATE \\\\*MERGEFORMAT}" "{\\fldrslt "<< dateToString(FALSE) << " }}\\par\n"; - t << "\\page\\page"; - DBG_RTF(t << "{\\comment End title page}\n") + m_t << "\\page\\page"; + DBG_RTF(m_t << "{\\comment End title page}\n") // table of contents section - DBG_RTF(t << "{\\comment Table of contents}\n") - t << "\\vertalt\n"; - t << rtf_Style_Reset << "\n"; - t << rtf_Style["Heading1"].reference(); - t << theTranslator->trRTFTableOfContents() << "\\par\n"; - t << rtf_Style_Reset << "\\par\n"; - t << "{\\field\\fldedit {\\*\\fldinst TOC \\\\f \\\\*MERGEFORMAT}{\\fldrslt Table of contents}}\\par\n"; - t << rtf_Style_Reset << "\n"; + DBG_RTF(m_t << "{\\comment Table of contents}\n") + m_t << "\\vertalt\n"; + m_t << rtf_Style_Reset << "\n"; + m_t << rtf_Style["Heading1"].reference(); + m_t << theTranslator->trRTFTableOfContents() << "\\par\n"; + m_t << rtf_Style_Reset << "\\par\n"; + m_t << "{\\field\\fldedit {\\*\\fldinst TOC \\\\f \\\\*MERGEFORMAT}{\\fldrslt Table of contents}}\\par\n"; + m_t << rtf_Style_Reset << "\n"; } break; case isMainPage: - t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; if (!mainPageHasTitle()) { - t << "{\\tc \\v " << theTranslator->trMainPage() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trMainPage() << "}\n"; } else { - t << "{\\tc \\v " << substitute(Doxygen::mainPage->title(),"%","") << "}\n"; + m_t << "{\\tc \\v " << substitute(Doxygen::mainPage->title(),"%","") << "}\n"; } - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; - //if (Config_getBool(GENERATE_TREEVIEW)) t << "main"; else t << "index"; - t << "index"; - t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \""; + //if (Config_getBool(GENERATE_TREEVIEW)) m_t << "main"; else m_t << "index"; + m_t << "index"; + m_t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; //case isPackageIndex: - // t << "\\par " << rtf_Style_Reset << "\n"; - // t << "{\\tc \\v " << theTranslator->trPackageList() << "}\n"; - // t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"packages.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + // m_t << "\\par " << rtf_Style_Reset << "\n"; + // m_t << "{\\tc \\v " << theTranslator->trPackageList() << "}\n"; + // m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"packages.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; // break; case isModuleIndex: - t << "\\par " << rtf_Style_Reset << "\n"; - t << "{\\tc \\v " << theTranslator->trModuleIndex() << "}\n"; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"modules.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "{\\tc \\v " << theTranslator->trModuleIndex() << "}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"modules.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isDirIndex: - t << "\\par " << rtf_Style_Reset << "\n"; - t << "{\\tc \\v " << theTranslator->trDirIndex() << "}\n"; - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"dirs.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "{\\tc \\v " << theTranslator->trDirIndex() << "}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"dirs.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isNamespaceIndex: - t << "\\par " << rtf_Style_Reset << "\n"; + m_t << "\\par " << rtf_Style_Reset << "\n"; if (fortranOpt) { - t << "{\\tc \\v " << theTranslator->trModulesIndex() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trModulesIndex() << "}\n"; } else { - t << "{\\tc \\v " << theTranslator->trNamespaceIndex() << "}\n"; + m_t << "{\\tc \\v " << theTranslator->trNamespaceIndex() << "}\n"; } - t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"namespaces.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; + m_t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"namespaces.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case 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"<<rtf_pageWidth<<"\\pard \\qc\\nowidctlpar\\widctlpar\\intbl\\adjustright \n"; +// m_t << "\\trowd \\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 \\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 \\trbrdrr\\brdrs\\brdrw10 \\trbrdrh\\brdrs\\brdrw10 \\trbrdrv\\brdrs\\brdrw10\n"; +// m_t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 \\clbrdrb\\brdrs\\brdrw10 \\clbrdrr \\brdrs\\brdrw10 \\cltxlrtb \\cellx"<<rtf_pageWidth<<"\\pard \\qc\\nowidctlpar\\widctlpar\\intbl\\adjustright \n"; // nextTableColumn(); //} // //void RTFGenerator::endCaption() //{ -// DBG_RTF(t << "{\\comment endCaption}\n";) +// DBG_RTF(m_t << "{\\comment endCaption}\n";) // endTableColumn(); // endTableRow(); //} // //void RTFGenerator::nextTableRow() //{ -// DBG_RTF(t << "{\\comment nextTableRow}\n";) +// DBG_RTF(m_t << "{\\comment nextTableRow}\n";) // ASSERT(m_numCols>0 && m_numCols<25); // uint columnWidth=rtf_pageWidth/m_numCols; -// t << "\\trowd \\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 " +// m_t << "\\trowd \\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 " // "\\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 " // "\\trbrdrr\\brdrs\\brdrw10 \\trbrdrh\\brdrs\\brdrw10 " // "\\trbrdrv\\brdrs\\brdrw10 \n"; // for (int i=0;i<m_numCols;i++) // { -// t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 " +// m_t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 " // "\\clbrdrb\\brdrs\\brdrw10 \\clbrdrr \\brdrs\\brdrw10 \\cltxlrtb " // "\\cellx" << (i*columnWidth) << "\n"; // } -// t << "\\pard \\widctlpar\\intbl\\adjustright\n{"; +// m_t << "\\pard \\widctlpar\\intbl\\adjustright\n{"; //} // //void RTFGenerator::endTableRow() //{ -// DBG_RTF(t << "{\\comment endTableRow}\n";) -// t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; +// DBG_RTF(m_t << "{\\comment endTableRow}\n";) +// m_t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; //} // //void RTFGenerator::nextTableColumn() //{ -// DBG_RTF(t << "{\\comment nextTableColumn}\n";) -// t << "{ "; +// DBG_RTF(m_t << "{\\comment nextTableColumn}\n";) +// m_t << "{ "; //} // //void RTFGenerator::endTableColumn() //{ -// DBG_RTF(t << "{\\comment endTableColumn}\n";) -// t << " \\cell }"; +// DBG_RTF(m_t << "{\\comment endTableColumn}\n";) +// m_t << " \\cell }"; //} // void RTFGenerator::startTextLink(const char *f,const char *anchor) @@ -1300,10 +1300,10 @@ void RTFGenerator::startTextLink(const char *f,const char *anchor) ref+=anchor; } - t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; - t << rtfFormatBmkStr(ref); - t << "\" }{}"; - t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; + m_t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; + m_t << rtfFormatBmkStr(ref); + m_t << "\" }{}"; + m_t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; } } @@ -1311,7 +1311,7 @@ void RTFGenerator::endTextLink() { if (Config_getBool(RTF_HYPERLINKS)) { - t << "}}}\n"; + m_t << "}}}\n"; } } @@ -1331,14 +1331,14 @@ void RTFGenerator::writeObjectLink(const char *ref, const char *f, refName+=anchor; } - t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; - t << rtfFormatBmkStr(refName); - t << "\" }{}"; - t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; + m_t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; + m_t << rtfFormatBmkStr(refName); + m_t << "\" }{}"; + m_t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; docify(text); - t << "}}}\n"; + m_t << "}}}\n"; } else { @@ -1350,7 +1350,7 @@ void RTFGenerator::writeObjectLink(const char *ref, const char *f, void RTFGenerator::startPageRef() { - t << " ("; + m_t << " ("; startEmphasis(); } @@ -1368,7 +1368,7 @@ void RTFGenerator::endPageRef(const char *clname, const char *anchor) } writeRTFReference(ref); endEmphasis(); - t << ")"; + m_t << ")"; } void RTFGenerator::writeCodeLink(const char *ref,const char *f, @@ -1388,14 +1388,14 @@ void RTFGenerator::writeCodeLink(const char *ref,const char *f, refName+=anchor; } - t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; - t << rtfFormatBmkStr(refName); - t << "\" }{}"; - t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; + m_t << "{\\field {\\*\\fldinst { HYPERLINK \\\\l \""; + m_t << rtfFormatBmkStr(refName); + m_t << "\" }{}"; + m_t << "}{\\fldrslt {\\cs37\\ul\\cf2 "; codify(name); - t << "}}}\n"; + m_t << "}}}\n"; } else { @@ -1405,22 +1405,22 @@ void RTFGenerator::writeCodeLink(const char *ref,const char *f, void RTFGenerator::startTitleHead(const char *) { - DBG_RTF(t <<"{\\comment startTitleHead}\n") + DBG_RTF(m_t << "{\\comment startTitleHead}\n") // beginRTFSection(); - t << rtf_Style_Reset << rtf_Style["Heading2"].reference() << "\n"; + m_t << rtf_Style_Reset << rtf_Style["Heading2"].reference() << "\n"; } void RTFGenerator::endTitleHead(const char *fileName,const char *name) { - DBG_RTF(t <<"{\\comment endTitleHead}\n") - t << "\\par " << rtf_Style_Reset << "\n"; + DBG_RTF(m_t << "{\\comment endTitleHead}\n") + m_t << "\\par " << rtf_Style_Reset << "\n"; if (name) { // make table of contents entry - t << "{\\tc\\tcl2 \\v "; + m_t << "{\\tc\\tcl2 \\v "; docify(name); - t << "}\n"; + m_t << "}\n"; // make an index entry addIndexItem(name,0); @@ -1439,7 +1439,7 @@ void RTFGenerator::endTitleHead(const char *fileName,const char *name) void RTFGenerator::startTitle() { - DBG_RTF(t <<"{\\comment startTitle}\n") + DBG_RTF(m_t << "{\\comment startTitle}\n") if (Config_getBool(COMPACT_RTF)) beginRTFSection(); else @@ -1448,29 +1448,29 @@ void RTFGenerator::startTitle() void RTFGenerator::startGroupHeader(int extraIndent) { - DBG_RTF(t <<"{\\comment startGroupHeader}\n") + DBG_RTF(m_t << "{\\comment startGroupHeader}\n") //newParagraph(); - t << rtf_Style_Reset; + m_t << rtf_Style_Reset; if (extraIndent==2) { - t << rtf_Style["Heading5"].reference(); + m_t << rtf_Style["Heading5"].reference(); } else if (extraIndent==1) { - t << rtf_Style["Heading4"].reference(); + m_t << rtf_Style["Heading4"].reference(); } else // extraIndent==0 { - t << rtf_Style["Heading3"].reference(); + m_t << rtf_Style["Heading3"].reference(); } - t << "\n"; + m_t << "\n"; } void RTFGenerator::endGroupHeader(int) { - DBG_RTF(t <<"{\\comment endGroupHeader}\n") - t << "\\par\n"; - t << rtf_Style_Reset << "\n"; + DBG_RTF(m_t << "{\\comment endGroupHeader}\n") + m_t << "\\par\n"; + m_t << rtf_Style_Reset << "\n"; } void RTFGenerator::startMemberDoc(const char *clname, @@ -1481,28 +1481,28 @@ void RTFGenerator::startMemberDoc(const char *clname, int, bool showInline) { - DBG_RTF(t << "{\\comment startMemberDoc}\n") + DBG_RTF(m_t << "{\\comment startMemberDoc}\n") if (memname && memname[0]!='@') { addIndexItem(memname,clname); addIndexItem(clname,memname); } - t << rtf_Style_Reset << rtf_Style[showInline ? "Heading5" : "Heading4"].reference(); + m_t << rtf_Style_Reset << rtf_Style[showInline ? "Heading5" : "Heading4"].reference(); //styleStack.push(rtf_Style_Heading4); - t << "{\n"; + m_t << "{\n"; //printf("RTFGenerator::startMemberDoc() '%s'\n",rtf_Style["Heading4"].reference()); startBold(); - t << "\n"; + m_t << "\n"; } void RTFGenerator::endMemberDoc(bool) { - DBG_RTF(t << "{\\comment endMemberDoc}\n") + DBG_RTF(m_t << "{\\comment endMemberDoc}\n") //const char *style = styleStack.pop(); //printf("RTFGenerator::endMemberDoc() '%s'\n",style); //ASSERT(style==rtf_Style["Heading4"].reference()); endBold(); - t << "}\n"; + m_t << "}\n"; newParagraph(); } @@ -1511,7 +1511,7 @@ void RTFGenerator::startDoxyAnchor(const char *,const char *, const char * ) { - DBG_RTF(t << "{\\comment startDoxyAnchor}\n") + DBG_RTF(m_t << "{\\comment startDoxyAnchor}\n") } void RTFGenerator::endDoxyAnchor(const char *fName,const char *anchor) @@ -1527,13 +1527,13 @@ void RTFGenerator::endDoxyAnchor(const char *fName,const char *anchor) ref+=anchor; } - DBG_RTF(t << "{\\comment endDoxyAnchor}\n") - t << "{\\bkmkstart "; - t << rtfFormatBmkStr(ref); - t << "}\n"; - t << "{\\bkmkend "; - t << rtfFormatBmkStr(ref); - t << "}\n"; + DBG_RTF(m_t << "{\\comment endDoxyAnchor}\n") + m_t << "{\\bkmkstart "; + m_t << rtfFormatBmkStr(ref); + m_t << "}\n"; + m_t << "{\\bkmkend "; + m_t << rtfFormatBmkStr(ref); + m_t << "}\n"; } @@ -1546,124 +1546,124 @@ void RTFGenerator::addIndexItem(const char *s1,const char *s2) { if (s1) { - t << "{\\xe \\v "; + m_t << "{\\xe \\v "; docify(s1); if (s2) { - t << "\\:"; + m_t << "\\:"; docify(s2); } - t << "}\n"; + m_t << "}\n"; } } void RTFGenerator::startIndent() { incrementIndentLevel(); - DBG_RTF(t << "{\\comment (startIndent) }\n") - t << "{\n"; - t << rtf_Style_Reset << rtf_CList_DepthStyle() << "\n"; + DBG_RTF(m_t << "{\\comment (startIndent) }\n") + m_t << "{\n"; + m_t << rtf_Style_Reset << rtf_CList_DepthStyle() << "\n"; } void RTFGenerator::endIndent() { - t << "}\n"; + m_t << "}\n"; decrementIndentLevel(); } void RTFGenerator::startDescription() { - DBG_RTF(t << "{\\comment (startDescription)}" << "\n") - t << "{\n"; - t << rtf_Style_Reset << rtf_DList_DepthStyle(); + DBG_RTF(m_t << "{\\comment (startDescription)}" << "\n") + m_t << "{\n"; + m_t << rtf_Style_Reset << rtf_DList_DepthStyle(); } void RTFGenerator::endDescription() { - DBG_RTF(t << "{\\comment (endDescription)}" << "\n") + DBG_RTF(m_t << "{\\comment (endDescription)}" << "\n") newParagraph(); - t << "}"; + m_t << "}"; } void RTFGenerator::startDescItem() { newParagraph(); - DBG_RTF(t << "{\\comment (startDescItem)}\n") - t << "{\\b "; + DBG_RTF(m_t << "{\\comment (startDescItem)}\n") + m_t << "{\\b "; } void RTFGenerator::endDescItem() { - DBG_RTF(t << "{\\comment (endDescItem)}\n") - t << "}\n"; + DBG_RTF(m_t << "{\\comment (endDescItem)}\n") + m_t << "}\n"; newParagraph(); } void RTFGenerator::startMemberDescription(const char *,const char *,bool) { - DBG_RTF(t << "{\\comment (startMemberDescription)}\n") - t << "{\n"; + DBG_RTF(m_t << "{\\comment (startMemberDescription)}\n") + m_t << "{\n"; incrementIndentLevel(); - t << rtf_Style_Reset << rtf_CList_DepthStyle(); + m_t << rtf_Style_Reset << rtf_CList_DepthStyle(); startEmphasis(); } void RTFGenerator::endMemberDescription() { - DBG_RTF(t << "{\\comment (endMemberDescription)}\n") + DBG_RTF(m_t << "{\\comment (endMemberDescription)}\n") endEmphasis(); //newParagraph(); decrementIndentLevel(); - t << "\\par"; - t << "}\n"; + m_t << "\\par"; + m_t << "}\n"; m_omitParagraph = TRUE; } void RTFGenerator::startDescList(SectionTypes) { - DBG_RTF(t << "{\\comment (startDescList)}\n") - t << "{"; // ends at endDescList - t << "{"; // ends at endDescTitle + DBG_RTF(m_t << "{\\comment (startDescList)}\n") + m_t << "{"; // ends at endDescList + m_t << "{"; // ends at endDescTitle startBold(); newParagraph(); } //void RTFGenerator::endDescTitle() //{ -// DBG_RTF(t << "{\\comment (endDescTitle) }\n") +// DBG_RTF(m_t << "{\\comment (endDescTitle) }\n") // endBold(); -// t << "}"; +// m_t << "}"; // newParagraph(); // incrementIndentLevel(); -// t << rtf_Style_Reset << rtf_DList_DepthStyle(); +// m_t << rtf_Style_Reset << rtf_DList_DepthStyle(); //} void RTFGenerator::startDescForItem() { - DBG_RTF(t << "{\\comment (startDescForItem) }\n") + DBG_RTF(m_t << "{\\comment (startDescForItem) }\n") } void RTFGenerator::endDescForItem() { - DBG_RTF(t << "{\\comment (endDescForItem) }\n") + DBG_RTF(m_t << "{\\comment (endDescForItem) }\n") } //void RTFGenerator::endDescList() //{ -// DBG_RTF(t << "{\\comment (endDescList)}\n") +// DBG_RTF(m_t << "{\\comment (endDescList)}\n") // newParagraph(); // decrementIndentLevel(); // m_omitParagraph = TRUE; -// t << "}"; +// m_t << "}"; //} void RTFGenerator::startSection(const char *,const char *title,SectionType type) { - DBG_RTF(t << "{\\comment (startSection)}\n") - t << "{"; - t<< rtf_Style_Reset; + DBG_RTF(m_t << "{\\comment (startSection)}\n") + m_t << "{"; + m_t << rtf_Style_Reset; int num=4; switch(type) { @@ -1677,21 +1677,21 @@ void RTFGenerator::startSection(const char *,const char *title,SectionType type) QCString heading; heading.sprintf("Heading%d",num); // set style - t << rtf_Style[heading.str()].reference(); + m_t << rtf_Style[heading.str()].reference(); // make table of contents entry - t << "{\\tc\\tcl" << num << " \\v "; + m_t << "{\\tc\\tcl" << num << " \\v "; docify(title); - t << "}\n"; + m_t << "}\n"; } void RTFGenerator::endSection(const char *lab,SectionType) { - DBG_RTF(t << "{\\comment (endSection)}\n") + DBG_RTF(m_t << "{\\comment (endSection)}\n") // make bookmark m_omitParagraph=FALSE; newParagraph(); writeAnchor(0,lab); - t << "}"; + m_t << "}"; } //void RTFGenerator::writeSectionRef(const char *ref,const char *, @@ -1706,10 +1706,10 @@ void RTFGenerator::endSection(const char *lab,SectionType) // startBold(); // docify(title); // endBold(); -// t << " ("; +// m_t << " ("; // docify(theTranslator->trPageAbbreviation()); // 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<n;i++) { - t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10\\brdrcf15 " + m_t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10\\brdrcf15 " "\\clbrdrl\\brdrs\\brdrw10\\brdrcf15 " "\\clbrdrb\\brdrs\\brdrw10\\brdrcf15 " "\\clbrdrr \\brdrs\\brdrw10\\brdrcf15 " "\\cltxlrtb " "\\cellx" << (rtf_pageWidth*columnPos[i]/100) << "\n"; } - t << "\\pard \\widctlpar\\intbl\\adjustright\n"; + m_t << "\\pard \\widctlpar\\intbl\\adjustright\n"; } void RTFGenerator::endMemberDocSimple(bool) { - DBG_RTF(t << "{\\comment (endMemberDocSimple)}\n") - t << "}\n"; + DBG_RTF(m_t << "{\\comment (endMemberDocSimple)}\n") + m_t << "}\n"; } void RTFGenerator::startInlineMemberType() { - DBG_RTF(t << "{\\comment (startInlineMemberType)}\n") - t << "{\\qr "; + DBG_RTF(m_t << "{\\comment (startInlineMemberType)}\n") + m_t << "{\\qr "; } void RTFGenerator::endInlineMemberType() { - DBG_RTF(t << "{\\comment (endInlineMemberType)}\n") - t << "\\cell }"; + DBG_RTF(m_t << "{\\comment (endInlineMemberType)}\n") + m_t << "\\cell }"; } void RTFGenerator::startInlineMemberName() { - DBG_RTF(t << "{\\comment (startInlineMemberName)}\n") - t << "{"; + DBG_RTF(m_t << "{\\comment (startInlineMemberName)}\n") + m_t << "{"; } void RTFGenerator::endInlineMemberName() { - DBG_RTF(t << "{\\comment (endInlineMemberName)}\n") - t << "\\cell }"; + DBG_RTF(m_t << "{\\comment (endInlineMemberName)}\n") + m_t << "\\cell }"; } void RTFGenerator::startInlineMemberDoc() { - DBG_RTF(t << "{\\comment (startInlineMemberDoc)}\n") - t << "{"; + DBG_RTF(m_t << "{\\comment (startInlineMemberDoc)}\n") + m_t << "{"; } void RTFGenerator::endInlineMemberDoc() { - DBG_RTF(t << "{\\comment (endInlineMemberDoc)}\n") - t << "\\cell }{\\row }\n"; + DBG_RTF(m_t << "{\\comment (endInlineMemberDoc)}\n") + m_t << "\\cell }{\\row }\n"; } void RTFGenerator::writeLineNumber(const char *ref,const char *fileName,const char *anchor,int l) @@ -2993,18 +2996,18 @@ void RTFGenerator::writeLineNumber(const char *ref,const char *fileName,const ch QCString lineAnchor; lineAnchor.sprintf("_l%05d",l); lineAnchor.prepend(stripExtensionGeneral(m_sourceFileName, ".rtf")); - t << "{\\bkmkstart "; - t << rtfFormatBmkStr(lineAnchor); - t << "}"; - t << "{\\bkmkend "; - t << rtfFormatBmkStr(lineAnchor); - t << "}\n"; + m_t << "{\\bkmkstart "; + m_t << rtfFormatBmkStr(lineAnchor); + m_t << "}"; + m_t << "{\\bkmkend "; + m_t << rtfFormatBmkStr(lineAnchor); + m_t << "}\n"; } - t << lineNumber << " "; + m_t << lineNumber << " "; } else { - t << l << " "; + m_t << l << " "; } m_col=0; } @@ -3025,8 +3028,8 @@ void RTFGenerator::startLabels() void RTFGenerator::writeLabel(const char *l,bool isLast) { - t << "{\\f2 [" << l << "]}"; - if (!isLast) t << ", "; + m_t << "{\\f2 [" << l << "]}"; + if (!isLast) m_t << ", "; } void RTFGenerator::endLabels() @@ -3048,10 +3051,10 @@ void RTFGenerator::startFontClass(const char *name) else if (qname == "vhdlchar") cod = 25; else if (qname == "vhdlkeyword") cod = 26; else if (qname == "vhdllogic") cod = 27; - t << "{\\cf" << cod << " "; + m_t << "{\\cf" << cod << " "; } void RTFGenerator::endFontClass() { - t << "}"; + m_t << "}"; } diff --git a/src/rtfgen.h b/src/rtfgen.h index e6695bb..b1ae9f1 100644 --- a/src/rtfgen.h +++ b/src/rtfgen.h @@ -32,8 +32,8 @@ class RTFGenerator : public OutputGenerator virtual std::unique_ptr<OutputGenerator> clone() const; static void init(); - static void writeStyleSheetFile(std::ostream &t); - static void writeExtensionsFile(std::ostream &t); + static void writeStyleSheetFile(TextStream &t); + static void writeExtensionsFile(TextStream &t); OutputType type() const { return RTF; } void setRelativePath(const QCString &path); @@ -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<Entry> &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<p) result.resize(q-result.data()+1); + if (q<p) result.resize(static_cast<uint>(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<TemplateNode> > { 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<TemplateContextImpl*>(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<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -2867,7 +2867,7 @@ class TemplateNodeIf : public TemplateNodeCreator<TemplateNodeIf> { } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -2930,7 +2930,7 @@ class TemplateNodeRepeat : public TemplateNodeCreator<TemplateNodeRepeat> { delete m_expr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3042,7 +3042,7 @@ class TemplateNodeRange : public TemplateNodeCreator<TemplateNodeRange> delete m_endExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3200,7 +3200,7 @@ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> delete m_expr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3302,7 +3302,7 @@ class TemplateNodeMsg : public TemplateNodeCreator<TemplateNodeMsg> parser->removeNextToken(); // skip over endmsg TRACE(("}TemplateNodeMsg()\n")); } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3311,7 +3311,9 @@ class TemplateNodeMsg : public TemplateNodeCreator<TemplateNodeMsg> ci->setActiveEscapeIntf(0); // avoid escaping things we send to standard out bool enable = ci->spacelessEnabled(); ci->enableSpaceless(FALSE); - m_nodes.render(std::cout,c); + TextStream t(&std::cout); + m_nodes.render(t,c); + t.flush(); std::cout << "\n"; ci->setActiveEscapeIntf(escIntf); ci->enableSpaceless(enable); @@ -3342,7 +3344,7 @@ class TemplateNodeBlock : public TemplateNodeCreator<TemplateNodeBlock> TRACE(("}TemplateNodeBlock(%s)\n",data.data())); } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3355,7 +3357,7 @@ class TemplateNodeBlock : public TemplateNodeCreator<TemplateNodeBlock> if (nb) // block is overruled { ci->push(); - std::ostringstream ss(std::ios_base::ate); + TextStream ss; // get super block of block nb TemplateNodeBlock *sb = ci->blockContext()->get(m_blockName); if (sb && sb!=nb && sb!=this) // nb and sb both overrule this block @@ -3423,7 +3425,7 @@ class TemplateNodeExtend : public TemplateNodeCreator<TemplateNodeExtend> delete m_extendExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3500,7 +3502,7 @@ class TemplateNodeInclude : public TemplateNodeCreator<TemplateNodeInclude> { delete m_includeExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3597,7 +3599,7 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> delete m_templateExpr; delete m_fileExpr; } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3636,12 +3638,13 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> outputFile.prepend(ci->outputDirectory()+"/"); } //printf("NoteCreate(%s)\n",outputFile.data()); - std::ofstream ts(outputFile.str(),std::ofstream::out | std::ofstream::binary); - if (ts.is_open()) + 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<TemplateNodeTree> TemplateContext *c = ctx->templateCtx; TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return QCString(); // should not happen - std::ostringstream ss(std::ios_base::ate); + TextStream ss; c->push(); TemplateVariant node; TemplateListIntf::ConstIterator *it = ctx->list->createIterator(); @@ -3758,7 +3761,7 @@ class TemplateNodeTree : public TemplateNodeCreator<TemplateNodeTree> delete it; return ss.str(); } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { //printf("TemplateNodeTree::render()\n"); TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); @@ -3830,7 +3833,7 @@ class TemplateNodeIndexEntry : public TemplateNodeCreator<TemplateNodeIndexEntry } TRACE(("}TemplateNodeIndexEntry(%s)\n",data.data())); } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3872,7 +3875,7 @@ class TemplateNodeOpenSubIndex : public TemplateNodeCreator<TemplateNodeOpenSubI } TRACE(("}TemplateNodeOpenSubIndex(%s)\n",data.data())); } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3908,7 +3911,7 @@ class TemplateNodeCloseSubIndex : public TemplateNodeCreator<TemplateNodeCloseSu } TRACE(("}TemplateNodeCloseSubIndex(%s)\n",data.data())); } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -3969,7 +3972,7 @@ class TemplateNodeWith : public TemplateNodeCreator<TemplateNodeWith> ~TemplateNodeWith() { } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -4017,7 +4020,7 @@ class TemplateNodeCycle : public TemplateNodeCreator<TemplateNodeCycle> } TRACE(("}TemplateNodeCycle(%s)\n",data.data())); } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); ci->setLocation(m_templateName,m_line); @@ -4091,7 +4094,7 @@ class TemplateNodeSet : public TemplateNodeCreator<TemplateNodeSet> ~TemplateNodeSet() { } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -4121,7 +4124,7 @@ class TemplateNodeSpaceless : public TemplateNodeCreator<TemplateNodeSpaceless> parser->removeNextToken(); // skip over endwith TRACE(("}TemplateNodeSpaceless()\n")); } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -4168,7 +4171,7 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers> delete m_listExpr; delete m_patternExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -4270,7 +4273,7 @@ class TemplateNodeTabbing : public TemplateNodeCreator<TemplateNodeTabbing> parser->removeNextToken(); // skip over endtabbing TRACE(("}TemplateNodeTabbing()\n")); } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -4319,7 +4322,7 @@ class TemplateNodeResource : public TemplateNodeCreator<TemplateNodeResource> delete m_resExpr; delete m_asExpr; } - void render(std::ostream &, TemplateContext *c) + void render(TextStream &, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -4387,7 +4390,7 @@ class TemplateNodeEncoding : public TemplateNodeCreator<TemplateNodeEncoding> { delete m_encExpr; } - void render(std::ostream &ts, TemplateContext *c) + void render(TextStream &ts, TemplateContext *c) { TemplateContextImpl *ci = dynamic_cast<TemplateContextImpl*>(c); if (ci==0) return; // should not happen @@ -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<TemplateContextImpl*>(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 <vector> -#include <iostream> #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 <string> +#include <iostream> +#include <sstream> +#include <cstdint> +#include <cstdio> +#include <fstream> + +#include "qcstring.h" + +/** @brief Text streaming class that buffers data. + * + * Simpler version of std::ostringstream that has much better + * performance. + */ +class TextStream final +{ + static const int INITIAL_CAPACITY = 4096; + public: + /** Creates an empty stream object. + */ + TextStream() + { + m_buffer.reserve(INITIAL_CAPACITY); + } + /** Create a text stream object for writing to a std::ostream. + * @note data is buffered until flush() is called or the object is destroyed. + */ + TextStream(std::ostream *s) : m_s(s) + { + m_buffer.reserve(INITIAL_CAPACITY); + } + /** Create a text stream, initializing the buffer with string \a s + */ + TextStream(const std::string &s) : m_buffer(s) + { + m_buffer.reserve(s.length()+INITIAL_CAPACITY); + } + + /** Writes any data that is buffered to the attached std::ostream */ + ~TextStream() { flush(); } + + /** 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<TextStream&>(*this); + } + + /** Adds a C-style string to the stream */ + TextStream &operator<<( const char *s) + { + if (s) m_buffer+=s; + return static_cast<TextStream&>(*this); + } + + /** Adds a QCString to the stream */ + TextStream &operator<<( const QCString &s ) + { + m_buffer+=s.str(); + return static_cast<TextStream&>(*this); + } + + /** Adds a std::string to the stream */ + TextStream &operator<<( const std::string &s ) + { + m_buffer+=s; + return static_cast<TextStream&>(*this); + } + + /** Adds a signed short integer to the stream */ + TextStream &operator<<( signed short i) + { + output_int32(i,i<0); + return static_cast<TextStream&>(*this); + } + + /** Adds a unsigned short integer to the stream */ + TextStream &operator<<( unsigned short i) + { + output_int32(i,false); + return static_cast<TextStream&>(*this); + } + + /** Adds a signed integer to the stream */ + TextStream &operator<<( signed int i) + { + output_int32(i,i<0); + return static_cast<TextStream&>(*this); + } + + /** Adds a unsigned integer to the stream */ + TextStream &operator<<( unsigned int i) + { + output_int32(i,false); + return static_cast<TextStream&>(*this); + } + + /** Adds a float to the stream */ + TextStream &operator<<( float f) + { + output_double((double)f); + return static_cast<TextStream&>(*this); + } + + /** Adds a double to the stream */ + TextStream &operator<<( double d) + { + output_double(d); + return static_cast<TextStream&>(*this); + } + + /** Adds a array of character to the stream + * @param buf the character buffer + * @param len the number of characters in the buffer to write + */ + void write(const char *buf,size_t len) + { + m_buffer.append(buf,len); + } + + /** Flushes the buffer. If a std::ostream is attached, the buffer's + * contents will be written to the stream. + */ + void flush() + { + if (m_s) + { + m_s->write(m_buffer.c_str(),m_buffer.length()); + } + 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 @@ -18,7 +18,8 @@ #include <cstdint> #include <string> -#include <iostream> + +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 <mutex> #include <unordered_set> #include <codecvt> -#include <iostream> #include <algorithm> #include <ctime> #include <cctype> @@ -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<uint>(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; @@ -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<void(size_t)> 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<const MemberDef *> getPorts(const ClassDef *cd); -static void writeVhdlEntityToolTip(std::ostream& t,ClassDef *cd); -static void endDot(std::ostream &t); -static void writeTable(const std::vector<const MemberDef*> &portList,std::ostream & t); -static void endTable(std::ostream &t); -static void writeClassToDot(std::ostream &t,ClassDef* cd); -static void writeVhdlDotLink(std::ostream &t,const QCString &a,const QCString &b,const QCString &style); +static void writeVhdlEntityToolTip(TextStream& t,ClassDef *cd); +static void endDot(TextStream &t); +static void writeTable(const std::vector<const MemberDef*> &portList,TextStream & t); +static void endTable(TextStream &t); +static void writeClassToDot(TextStream &t,ClassDef* cd); +static void writeVhdlDotLink(TextStream &t,const QCString &a,const QCString &b,const QCString &style); static const MemberDef *flowMember=0; void VhdlDocGen::setFlowMember( const MemberDef* mem) @@ -95,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=<<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\">\n"; } -static void writeVhdlDotLink(std::ostream &t, +static void writeVhdlDotLink(TextStream &t, const QCString &a,const QCString &b,const QCString &style) { t << a << "->" << b; @@ -285,7 +288,7 @@ static QCString formatBriefNote(const QCString &brief,ClassDef * cd) return vForm; } -static void writeVhdlEntityToolTip(std::ostream& t,ClassDef *cd) +static void writeVhdlEntityToolTip(TextStream& t,ClassDef *cd) { QCString brief=cd->briefDescription(); @@ -306,7 +309,7 @@ static void writeVhdlEntityToolTip(std::ostream& t,ClassDef *cd) writeVhdlDotLink(t,dotn,node,"dotted"); } -static void writeColumn(std::ostream &t,const MemberDef *md,bool start) +static void writeColumn(TextStream &t,const MemberDef *md,bool start) { QCString toolTip; @@ -389,13 +392,13 @@ static void writeColumn(std::ostream &t,const MemberDef *md,bool start) } } -static void endTable(std::ostream &t) +static void endTable(TextStream &t) { t << "</TABLE>>\n"; t << "] \n"; } -static void writeClassToDot(std::ostream &t,ClassDef* cd) +static void writeClassToDot(TextStream &t,ClassDef* cd) { t << "<TR><TD COLSPAN=\"2\" BGCOLOR=\"yellow\" "; t << "PORT=\""; @@ -429,9 +432,9 @@ static std::vector<const MemberDef*> getPorts(const ClassDef *cd) return portList; } -//writeColumn(std::ostream &t,QCString name,bool start) +//writeColumn(TextStream &t,QCString name,bool start) -static void writeTable(const std::vector<const MemberDef*> &portList,std::ostream & t) +static void writeTable(const std::vector<const MemberDef*> &portList,TextStream & t) { std::vector<const MemberDef *> inPorts; std::vector<const MemberDef *> outPorts; @@ -1694,7 +1697,7 @@ bool VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definit return hasParams; } -void VhdlDocGen::writeTagFile(MemberDefMutable *mdef,std::ostream &tagFile) +void VhdlDocGen::writeTagFile(MemberDefMutable *mdef,TextStream &tagFile) { tagFile << " <member kind=\""; if (VhdlDocGen::isGeneric(mdef)) tagFile << "generic"; @@ -3054,7 +3057,7 @@ void FlowChart::delFlowList() flowList.clear(); } -void FlowChart::alignCommentNode(std::ostream &t,QCString com) +void FlowChart::alignCommentNode(TextStream &t,QCString com) { uint max=0; QCString s; @@ -3090,7 +3093,7 @@ void FlowChart::alignCommentNode(std::ostream &t,QCString com) } -void FlowChart::buildCommentNodes(std::ostream & t) +void FlowChart::buildCommentNodes(TextStream & t) { size_t size=flowList.size(); bool begin=false; @@ -3175,7 +3178,7 @@ void FlowChart::buildCommentNodes(std::ostream & t) }// for; } -void FlowChart::codify(std::ostream &t,const char *str) +void FlowChart::codify(TextStream &t,const char *str) { if (str) { @@ -3401,7 +3404,7 @@ void FlowChart::createSVG() } } -void FlowChart::startDot(std::ostream &t) +void FlowChart::startDot(TextStream &t) { t << " digraph G { \n"; t << "rankdir=TB \n"; @@ -3409,7 +3412,7 @@ void FlowChart::startDot(std::ostream &t) t << "stylesheet=\"doxygen.css\"\n"; } -void FlowChart::endDot(std::ostream &t) +void FlowChart::endDot(TextStream &t) { t << " } \n"; } @@ -3420,12 +3423,13 @@ void FlowChart::writeFlowChart() QCString ov = Config_getString(HTML_OUTPUT); QCString fileName = ov+"/flow_design.dot"; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { err("Cannot open file %s for writing\n",fileName.data()); return; } + TextStream t(&f); colTextNodes(); // buildCommentNodes(t); @@ -3438,7 +3442,8 @@ void FlowChart::writeFlowChart() { printUmlTree(); delFlowList(); - t.close(); + t.flush(); + f.close(); return; } @@ -3452,11 +3457,12 @@ void FlowChart::writeFlowChart() FlowChart::endDot(t); delFlowList(); - t.close(); + t.flush(); + f.close(); FlowChart::createSVG(); }// writeFlowChart -void FlowChart::writeShape(std::ostream &t,const FlowChart &fl) +void FlowChart::writeShape(TextStream &t,const FlowChart &fl) { if (fl.type & EEND) return; QCString var; @@ -3558,7 +3564,7 @@ void FlowChart::writeShape(std::ostream &t,const FlowChart &fl) } -void FlowChart::writeEdge(std::ostream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i) +void FlowChart::writeEdge(TextStream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i) { bool b=fl_from.type & STARTL; bool c=fl_to.type & STARTL; @@ -3576,7 +3582,7 @@ void FlowChart::writeEdge(std::ostream &t,const FlowChart &fl_from,const FlowCha writeEdge(t,fl_from.id,fl_to.id,i,b,c); } -void FlowChart::writeEdge(std::ostream &t,int fl_from,int fl_to,int i,bool bFrom,bool bTo) +void FlowChart::writeEdge(TextStream &t,int fl_from,int fl_to,int i,bool bFrom,bool bTo) { QCString label,col; @@ -3768,7 +3774,7 @@ size_t FlowChart::getNextIfLink(const FlowChart &fl,size_t index) return getNextNode(endifNode,stamp); } -void FlowChart::writeFlowLinks(std::ostream &t) +void FlowChart::writeFlowLinks(TextStream &t) { size_t size=flowList.size(); if (size<2) return; diff --git a/src/vhdldocgen.h b/src/vhdldocgen.h index aa3313e..0fe6b96 100644 --- a/src/vhdldocgen.h +++ b/src/vhdldocgen.h @@ -36,6 +36,7 @@ class Definition; class GroupDef; class FileDef; class NamespaceDef; +class TextStream; struct Argument; struct VhdlConfNode @@ -141,7 +142,7 @@ class VhdlDocGen static QCString getClassTitle(const ClassDef*); static void writeInlineClassLink(const ClassDef*, OutputList &ol); - static void writeTagFile(MemberDefMutable *mdef,std::ostream &tagFile); + static void writeTagFile(MemberDefMutable *mdef,TextStream &tagFile); static bool isConstraint(const MemberDef *mdef); static bool isConfig(const MemberDef *mdef); @@ -228,7 +229,7 @@ class VhdlDocGen // flowcharts static void createFlowChart(const MemberDef*); - //static void addFlowImage(const std::ostream &,const QCString &); + //static void addFlowImage(const TextStream &,const QCString &); static void setFlowMember( const MemberDef *flowMember); static const MemberDef *getFlowMember(); @@ -288,13 +289,13 @@ class FlowChart //---------- create svg ------------------------------------------------------------- static void createSVG(); - static void startDot(std::ostream &t); - static void endDot(std::ostream &t); - static void codify(std::ostream &t,const char *str); - static void writeShape(std::ostream &t,const FlowChart &fl); - static void writeEdge(std::ostream &t,int fl_from,int fl_to,int i,bool bFrom=FALSE,bool bTo=FALSE); - static void writeEdge(std::ostream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i); - static void writeFlowLinks(std::ostream &t); + static void startDot(TextStream &t); + static void endDot(TextStream &t); + static void codify(TextStream &t,const char *str); + static void writeShape(TextStream &t,const FlowChart &fl); + static void writeEdge(TextStream &t,int fl_from,int fl_to,int i,bool bFrom=FALSE,bool bTo=FALSE); + static void writeEdge(TextStream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i); + static void writeFlowLinks(TextStream &t); static QCString getNodeName(int n); static void colTextNodes(); @@ -317,8 +318,8 @@ class FlowChart static QCString convertNameToFileName(); static void printNode(const FlowChart& n); static void printFlowTree(); - static void buildCommentNodes(std::ostream &t); - static void alignCommentNode(std::ostream &t,QCString com); + static void buildCommentNodes(TextStream &t); + static void alignCommentNode(TextStream &t,QCString com); static void printUmlTree(); static QCString printPlantUmlNode(const FlowChart &flo,bool,bool); diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index a356682..9f65feb 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -35,7 +35,7 @@ static void visitCaption(XmlDocVisitor *parent, const DocNodeList &children) for (const auto &n : children) n->accept(parent); } -static void visitPreStart(std::ostream &t, const char *cmd, bool doCaption, +static void visitPreStart(TextStream &t, const char *cmd, bool doCaption, XmlDocVisitor *parent, const DocNodeList &children, const QCString &name, bool writeType, DocImage::Type type, const QCString &width, const QCString &height, const QCString &alt = QCString(""), bool inlineImage = FALSE) @@ -82,12 +82,12 @@ static void visitPreStart(std::ostream &t, const char *cmd, bool doCaption, t << ">"; } -static void visitPostEnd(std::ostream &t, const char *cmd) +static void visitPostEnd(TextStream &t, const char *cmd) { t << "</" << cmd << ">\n"; } -XmlDocVisitor::XmlDocVisitor(std::ostream &t,CodeOutputInterface &ci,const char *langExt) +XmlDocVisitor::XmlDocVisitor(TextStream &t,CodeOutputInterface &ci,const 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 <stdlib.h> +#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 << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";; t << "<doxygen xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; @@ -185,7 +186,7 @@ static void writeCombineScript() } -void writeXMLLink(std::ostream &t,const char *extRef,const char *compoundId, +void writeXMLLink(TextStream &t,const char *extRef,const char *compoundId, const char *anchorId,const char *text,const char *tooltip) { t << "<ref refid=\"" << compoundId; @@ -204,7 +205,7 @@ void writeXMLLink(std::ostream &t,const char *extRef,const char *compoundId, class TextGeneratorXMLImpl : public TextGeneratorIntf { public: - TextGeneratorXMLImpl(std::ostream &t): m_t(t) {} + TextGeneratorXMLImpl(TextStream &t): m_t(t) {} void writeString(const char *s,bool /*keepSpaces*/) const { writeXMLString(m_t,s); @@ -217,7 +218,7 @@ class TextGeneratorXMLImpl : public TextGeneratorIntf writeXMLLink(m_t,extRef,file,anchor,text,0); } private: - std::ostream &m_t; + TextStream &m_t; }; //------------------------------------------------------------------------------------------- @@ -347,7 +348,7 @@ void XMLCodeGenerator::endCodeFragment(const char *) //------------------------------------------------------------------------------------------- -static void writeTemplateArgumentList(std::ostream &t, +static void writeTemplateArgumentList(TextStream &t, const ArgumentList &al, const Definition *scope, const FileDef *fileScope, @@ -390,17 +391,17 @@ static void writeTemplateArgumentList(std::ostream &t, } } -static void writeMemberTemplateLists(const MemberDef *md,std::ostream &t) +static void writeMemberTemplateLists(const MemberDef *md,TextStream &t) { writeTemplateArgumentList(t,md->templateArguments(),md->getClassDef(),md->getFileDef(),8); } -static void writeTemplateList(const ClassDef *cd,std::ostream &t) +static void writeTemplateList(const ClassDef *cd,TextStream &t) { writeTemplateArgumentList(t,cd->templateArguments(),cd,0,4); } -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 << " </sectiondef>\n"; } -static void writeListOfAllMembers(const ClassDef *cd,std::ostream &t) +static void writeListOfAllMembers(const ClassDef *cd,TextStream &t) { t << " <listofallmembers>\n"; for (auto &mni : cd->memberNameInfoLinkedMap()) @@ -1114,7 +1115,7 @@ static void writeListOfAllMembers(const ClassDef *cd,std::ostream &t) t << " </listofallmembers>\n"; } -static void writeInnerClasses(const ClassLinkedRefMap &cl,std::ostream &t) +static void writeInnerClasses(const ClassLinkedRefMap &cl,TextStream &t) { for (const auto &cd : cl) { @@ -1134,7 +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 << " <compounddef id=\"" @@ -1385,7 +1387,7 @@ static void generateXMLForClass(const ClassDef *cd,std::ostream &ti) ti << " </compound>\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 << " <compounddef id=\"" << nd->getOutputFileBase() @@ -1454,7 +1457,7 @@ static void generateXMLForNamespace(const NamespaceDef *nd,std::ostream &ti) ti << " </compound>\n"; } -static void generateXMLForFile(FileDef *fd,std::ostream &ti) +static void generateXMLForFile(FileDef *fd,TextStream &ti) { // + includes files // + includedby files @@ -1478,12 +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 << " <compounddef id=\"" << fd->getOutputFileBase() @@ -1567,7 +1571,7 @@ static void generateXMLForFile(FileDef *fd,std::ostream &ti) ti << " </compound>\n"; } -static void generateXMLForGroup(const GroupDef *gd,std::ostream &ti) +static void generateXMLForGroup(const GroupDef *gd,TextStream &ti) { // + members // + member groups @@ -1588,12 +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 << " <compounddef id=\"" @@ -1633,7 +1638,7 @@ static void generateXMLForGroup(const GroupDef *gd,std::ostream &ti) ti << " </compound>\n"; } -static void generateXMLForDir(DirDef *dd,std::ostream &ti) +static void generateXMLForDir(DirDef *dd,TextStream &ti) { if (dd->isReference()) return; // skip external references ti << " <compound refid=\"" << dd->getOutputFileBase() @@ -1642,12 +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 << " <compounddef id=\"" @@ -1670,7 +1676,7 @@ static void generateXMLForDir(DirDef *dd,std::ostream &ti) ti << " </compound>\n"; } -static void generateXMLForPage(PageDef *pd,std::ostream &ti,bool isExample) +static void generateXMLForPage(PageDef *pd,TextStream &ti,bool isExample) { // + name // + title @@ -1694,12 +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 << " <compounddef id=\"" << pageName; @@ -1824,102 +1831,108 @@ void generateXML() ResourceMgr::instance().copyResource("index.xsd",outputDirectory); QCString fileName=outputDirectory+"/compound.xsd"; - std::ofstream t(fileName.str(),std::ofstream::out | std::ofstream::binary); - if (!t.is_open()) + std::ofstream f(fileName.str(),std::ofstream::out | std::ofstream::binary); + if (!f.is_open()) { err("Cannot open file %s for writing!\n",fileName.data()); return; } - - // write compound.xsd, but replace special marker with the entities - QCString compound_xsd = ResourceMgr::instance().getAsString("compound.xsd"); - const char *startLine = compound_xsd.data(); - while (*startLine) { - // find end of the line - const char *endLine = startLine+1; - while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n - int len=endLine-startLine; - if (len>0) + TextStream t(&f); + + // write compound.xsd, but replace special marker with the entities + QCString compound_xsd = ResourceMgr::instance().getAsString("compound.xsd"); + const char *startLine = compound_xsd.data(); + while (*startLine) { - QCString s(len+1); - qstrncpy(s.rawData(),startLine,len); - s[len]='\0'; - if (s.find("<!-- Automatically insert here the HTML entities -->")!=-1) + // find end of the line + const char *endLine = startLine+1; + while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n + int len=static_cast<int>(endLine-startLine); + if (len>0) { - HtmlEntityMapper::instance()->writeXMLSchema(t); - } - else - { - t.write(startLine,len); + QCString s(len+1); + qstrncpy(s.rawData(),startLine,len); + s[len]='\0'; + if (s.find("<!-- Automatically insert here the HTML entities -->")!=-1) + { + HtmlEntityMapper::instance()->writeXMLSchema(t); + } + else + { + t.write(startLine,len); + } } + startLine=endLine; } - startLine=endLine; } - t.close(); + f.close(); 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 << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";; - t << "<doxygenindex xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; - t << "xsi:noNamespaceSchemaLocation=\"index.xsd\" "; - t << "version=\"" << getDoxygenVersion() << "\" "; - t << "xml:lang=\"" << theTranslator->trISOLang() << "\""; - t << ">\n"; + // write index header + t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";; + t << "<doxygenindex xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; + t << "xsi:noNamespaceSchemaLocation=\"index.xsd\" "; + t << "version=\"" << getDoxygenVersion() << "\" "; + t << "xml:lang=\"" << theTranslator->trISOLang() << "\""; + t << ">\n"; - for (const auto &cd : *Doxygen::classLinkedMap) - { - generateXMLForClass(cd.get(),t); - } - for (const auto &nd : *Doxygen::namespaceLinkedMap) - { - msg("Generating XML output for namespace %s\n",nd->name().data()); - generateXMLForNamespace(nd.get(),t); - } - for (const auto &fn : *Doxygen::inputNameLinkedMap) - { - for (const auto &fd : *fn) + for (const auto &cd : *Doxygen::classLinkedMap) { - msg("Generating XML output for file %s\n",fd->name().data()); - generateXMLForFile(fd.get(),t); + generateXMLForClass(cd.get(),t); + } + for (const auto &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 << " </compoundlist>\n"; - t << "</doxygenindex>\n"; + //t << " </compoundlist>\n"; + t << "</doxygenindex>\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; |