summaryrefslogtreecommitdiffstats
path: root/src/qhpxmlwriter.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/qhpxmlwriter.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/qhpxmlwriter.cpp')
-rw-r--r--src/qhpxmlwriter.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/qhpxmlwriter.cpp b/src/qhpxmlwriter.cpp
index 5915841..b3ab95a 100644
--- a/src/qhpxmlwriter.cpp
+++ b/src/qhpxmlwriter.cpp
@@ -16,6 +16,7 @@
#include "qhpxmlwriter.h"
#include "util.h"
+#include "qcstring.h"
QhpXmlWriter::QhpXmlWriter()
: m_indentLevel(0), m_curLineIndented(false), m_compress(false)
@@ -46,8 +47,8 @@ void QhpXmlWriter::dumpTo(TextStream & file)
file << m_backend.str();
}
-void QhpXmlWriter::open(char const * elementName,
- char const * const * attributes)
+void QhpXmlWriter::open(const QCString &elementName,
+ const char * const attributes[])
{
indent();
openPure(elementName, attributes);
@@ -55,16 +56,16 @@ void QhpXmlWriter::open(char const * elementName,
m_indentLevel++;
}
-void QhpXmlWriter::openClose(char const * elementName,
- char const * const * attributes)
+void QhpXmlWriter::openClose(const QCString &elementName,
+ const char * const attributes[])
{
indent();
openClosePure(elementName, attributes);
newLine();
}
-void QhpXmlWriter::openCloseContent(char const * elementName,
- char const * content)
+void QhpXmlWriter::openCloseContent(const QCString &elementName,
+ const QCString &content)
{
indent();
openPure(elementName);
@@ -73,7 +74,7 @@ void QhpXmlWriter::openCloseContent(char const * elementName,
newLine();
}
-void QhpXmlWriter::close(char const * elementName)
+void QhpXmlWriter::close(const QCString &elementName)
{
m_indentLevel--;
indent();
@@ -81,7 +82,7 @@ void QhpXmlWriter::close(char const * elementName)
newLine();
}
-void QhpXmlWriter::declaration(char const * version, char const * encoding)
+void QhpXmlWriter::declaration(const QCString &version, const QCString &encoding)
{
m_backend << "<?xml version=\"" << version << "\" encoding=\"" << encoding << "\"?>";
newLine();
@@ -109,17 +110,17 @@ void QhpXmlWriter::newLine()
}
}
-void QhpXmlWriter::openPureHelper(char const * elementName,
- char const * const * attributes, bool close)
+void QhpXmlWriter::openPureHelper(const QCString &elementName,
+ const char * const attributes[], bool close)
{
m_backend << "<" << elementName;
if (attributes)
{
- for (char const * const * walker = attributes;
+ for (const char * const * walker = attributes;
walker[0]; walker += 2)
{
- char const * const key = walker[0];
- char const * const value = walker[1];
+ const char *const key = walker[0];
+ const char *const value = walker[1];
if (!value)
{
continue;
@@ -135,19 +136,19 @@ void QhpXmlWriter::openPureHelper(char const * elementName,
m_backend << ">";
}
-void QhpXmlWriter::openPure(char const * elementName,
- char const * const * attributes)
+void QhpXmlWriter::openPure(const QCString &elementName,
+ const char * const attributes[])
{
openPureHelper(elementName, attributes, false);
}
-void QhpXmlWriter::openClosePure(char const * elementName,
- char const * const * attributes)
+void QhpXmlWriter::openClosePure(const QCString &elementName,
+ const char * const attributes[])
{
openPureHelper(elementName, attributes, true);
}
-void QhpXmlWriter::closePure(char const * elementName)
+void QhpXmlWriter::closePure(const QCString &elementName)
{
m_backend << "</" << elementName << ">";
}