diff options
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()); |