[Libreoffice-commits] core.git: starmath/source
Takeshi Abe
tabe at fixedpoint.jp
Mon Apr 27 14:34:30 PDT 2015
starmath/source/mathmlimport.cxx | 42 ++++++++++-----------------------------
starmath/source/mathmlimport.hxx | 21 ++++++++++---------
2 files changed, 22 insertions(+), 41 deletions(-)
New commits:
commit f0ec37e1374177e31236c5a3a6dafde6b45dd74a
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Thu Apr 23 13:36:38 2015 +0900
use std::unique_ptr<> to simplify ctor and dtor
Change-Id: Iea949e5936f58317e64e60a407613bb99ae113ff
Reviewed-on: https://gerrit.libreoffice.org/15489
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index d60f4d0..2a8179e 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -399,16 +399,6 @@ SmXMLImport::SmXMLImport(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rContext,
OUString const & implementationName, SvXMLImportFlags nImportFlags)
: SvXMLImport(rContext, implementationName, nImportFlags),
- pPresLayoutElemTokenMap(0),
- pPresLayoutAttrTokenMap(0),
- pFencedAttrTokenMap(0),
- pOperatorAttrTokenMap(0),
- pAnnotationAttrTokenMap(0),
- pPresElemTokenMap(0),
- pPresScriptEmptyElemTokenMap(0),
- pPresTableElemTokenMap(0),
- pColorTokenMap(0),
- pActionAttrTokenMap(0),
bSuccess(false)
{
}
@@ -1966,14 +1956,14 @@ static const SvXMLTokenMapEntry aActionAttrTokenMap[] =
const SvXMLTokenMap& SmXMLImport::GetPresLayoutElemTokenMap()
{
if (!pPresLayoutElemTokenMap)
- pPresLayoutElemTokenMap = new SvXMLTokenMap(aPresLayoutElemTokenMap);
+ pPresLayoutElemTokenMap.reset(new SvXMLTokenMap(aPresLayoutElemTokenMap));
return *pPresLayoutElemTokenMap;
}
const SvXMLTokenMap& SmXMLImport::GetPresLayoutAttrTokenMap()
{
if (!pPresLayoutAttrTokenMap)
- pPresLayoutAttrTokenMap = new SvXMLTokenMap(aPresLayoutAttrTokenMap);
+ pPresLayoutAttrTokenMap.reset(new SvXMLTokenMap(aPresLayoutAttrTokenMap));
return *pPresLayoutAttrTokenMap;
}
@@ -1981,57 +1971,57 @@ const SvXMLTokenMap& SmXMLImport::GetPresLayoutAttrTokenMap()
const SvXMLTokenMap& SmXMLImport::GetFencedAttrTokenMap()
{
if (!pFencedAttrTokenMap)
- pFencedAttrTokenMap = new SvXMLTokenMap(aFencedAttrTokenMap);
+ pFencedAttrTokenMap.reset(new SvXMLTokenMap(aFencedAttrTokenMap));
return *pFencedAttrTokenMap;
}
const SvXMLTokenMap& SmXMLImport::GetOperatorAttrTokenMap()
{
if (!pOperatorAttrTokenMap)
- pOperatorAttrTokenMap = new SvXMLTokenMap(aOperatorAttrTokenMap);
+ pOperatorAttrTokenMap.reset(new SvXMLTokenMap(aOperatorAttrTokenMap));
return *pOperatorAttrTokenMap;
}
const SvXMLTokenMap& SmXMLImport::GetAnnotationAttrTokenMap()
{
if (!pAnnotationAttrTokenMap)
- pAnnotationAttrTokenMap = new SvXMLTokenMap(aAnnotationAttrTokenMap);
+ pAnnotationAttrTokenMap.reset(new SvXMLTokenMap(aAnnotationAttrTokenMap));
return *pAnnotationAttrTokenMap;
}
const SvXMLTokenMap& SmXMLImport::GetPresElemTokenMap()
{
if (!pPresElemTokenMap)
- pPresElemTokenMap = new SvXMLTokenMap(aPresElemTokenMap);
+ pPresElemTokenMap.reset(new SvXMLTokenMap(aPresElemTokenMap));
return *pPresElemTokenMap;
}
const SvXMLTokenMap& SmXMLImport::GetPresScriptEmptyElemTokenMap()
{
if (!pPresScriptEmptyElemTokenMap)
- pPresScriptEmptyElemTokenMap = new
- SvXMLTokenMap(aPresScriptEmptyElemTokenMap);
+ pPresScriptEmptyElemTokenMap.reset(new
+ SvXMLTokenMap(aPresScriptEmptyElemTokenMap));
return *pPresScriptEmptyElemTokenMap;
}
const SvXMLTokenMap& SmXMLImport::GetPresTableElemTokenMap()
{
if (!pPresTableElemTokenMap)
- pPresTableElemTokenMap = new SvXMLTokenMap(aPresTableElemTokenMap);
+ pPresTableElemTokenMap.reset(new SvXMLTokenMap(aPresTableElemTokenMap));
return *pPresTableElemTokenMap;
}
const SvXMLTokenMap& SmXMLImport::GetColorTokenMap()
{
if (!pColorTokenMap)
- pColorTokenMap = new SvXMLTokenMap(aColorTokenMap);
+ pColorTokenMap.reset(new SvXMLTokenMap(aColorTokenMap));
return *pColorTokenMap;
}
const SvXMLTokenMap& SmXMLImport::GetActionAttrTokenMap()
{
if (!pActionAttrTokenMap)
- pActionAttrTokenMap = new SvXMLTokenMap(aActionAttrTokenMap);
+ pActionAttrTokenMap.reset(new SvXMLTokenMap(aActionAttrTokenMap));
return *pActionAttrTokenMap;
}
@@ -2901,16 +2891,6 @@ SvXMLImportContext *SmXMLImport::CreateActionContext(sal_uInt16 nPrefix,
SmXMLImport::~SmXMLImport() throw ()
{
- delete pPresLayoutElemTokenMap;
- delete pPresElemTokenMap;
- delete pPresScriptEmptyElemTokenMap;
- delete pPresTableElemTokenMap;
- delete pPresLayoutAttrTokenMap;
- delete pFencedAttrTokenMap;
- delete pColorTokenMap;
- delete pOperatorAttrTokenMap;
- delete pAnnotationAttrTokenMap;
- delete pActionAttrTokenMap;
}
void SmXMLImport::SetViewSettings(const Sequence<PropertyValue>& aViewProps)
diff --git a/starmath/source/mathmlimport.hxx b/starmath/source/mathmlimport.hxx
index 88571fc..9254273 100644
--- a/starmath/source/mathmlimport.hxx
+++ b/starmath/source/mathmlimport.hxx
@@ -26,6 +26,7 @@
#include <xmloff/xmltoken.hxx>
#include <node.hxx>
+#include <memory>
class SfxMedium;
namespace com { namespace sun { namespace star {
@@ -71,16 +72,16 @@ public:
class SmXMLImport : public SvXMLImport
{
- SvXMLTokenMap *pPresLayoutElemTokenMap;
- SvXMLTokenMap *pPresLayoutAttrTokenMap;
- SvXMLTokenMap *pFencedAttrTokenMap;
- SvXMLTokenMap *pOperatorAttrTokenMap;
- SvXMLTokenMap *pAnnotationAttrTokenMap;
- SvXMLTokenMap *pPresElemTokenMap;
- SvXMLTokenMap *pPresScriptEmptyElemTokenMap;
- SvXMLTokenMap *pPresTableElemTokenMap;
- SvXMLTokenMap *pColorTokenMap;
- SvXMLTokenMap *pActionAttrTokenMap;
+ std::unique_ptr<SvXMLTokenMap> pPresLayoutElemTokenMap;
+ std::unique_ptr<SvXMLTokenMap> pPresLayoutAttrTokenMap;
+ std::unique_ptr<SvXMLTokenMap> pFencedAttrTokenMap;
+ std::unique_ptr<SvXMLTokenMap> pOperatorAttrTokenMap;
+ std::unique_ptr<SvXMLTokenMap> pAnnotationAttrTokenMap;
+ std::unique_ptr<SvXMLTokenMap> pPresElemTokenMap;
+ std::unique_ptr<SvXMLTokenMap> pPresScriptEmptyElemTokenMap;
+ std::unique_ptr<SvXMLTokenMap> pPresTableElemTokenMap;
+ std::unique_ptr<SvXMLTokenMap> pColorTokenMap;
+ std::unique_ptr<SvXMLTokenMap> pActionAttrTokenMap;
SmNodeStack aNodeStack;
bool bSuccess;
More information about the Libreoffice-commits
mailing list