summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/code.l19
-rw-r--r--src/context.cpp64
-rw-r--r--src/dot.cpp4
-rw-r--r--src/dotdirdeps.cpp2
-rw-r--r--src/dotfilepatcher.cpp4
-rw-r--r--src/dotgfxhierarchytable.cpp2
-rw-r--r--src/dotgraph.cpp6
-rw-r--r--src/dotgroupcollaboration.cpp2
-rw-r--r--src/dotlegendgraph.cpp4
-rw-r--r--src/doxygen.cpp16
-rw-r--r--src/entry.cpp12
-rw-r--r--src/entry.h7
-rwxr-xr-xsrc/fortranscanner.l10
-rw-r--r--src/htmlgen.cpp6
-rw-r--r--src/index.cpp16
-rw-r--r--src/latexgen.cpp6
-rw-r--r--src/lexscanner.l2
-rw-r--r--src/msc.cpp2
-rw-r--r--src/pyscanner.l189
-rw-r--r--src/qhpxmlwriter.cpp3
-rw-r--r--src/qhpxmlwriter.h2
-rw-r--r--src/scanner.l412
-rw-r--r--src/sqlite3gen.cpp2
-rw-r--r--src/template.cpp6
-rw-r--r--src/utf8.cpp2
-rw-r--r--src/util.cpp32
26 files changed, 418 insertions, 414 deletions
diff --git a/src/code.l b/src/code.l
index 90c1ff3..a0ace11 100644
--- a/src/code.l
+++ b/src/code.l
@@ -34,6 +34,7 @@
#include <vector>
#include <string>
#include <mutex>
+#include <sstream>
#include <stdio.h>
#include <assert.h>
@@ -74,10 +75,11 @@
// context for an Objective-C method call
struct ObjCCallCtx
{
+ ObjCCallCtx() : comment(std::ios_base::ate) {}
int id;
QCString methodName;
QCString objectTypeOrName;
- QGString comment;
+ std::ostringstream comment;
const ClassDef *objectType;
const MemberDef *objectVar;
const MemberDef *method;
@@ -1435,18 +1437,19 @@ ENDQopt ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"seale
}
<ObjCCall,ObjCMName>{CCS} {
yyextra->lastObjCCallContext = YY_START;
- yyextra->currentCtx->comment=yytext;
+ yyextra->currentCtx->comment.str(yytext);
BEGIN(ObjCCallComment);
}
<ObjCCallComment>{CCE} {
- yyextra->currentCtx->comment+=yytext;
- yyextra->currentCtx->format+=escapeComment(yyscanner,yyextra->currentCtx->comment);
+ yyextra->currentCtx->comment << yytext;
+ std::string commentStr = yyextra->currentCtx->comment.str();
+ yyextra->currentCtx->format+=escapeComment(yyscanner,commentStr.c_str());
BEGIN(yyextra->lastObjCCallContext);
}
-<ObjCCallComment>[^*\n]+ { yyextra->currentCtx->comment+=yytext; }
-<ObjCCallComment>{CPPC}|{CCS} { yyextra->currentCtx->comment+=yytext; }
-<ObjCCallComment>\n { yyextra->currentCtx->comment+=*yytext; }
-<ObjCCallComment>. { yyextra->currentCtx->comment+=*yytext; }
+<ObjCCallComment>[^*\n]+ { yyextra->currentCtx->comment << yytext; }
+<ObjCCallComment>{CPPC}|{CCS} { yyextra->currentCtx->comment << yytext; }
+<ObjCCallComment>\n { yyextra->currentCtx->comment << *yytext; }
+<ObjCCallComment>. { yyextra->currentCtx->comment << *yytext; }
<ObjCCall>{ID} {
yyextra->currentCtx->format+=escapeObject(yyscanner,yytext);
if (yyextra->braceCount==0)
diff --git a/src/context.cpp b/src/context.cpp
index ec1d7a4..dec48c9 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::stringstream ts;
+ std::ostringstream ts(std::ios_base::ate);
switch (g_globals.outputFormat)
{
case ContextOutputFormat_Html:
@@ -1281,12 +1281,12 @@ static TemplateVariant parseDoc(const Definition *def,const QCString &file,int l
err("context.cpp: output format not yet supported\n");
break;
}
- QCString docs = ts.str().c_str();
+ std::string docs = ts.str();
bool isEmpty = root->isEmpty();
if (isEmpty)
result = "";
else
- result = TemplateVariant(docs,TRUE);
+ result = TemplateVariant(docs.c_str(),TRUE);
delete root;
return result;
}
@@ -1296,7 +1296,7 @@ static TemplateVariant parseCode(MemberDef *md,const QCString &scopeName,const Q
{
auto intf = Doxygen::parserManager->getCodeParser(md->getDefFileExtension());
intf->resetCodeParserState();
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
switch (g_globals.outputFormat)
{
case ContextOutputFormat_Html:
@@ -1327,7 +1327,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::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
switch (g_globals.outputFormat)
{
case ContextOutputFormat_Html:
@@ -1949,7 +1949,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
}
TemplateVariant inheritanceDiagram() const
{
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
static bool haveDot = Config_getBool(HAVE_DOT);
static bool classDiagrams = Config_getBool(CLASS_DIAGRAMS);
static bool classGraph = Config_getBool(CLASS_GRAPH);
@@ -1990,13 +1990,13 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
{
case ContextOutputFormat_Html:
{
- std::stringstream tt;
+ std::ostringstream tt(std::ios_base::ate);
QCString name = convertToHtml(m_classDef->displayName());
d.writeImage(tt,g_globals.outputDir,
relPathAsString(),
m_classDef->getOutputFileBase());
- if (tt.tellg()>0)
+ if (tt.tellp()>0)
{
t << "<div class=\"center\">\n";
t << " <img src=\"";
@@ -2049,7 +2049,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
TemplateVariant collaborationDiagram() const
{
static bool haveDot = Config_getBool(HAVE_DOT);
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
if (haveDot)
{
DotClassGraph *cg = getCollaborationGraph();
@@ -3054,7 +3054,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private>
TemplateVariant includeGraph() const
{
static bool haveDot = Config_getBool(HAVE_DOT);
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
if (haveDot)
{
DotInclDepGraph *cg = getIncludeGraph();
@@ -3106,7 +3106,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private>
TemplateVariant includedByGraph() const
{
static bool haveDot = Config_getBool(HAVE_DOT);
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
if (haveDot)
{
DotInclDepGraph *cg = getIncludedByGraph();
@@ -3512,7 +3512,7 @@ class DirContext::Private : public DefinitionContext<DirContext::Private>
}
TemplateVariant dirGraph() const
{
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
static bool haveDot = Config_getBool(HAVE_DOT);
static bool dirGraph = Config_getBool(DIRECTORY_GRAPH);
if (haveDot && dirGraph)
@@ -3896,7 +3896,7 @@ class TextGeneratorFactory
TemplateVariant createLinkedText(const Definition *def,const QCString &relPath,const QCString &text)
{
- std::stringstream ts;
+ std::ostringstream ts(std::ios_base::ate);
TextGeneratorIntf *tg = TextGeneratorFactory::instance()->create(ts,relPath);
if (tg)
{
@@ -4937,7 +4937,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
if (hasCallGraph().toBool())
{
DotCallGraph *cg = getCallGraph();
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
switch (g_globals.outputFormat)
{
case ContextOutputFormat_Html:
@@ -5009,7 +5009,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
if (hasCallerGraph().toBool())
{
DotCallGraph *cg = getCallerGraph();
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
switch (g_globals.outputFormat)
{
case ContextOutputFormat_Html:
@@ -5273,7 +5273,7 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private>
}
TemplateVariant groupGraph() const
{
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
static bool haveDot = Config_getBool(HAVE_DOT);
static bool groupGraphs = Config_getBool(GROUP_GRAPHS);
if (haveDot && groupGraphs)
@@ -8291,7 +8291,7 @@ class InheritanceGraphContext::Private
}
TemplateVariant graph() const
{
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
static bool haveDot = Config_getBool(HAVE_DOT);
static bool graphicalHierarchy = Config_getBool(GRAPHICAL_HIERARCHY);
if (haveDot && graphicalHierarchy)
@@ -9892,7 +9892,7 @@ class LatexSpaceless : public TemplateSpacelessIntf
void reset() { }
QCString remove(const QCString &s)
{
- QGString result;
+ std::ostringstream result(std::ios_base::ate);
const char *p = s.data();
char c;
while ((c=*p++))
@@ -9902,12 +9902,11 @@ class LatexSpaceless : public TemplateSpacelessIntf
case '\t': case ' ': case '\n':
break;
default:
- result+=c;
+ result << c;
break;
}
}
- result+='\0';
- return result.data();
+ return result.str();
}
private:
};
@@ -9926,7 +9925,7 @@ class HtmlSpaceless : public TemplateSpacelessIntf
}
QCString remove(const QCString &s)
{
- QGString result;
+ std::ostringstream result(std::ios_base::ate);
const char *p = s.data();
char c;
while ((c=*p++))
@@ -9935,15 +9934,15 @@ class HtmlSpaceless : public TemplateSpacelessIntf
{
case '<': // start of a tag
if (!m_insideString) m_insideTag=TRUE,m_removeSpaces=FALSE;
- result+=c;
+ result << c;
break;
case '>': // end of a tag
if (!m_insideString) m_insideTag=FALSE,m_removeSpaces=TRUE;
- result+=c;
+ result << c;
break;
case '\\': // escaped character in a string
- result+=c;
- if (m_insideString && *p) result+=*p++;
+ result << c;
+ if (m_insideString && *p) result << *p++;
break;
case '"': case '\'':
if (m_insideTag)
@@ -9957,7 +9956,7 @@ class HtmlSpaceless : public TemplateSpacelessIntf
m_insideString=c;
}
}
- result+=c;
+ result << c;
break;
case ' ': case '\t': case '\n': // whitespace
if (!m_insideTag) // outside tags strip consecutive whitespace
@@ -9966,20 +9965,19 @@ class HtmlSpaceless : public TemplateSpacelessIntf
}
else
{
- result+=' ';
+ result << ' ';
}
break;
default:
//if (m_removeSpaces) result+=' ';
- result+=c;
+ result << c;
m_removeSpaces=FALSE;
break;
}
}
- result+='\0';
//printf("HtmlSpaceless::remove({%s})={%s} m_insideTag=%d m_insideString=%c (%d) removeSpaces=%d\n",s.data(),result.data(),
// m_insideTag,m_insideString,m_insideString,m_removeSpaces);
- return result.data();
+ return result.str();
}
private:
bool m_insideTag;
@@ -10117,7 +10115,7 @@ void generateOutputViaTemplate()
HtmlSpaceless spl;
ctx->setSpacelessIntf(&spl);
ctx->setOutputDirectory(g_globals.outputDir);
- std::stringstream ts;
+ std::ostringstream ts(std::ios_base::ate);
tpl->render(ts,ctx);
e.unload(tpl);
}
@@ -10142,7 +10140,7 @@ void generateOutputViaTemplate()
LatexSpaceless spl;
ctx->setSpacelessIntf(&spl);
ctx->setOutputDirectory(g_globals.outputDir);
- std::stringstream ts;
+ std::ostringstream ts(std::ios_base::ate);
tpl->render(ts,ctx);
e.unload(tpl);
}
diff --git a/src/dot.cpp b/src/dot.cpp
index 8deb0d8..6a38a6e 100644
--- a/src/dot.cpp
+++ b/src/dot.cpp
@@ -354,11 +354,11 @@ void writeDotImageMapFromFile(std::ostream &t,
}
else // bitmap graphics
{
- std::stringstream tt;
+ std::ostringstream tt(std::ios_base::ate);
t << "<img src=\"" << relPath << imgName << "\" alt=\""
<< imgName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>\n";
DotFilePatcher::convertMapFile(tt, absOutFile, relPath ,TRUE, context);
- if (tt.tellg()>0)
+ if (tt.tellp()>0)
{
t << "<map name=\"" << mapName << "\" id=\"" << mapName << "\">";
t << tt.str();
diff --git a/src/dotdirdeps.cpp b/src/dotdirdeps.cpp
index 8e203c7..680b2f7 100644
--- a/src/dotdirdeps.cpp
+++ b/src/dotdirdeps.cpp
@@ -199,7 +199,7 @@ QCString DotDirDeps::getBaseName() const
void DotDirDeps::computeTheGraph()
{
// compute md5 checksum of the graph were are about to generate
- std::stringstream md5stream;
+ std::ostringstream md5stream(std::ios_base::ate);
//m_dir->writeDepGraph(md5stream);
writeDotDirDepGraph(md5stream,m_dir,m_linkRelations);
m_theGraph = md5stream.str();
diff --git a/src/dotfilepatcher.cpp b/src/dotfilepatcher.cpp
index 2d934f0..d19dc4a 100644
--- a/src/dotfilepatcher.cpp
+++ b/src/dotfilepatcher.cpp
@@ -411,12 +411,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::stringstream tt;
+ std::ostringstream tt(std::ios_base::ate);
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.tellg()>0)
+ if (tt.tellp()>0)
{
t << "<map name=\"" << correctId(map.label) << "\" id=\"" << correctId(map.label) << "\">\n";
t << tt.str();
diff --git a/src/dotgfxhierarchytable.cpp b/src/dotgfxhierarchytable.cpp
index f05f982..4684f96 100644
--- a/src/dotgfxhierarchytable.cpp
+++ b/src/dotgfxhierarchytable.cpp
@@ -35,7 +35,7 @@ QCString DotGfxHierarchyTable::getBaseName() const
void DotGfxHierarchyTable::computeTheGraph()
{
- std::stringstream md5stream;
+ std::ostringstream md5stream(std::ios_base::ate);
writeGraphHeader(md5stream,theTranslator->trGraphicalHierarchy());
md5stream << " rankdir=\"LR\";\n";
for (auto node : m_rootNodes)
diff --git a/src/dotgraph.cpp b/src/dotgraph.cpp
index 1f5d5a0..d9dd91e 100644
--- a/src/dotgraph.cpp
+++ b/src/dotgraph.cpp
@@ -82,9 +82,9 @@ static bool insertMapFile(std::ostream &out,const QCString &mapFile,
FileInfo fi(mapFile.str());
if (fi.exists() && fi.size()>0) // reuse existing map file
{
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
DotFilePatcher::convertMapFile(t,mapFile,relPath,false);
- if (t.tellg()>0)
+ if (t.tellp()>0)
{
out << "<map name=\"" << mapLabel << "\" id=\"" << mapLabel << "\">\n";
out << t.str();
@@ -307,7 +307,7 @@ void DotGraph::computeGraph(DotNode *root,
QCString &graphStr)
{
//printf("computeMd5Signature\n");
- std::stringstream md5stream;
+ std::ostringstream md5stream(std::ios_base::ate);
writeGraphHeader(md5stream,title);
if (!rank.isEmpty())
{
diff --git a/src/dotgroupcollaboration.cpp b/src/dotgroupcollaboration.cpp
index 34359dd..9ee0bba 100644
--- a/src/dotgroupcollaboration.cpp
+++ b/src/dotgroupcollaboration.cpp
@@ -209,7 +209,7 @@ QCString DotGroupCollaboration::getBaseName() const
void DotGroupCollaboration::computeTheGraph()
{
- std::stringstream md5stream;
+ std::ostringstream md5stream(std::ios_base::ate);
writeGraphHeader(md5stream,m_rootNode->label());
// clean write flags
diff --git a/src/dotlegendgraph.cpp b/src/dotlegendgraph.cpp
index c1f800b..0389a1d 100644
--- a/src/dotlegendgraph.cpp
+++ b/src/dotlegendgraph.cpp
@@ -25,7 +25,7 @@
void DotLegendGraph::writeGraph(const char *path)
{
- std::stringstream ts;
+ std::ostringstream ts(std::ios_base::ate);
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::stringstream md5stream;
+ std::ostringstream md5stream(std::ios_base::ate);
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/doxygen.cpp b/src/doxygen.cpp
index cb9ed19..f7f6d01 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -2048,7 +2048,7 @@ static MemberDef *addVariableToClass(
qPrint(args),
root->protection,
fromAnnScope,
- qPrint(root->initializer)
+ qPrint(root->initializer.str())
);
QCString def;
@@ -2147,7 +2147,8 @@ static MemberDef *addVariableToClass(
md->setFromAnonymousMember(fromAnnMemb);
//md->setIndentDepth(indentDepth);
md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine);
- md->setInitializer(root->initializer);
+ std::string init = root->initializer.str();
+ md->setInitializer(init.c_str());
md->setMaxInitLines(root->initLines);
md->setMemberGroupId(root->mGrpId);
md->setMemberSpecifiers(root->spec);
@@ -2382,7 +2383,8 @@ static MemberDef *addVariableToFile(
md->addSectionsToDefinition(root->anchors);
md->setFromAnonymousScope(fromAnnScope);
md->setFromAnonymousMember(fromAnnMemb);
- md->setInitializer(root->initializer);
+ std::string init = root->initializer.str();
+ md->setInitializer(init.c_str());
md->setMaxInitLines(root->initLines);
md->setMemberGroupId(root->mGrpId);
md->setDefinition(def);
@@ -5018,10 +5020,11 @@ static void addMemberDocs(const Entry *root,
// md->initializer().data(),md->initializer().isEmpty(),
// root->initializer.data(),root->initializer.isEmpty()
// );
- if (md->initializer().isEmpty() && !root->initializer.isEmpty())
+ std::string rootInit = root->initializer.str();
+ if (md->initializer().isEmpty() && !rootInit.empty())
{
//printf("setInitializer\n");
- md->setInitializer(root->initializer);
+ md->setInitializer(rootInit.c_str());
}
md->setMaxInitLines(root->initLines);
@@ -7133,7 +7136,8 @@ static void addEnumValuesToEnums(const Entry *root)
fmd->setDocumentation(e->doc,e->docFile,e->docLine);
fmd->setBriefDescription(e->brief,e->briefFile,e->briefLine);
fmd->addSectionsToDefinition(e->anchors);
- fmd->setInitializer(e->initializer);
+ std::string init = e->initializer.str();
+ fmd->setInitializer(init.c_str());
fmd->setMaxInitLines(e->initLines);
fmd->setMemberGroupId(e->mGrpId);
fmd->setExplicitExternal(e->explicitExternal,fileName,e->startLine,e->startColumn);
diff --git a/src/entry.cpp b/src/entry.cpp
index 9962b3f..cd4ec1e 100644
--- a/src/entry.cpp
+++ b/src/entry.cpp
@@ -28,7 +28,7 @@
static AtomicInt g_num;
-Entry::Entry()
+Entry::Entry() : program(std::ios_base::ate), initializer(std::ios_base::ate)
{
//printf("Entry::Entry(%p)\n",this);
g_num++;
@@ -43,7 +43,7 @@ Entry::Entry()
reset();
}
-Entry::Entry(const Entry &e)
+Entry::Entry(const Entry &e) : program(std::ios_base::ate), initializer(std::ios_base::ate)
{
//printf("Entry::Entry(%p):copy\n",this);
g_num++;
@@ -70,8 +70,8 @@ Entry::Entry(const Entry &e)
bitfields = e.bitfields;
argList = e.argList;
tArgLists = e.tArgLists;
- program = e.program;
- initializer = e.initializer;
+ program.str(e.program.str());
+ initializer.str(e.initializer.str());
includeFile = e.includeFile;
includeName = e.includeName;
doc = e.doc;
@@ -189,7 +189,7 @@ void Entry::reset()
args.resize(0);
bitfields.resize(0);
exception.resize(0);
- program.resize(0);
+ program.str(std::string());
includeFile.resize(0);
includeName.resize(0);
doc.resize(0);
@@ -205,7 +205,7 @@ void Entry::reset()
inbodyLine=-1;
inside.resize(0);
fileName.resize(0);
- initializer.resize(0);
+ initializer.str(std::string());
initLines = -1;
startLine = 1;
startColumn = 1;
diff --git a/src/entry.h b/src/entry.h
index f11870a..cf46efb 100644
--- a/src/entry.h
+++ b/src/entry.h
@@ -18,10 +18,9 @@
#ifndef ENTRY_H
#define ENTRY_H
-#include <qgstring.h>
-
#include <vector>
#include <memory>
+#include <sstream>
#include "types.h"
#include "arguments.h"
@@ -257,8 +256,8 @@ class Entry
QCString bitfields; //!< member's bit fields
ArgumentList argList; //!< member arguments as a list
ArgumentLists tArgLists; //!< template argument declarations
- QGString program; //!< the program text
- QGString initializer; //!< initial value (for variables)
+ std::ostringstream program; //!< the program text
+ std::ostringstream 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/fortranscanner.l b/src/fortranscanner.l
index 34ca344..0cf49ee 100755
--- a/src/fortranscanner.l
+++ b/src/fortranscanner.l
@@ -1030,11 +1030,11 @@ private {
yy_pop_state(yyscanner); // end initialization
if (yyextra->last_enum)
{
- yyextra->last_enum->initializer= yyextra->initializer;
+ yyextra->last_enum->initializer.str(yyextra->initializer.str());
}
else
{
- if (yyextra->vtype == V_VARIABLE) yyextra->last_entry->initializer= yyextra->initializer;
+ if (yyextra->vtype == V_VARIABLE) yyextra->last_entry->initializer.str(yyextra->initializer.str());
}
}
else
@@ -1046,11 +1046,11 @@ private {
yy_pop_state(yyscanner); // end initialization
if (yyextra->last_enum)
{
- yyextra->last_enum->initializer= yyextra->initializer;
+ yyextra->last_enum->initializer.str(yyextra->initializer.str());
}
else
{
- if (yyextra->vtype == V_VARIABLE) yyextra->last_entry->initializer= yyextra->initializer;
+ if (yyextra->vtype == V_VARIABLE) yyextra->last_entry->initializer.str(yyextra->initializer.str());
}
yyextra->colNr -= 1;
unput(*yytext);
@@ -2715,7 +2715,7 @@ static void parseMain(yyscan_t yyscanner, const char *fileName,const char *fileB
//debugCompounds(rt); //debug
- rt->program.resize(0);
+ rt->program.str(std::string());
//delete yyextra->current; yyextra->current=0;
yyextra->moduleProcedures.clear();
if (tmpBuf)
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp
index 59d4868..4c3f800 100644
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -301,7 +301,7 @@ static QCString getConvertLatexMacro()
static QCString getSearchBox(bool serverSide, QCString relPath, bool highlightSearch)
{
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
if (serverSide)
{
writeServerSearchBox(t, relPath, highlightSearch);
@@ -1565,9 +1565,9 @@ void HtmlGenerator::endClassDiagram(const ClassDiagram &d,
startSectionSummary(t,m_sectionCount);
endSectionSummary(t);
startSectionContent(t,m_sectionCount);
- std::stringstream tt;
+ std::ostringstream tt(std::ios_base::ate);
d.writeImage(tt,dir(),m_relPath,fileName);
- if (tt.tellg()>0)
+ if (tt.tellp()>0)
{
t << " <div class=\"center\">\n";
t << " <img src=\"";
diff --git a/src/index.cpp b/src/index.cpp
index ded45a9..5554987 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::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
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::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
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::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
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::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
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::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
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::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
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::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
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::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
ftv->generateTreeViewInline(t);
ol.disableAllBut(OutputGenerator::Html);
ol.writeString(t.str().c_str());
diff --git a/src/latexgen.cpp b/src/latexgen.cpp
index 300af19..c0c3e47 100644
--- a/src/latexgen.cpp
+++ b/src/latexgen.cpp
@@ -613,7 +613,7 @@ static QCString substituteLatexKeywords(const QCString &str,
style="plain";
}
- std::stringstream tg;
+ std::ostringstream tg(std::ios_base::ate);
bool timeStamp = Config_getBool(LATEX_TIMESTAMP);
QCString generatedBy;
if (timeStamp)
@@ -639,11 +639,11 @@ static QCString substituteLatexKeywords(const QCString &str,
if (latexEmojiDirectory.isEmpty()) latexEmojiDirectory = ".";
latexEmojiDirectory = substitute(latexEmojiDirectory,"\\","/");
- std::stringstream tg1;
+ std::ostringstream tg1(std::ios_base::ate);
writeExtraLatexPackages(tg1);
QCString extraLatexPackages = tg1.str();
- std::stringstream tg2;
+ std::ostringstream tg2(std::ios_base::ate);
writeLatexSpecialFormulaChars(tg2);
QCString latexSpecialFormulaChars = tg2.str();
diff --git a/src/lexscanner.l b/src/lexscanner.l
index 47d3443..f148e16 100644
--- a/src/lexscanner.l
+++ b/src/lexscanner.l
@@ -893,7 +893,7 @@ static void parseMain(yyscan_t yyscanner,
lexscannerYYlex(yyscanner);
- rt->program.resize(0);
+ rt->program.str(std::string());
}
//----------------------------------------------------------------------------
diff --git a/src/msc.cpp b/src/msc.cpp
index 0be1c31..8b45faa 100644
--- a/src/msc.cpp
+++ b/src/msc.cpp
@@ -153,7 +153,7 @@ static QCString getMscImageMapFromFile(const QCString& inFile, const QCString& o
return "";
}
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
convertMapFile(t, outFile, relPath, context);
QCString result = t.str();
diff --git a/src/pyscanner.l b/src/pyscanner.l
index 925ae7e..6660915 100644
--- a/src/pyscanner.l
+++ b/src/pyscanner.l
@@ -63,9 +63,10 @@
struct pyscannerYY_state
{
+ pyscannerYY_state() : defVal(std::ios_base::ate) {}
CommentScanner commentScanner;
OutlineParserInterface *thisParser = 0;
- const char * inputString = 0;
+ QCString inputString;
yy_size_t inputPosition = 0;
Protection protection = Public;
std::shared_ptr<Entry> current_root;
@@ -86,7 +87,7 @@ struct pyscannerYY_state
bool doubleQuote = FALSE;
bool specialBlock = FALSE;
int stringContext = 0;
- QGString * copyString = 0;
+ std::ostringstream * copyString = 0;
int indent = 0;
int curIndent = 0;
int commentIndent = 0;
@@ -97,7 +98,7 @@ struct pyscannerYY_state
int atomCount = 0;
QCString moduleScope;
QCString packageName;
- QGString defVal;
+ std::ostringstream defVal;
int braceCount = 0;
bool lexInit = FALSE;
bool packageCommentAllowed = FALSE;
@@ -543,7 +544,7 @@ STARTDOCSYMS "##"
else
{
incLineNr(yyscanner);
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
}
\n{B}/"##" {
@@ -561,7 +562,7 @@ STARTDOCSYMS "##"
else
{
incLineNr(yyscanner);
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
}
<<EOF>> {
@@ -569,10 +570,10 @@ STARTDOCSYMS "##"
yyterminate();
}
^{BB}/\n { // skip empty line
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
^{BB} { // something at indent >0
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
yyextra->curIndent = computeIndent(yytext);
if (yyextra->curIndent<=yyextra->indent)
// jumped out of the function
@@ -582,46 +583,46 @@ STARTDOCSYMS "##"
}
}
"'" { // start of a single quoted string
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
yyextra->stringContext=YY_START;
yyextra->specialBlock = FALSE;
yyextra->copyString=&yyextra->current->program;
BEGIN( SingleQuoteString );
}
"\"" { // start of a double quoted string
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
yyextra->stringContext=YY_START;
yyextra->specialBlock = FALSE;
yyextra->copyString=&yyextra->current->program;
BEGIN( DoubleQuoteString );
}
[^ \t\n#'".]+ { // non-special stuff
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
yyextra->specialBlock = FALSE;
}
^{POUNDCOMMENT} { // normal comment
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
"#".* { // comment half way
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
{NEWLINE} {
incLineNr(yyscanner);
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
. { // any character
- yyextra->current->program+=*yytext;
+ yyextra->current->program << *yytext;
yyextra->specialBlock = FALSE;
}
{TRIDOUBLEQUOTE} { // start of a comment block
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
initTriDoubleQuoteBlock(yyscanner);
BEGIN(TripleComment);
}
{TRISINGLEQUOTE} { // start of a comment block
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
initTriSingleQuoteBlock(yyscanner);
BEGIN(TripleComment);
}
@@ -652,7 +653,7 @@ STARTDOCSYMS "##"
}
"->" {
- yyextra->defVal.resize(0);
+ yyextra->defVal.str(std::string());
yyextra->braceCount = 0;
BEGIN(FunctionTypeAnnotation);
}
@@ -689,7 +690,7 @@ STARTDOCSYMS "##"
"=" { // default value
// TODO: this rule is too simple, need to be able to
// match things like =")" as well!
- yyextra->defVal.resize(0);
+ yyextra->defVal.str(std::string());
yyextra->braceCount = 0;
BEGIN(FunctionParamDefVal);
}
@@ -698,7 +699,7 @@ STARTDOCSYMS "##"
BEGIN(FunctionDec);
}
":"{B} {
- yyextra->defVal.resize(0);
+ yyextra->defVal.str(std::string());
yyextra->braceCount = 0;
BEGIN(FunctionAnnotation);
}
@@ -714,42 +715,42 @@ STARTDOCSYMS "##"
"[" |
"(" {
++yyextra->braceCount;
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
}
"}" |
"]" |
")" {
--yyextra->braceCount;
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
}
":" {
if (yyextra->braceCount == 0)
{
- yyextra->current->type = yyextra->defVal.data();
+ yyextra->current->type = yyextra->defVal.str();
unput(*yytext);
BEGIN(FunctionDec);
}
else
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
}
"'" {
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
yyextra->copyString=&yyextra->defVal;
yyextra->stringContext=FunctionTypeAnnotation;
BEGIN(SingleQuoteString);
}
"\"" {
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
yyextra->copyString=&yyextra->defVal;
yyextra->stringContext=FunctionTypeAnnotation;
BEGIN(DoubleQuoteString);
}
\n {
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
incLineNr(yyscanner);
}
. {
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
}
}
@@ -758,12 +759,12 @@ STARTDOCSYMS "##"
"[" |
"(" {
++yyextra->braceCount;
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
}
"}" |
"]" {
--yyextra->braceCount;
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
}
")" |
"=" |
@@ -771,7 +772,7 @@ STARTDOCSYMS "##"
if (yyextra->braceCount == 0)
{
if (!yyextra->current->argList.empty())
- yyextra->current->argList.back().type += yyextra->defVal;
+ yyextra->current->argList.back().type += yyextra->defVal.str();
if (*yytext != ',')
unput(*yytext);
BEGIN(FunctionParams);
@@ -780,27 +781,27 @@ STARTDOCSYMS "##"
{
if (*yytext == ')')
--yyextra->braceCount;
- yyextra->defVal += *yytext;
+ yyextra->defVal << *yytext;
}
}
"'" {
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
yyextra->copyString=&yyextra->defVal;
yyextra->stringContext=FunctionAnnotation;
BEGIN(SingleQuoteString);
}
"\"" {
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
yyextra->copyString=&yyextra->defVal;
yyextra->stringContext=FunctionAnnotation;
BEGIN(DoubleQuoteString);
}
\n {
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
incLineNr(yyscanner);
}
. {
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
}
}
@@ -809,19 +810,19 @@ STARTDOCSYMS "##"
"[" |
"(" { // internal opening brace, assumption is that we have correct code so braces do match
++yyextra->braceCount;
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
}
"}" |
"]" {
--yyextra->braceCount;
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
}
")" |
"," {
if (yyextra->braceCount == 0)
{
if (!yyextra->current->argList.empty())
- yyextra->current->argList.back().defval=QCString(yyextra->defVal).stripWhiteSpace();
+ yyextra->current->argList.back().defval=QCString(yyextra->defVal.str()).stripWhiteSpace();
if (*yytext == ')')
unput(*yytext);
BEGIN(FunctionParams);
@@ -830,28 +831,28 @@ STARTDOCSYMS "##"
{
if (*yytext == ')')
--yyextra->braceCount;
- yyextra->defVal += *yytext;
+ yyextra->defVal << *yytext;
}
}
"'" {
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
yyextra->copyString=&yyextra->defVal;
yyextra->stringContext=FunctionParamDefVal;
BEGIN( SingleQuoteString );
}
"\"" {
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
yyextra->copyString=&yyextra->defVal;
yyextra->stringContext=FunctionParamDefVal;
BEGIN( DoubleQuoteString );
}
\n {
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
incLineNr(yyscanner);
}
. {
- yyextra->defVal+=*yytext;
+ yyextra->defVal << *yytext;
}
}
@@ -872,7 +873,7 @@ STARTDOCSYMS "##"
BEGIN(Search);
}
^{BB}/\n { // skip empty line
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
<<EOF>> {
endOfDef(yyscanner);
@@ -893,49 +894,49 @@ STARTDOCSYMS "##"
}
else
{
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
}
"'" { // start of a single quoted string
- yyextra->current->program+=*yytext;
+ yyextra->current->program << *yytext;
yyextra->stringContext=YY_START;
yyextra->specialBlock = FALSE;
yyextra->copyString=&yyextra->current->program;
BEGIN( SingleQuoteString );
}
"\"" { // start of a double quoted string
- yyextra->current->program+=*yytext;
+ yyextra->current->program << *yytext;
yyextra->stringContext=YY_START;
yyextra->specialBlock = FALSE;
yyextra->copyString=&yyextra->current->program;
BEGIN( DoubleQuoteString );
}
[^ \t\n#'"]+ { // non-special stuff
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
yyextra->specialBlock = FALSE;
//yyextra->hideClassDocs = FALSE;
}
{NEWLINE} {
- yyextra->current->program+=*yytext;
+ yyextra->current->program << *yytext;
incLineNr(yyscanner);
}
{POUNDCOMMENT} { // normal comment
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
. { // any character
yyextra->specialBlock = FALSE;
- yyextra->current->program+=*yytext;
+ yyextra->current->program << *yytext;
}
{TRIDOUBLEQUOTE} { // start of a comment block
//if (!yyextra->hideClassDocs)
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
initTriDoubleQuoteBlock(yyscanner);
BEGIN(TripleComment);
}
{TRISINGLEQUOTE} { // start of a comment block
//if (!yyextra->hideClassDocs)
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
initTriSingleQuoteBlock(yyscanner);
BEGIN(TripleComment);
}
@@ -974,7 +975,7 @@ STARTDOCSYMS "##"
":" { // begin of the class definition
yyextra->specialBlock = TRUE; // expecting a docstring
yyextra->current->bodyLine = yyextra->yyLineNr;
- yyextra->current->program.resize(0);
+ yyextra->current->program.str(std::string());
BEGIN(ClassCaptureIndent);
}
@@ -1011,17 +1012,17 @@ STARTDOCSYMS "##"
"\n"|({BB}"\n") {
// Blankline - ignore, keep looking for indentation.
lineCount(yyscanner);
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
{TRIDOUBLEQUOTE} { // start of a comment block
initTriDoubleQuoteBlock(yyscanner);
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
BEGIN(TripleComment);
}
{TRISINGLEQUOTE} { // start of a comment block
initTriSingleQuoteBlock(yyscanner);
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
BEGIN(TripleComment);
}
{STARTDOCSYMS}[#]* { // start of a special comment
@@ -1031,7 +1032,7 @@ STARTDOCSYMS "##"
{POUNDCOMMENT} { // ignore comment with just one #
}
^{BB} {
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
//yyextra->current->startLine = yyextra->yyLineNr;
yyextra->curIndent=computeIndent(yytext);
yyextra->bodyEntry = yyextra->current;
@@ -1045,7 +1046,7 @@ STARTDOCSYMS "##"
// Just pushback an empty class, and
// resume parsing the body.
newEntry(yyscanner);
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
// printf("Failed to find indent - skipping!");
BEGIN( Search );
@@ -1057,41 +1058,41 @@ STARTDOCSYMS "##"
"=" { // the assignment operator
//printf("====== VariableDec at line %d\n",yyextra->yyLineNr);
yyextra->start_init = TRUE;
- yyextra->current->initializer = yytext;
- yyextra->current->initializer += " ";
+ yyextra->current->initializer.str(yytext);
+ yyextra->current->initializer << " ";
}
{B} { // spaces
- yyextra->current->initializer += yytext;
+ yyextra->current->initializer << yytext;
}
{INTNUMBER} { // integer value
if (yyextra->current-> type.isEmpty()) yyextra->current->type = "int";
- yyextra->current->initializer += yytext;
+ yyextra->current->initializer << yytext;
}
{FLOATNUMBER} { // floating point value
if (yyextra->current->type.isEmpty()) yyextra->current->type = "float";
- yyextra->current->initializer += yytext;
+ yyextra->current->initializer << yytext;
}
{BOOL} { // boolean value
if (yyextra->current->type.isEmpty()) yyextra->current->type = "bool";
- yyextra->current->initializer += yytext;
+ yyextra->current->initializer << yytext;
}
{STRINGPREFIX}?"'" { // string
if (yyextra->current->type.isEmpty()) yyextra->current->type = "string";
- yyextra->current->initializer += yytext;
+ yyextra->current->initializer << yytext;
yyextra->copyString=&yyextra->current->initializer;
yyextra->stringContext=VariableDec;
BEGIN( SingleQuoteString );
}
{STRINGPREFIX}?"\"" { // string
if (yyextra->current->type.isEmpty()) yyextra->current->type = "string";
- yyextra->current->initializer += yytext;
+ yyextra->current->initializer << yytext;
yyextra->copyString=&yyextra->current->initializer;
yyextra->stringContext=VariableDec;
BEGIN( DoubleQuoteString );
}
{TRIDOUBLEQUOTE} { // start of a comment block
if (yyextra->current->type.isEmpty()) yyextra->current->type = "string";
- yyextra->current->initializer += yytext;
+ yyextra->current->initializer << yytext;
yyextra->doubleQuote=TRUE;
yyextra->copyString=&yyextra->current->initializer;
yyextra->stringContext=VariableDec;
@@ -1100,7 +1101,7 @@ STARTDOCSYMS "##"
{TRISINGLEQUOTE} { // start of a comment block
if (yyextra->current->type.isEmpty()) yyextra->current->type = "string";
- yyextra->current->initializer += yytext;
+ yyextra->current->initializer << yytext;
yyextra->doubleQuote=FALSE;
yyextra->copyString=&yyextra->current->initializer;
yyextra->stringContext=VariableDec;
@@ -1111,7 +1112,7 @@ STARTDOCSYMS "##"
{
yyextra->current->type = "tuple";
}
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
yyextra->atomStart='(';
yyextra->atomEnd=')';
yyextra->atomCount=1;
@@ -1119,7 +1120,7 @@ STARTDOCSYMS "##"
}
"[" { // list
if (yyextra->start_init) yyextra->current->type = "list";
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
yyextra->atomStart='[';
yyextra->atomEnd=']';
yyextra->atomCount=1;
@@ -1127,7 +1128,7 @@ STARTDOCSYMS "##"
}
"{" { // dictionary
if (yyextra->start_init) yyextra->current->type = "dictionary";
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
yyextra->atomStart='{';
yyextra->atomEnd='}';
yyextra->atomCount=1;
@@ -1150,11 +1151,11 @@ STARTDOCSYMS "##"
}
}
yyextra->start_init = FALSE;
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
}
. {
yyextra->start_init = FALSE;
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
}
\n {
unput('\n');
@@ -1164,14 +1165,14 @@ STARTDOCSYMS "##"
<VariableAtom>{
[\(\[\{] {
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
if (yyextra->atomStart==*yytext)
{
yyextra->atomCount++;
}
}
[\)\]\}] {
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
if (yyextra->atomEnd==*yytext)
{
yyextra->atomCount--;
@@ -1184,37 +1185,37 @@ STARTDOCSYMS "##"
}
{TRIDOUBLEQUOTE} { // start of a comment block
yyextra->specialBlock = FALSE;
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
initTriDoubleQuoteBlock(yyscanner);
BEGIN(TripleComment);
}
{TRISINGLEQUOTE} { // start of a comment block
yyextra->specialBlock = FALSE;
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
initTriSingleQuoteBlock(yyscanner);
BEGIN(TripleComment);
}
"'" {
yyextra->stringContext=YY_START;
- yyextra->current->initializer+="'";
+ yyextra->current->initializer << "'";
yyextra->copyString=&yyextra->current->initializer;
BEGIN( SingleQuoteString );
}
"\"" {
yyextra->stringContext=YY_START;
- yyextra->current->initializer+="\"";
+ yyextra->current->initializer << "\"";
yyextra->copyString=&yyextra->current->initializer;
BEGIN( DoubleQuoteString );
}
{IDENTIFIER} {
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
}
. {
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
}
\n {
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
incLineNr(yyscanner);
}
@@ -1274,8 +1275,8 @@ STARTDOCSYMS "##"
if ((yyextra->docBlockContext==ClassBody /*&& !yyextra->hideClassDocs*/) ||
yyextra->docBlockContext==FunctionBody)
{
- yyextra->current->program+=yyextra->docBlock;
- yyextra->current->program+=yytext;
+ yyextra->current->program << yyextra->docBlock;
+ yyextra->current->program << yytext;
}
//if (yyextra->hideClassDocs)
//{
@@ -1380,7 +1381,7 @@ STARTDOCSYMS "##"
<TripleString>{
{ENDTRIDOUBLEQUOTE} |
{ENDTRISINGLEQUOTE} {
- *yyextra->copyString += yytext;
+ *yyextra->copyString << yytext;
if (yyextra->doubleQuote==(yytext[0]=='"'))
{
BEGIN(yyextra->stringContext);
@@ -1390,14 +1391,14 @@ STARTDOCSYMS "##"
({LONGSTRINGBLOCK}) {
lineCount(yyscanner);
- *yyextra->copyString += yytext;
+ *yyextra->copyString << yytext;
}
\n {
incLineNr(yyscanner);
- *yyextra->copyString += yytext;
+ *yyextra->copyString << yytext;
}
. {
- *yyextra->copyString += *yytext;
+ *yyextra->copyString << *yytext;
}
}
@@ -1665,7 +1666,7 @@ static void endOfDef(yyscan_t yyscanner,int correction)
static inline void addToString(yyscan_t yyscanner,const char *s)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- if (yyextra->copyString) (*yyextra->copyString)+=s;
+ if (yyextra->copyString) (*yyextra->copyString) << s;
}
static void initTriDoubleQuoteBlock(yyscan_t yyscanner)
@@ -1747,12 +1748,12 @@ 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.isEmpty())
+ if (ce->program.tellp() != std::streampos(0))
{
//fprintf(stderr,"parseCompounds: -- %s (line %d) ---------\n%s\n---------------\n",
// ce->name.data(), ce->bodyLine, ce->program.data());
// init scanner state
- yyextra->inputString = ce->program;
+ yyextra->inputString = ce->program.str();
yyextra->inputPosition = 0;
pyscannerYYrestart( 0, yyscanner );
if (ce->section&Entry::COMPOUND_MASK)
@@ -1777,7 +1778,7 @@ static void parseCompounds(yyscan_t yyscanner,std::shared_ptr<Entry> rt)
pyscannerYYlex(yyscanner) ;
yyextra->lexInit=TRUE;
- ce->program.resize(0);
+ ce->program.str(std::string());
yyextra->commentScanner.leaveCompound(yyextra->yyFileName,yyextra->yyLineNr,name);
@@ -1848,7 +1849,7 @@ static void parseMain(yyscan_t yyscanner, const char *fileName,const char *fileB
yyextra->commentScanner.leaveFile(yyextra->yyFileName,yyextra->yyLineNr);
- yyextra->current_root->program.resize(0);
+ yyextra->current_root->program.str(std::string());
parseCompounds(yyscanner, yyextra->current_root);
}
diff --git a/src/qhpxmlwriter.cpp b/src/qhpxmlwriter.cpp
index 51058f4..f495aaa 100644
--- a/src/qhpxmlwriter.cpp
+++ b/src/qhpxmlwriter.cpp
@@ -18,7 +18,8 @@
#include "util.h"
QhpXmlWriter::QhpXmlWriter()
- : m_indentLevel(0), m_curLineIndented(false), m_compress(false)
+ : m_backend(std::ios_base::ate), m_indentLevel(0),
+ m_curLineIndented(false), m_compress(false)
{
}
diff --git a/src/qhpxmlwriter.h b/src/qhpxmlwriter.h
index 31c391e..f883ba6 100644
--- a/src/qhpxmlwriter.h
+++ b/src/qhpxmlwriter.h
@@ -51,7 +51,7 @@ class QhpXmlWriter
char const * const * attributes = 0);
void closePure(char const * elementName);
- std::stringstream m_backend;
+ std::ostringstream m_backend;
int m_indentLevel;
bool m_curLineIndented;
bool m_compress;
diff --git a/src/scanner.l b/src/scanner.l
index 8c2cd07..b529d48 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -60,9 +60,10 @@ static AtomicInt anonNSCount;
struct scannerYY_state
{
+ scannerYY_state() : docBlock(std::ios_base::ate) {}
OutlineParserInterface *thisParser;
CommentScanner commentScanner;
- const char * inputString = 0;
+ QCString inputString;
int inputPosition = 0;
int lastContext = 0;
int lastCContext = 0;
@@ -145,17 +146,17 @@ struct scannerYY_state
ArgumentList *currentArgumentList = 0;
char lastCopyArgChar = '\0';
- QCString *pCopyQuotedString = 0;
- QCString *pCopyRoundString = 0;
- QCString *pCopyCurlyString = 0;
- QCString *pCopyRawString = 0;
- QGString *pCopyCurlyGString = 0;
- QGString *pCopyRoundGString = 0;
- QGString *pCopySquareGString = 0;
- QGString *pCopyQuotedGString = 0;
- QGString *pCopyHereDocGString = 0;
- QGString *pCopyRawGString = 0;
- QGString *pSkipVerbString = 0;
+ QCString *pCopyQuotedString = 0;
+ 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;
bool insideFormula = false;
bool insideTryBlock = false;
@@ -169,7 +170,7 @@ struct scannerYY_state
QCString briefBackup;
int docBlockContext = 0;
- QGString docBlock;
+ std::ostringstream docBlock;
QCString docBlockName;
bool docBlockInBody = false;
bool docBlockAutoBrief = false;
@@ -1791,7 +1792,7 @@ NONLopt [^\n]*
( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
- yyextra->docBlock=indent;
+ yyextra->docBlock.str(indent.str());
lineCount(yyscanner);
yyextra->docBlockTerm = ';';
@@ -1963,12 +1964,12 @@ NONLopt [^\n]*
}
<CopyHereDoc>{ID} { // PHP heredoc
yyextra->delimiter = yytext;
- *yyextra->pCopyHereDocGString += yytext;
+ *yyextra->pCopyHereDocGString << yytext;
BEGIN(CopyHereDocEnd);
}
<CopyHereDoc>"'"{ID}/"'" { // PHP nowdoc
yyextra->delimiter = &yytext[1];
- *yyextra->pCopyHereDocGString += yytext;
+ *yyextra->pCopyHereDocGString << yytext;
BEGIN(CopyHereDocEnd);
}
<HereDoc>{ID} { // PHP heredoc
@@ -1987,7 +1988,7 @@ NONLopt [^\n]*
}
<HereDocEnd>. { }
<CopyHereDocEnd>^{ID} { // id at start of the line could mark the end of the block
- *yyextra->pCopyHereDocGString += yytext;
+ *yyextra->pCopyHereDocGString << yytext;
if (yyextra->delimiter==yytext) // it is the end marker
{
BEGIN(yyextra->lastHereDocContext);
@@ -1995,13 +1996,13 @@ NONLopt [^\n]*
}
<CopyHereDocEnd>\n {
lineCount(yyscanner);
- *yyextra->pCopyHereDocGString += yytext;
+ *yyextra->pCopyHereDocGString << yytext;
}
<CopyHereDocEnd>{ID} {
- *yyextra->pCopyHereDocGString += yytext;
+ *yyextra->pCopyHereDocGString << yytext;
}
<CopyHereDocEnd>. {
- *yyextra->pCopyHereDocGString += yytext;
+ *yyextra->pCopyHereDocGString << yytext;
}
<FindMembers>"Q_OBJECT" { // Qt object macro
}
@@ -2307,7 +2308,7 @@ NONLopt [^\n]*
YY_START==ReadNSBody ||
YY_START==ReadBodyIntf)
{
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
BEGIN( PreLineCtrl );
}
@@ -2317,7 +2318,7 @@ NONLopt [^\n]*
yyextra->lastPreLineCtrlContext==ReadNSBody ||
yyextra->lastPreLineCtrlContext==ReadBodyIntf)
{
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
}
<PreLineCtrl>. {
@@ -2325,7 +2326,7 @@ NONLopt [^\n]*
yyextra->lastPreLineCtrlContext==ReadNSBody ||
yyextra->lastPreLineCtrlContext==ReadBodyIntf)
{
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
}
<PreLineCtrl>\n {
@@ -2333,7 +2334,7 @@ NONLopt [^\n]*
yyextra->lastPreLineCtrlContext==ReadNSBody ||
yyextra->lastPreLineCtrlContext==ReadBodyIntf)
{
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
}
lineCount(yyscanner);
BEGIN( yyextra->lastPreLineCtrlContext );
@@ -2396,10 +2397,10 @@ NONLopt [^\n]*
yyextra->current->startColumn = yyextra->yyColNr;
yyextra->current->type.resize(0);
yyextra->current->type = "const";
- QCString init = yyextra->current->initializer.data();
+ QCString init = yyextra->current->initializer.str();
init = init.simplifyWhiteSpace();
init = init.left(init.length()-1);
- yyextra->current->initializer = init;
+ yyextra->current->initializer.str(init.str());
yyextra->current->name = yyextra->current->name.stripWhiteSpace();
yyextra->current->section = Entry::VARIABLE_SEC;
yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
@@ -2463,7 +2464,7 @@ NONLopt [^\n]*
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
- yyextra->docBlock=indent;
+ yyextra->docBlock.str(indent.str());
//printf("indent=%d\n",computeIndent(yytext+1,yyextra->column));
lineCount(yyscanner);
@@ -2493,7 +2494,7 @@ NONLopt [^\n]*
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
- yyextra->docBlock=indent;
+ yyextra->docBlock.str(indent.str());
lineCount(yyscanner);
yyextra->docBlockTerm = ',';
@@ -2526,7 +2527,7 @@ NONLopt [^\n]*
( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
- yyextra->docBlock=indent;
+ yyextra->docBlock.str(indent.str());
lineCount(yyscanner);
yyextra->docBlockTerm = 0;
@@ -2563,7 +2564,7 @@ NONLopt [^\n]*
yyextra->docBlockContext = YY_START;
yyextra->docBlockInBody = FALSE;
yyextra->docBlockAutoBrief = FALSE;
- yyextra->docBlock.resize(0);
+ yyextra->docBlock.str(std::string());
yyextra->docBlockTerm = 0;
startCommentBlock(yyscanner,TRUE);
BEGIN(DocLine);
@@ -2580,7 +2581,7 @@ NONLopt [^\n]*
{
yyextra->docBlockContext = YY_START;
yyextra->docBlockInBody = FALSE;
- yyextra->docBlock.resize(0);
+ yyextra->docBlock.str(std::string());
yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
yyextra->docBlockTerm = 0;
@@ -2603,7 +2604,7 @@ NONLopt [^\n]*
if (!yyextra->insideCS) REJECT;
yyextra->current->bodyLine = yyextra->yyLineNr;
yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->current->initializer = yytext;
+ yyextra->current->initializer.str(yytext);
yyextra->lastInitializerContext = YY_START;
yyextra->initBracketCount=0;
yyextra->current->mtype = yyextra->mtype = Property;
@@ -2613,7 +2614,7 @@ NONLopt [^\n]*
<FindMembers>"=" { // in PHP code this could also be due to "<?="
yyextra->current->bodyLine = yyextra->yyLineNr;
yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->current->initializer = yytext;
+ yyextra->current->initializer.str(yytext);
yyextra->lastInitializerContext = YY_START;
yyextra->initBracketCount=0;
BEGIN(ReadInitializer);
@@ -2632,7 +2633,7 @@ NONLopt [^\n]*
yyextra->lastRoundContext=YY_START;
yyextra->pCopyRoundGString=&yyextra->current->initializer;
yyextra->roundCount=0;
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
BEGIN(GCopyRound);
}
<ReadInitializer,ReadInitializerPtr>"[" {
@@ -2640,14 +2641,14 @@ NONLopt [^\n]*
yyextra->lastSquareContext=YY_START;
yyextra->pCopySquareGString=&yyextra->current->initializer;
yyextra->squareCount=0;
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
BEGIN(GCopySquare);
}
<ReadInitializer,ReadInitializerPtr>"{" {
yyextra->lastCurlyContext=YY_START;
yyextra->pCopyCurlyGString=&yyextra->current->initializer;
yyextra->curlyCount=0;
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
BEGIN(GCopyCurly);
}
<ReadInitializer,ReadInitializerPtr>[;,] {
@@ -2667,18 +2668,18 @@ NONLopt [^\n]*
else if (*yytext==';' || (yyextra->lastInitializerContext==FindFields && yyextra->initBracketCount==0)) // yyextra->initBracketCount==0 was added for bug 665778
{
unput(*yytext);
- if (YY_START == ReadInitializerPtr) yyextra->current->initializer.resize(0);
+ if (YY_START == ReadInitializerPtr) yyextra->current->initializer.str(std::string());
BEGIN(yyextra->lastInitializerContext);
}
else if (*yytext==',' && yyextra->initBracketCount==0) // for "int a=0,b=0"
{
unput(*yytext);
- if (YY_START == ReadInitializerPtr) yyextra->current->initializer.resize(0);
+ if (YY_START == ReadInitializerPtr) yyextra->current->initializer.str(std::string());
BEGIN(yyextra->lastInitializerContext);
}
else
{
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
}
}
<ReadInitializer,ReadInitializerPtr>{RAWBEGIN} { // C++11 raw string
@@ -2689,7 +2690,7 @@ NONLopt [^\n]*
else
{
QCString text=yytext;
- yyextra->current->initializer+=text;
+ yyextra->current->initializer << text;
int i=text.find('"');
yyextra->delimiter = yytext+i+1;
yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1);
@@ -2700,7 +2701,7 @@ NONLopt [^\n]*
}
}
<RawGString>{RAWEND} {
- *yyextra->pCopyRawGString+=yytext;
+ *yyextra->pCopyRawGString << yytext;
QCString delimiter = yytext+1;
delimiter=delimiter.left(delimiter.length()-1);
if (delimiter==yyextra->delimiter)
@@ -2709,13 +2710,13 @@ NONLopt [^\n]*
}
}
<RawGString>[^)\n]+ {
- *yyextra->pCopyRawGString+=yytext;
+ *yyextra->pCopyRawGString << yytext;
}
<RawGString>. {
- *yyextra->pCopyRawGString+=yytext;
+ *yyextra->pCopyRawGString << yytext;
}
<RawGString>\n {
- *yyextra->pCopyRawGString+=yytext;
+ *yyextra->pCopyRawGString << yytext;
lineCount(yyscanner);
}
<RawString>{RAWEND} {
@@ -2729,15 +2730,15 @@ NONLopt [^\n]*
}
}
<RawString>[^)]+ {
- *yyextra->pCopyRawString+=yytext;
+ *yyextra->pCopyRawString += yytext;
yyextra->fullArgString+=yytext;
}
<RawString>. {
- *yyextra->pCopyRawString+=yytext;
+ *yyextra->pCopyRawString += yytext;
yyextra->fullArgString+=yytext;
}
<RawString>\n {
- *yyextra->pCopyRawString+=yytext;
+ *yyextra->pCopyRawString += yytext;
yyextra->fullArgString+=yytext;
lineCount(yyscanner);
}
@@ -2749,39 +2750,39 @@ NONLopt [^\n]*
else
{
yyextra->lastStringContext=YY_START;
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
yyextra->pCopyQuotedGString=&yyextra->current->initializer;
BEGIN(CopyGString);
}
}
<ReadInitializer,ReadInitializerPtr>"->" {
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
}
<ReadInitializer,ReadInitializerPtr>"<<" {
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
}
<ReadInitializer,ReadInitializerPtr>">>" {
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
}
<ReadInitializer,ReadInitializerPtr>[<\[{(] {
yyextra->initBracketCount++;
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
}
<ReadInitializer,ReadInitializerPtr>[>\]})] {
yyextra->initBracketCount--;
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
}
<ReadInitializer,ReadInitializerPtr>\' {
if (yyextra->insidePHP)
{
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
yyextra->pCopyQuotedGString = &yyextra->current->initializer;
yyextra->lastStringContext=YY_START;
BEGIN(CopyPHPGString);
}
else
{
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
}
}
<ReadInitializer,ReadInitializerPtr>{CHARLIT} {
@@ -2791,16 +2792,16 @@ NONLopt [^\n]*
}
else
{
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
}
}
<ReadInitializer,ReadInitializerPtr>\n {
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
lineCount(yyscanner);
}
<ReadInitializer,ReadInitializerPtr>"@\"" {
//printf("yyextra->insideCS=%d\n",yyextra->insideCS);
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
if (!yyextra->insideCS && !yyextra->insideObjC)
{
REJECT;
@@ -2814,30 +2815,30 @@ NONLopt [^\n]*
}
}
<SkipVerbString>[^\n"]+ {
- *yyextra->pSkipVerbString+=yytext;
+ *yyextra->pSkipVerbString << yytext;
}
<SkipVerbString>"\"\"" { // quote escape
- *yyextra->pSkipVerbString+=yytext;
+ *yyextra->pSkipVerbString << yytext;
}
<SkipVerbString>"\"" {
- *yyextra->pSkipVerbString+=*yytext;
+ *yyextra->pSkipVerbString << *yytext;
BEGIN(yyextra->lastSkipVerbStringContext);
}
<SkipVerbString>\n {
- *yyextra->pSkipVerbString+=*yytext;
+ *yyextra->pSkipVerbString << *yytext;
lineCount(yyscanner);
}
<SkipVerbString>. {
- *yyextra->pSkipVerbString+=*yytext;
+ *yyextra->pSkipVerbString << *yytext;
}
<ReadInitializer,ReadInitializerPtr>"?>" {
if (yyextra->insidePHP)
BEGIN( FindMembersPHP );
else
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
}
<ReadInitializer,ReadInitializerPtr>. {
- yyextra->current->initializer+=*yytext;
+ yyextra->current->initializer << *yytext;
}
/* generic quoted string copy rules */
@@ -2865,62 +2866,62 @@ NONLopt [^\n]*
/* generic quoted growable string copy rules */
<CopyGString,CopyPHPGString>\\. {
- *yyextra->pCopyQuotedGString+=yytext;
+ *yyextra->pCopyQuotedGString << yytext;
}
<CopyGString>\" {
- *yyextra->pCopyQuotedGString+=*yytext;
+ *yyextra->pCopyQuotedGString << *yytext;
BEGIN( yyextra->lastStringContext );
}
<CopyPHPGString>\' {
- *yyextra->pCopyQuotedGString+=*yytext;
+ *yyextra->pCopyQuotedGString << *yytext;
BEGIN( yyextra->lastStringContext );
}
<CopyGString,CopyPHPGString>"<?php" { // we had an odd number of quotes.
- *yyextra->pCopyQuotedGString += yytext;
+ *yyextra->pCopyQuotedGString << yytext;
BEGIN( yyextra->lastStringContext );
}
<CopyGString,CopyPHPGString>{CCS}|{CCE}|{CPPC} {
- *yyextra->pCopyQuotedGString+=yytext;
+ *yyextra->pCopyQuotedGString << yytext;
}
<CopyGString,CopyPHPGString>\n {
- *yyextra->pCopyQuotedGString+=*yytext;
+ *yyextra->pCopyQuotedGString << *yytext;
lineCount(yyscanner);
}
<CopyGString,CopyPHPGString>. {
- *yyextra->pCopyQuotedGString+=*yytext;
+ *yyextra->pCopyQuotedGString << *yytext;
}
/* generic round bracket list copy rules */
<CopyRound>\" {
- *yyextra->pCopyRoundString+=*yytext;
+ *yyextra->pCopyRoundString += *yytext;
yyextra->pCopyQuotedString=yyextra->pCopyRoundString;
yyextra->lastStringContext=YY_START;
BEGIN(CopyString);
}
<CopyRound>"(" {
- *yyextra->pCopyRoundString+=*yytext;
+ *yyextra->pCopyRoundString += *yytext;
yyextra->roundCount++;
}
<CopyRound>")" {
- *yyextra->pCopyRoundString+=*yytext;
+ *yyextra->pCopyRoundString += *yytext;
if (--yyextra->roundCount<0)
BEGIN(yyextra->lastRoundContext);
}
<CopyRound>\n {
lineCount(yyscanner);
- *yyextra->pCopyRoundString+=*yytext;
+ *yyextra->pCopyRoundString += *yytext;
}
<CopyRound>\' {
if (yyextra->insidePHP)
{
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
yyextra->pCopyQuotedString = yyextra->pCopyRoundString;
yyextra->lastStringContext=YY_START;
BEGIN(CopyPHPString);
}
else
{
- *yyextra->pCopyRoundString+=yytext;
+ *yyextra->pCopyRoundString += yytext;
}
}
<CopyRound>{CHARLIT} {
@@ -2942,35 +2943,35 @@ NONLopt [^\n]*
/* generic round bracket list copy rules for growable strings */
<GCopyRound>\" {
- *yyextra->pCopyRoundGString+=*yytext;
+ *yyextra->pCopyRoundGString << *yytext;
yyextra->pCopyQuotedGString=yyextra->pCopyRoundGString;
yyextra->lastStringContext=YY_START;
BEGIN(CopyGString);
}
<GCopyRound>"(" {
- *yyextra->pCopyRoundGString+=*yytext;
+ *yyextra->pCopyRoundGString << *yytext;
yyextra->roundCount++;
}
<GCopyRound>")" {
- *yyextra->pCopyRoundGString+=*yytext;
+ *yyextra->pCopyRoundGString << *yytext;
if (--yyextra->roundCount<0)
BEGIN(yyextra->lastRoundContext);
}
<GCopyRound>\n {
lineCount(yyscanner);
- *yyextra->pCopyRoundGString+=*yytext;
+ *yyextra->pCopyRoundGString << *yytext;
}
<GCopyRound>\' {
if (yyextra->insidePHP)
{
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
yyextra->pCopyQuotedGString = yyextra->pCopyRoundGString;
yyextra->lastStringContext=YY_START;
BEGIN(CopyPHPGString);
}
else
{
- *yyextra->pCopyRoundGString+=yytext;
+ *yyextra->pCopyRoundGString << yytext;
}
}
<GCopyRound>{CHARLIT} {
@@ -2980,47 +2981,47 @@ NONLopt [^\n]*
}
else
{
- *yyextra->pCopyRoundGString+=yytext;
+ *yyextra->pCopyRoundGString << yytext;
}
}
<GCopyRound>[^"'()\n\/,]+ {
- *yyextra->pCopyRoundGString+=yytext;
+ *yyextra->pCopyRoundGString << yytext;
}
<GCopyRound>. {
- *yyextra->pCopyRoundGString+=*yytext;
+ *yyextra->pCopyRoundGString << *yytext;
}
/* generic square bracket list copy rules for growable strings, we should only enter here in case of php, left the test part as in GCopyRound to keep it compatible with the round bracket version */
<GCopySquare>\" {
- *yyextra->pCopySquareGString+=*yytext;
+ *yyextra->pCopySquareGString << *yytext;
yyextra->pCopyQuotedGString=yyextra->pCopySquareGString;
yyextra->lastStringContext=YY_START;
BEGIN(CopyGString);
}
<GCopySquare>"[" {
- *yyextra->pCopySquareGString+=*yytext;
+ *yyextra->pCopySquareGString << *yytext;
yyextra->squareCount++;
}
<GCopySquare>"]" {
- *yyextra->pCopySquareGString+=*yytext;
+ *yyextra->pCopySquareGString << *yytext;
if (--yyextra->squareCount<0)
BEGIN(yyextra->lastSquareContext);
}
<GCopySquare>\n {
lineCount(yyscanner);
- *yyextra->pCopySquareGString+=*yytext;
+ *yyextra->pCopySquareGString << *yytext;
}
<GCopySquare>\' {
if (yyextra->insidePHP)
{
- yyextra->current->initializer+=yytext;
+ yyextra->current->initializer << yytext;
yyextra->pCopyQuotedGString = yyextra->pCopySquareGString;
yyextra->lastStringContext=YY_START;
BEGIN(CopyPHPGString);
}
else
{
- *yyextra->pCopySquareGString+=yytext;
+ *yyextra->pCopySquareGString << yytext;
}
}
<GCopySquare>{CHARLIT} {
@@ -3030,25 +3031,25 @@ NONLopt [^\n]*
}
else
{
- *yyextra->pCopySquareGString+=yytext;
+ *yyextra->pCopySquareGString << yytext;
}
}
<GCopySquare>[^"\[\]\n\/,]+ {
- *yyextra->pCopySquareGString+=yytext;
+ *yyextra->pCopySquareGString << yytext;
}
<GCopySquare>. {
- *yyextra->pCopySquareGString+=*yytext;
+ *yyextra->pCopySquareGString << *yytext;
}
/* generic curly bracket list copy rules */
<CopyCurly>\" {
- *yyextra->pCopyCurlyString+=*yytext;
+ *yyextra->pCopyCurlyString += *yytext;
yyextra->pCopyQuotedString=yyextra->pCopyCurlyString;
yyextra->lastStringContext=YY_START;
BEGIN(CopyString);
}
<CopyCurly>\' {
- *yyextra->pCopyCurlyString+=*yytext;
+ *yyextra->pCopyCurlyString += *yytext;
if (yyextra->insidePHP)
{
yyextra->pCopyQuotedString=yyextra->pCopyCurlyString;
@@ -3057,11 +3058,11 @@ NONLopt [^\n]*
}
}
<CopyCurly>"{" {
- *yyextra->pCopyCurlyString+=*yytext;
+ *yyextra->pCopyCurlyString += *yytext;
yyextra->curlyCount++;
}
<CopyCurly>"}" {
- *yyextra->pCopyCurlyString+=*yytext;
+ *yyextra->pCopyCurlyString += *yytext;
if (--yyextra->curlyCount<0)
BEGIN(yyextra->lastCurlyContext);
}
@@ -3071,19 +3072,19 @@ NONLopt [^\n]*
}
else
{
- *yyextra->pCopyCurlyString+=yytext;
+ *yyextra->pCopyCurlyString += yytext;
}
}
<CopyCurly>[^"'{}\/\n,]+ {
- *yyextra->pCopyCurlyString+=yytext;
+ *yyextra->pCopyCurlyString += yytext;
}
-<CopyCurly>"/" { *yyextra->pCopyCurlyString+=yytext; }
+<CopyCurly>"/" { *yyextra->pCopyCurlyString += yytext; }
<CopyCurly>\n {
lineCount(yyscanner);
- *yyextra->pCopyCurlyString+=*yytext;
+ *yyextra->pCopyCurlyString += *yytext;
}
<CopyCurly>. {
- *yyextra->pCopyCurlyString+=*yytext;
+ *yyextra->pCopyCurlyString += *yytext;
}
/* generic curly bracket list copy rules for growable strings */
@@ -3101,13 +3102,13 @@ NONLopt [^\n]*
}
}
<GCopyCurly>\" {
- *yyextra->pCopyCurlyGString+=*yytext;
+ *yyextra->pCopyCurlyGString << *yytext;
yyextra->pCopyQuotedGString=yyextra->pCopyCurlyGString;
yyextra->lastStringContext=YY_START;
BEGIN(CopyGString);
}
<GCopyCurly>\' {
- *yyextra->pCopyCurlyGString+=*yytext;
+ *yyextra->pCopyCurlyGString << *yytext;
if (yyextra->insidePHP)
{
yyextra->pCopyQuotedGString=yyextra->pCopyCurlyGString;
@@ -3116,11 +3117,11 @@ NONLopt [^\n]*
}
}
<GCopyCurly>"{" {
- *yyextra->pCopyCurlyGString+=*yytext;
+ *yyextra->pCopyCurlyGString << *yytext;
yyextra->curlyCount++;
}
<GCopyCurly>"}" {
- *yyextra->pCopyCurlyGString+=*yytext;
+ *yyextra->pCopyCurlyGString << *yytext;
if (--yyextra->curlyCount<0)
BEGIN(yyextra->lastCurlyContext);
}
@@ -3130,22 +3131,22 @@ NONLopt [^\n]*
}
else
{
- *yyextra->pCopyCurlyGString+=yytext;
+ *yyextra->pCopyCurlyGString << yytext;
}
}
<GCopyCurly>[^"'{}\/\n,]+ {
- *yyextra->pCopyCurlyGString+=yytext;
+ *yyextra->pCopyCurlyGString << yytext;
}
<GCopyCurly>[,]+ {
- *yyextra->pCopyCurlyGString+=yytext;
+ *yyextra->pCopyCurlyGString << yytext;
}
-<GCopyCurly>"/" { *yyextra->pCopyCurlyGString+=yytext; }
+<GCopyCurly>"/" { *yyextra->pCopyCurlyGString << yytext; }
<GCopyCurly>\n {
lineCount(yyscanner);
- *yyextra->pCopyCurlyGString+=*yytext;
+ *yyextra->pCopyCurlyGString << *yytext;
}
<GCopyCurly>. {
- *yyextra->pCopyCurlyGString+=*yytext;
+ *yyextra->pCopyCurlyGString << *yytext;
}
/* ---------------------- */
@@ -3220,7 +3221,7 @@ NONLopt [^\n]*
yyextra->current->args.resize(0);
yyextra->current->brief.resize(0);
yyextra->current->doc.resize(0);
- yyextra->current->initializer.resize(0);
+ yyextra->current->initializer.str(std::string());
yyextra->current->bitfields.resize(0);
int i=oldType.length();
while (i>0 && (oldType[i-1]=='*' || oldType[i-1]=='&' || oldType[i-1]==' ')) i--;
@@ -3507,13 +3508,13 @@ NONLopt [^\n]*
unput('(');
yyextra->lastInitializerContext = YY_START;
yyextra->initBracketCount=0;
- yyextra->current->initializer = "=";
+ yyextra->current->initializer.str("=");
BEGIN(ReadInitializer);
}
<FindFields>"=" {
yyextra->lastInitializerContext = YY_START;
yyextra->initBracketCount=0;
- yyextra->current->initializer = yytext;
+ yyextra->current->initializer.str(yytext);
BEGIN(ReadInitializer);
}
<FindFields>";" {
@@ -3590,21 +3591,21 @@ NONLopt [^\n]*
/*
<FindFieldArg>"," { unput(*yytext); BEGIN(FindFields); }
*/
-<ReadBody,ReadNSBody,ReadBodyIntf>[^\r\n\#{}"@'/<]* { yyextra->current->program += yytext ; }
-<ReadBody,ReadNSBody,ReadBodyIntf>{CPPC}.* { yyextra->current->program += yytext ; }
+<ReadBody,ReadNSBody,ReadBodyIntf>[^\r\n\#{}"@'/<]* { yyextra->current->program << yytext ; }
+<ReadBody,ReadNSBody,ReadBodyIntf>{CPPC}.* { yyextra->current->program << yytext ; }
<ReadBody,ReadNSBody,ReadBodyIntf>"#".* { if (!yyextra->insidePHP)
REJECT;
// append PHP comment.
- yyextra->current->program += yytext ;
+ yyextra->current->program << yytext ;
}
-<ReadBody,ReadNSBody,ReadBodyIntf>@\" { yyextra->current->program += yytext ;
+<ReadBody,ReadNSBody,ReadBodyIntf>@\" { yyextra->current->program << yytext ;
yyextra->pSkipVerbString = &yyextra->current->program;
yyextra->lastSkipVerbStringContext=YY_START;
BEGIN( SkipVerbString );
}
<ReadBody,ReadNSBody,ReadBodyIntf>"<<<" { if (yyextra->insidePHP)
{
- yyextra->current->program += yytext ;
+ yyextra->current->program << yytext ;
yyextra->pCopyHereDocGString = &yyextra->current->program;
yyextra->lastHereDocContext=YY_START;
BEGIN( CopyHereDoc );
@@ -3614,16 +3615,16 @@ NONLopt [^\n]*
REJECT;
}
}
-<ReadBody,ReadNSBody,ReadBodyIntf>\" { yyextra->current->program += yytext ;
+<ReadBody,ReadNSBody,ReadBodyIntf>\" { yyextra->current->program << yytext ;
yyextra->pCopyQuotedGString = &yyextra->current->program;
yyextra->lastStringContext=YY_START;
BEGIN( CopyGString );
}
-<ReadBody,ReadNSBody,ReadBodyIntf>{CCS}{B}* { yyextra->current->program += yytext ;
+<ReadBody,ReadNSBody,ReadBodyIntf>{CCS}{B}* { yyextra->current->program << yytext ;
yyextra->lastContext = YY_START ;
BEGIN( Comment ) ;
}
-<ReadBody,ReadNSBody,ReadBodyIntf>{CCS}{BL} { yyextra->current->program += yytext ;
+<ReadBody,ReadNSBody,ReadBodyIntf>{CCS}{BL} { yyextra->current->program << yytext ;
++yyextra->yyLineNr ;
yyextra->lastContext = YY_START ;
BEGIN( Comment ) ;
@@ -3631,11 +3632,11 @@ NONLopt [^\n]*
<ReadBody,ReadNSBody,ReadBodyIntf>"'" {
if (!yyextra->insidePHP)
{
- yyextra->current->program += yytext;
+ yyextra->current->program << yytext;
}
else
{ // begin of single quoted string
- yyextra->current->program += yytext;
+ yyextra->current->program << yytext;
yyextra->pCopyQuotedGString = &yyextra->current->program;
yyextra->lastStringContext=YY_START;
BEGIN(CopyPHPGString);
@@ -3649,20 +3650,20 @@ NONLopt [^\n]*
}
else
{
- yyextra->current->program += yytext;
+ yyextra->current->program << yytext;
}
}
-<ReadBody,ReadNSBody,ReadBodyIntf>"{" { yyextra->current->program += yytext ;
+<ReadBody,ReadNSBody,ReadBodyIntf>"{" { yyextra->current->program << yytext ;
++yyextra->curlyCount ;
}
<ReadBodyIntf>"}" {
- yyextra->current->program += yytext ;
+ yyextra->current->program << yytext ;
--yyextra->curlyCount ;
}
<ReadBody,ReadNSBody>"}" { //err("ReadBody count=%d\n",yyextra->curlyCount);
if ( yyextra->curlyCount>0 )
{
- yyextra->current->program += yytext ;
+ yyextra->current->program << yytext ;
--yyextra->curlyCount ;
}
else
@@ -3689,7 +3690,7 @@ NONLopt [^\n]*
while ((split_point = yyextra->current->name.find("::")) != -1)
{
std::shared_ptr<Entry> new_current = std::make_shared<Entry>(*yyextra->current);
- yyextra->current->program = "";
+ yyextra->current->program.str(std::string());
new_current->name = yyextra->current->name.mid(split_point + 2);
yyextra->current->name = yyextra->current->name.left(split_point);
if (!yyextra->current_root->name.isEmpty()) yyextra->current->name.prepend(yyextra->current_root->name+"::");
@@ -3722,7 +3723,7 @@ NONLopt [^\n]*
{
if ((yyextra->current->section == Entry::ENUM_SEC) || (yyextra->current->spec&Entry::Enum))
{
- yyextra->current->program+=','; // add field terminator
+ yyextra->current->program << ','; // add field terminator
}
// add compound definition to the tree
yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args);
@@ -3773,7 +3774,7 @@ NONLopt [^\n]*
lineCount(yyscanner);
if ( yyextra->curlyCount>0 )
{
- yyextra->current->program += yytext ;
+ yyextra->current->program << yytext ;
--yyextra->curlyCount ;
}
else
@@ -3796,7 +3797,7 @@ NONLopt [^\n]*
<TypedefName>{ID} {
if ((yyextra->current->section == Entry::ENUM_SEC) || (yyextra->current->spec&Entry::Enum))
{
- yyextra->current->program+=","; // add field terminator
+ yyextra->current->program << ","; // add field terminator
}
yyextra->current->name=yytext;
prependScope(yyscanner);
@@ -3816,7 +3817,7 @@ NONLopt [^\n]*
yyextra->current->name.sprintf("@%d",anonCount++);
if ((yyextra->current->section == Entry::ENUM_SEC) || (yyextra->current->spec&Entry::Enum))
{
- yyextra->current->program+=','; // add field terminator
+ yyextra->current->program << ','; // add field terminator
}
// add compound definition to the tree
yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
@@ -3947,7 +3948,7 @@ NONLopt [^\n]*
varEntry->doc = yyextra->current->doc.copy();
varEntry->brief = yyextra->current->brief.copy();
varEntry->mGrpId = yyextra->current->mGrpId;
- varEntry->initializer = yyextra->current->initializer;
+ varEntry->initializer.str(yyextra->current->initializer.str());
varEntry->groups = yyextra->current->groups;
varEntry->sli = yyextra->current->sli;
@@ -3990,7 +3991,7 @@ NONLopt [^\n]*
<MemberSpec>"=" {
yyextra->lastInitializerContext=YY_START;
yyextra->initBracketCount=0;
- yyextra->current->initializer = yytext;
+ yyextra->current->initializer.str(yytext);
BEGIN(ReadInitializer);
/* BEGIN(MemberSpecSkip); */
}
@@ -4004,7 +4005,7 @@ NONLopt [^\n]*
*/
<MemberSpecSkip>"," { BEGIN(MemberSpec); }
<MemberSpecSkip>";" { unput(';'); BEGIN(MemberSpec); }
-<ReadBody,ReadNSBody,ReadBodyIntf>{BN}{1,80} { yyextra->current->program += yytext ;
+<ReadBody,ReadNSBody,ReadBodyIntf>{BN}{1,80} { yyextra->current->program << yytext ;
lineCount(yyscanner) ;
}
<ReadBodyIntf>"@end"/[^a-z_A-Z0-9] { // end of Objective C block
@@ -4014,7 +4015,7 @@ NONLopt [^\n]*
yyextra->insideObjC=FALSE;
BEGIN( FindMembers );
}
-<ReadBody,ReadNSBody,ReadBodyIntf>. { yyextra->current->program += yytext ; }
+<ReadBody,ReadNSBody,ReadBodyIntf>. { yyextra->current->program << yytext ; }
<FindMembers>"("/{BN}*"::"*{BN}*({TSCOPE}{BN}*"::")*{TSCOPE}{BN}*")"{BN}*"(" | /* typedef void (A<int>::func_t)(args...) */
<FindMembers>("("({BN}*"::"*{BN}*{TSCOPE}{BN}*"::")*({BN}*[*&\^]{BN}*)+)+ { /* typedef void (A::*ptr_t)(args...) or int (*func(int))[], the ^ is for Obj-C blocks */
@@ -4672,7 +4673,7 @@ NONLopt [^\n]*
// typically an initialized function pointer
yyextra->lastInitializerContext=YY_START;
yyextra->initBracketCount=0;
- yyextra->current->initializer = yytext;
+ yyextra->current->initializer.str(yytext);
BEGIN(ReadInitializer);
}
}
@@ -5039,7 +5040,7 @@ NONLopt [^\n]*
yyextra->docBlockInBody = FALSE;
yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
- yyextra->docBlock.resize(0);
+ yyextra->docBlock.str(std::string());
yyextra->docBlockTerm = '}';
if (yytext[yyleng-3]=='/')
{
@@ -5058,7 +5059,7 @@ NONLopt [^\n]*
yyextra->docBlockInBody = FALSE;
yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
- yyextra->docBlock.resize(0);
+ yyextra->docBlock.str(std::string());
yyextra->docBlockTerm = '}';
if (yytext[yyleng-3]=='/')
{
@@ -5113,7 +5114,7 @@ NONLopt [^\n]*
yyextra->lastRawStringContext = YY_START;
yyextra->dummyRawString.resize(0);
yyextra->pCopyRawString = &yyextra->dummyRawString;
- *yyextra->pCopyRawString+=yytext;
+ *yyextra->pCopyRawString += yytext;
BEGIN(RawString);
}
<SkipCurly,SkipCurlyCpp>[^\n#"'@\\/{}<]+ {
@@ -5657,7 +5658,7 @@ NONLopt [^\n]*
else
{
lineCount(yyscanner);
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
yyextra->current->fileName = yyextra->yyFileName ;
yyextra->current->startLine = yyextra->yyLineNr ;
yyextra->current->startColumn = yyextra->yyColNr;
@@ -5676,7 +5677,7 @@ NONLopt [^\n]*
else
{
lineCount(yyscanner);
- yyextra->current->program+=yytext;
+ yyextra->current->program << yytext;
yyextra->current->fileName = yyextra->yyFileName ;
yyextra->current->startLine = yyextra->yyLineNr ;
yyextra->current->startColumn = yyextra->yyColNr;
@@ -5685,7 +5686,7 @@ NONLopt [^\n]*
}
}
<CompoundName,ClassVar>{B}*"{"{B}* {
- yyextra->current->program.resize(0);
+ yyextra->current->program.str(std::string());
yyextra->current->fileName = yyextra->yyFileName ;
yyextra->current->bodyLine = yyextra->yyLineNr;
yyextra->current->bodyColumn = yyextra->yyColNr;
@@ -5938,7 +5939,7 @@ NONLopt [^\n]*
}
}
<Bases>{B}*"{"{B}* {
- yyextra->current->program.resize(0);
+ yyextra->current->program.str(std::string());
yyextra->current->fileName = yyextra->yyFileName ;
yyextra->current->bodyLine = yyextra->yyLineNr;
yyextra->current->bodyColumn = yyextra->yyColNr;
@@ -5968,24 +5969,24 @@ NONLopt [^\n]*
}
<SkipUnionSwitch>\n { lineCount(yyscanner); }
<SkipUnionSwitch>.
-<Comment>{BN}+ { yyextra->current->program += yytext ;
+<Comment>{BN}+ { yyextra->current->program << yytext ;
lineCount(yyscanner) ;
}
-<Comment>{CCS} { yyextra->current->program += yytext ; }
-<Comment>{CPPC} { yyextra->current->program += yytext ; }
+<Comment>{CCS} { yyextra->current->program << yytext ; }
+<Comment>{CPPC} { yyextra->current->program << yytext ; }
<Comment>{CMD}("code"|"verbatim") {
yyextra->insideCode=TRUE;
- yyextra->current->program += yytext ;
+ yyextra->current->program << yytext ;
}
<Comment>{CMD}("endcode"|"endverbatim") {
yyextra->insideCode=FALSE;
- yyextra->current->program += yytext ;
+ yyextra->current->program << yytext ;
}
-<Comment>[^ \.\t\r\n\/\*]+ { yyextra->current->program += yytext ; }
-<Comment>{CCE} { yyextra->current->program += yytext ;
+<Comment>[^ \.\t\r\n\/\*]+ { yyextra->current->program << yytext ; }
+<Comment>{CCE} { yyextra->current->program << yytext ;
if (!yyextra->insideCode) BEGIN( yyextra->lastContext ) ;
}
-<Comment>. { yyextra->current->program += *yytext ; }
+<Comment>. { yyextra->current->program << *yytext ; }
<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,SkipC11Inits,SkipC11Attribute,Bases,OldStyleArgs>({CPPC}{B}*)?{CCS}"!" {
//printf("Start doc block at %d\n",yyextra->yyLineNr);
@@ -6010,7 +6011,7 @@ NONLopt [^\n]*
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
- yyextra->docBlock=indent;
+ yyextra->docBlock.str(indent.str());
if (yyextra->docBlockAutoBrief)
{
@@ -6042,7 +6043,7 @@ NONLopt [^\n]*
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
- yyextra->docBlock=indent;
+ yyextra->docBlock.str(indent.str());
if (yyextra->docBlockAutoBrief)
{
@@ -6054,7 +6055,7 @@ NONLopt [^\n]*
}
else
{
- yyextra->current->program += yytext ;
+ yyextra->current->program << yytext ;
yyextra->lastContext = YY_START ;
BEGIN( Comment ) ;
}
@@ -6076,7 +6077,7 @@ NONLopt [^\n]*
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
- yyextra->docBlock=indent;
+ yyextra->docBlock.str(indent.str());
if (yyextra->docBlockAutoBrief)
{
@@ -6098,7 +6099,7 @@ NONLopt [^\n]*
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
- yyextra->docBlock=indent;
+ yyextra->docBlock.str(indent.str());
startCommentBlock(yyscanner,yyextra->current->brief.isEmpty());
BEGIN( DocLine );
@@ -6114,7 +6115,7 @@ NONLopt [^\n]*
yyextra->docBlockAutoBrief = FALSE;
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
- yyextra->docBlock=indent;
+ yyextra->docBlock.str(indent.str());
startCommentBlock(yyscanner,yyextra->current->brief.isEmpty());
BEGIN( DocLine );
}
@@ -6185,7 +6186,7 @@ NONLopt [^\n]*
// C++11 style initializer list
yyextra->current->bodyLine = yyextra->yyLineNr;
yyextra->current->bodyColumn = yyextra->yyColNr;
- yyextra->current->initializer = yytext;
+ yyextra->current->initializer.str(yytext);
yyextra->lastInitializerContext = YY_START;
yyextra->initBracketCount=1;
BEGIN(ReadInitializer);
@@ -6196,7 +6197,7 @@ NONLopt [^\n]*
<CSAccessorDecl>"}"{B}*"=" {
// fall back to next rule if it's not the right bracket
if (yyextra->curlyCount != 0) REJECT;
- yyextra->current->initializer = "=";
+ yyextra->current->initializer.str("=");
yyextra->current->endBodyLine=yyextra->yyLineNr;
yyextra->lastInitializerContext = FindMembers;
BEGIN(ReadInitializer);
@@ -6300,57 +6301,56 @@ NONLopt [^\n]*
/* ---- Single line comments ------ */
<DocLine>[^\n]*"\n"[ \t]*{CPPC}[/!][<]? { // continuation of multiline C++-style comment
- yyextra->docBlock+=yytext;
int markerLen = yytext[yyleng-1]=='<' ? 4 : 3;
- yyextra->docBlock.resize(yyextra->docBlock.length() - markerLen);
+ yyextra->docBlock << std::string(yytext).substr(0,yyleng-markerLen);
lineCount(yyscanner);
}
<DocLine>{B}*{CPPC}"/"[/]+{Bopt}/"\n" { // ignore marker line (see bug700345)
- handleCommentBlock(yyscanner,yyextra->docBlock.data(),yyextra->current->brief.isEmpty());
+ handleCommentBlock(yyscanner,yyextra->docBlock.str(),yyextra->current->brief.isEmpty());
BEGIN( yyextra->docBlockContext );
}
<DocLine>{NONLopt}/"\n"{B}*{CPPC}[!/]{B}*{CMD}"}" { // next line is an end group marker, see bug 752712
- yyextra->docBlock+=yytext;
- handleCommentBlock(yyscanner,yyextra->docBlock.data(),yyextra->current->brief.isEmpty());
+ yyextra->docBlock << yytext;
+ handleCommentBlock(yyscanner,yyextra->docBlock.str(),yyextra->current->brief.isEmpty());
BEGIN( yyextra->docBlockContext );
}
<DocLine>{NONLopt}/"\n" { // whole line
- yyextra->docBlock+=yytext;
- handleCommentBlock(yyscanner,yyextra->docBlock.data(),yyextra->current->brief.isEmpty());
+ yyextra->docBlock << yytext;
+ handleCommentBlock(yyscanner,yyextra->docBlock.str(),yyextra->current->brief.isEmpty());
BEGIN( yyextra->docBlockContext );
}
/* ---- Comments blocks ------ */
<DocBlock>"*"*{CCE} { // end of comment block
- handleCommentBlock(yyscanner,yyextra->docBlock.data(),FALSE);
+ handleCommentBlock(yyscanner,yyextra->docBlock.str(),FALSE);
BEGIN(yyextra->docBlockContext);
}
<DocBlock>^{B}*"*"+/[^/] {
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
- yyextra->docBlock+=indent;
+ yyextra->docBlock << indent;
}
<DocBlock>^{B}*({CPPC})?{B}*"*"+/[^/a-z_A-Z0-9*] { // start of a comment line
QCString indent;
indent.fill(' ',computeIndent(yytext,yyextra->column));
- yyextra->docBlock+=indent;
+ yyextra->docBlock << indent;
}
<DocBlock>^{B}*({CPPC}){B}* { // strip embedded C++ comments if at the start of a line
}
<DocBlock>{CPPC} { // slashes in the middle of a comment block
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
}
<DocBlock>{CCS} { // start of a new comment in the
// middle of a comment block
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
}
<DocBlock>({CMD}{CMD}){ID}/[^a-z_A-Z0-9] { // escaped command
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
}
<DocBlock>{CMD}("f$"|"f["|"f{") {
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
yyextra->docBlockName=&yytext[1];
if (yyextra->docBlockName.at(1)=='{')
{
@@ -6361,14 +6361,14 @@ NONLopt [^\n]*
BEGIN(DocCopyBlock);
}
<DocBlock>{B}*"<"{PRE}">" {
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
yyextra->docBlockName="<pre>";
yyextra->fencedSize=0;
yyextra->nestedComment=FALSE;
BEGIN(DocCopyBlock);
}
<DocBlock>{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!)
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
yyextra->docBlockName=&yytext[1];
yyextra->fencedSize=0;
yyextra->nestedComment=FALSE;
@@ -6377,7 +6377,7 @@ NONLopt [^\n]*
<DocBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
QCString pat = substitute(yytext,"*"," ");
- yyextra->docBlock+=pat;
+ yyextra->docBlock << pat;
yyextra->docBlockName="~~~";
yyextra->fencedSize=pat.stripWhiteSpace().length();
yyextra->nestedComment=FALSE;
@@ -6385,7 +6385,7 @@ NONLopt [^\n]*
}
<DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
QCString pat = substitute(yytext,"*"," ");
- yyextra->docBlock+=pat;
+ yyextra->docBlock << pat;
yyextra->docBlockName="```";
yyextra->fencedSize=pat.stripWhiteSpace().length();
yyextra->nestedComment=FALSE;
@@ -6394,7 +6394,7 @@ NONLopt [^\n]*
<DocBlock>{B}*"<code>" {
if (yyextra->insideCS)
{
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
yyextra->docBlockName="<code>";
yyextra->nestedComment=FALSE;
BEGIN(DocCopyBlock);
@@ -6405,38 +6405,38 @@ NONLopt [^\n]*
}
}
<DocBlock>[^@*~\/\\\n]+ { // any character that isn't special
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
}
<DocBlock>\n { // newline
lineCount(yyscanner);
- yyextra->docBlock+=*yytext;
+ yyextra->docBlock << *yytext;
}
<DocBlock>. { // command block
- yyextra->docBlock+=*yytext;
+ yyextra->docBlock << *yytext;
}
/* ---- Copy verbatim sections ------ */
<DocCopyBlock>"</"{PRE}">" { // end of a <pre> block
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
if (yyextra->docBlockName=="<pre>")
{
BEGIN(DocBlock);
}
}
<DocCopyBlock>"</"{CODE}">" { // end of a <code> block
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
if (yyextra->docBlockName=="<code>")
{
BEGIN(DocBlock);
}
}
<DocCopyBlock>[\\@]("f$"|"f]"|"f}") {
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
BEGIN(DocBlock);
}
<DocCopyBlock>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
if (&yytext[4]==yyextra->docBlockName)
{
BEGIN(DocBlock);
@@ -6455,7 +6455,7 @@ NONLopt [^\n]*
{
QCString indent;
indent.fill(' ',computeIndent(yytext,0));
- yyextra->docBlock+=indent;
+ yyextra->docBlock << indent;
}
}
<DocCopyBlock>^{B}*"*"+/{B}+"*"{BN}* { // start of a comment line with two *'s
@@ -6463,7 +6463,7 @@ NONLopt [^\n]*
{
QCString indent;
indent.fill(' ',computeIndent(yytext,0));
- yyextra->docBlock+=indent;
+ yyextra->docBlock << indent;
}
else
{
@@ -6475,7 +6475,7 @@ NONLopt [^\n]*
{
QCString indent;
indent.fill(' ',computeIndent(yytext,-1));
- yyextra->docBlock+=indent+"*";
+ yyextra->docBlock << indent+"*";
}
else
{
@@ -6489,12 +6489,12 @@ NONLopt [^\n]*
if (yyextra->nestedComment) // keep * it is part of the code
{
indent.fill(' ',computeIndent(yytext,-1));
- yyextra->docBlock+=indent+"*";
+ yyextra->docBlock << indent+"*";
}
else // remove * it is part of the comment block
{
indent.fill(' ',computeIndent(yytext,0));
- yyextra->docBlock+=indent;
+ yyextra->docBlock << indent;
}
}
else
@@ -6504,7 +6504,7 @@ NONLopt [^\n]*
}
<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
QCString pat = substitute(yytext,"*"," ");
- yyextra->docBlock+=pat;
+ yyextra->docBlock << pat;
if (yyextra->fencedSize==pat.stripWhiteSpace().length())
{
BEGIN(DocBlock);
@@ -6512,14 +6512,14 @@ NONLopt [^\n]*
}
<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
QCString pat = substitute(yytext,"*"," ");
- yyextra->docBlock+=pat;
+ yyextra->docBlock << pat;
if (yyextra->fencedSize==pat.stripWhiteSpace().length())
{
BEGIN(DocBlock);
}
}
<DocCopyBlock>[^\<@/\*\]~\$\\\n]+ { // any character that is not special
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
}
<DocCopyBlock>{CCS}|{CCE}|{CPPC} {
if (yytext[1]=='*')
@@ -6530,14 +6530,14 @@ NONLopt [^\n]*
{
yyextra->nestedComment=FALSE;
}
- yyextra->docBlock+=yytext;
+ yyextra->docBlock << yytext;
}
<DocCopyBlock>\n { // newline
- yyextra->docBlock+=*yytext;
+ yyextra->docBlock << *yytext;
lineCount(yyscanner);
}
<DocCopyBlock>. { // any other character
- yyextra->docBlock+=*yytext;
+ yyextra->docBlock << *yytext;
}
<DocCopyBlock><<EOF>> {
warn(yyextra->yyFileName,yyextra->yyLineNr,
@@ -7202,7 +7202,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.isEmpty())
+ if (ce->program.tellp() != std::streampos(0))
{
//printf("-- %s ---------\n%s\n---------------\n",
// ce->name.data(),ce->program.data());
@@ -7210,7 +7210,7 @@ static void parseCompounds(yyscan_t yyscanner,const std::shared_ptr<Entry> &rt)
yyextra->padCount=0;
//depthIf = 0;
yyextra->column=0;
- yyextra->inputString = ce->program;
+ yyextra->inputString = ce->program.str();
yyextra->inputPosition = 0;
if (ce->section==Entry::ENUM_SEC || (ce->spec&Entry::Enum))
BEGIN( FindFields ) ;
@@ -7294,7 +7294,7 @@ static void parseCompounds(yyscan_t yyscanner,const std::shared_ptr<Entry> &rt)
yyextra->commentScanner.leaveCompound(yyextra->yyFileName,yyextra->yyLineNr,name);
- ce->program.resize(0);
+ ce->program.str(std::string());
//if (depthIf>0)
@@ -7371,7 +7371,7 @@ static void parseMain(yyscan_t yyscanner,
//forceEndGroup();
yyextra->commentScanner.leaveFile(yyextra->yyFileName,yyextra->yyLineNr);
- rt->program.resize(0);
+ rt->program.str(std::string());
parseCompounds(yyscanner,rt);
diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp
index 04c0953..e936992 100644
--- a/src/sqlite3gen.cpp
+++ b/src/sqlite3gen.cpp
@@ -1385,7 +1385,7 @@ QCString getSQLDocBlock(const Definition *scope,
{
if (doc.isEmpty()) return "";
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
DocNode *root = validatingParseDoc(
fileName,
lineNr,
diff --git a/src/template.cpp b/src/template.cpp
index 9af1d60..e96b16a 100644
--- a/src/template.cpp
+++ b/src/template.cpp
@@ -3355,7 +3355,7 @@ class TemplateNodeBlock : public TemplateNodeCreator<TemplateNodeBlock>
if (nb) // block is overruled
{
ci->push();
- std::stringstream ss;
+ std::ostringstream ss(std::ios_base::ate);
// 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
@@ -3641,7 +3641,7 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate>
{
TemplateEscapeIntf *escIntf = ci->escapeIntf();
ci->selectEscapeIntf(extension);
- std::stringstream os;
+ std::ostringstream os(std::ios_base::ate);
createTemplate->render(os,c);
QCString out = os.str();
stripLeadingWhiteSpace(out);
@@ -3714,7 +3714,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::stringstream ss;
+ std::ostringstream ss(std::ios_base::ate);
c->push();
TemplateVariant node;
TemplateListIntf::ConstIterator *it = ctx->list->createIterator();
diff --git a/src/utf8.cpp b/src/utf8.cpp
index a71ede8..ea7ee34 100644
--- a/src/utf8.cpp
+++ b/src/utf8.cpp
@@ -138,7 +138,7 @@ static inline std::string caseConvert(const std::string &input,
const char *(*conversionFunc)(uint32_t code))
{
uint32_t code;
- std::stringstream result;
+ std::ostringstream result(std::ios_base::ate);
size_t len;
size_t bytesLeft = input.length();
const char *p = input.c_str();
diff --git a/src/util.cpp b/src/util.cpp
index ccae0de..f402bac 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -4233,7 +4233,7 @@ QCString convertToPSString(const char *s)
QCString convertToLaTeX(const QCString &s,bool insideTabbing,bool keepSpaces)
{
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
filterLatexString(t,s,insideTabbing,false,false,false,keepSpaces);
QCString result = t.str();
return result.data();
@@ -5129,7 +5129,7 @@ QCString latexEscapeLabelName(const char *s)
{
if (s==0) return "";
QCString tmp(qstrlen(s)+1);
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
const char *p=s;
char c;
int i;
@@ -5172,7 +5172,7 @@ QCString latexEscapeIndexChars(const char *s)
{
if (s==0) return "";
QCString tmp(qstrlen(s)+1);
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
const char *p=s;
char c;
int i;
@@ -5215,7 +5215,7 @@ QCString latexEscapeIndexChars(const char *s)
QCString latexEscapePDFString(const char *s)
{
if (s==0) return "";
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
const char *p=s;
char c;
while ((c=*p++))
@@ -5239,7 +5239,7 @@ QCString latexEscapePDFString(const char *s)
QCString latexFilterURL(const char *s)
{
if (s==0) return "";
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
const signed char *p=(const signed char*)s;
char c;
while ((c=*p++))
@@ -5746,7 +5746,7 @@ QCString parseCommentAsText(const Definition *scope,const MemberDef *md,
{
if (doc.isEmpty()) return "";
//printf("parseCommentAsText(%s)\n",doc.data());
- std::stringstream t;
+ std::ostringstream t(std::ios_base::ate);
DocNode *root = validatingParseDoc(fileName,lineNr,
(Definition*)scope,(MemberDef*)md,doc,FALSE,FALSE,
0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
@@ -5916,24 +5916,23 @@ static QCString replaceAliasArguments(StringUnorderedSet &aliasesProcessed,
static QCString escapeCommas(const QCString &s)
{
- QGString result;
+ std::ostringstream result(std::ios_base::ate);
const char *p = s.data();
char c,pc=0;
while ((c=*p++))
{
if (c==',' && pc!='\\')
{
- result+="\\,";
+ result << "\\,";
}
else
{
- result+=c;
+ result << c;
}
pc=c;
}
- result+='\0';
//printf("escapeCommas: '%s'->'%s'\n",s.data(),result.data());
- return result.data();
+ return result.str();
}
static QCString expandAliasRec(StringUnorderedSet &aliasesProcessed,const std::string &s,bool allowRecursion)
@@ -6630,7 +6629,7 @@ QCString stripIndentation(const QCString &s)
if (minIndent==0) return s;
// remove minimum indentation for each line
- QGString result;
+ std::ostringstream result(std::ios_base::ate);
p=s.data();
indent=0;
while ((c=*p++))
@@ -6638,7 +6637,7 @@ QCString stripIndentation(const QCString &s)
if (c=='\n') // start of new line
{
indent=0;
- result+=c;
+ result << c;
}
else if (indent<minIndent) // skip until we reach minIndent
{
@@ -6648,7 +6647,7 @@ QCString stripIndentation(const QCString &s)
int i=newIndent;
while (i>minIndent) // if a tab crosses the minIndent boundary fill the rest with spaces
{
- result+=' ';
+ result << ' ';
i--;
}
indent=newIndent;
@@ -6660,12 +6659,11 @@ QCString stripIndentation(const QCString &s)
}
else // copy anything until the end of the line
{
- result+=c;
+ result << c;
}
}
- result+='\0';
- return result.data();
+ return result.str();
}
// strip up to \a indentationLevel spaces from each line in \a doc (excluding the first line)