diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-08-07 15:35:01 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-08-07 16:52:08 +0200 |
commit | febd02b705c06929810835c5e2f677bfc91fb52c (patch) | |
tree | a74054ecf85fa840cb3c860101fa86e12624e9e6 /xmloff/source | |
parent | 18c502b0049a5330f870ad43e1c49b46cbae81fc (diff) |
xmloff: replace boost::ptr_set with std::set<std::unique_ptr>
boost::ptr_set was actually quite nice here, pity about the obnoxious
warnings...
Change-Id: I46973635fd26e4f1db96f2806c211b83436bef5e
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/style/impastpl.cxx | 35 | ||||
-rw-r--r-- | xmloff/source/style/impastpl.hxx | 70 |
2 files changed, 57 insertions, 48 deletions
diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx index c0054f0afa39..7c98e3ed7c20 100644 --- a/xmloff/source/style/impastpl.cxx +++ b/xmloff/source/style/impastpl.cxx @@ -60,7 +60,7 @@ XMLAutoStyleFamily::~XMLAutoStyleFamily() {} void XMLAutoStyleFamily::ClearEntries() { - maParentSet.clear(); + m_ParentSet.clear(); } static OUString @@ -506,16 +506,17 @@ bool SvXMLAutoStylePoolP_Impl::Add( XMLAutoStyleFamily &rFamily = **iter; - XMLAutoStylePoolParent aTmp(rParentName); - XMLAutoStyleFamily::ParentSetType::iterator it2 = rFamily.maParentSet.find(aTmp); - if (it2 == rFamily.maParentSet.end()) + std::unique_ptr<XMLAutoStylePoolParent> pTmp(new XMLAutoStylePoolParent(rParentName)); + auto it2 = rFamily.m_ParentSet.find(pTmp); + if (it2 == rFamily.m_ParentSet.end()) { std::pair<XMLAutoStyleFamily::ParentSetType::iterator,bool> r = - rFamily.maParentSet.insert(new XMLAutoStylePoolParent(rParentName)); + rFamily.m_ParentSet.insert(std::unique_ptr<XMLAutoStylePoolParent>( + new XMLAutoStylePoolParent(rParentName))); it2 = r.first; } - XMLAutoStylePoolParent& rParent = *it2; + XMLAutoStylePoolParent& rParent = **it2; bool bRet = false; if (rParent.Add(rFamily, rProperties, rName, bDontSeek)) @@ -539,16 +540,17 @@ bool SvXMLAutoStylePoolP_Impl::AddNamed( XMLAutoStyleFamily &rFamily = **iter; - XMLAutoStylePoolParent aTmp(rParentName); - XMLAutoStyleFamily::ParentSetType::iterator it2 = rFamily.maParentSet.find(aTmp); - if (it2 == rFamily.maParentSet.end()) + std::unique_ptr<XMLAutoStylePoolParent> pTmp(new XMLAutoStylePoolParent(rParentName)); + auto it2 = rFamily.m_ParentSet.find(pTmp); + if (it2 == rFamily.m_ParentSet.end()) { std::pair<XMLAutoStyleFamily::ParentSetType::iterator,bool> r = - rFamily.maParentSet.insert(new XMLAutoStylePoolParent(rParentName)); + rFamily.m_ParentSet.insert(std::unique_ptr<XMLAutoStylePoolParent>( + new XMLAutoStylePoolParent(rParentName))); it2 = r.first; } - XMLAutoStylePoolParent& rParent = *it2; + XMLAutoStylePoolParent& rParent = **it2; bool bRet = false; if (rParent.AddNamed(rFamily, rProperties, rName)) @@ -575,11 +577,11 @@ OUString SvXMLAutoStylePoolP_Impl::Find( sal_Int32 nFamily, assert(iter != m_FamilySet.end()); // family must be known XMLAutoStyleFamily const& rFamily = **iter; - XMLAutoStylePoolParent aTmp( rParent ); - XMLAutoStyleFamily::ParentSetType::const_iterator it2 = rFamily.maParentSet.find(aTmp); - if (it2 != rFamily.maParentSet.end()) + std::unique_ptr<XMLAutoStylePoolParent> pTmp(new XMLAutoStylePoolParent(rParent)); + auto const it2 = rFamily.m_ParentSet.find(pTmp); + if (it2 != rFamily.m_ParentSet.end()) { - sName = it2->Find(rFamily, rProperties); + sName = (*it2)->Find(rFamily, rProperties); } return sName; @@ -628,8 +630,7 @@ void SvXMLAutoStylePoolP_Impl::exportXML( // which contains a parent-name and a SvXMLAutoStylePoolProperties_Impl std::vector<AutoStylePoolExport> aExpStyles(nCount); - XMLAutoStyleFamily::ParentSetType::iterator it = rFamily.maParentSet.begin(), itEnd = rFamily.maParentSet.end(); - for (; it != itEnd; ++it) + for (auto const& it : rFamily.m_ParentSet) { XMLAutoStylePoolParent& rParent = *it; size_t nProperties = rParent.GetPropertiesList().size(); diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx index 50932815c374..09893899a528 100644 --- a/xmloff/source/style/impastpl.hxx +++ b/xmloff/source/style/impastpl.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_XMLOFF_SOURCE_STYLE_IMPASTPL_HXX #define INCLUDED_XMLOFF_SOURCE_STYLE_IMPASTPL_HXX -#include <boost/ptr_container/ptr_set.hpp> #include <sal/types.h> #include <rtl/ustring.hxx> #include <set> @@ -37,39 +36,10 @@ class SvXMLAutoStylePoolP; class XMLAutoStylePoolParent; +class XMLAutoStyleFamily; class SvXMLExportPropertyMapper; class SvXMLExport; -// Implementationclass for stylefamily-information - -struct XMLAutoStyleFamily : boost::noncopyable -{ - typedef boost::ptr_set<XMLAutoStylePoolParent> ParentSetType; - typedef std::set<OUString> NameSetType; - - sal_uInt32 mnFamily; - OUString maStrFamilyName; - rtl::Reference < SvXMLExportPropertyMapper > mxMapper; - - ParentSetType maParentSet; - NameSetType maNameSet; - sal_uInt32 mnCount; - sal_uInt32 mnName; - OUString maStrPrefix; - bool mbAsFamily; - - XMLAutoStyleFamily( sal_Int32 nFamily, const OUString& rStrName, - const rtl::Reference<SvXMLExportPropertyMapper>& rMapper, - const OUString& rStrPrefix, bool bAsFamily = true ); - - explicit XMLAutoStyleFamily( sal_Int32 nFamily ); - ~XMLAutoStyleFamily(); - - friend bool operator<(const XMLAutoStyleFamily& r1, const XMLAutoStyleFamily& r2); - - void ClearEntries(); -}; - // Properties of a pool class XMLAutoStylePoolProperties @@ -128,6 +98,44 @@ public: bool operator< (const XMLAutoStylePoolParent& rOther) const; }; +// Implementationclass for stylefamily-information + +struct XMLAutoStyleFamily : boost::noncopyable +{ + struct XMLAutoStylePoolParent_Less + { + bool operator()(std::unique_ptr<XMLAutoStylePoolParent> const& lhs, + std::unique_ptr<XMLAutoStylePoolParent> const& rhs) const + { + return (*lhs) < (*rhs); + } + }; + typedef std::set<std::unique_ptr<XMLAutoStylePoolParent>, XMLAutoStylePoolParent_Less> ParentSetType; + typedef std::set<OUString> NameSetType; + + sal_uInt32 mnFamily; + OUString maStrFamilyName; + rtl::Reference<SvXMLExportPropertyMapper> mxMapper; + + ParentSetType m_ParentSet; + NameSetType maNameSet; + sal_uInt32 mnCount; + sal_uInt32 mnName; + OUString maStrPrefix; + bool mbAsFamily; + + XMLAutoStyleFamily( sal_Int32 nFamily, const OUString& rStrName, + const rtl::Reference<SvXMLExportPropertyMapper>& rMapper, + const OUString& rStrPrefix, bool bAsFamily = true ); + + explicit XMLAutoStyleFamily( sal_Int32 nFamily ); + ~XMLAutoStyleFamily(); + + friend bool operator<(const XMLAutoStyleFamily& r1, const XMLAutoStyleFamily& r2); + + void ClearEntries(); +}; + // Implementationclass of SvXMLAutoStylePool class SvXMLAutoStylePoolP_Impl |