loplugin:useuniqueptr in BasicCodeTagger

Change-Id: I85b7d5b3030d4b3ec5318e4ee6793927c1f16355
Reviewed-on: https://gerrit.libreoffice.org/47835
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2018-01-12 08:22:09 +02:00
parent 215254415f
commit a2f86708a5
2 changed files with 3 additions and 6 deletions

View File

@ -14,6 +14,7 @@
#include <cstdlib>
#include <string>
#include <deque>
#include <memory>
#include <vector>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
@ -30,7 +31,7 @@ class L10N_DLLPUBLIC BasicCodeTagger
private:
xmlDocPtr m_pDocument;
std::vector<xmlNodePtr> m_BasicCodeContainerTags;
LibXmlTreeWalker *m_pXmlTreeWalker;
std::unique_ptr<LibXmlTreeWalker> m_pXmlTreeWalker;
SyntaxHighlighter m_Highlighter;
bool m_bTaggingCompleted;
void tagParagraph( xmlNodePtr paragraph );

View File

@ -62,8 +62,6 @@ BasicCodeTagger::BasicCodeTagger( xmlDocPtr rootDoc ):
BasicCodeTagger::~BasicCodeTagger()
{
if ( m_pXmlTreeWalker != nullptr )
delete m_pXmlTreeWalker;
}
//!Gathers all the <bascode> tag nodes from xml tree.
/*!
@ -75,9 +73,7 @@ void BasicCodeTagger::getBasicCodeContainerNodes()
m_BasicCodeContainerTags.clear();
if ( m_pXmlTreeWalker != nullptr )
delete m_pXmlTreeWalker;
m_pXmlTreeWalker = new LibXmlTreeWalker( m_pDocument );
m_pXmlTreeWalker.reset(new LibXmlTreeWalker( m_pDocument ));
currentNode = m_pXmlTreeWalker->currentNode();
if ( !( xmlStrcmp( currentNode->name, reinterpret_cast<const xmlChar*>("bascode") ) ) )