diff options
Diffstat (limited to 'i18npool/source/localedata')
-rw-r--r-- | i18npool/source/localedata/LocaleNode.cxx | 4 | ||||
-rw-r--r-- | i18npool/source/localedata/LocaleNode.hxx | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index a17ff49cefcf..5d3e29a3531c 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -73,7 +73,7 @@ void LocaleNode::printR () const { } void LocaleNode::addChild ( LocaleNode * node) { - children.push_back(node); + children.emplace_back(node); node->parent = this; } @@ -99,8 +99,6 @@ const LocaleNode * LocaleNode::findNode ( const sal_Char *name) const { LocaleNode::~LocaleNode() { - for (size_t i=0; i < children.size(); ++i) - delete children[i]; } LocaleNode* LocaleNode::createNode (const OUString& name, const Reference< XAttributeList > & attr) diff --git a/i18npool/source/localedata/LocaleNode.hxx b/i18npool/source/localedata/LocaleNode.hxx index c3e6c57e6a22..0f089d162bf3 100644 --- a/i18npool/source/localedata/LocaleNode.hxx +++ b/i18npool/source/localedata/LocaleNode.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> #include <vector> +#include <memory> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/xml/sax/SAXParseException.hpp> @@ -85,7 +86,7 @@ class LocaleNode OUString aValue; Attr aAttribs; LocaleNode * parent; - std::vector<LocaleNode*> children; + std::vector<std::unique_ptr<LocaleNode>> children; protected: mutable int nError; @@ -97,7 +98,7 @@ public: const OUString& getValue() const { return aValue; }; const Attr& getAttr() const { return aAttribs; }; sal_Int32 getNumberOfChildren () const { return sal_Int32(children.size()); }; - LocaleNode * getChildAt (sal_Int32 idx) const { return children[idx] ; }; + LocaleNode * getChildAt (sal_Int32 idx) const { return children[idx].get(); }; const LocaleNode * findNode ( const sal_Char *name) const; void print () const; void printR () const; |