include/xmloff/SinglePropertySetInfoCache.hxx | 6 - include/xmloff/namespacemap.hxx | 18 ++-- include/xmloff/xmlaustp.hxx | 2 sc/source/filter/xml/sheetdata.cxx | 6 - xmloff/source/core/namespacemap.cxx | 82 ++++++++++----------- xmloff/source/style/SinglePropertySetInfoCache.cxx | 8 +- xmloff/source/style/xmlaustp.cxx | 32 ++++---- 7 files changed, 77 insertions(+), 77 deletions(-)
New commits: commit 40b6224780284d0e7fa542698bd17586a525159b Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Mar 27 09:41:02 2023 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Mar 27 11:29:28 2023 +0000 xmloff: prefix members of NameSpaceEntry, SinglePropertySetInfoCache, ... ... SvXMLAutoStylePoolP and SvXMLNamespaceMap See tdf#94879 for motivation. Change-Id: I306ceadd6d3753b76188fed3707b4df63c10bb8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149621 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/include/xmloff/SinglePropertySetInfoCache.hxx b/include/xmloff/SinglePropertySetInfoCache.hxx index 45f4edf6d44e..891d2e4974e2 100644 --- a/include/xmloff/SinglePropertySetInfoCache.hxx +++ b/include/xmloff/SinglePropertySetInfoCache.hxx @@ -35,8 +35,8 @@ class SinglePropertySetInfoCache typedef std::map<css::uno::Reference<css::beans::XPropertySetInfo>, bool> Map; - OUString sName; - Map map_; + OUString m_sName; + Map m_Map; public: @@ -52,7 +52,7 @@ public: inline SinglePropertySetInfoCache::SinglePropertySetInfoCache( OUString _sName ) : - sName(std::move( _sName )) + m_sName(std::move( _sName )) { } diff --git a/include/xmloff/namespacemap.hxx b/include/xmloff/namespacemap.hxx index 51e741fb85d8..6fbc389bd7ee 100644 --- a/include/xmloff/namespacemap.hxx +++ b/include/xmloff/namespacemap.hxx @@ -42,15 +42,15 @@ class NameSpaceEntry final { public: // sName refers to the full namespace name - OUString sName; + OUString m_sName; // sPrefix is the prefix used to declare a given item to be from a given namespace - OUString sPrefix; + OUString m_sPrefix; // nKey is the unique identifier of a namespace - sal_uInt16 nKey; + sal_uInt16 m_nKey; bool operator==(NameSpaceEntry const & rhs) const { - return sName == rhs.sName && sPrefix == rhs.sPrefix && nKey == rhs.nKey; + return m_sName == rhs.m_sName && m_sPrefix == rhs.m_sPrefix && m_nKey == rhs.m_nKey; } }; @@ -82,12 +82,12 @@ typedef std::unordered_map < sal_uInt16, KeyToNameSpaceMapEntry > KeyToNameSpace class XMLOFF_DLLPUBLIC SvXMLNamespaceMap { - OUString sXMLNS; + OUString m_sXMLNS; - NameSpaceHash aNameHash; - mutable NameSpaceHash aNameCache; + NameSpaceHash m_aNameHash; + mutable NameSpaceHash m_aNameCache; KeyToNameSpaceMap maKeyToNamespaceMap; - mutable QNameCache aQNameCache; + mutable QNameCache m_aQNameCache; SAL_DLLPRIVATE sal_uInt16 Add_( const OUString& rPrefix, const OUString &rName, sal_uInt16 nKey ); public: @@ -134,7 +134,7 @@ public: /* Give access to all namespace definitions, including multiple entries for the same key (needed for saving sheets separately in Calc). This might be replaced by a better interface later. */ - const NameSpaceHash& GetAllEntries() const { return aNameHash; } + const NameSpaceHash& GetAllEntries() const { return m_aNameHash; } void Clear(); diff --git a/include/xmloff/xmlaustp.hxx b/include/xmloff/xmlaustp.hxx index bc21450eef65..2051e7ac43e2 100644 --- a/include/xmloff/xmlaustp.hxx +++ b/include/xmloff/xmlaustp.hxx @@ -51,7 +51,7 @@ class XMLOFF_DLLPUBLIC SvXMLAutoStylePoolP : public salhelper::SimpleReferenceOb friend class Test; friend class SvXMLAutoStylePoolP_Impl; - std::unique_ptr<SvXMLAutoStylePoolP_Impl> pImpl; + std::unique_ptr<SvXMLAutoStylePoolP_Impl> m_pImpl; protected: diff --git a/sc/source/filter/xml/sheetdata.cxx b/sc/source/filter/xml/sheetdata.cxx index 51ae5c3aaf97..bfd9abe5e598 100644 --- a/sc/source/filter/xml/sheetdata.cxx +++ b/sc/source/filter/xml/sheetdata.cxx @@ -191,7 +191,7 @@ void ScSheetSaveData::StoreLoadedNamespaces( const SvXMLNamespaceMap& rNamespace // ignore the initial namespaces if ( maInitialPrefixes.find( rName ) == maInitialPrefixes.end() ) { - maLoadedNamespaces.emplace_back( rEntry.sPrefix, rEntry.sName, rEntry.nKey ); + maLoadedNamespaces.emplace_back( rEntry.m_sPrefix, rEntry.m_sName, rEntry.m_nKey ); } } } @@ -199,7 +199,7 @@ void ScSheetSaveData::StoreLoadedNamespaces( const SvXMLNamespaceMap& rNamespace static bool lcl_NameInHash( const NameSpaceHash& rNameHash, const OUString& rName ) { return std::any_of(rNameHash.begin(), rNameHash.end(), - [&rName](const NameSpaceHash::value_type& rEntry) { return rEntry.second.sName == rName; }); + [&rName](const NameSpaceHash::value_type& rEntry) { return rEntry.second.m_sName == rName; }); } bool ScSheetSaveData::AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) const @@ -214,7 +214,7 @@ bool ScSheetSaveData::AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) cons NameSpaceHash::const_iterator aHashIter = rNameHash.find( rLoadedNamespace.maPrefix ); // same prefix, but different name: loaded namespaces can't be used - bool bNameConflict = (aHashIter != rNameHash.end()) && (aHashIter->second.sName != rLoadedNamespace.maName); + bool bNameConflict = (aHashIter != rNameHash.end()) && (aHashIter->second.m_sName != rLoadedNamespace.maName); // a second prefix for the same name would confuse SvXMLNamespaceMap lookup, // so this is also considered a conflict diff --git a/xmloff/source/core/namespacemap.cxx b/xmloff/source/core/namespacemap.cxx index c6fbb1d5d845..84668a612dfe 100644 --- a/xmloff/source/core/namespacemap.cxx +++ b/xmloff/source/core/namespacemap.cxx @@ -50,23 +50,23 @@ using namespace ::xmloff::token; const OUString sEmpty; SvXMLNamespaceMap::SvXMLNamespaceMap() -: sXMLNS( GetXMLToken ( XML_XMLNS ) ) +: m_sXMLNS( GetXMLToken ( XML_XMLNS ) ) { // approx worst-case size - aNameHash.reserve(20); + m_aNameHash.reserve(20); maKeyToNamespaceMap.reserve(20); } SvXMLNamespaceMap::SvXMLNamespaceMap( const SvXMLNamespaceMap& rMap ) -: sXMLNS( GetXMLToken ( XML_XMLNS ) ) +: m_sXMLNS( GetXMLToken ( XML_XMLNS ) ) { - aNameHash = rMap.aNameHash; + m_aNameHash = rMap.m_aNameHash; maKeyToNamespaceMap = rMap.maKeyToNamespaceMap; } SvXMLNamespaceMap& SvXMLNamespaceMap::operator=( const SvXMLNamespaceMap& rMap ) { - aNameHash = rMap.aNameHash; + m_aNameHash = rMap.m_aNameHash; maKeyToNamespaceMap = rMap.maKeyToNamespaceMap; return *this; } @@ -77,16 +77,16 @@ SvXMLNamespaceMap::~SvXMLNamespaceMap() void SvXMLNamespaceMap::Clear() { - aNameHash.clear(); - aNameCache.clear(); + m_aNameHash.clear(); + m_aNameCache.clear(); maKeyToNamespaceMap.clear(); - aQNameCache.clear(); + m_aQNameCache.clear(); } bool SvXMLNamespaceMap::operator ==( const SvXMLNamespaceMap& rCmp ) const { - return aNameHash == rCmp.aNameHash; + return m_aNameHash == rCmp.m_aNameHash; } sal_uInt16 SvXMLNamespaceMap::Add_( const OUString& rPrefix, const OUString &rName, sal_uInt16 nKey ) @@ -104,7 +104,7 @@ sal_uInt16 SvXMLNamespaceMap::Add_( const OUString& rPrefix, const OUString &rNa } while ( true ); } - aNameHash.insert_or_assign( rPrefix, NameSpaceEntry{ rName, rPrefix, nKey} ); + m_aNameHash.insert_or_assign( rPrefix, NameSpaceEntry{ rName, rPrefix, nKey} ); maKeyToNamespaceMap.insert_or_assign( nKey, KeyToNameSpaceMapEntry{ rName, rPrefix} ); return nKey; } @@ -122,7 +122,7 @@ sal_uInt16 SvXMLNamespaceMap::Add( const OUString& rPrefix, const OUString& rNam assert(XML_NAMESPACE_NONE != nKey); #endif - if ( aNameHash.find ( rPrefix ) == aNameHash.end() ) + if ( m_aNameHash.find ( rPrefix ) == m_aNameHash.end() ) nKey = Add_( rPrefix, rName, nKey ); return nKey; @@ -141,8 +141,8 @@ sal_uInt16 SvXMLNamespaceMap::AddIfKnown( const OUString& rPrefix, const OUStrin if( XML_NAMESPACE_UNKNOWN != nKey ) { - NameSpaceHash::const_iterator aIter = aNameHash.find( rPrefix ); - if( aIter == aNameHash.end() || (*aIter).second.sName != rName ) + NameSpaceHash::const_iterator aIter = m_aNameHash.find( rPrefix ); + if( aIter == m_aNameHash.end() || (*aIter).second.m_sName != rName ) nKey = Add_( rPrefix, rName, nKey ); } @@ -152,18 +152,18 @@ sal_uInt16 SvXMLNamespaceMap::AddIfKnown( const OUString& rPrefix, const OUStrin sal_uInt16 SvXMLNamespaceMap::GetKeyByPrefix( const OUString& rPrefix ) const { - NameSpaceHash::const_iterator aIter = aNameHash.find(rPrefix); - return (aIter != aNameHash.end()) ? (*aIter).second.nKey : USHRT_MAX; + NameSpaceHash::const_iterator aIter = m_aNameHash.find(rPrefix); + return (aIter != m_aNameHash.end()) ? (*aIter).second.m_nKey : USHRT_MAX; } sal_uInt16 SvXMLNamespaceMap::GetKeyByName( const OUString& rName ) const { sal_uInt16 nKey = XML_NAMESPACE_UNKNOWN; - auto aIter = std::find_if(aNameHash.cbegin(), aNameHash.cend(), - [&rName](const NameSpaceHash::value_type& rEntry) { return rEntry.second.sName == rName; }); + auto aIter = std::find_if(m_aNameHash.cbegin(), m_aNameHash.cend(), + [&rName](const NameSpaceHash::value_type& rEntry) { return rEntry.second.m_sName == rName; }); - if (aIter != aNameHash.cend()) - nKey = (*aIter).second.nKey; + if (aIter != m_aNameHash.cend()) + nKey = (*aIter).second.m_nKey; return nKey; } @@ -188,9 +188,9 @@ OUString SvXMLNamespaceMap::GetAttrNameByKey( sal_uInt16 nKey ) const const OUString & prefix( (*aIter).second.sPrefix ); if (prefix.isEmpty()) // default namespace - return sXMLNS; + return m_sXMLNS; - return sXMLNS + ":" + prefix; + return m_sXMLNS + ":" + prefix; } OUString SvXMLNamespaceMap::GetQNameByKey( sal_uInt16 nKey, @@ -213,7 +213,7 @@ OUString SvXMLNamespaceMap::GetQNameByKey( sal_uInt16 nKey, // ...if it's in the xmlns namespace, make the prefix // don't bother caching this, it rarely happens OUStringBuffer sQName; - sQName.append ( sXMLNS ); + sQName.append ( m_sXMLNS ); if (!rLocalName.isEmpty()) // not default namespace { sQName.append ( ':' ); @@ -230,10 +230,10 @@ OUString SvXMLNamespaceMap::GetQNameByKey( sal_uInt16 nKey, { QNameCache::const_iterator aQCacheIter; if (bCache) - aQCacheIter = aQNameCache.find ( QNamePair ( nKey, rLocalName ) ); + aQCacheIter = m_aQNameCache.find ( QNamePair ( nKey, rLocalName ) ); else - aQCacheIter = aQNameCache.end(); - if ( aQCacheIter != aQNameCache.end() ) + aQCacheIter = m_aQNameCache.end(); + if ( aQCacheIter != m_aQNameCache.end() ) return (*aQCacheIter).second; else { @@ -252,7 +252,7 @@ OUString SvXMLNamespaceMap::GetQNameByKey( sal_uInt16 nKey, if (bCache) { OUString sString(sQName.makeStringAndClear()); - aQNameCache.emplace(QNamePair(nKey, rLocalName), sString); + m_aQNameCache.emplace(QNamePair(nKey, rLocalName), sString); return sString; } else @@ -291,17 +291,17 @@ sal_uInt16 SvXMLNamespaceMap::GetKeyByQName(const OUString& rQName, NameSpaceHash::const_iterator it; if (eMode == QNameMode::AttrNameCached) - it = aNameCache.find ( rQName ); + it = m_aNameCache.find ( rQName ); else - it = aNameCache.end(); - if ( it != aNameCache.end() ) + it = m_aNameCache.end(); + if ( it != m_aNameCache.end() ) { const NameSpaceEntry &rEntry = (*it).second; if ( pPrefix ) - *pPrefix = rEntry.sPrefix; + *pPrefix = rEntry.m_sPrefix; if ( pLocalName ) - *pLocalName = rEntry.sName; - nKey = rEntry.nKey; + *pLocalName = rEntry.m_sName; + nKey = rEntry.m_nKey; if ( pNamespace ) { auto aMapIter = maKeyToNamespaceMap.find (nKey); @@ -337,15 +337,15 @@ sal_uInt16 SvXMLNamespaceMap::GetKeyByQName(const OUString& rQName, if( pLocalName ) *pLocalName = sEntryName; - NameSpaceHash::const_iterator aIter = aNameHash.find( sEntryPrefix ); - if ( aIter != aNameHash.end() ) + NameSpaceHash::const_iterator aIter = m_aNameHash.find( sEntryPrefix ); + if ( aIter != m_aNameHash.end() ) { // found: retrieve namespace key - nKey = (*aIter).second.nKey; + nKey = (*aIter).second.m_nKey; if ( pNamespace ) - *pNamespace = (*aIter).second.sName; + *pNamespace = (*aIter).second.m_sName; } - else if ( sEntryPrefix == sXMLNS ) + else if ( sEntryPrefix == m_sXMLNS ) // not found, but xmlns prefix: return xmlns 'namespace' nKey = XML_NAMESPACE_XMLNS; else if( nColonPos == -1 ) @@ -356,7 +356,7 @@ sal_uInt16 SvXMLNamespaceMap::GetKeyByQName(const OUString& rQName, if (eMode == QNameMode::AttrNameCached) { - aNameCache.insert_or_assign(rQName, NameSpaceEntry{std::move(sEntryName), std::move(sEntryPrefix), nKey}); + m_aNameCache.insert_or_assign(rQName, NameSpaceEntry{std::move(sEntryName), std::move(sEntryPrefix), nKey}); } } @@ -399,7 +399,7 @@ void SvXMLNamespaceMap::AddAtIndex( const OUString& rPrefix, nKey = GetKeyByName( rName ); assert(XML_NAMESPACE_NONE != nKey); - if( XML_NAMESPACE_NONE != nKey && ! ( aNameHash.count ( rPrefix ) ) ) + if( XML_NAMESPACE_NONE != nKey && ! ( m_aNameHash.count ( rPrefix ) ) ) { Add_( rPrefix, rName, nKey ); } @@ -424,8 +424,8 @@ const OUString& SvXMLNamespaceMap::GetNameByIndex( sal_uInt16 nIdx ) const sal_uInt16 SvXMLNamespaceMap::GetIndexByPrefix( const OUString& rPrefix ) const { - NameSpaceHash::const_iterator aIter = aNameHash.find(rPrefix); - return (aIter != aNameHash.end()) ? (*aIter).second.nKey : USHRT_MAX; + NameSpaceHash::const_iterator aIter = m_aNameHash.find(rPrefix); + return (aIter != m_aNameHash.end()) ? (*aIter).second.m_nKey : USHRT_MAX; } sal_uInt16 SvXMLNamespaceMap::GetKeyByAttrName( const OUString& rAttrName, diff --git a/xmloff/source/style/SinglePropertySetInfoCache.cxx b/xmloff/source/style/SinglePropertySetInfoCache.cxx index 1bc06ef4d8e4..be81c02c8e58 100644 --- a/xmloff/source/style/SinglePropertySetInfoCache.cxx +++ b/xmloff/source/style/SinglePropertySetInfoCache.cxx @@ -31,12 +31,12 @@ bool SinglePropertySetInfoCache::hasProperty( { if( !rPropSetInfo.is() ) rPropSetInfo = rPropSet->getPropertySetInfo(); - Map::iterator aIter = map_.find( rPropSetInfo ); - if( aIter != map_.end() ) + Map::iterator aIter = m_Map.find( rPropSetInfo ); + if( aIter != m_Map.end() ) { return (*aIter).second; } - bool bRet = rPropSetInfo->hasPropertyByName( sName ); + bool bRet = rPropSetInfo->hasPropertyByName( m_sName ); // Check whether the property set info is destroyed if it is assigned to a // weak reference only; if it is destroyed, then every instance of // getPropertySetInfo returns a new object; Such property set infos must not @@ -46,7 +46,7 @@ bool SinglePropertySetInfoCache::hasProperty( rPropSetInfo = xWeakInfo; if( rPropSetInfo.is() ) { - map_.emplace(rPropSetInfo, bRet); + m_Map.emplace(rPropSetInfo, bRet); } return bRet; } diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx index 47bba649b968..f3fe0c8167c2 100644 --- a/xmloff/source/style/xmlaustp.cxx +++ b/xmloff/source/style/xmlaustp.cxx @@ -254,7 +254,7 @@ void SvXMLAutoStylePoolP::exportStyleContent( } SvXMLAutoStylePoolP::SvXMLAutoStylePoolP( SvXMLExport& rExport ) - : pImpl( new SvXMLAutoStylePoolP_Impl( rExport ) ) + : m_pImpl( new SvXMLAutoStylePoolP_Impl( rExport ) ) { } @@ -264,7 +264,7 @@ SvXMLAutoStylePoolP::~SvXMLAutoStylePoolP() SvXMLExport& SvXMLAutoStylePoolP::GetExport() const { - return pImpl->GetExport(); + return m_pImpl->GetExport(); } // TODO: remove this @@ -285,33 +285,33 @@ void SvXMLAutoStylePoolP::AddFamily( const OUString& rStrPrefix, bool bAsFamily ) { - pImpl->AddFamily( nFamily, rStrName, rMapper, rStrPrefix, bAsFamily ); + m_pImpl->AddFamily( nFamily, rStrName, rMapper, rStrPrefix, bAsFamily ); } void SvXMLAutoStylePoolP::SetFamilyPropSetMapper( XmlStyleFamily nFamily, const rtl::Reference < SvXMLExportPropertyMapper > & rMapper ) { - pImpl->SetFamilyPropSetMapper( nFamily, rMapper ); + m_pImpl->SetFamilyPropSetMapper( nFamily, rMapper ); } void SvXMLAutoStylePoolP::RegisterName( XmlStyleFamily nFamily, const OUString& rName ) { - pImpl->RegisterName( nFamily, rName ); + m_pImpl->RegisterName( nFamily, rName ); } void SvXMLAutoStylePoolP::RegisterDefinedName( XmlStyleFamily nFamily, const OUString& rName ) { - pImpl->RegisterDefinedName( nFamily, rName ); + m_pImpl->RegisterDefinedName( nFamily, rName ); } void SvXMLAutoStylePoolP::GetRegisteredNames( uno::Sequence<sal_Int32>& rFamilies, uno::Sequence<OUString>& rNames ) { - pImpl->GetRegisteredNames( rFamilies, rNames ); + m_pImpl->GetRegisteredNames( rFamilies, rNames ); } void SvXMLAutoStylePoolP::RegisterNames( @@ -331,14 +331,14 @@ void SvXMLAutoStylePoolP::RegisterNames( /// retrieve the names of the properties used in the styles css::uno::Sequence<OUString> SvXMLAutoStylePoolP::GetPropertyNames( ) { - return pImpl->GetPropertyNames(); + return m_pImpl->GetPropertyNames(); } OUString SvXMLAutoStylePoolP::Add( XmlStyleFamily nFamily, std::vector< XMLPropertyState >&& rProperties ) { OUString sName; - pImpl->Add(sName, nFamily, "", std::move(rProperties) ); + m_pImpl->Add(sName, nFamily, "", std::move(rProperties) ); return sName; } @@ -347,42 +347,42 @@ OUString SvXMLAutoStylePoolP::Add( XmlStyleFamily nFamily, std::vector< XMLPropertyState >&& rProperties, bool bDontSeek ) { OUString sName; - pImpl->Add(sName, nFamily, rParent, std::move(rProperties), bDontSeek); + m_pImpl->Add(sName, nFamily, rParent, std::move(rProperties), bDontSeek); return sName; } bool SvXMLAutoStylePoolP::Add(OUString& rName, XmlStyleFamily nFamily, const OUString& rParent, ::std::vector< XMLPropertyState >&& rProperties ) { - return pImpl->Add(rName, nFamily, rParent, std::move(rProperties)); + return m_pImpl->Add(rName, nFamily, rParent, std::move(rProperties)); } bool SvXMLAutoStylePoolP::AddNamed( const OUString& rName, XmlStyleFamily nFamily, const OUString& rParent, std::vector< XMLPropertyState > rProperties ) { - return pImpl->AddNamed(rName, nFamily, rParent, std::move(rProperties)); + return m_pImpl->AddNamed(rName, nFamily, rParent, std::move(rProperties)); } OUString SvXMLAutoStylePoolP::Find( XmlStyleFamily nFamily, const OUString& rParent, const std::vector< XMLPropertyState >& rProperties ) const { - return pImpl->Find( nFamily, rParent, rProperties ); + return m_pImpl->Find( nFamily, rParent, rProperties ); } void SvXMLAutoStylePoolP::exportXML( XmlStyleFamily nFamily ) const { - pImpl->exportXML( nFamily, this ); + m_pImpl->exportXML( nFamily, this ); } void SvXMLAutoStylePoolP::ClearEntries() { - pImpl->ClearEntries(); + m_pImpl->ClearEntries(); } std::vector<xmloff::AutoStyleEntry> SvXMLAutoStylePoolP::GetAutoStyleEntries() const { - return pImpl->GetAutoStyleEntries(); + return m_pImpl->GetAutoStyleEntries(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */