summaryrefslogtreecommitdiffstats
path: root/src/vhdljjparser.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-04-11 19:22:59 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2021-04-22 17:34:13 (GMT)
commit592aaa4f17d73ec8c475df0f44efaea8cc4d575c (patch)
tree3cfd68cec756661045ee25c906a8d8f4bddf7a6a /src/vhdljjparser.cpp
parent98c67549bc3cd855873e0ef5eeab7c6410699d78 (diff)
downloadDoxygen-592aaa4f17d73ec8c475df0f44efaea8cc4d575c.zip
Doxygen-592aaa4f17d73ec8c475df0f44efaea8cc4d575c.tar.gz
Doxygen-592aaa4f17d73ec8c475df0f44efaea8cc4d575c.tar.bz2
Refactoring: remove implicit conversion from QCString to const char *
This commit changes the following in relation to string use - The implicit convert from 'QCString' to 'const char *' is removed - Strings parameters use 'const QCString &' as much as possible in favor over 'const char *' - 'if (s)' where s is a QCString has been replaced by 'if(!s.isEmpty())' - data() now always returns a valid C-string and not a 0-pointer. - when passing a string 's' to printf and related functions 'qPrint(s)' is used instead of 's.data()' - for empty string arguments 'QCString()' is used instead of '0' - The copy() operation has been removed - Where possible 'qstrcmp(a,b)==0' has been replaces by 'a==b' and 'qstrcmp(a,b)<0' has been replaced by 'a<b' - Parameters of string type that were default initialized with '= 0' are no initialized with '= QCString()'
Diffstat (limited to 'src/vhdljjparser.cpp')
-rw-r--r--src/vhdljjparser.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp
index f060c30..963f3ec 100644
--- a/src/vhdljjparser.cpp
+++ b/src/vhdljjparser.cpp
@@ -57,7 +57,7 @@ static EntryList g_instFiles;
struct VHDLOutlineParser::Private
{
- void parseVhdlfile(const char *fileName,const char* inputBuffer,bool inLine);
+ void parseVhdlfile(const QCString &fileName,const char* inputBuffer,bool inLine);
VHDLOutlineParser *thisParser = 0;
VhdlParser *vhdlParser = 0;
@@ -86,20 +86,20 @@ struct VHDLOutlineParser::Private
};
-void VHDLOutlineParser::Private::parseVhdlfile(const char *fileName,
+void VHDLOutlineParser::Private::parseVhdlfile(const QCString &fileName,
const char* inputBuffer,bool inLine)
{
JAVACC_STRING_TYPE s =inputBuffer;
CharStream *stream = new CharStream(s.c_str(), (int)s.size(), 1, 1);
VhdlParserTokenManager *tokenManager = new VhdlParserTokenManager(stream);
- VhdlTokenManagerErrorHandler *tokErrHandler=new VhdlTokenManagerErrorHandler(fileName);
+ VhdlTokenManagerErrorHandler *tokErrHandler=new VhdlTokenManagerErrorHandler(fileName.data());
vhdlParser=new VhdlParser(tokenManager);
vhdlParser->setOutlineParser(thisParser);
vhdlParser->setSharedState(&shared);
tokenManager->setLexParser(vhdlParser);
tokenManager->ReInit(stream,0);
tokenManager->setErrorHandler(tokErrHandler);
- VhdlErrorHandler *parserErrHandler=new VhdlErrorHandler(fileName);
+ VhdlErrorHandler *parserErrHandler=new VhdlErrorHandler(fileName.data());
vhdlParser->setErrorHandler(parserErrHandler);
try
{
@@ -129,7 +129,7 @@ VHDLOutlineParser::~VHDLOutlineParser()
{
}
-void VHDLOutlineParser::parseInput(const char *fileName,const char *fileBuf,
+void VHDLOutlineParser::parseInput(const QCString &fileName,const char *fileBuf,
const std::shared_ptr<Entry> &root, ClangTUParser *)
{
VhdlParser::SharedState *s = &p->shared;
@@ -138,7 +138,7 @@ void VHDLOutlineParser::parseInput(const char *fileName,const char *fileBuf,
// fprintf(stderr,"\n ============= %s\n ==========\n",fileBuf);
- bool inLine = (fileName==0 || strlen(fileName)==0);
+ bool inLine = fileName.isEmpty();
p->yyFileName=fileName;
@@ -266,7 +266,7 @@ void VHDLOutlineParser::handleFlowComment(const char* doc)
QCString qcs(doc);
qcs=qcs.stripWhiteSpace();
qcs.stripPrefix("--#");
- FlowChart::addFlowChart(FlowChart::COMMENT_NO,0,0,qcs.data());
+ FlowChart::addFlowChart(FlowChart::COMMENT_NO,QCString(),QCString(),qcs);
}
}
@@ -324,7 +324,7 @@ int VHDLOutlineParser::checkInlineCode(QCString &doc)
QCString na;
for (const auto &qcs_ : ql)
{
- QCString qcs = qcs_;
+ QCString qcs(qcs_);
qcs = qcs.simplifyWhiteSpace();
if (findRe(qcs,csRe)!=-1)
{
@@ -380,7 +380,7 @@ int VHDLOutlineParser::checkInlineCode(QCString &doc)
return 1;
}
-void VHDLOutlineParser::handleCommentBlock(const char *doc1, bool brief)
+void VHDLOutlineParser::handleCommentBlock(const QCString &doc1, bool brief)
{
int position = 0;
bool needsEntry = FALSE;
@@ -462,7 +462,7 @@ void VHDLOutlineParser::handleCommentBlock(const char *doc1, bool brief)
p->strComment.resize(0);
}
-void VHDLOutlineParser::parsePrototype(const char *text)
+void VHDLOutlineParser::parsePrototype(const QCString &text)
{
p->varName=text;
p->varr=TRUE;
@@ -618,7 +618,7 @@ void VHDLOutlineParser::pushLabel( QCString &label,QCString & val)
QCString VHDLOutlineParser::popLabel(QCString & q)
{
int i=q.findRev("|");
- if (i<0) return "";
+ if (i<0) return QCString();
q = q.left(i);
return q;
}
@@ -764,9 +764,9 @@ void VHDLOutlineParser::createFlow()
q+=")";
}
- q.prepend(VhdlDocGen::getFlowMember()->name().data());
+ q.prepend(VhdlDocGen::getFlowMember()->name());
- FlowChart::addFlowChart(FlowChart::START_NO,q,0);
+ FlowChart::addFlowChart(FlowChart::START_NO,q,QCString());
if (s->currP==VhdlDocGen::FUNCTION)
{
@@ -781,7 +781,7 @@ void VHDLOutlineParser::createFlow()
ret="end process ";
}
- FlowChart::addFlowChart(FlowChart::END_NO,ret,0);
+ FlowChart::addFlowChart(FlowChart::END_NO,ret,QCString());
// FlowChart::printFlowList();
FlowChart::writeFlowChart();
s->currP=0;
@@ -849,7 +849,7 @@ void VHDLOutlineParser::error_skipto(int kind)
p->vhdlParser->getNextToken(); // step to next token
op=p->vhdlParser->getToken(1); // get first token
if (op==0) break;
- //fprintf(stderr,"\n %s",t->image.data());
+ //fprintf(stderr,"\n %s",qPrint(t->image));
} while (op->kind != kind);
p->vhdlParser->clearError();
// The above loop consumes tokens all the way up to a token of