diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-11-08 11:28:04 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-11-08 15:35:18 +0100 |
commit | b536e10390c171e96b6477c04d66023a1da543c4 (patch) | |
tree | 4c04275831cea51f0a343d00e382f519a08bcd90 /tools/source/xml | |
parent | 958c09acc1058a4a0eba28ac94f2883fff64d600 (diff) |
Retrofit "KeepEmptyLinesAtTheStartOfBlocks: false" into .clang-format
...even if that can cause reformatting of already formatted code. The problem I
came across is that without this something like
> namespace {
>
> void f1();
>
> void f2();
>
> }
(which is quite a common style in the current code base) would be changed to
> namespace
> {
>
> void f1();
>
> void f2();
> }
instead of
> namespace
> {
> void f1();
>
> void f2();
> }
and I found no other clang-format style option that would result in the
presence or absence of an empty line be identical at the start and end of the
namespace block.
vmiklos asked to reformat the existing new (i.e., non-blacklisted) files at the
same time, so this commit includes that. Some of those new files had not been
formatted at all, so this commit includes their full reformatting changes.
Change-Id: I54daf0c11098d07d02c802104cf7f56372e61f7c
Reviewed-on: https://gerrit.libreoffice.org/44450
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'tools/source/xml')
-rw-r--r-- | tools/source/xml/XmlWalker.cxx | 25 | ||||
-rw-r--r-- | tools/source/xml/XmlWriter.cxx | 25 |
2 files changed, 23 insertions, 27 deletions
diff --git a/tools/source/xml/XmlWalker.cxx b/tools/source/xml/XmlWalker.cxx index 9bec6d9dd534..61aedee7e6e4 100644 --- a/tools/source/xml/XmlWalker.cxx +++ b/tools/source/xml/XmlWalker.cxx @@ -15,17 +15,18 @@ #include <libxml/xmlstring.h> #include <vector> -namespace tools { - +namespace tools +{ struct XmlWalkerImpl { XmlWalkerImpl() : mpDocPtr(nullptr) , mpRoot(nullptr) , mpCurrent(nullptr) - {} + { + } - xmlDocPtr mpDocPtr; + xmlDocPtr mpDocPtr; xmlNodePtr mpRoot; xmlNodePtr mpCurrent; @@ -34,7 +35,8 @@ struct XmlWalkerImpl XmlWalker::XmlWalker() : mpImpl(o3tl::make_unique<XmlWalkerImpl>()) -{} +{ +} XmlWalker::~XmlWalker() { @@ -67,7 +69,8 @@ OString XmlWalker::content() OString aContent; if (mpImpl->mpCurrent->xmlChildrenNode != nullptr) { - xmlChar* pContent = xmlNodeListGetString(mpImpl->mpDocPtr, mpImpl->mpCurrent->xmlChildrenNode, 1); + xmlChar* pContent + = xmlNodeListGetString(mpImpl->mpDocPtr, mpImpl->mpCurrent->xmlChildrenNode, 1); aContent = OString(reinterpret_cast<const char*>(pContent)); xmlFree(pContent); } @@ -97,15 +100,9 @@ OString XmlWalker::attribute(OString sName) return aAttributeContent; } -void XmlWalker::next() -{ - mpImpl->mpCurrent = mpImpl->mpCurrent->next; -} +void XmlWalker::next() { mpImpl->mpCurrent = mpImpl->mpCurrent->next; } -bool XmlWalker::isValid() const -{ - return mpImpl->mpCurrent != nullptr; -} +bool XmlWalker::isValid() const { return mpImpl->mpCurrent != nullptr; } } // end tools namespace diff --git a/tools/source/xml/XmlWriter.cxx b/tools/source/xml/XmlWriter.cxx index 014252bc39aa..5952dde13c96 100644 --- a/tools/source/xml/XmlWriter.cxx +++ b/tools/source/xml/XmlWriter.cxx @@ -12,10 +12,10 @@ #include <libxml/xmlwriter.h> -namespace tools { - -namespace { - +namespace tools +{ +namespace +{ int funcWriteCallback(void* pContext, const char* sBuffer, int nLen) { SvStream* pStream = static_cast<SvStream*>(pContext); @@ -36,7 +36,8 @@ struct XmlWriterImpl XmlWriterImpl(SvStream* pStream) : mpStream(pStream) , mpWriter(nullptr) - {} + { + } SvStream* mpStream; xmlTextWriterPtr mpWriter; @@ -44,18 +45,19 @@ struct XmlWriterImpl XmlWriter::XmlWriter(SvStream* pStream) : mpImpl(o3tl::make_unique<XmlWriterImpl>(pStream)) -{} +{ +} XmlWriter::~XmlWriter() { - if (mpImpl && mpImpl->mpWriter != nullptr) endDocument(); } bool XmlWriter::startDocument() { - xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO(funcWriteCallback, funcCloseCallback, mpImpl->mpStream, nullptr); + xmlOutputBufferPtr xmlOutBuffer + = xmlOutputBufferCreateIO(funcWriteCallback, funcCloseCallback, mpImpl->mpStream, nullptr); mpImpl->mpWriter = xmlNewTextWriter(xmlOutBuffer); if (mpImpl->mpWriter == nullptr) return false; @@ -78,12 +80,9 @@ void XmlWriter::startElement(const OString& sName) xmlFree(xmlName); } -void XmlWriter::endElement() -{ - xmlTextWriterEndElement(mpImpl->mpWriter); -} +void XmlWriter::endElement() { xmlTextWriterEndElement(mpImpl->mpWriter); } -void XmlWriter::attribute(const OString& name, const OString & value) +void XmlWriter::attribute(const OString& name, const OString& value) { xmlChar* xmlName = xmlCharStrdup(name.getStr()); xmlChar* xmlValue = xmlCharStrdup(value.getStr()); |