Kaydet (Commit) fa90bbb7 authored tarafından Michael Stahl's avatar Michael Stahl

sc: replace boost::ptr_map with std::map<std::unique_ptr>

Change-Id: I32ab5eb985bd55d9194f3bff4739614cb6e93516
üst 742bcd2b
...@@ -103,7 +103,7 @@ void ScHTMLStyles::add(const char* pElemName, size_t nElemName, const char* pCla ...@@ -103,7 +103,7 @@ void ScHTMLStyles::add(const char* pElemName, size_t nElemName, const char* pCla
else else
{ {
// Element name only. Add it to the element global. // Element name only. Add it to the element global.
insertProp(maElemGlobalProps, aElem, aProp, aValue); insertProp(m_ElemGlobalProps, aElem, aProp, aValue);
} }
} }
else else
...@@ -113,7 +113,7 @@ void ScHTMLStyles::add(const char* pElemName, size_t nElemName, const char* pCla ...@@ -113,7 +113,7 @@ void ScHTMLStyles::add(const char* pElemName, size_t nElemName, const char* pCla
// Class name only. Add it to the global. // Class name only. Add it to the global.
OUString aClass(pClassName, nClassName, RTL_TEXTENCODING_UTF8); OUString aClass(pClassName, nClassName, RTL_TEXTENCODING_UTF8);
aClass = aClass.toAsciiLowerCase(); aClass = aClass.toAsciiLowerCase();
insertProp(maGlobalProps, aClass, aProp, aValue); insertProp(m_GlobalProps, aClass, aProp, aValue);
} }
} }
} }
...@@ -130,7 +130,7 @@ const OUString& ScHTMLStyles::getPropertyValue( ...@@ -130,7 +130,7 @@ const OUString& ScHTMLStyles::getPropertyValue(
NamePropsType::const_iterator itr2 = pClasses->find(rClass); NamePropsType::const_iterator itr2 = pClasses->find(rClass);
if (itr2 != pClasses->end()) if (itr2 != pClasses->end())
{ {
const PropsType* pProps = itr2->second; const PropsType *const pProps = itr2->second.get();
PropsType::const_iterator itr3 = pProps->find(rPropName); PropsType::const_iterator itr3 = pProps->find(rPropName);
if (itr3 != pProps->end()) if (itr3 != pProps->end())
return itr3->second; return itr3->second;
...@@ -139,10 +139,10 @@ const OUString& ScHTMLStyles::getPropertyValue( ...@@ -139,10 +139,10 @@ const OUString& ScHTMLStyles::getPropertyValue(
} }
// Next, look into the class global storage. // Next, look into the class global storage.
{ {
NamePropsType::const_iterator itr = maGlobalProps.find(rClass); auto const itr = m_GlobalProps.find(rClass);
if (itr != maGlobalProps.end()) if (itr != m_GlobalProps.end())
{ {
const PropsType* pProps = itr->second; const PropsType *const pProps = itr->second.get();
PropsType::const_iterator itr2 = pProps->find(rPropName); PropsType::const_iterator itr2 = pProps->find(rPropName);
if (itr2 != pProps->end()) if (itr2 != pProps->end())
return itr2->second; return itr2->second;
...@@ -150,10 +150,10 @@ const OUString& ScHTMLStyles::getPropertyValue( ...@@ -150,10 +150,10 @@ const OUString& ScHTMLStyles::getPropertyValue(
} }
// As the last resort, look into the element global storage. // As the last resort, look into the element global storage.
{ {
NamePropsType::const_iterator itr = maElemGlobalProps.find(rClass); auto const itr = m_ElemGlobalProps.find(rClass);
if (itr != maElemGlobalProps.end()) if (itr != m_ElemGlobalProps.end())
{ {
const PropsType* pProps = itr->second; const PropsType *const pProps = itr->second.get();
PropsType::const_iterator itr2 = pProps->find(rPropName); PropsType::const_iterator itr2 = pProps->find(rPropName);
if (itr2 != pProps->end()) if (itr2 != pProps->end())
return itr2->second; return itr2->second;
...@@ -172,7 +172,8 @@ void ScHTMLStyles::insertProp( ...@@ -172,7 +172,8 @@ void ScHTMLStyles::insertProp(
{ {
// new element // new element
std::unique_ptr<PropsType> p(new PropsType); std::unique_ptr<PropsType> p(new PropsType);
std::pair<NamePropsType::iterator, bool> r = o3tl::ptr_container::insert(rStore, aName, std::move(p)); std::pair<NamePropsType::iterator, bool> r =
rStore.insert(std::make_pair(aName, std::move(p)));
if (!r.second) if (!r.second)
// insertion failed. // insertion failed.
return; return;
...@@ -180,7 +181,7 @@ void ScHTMLStyles::insertProp( ...@@ -180,7 +181,7 @@ void ScHTMLStyles::insertProp(
itr = r.first; itr = r.first;
} }
PropsType* pProps = itr->second; PropsType *const pProps = itr->second.get();
pProps->insert(PropsType::value_type(aProp, aValue)); pProps->insert(PropsType::value_type(aProp, aValue));
} }
......
...@@ -49,11 +49,11 @@ class ScHTMLTable; ...@@ -49,11 +49,11 @@ class ScHTMLTable;
class ScHTMLStyles class ScHTMLStyles
{ {
typedef std::unordered_map<OUString, OUString, OUStringHash> PropsType; typedef std::unordered_map<OUString, OUString, OUStringHash> PropsType;
typedef ::boost::ptr_map<OUString, PropsType> NamePropsType; typedef ::std::map<OUString, std::unique_ptr<PropsType>> NamePropsType;
typedef ::boost::ptr_map<OUString, NamePropsType> ElemsType; typedef ::boost::ptr_map<OUString, NamePropsType> ElemsType;
NamePropsType maGlobalProps; /// global properties (for a given class for all elements) NamePropsType m_GlobalProps; /// global properties (for a given class for all elements)
NamePropsType maElemGlobalProps; /// element global properties (no class specified) NamePropsType m_ElemGlobalProps; /// element global properties (no class specified)
ElemsType maElemProps; /// element to class to properties (both element and class are given) ElemsType maElemProps; /// element to class to properties (both element and class are given)
const OUString maEmpty; /// just a persistent empty string. const OUString maEmpty; /// just a persistent empty string.
public: public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment