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:
@@ -14,6 +14,7 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <libxml/xmlmemory.h>
|
#include <libxml/xmlmemory.h>
|
||||||
#include <libxml/parser.h>
|
#include <libxml/parser.h>
|
||||||
@@ -30,7 +31,7 @@ class L10N_DLLPUBLIC BasicCodeTagger
|
|||||||
private:
|
private:
|
||||||
xmlDocPtr m_pDocument;
|
xmlDocPtr m_pDocument;
|
||||||
std::vector<xmlNodePtr> m_BasicCodeContainerTags;
|
std::vector<xmlNodePtr> m_BasicCodeContainerTags;
|
||||||
LibXmlTreeWalker *m_pXmlTreeWalker;
|
std::unique_ptr<LibXmlTreeWalker> m_pXmlTreeWalker;
|
||||||
SyntaxHighlighter m_Highlighter;
|
SyntaxHighlighter m_Highlighter;
|
||||||
bool m_bTaggingCompleted;
|
bool m_bTaggingCompleted;
|
||||||
void tagParagraph( xmlNodePtr paragraph );
|
void tagParagraph( xmlNodePtr paragraph );
|
||||||
|
@@ -62,8 +62,6 @@ BasicCodeTagger::BasicCodeTagger( xmlDocPtr rootDoc ):
|
|||||||
|
|
||||||
BasicCodeTagger::~BasicCodeTagger()
|
BasicCodeTagger::~BasicCodeTagger()
|
||||||
{
|
{
|
||||||
if ( m_pXmlTreeWalker != nullptr )
|
|
||||||
delete m_pXmlTreeWalker;
|
|
||||||
}
|
}
|
||||||
//!Gathers all the <bascode> tag nodes from xml tree.
|
//!Gathers all the <bascode> tag nodes from xml tree.
|
||||||
/*!
|
/*!
|
||||||
@@ -75,9 +73,7 @@ void BasicCodeTagger::getBasicCodeContainerNodes()
|
|||||||
|
|
||||||
m_BasicCodeContainerTags.clear();
|
m_BasicCodeContainerTags.clear();
|
||||||
|
|
||||||
if ( m_pXmlTreeWalker != nullptr )
|
m_pXmlTreeWalker.reset(new LibXmlTreeWalker( m_pDocument ));
|
||||||
delete m_pXmlTreeWalker;
|
|
||||||
m_pXmlTreeWalker = new LibXmlTreeWalker( m_pDocument );
|
|
||||||
|
|
||||||
currentNode = m_pXmlTreeWalker->currentNode();
|
currentNode = m_pXmlTreeWalker->currentNode();
|
||||||
if ( !( xmlStrcmp( currentNode->name, reinterpret_cast<const xmlChar*>("bascode") ) ) )
|
if ( !( xmlStrcmp( currentNode->name, reinterpret_cast<const xmlChar*>("bascode") ) ) )
|
||||||
|
Reference in New Issue
Block a user